From bbf95805191f1538d500228b824a5ababbc40e05 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Fri, 23 Sep 2016 10:34:36 +0100 Subject: [PATCH] Let git handle line endings for us. --- .editorConfig | 30 +- .gitattributes | 29 + .gitignore | 80 +- .jshintrc | 88 +- README.txt | 204 +- l10n.properties | 8 +- license/alfresco_community/header.txt | 34 +- license/alfresco_community/license.txt | 330 +- license/licenses.properties | 2 +- rm-community/.editorConfig | 34 +- rm-community/.jshintrc | 88 +- rm-community/LICENSE.txt | 330 +- .../default/rm-imap-server-context.xml | 30 +- .../org_alfresco_module_rm/action-context.xml | 130 +- .../alfresco-global.properties | 176 +- .../org_alfresco_module_rm/audit/rm-audit.xml | 180 +- .../bootstrap/RMDataDictionaryBootstrap.xml | 506 +-- .../notify-records-due-for-review-email.ftl | 300 +- .../bootstrap/content/onCreate_supersedes.js | 82 +- .../content/record-rejected-email.ftl | 292 +- .../content/record-superseded-email.ftl | 288 +- .../bootstrap/content/recordsCustomModel.xml | 316 +- .../content/rmEventConfigBootstrap.json | 152 +- .../bootstrap/content/rma_isClosed.js | 76 +- .../report_rmr_destructionReport.html.ftl | 284 +- .../report/report_rmr_holdReport.html.ftl | 292 +- .../report/report_rmr_transferReport.html.ftl | 226 +- .../groups/rm-capability-groups-context.xml | 168 +- .../rm-capabilities-audit-context.xml | 144 +- .../rm-capabilities-condition-context.xml | 462 +-- .../rm-capabilities-config-context.xml | 186 +- .../rm-capabilities-disposition-context.xml | 630 +-- .../rm-capabilities-event-context.xml | 82 +- .../rm-capabilities-fileplan-context.xml | 192 +- .../rm-capabilities-freeze-context.xml | 340 +- .../rm-capabilities-group-context.xml | 496 +-- .../rm-capabilities-record-context.xml | 776 ++-- .../rm-capabilities-recordfolder-context.xml | 458 +-- .../rm-capabilities-reference-context.xml | 44 +- .../rm-capabilities-rule-context.xml | 38 +- .../rm-capabilities-security-context.xml | 120 +- .../content-context.xml | 72 +- .../dod5015/DODExampleFilePlan.xml | 2090 +++++----- ...15-capabilities-classification-context.xml | 162 +- .../dod5015/dod5015-context.xml | 120 +- .../dod5015/dod5015Model.xml | 866 ++-- .../dod5015/messages/dod5015-model.properties | 196 +- .../messages/dod5015-model_de.properties | 196 +- .../messages/dod5015-model_es.properties | 196 +- .../messages/dod5015-model_fr.properties | 196 +- .../messages/dod5015-model_it.properties | 196 +- .../messages/dod5015-model_ja.properties | 196 +- .../messages/dod5015-model_nb.properties | 196 +- .../messages/dod5015-model_nl.properties | 196 +- .../messages/dod5015-model_pt_BR.properties | 196 +- .../messages/dod5015-model_ru.properties | 196 +- .../messages/dod5015-model_zh_CN.properties | 196 +- .../dod5015/messages/dod5015.properties | 14 +- .../dod5015/messages/dod5015_de.properties | 14 +- .../dod5015/messages/dod5015_es.properties | 14 +- .../dod5015/messages/dod5015_fr.properties | 14 +- .../dod5015/messages/dod5015_it.properties | 14 +- .../dod5015/messages/dod5015_ja.properties | 14 +- .../dod5015/messages/dod5015_nb.properties | 14 +- .../dod5015/messages/dod5015_nl.properties | 14 +- .../dod5015/messages/dod5015_pt_BR.properties | 14 +- .../dod5015/messages/dod5015_ru.properties | 14 +- .../dod5015/messages/dod5015_zh_CN.properties | 14 +- .../extended-repository-context.xml | 528 +-- .../org_alfresco_module_rm/log4j.properties | 116 +- .../messages/action-service.properties | 84 +- .../messages/action-service_de.properties | 84 +- .../messages/action-service_es.properties | 84 +- .../messages/action-service_fr.properties | 84 +- .../messages/action-service_it.properties | 84 +- .../messages/action-service_ja.properties | 84 +- .../messages/action-service_nb.properties | 84 +- .../messages/action-service_nl.properties | 84 +- .../messages/action-service_pt_BR.properties | 84 +- .../messages/action-service_ru.properties | 84 +- .../messages/action-service_zh_CN.properties | 84 +- .../messages/actions.properties | 420 +- .../messages/actions_de.properties | 420 +- .../messages/actions_es.properties | 420 +- .../messages/actions_fr.properties | 420 +- .../messages/actions_it.properties | 420 +- .../messages/actions_ja.properties | 420 +- .../messages/actions_nb.properties | 420 +- .../messages/actions_nl.properties | 420 +- .../messages/actions_pt_BR.properties | 420 +- .../messages/actions_ru.properties | 420 +- .../messages/actions_zh_CN.properties | 420 +- .../messages/admin-service.properties | 30 +- .../messages/admin-service_de.properties | 30 +- .../messages/admin-service_es.properties | 30 +- .../messages/admin-service_fr.properties | 30 +- .../messages/admin-service_it.properties | 30 +- .../messages/admin-service_ja.properties | 30 +- .../messages/admin-service_nb.properties | 30 +- .../messages/admin-service_nl.properties | 30 +- .../messages/admin-service_pt_BR.properties | 30 +- .../messages/admin-service_ru.properties | 30 +- .../messages/admin-service_zh_CN.properties | 30 +- .../messages/audit-service.properties | 32 +- .../messages/audit-service_de.properties | 32 +- .../messages/audit-service_es.properties | 32 +- .../messages/audit-service_fr.properties | 32 +- .../messages/audit-service_it.properties | 32 +- .../messages/audit-service_ja.properties | 32 +- .../messages/audit-service_nb.properties | 32 +- .../messages/audit-service_nl.properties | 32 +- .../messages/audit-service_pt_BR.properties | 32 +- .../messages/audit-service_ru.properties | 32 +- .../messages/audit-service_zh_CN.properties | 32 +- .../messages/capability-service.properties | 208 +- .../messages/capability-service_de.properties | 208 +- .../messages/capability-service_es.properties | 208 +- .../messages/capability-service_fr.properties | 208 +- .../messages/capability-service_it.properties | 208 +- .../messages/capability-service_ja.properties | 208 +- .../messages/capability-service_nb.properties | 208 +- .../messages/capability-service_nl.properties | 208 +- .../capability-service_pt_BR.properties | 208 +- .../messages/capability-service_ru.properties | 208 +- .../capability-service_zh_CN.properties | 208 +- .../messages/notification-service.properties | 4 +- .../notification-service_de.properties | 4 +- .../notification-service_es.properties | 4 +- .../notification-service_fr.properties | 4 +- .../notification-service_it.properties | 4 +- .../notification-service_ja.properties | 4 +- .../notification-service_nb.properties | 4 +- .../notification-service_nl.properties | 4 +- .../notification-service_pt_BR.properties | 4 +- .../notification-service_ru.properties | 4 +- .../notification-service_zh_CN.properties | 4 +- .../records-management-service.properties | 40 +- .../records-management-service_de.properties | 40 +- .../records-management-service_es.properties | 40 +- .../records-management-service_fr.properties | 40 +- .../records-management-service_it.properties | 40 +- .../records-management-service_ja.properties | 40 +- .../records-management-service_nb.properties | 40 +- .../records-management-service_nl.properties | 40 +- ...ecords-management-service_pt_BR.properties | 40 +- .../records-management-service_ru.properties | 40 +- ...ecords-management-service_zh_CN.properties | 40 +- .../messages/records-model.properties | 528 +-- .../messages/records-model_de.properties | 528 +-- .../messages/records-model_es.properties | 528 +-- .../messages/records-model_fr.properties | 528 +-- .../messages/records-model_it.properties | 528 +-- .../messages/records-model_ja.properties | 528 +-- .../messages/records-model_nb.properties | 528 +-- .../messages/records-model_nl.properties | 528 +-- .../messages/records-model_pt_BR.properties | 528 +-- .../messages/records-model_ru.properties | 528 +-- .../messages/records-model_zh_CN.properties | 528 +-- .../messages/report-model.properties | 24 +- .../messages/report-model_de.properties | 24 +- .../messages/report-model_es.properties | 24 +- .../messages/report-model_fr.properties | 24 +- .../messages/report-model_it.properties | 24 +- .../messages/report-model_ja.properties | 24 +- .../messages/report-model_nb.properties | 24 +- .../messages/report-model_nl.properties | 24 +- .../messages/report-model_pt_BR.properties | 24 +- .../messages/report-model_ru.properties | 24 +- .../messages/report-model_zh_CN.properties | 24 +- .../messages/rm-actions.properties | 16 +- .../messages/rm-actions_de.properties | 16 +- .../messages/rm-actions_es.properties | 16 +- .../messages/rm-actions_fr.properties | 16 +- .../messages/rm-actions_it.properties | 16 +- .../messages/rm-actions_ja.properties | 16 +- .../messages/rm-actions_nb.properties | 16 +- .../messages/rm-actions_nl.properties | 16 +- .../messages/rm-actions_pt_BR.properties | 16 +- .../messages/rm-actions_ru.properties | 16 +- .../messages/rm-actions_zh_CN.properties | 16 +- .../messages/rm-events.properties | 42 +- .../messages/rm-events_de.properties | 42 +- .../messages/rm-events_es.properties | 42 +- .../messages/rm-events_fr.properties | 42 +- .../messages/rm-events_it.properties | 42 +- .../messages/rm-events_ja.properties | 42 +- .../messages/rm-events_nb.properties | 42 +- .../messages/rm-events_nl.properties | 42 +- .../messages/rm-events_pt_BR.properties | 42 +- .../messages/rm-events_ru.properties | 42 +- .../messages/rm-events_zh_CN.properties | 42 +- .../messages/rm-system.properties | 48 +- .../messages/rm-system_de.properties | 48 +- .../messages/rm-system_es.properties | 48 +- .../messages/rm-system_fr.properties | 48 +- .../messages/rm-system_it.properties | 48 +- .../messages/rm-system_ja.properties | 48 +- .../messages/rm-system_nb.properties | 48 +- .../messages/rm-system_nl.properties | 48 +- .../messages/rm-system_pt_BR.properties | 48 +- .../messages/rm-system_ru.properties | 48 +- .../messages/rm-system_zh_CN.properties | 48 +- .../messages/template.properties | 52 +- .../messages/template_de.properties | 52 +- .../messages/template_es.properties | 52 +- .../messages/template_fr.properties | 52 +- .../messages/template_it.properties | 52 +- .../messages/template_ja.properties | 52 +- .../messages/template_nb.properties | 52 +- .../messages/template_nl.properties | 52 +- .../messages/template_pt_BR.properties | 52 +- .../messages/template_ru.properties | 52 +- .../messages/template_zh_CN.properties | 52 +- .../model/recordableVersionModel.xml | 256 +- .../model/recordsModel.xml | 2456 +++++------ .../model/recordsPermissionModel.xml | 992 ++--- .../model/reportModel.xml | 100 +- .../model/rm-model-security-context.xml | 322 +- .../org_alfresco_module_rm/module-context.xml | 522 +-- .../org_alfresco_module_rm/module.properties | 20 +- .../patch/rm-patch-context.xml | 100 +- .../patch/rm-patch-v20-context.xml | 130 +- .../patch/rm-patch-v21-context.xml | 212 +- .../patch/rm-patch-v22-context.xml | 210 +- .../patch/rm-patch-v23-context.xml | 72 +- .../patch/rm-patch-v24-context.xml | 34 +- .../query/rm-common-SqlMap.xml | 44 +- .../query/rm-common-SqlMapConfig.xml | 24 +- .../query/rm-query-context.xml | 48 +- .../rm-action-context.xml | 2314 +++++------ .../rm-audit-context.xml | 190 +- .../rm-capabilities-context.xml | 310 +- .../rm-deprecated-context.xml | 270 +- .../rm-disposition-properties-context.xml | 78 +- .../org_alfresco_module_rm/rm-id-context.xml | 92 +- .../org_alfresco_module_rm/rm-job-context.xml | 306 +- .../rm-model-context.xml | 408 +- .../rm-public-services-security-context.xml | 350 +- .../rm-report-context.xml | 210 +- .../rm-service-context.xml | 3298 +++++++-------- .../rm-ui-evaluators-context.xml | 1852 ++++----- .../rm-version-context.xml | 182 +- .../rm-webscript-context.xml | 1330 +++--- .../rm-workflow-context.xml | 52 +- .../security/rm-default-roles-bootstrap.json | 448 +- .../security/rm-method-security-context.xml | 38 +- .../security/rm-method-security.properties | 454 +-- .../security/rm-policy-context.xml | 92 +- .../dictionary/rm-classes.get.desc.xml | 14 +- .../dictionary/rm-classes.get.json.ftl | 54 +- .../dictionary/rm-properties.get.desc.xml | 16 +- .../dictionary/rm-properties.get.json.ftl | 54 +- .../roles/rm-authorities.delete.desc.xml | 22 +- .../roles/rm-authorities.delete.json.ftl | 54 +- .../roles/rm-authorities.post.desc.xml | 22 +- .../roles/rm-authorities.post.json.ftl | 54 +- ...rm-actionconditiondefinitions.get.desc.xml | 14 +- ...rm-actionconditiondefinitions.get.json.ftl | 54 +- .../rule/rm-actiondefinitions.get.desc.xml | 14 +- .../rule/rm-actiondefinitions.get.json.ftl | 54 +- .../rm-substitutionsuggestions.get.desc.xml | 14 +- .../rm-substitutionsuggestions.get.json.ftl | 68 +- .../version/rm-version.get.desc.xml | 16 +- .../repository/version/rm-version.get.js | 302 +- .../version/rm-version.get.json.ftl | 96 +- .../rma/admin/emailmap.delete.desc.xml | 28 +- .../rma/admin/emailmap.delete.json.ftl | 66 +- .../alfresco/rma/admin/emailmap.get.desc.xml | 56 +- .../alfresco/rma/admin/emailmap.get.json.ftl | 66 +- .../org/alfresco/rma/admin/emailmap.lib.ftl | 80 +- .../alfresco/rma/admin/emailmap.post.desc.xml | 38 +- .../alfresco/rma/admin/emailmap.post.json.ftl | 66 +- .../rma/admin/emailmapkeys.get.desc.xml | 16 +- .../rma/admin/emailmapkeys.get.json.ftl | 78 +- .../admin/rmconstraint/rmconstraint-utils.js | 88 +- .../rmconstraint/rmconstraint.delete.desc.xml | 24 +- .../admin/rmconstraint/rmconstraint.delete.js | 106 +- .../rmconstraint/rmconstraint.delete.json.ftl | 62 +- .../rmconstraint/rmconstraint.get.desc.xml | 42 +- .../admin/rmconstraint/rmconstraint.get.js | 102 +- .../rmconstraint/rmconstraint.get.json.ftl | 68 +- .../admin/rmconstraint/rmconstraint.lib.ftl | 174 +- .../rmconstraint/rmconstraint.put.desc.xml | 36 +- .../rmconstraint/rmconstraint.put.json.ftl | 74 +- .../rmconstraint/rmconstraint.put.json.js | 174 +- .../rmconstraint/rmconstraints.get.desc.xml | 34 +- .../admin/rmconstraint/rmconstraints.get.js | 90 +- .../rmconstraint/rmconstraints.get.json.ftl | 78 +- .../rmconstraint/rmconstraints.post.desc.xml | 38 +- .../rmconstraint/rmconstraints.post.json.ftl | 74 +- .../rmconstraint/rmconstraints.post.json.js | 162 +- .../values/rmconstraint.get.desc.xml | 124 +- .../rmconstraint/values/rmconstraint.get.js | 102 +- .../values/rmconstraint.get.json.ftl | 66 +- .../values/rmconstraint.post.desc.xml | 54 +- .../values/rmconstraint.post.json.ftl | 66 +- .../values/rmconstraint.post.json.js | 130 +- .../values/rmconstraintvalue.delete.desc.xml | 20 +- .../values/rmconstraintvalue.delete.js | 134 +- .../values/rmconstraintvalue.delete.json.ftl | 66 +- .../values/rmconstraintvalue.get.desc.xml | 92 +- .../values/rmconstraintvalue.get.js | 124 +- .../values/rmconstraintvalue.get.json.ftl | 66 +- .../rma/admin/rmevent/rmevent.delete.desc.xml | 26 +- .../rma/admin/rmevent/rmevent.delete.json.ftl | 54 +- .../rma/admin/rmevent/rmevent.get.desc.xml | 26 +- .../rma/admin/rmevent/rmevent.get.json.ftl | 68 +- .../rma/admin/rmevent/rmevent.lib.ftl | 76 +- .../rma/admin/rmevent/rmevent.put.desc.xml | 26 +- .../rma/admin/rmevent/rmevent.put.json.ftl | 68 +- .../rma/admin/rmevent/rmevents.get.desc.xml | 26 +- .../rma/admin/rmevent/rmevents.get.json.ftl | 78 +- .../rma/admin/rmevent/rmevents.post.desc.xml | 26 +- .../rma/admin/rmevent/rmevents.post.json.ftl | 70 +- .../admin/rmevent/rmeventtypes.get.desc.xml | 26 +- .../admin/rmevent/rmeventtypes.get.json.ftl | 84 +- .../rma/admin/rmrole/rmrole.delete.desc.xml | 30 +- .../rma/admin/rmrole/rmrole.delete.json.ftl | 54 +- .../rma/admin/rmrole/rmrole.get.desc.xml | 30 +- .../rma/admin/rmrole/rmrole.get.json.ftl | 68 +- .../alfresco/rma/admin/rmrole/rmrole.lib.ftl | 130 +- .../rma/admin/rmrole/rmrole.put.desc.xml | 30 +- .../rma/admin/rmrole/rmrole.put.json.ftl | 68 +- .../rma/admin/rmrole/rmroles.get.desc.xml | 42 +- .../rma/admin/rmrole/rmroles.get.json.ftl | 78 +- .../rma/admin/rmrole/rmroles.post.desc.xml | 30 +- .../rma/admin/rmrole/rmroles.post.json.ftl | 68 +- .../rma/applydodcertmodelfixes.get.desc.xml | 28 +- .../rma/applydodcertmodelfixes.get.json.ftl | 62 +- .../alfresco/rma/applyfixmob1573.get.desc.xml | 16 +- .../alfresco/rma/applyfixmob1573.get.json.ftl | 62 +- .../rma/bootstraptestdata.get.desc.xml | 16 +- .../rma/bootstraptestdata.get.json.ftl | 62 +- .../rma/capability/capabilities.get.desc.xml | 18 +- .../rma/capability/capabilities.get.json.ftl | 118 +- .../alfresco/rma/customisable.get.desc.xml | 22 +- .../alfresco/rma/customisable.get.json.ftl | 80 +- .../rma/custompropdefinition.delete.desc.xml | 36 +- .../rma/custompropdefinition.delete.json.ftl | 68 +- .../rma/custompropdefinition.post.desc.xml | 58 +- .../rma/custompropdefinition.post.json.ftl | 66 +- .../rma/custompropdefinition.put.desc.xml | 50 +- .../rma/custompropdefinition.put.json.ftl | 66 +- .../rma/custompropdefinitions.get.desc.xml | 26 +- .../rma/custompropdefinitions.get.json.ftl | 138 +- .../alfresco/rma/customref.delete.desc.xml | 28 +- .../alfresco/rma/customref.delete.json.ftl | 58 +- .../org/alfresco/rma/customref.post.desc.xml | 34 +- .../org/alfresco/rma/customref.post.json.ftl | 62 +- .../rma/customrefdefinition.post.desc.xml | 44 +- .../rma/customrefdefinition.post.json.ftl | 72 +- .../rma/customrefdefinition.put.desc.xml | 50 +- .../rma/customrefdefinition.put.json.ftl | 64 +- .../rma/customrefdefinitions.get.desc.xml | 28 +- .../rma/customrefdefinitions.get.json.ftl | 84 +- .../org/alfresco/rma/customrefs.get.desc.xml | 88 +- .../org/alfresco/rma/customrefs.get.json.ftl | 106 +- .../org/alfresco/rma/dataset.post.desc.xml | 16 +- .../org/alfresco/rma/dataset.post.json.ftl | 64 +- .../org/alfresco/rma/datasets.get.desc.xml | 16 +- .../org/alfresco/rma/datasets.get.json.ftl | 82 +- ...ispositionactiondefinition.delete.desc.xml | 16 +- ...ispositionactiondefinition.delete.json.ftl | 54 +- .../rma/dispositionactiondefinition.lib.ftl | 88 +- .../dispositionactiondefinition.put.desc.xml | 40 +- .../dispositionactiondefinition.put.json.ftl | 62 +- ...dispositionactiondefinitions.post.desc.xml | 40 +- ...dispositionactiondefinitions.post.json.ftl | 62 +- .../rma/dispositionlifecycle.get.desc.xml | 16 +- .../rma/dispositionlifecycle.get.json.ftl | 132 +- .../rma/dispositionproperties.get.desc.xml | 16 +- .../rma/dispositionproperties.get.json.ftl | 80 +- .../rma/dispositionschedule.get.desc.xml | 16 +- .../rma/dispositionschedule.get.json.ftl | 110 +- .../alfresco/rma/dodcustomtypes.get.desc.xml | 22 +- .../alfresco/rma/dodcustomtypes.get.json.ftl | 84 +- .../org/alfresco/rma/export.post.desc.xml | 30 +- .../alfresco/rma/export.post.html.status.ftl | 90 +- .../alfresco/rma/fileplanreport.get.desc.xml | 24 +- .../org/alfresco/rma/fileplanreport.get.js | 444 +- .../alfresco/rma/fileplanreport.get.json.ftl | 90 +- .../org/alfresco/rma/fileplanreport.lib.ftl | 144 +- .../org/alfresco/rma/hold.post.desc.xml | 32 +- .../org/alfresco/rma/hold.post.json.ftl | 54 +- .../org/alfresco/rma/hold.put.desc.xml | 32 +- .../org/alfresco/rma/hold.put.json.ftl | 54 +- .../org/alfresco/rma/holds.get.desc.xml | 38 +- .../org/alfresco/rma/holds.get.json.ftl | 84 +- .../org/alfresco/rma/import.post.desc.xml | 32 +- .../org/alfresco/rma/import.post.html.ftl | 80 +- .../org/alfresco/rma/import.post.json.ftl | 62 +- .../alfresco/rma/listofvalues.get.desc.xml | 16 +- .../alfresco/rma/listofvalues.get.json.ftl | 56 +- .../org/alfresco/rma/listofvalues.lib.ftl | 202 +- .../rma/recordmetadataaspects.get.desc.xml | 22 +- .../rma/recordmetadataaspects.get.json.ftl | 86 +- .../alfresco/rma/relationship.delete.desc.xml | 14 +- .../alfresco/rma/relationship.delete.json.ftl | 58 +- .../rma/relationshiplabels.get.desc.xml | 14 +- .../rma/relationshiplabels.get.json.ftl | 84 +- .../alfresco/rma/relationships.get.desc.xml | 14 +- .../alfresco/rma/relationships.get.json.ftl | 82 +- .../org/alfresco/rma/rmaction.post.desc.xml | 36 +- .../org/alfresco/rma/rmaction.post.json.ftl | 80 +- .../alfresco/rma/rmauditlog.delete.desc.xml | 16 +- .../alfresco/rma/rmauditlog.delete.json.ftl | 56 +- .../org/alfresco/rma/rmauditlog.get.desc.xml | 42 +- .../org/alfresco/rma/rmauditlog.lib.ftl | 76 +- .../org/alfresco/rma/rmauditlog.post.desc.xml | 44 +- .../org/alfresco/rma/rmauditlog.put.desc.xml | 30 +- .../org/alfresco/rma/rmauditlog.put.json.ftl | 56 +- .../rma/rmauditlogstatus.get.desc.xml | 22 +- .../rma/rmauditlogstatus.get.json.ftl | 64 +- .../alfresco/rma/rmconstraints.get.desc.xml | 26 +- .../alfresco/rma/rmconstraints.get.json.ftl | 82 +- .../alfresco/rma/rmpermissions.post.desc.xml | 70 +- .../alfresco/rma/rmpermissions.post.json.ftl | 54 +- .../alfresco/rma/rmpermissions.post.json.js | 166 +- .../org/alfresco/rma/transfer.get.desc.xml | 16 +- .../alfresco/rma/transferreport.get.desc.xml | 16 +- .../alfresco/rma/transferreport.post.desc.xml | 30 +- .../rma/userrightsreport.get.desc.xml | 16 +- .../rma/userrightsreport.get.json.ftl | 144 +- .../rm-doclist.get.desc.xml | 22 +- .../documentlibrary-v2/rm-doclist.get.js | 76 +- .../rm-doclist.get.json.ftl | 54 +- .../documentlibrary-v2/rm-doclist.lib.js | 748 ++-- .../documentlibrary-v2/rm-filters.lib.js | 444 +- .../documentlibrary-v2/rm-node.get.desc.xml | 16 +- .../documentlibrary-v2/rm-node.get.js | 56 +- .../documentlibrary-v2/rm-node.get.json.ftl | 54 +- .../documentlibrary-v2/rm-parse-args.lib.js | 374 +- .../recorded-version-config.get.desc.xml | 16 +- .../recorded-version-config.get.json.ftl | 84 +- .../recorded-version-config.post.desc.xml | 16 +- .../recorded-version-config.post.json.ftl | 54 +- .../action/rm-copy-to.post.desc.xml | 26 +- .../action/rm-copy-to.post.json.ftl | 56 +- .../action/rm-copy-to.post.json.js | 268 +- .../action/rm-link.post.desc.xml | 24 +- .../action/rm-link.post.json.ftl | 56 +- .../action/rm-link.post.json.js | 218 +- .../action/rm-move-to.post.desc.xml | 24 +- .../action/rm-move-to.post.json.ftl | 56 +- .../action/rm-move-to.post.json.js | 256 +- .../rm-permissions.get.desc.xml | 16 +- .../documentlibrary/rm-permissions.get.js | 138 +- .../rm-permissions.get.json.ftl | 54 +- .../rm-savedsearches.get.desc.xml | 16 +- .../documentlibrary/rm-savedsearches.get.js | 160 +- .../rm-savedsearches.get.json.ftl | 78 +- .../documentlibrary/rm-transfer.get.desc.xml | 16 +- .../documentlibrary/rm-transfer.get.js | 94 +- .../documentlibrary/rm-transfer.get.json.ftl | 78 +- .../documentlibrary/rm-treenode.get.desc.xml | 22 +- .../documentlibrary/rm-treenode.get.js | 326 +- .../documentlibrary/rm-treenode.get.json.ftl | 130 +- .../slingshot/forms/metadata.get.desc.xml | 14 +- .../slingshot/forms/metadata.get.json.ftl | 84 +- .../rmsearch/faceted/rmsearch.get.desc.xml | 16 +- .../rmsearch/faceted/rmsearch.get.js | 106 +- .../rmsearch/faceted/rmsearch.get.json.ftl | 230 +- .../rmsearch/faceted/rmsearch.lib.js | 102 +- .../rmsearch/rmsavedsearches.delete.desc.xml | 16 +- .../rmsearch/rmsavedsearches.delete.json.ftl | 58 +- .../rmsearch/rmsavedsearches.get.desc.xml | 16 +- .../rmsearch/rmsavedsearches.get.json.ftl | 84 +- .../rmsearch/rmsavedsearches.post.desc.xml | 16 +- .../rmsearch/rmsavedsearches.post.json.ftl | 58 +- .../slingshot/rmsearch/rmsearch.get.desc.xml | 16 +- .../slingshot/rmsearch/rmsearch.get.json.ftl | 148 +- .../rmsearch/rmsearchproperties.get.desc.xml | 16 +- .../rmsearch/rmsearchproperties.get.json.ftl | 106 +- .../alfresco/workflow/requestInfo.bpmn20.xml | 202 +- .../workflow/rm-workflow-messages.properties | 44 +- .../rm-workflow-messages_de.properties | 44 +- .../rm-workflow-messages_es.properties | 44 +- .../rm-workflow-messages_fr.properties | 44 +- .../rm-workflow-messages_it.properties | 44 +- .../rm-workflow-messages_ja.properties | 44 +- .../rm-workflow-messages_nb.properties | 44 +- .../rm-workflow-messages_nl.properties | 44 +- .../rm-workflow-messages_pt_BR.properties | 44 +- .../rm-workflow-messages_ru.properties | 44 +- .../rm-workflow-messages_zh_CN.properties | 44 +- .../alfresco/workflow/rmWorkflowModel.xml | 122 +- .../caveat/RMListOfValuesConstraint.java | 82 +- ...annotApplyConstraintMetadataException.java | 90 +- .../CustomMetadataException.java | 82 +- .../InvalidCustomAspectMetadataException.java | 90 +- .../NotCustomisableMetadataException.java | 88 +- ...ropertyAlreadyExistsMetadataException.java | 90 +- .../RecordsManagementAdminService.java | 74 +- .../RecordsManagementService.java | 616 +-- .../RecordsManagementServiceImpl.java | 1008 ++--- ...cordsManagementAuditServiceDeprecated.java | 166 +- .../caveat/PivotUtil.java | 142 +- .../caveat/RMCaveatConfigComponent.java | 242 +- .../caveat/RMCaveatConfigComponentImpl.java | 2296 +++++------ .../caveat/RMCaveatConfigService.java | 322 +- .../caveat/RMCaveatConfigServiceImpl.java | 874 ++-- .../caveat/RMConstraintInfo.java | 176 +- .../caveat/RMConstraintMessageKeys.java | 78 +- .../caveat/RMListOfValuesConstraint.java | 518 +-- .../caveat/ScriptAuthority.java | 120 +- .../caveat/ScriptConstraint.java | 540 +-- .../caveat/ScriptConstraintAuthority.java | 116 +- .../caveat/ScriptConstraintValue.java | 132 +- .../caveat/ScriptRMCaveatConfigService.java | 348 +- .../compatibility/CompatibilityModel.java | 96 +- .../DeprecatedExtendedSecurityService.java | 296 +- .../ExtendedReaderDynamicAuthority.java | 196 +- .../ExtendedSecurityBaseDynamicAuthority.java | 384 +- .../ExtendedWriterDynamicAuthority.java | 206 +- .../FilePlanAuthenticationService.java | 118 +- .../FilePlanAuthenticationServiceImpl.java | 126 +- .../RecordsManagementSecurityService.java | 430 +- .../RecordsManagementSecurityServiceImpl.java | 460 +-- .../org_alfresco_module_rm/security/Role.java | 146 +- .../RecordsManagementPolicies.java | 258 +- .../RecordsManagementServiceRegistry.java | 386 +- .../RecordsManagementServiceRegistryImpl.java | 416 +- .../AuditableActionExecuterAbstractBase.java | 338 +- ...PropertySubActionExecuterAbstractBase.java | 192 +- .../action/RMActionExecuterAbstractBase.java | 1374 +++---- ...DispositionActionExecuterAbstractBase.java | 624 +-- .../action/RecordsManagementAction.java | 208 +- .../RecordsManagementActionCondition.java | 146 +- ...dsManagementActionConditionDefinition.java | 88 +- ...nagementActionConditionDefinitionImpl.java | 106 +- ...tActionConditionEvaluatorAbstractBase.java | 448 +- .../RecordsManagementActionDefinition.java | 98 +- ...RecordsManagementActionDefinitionImpl.java | 150 +- .../action/RecordsManagementActionResult.java | 120 +- .../RecordsManagementActionService.java | 294 +- .../RecordsManagementActionServiceImpl.java | 674 +-- .../action/ScheduledDispositionJob.java | 276 +- .../constraint/CustomParameterConstraint.java | 148 +- .../DispositionActionParameterConstraint.java | 144 +- .../ManualEventParameterConstraint.java | 150 +- .../RecordTypeParameterConstraint.java | 252 +- .../VersionParameterConstraint.java | 118 +- .../action/dm/CreateRecordAction.java | 484 +-- .../dm/DeclareAsVersionRecordAction.java | 488 +-- .../action/dm/ExecuteScriptAction.java | 112 +- .../action/dm/HideRecordAction.java | 222 +- .../action/dm/MoveDmRecordAction.java | 304 +- .../dm/RecordableVersionConfigAction.java | 408 +- .../CapabilityConditionEvaluator.java | 132 +- .../evaluator/DelegateActionCondition.java | 160 +- .../DispositionActionRelativePositions.java | 78 +- .../HasDispositionActionEvaluator.java | 282 +- .../action/evaluator/IsKindEvaluator.java | 166 +- .../evaluator/IsRecordTypeEvaluator.java | 184 +- .../action/impl/AddRecordTypeAction.java | 260 +- .../action/impl/ApplyCustomTypeAction.java | 308 +- ...spositionActionDefinitionUpdateAction.java | 550 +-- .../action/impl/CloseRecordFolderAction.java | 178 +- .../action/impl/CompleteEventAction.java | 196 +- .../impl/CopyMoveLinkFileToBaseAction.java | 966 ++--- .../action/impl/CopyToAction.java | 94 +- .../impl/CreateDispositionScheduleAction.java | 188 +- .../action/impl/CutOffAction.java | 196 +- .../action/impl/DeclareRecordAction.java | 430 +- .../action/impl/DelegateAction.java | 208 +- .../action/impl/DeleteHoldAction.java | 124 +- .../action/impl/DestroyAction.java | 462 +-- .../EditDispositionActionAsOfDateAction.java | 168 +- .../action/impl/EditHoldReasonAction.java | 148 +- .../action/impl/EditReviewAsOfDateAction.java | 156 +- .../action/impl/FileReportAction.java | 400 +- .../action/impl/FileToAction.java | 94 +- .../action/impl/FreezeAction.java | 152 +- .../action/impl/LinkToAction.java | 94 +- .../action/impl/MoveToAction.java | 94 +- .../action/impl/OpenRecordFolderAction.java | 190 +- .../action/impl/RejectAction.java | 150 +- .../action/impl/RelinquishHoldAction.java | 124 +- .../action/impl/RequestInfoAction.java | 358 +- .../action/impl/RetainAction.java | 104 +- .../action/impl/SplitEmailAction.java | 604 +-- .../action/impl/TransferAction.java | 240 +- .../action/impl/TransferCompleteAction.java | 188 +- .../action/impl/UnCutoffAction.java | 196 +- .../action/impl/UndeclareRecordAction.java | 154 +- .../action/impl/UndoEventAction.java | 156 +- .../action/impl/UnfreezeAction.java | 100 +- .../action/impl/UnlinkFromAction.java | 148 +- ...annotApplyConstraintMetadataException.java | 98 +- .../admin/CustomMetadataException.java | 96 +- .../InvalidCustomAspectMetadataException.java | 98 +- .../NotCustomisableMetadataException.java | 96 +- ...ropertyAlreadyExistsMetadataException.java | 102 +- .../admin/RecordsManagementAdminBase.java | 770 ++-- .../admin/RecordsManagementAdminService.java | 830 ++-- .../RecordsManagementAdminServiceImpl.java | 2742 ++++++------- .../audit/RecordsManagementAuditEntry.java | 558 +-- ...RecordsManagementAuditQueryParameters.java | 432 +- .../audit/RecordsManagementAuditService.java | 450 +-- .../RecordsManagementAuditServiceImpl.java | 3518 ++++++++-------- .../audit/event/AuditEvent.java | 292 +- .../audit/event/CopyToAuditEvent.java | 140 +- .../audit/event/CreateObjectAuditEvent.java | 116 +- .../audit/event/CreatePersonAuditEvent.java | 116 +- .../audit/event/DeleteObjectAuditEvent.java | 116 +- .../audit/event/FileToAuditEvent.java | 132 +- .../audit/event/LinkToAuditEvent.java | 130 +- .../audit/event/MoveToAuditEvent.java | 118 +- .../RecordableVersionPolicyAuditEvent.java | 134 +- .../audit/event/UpdateObjectAuditEvent.java | 126 +- .../AuthenticatedUserRolesDataExtractor.java | 254 +- .../FilePlanIdentifierDataExtractor.java | 158 +- .../FilePlanNamePathDataExtractor.java | 258 +- .../FilePlanNodeRefPathDataExtractor.java | 230 +- .../BootstrapImporterModuleComponent.java | 200 +- .../ModuleCompatibilityComponent.java | 308 +- ...rdContributorsGroupBootstrapComponent.java | 164 +- .../bootstrap/RecordsManagementBootstrap.java | 246 +- .../capability/AbstractCapability.java | 638 +-- .../capability/Capability.java | 232 +- .../capability/CapabilityService.java | 308 +- .../capability/CapabilityServiceImpl.java | 570 +-- .../capability/CompositeCapability.java | 92 +- .../capability/Group.java | 122 +- .../capability/GroupImpl.java | 228 +- .../capability/PolicyRegister.java | 76 +- .../capability/RMActionProxyFactoryBean.java | 248 +- .../capability/RMAfterInvocationProvider.java | 1942 ++++----- .../capability/RMEntryVoter.java | 826 ++-- .../capability/RMPermissionModel.java | 274 +- .../capability/RMSecurityCommon.java | 812 ++-- .../AbstractCapabilityCondition.java | 358 +- .../declarative/CapabilityCondition.java | 108 +- .../declarative/DeclarativeCapability.java | 776 ++-- .../DeclarativeCompositeCapability.java | 296 +- .../condition/AtLeastOneCondition.java | 176 +- .../condition/ClosedCapabilityCondition.java | 162 +- .../condition/CutoffCapabilityCondition.java | 100 +- .../DeclaredCapabilityCondition.java | 98 +- .../DestroyedCapabilityCondition.java | 90 +- .../condition/FailCapabilityCondition.java | 92 +- .../FileableCapabilityCondition.java | 134 +- .../condition/FillingCapabilityCondition.java | 114 +- ...ingOnHoldContainerCapabilityCondition.java | 138 +- .../condition/FrozenCapabilityCondition.java | 172 +- .../condition/FrozenOrHoldCondition.java | 104 +- .../HasAspectCapabilityCondition.java | 140 +- ...HasDispositionDateCapabilityCondition.java | 152 +- .../HasEventsCapabilityCondition.java | 144 +- .../condition/HoldCapabilityCondition.java | 188 +- .../IsClassifiedCapabilityCondition.java | 138 +- .../condition/IsPropertySetCondition.java | 194 +- .../condition/IsRecordCategoryCondition.java | 106 +- .../condition/IsRecordCondition.java | 106 +- .../condition/IsRecordFolderCondition.java | 106 +- .../IsScheduledCapabilityCondition.java | 172 +- ...sTransferAccessionCapabilityCondition.java | 118 +- .../LastDispositionActionCondition.java | 142 +- .../MayBeScheduledCapabilityCondition.java | 220 +- .../condition/MovableCapabilityCondition.java | 104 +- .../RecordFiledCapabilityCondition.java | 100 +- .../TransferredCapabilityCondition.java | 88 +- ...italRecordOrFolderCapabilityCondition.java | 122 +- .../ChangeOrDeleteReferencesCapability.java | 152 +- .../capability/impl/CreateCapability.java | 380 +- .../impl/DeleteLinksCapability.java | 148 +- .../impl/EditNonRecordMetadataCapability.java | 144 +- .../capability/impl/UpdateCapability.java | 112 +- .../impl/ViewRecordsCapability.java | 124 +- .../capability/policy/AbstractBasePolicy.java | 402 +- .../capability/policy/AssocPolicy.java | 94 +- .../policy/ConfigAttributeDefinition.java | 310 +- .../capability/policy/CreatePolicy.java | 128 +- .../capability/policy/DeclarePolicy.java | 92 +- .../capability/policy/DeletePolicy.java | 122 +- .../capability/policy/MovePolicy.java | 172 +- .../capability/policy/Policy.java | 116 +- .../capability/policy/ReadPolicy.java | 104 +- .../capability/policy/UpdatePolicy.java | 126 +- .../policy/UpdatePropertiesPolicy.java | 88 +- .../capability/policy/WriteContentPolicy.java | 92 +- .../content/ContentDestructionComponent.java | 492 +-- .../content/EagerContentStoreCleaner.java | 344 +- .../content/cleanser/ContentCleanser.java | 250 +- .../cleanser/ContentCleanser522022M.java | 118 +- .../dataset/DataSet.java | 108 +- .../dataset/DataSetBase.java | 260 +- .../dataset/DataSetService.java | 206 +- .../dataset/DataSetServiceImpl.java | 1048 ++--- .../disposition/DispositionAction.java | 306 +- .../DispositionActionDefinition.java | 268 +- .../DispositionActionDefinitionImpl.java | 510 +-- .../disposition/DispositionActionImpl.java | 1042 ++--- .../disposition/DispositionSchedule.java | 184 +- .../disposition/DispositionScheduleImpl.java | 388 +- .../DispositionSelectionStrategy.java | 416 +- .../disposition/DispositionService.java | 490 +-- .../disposition/DispositionServiceImpl.java | 2178 +++++----- .../property/DispositionProperty.java | 552 +-- .../dod5015/DOD5015FilePlanTypeBootstrap.java | 120 +- .../dod5015/DOD5015Model.java | 200 +- .../model/dod/aspect/DOD5015RecordAspect.java | 206 +- .../email/CustomEmailMappingService.java | 148 +- .../email/CustomEmailMappingServiceImpl.java | 990 ++--- .../email/CustomMapping.java | 240 +- .../CustomisableEmailMappingKeyBootstrap.java | 148 +- .../email/RFC822MetadataExtracter.java | 240 +- .../event/EventCompletionDetails.java | 352 +- .../event/OnReferenceCreateEventType.java | 306 +- .../event/OnReferencedRecordActionedUpon.java | 520 +-- .../event/RecordsManagementEvent.java | 218 +- .../event/RecordsManagementEventService.java | 246 +- .../RecordsManagementEventServiceImpl.java | 776 ++-- .../event/RecordsManagementEventType.java | 120 +- .../SimpleRecordsManagementEventTypeImpl.java | 218 +- .../fileplan/FilePlanComponentKind.java | 110 +- .../fileplan/FilePlanService.java | 698 ++-- .../fileplan/FilePlanServiceImpl.java | 1278 +++--- .../forms/RecordsManagementFormFilter.java | 386 +- .../RecordsManagementNodeFormFilter.java | 866 ++-- .../RecordsManagementTypeFormFilter.java | 382 +- .../freeze/FreezeService.java | 302 +- .../freeze/FreezeServiceImpl.java | 782 ++-- .../hold/HoldService.java | 396 +- .../hold/HoldServiceImpl.java | 1544 +++---- .../identifier/BasicIdentifierGenerator.java | 130 +- .../identifier/IdentifierGenerator.java | 112 +- .../identifier/IdentifierGeneratorBase.java | 224 +- .../identifier/IdentifierService.java | 140 +- .../identifier/IdentifierServiceImpl.java | 410 +- .../job/DispositionLifecycleJobExecuter.java | 506 +-- ...otifyOfRecordsDueForReviewJobExecuter.java | 324 +- .../job/PublishUpdatesJobExecuter.java | 832 ++-- .../job/RecordsManagementJob.java | 406 +- .../job/RecordsManagementJobExecuter.java | 178 +- .../job/publish/BasePublishExecutor.java | 112 +- ...sitionActionDefinitionPublishExecutor.java | 194 +- .../job/publish/PublishExecutor.java | 100 +- .../job/publish/PublishExecutorRegistry.java | 126 +- .../jscript/ScriptCapability.java | 148 +- .../jscript/ScriptRecordsManagmentNode.java | 174 +- .../ScriptRecordsManagmentService.java | 262 +- .../jscript/app/BaseEvaluator.java | 552 +-- .../jscript/app/JSONConversionComponent.java | 1200 +++--- .../app/evaluator/CutoffEvaluator.java | 104 +- .../EditRecordMetadataActionEvaluator.java | 98 +- .../evaluator/FolderOpenClosedEvaluator.java | 100 +- .../app/evaluator/FrozenEvaluator.java | 136 +- .../app/evaluator/HasAspectEvaluator.java | 108 +- .../app/evaluator/MultiParentEvaluator.java | 152 +- .../app/evaluator/NonElectronicEvaluator.java | 116 +- .../evaluator/SplitEmailActionEvaluator.java | 126 +- .../app/evaluator/TransferEvaluator.java | 250 +- .../jscript/app/evaluator/TrueEvaluator.java | 90 +- .../app/evaluator/VitalRecordEvaluator.java | 102 +- .../model/BaseBehaviourBean.java | 180 +- .../model/CustomisableTypesBootstrap.java | 178 +- .../model/RecordsManagementCustomModel.java | 134 +- .../model/RecordsManagementModel.java | 562 +-- .../behaviour/AbstractDisposableItem.java | 178 +- .../RecordsManagementSearchBehaviour.java | 1826 ++++----- .../DictionaryBootstrapPostProcessor.java | 132 +- .../model/rma/aspect/AccendedAspect.java | 130 +- .../model/rma/aspect/CutoffAspect.java | 130 +- .../rma/aspect/DeclaredRecordAspect.java | 130 +- .../aspect/DispositionLifecycleAspect.java | 212 +- .../rma/aspect/ExtendedSecurityAspect.java | 154 +- .../rma/aspect/FilePlanComponentAspect.java | 684 ++-- .../model/rma/aspect/FrozenAspect.java | 428 +- .../model/rma/aspect/GhostedAspect.java | 164 +- .../model/rma/aspect/RecordAspect.java | 678 ++-- .../RecordComponentIdentifierAspect.java | 482 +-- .../RecordOriginatingDetailsAspect.java | 130 +- .../model/rma/aspect/RecordSearchAspect.java | 126 +- .../model/rma/aspect/ScheduledAspect.java | 162 +- .../model/rma/aspect/TransferredAspect.java | 130 +- .../model/rma/aspect/TransferringAspect.java | 130 +- .../model/rma/aspect/UncutoffAspect.java | 130 +- .../model/rma/aspect/VersionRecordAspect.java | 264 +- .../model/rma/aspect/VitalRecordAspect.java | 126 +- .../aspect/VitalRecordDefinitionAspect.java | 202 +- .../model/rma/type/CmObjectType.java | 348 +- .../type/DispositionActionDefinitionType.java | 216 +- .../model/rma/type/FilePlanType.java | 430 +- .../model/rma/type/HoldContainerType.java | 154 +- .../model/rma/type/RecordCategoryType.java | 432 +- .../model/rma/type/RecordFolderType.java | 546 +-- .../type/RecordsManagementContainerType.java | 466 +-- .../model/rma/type/RmSiteType.java | 596 +-- .../model/rma/type/TransferContainerType.java | 150 +- .../security/ModelAccessDeniedException.java | 102 +- .../model/security/ModelSecurityService.java | 298 +- .../security/ModelSecurityServiceImpl.java | 744 ++-- .../model/security/ProtectedAspect.java | 80 +- .../security/ProtectedModelArtifact.java | 270 +- .../model/security/ProtectedProperty.java | 118 +- .../RecordsManagementNotificationHelper.java | 960 ++--- .../patch/AbstractModulePatch.java | 596 +-- .../patch/ModulePatch.java | 146 +- .../patch/ModulePatchExecuter.java | 98 +- .../patch/ModulePatchExecuterImpl.java | 354 +- .../patch/common/CapabilityPatch.java | 298 +- .../compatibility/ModulePatchComponent.java | 292 +- .../patch/v20/NotificationTemplatePatch.java | 422 +- .../patch/v20/RMv2FilePlanNodeRefPatch.java | 364 +- .../patch/v20/RMv2ModelPatch.java | 312 +- .../patch/v20/RMv2SavedSearchPatch.java | 252 +- .../v21/NotificationTemplatePatch_v21.java | 252 +- .../patch/v21/RMv21BehaviorScriptsPatch.java | 368 +- .../patch/v21/RMv21CapabilityPatch.java | 352 +- .../patch/v21/RMv21InPlacePatch.java | 466 +-- .../patch/v21/RMv21PatchComponent.java | 168 +- .../v21/RMv21RecordInheritancePatch.java | 292 +- .../patch/v21/RMv21ReportServicePatch.java | 298 +- .../patch/v21/RMv21RolesPatch.java | 236 +- .../patch/v22/RMv22CapabilityPatch.java | 142 +- .../patch/v22/RMv22DODCompliantSitePatch.java | 182 +- .../RMv22DODModelSeparationModulePatch.java | 354 +- .../RMv22FileHoldReportCapabilityPatch.java | 106 +- ...2GhostOnDestroyDispositionActionPatch.java | 378 +- .../patch/v22/RMv22HoldCapabilityPatch.java | 114 +- .../patch/v22/RMv22HoldReportPatch.java | 236 +- .../RMv22RemoveInPlaceRolesFromAllPatch.java | 212 +- .../patch/v22/RMv22ReportTemplatePatch.java | 242 +- .../v23/RMv23EndRetentionCapabilityPatch.java | 108 +- .../RMv23RecordContributorsGroupPatch.java | 124 +- .../patch/v23/RMv23VersionsEventPatch.java | 136 +- ...FilePlanContainerRuleInheritancePatch.java | 182 +- ...ordsManagementPermissionPostProcessor.java | 164 +- .../query/RecordsManagementQueryDAO.java | 98 +- .../query/RecordsManagementQueryDAOImpl.java | 200 +- .../record/InplaceRecordService.java | 112 +- .../record/InplaceRecordServiceImpl.java | 388 +- .../record/RecordLinkRuntimeException.java | 124 +- .../record/RecordMetadataBootstrap.java | 202 +- .../record/RecordService.java | 562 +-- .../record/RecordServiceImpl.java | 3596 ++++++++--------- .../RecordableVersionConfigService.java | 120 +- .../RecordableVersionConfigServiceImpl.java | 272 +- .../recordfolder/RecordFolderService.java | 338 +- .../recordfolder/RecordFolderServiceImpl.java | 642 +-- .../relationship/Relationship.java | 124 +- .../relationship/RelationshipDefinition.java | 122 +- .../RelationshipDefinitionImpl.java | 248 +- .../relationship/RelationshipDisplayName.java | 238 +- .../relationship/RelationshipImpl.java | 332 +- .../relationship/RelationshipService.java | 316 +- .../relationship/RelationshipServiceImpl.java | 1938 ++++----- .../relationship/RelationshipType.java | 86 +- .../org_alfresco_module_rm/report/Report.java | 132 +- .../report/ReportGenerator.java | 112 +- .../report/ReportModel.java | 116 +- .../report/ReportService.java | 178 +- .../report/ReportServiceImpl.java | 268 +- .../report/generator/BaseReportGenerator.java | 314 +- .../generator/DeclarativeReportGenerator.java | 754 ++-- .../report/generator/ReportInfo.java | 224 +- .../generator/transfer/TransferNode.java | 148 +- .../transfer/TransferReportGenerator.java | 484 +-- .../role/FilePlanRoleService.java | 452 +-- .../role/FilePlanRoleServiceImpl.java | 1772 ++++---- .../org_alfresco_module_rm/role/Role.java | 250 +- .../script/AbstractRmWebScript.java | 316 +- .../script/ApplyDodCertModelFixesGet.java | 454 +-- .../script/ApplyFixMob1573Get.java | 328 +- .../script/AuditLogDelete.java | 116 +- .../script/AuditLogGet.java | 338 +- .../script/AuditLogPost.java | 596 +-- .../script/AuditLogPut.java | 192 +- .../script/AuditLogStatusGet.java | 196 +- .../script/BaseAuditAdminWebScript.java | 202 +- .../script/BaseAuditRetrievalWebScript.java | 564 +-- .../script/BaseCustomPropertyWebScript.java | 146 +- .../script/BaseTransferWebScript.java | 448 +- .../script/BootstrapTestDataGet.java | 712 ++-- .../CustomPropertyDefinitionDelete.java | 244 +- .../script/CustomPropertyDefinitionPost.java | 508 +-- .../script/CustomPropertyDefinitionPut.java | 470 +-- .../script/CustomPropertyDefinitionsGet.java | 260 +- .../script/CustomRefDelete.java | 322 +- .../script/CustomRefPost.java | 336 +- .../script/CustomReferenceDefinitionBase.java | 206 +- .../script/CustomReferenceDefinitionPost.java | 176 +- .../script/CustomReferenceDefinitionPut.java | 176 +- .../script/CustomReferenceDefinitionsGet.java | 290 +- .../script/CustomReferenceType.java | 134 +- .../script/CustomRefsGet.java | 486 +-- .../script/CustomisableGet.java | 354 +- .../script/DataSetPost.java | 288 +- .../script/DataSetsGet.java | 262 +- .../script/DispositionAbstractBase.java | 458 +-- .../DispositionActionDefinitionDelete.java | 166 +- .../DispositionActionDefinitionPost.java | 336 +- .../DispositionActionDefinitionPut.java | 334 +- .../script/DispositionLifecycleGet.java | 386 +- .../script/DispositionPropertiesGet.java | 254 +- .../script/DispositionScheduleGet.java | 106 +- .../script/DodCustomTypesGet.java | 156 +- .../script/EmailMapDelete.java | 174 +- .../script/EmailMapGet.java | 138 +- .../script/EmailMapKeysGet.java | 136 +- .../script/EmailMapPost.java | 200 +- .../script/ExportPost.java | 370 +- .../script/ImportPost.java | 530 +-- .../script/ListOfValuesGet.java | 608 +-- .../script/RMConstraintGet.java | 158 +- .../script/RecordMetaDataAspectsGet.java | 300 +- .../script/RelationshipDelete.java | 250 +- .../script/RelationshipLabelsGet.java | 454 +-- .../script/RelationshipsGet.java | 386 +- .../script/RmActionPost.java | 456 +-- .../script/TransferGet.java | 214 +- .../script/TransferReportGet.java | 594 +-- .../script/TransferReportPost.java | 924 ++--- .../script/UserRightsReportGet.java | 708 ++-- .../script/admin/RMEventBase.java | 152 +- .../script/admin/RmEventDelete.java | 174 +- .../script/admin/RmEventGet.java | 172 +- .../script/admin/RmEventPut.java | 314 +- .../script/admin/RmEventTypesGet.java | 144 +- .../script/admin/RmEventsGet.java | 144 +- .../script/admin/RmEventsPost.java | 314 +- .../script/admin/RmRoleDelete.java | 162 +- .../script/admin/RmRoleGet.java | 156 +- .../script/admin/RmRolePut.java | 246 +- .../script/admin/RmRolesGet.java | 190 +- .../script/admin/RmRolesPost.java | 216 +- .../admin/RoleDeclarativeWebScript.java | 586 +-- .../script/capability/CapabilitiesGet.java | 448 +- .../script/hold/BaseHold.java | 520 +-- .../script/hold/Hold.java | 154 +- .../script/hold/HoldPost.java | 100 +- .../script/hold/HoldPut.java | 100 +- .../script/hold/HoldsGet.java | 500 +-- .../slingshot/RMSavedSearchesDelete.java | 208 +- .../script/slingshot/RMSavedSearchesGet.java | 316 +- .../script/slingshot/RMSavedSearchesPost.java | 336 +- .../script/slingshot/RMSearchGet.java | 884 ++-- .../slingshot/RMSearchPropertiesGet.java | 438 +- .../slingshot/RecordedVersionConfigGet.java | 168 +- .../slingshot/RecordedVersionConfigPost.java | 202 +- .../script/slingshot/Version.java | 208 +- .../script/slingshot/forms/RMMetaDataGet.java | 450 +-- .../RecordsManagementSearchParameters.java | 800 ++-- .../RecordsManagementSearchService.java | 206 +- .../RecordsManagementSearchServiceImpl.java | 1272 +++--- .../search/ReportDetails.java | 244 +- .../search/SavedSearchDetails.java | 640 +-- .../SavedSearchDetailsCompatibility.java | 466 +-- .../search/SortItem.java | 88 +- .../security/ExtendedSecurityService.java | 210 +- .../security/ExtendedSecurityServiceImpl.java | 1292 +++--- .../security/FilePlanPermissionService.java | 152 +- .../FilePlanPermissionServiceImpl.java | 1250 +++--- .../security/RMMethodSecurityInterceptor.java | 722 ++-- .../RMMethodSecurityPostProcessor.java | 418 +- .../site/GetChildrenCannedQueryFactory.java | 114 +- .../transfer/TransferService.java | 142 +- .../transfer/TransferServiceImpl.java | 642 +-- .../util/AlfrescoTransactionSupport.java | 126 +- .../util/AuthenticationUtil.java | 260 +- .../util/PoliciesUtil.java | 172 +- .../util/RMCollectionUtils.java | 408 +- .../util/RMParameterCheck.java | 104 +- .../util/ServiceBaseImpl.java | 1080 ++--- .../util/TransactionalResourceHelper.java | 230 +- .../util/UpdateActionType.java | 84 +- .../version/ExtendedVersionableAspect.java | 448 +- .../version/RecordableVersionModel.java | 120 +- .../RecordableVersionNodeServiceImpl.java | 514 +-- .../version/RecordableVersionPolicy.java | 78 +- .../version/RecordableVersionService.java | 214 +- .../version/RecordableVersionServiceImpl.java | 1782 ++++---- .../version/model/VersionableAspect.java | 130 +- .../BroadcastVitalRecordDefinitionAction.java | 286 +- .../vital/ReviewedAction.java | 198 +- .../vital/VitalRecordDefinition.java | 130 +- .../vital/VitalRecordDefinitionImpl.java | 214 +- .../vital/VitalRecordService.java | 168 +- .../vital/VitalRecordServiceImpl.java | 426 +- .../action/ExtendedActionServiceImpl.java | 282 +- .../parameter/DateParameterProcessor.java | 518 +-- .../parameter/MessageParameterProcessor.java | 128 +- .../parameter/NodeParameterProcessor.java | 606 +-- .../NodeParameterSuggesterBootstrap.java | 202 +- .../action/parameter/ParameterProcessor.java | 206 +- .../ParameterProcessorComponent.java | 350 +- .../ParameterSubstitutionSuggester.java | 74 +- .../repo/imap/ExtendedImapServiceImpl.java | 150 +- .../alfresco/repo/jscript/ExtendedSearch.java | 124 +- .../ExtendedFileFolderServiceImpl.java | 148 +- .../repo/rule/ExtendedRuleServiceImpl.java | 454 +-- ...foreDeleteChildAssociationRuleTrigger.java | 224 +- .../repo/security/authority/RMAuthority.java | 104 +- .../authority/RMAuthorityDAOImpl.java | 180 +- .../impl/ExtendedPermissionService.java | 130 +- .../impl/ExtendedPermissionServiceImpl.java | 772 ++-- .../impl/acegi/RMACLEntryVoter.java | 120 +- .../processor/PermissionPostProcessor.java | 104 +- .../processor/PermissionPreProcessor.java | 104 +- .../PermissionProcessorRegistry.java | 172 +- .../impl/PermissionPostProcessorBaseImpl.java | 102 +- .../impl/PermissionPreProcessorBaseImpl.java | 102 +- .../impl/PermissionProcessorBaseImpl.java | 116 +- .../web/scripts/dictionary/RmClassesGet.java | 500 +-- .../RmDictionaryWebServiceUtils.java | 130 +- .../scripts/dictionary/RmPropertiesGet.java | 368 +- .../scripts/roles/AbstractRmAuthorities.java | 216 +- .../scripts/roles/RmAuthoritiesDelete.java | 124 +- .../web/scripts/roles/RmAuthoritiesPost.java | 124 +- .../rule/RmActionConditionDefinitionsGet.java | 180 +- .../scripts/rule/RmActionDefinitionsGet.java | 160 +- .../RmSubstitutionSuggestionsGet.java | 632 +-- .../java/org/alfresco/util/SortDirection.java | 160 +- .../org/alfresco/util/WebScriptUtils.java | 858 ++-- .../alfresco/workflow/RMWorkflowModel.java | 108 +- .../RequestInfoAssignmentHandler.java | 280 +- .../requestInfo/RequestInfoNotifier.java | 162 +- .../requestInfo/RequestInfoUtils.java | 292 +- .../RequestInfoVariableHandler.java | 118 +- .../local/alfresco-global.properties | 142 +- .../test/AllTestSuite.java | 134 +- .../destroy/DestroyContentTest.java | 720 ++-- .../integration/disposition/CutOffTest.java | 454 +-- .../integration/dod/RM1147DODRMSiteTest.java | 370 +- .../dod/RM1194ExcludeDoDRecordTypesTest.java | 248 +- .../integration/event/CompleteEventsTest.java | 912 ++--- .../hold/AddRemoveFromHoldTest.java | 848 ++-- .../test/integration/hold/CreateHoldTest.java | 274 +- .../test/integration/hold/DeleteHoldTest.java | 444 +- .../test/integration/issue/RM1008Test.java | 736 ++-- .../test/integration/issue/RM1027Test.java | 252 +- .../test/integration/issue/RM1030Test.java | 328 +- .../test/integration/issue/RM1039Test.java | 390 +- .../test/integration/issue/RM1424Test.java | 256 +- .../test/integration/issue/RM1429Test.java | 160 +- .../test/integration/issue/RM1463Test.java | 154 +- .../test/integration/issue/RM1464Test.java | 154 +- .../test/integration/issue/RM1727Test.java | 240 +- .../test/integration/issue/RM1799Test.java | 204 +- .../test/integration/issue/RM1814Test.java | 186 +- .../test/integration/issue/RM1887Test.java | 180 +- .../test/integration/issue/RM1914Test.java | 296 +- .../test/integration/issue/RM2072Test.java | 380 +- .../test/integration/issue/RM2190Test.java | 458 +-- .../test/integration/issue/RM2192Test.java | 364 +- .../test/integration/issue/RM3341Test.java | 244 +- .../test/integration/issue/RM452Test.java | 212 +- .../test/integration/issue/RM804Test.java | 396 +- .../test/integration/issue/RM978Test.java | 1754 ++++---- .../integration/issue/RM981SystemTest.java | 250 +- .../test/integration/issue/RM994Test.java | 268 +- .../integration/issue/rm3314/RM3314Test.java | 160 +- .../issue/rm3314/RM3314TestListener.java | 294 +- .../job/AutomaticDispositionTest.java | 282 +- .../record/CompleteRecordTest.java | 484 +-- .../integration/record/CreateRecordTest.java | 592 +-- .../record/HideInplaceRecordTest.java | 214 +- .../record/InplaceRecordPermissionTest.java | 1904 ++++----- .../integration/record/LinkRecordTest.java | 330 +- .../record/MoveInplaceRecordTest.java | 312 +- .../integration/record/MoveRecordTest.java | 700 ++-- .../integration/record/RejectRecordTest.java | 604 +-- .../integration/record/ViewRecordTest.java | 224 +- .../recordfolder/MoveRecordFolderTest.java | 1042 ++--- .../relationship/CreateRelationshipTest.java | 436 +- .../relationship/DeleteRelationshipTest.java | 536 +-- .../integration/report/HoldReportTest.java | 350 +- .../rule/FilePlanRuleInheritanceTest.java | 568 +-- ...reateTransferFolderAsNonAdminUserTest.java | 332 +- ...FilingPermissionsOnTransferFolderTest.java | 400 +- .../NoPermissionsOnTransferFolderTest.java | 380 +- .../ReadPermissionsOnTransferFolderTest.java | 420 +- .../version/AdHocRecordableVersionsTest.java | 398 +- .../version/AutoRecordableVersionsTest.java | 358 +- .../integration/version/AutoVersionTest.java | 480 +-- .../version/DeclareAsRecordVersionTest.java | 434 +- .../version/DeleteRecordVersionTest.java | 1026 ++--- .../version/RecordableVersionsBaseTest.java | 826 ++-- .../legacy/action/CreateRecordActionTest.java | 164 +- .../legacy/action/FileReportActionTest.java | 232 +- .../test/legacy/action/FileToActionTest.java | 686 ++-- .../legacy/action/HideRecordActionTest.java | 184 +- .../legacy/action/MoveRecordActionTest.java | 224 +- .../RecordableVersionConfigActionTest.java | 304 +- .../test/legacy/action/RejectActionTest.java | 248 +- .../capabilities/CompositeCapabilityTest.java | 344 +- .../DeclarativeCapabilityTest.java | 1004 ++--- .../jscript/JSONConversionComponentTest.java | 330 +- .../legacy/security/MethodSecurityTest.java | 174 +- .../service/CapabilityServiceImplTest.java | 288 +- .../CustomEMailMappingServiceImplTest.java | 310 +- .../service/DataSetServiceImplTest.java | 546 +-- .../service/DispositionServiceImplTest.java | 2064 +++++----- .../service/ExtendedActionServiceTest.java | 464 +-- .../ExtendedSecurityServiceImplTest.java | 590 +-- .../FilePlanPermissionServiceImplTest.java | 2534 ++++++------ .../service/FilePlanRoleServiceImplTest.java | 462 +-- .../service/FilePlanServiceImplTest.java | 1092 ++--- .../legacy/service/FreezeServiceImplTest.java | 490 +-- .../service/ModelSecurityServiceImplTest.java | 556 +-- .../RMCaveatConfigServiceImplTest.java | 1242 +++--- .../legacy/service/RecordServiceImplTest.java | 1546 +++---- ...ecordsManagementActionServiceImplTest.java | 542 +-- ...RecordsManagementAdminServiceImplTest.java | 1904 ++++----- ...RecordsManagementAuditServiceImplTest.java | 1018 ++--- ...RecordsManagementEventServiceImplTest.java | 272 +- .../RecordsManagementQueryDAOImplTest.java | 180 +- ...ecordsManagementSearchServiceImplTest.java | 580 +-- .../RecordsManagementServiceImplTest.java | 1246 +++--- .../legacy/service/ReportServiceImplTest.java | 480 +-- .../legacy/service/ServiceBaseImplTest.java | 236 +- .../service/VitalRecordServiceImplTest.java | 940 ++--- .../ActionDefinitionsRestApiTest.java | 240 +- .../legacy/webscript/AuditRestApiTest.java | 200 +- .../webscript/CapabilitiesRestApiTest.java | 240 +- .../legacy/webscript/DataSetRestApiTest.java | 240 +- .../webscript/DispositionRestApiTest.java | 894 ++-- .../webscript/EmailMapKeysRestApiTest.java | 156 +- .../legacy/webscript/EmailMapScriptTest.java | 224 +- .../legacy/webscript/EventRestApiTest.java | 502 +-- .../webscript/RMCaveatConfigScriptTest.java | 1858 ++++----- .../webscript/RMConstraintScriptTest.java | 218 +- .../webscript/RmAuthoritiesRestApiTest.java | 700 ++-- .../webscript/RmClassesRestApiTest.java | 310 +- .../webscript/RmPropertiesRestApiTest.java | 310 +- .../test/legacy/webscript/RmRestApiTest.java | 2344 +++++------ .../legacy/webscript/RoleRestApiTest.java | 752 ++-- .../SubstitutionSuggestionsRestApiTest.java | 206 +- .../test/system/DataLoadSystemTest.java | 676 ++-- .../NotificationServiceHelperSystemTest.java | 312 +- .../test/util/BaseRMTestCase.java | 1986 ++++----- .../test/util/BaseRMWebScriptTestCase.java | 800 ++-- .../test/util/CommonRMTestUtils.java | 760 ++-- .../test/util/GenerateCapabilityReport.java | 166 +- .../RetryingTransactionHelperBaseTest.java | 152 +- .../test/util/TestAction.java | 110 +- .../test/util/TestAction2.java | 98 +- .../test/util/TestActionParams.java | 98 +- .../test/util/TestActionPropertySubs.java | 222 +- .../test/util/TestContentCleanser.java | 130 +- .../test/util/TestDmAction.java | 104 +- .../test/util/TestModel.java | 88 +- .../test/util/TestService.java | 76 +- .../test/util/TestServiceImpl.java | 132 +- .../test/util/TestWebScriptRepoServer.java | 458 +-- .../test/util/bdt/BehaviourTest.java | 552 +-- .../test/util/bdt/ExpectedFailure.java | 184 +- .../test/util/bdt/ExpectedValue.java | 172 +- .../extension/rm-method-security.properties | 2 +- .../repository/generic-paged-results.lib.ftl | 78 +- .../test/resources/test-context.xml | 496 +-- .../test/resources/test-filePlan.xml | 568 +-- .../test/resources/test-job-context.xml | 34 +- .../test/resources/test-model.xml | 142 +- .../test/resources/test-rm3314-context.xml | 52 +- .../test/resources/test.properties | 2 +- .../test/resources/testCaveatConfig1.json | 16 +- .../test/resources/testCaveatConfig2.json | 54 +- .../rm-community-repo/tomcat/context.xml | 62 +- .../action/BaseActionUnitTest.java | 126 +- .../DeclareAsVersionRecordActionUnitTest.java | 604 +-- .../action/impl/FileReportActionUnitTest.java | 230 +- .../action/impl/UnlinkFromActionUnitTest.java | 306 +- .../api/CommunityPublicAPIUnitTest.java | 84 +- ...tstrapImporterModuleComponentUnitTest.java | 206 +- .../ModuleCompatibilityComponentUnitTest.java | 358 +- ...butorsGroupBootstrapComponentUnitTest.java | 184 +- .../capability/RMEntryVoterUnitTest.java | 458 +-- ...dContainerCapabilityConditionUnitTest.java | 302 +- .../FrozenCapabilityConditionUnitTest.java | 490 +-- .../HoldCapabilityConditionUnitTest.java | 304 +- ...tNonRecordsMetadataCapabilityUnitTest.java | 148 +- .../EagerContentStoreCleanerUnitTest.java | 260 +- .../ContentCleanser522022MUnitTest.java | 242 +- ...cordsManagementTypeFormFilterUnitTest.java | 372 +- .../hold/HoldServiceImplUnitTest.java | 936 ++--- ...spositionLifecycleJobExecuterUnitTest.java | 510 +-- .../evaluator/FrozenEvaluatorUnitTest.java | 232 +- .../evaluator/TransferEvaluatorUnitTest.java | 362 +- ...tionaryBootstrapPostProcessorUnitTest.java | 208 +- .../aspect/VersionRecordAspectUnitTest.java | 198 +- .../rma/type/HoldContainerTypeUnitTest.java | 174 +- .../type/NonElectronicRecordTypeUnitTest.java | 226 +- ...ecordsManagementContainerTypeUnitTest.java | 210 +- .../type/TransferContainerTypeUnitTest.java | 162 +- .../v22/RMv22CapabilityPatchUnitTest.java | 266 +- ...emoveInPlaceRolesFromAllPatchUnitTest.java | 272 +- ...ContainerRuleInheritancePatchUnitTest.java | 236 +- .../RecordMetadataBootstrapUnitTest.java | 142 +- .../record/RecordServiceImplUnitTest.java | 930 ++--- .../config/BaseRecordedVersionConfigTest.java | 124 +- .../RecordedVersionConfigGetUnitTest.java | 272 +- .../RecordedVersionConfigPostUnitTest.java | 226 +- .../hold/BaseHoldWebScriptUnitTest.java | 156 +- .../BaseHoldWebScriptWithContentUnitTest.java | 498 +-- .../script/hold/HoldPostUnitTest.java | 218 +- .../script/hold/HoldPutUnitTest.java | 218 +- .../script/hold/HoldsGetUnitTest.java | 556 +-- .../ExtendedSecurityServiceImplUnitTest.java | 1856 ++++----- ...FilePlanPermissionServiceImplUnitTest.java | 898 ++-- .../test/AllUnitTestSuite.java | 94 +- .../test/util/AlfMock.java | 260 +- .../test/util/BaseUnitTest.java | 788 ++-- .../test/util/BaseWebScriptUnitTest.java | 612 +-- .../test/util/ExceptionUtils.java | 488 +-- .../ExceptionUtilsUsageExamplesUnitTest.java | 258 +- .../test/util/FPUtils.java | 194 +- .../test/util/FPUtilsUnitTest.java | 174 +- .../util/MockAuthenticationUtilHelper.java | 208 +- .../test/util/WebScriptExceptionMatcher.java | 214 +- .../util/RMCollectionUtilsUnitTest.java | 250 +- .../util/RMParameterCheckUnitTest.java | 128 +- .../ExtendedVersionableAspectUnitTest.java | 818 ++-- .../RecordableVersionServiceImplUnitTest.java | 1340 +++--- .../TestRecordableVersionServiceImpl.java | 142 +- .../DateParameterProcessorUnitTest.java | 264 +- .../imap/ExtendedImapServiceImplUnitTest.java | 232 +- ...ExtendedPermissionServiceImplUnitTest.java | 540 +-- 1219 files changed, 165177 insertions(+), 165148 deletions(-) create mode 100644 .gitattributes diff --git a/.editorConfig b/.editorConfig index 8a1ce60ed4..1808f3da08 100644 --- a/.editorConfig +++ b/.editorConfig @@ -1,15 +1,15 @@ -# EditorConfig file: http://editorconfig.org/ -# Syntax at: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties - -# This is the Top level for the RM project -root = true - -# All files should use spaces. -[*] -indent_style = space -end_of_line = crlf -trim_trailing_whitespace = true -indent_size = 3 - -[*.java] -indent_size = 4 +# EditorConfig file: http://editorconfig.org/ +# Syntax at: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties + +# This is the Top level for the RM project +root = true + +# All files should use spaces. +[*] +indent_style = space +end_of_line = crlf +trim_trailing_whitespace = true +indent_size = 3 + +[*.java] +indent_size = 4 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..2f5a361a05 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,29 @@ +# Automatically detect if no other rule applies. +* text=auto + +# Extensions known to be text files. +*.css text +*.editorConfig text +*.ftl text +*.gitattributes text +*.gitignore text +*.html text +*.importorder text +*.java text +*.js text +*.jshintrc text +*.json text +*.properties text +*.txt text +*.xml text + +# Alfresco content package. +*.acp binary + +# Image files. +*.gif binary +*.jpg binary +*.png binary + +# IntelliJ has a jar file as part of its config directory. +*.jar binary diff --git a/.gitignore b/.gitignore index 76b6b011a9..dfdc3e2322 100644 --- a/.gitignore +++ b/.gitignore @@ -1,40 +1,40 @@ -# General ignored files and directories -.ant-targets-build.xml -.classpath -.gradle -.idea -.project -.settings -*.eml -*.iml -*.log* -*.tmp -*.war -bin -build.local.properties -dist -explodedDeps -local.properties -target -test-output - -# /rm-community/ -/rm-community/l10n -/rm-community/root - -# /rm-community/rm-server/ -/rm-community/rm-server/alfresco-solr.zip -/rm-community/rm-server/solr -/rm-community/rm-server/shared - -# /rm-community/rm-server/config/ -/rm-community/rm-server/config/alfresco-global.properties - -# /rm-community/rm-server/config/alfresco/ -/rm-community/rm-server/config/alfresco/extension - -# /rm-enterprise/rm-automation-enterprise/ -/rm-enterprise/rm-automation-enterprise/l10n -/rm-enterprise/rm-automation-enterprise/root - -rm-automation/src/test/resources/webdriver.properties +# General ignored files and directories +.ant-targets-build.xml +.classpath +.gradle +.idea +.project +.settings +*.eml +*.iml +*.log* +*.tmp +*.war +bin +build.local.properties +dist +explodedDeps +local.properties +target +test-output + +# /rm-community/ +/rm-community/l10n +/rm-community/root + +# /rm-community/rm-server/ +/rm-community/rm-server/alfresco-solr.zip +/rm-community/rm-server/solr +/rm-community/rm-server/shared + +# /rm-community/rm-server/config/ +/rm-community/rm-server/config/alfresco-global.properties + +# /rm-community/rm-server/config/alfresco/ +/rm-community/rm-server/config/alfresco/extension + +# /rm-enterprise/rm-automation-enterprise/ +/rm-enterprise/rm-automation-enterprise/l10n +/rm-enterprise/rm-automation-enterprise/root + +rm-automation/src/test/resources/webdriver.properties diff --git a/.jshintrc b/.jshintrc index 9af2c28e32..67d44b1766 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,44 +1,44 @@ -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "es3": true, - "forin": true, - "freeze": true, - "funcscope": true, - "immed": true, - "indent": 3, - "iterator": true, - "latedef": true, - "maxcomplexity": 10, - "maxdepth": 50, - "maxerr": 50, - "maxlen": 250, - "maxparams": 50, - "maxstatements": 30, - "newcap": true, - "noarg": true, - "nonbsp": true, - "nonew": true, - "notypeof": true, - "shadow": "outer", - "undef": true, - "unused": true, - - "globals": { - "module": false, - "model": true, - "Alfresco": true, - "YAHOO": false, - "appContext": false, - "PDFJS": false, - "AlfrescoUtil": true, - "msg": false - }, - - "expr": true, - "strict": false, - - "browser": true, - "dojo": true -} +{ + "bitwise": true, + "curly": true, + "eqeqeq": true, + "es3": true, + "forin": true, + "freeze": true, + "funcscope": true, + "immed": true, + "indent": 3, + "iterator": true, + "latedef": true, + "maxcomplexity": 10, + "maxdepth": 50, + "maxerr": 50, + "maxlen": 250, + "maxparams": 50, + "maxstatements": 30, + "newcap": true, + "noarg": true, + "nonbsp": true, + "nonew": true, + "notypeof": true, + "shadow": "outer", + "undef": true, + "unused": true, + + "globals": { + "module": false, + "model": true, + "Alfresco": true, + "YAHOO": false, + "appContext": false, + "PDFJS": false, + "AlfrescoUtil": true, + "msg": false + }, + + "expr": true, + "strict": false, + + "browser": true, + "dojo": true +} diff --git a/README.txt b/README.txt index b9362315b3..637a6736fd 100644 --- a/README.txt +++ b/README.txt @@ -1,102 +1,102 @@ -Configuring and starting Alfresco/Share: ----------------------------------------- - -- Clone the project (e.g. git clone git@gitlab.alfresco.com:records-management/records-management.git) - -- Import the project as a maven project - -- Start the Alfresco/Share instances with the following commands: - - mvn clean install -Pstart-repo - mvn clean install -Pstart-share - - (these commands work best if run from the specific directories, e.g. start share from - rm-enterprise/rm-enterprise-share/ or rm-community/rm-community-share/ ) - - -Configuring a different DB other than H2 (e.g. MySQL or PostgreSQL): --------------------------------------------------------------------- - -- Create a file called "local.properties" under src/main/resources in alfresco-rm-enterprise-repo - -- Add the following properties in this new file - my.db.name -> The name of the database schema - my.db.port -> The port number for your database (default port number for postgres is 5432 and for mysql it is 3306) - -- Run the following commands to start your Alfresco instance: - - to start Alfresco (using Postgres): - mvn clean install -Pstart-repo,use-postgres - - to start Alfresco (using MySQL): - mvn clean install -Pstart-repo,use-mysql - - -Running integration test: -------------------------- - -In order to execute the integration tests run the following command (unit tests will be executed every time before you start Alfresco/Share): - -mvn clean install -Dskip.integrationtests=false - - -Running UI Automation tests: ----------------------------- - -To run the automated UI tests, change to the rm-automation directory and run: - - mvn clean install -Dskip.automationtests=false - -Depending on your local Firefox version, you may need to modify the rm-automation/pom.xml to use version 1.7 of selenium-grid - - -Updating License Headers: -------------------------- - -In order to refesh out of date license source headers run the following command: - -mvn clean install -Dlicense.update.dryrun=false - - -Running tests against latest Aikau snapshot: --------------------------------------------- - -The latest Aikau snapshot can be pulled by running the following command in rm-community: - - mvn clean install -DskipTests -Dalfresco.aikau.version=LATEST -U - -Thereafter start the Share instance and run automation tests as described above. - - -Configuring Outlook Integration: -------------------------------- - -To download and run RM with the Outlook Integration AMPs installed on the repo and Share use the following commands: - - mvn clean install -Pstart-repo,outlook-integration - mvn clean install -Pstart-share,outlook-integration - -Follow these instructions install licence and Outlook plugin: - - - http://docs.alfresco.com/outlook2.1/tasks/Outlook-license.html - - http://docs.alfresco.com/outlook2.1/tasks/Outlook-install_v2.html - - - - - -SNAPSHOT dependencies: ----------------------- - -If you're building Enterprise RM, the base project (Community) is pulled in via a snapshot dependency configured in maven. -This dependency will either be loaded from your local .m2 cache or from Nexus if the version in your .m2 doesn't exist or is old -(Old in maven terms is anything over 24hrs old). If maven fetches it from Nexus, your code it's unlikely to be the correct version. -You want to always use the version in your local cache - this means either doing a daily build at the root project level -that pushes a new copy of the correct version into your cache, or alternatively you could run mvn with the ---no-snapshot-dependency (or -nsu) option, which won't try to download a newer version. - - -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. +Configuring and starting Alfresco/Share: +---------------------------------------- + +- Clone the project (e.g. git clone git@gitlab.alfresco.com:records-management/records-management.git) + +- Import the project as a maven project + +- Start the Alfresco/Share instances with the following commands: + + mvn clean install -Pstart-repo + mvn clean install -Pstart-share + + (these commands work best if run from the specific directories, e.g. start share from + rm-enterprise/rm-enterprise-share/ or rm-community/rm-community-share/ ) + + +Configuring a different DB other than H2 (e.g. MySQL or PostgreSQL): +-------------------------------------------------------------------- + +- Create a file called "local.properties" under src/main/resources in alfresco-rm-enterprise-repo + +- Add the following properties in this new file + my.db.name -> The name of the database schema + my.db.port -> The port number for your database (default port number for postgres is 5432 and for mysql it is 3306) + +- Run the following commands to start your Alfresco instance: + + to start Alfresco (using Postgres): + mvn clean install -Pstart-repo,use-postgres + + to start Alfresco (using MySQL): + mvn clean install -Pstart-repo,use-mysql + + +Running integration test: +------------------------- + +In order to execute the integration tests run the following command (unit tests will be executed every time before you start Alfresco/Share): + +mvn clean install -Dskip.integrationtests=false + + +Running UI Automation tests: +---------------------------- + +To run the automated UI tests, change to the rm-automation directory and run: + + mvn clean install -Dskip.automationtests=false + +Depending on your local Firefox version, you may need to modify the rm-automation/pom.xml to use version 1.7 of selenium-grid + + +Updating License Headers: +------------------------- + +In order to refesh out of date license source headers run the following command: + +mvn clean install -Dlicense.update.dryrun=false + + +Running tests against latest Aikau snapshot: +-------------------------------------------- + +The latest Aikau snapshot can be pulled by running the following command in rm-community: + + mvn clean install -DskipTests -Dalfresco.aikau.version=LATEST -U + +Thereafter start the Share instance and run automation tests as described above. + + +Configuring Outlook Integration: +------------------------------- + +To download and run RM with the Outlook Integration AMPs installed on the repo and Share use the following commands: + + mvn clean install -Pstart-repo,outlook-integration + mvn clean install -Pstart-share,outlook-integration + +Follow these instructions install licence and Outlook plugin: + + - http://docs.alfresco.com/outlook2.1/tasks/Outlook-license.html + - http://docs.alfresco.com/outlook2.1/tasks/Outlook-install_v2.html + + + + + +SNAPSHOT dependencies: +---------------------- + +If you're building Enterprise RM, the base project (Community) is pulled in via a snapshot dependency configured in maven. +This dependency will either be loaded from your local .m2 cache or from Nexus if the version in your .m2 doesn't exist or is old +(Old in maven terms is anything over 24hrs old). If maven fetches it from Nexus, your code it's unlikely to be the correct version. +You want to always use the version in your local cache - this means either doing a daily build at the root project level +that pushes a new copy of the correct version into your cache, or alternatively you could run mvn with the +--no-snapshot-dependency (or -nsu) option, which won't try to download a newer version. + + +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. diff --git a/l10n.properties b/l10n.properties index 04791b76ff..663ca0f168 100644 --- a/l10n.properties +++ b/l10n.properties @@ -1,4 +1,4 @@ -# Localisation config overrides for Records Management module -MESSAGE_SEARCH_PATH="rm-community/rm-community-repo/config rm-community/rm-community-share rm-community/rm-share/source rm-enterprise/rm-enterprise-repo/src/main rm-enterprise/rm-enterprise-share/src/main " -EXCLUDED_FILES="$EXCLUDED_FILES rm-method-security.properties springloaded.properties file-mapping.properties classified-content-notForTranslating.properties notForTranslating" -EXTENSION_PREFIX=-RM +# Localisation config overrides for Records Management module +MESSAGE_SEARCH_PATH="rm-community/rm-community-repo/config rm-community/rm-community-share rm-community/rm-share/source rm-enterprise/rm-enterprise-repo/src/main rm-enterprise/rm-enterprise-share/src/main " +EXCLUDED_FILES="$EXCLUDED_FILES rm-method-security.properties springloaded.properties file-mapping.properties classified-content-notForTranslating.properties notForTranslating" +EXTENSION_PREFIX=-RM diff --git a/license/alfresco_community/header.txt b/license/alfresco_community/header.txt index 06e85840e6..d850cee1ea 100644 --- a/license/alfresco_community/header.txt +++ b/license/alfresco_community/header.txt @@ -1,18 +1,18 @@ -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 +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 . \ No newline at end of file diff --git a/license/alfresco_community/license.txt b/license/alfresco_community/license.txt index e8bec28dfa..cca7fc278f 100644 --- a/license/alfresco_community/license.txt +++ b/license/alfresco_community/license.txt @@ -1,165 +1,165 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/license/licenses.properties b/license/licenses.properties index c9c434ed06..19b06c5c37 100644 --- a/license/licenses.properties +++ b/license/licenses.properties @@ -1,2 +1,2 @@ -alfresco_community=Alfresco Community +alfresco_community=Alfresco Community alfresco_enterprise=Alfresco Enterprise \ No newline at end of file diff --git a/rm-community/.editorConfig b/rm-community/.editorConfig index 2dcf5d5e94..48fa6b4b8e 100644 --- a/rm-community/.editorConfig +++ b/rm-community/.editorConfig @@ -1,17 +1,17 @@ - -# EditorConfig file: http://editorconfig.org/ -# Syntax at: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties - -# This is the Top level for the RM project -root = true - -# All files should use spaces. -[*] -indent_style = space - -# Just JS for now. -[*.js] -indent_size = 3 -trim_trailing_whitespace = true - -#TODO: css, xml, ftl, etc. + +# EditorConfig file: http://editorconfig.org/ +# Syntax at: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties + +# This is the Top level for the RM project +root = true + +# All files should use spaces. +[*] +indent_style = space + +# Just JS for now. +[*.js] +indent_size = 3 +trim_trailing_whitespace = true + +#TODO: css, xml, ftl, etc. diff --git a/rm-community/.jshintrc b/rm-community/.jshintrc index 8bc7b445a7..a54fb37ca2 100644 --- a/rm-community/.jshintrc +++ b/rm-community/.jshintrc @@ -1,45 +1,45 @@ - -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "es3": true, - "forin": true, - "freeze": true, - "funcscope": true, - "immed": true, - "indent": 3, - "iterator": true, - "latedef": true, - "maxcomplexity": 10, - "maxdepth": 50, - "maxerr": 50, - "maxlen": 250, - "maxparams": 50, - "maxstatements": 30, - "newcap": true, - "noarg": true, - "nonbsp": true, - "nonew": true, - "notypeof": true, - "shadow": "outer", - "undef": true, - "unused": true, - - "globals": { - "module": false, - "model": true, - "Alfresco": true, - "YAHOO": false, - "appContext": false, - "PDFJS": false, - "AlfrescoUtil": true, - "msg": false - }, - - "expr": true, - "strict": false, - - "browser": true, - "dojo": true + +{ + "bitwise": true, + "curly": true, + "eqeqeq": true, + "es3": true, + "forin": true, + "freeze": true, + "funcscope": true, + "immed": true, + "indent": 3, + "iterator": true, + "latedef": true, + "maxcomplexity": 10, + "maxdepth": 50, + "maxerr": 50, + "maxlen": 250, + "maxparams": 50, + "maxstatements": 30, + "newcap": true, + "noarg": true, + "nonbsp": true, + "nonew": true, + "notypeof": true, + "shadow": "outer", + "undef": true, + "unused": true, + + "globals": { + "module": false, + "model": true, + "Alfresco": true, + "YAHOO": false, + "appContext": false, + "PDFJS": false, + "AlfrescoUtil": true, + "msg": false + }, + + "expr": true, + "strict": false, + + "browser": true, + "dojo": true } \ No newline at end of file diff --git a/rm-community/LICENSE.txt b/rm-community/LICENSE.txt index e8bec28dfa..cca7fc278f 100644 --- a/rm-community/LICENSE.txt +++ b/rm-community/LICENSE.txt @@ -1,165 +1,165 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml b/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml index f30a9cb9b0..8c76027779 100644 --- a/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/extension/subsystems/imap/default/default/rm-imap-server-context.xml @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml index 5ce959d53f..7a6053d037 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/action-context.xml @@ -1,66 +1,66 @@ - - - - - - - - - - alfresco.module.org_alfresco_module_rm.messages.actions - - - - - - - - - - - - - - {http://www.alfresco.org/model/content/1.0}content - - - - - - - - - - - - - - {http://www.alfresco.org/model/content/1.0}content - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + alfresco.module.org_alfresco_module_rm.messages.actions + + + + + + + + + + + + + + {http://www.alfresco.org/model/content/1.0}content + + + + + + + + + + + + + + {http://www.alfresco.org/model/content/1.0}content + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties index 15d8ccbc46..19e5f49c9a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties @@ -1,88 +1,88 @@ -# Enable ghosting of records on deletion -rm.ghosting.enabled=true - -# Notification configuration -rm.notification.role=RecordsManager -# NOTE: the notification subject can now be set within the usual I18N property files per notification template - -# -# Turn off imap server attachments if we are using RM. -# TODO : Longer term needs to have a query based, dynamic -# exclusion for RM sites. -# -imap.server.attachments.extraction.enabled=false - -# -# Enable auditing -# -audit.enabled=true -audit.rm.enabled=true -#audit.rm.runas=admin - -#audit.filter.alfresco-access.transaction.user=~null;.* - -# -# Extended permission service cache sizing -# -cache.writersSharedCache.maxItems=10000 -cache.writersSharedCache.cluster.type=fully-distributed - -# -# Indicates whether RM rules will be run as Admin or not by default -# -rm.rule.runasadmin=true - -# -# Auto-complete suggestion parameters -# -# The minimum size of fragment supplied that will trigger a search for suggestions for auto completion -rm.autocompletesuggestion.minfragmentsize=2 -# The maximum number of path suggestions to supply -rm.autocompletesuggestion.maxsuggestions.path=5 -# The maximum number of node suggestions to supply -rm.autocompletesuggestion.maxsuggestions.node=5 -# The maximum number of date suggestions to supply -rm.autocompletesuggestion.maxsuggestions.date=5 -# Comma separated list of types/aspects to be used by the node parameter autocomplete suggester -rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes=rma:record,cm:content - -# -# Global RM retention lifecycle trigger cron job expression -# -rm.dispositionlifecycletrigger.cronexpression=0 0/5 * * * ? - -# -# Records contributors group -# -# if false then record contributor check is ignored and all users can contribute records from -# a collaboration site, if true then a user must be a member of the records contributor group -# in order for them to contribute a record from a collaboration site. Default value 'false'. -rm.record.contributors.group.enabled=false -# record contributors group, default value 'RECORD_CONTRIBUTORS' -rm.record.contributors.group.name=RECORD_CONTRIBUTORS - -# -# Content cleansing -# -rm.content.cleansing.enabled=false -rm.content.cleaner=contentCleanser.522022M - -# Indicates whether mandatory properties are checked before completing a record -# -rm.completerecord.mandatorypropertiescheck.enabled=true - -# -# Indicates whether the existing file plan is converted to a standard file plan during -# upgrade to V2.2, otherwise it will be converted to a DoD compliant file plan. -# -# Note that when converted to a standard file plan that DoD related record meta-data remains -# on the individual records and will not be visible in the UI, but can be assessed via -# deprecated model properties in the rma namespace. -# -rm.patch.v22.convertToStandardFilePlan=false - -# -# Extended auto-version behaviour. If true and other auto-version properties are satisfied, then -# a document will be auto-versioned when its type is changed. -# -version.store.enableAutoVersionOnTypeChange=false +# Enable ghosting of records on deletion +rm.ghosting.enabled=true + +# Notification configuration +rm.notification.role=RecordsManager +# NOTE: the notification subject can now be set within the usual I18N property files per notification template + +# +# Turn off imap server attachments if we are using RM. +# TODO : Longer term needs to have a query based, dynamic +# exclusion for RM sites. +# +imap.server.attachments.extraction.enabled=false + +# +# Enable auditing +# +audit.enabled=true +audit.rm.enabled=true +#audit.rm.runas=admin + +#audit.filter.alfresco-access.transaction.user=~null;.* + +# +# Extended permission service cache sizing +# +cache.writersSharedCache.maxItems=10000 +cache.writersSharedCache.cluster.type=fully-distributed + +# +# Indicates whether RM rules will be run as Admin or not by default +# +rm.rule.runasadmin=true + +# +# Auto-complete suggestion parameters +# +# The minimum size of fragment supplied that will trigger a search for suggestions for auto completion +rm.autocompletesuggestion.minfragmentsize=2 +# The maximum number of path suggestions to supply +rm.autocompletesuggestion.maxsuggestions.path=5 +# The maximum number of node suggestions to supply +rm.autocompletesuggestion.maxsuggestions.node=5 +# The maximum number of date suggestions to supply +rm.autocompletesuggestion.maxsuggestions.date=5 +# Comma separated list of types/aspects to be used by the node parameter autocomplete suggester +rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes=rma:record,cm:content + +# +# Global RM retention lifecycle trigger cron job expression +# +rm.dispositionlifecycletrigger.cronexpression=0 0/5 * * * ? + +# +# Records contributors group +# +# if false then record contributor check is ignored and all users can contribute records from +# a collaboration site, if true then a user must be a member of the records contributor group +# in order for them to contribute a record from a collaboration site. Default value 'false'. +rm.record.contributors.group.enabled=false +# record contributors group, default value 'RECORD_CONTRIBUTORS' +rm.record.contributors.group.name=RECORD_CONTRIBUTORS + +# +# Content cleansing +# +rm.content.cleansing.enabled=false +rm.content.cleaner=contentCleanser.522022M + +# Indicates whether mandatory properties are checked before completing a record +# +rm.completerecord.mandatorypropertiescheck.enabled=true + +# +# Indicates whether the existing file plan is converted to a standard file plan during +# upgrade to V2.2, otherwise it will be converted to a DoD compliant file plan. +# +# Note that when converted to a standard file plan that DoD related record meta-data remains +# on the individual records and will not be visible in the UI, but can be assessed via +# deprecated model properties in the rma namespace. +# +rm.patch.v22.convertToStandardFilePlan=false + +# +# Extended auto-version behaviour. If true and other auto-version properties are satisfied, then +# a document will be auto-versioned when its type is changed. +# +version.store.enableAutoVersionOnTypeChange=false diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml index 6ceab3c551..7e8cfc0eb6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/audit/rm-audit.xml @@ -1,90 +1,90 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml index cc6fe1f97e..4cbf4f39c7 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml @@ -1,254 +1,254 @@ - - - - - - - workspace - SpacesStore - rm_config_folder - Records Management - Records Management - Configuration information for the Records Management application. - - - - - - - - - - - workspace - SpacesStore - rm_event_config - Records management event configuration. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json|mimetype=text/plain|encoding=UTF-8 - rm_event_config.json - rm_event_config.json - - - - - - - - - workspace - SpacesStore - records_management_custom_model - Records Management Custom Model - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml|mimetype=text/plain|encoding=UTF-8 - recordsCustomModel.xml - recordsCustomModel.xml - {http://www.alfresco.org/model/rmcustom/1.0}rmcustom - Records Management Custom Model - Alfresco - 1.0 - true - - - - - - workspace - SpacesStore - rm_behavior_scripts - Records Management Behavior Scripts - Records Management Behavior Scripts - Scripts intended for execution in response to RM events. - - - - - - - - - - workspace - SpacesStore - Records management sample script. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js|mimetype=text/javascript|encoding=UTF-8 - onCreate_supersedes.js - onCreate_supersedes.js - - - - - - - - - workspace - SpacesStore - rm_scripts - Records Management Scripts - Records Management Scripts - Scripts specific to RM that can also be executed by RM rules. - - - - - - workspace - SpacesStore - records_management_email_templates - Records Management Email Templates - Records Management Email Templates - Email templates for records management. - - - - - - - - - - - - - - true - - Email template for notify records due for review job. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_ - notify-records-due-for-review-email.ftl - - notify-records-due-for-review-email.ftl - org_alfresco_module_rm_notificationTemplatePatch - - - - - - - - - - - - workspace - SpacesStore - record_superseded_template - Record superseded email template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl|mimetype=text/plain|encoding=UTF-8 - record-superseded-email.ftl - record-superseded-email.ftl - org_alfresco_module_rm_notificationTemplatePatch - - - - - - - - - - - workspace - SpacesStore - record_rejected_template - Record rejected email template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl|mimetype=text/plain|encoding=UTF-8 - record-rejected-email.ftl - record-rejected-email.ftl - org_alfresco_module_rm_notificationTemplatePatch - - - - - - - - - workspace - SpacesStore - rm_report_templates - Records Management Report Templates - Records Management Report Templates - Records management report templates. - - - - - - - - - - workspace - SpacesStore - rmr_destructionReport - Desruction report template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl|mimetype=text/plain|encoding=UTF-8 - Destruction Report Template - report_rmr_destructionReport.html.ftl - - - - - - - - - - - workspace - SpacesStore - rmr_transferReport - Transfer report template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl|mimetype=text/plain|encoding=UTF-8 - Transfer Report Template - report_rmr_transferReport.html.ftl - - - - - - - - - - - workspace - SpacesStore - rmr_holdReport - Hold report template. - contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl|mimetype=text/plain|encoding=UTF-8 - Hold Report Template - report_rmr_holdReport.html.ftl - - - - - - - - - - + + + + + + + workspace + SpacesStore + rm_config_folder + Records Management + Records Management + Configuration information for the Records Management application. + + + + + + + + + + + workspace + SpacesStore + rm_event_config + Records management event configuration. + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json|mimetype=text/plain|encoding=UTF-8 + rm_event_config.json + rm_event_config.json + + + + + + + + + workspace + SpacesStore + records_management_custom_model + Records Management Custom Model + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml|mimetype=text/plain|encoding=UTF-8 + recordsCustomModel.xml + recordsCustomModel.xml + {http://www.alfresco.org/model/rmcustom/1.0}rmcustom + Records Management Custom Model + Alfresco + 1.0 + true + + + + + + workspace + SpacesStore + rm_behavior_scripts + Records Management Behavior Scripts + Records Management Behavior Scripts + Scripts intended for execution in response to RM events. + + + + + + + + + + workspace + SpacesStore + Records management sample script. + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js|mimetype=text/javascript|encoding=UTF-8 + onCreate_supersedes.js + onCreate_supersedes.js + + + + + + + + + workspace + SpacesStore + rm_scripts + Records Management Scripts + Records Management Scripts + Scripts specific to RM that can also be executed by RM rules. + + + + + + workspace + SpacesStore + records_management_email_templates + Records Management Email Templates + Records Management Email Templates + Email templates for records management. + + + + + + + + + + + + + + true + + Email template for notify records due for review job. + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl|mimetype=text/plain|size=|encoding=UTF-8|locale=en_US_ + notify-records-due-for-review-email.ftl + + notify-records-due-for-review-email.ftl + org_alfresco_module_rm_notificationTemplatePatch + + + + + + + + + + + + workspace + SpacesStore + record_superseded_template + Record superseded email template. + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl|mimetype=text/plain|encoding=UTF-8 + record-superseded-email.ftl + record-superseded-email.ftl + org_alfresco_module_rm_notificationTemplatePatch + + + + + + + + + + + workspace + SpacesStore + record_rejected_template + Record rejected email template. + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl|mimetype=text/plain|encoding=UTF-8 + record-rejected-email.ftl + record-rejected-email.ftl + org_alfresco_module_rm_notificationTemplatePatch + + + + + + + + + workspace + SpacesStore + rm_report_templates + Records Management Report Templates + Records Management Report Templates + Records management report templates. + + + + + + + + + + workspace + SpacesStore + rmr_destructionReport + Desruction report template. + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl|mimetype=text/plain|encoding=UTF-8 + Destruction Report Template + report_rmr_destructionReport.html.ftl + + + + + + + + + + + workspace + SpacesStore + rmr_transferReport + Transfer report template. + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl|mimetype=text/plain|encoding=UTF-8 + Transfer Report Template + report_rmr_transferReport.html.ftl + + + + + + + + + + + workspace + SpacesStore + rmr_holdReport + Hold report template. + contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl|mimetype=text/plain|encoding=UTF-8 + Hold Report Template + report_rmr_holdReport.html.ftl + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl index 10a504415b..fa2aea61c6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl @@ -1,150 +1,150 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - -
- Records due for review. -
-
- ${date?datetime?string.full} -
-
-
-

Hi,

- -

The following records are now due for review:

- - <#if (args.records)??> - - <#list args.records as record> - - - - <#if record_has_next> - - - -
- - - - - -
- - - - - - - - - - - - -
${record.properties["rma:identifier"]!} ${record.name}
Click on this link to view the record:
- - ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${record.storeType}://${record.storeId}/${record.id} -
-
-
- - -

Sincerely,
- Alfresco ${productName!""}

-
-
-
-
 
-
- To find out more about Alfresco ${productName!""} visit http://www.alfresco.com -
-
 
-
- -
-
-
- - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
+ + +
+ Records due for review. +
+
+ ${date?datetime?string.full} +
+
+
+

Hi,

+ +

The following records are now due for review:

+ + <#if (args.records)??> + + <#list args.records as record> + + + + <#if record_has_next> + + + +
+ + + + + +
+ + + + + + + + + + + + +
${record.properties["rma:identifier"]!} ${record.name}
Click on this link to view the record:
+ + ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${record.storeType}://${record.storeId}/${record.id} +
+
+
+ + +

Sincerely,
+ Alfresco ${productName!""}

+
+
+
+
 
+
+ To find out more about Alfresco ${productName!""} visit http://www.alfresco.com +
+
 
+
+ +
+
+
+ + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js index 81ebd9917d..3adffbdb1f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/onCreate_supersedes.js @@ -1,41 +1,41 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Main entrypoint for script. - * - * @method main - */ -function main() -{ - // Log debug message - logger.log("Record " + node.name + " has been superseded. Sending notification"); - - // Send notification - rmService.sendSupersededNotification(node); -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Main entrypoint for script. + * + * @method main + */ +function main() +{ + // Log debug message + logger.log("Record " + node.name + " has been superseded. Sending notification"); + + // Send notification + rmService.sendSupersededNotification(node); +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl index b8ce310962..8b85ffaee8 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl @@ -1,146 +1,146 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - -
- Record has been rejected -
-
- ${args.rejectDate?datetime?string.full} -
-
-
-

Hello ${args.recordCreator},

- -

${args.rejectedPerson} has rejected the following record with this reason:

- -

${args.rejectReason}

- - - - - - -
- - - - - -
- - - - - - - - - - - - -
${args.recordId} ${args.recordName}
Click on this link to view the record:
- - ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${args.record.storeType}://${args.record.storeId}/${args.record.id} -
-
-
- -

Sincerely,
- Alfresco ${productName!""}

-
-
-
-
 
-
- To find out more about Alfresco ${productName!""} visit http://www.alfresco.com -
-
 
-
- -
-
-
- - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
+ + +
+ Record has been rejected +
+
+ ${args.rejectDate?datetime?string.full} +
+
+
+

Hello ${args.recordCreator},

+ +

${args.rejectedPerson} has rejected the following record with this reason:

+ +

${args.rejectReason}

+ + + + + + +
+ + + + + +
+ + + + + + + + + + + + +
${args.recordId} ${args.recordName}
Click on this link to view the record:
+ + ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${args.record.storeType}://${args.record.storeId}/${args.record.id} +
+
+
+ +

Sincerely,
+ Alfresco ${productName!""}

+
+
+
+
 
+
+ To find out more about Alfresco ${productName!""} visit http://www.alfresco.com +
+
 
+
+ +
+
+
+ + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl index 64088cf385..238b460ec1 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl @@ -1,144 +1,144 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - -
- Superseded record. -
-
- ${date?datetime?string.full} -
-
-
-

Hi,

- -

The following record been superseded:

- - - - - - -
- - - - - -
- - - - - - - - - - - - -
${args.record.properties["rma:identifier"]!} ${args.record.name}
Click on this link to view the record:
- - ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${args.record.storeType}://${args.record.storeId}/${args.record.id} -
-
-
- -

Sincerely,
- Alfresco ${productName!""}

-
-
-
-
 
-
- To find out more about Alfresco ${productName!""} visit http://www.alfresco.com -
-
 
-
- -
-
-
- - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
+ + +
+ Superseded record. +
+
+ ${date?datetime?string.full} +
+
+
+

Hi,

+ +

The following record been superseded:

+ + + + + + +
+ + + + + +
+ + + + + + + + + + + + +
${args.record.properties["rma:identifier"]!} ${args.record.name}
Click on this link to view the record:
+ + ${shareUrl}/page/site/${args.site}/document-details?nodeRef=${args.record.storeType}://${args.record.storeId}/${args.record.id} +
+
+
+ +

Sincerely,
+ Alfresco ${productName!""}

+
+
+
+
 
+
+ To find out more about Alfresco ${productName!""} visit http://www.alfresco.com +
+
 
+
+ +
+
+
+ + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml index 9e3244ce81..15fad5c368 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml @@ -1,159 +1,159 @@ - - - - - - - - - Records Management Custom Model - Alfresco - 1.0 - - - - - - - - - - - - - - - - - - - - - - - listconstraint.rmc_smList.title - - - - - true - - - - - listconstraint.rmc_tlList.title - - - - - true - - - - - - - - - - Supplemental Marking List - d:text - false - true - - - - - - - - - - Records Management Custom Associations - - - - - Superseded By__Supersedes - - false - true - - - rma:record - false - true - - - - - Obsoleted By__Obsoletes - - false - true - - - rma:record - false - true - - - - - Next Version__Previous Version - - false - true - - - rma:record - false - true - - - - - Supporting Documentation__Supported Documentation - - false - true - - - rma:record - false - true - - - - - Cross-Reference - - false - true - - - rma:record - false - true - - - - - Rendition - - false - true - - - rma:record - false - true - - - - - - - - + + + + + + + + + Records Management Custom Model + Alfresco + 1.0 + + + + + + + + + + + + + + + + + + + + + + + listconstraint.rmc_smList.title + + + + + true + + + + + listconstraint.rmc_tlList.title + + + + + true + + + + + + + + + + Supplemental Marking List + d:text + false + true + + + + + + + + + + Records Management Custom Associations + + + + + Superseded By__Supersedes + + false + true + + + rma:record + false + true + + + + + Obsoleted By__Obsoletes + + false + true + + + rma:record + false + true + + + + + Next Version__Previous Version + + false + true + + + rma:record + false + true + + + + + Supporting Documentation__Supported Documentation + + false + true + + + rma:record + false + true + + + + + Cross-Reference + + false + true + + + rma:record + false + true + + + + + Rendition + + false + true + + + rma:record + false + true + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json index 6eb58eff72..3e2a07df1b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json @@ -1,76 +1,76 @@ -{ - "events" : - [ - { - "eventType" : "rmEventType.simple", - "eventName" : "case_closed", - "eventDisplayLabel" : "rmevent.case_closed" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "abolished", - "eventDisplayLabel" : "rmevent.abolished" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "re_designated", - "eventDisplayLabel" : "rmevent.re_designated" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "no_longer_needed", - "eventDisplayLabel" : "rmevent.no_longer_needed" - }, - { - "eventType" : "rmEventType.superseded", - "eventName" : "superseded", - "eventDisplayLabel" : "rmevent.superseded" - }, - { - "eventType" : "rmEventType.versioned", - "eventName" : "versioned", - "eventDisplayLabel" : "rmevent.versioned" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "study_complete", - "eventDisplayLabel" : "rmevent.study_complete" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "training_complete", - "eventDisplayLabel" : "rmevent.training_complete" - }, - { - "eventType" : "rmEventType.crossReferencedRecordTransfered", - "eventName" : "related_record_trasfered_inactive_storage", - "eventDisplayLabel" : "rmevent.related_record_trasfered_inactive_storage" - }, - { - "eventType" : "rmEventType.obsolete", - "eventName" : "obsolete", - "eventDisplayLabel" : "rmevent.obsolete" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "all_allowances_granted_are_terminated", - "eventDisplayLabel" : "rmevent.all_allowances_granted_are_terminated" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "WGI_action_complete", - "eventDisplayLabel" : "rmevent.WGI_action_complete" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "separation", - "eventDisplayLabel" : "rmevent.separation" - }, - { - "eventType" : "rmEventType.simple", - "eventName" : "case_complete", - "eventDisplayLabel" : "rmevent.case_complete" - } - ] -} - +{ + "events" : + [ + { + "eventType" : "rmEventType.simple", + "eventName" : "case_closed", + "eventDisplayLabel" : "rmevent.case_closed" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "abolished", + "eventDisplayLabel" : "rmevent.abolished" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "re_designated", + "eventDisplayLabel" : "rmevent.re_designated" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "no_longer_needed", + "eventDisplayLabel" : "rmevent.no_longer_needed" + }, + { + "eventType" : "rmEventType.superseded", + "eventName" : "superseded", + "eventDisplayLabel" : "rmevent.superseded" + }, + { + "eventType" : "rmEventType.versioned", + "eventName" : "versioned", + "eventDisplayLabel" : "rmevent.versioned" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "study_complete", + "eventDisplayLabel" : "rmevent.study_complete" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "training_complete", + "eventDisplayLabel" : "rmevent.training_complete" + }, + { + "eventType" : "rmEventType.crossReferencedRecordTransfered", + "eventName" : "related_record_trasfered_inactive_storage", + "eventDisplayLabel" : "rmevent.related_record_trasfered_inactive_storage" + }, + { + "eventType" : "rmEventType.obsolete", + "eventName" : "obsolete", + "eventDisplayLabel" : "rmevent.obsolete" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "all_allowances_granted_are_terminated", + "eventDisplayLabel" : "rmevent.all_allowances_granted_are_terminated" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "WGI_action_complete", + "eventDisplayLabel" : "rmevent.WGI_action_complete" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "separation", + "eventDisplayLabel" : "rmevent.separation" + }, + { + "eventType" : "rmEventType.simple", + "eventName" : "case_complete", + "eventDisplayLabel" : "rmevent.case_complete" + } + ] +} + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js index d9e2b062f6..92d5d0863e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rma_isClosed.js @@ -1,38 +1,38 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Main entrypoint for script. - * This sample script simply echoes the name of the node with the changed property. - * - * @method main - */ -function main() -{ - logger.log("Sample RM script. No-op run on node " + node.name); -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Main entrypoint for script. + * This sample script simply echoes the name of the node with the changed property. + * + * @method main + */ +function main() +{ + logger.log("Sample RM script. No-op run on node " + node.name); +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl index fa9f05d647..3c8e6fadb5 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl @@ -1,142 +1,142 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> - - - - - - - - - -
- - - - -
- - - - - - - -
- - - - -
- - - - - -
- - -
- ${message("file.report.destruction.report")} -
-
-
- - - - - - - - - - - - - -
${message("file.report.destroyed")} <#if node.hasAspect("rma:record")>${message("file.report.record")}<#else>${message("file.report.record.folder")}:${node.properties["rma:identifier"]} ${node.properties.name}
${message("file.report.disposition.authority")}: - <#if node.properties["rma:recordSearchDispositionAuthority"]??> - ${node.properties["rma:recordSearchDispositionAuthority"]} - -
${message("file.report.disposition.instructions")}: - <#if node.properties["rma:recordSearchDispositionInstructions"]??> - ${node.properties["rma:recordSearchDispositionInstructions"]} - -
- <#if node.childAssociations["cm:contains"]??> -
- - - - - -
${message("file.report.destroyed.records")}:
- - - - -
- - <#list node.childAssociations["cm:contains"] as child> - - - - - -
- - - - - - -
${child.properties["rma:identifier"]} ${child.properties.name}
-
-
- -
-
-
-
- -
-
-
- - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> + + + + + + + + + +
+ + + + +
+ + + + + + + +
+ + + + +
+ + + + + +
+ + +
+ ${message("file.report.destruction.report")} +
+
+
+ + + + + + + + + + + + + +
${message("file.report.destroyed")} <#if node.hasAspect("rma:record")>${message("file.report.record")}<#else>${message("file.report.record.folder")}:${node.properties["rma:identifier"]} ${node.properties.name}
${message("file.report.disposition.authority")}: + <#if node.properties["rma:recordSearchDispositionAuthority"]??> + ${node.properties["rma:recordSearchDispositionAuthority"]} + +
${message("file.report.disposition.instructions")}: + <#if node.properties["rma:recordSearchDispositionInstructions"]??> + ${node.properties["rma:recordSearchDispositionInstructions"]} + +
+ <#if node.childAssociations["cm:contains"]??> +
+ + + + + +
${message("file.report.destroyed.records")}:
+ + + + +
+ + <#list node.childAssociations["cm:contains"] as child> + + + + + +
+ + + + + + +
${child.properties["rma:identifier"]} ${child.properties.name}
+
+
+ +
+
+
+
+ +
+
+
+ + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl index 59b0c67a69..53ec30742c 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl @@ -1,146 +1,146 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> - - - - - - - - - -
- - - - -
- - - - - - - -
- - - - -
- - - - - -
- - -
- ${message("file.report.hold.report")} -
-
-
- - - - - - - - - - - - - - - - - - - - - -
${message("file.report.hold.name")}:${node.properties["cm:name"]}
${message("file.report.hold.description")}: - <#if node.properties["cm:description"]??> - ${node.properties["cm:description"]} - -
${message("file.report.hold.reason")}:${node.properties["rma:holdReason"]}
${message("file.report.createdby")}:${reportUser}
${message("file.report.createdon")}:${reportDate}
- <#if node.childAssociations["rma:frozenRecords"]??> -
- - - - - -
${message("file.report.hold.held")}:
- - - - -
- - <#list node.childAssociations["rma:frozenRecords"] as child> - - - - - -
- - - - - - -
${child.properties["rma:identifier"]} ${child.properties.name}
-
-
- -
-
-
-
- -
-
-
- - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> + + + + + + + + + +
+ + + + +
+ + + + + + + +
+ + + + +
+ + + + + +
+ + +
+ ${message("file.report.hold.report")} +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
${message("file.report.hold.name")}:${node.properties["cm:name"]}
${message("file.report.hold.description")}: + <#if node.properties["cm:description"]??> + ${node.properties["cm:description"]} + +
${message("file.report.hold.reason")}:${node.properties["rma:holdReason"]}
${message("file.report.createdby")}:${reportUser}
${message("file.report.createdon")}:${reportDate}
+ <#if node.childAssociations["rma:frozenRecords"]??> +
+ + + + + +
${message("file.report.hold.held")}:
+ + + + +
+ + <#list node.childAssociations["rma:frozenRecords"] as child> + + + + + +
+ + + + + + +
${child.properties["rma:identifier"]} ${child.properties.name}
+
+
+ +
+
+
+
+ +
+
+
+ + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl index 0c29ecc6af..e9ea680793 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl @@ -1,113 +1,113 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> - - - <#assign isAccession=node.properties["rma:transferAccessionIndicator"]> - - <#if isAccession> - ${message("file.report.acession.report")} - <#else> - ${message("file.report.transfer.report")} - - - - - <#if isAccession> -

${message("file.report.acession.report")}

- <#else> -

${message("file.report.transfer.report")}

- - - - - - - - - - - - - - - - - - -
${message("file.report.transfer.date")}:${node.properties["cm:created"]?string(message("file.report.date.format"))?html}
${message("file.report.transfer.location")}: - <#if isAccession> - ${message("file.report.nara")} - <#else> - ${node.properties["rma:transferLocation"]?html} - -
${message("file.report.performed.by")}:${node.properties["cm:creator"]?html}
${message("file.report.disposition.authority")}:${properties["dispositionAuthority"]?html}
-

${message("file.report.transferred.items")}

-
- <#list properties.transferNodes as transferNode> - <#if transferNode.properties["isFolder"]> - <@generateTransferFolderHTML transferNode/> - <#else> - <@generateTransferRecordHTML transferNode/> - - -
- - - -<#macro generateTransferFolderHTML transferNode> - - ${transferNode.properties["name"]?html} - - (${message("file.report.unique.folder.identifier")}: ${transferNode.properties["identifier"]?html}) -
- <#list transferNode.properties["records"] as record> - <@generateTransferRecordHTML record/> - -
- - -<#macro generateTransferRecordHTML transferNode> -
- - ${transferNode.properties["name"]?html} - - (${message("file.report.unique.record.identifier")}: ${transferNode.properties["identifier"]?html}) - <#if transferNode.properties["isDeclared"]> - ${message("file.report.declared.by")} - ${transferNode.properties["declaredBy"]?html} - ${message("file.report.declared.on")} - ${transferNode.properties["declaredOn"]?string(message("file.report.date.format"))?html} - -
- +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> + + + <#assign isAccession=node.properties["rma:transferAccessionIndicator"]> + + <#if isAccession> + ${message("file.report.acession.report")} + <#else> + ${message("file.report.transfer.report")} + + + + + <#if isAccession> +

${message("file.report.acession.report")}

+ <#else> +

${message("file.report.transfer.report")}

+ + + + + + + + + + + + + + + + + + +
${message("file.report.transfer.date")}:${node.properties["cm:created"]?string(message("file.report.date.format"))?html}
${message("file.report.transfer.location")}: + <#if isAccession> + ${message("file.report.nara")} + <#else> + ${node.properties["rma:transferLocation"]?html} + +
${message("file.report.performed.by")}:${node.properties["cm:creator"]?html}
${message("file.report.disposition.authority")}:${properties["dispositionAuthority"]?html}
+

${message("file.report.transferred.items")}

+
+ <#list properties.transferNodes as transferNode> + <#if transferNode.properties["isFolder"]> + <@generateTransferFolderHTML transferNode/> + <#else> + <@generateTransferRecordHTML transferNode/> + + +
+ + + +<#macro generateTransferFolderHTML transferNode> + + ${transferNode.properties["name"]?html} + + (${message("file.report.unique.folder.identifier")}: ${transferNode.properties["identifier"]?html}) +
+ <#list transferNode.properties["records"] as record> + <@generateTransferRecordHTML record/> + +
+ + +<#macro generateTransferRecordHTML transferNode> +
+ + ${transferNode.properties["name"]?html} + + (${message("file.report.unique.record.identifier")}: ${transferNode.properties["identifier"]?html}) + <#if transferNode.properties["isDeclared"]> + ${message("file.report.declared.by")} + ${transferNode.properties["declaredBy"]?html} + ${message("file.report.declared.on")} + ${transferNode.properties["declaredOn"]?string(message("file.report.date.format"))?html} + +
+ diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/groups/rm-capability-groups-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/groups/rm-capability-groups-context.xml index dc769ec8ad..0e940d34ef 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/groups/rm-capability-groups-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/groups/rm-capability-groups-context.xml @@ -1,85 +1,85 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-audit-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-audit-context.xml index 89139b93b2..5548567780 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-audit-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-audit-context.xml @@ -1,73 +1,73 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml index d5509295c4..135a49616a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml @@ -1,232 +1,232 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-config-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-config-context.xml index 1cf4201a4e..5cc9dffd5b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-config-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-config-context.xml @@ -1,94 +1,94 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml index 5f4f44880b..3dc524bfe4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml @@ -1,316 +1,316 @@ - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - FILE_PLAN_COMPONENT - - - - - - - - - - - - - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - TRANSFER - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + FILE_PLAN_COMPONENT + + + + + + + + + + + + + + + + + + + + + RECORD + RECORD_FOLDER + + + + + + + + + + + + + + + + + + + + TRANSFER + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-event-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-event-context.xml index 3ed05e48aa..c9362ed9d6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-event-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-event-context.xml @@ -1,42 +1,42 @@ - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml index b42957bd9f..e8eeae8602 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml @@ -1,97 +1,97 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FILE_PLAN - - - - - - - - - - - - - - - - RECORD_CATEGORY - DISPOSITION_SCHEDULE - - - - - - - - - - - - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FILE_PLAN + + + + + + + + + + + + + + + + RECORD_CATEGORY + DISPOSITION_SCHEDULE + + + + + + + + + + + + + + + + + + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml index 8db7ba051b..5a1cceb841 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml @@ -1,171 +1,171 @@ - - - - - - - - - - - - - FILE_PLAN - HOLD_CONTAINER - - - - - - - - - - - - - - - - - HOLD - - - - - - - - - - - - - - - - - HOLD - - - - - - - - - - - - - - - - - HOLD - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - HOLD - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - HOLD - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + FILE_PLAN + HOLD_CONTAINER + + + + + + + + + + + + + + + + + HOLD + + + + + + + + + + + + + + + + + HOLD + + + + + + + + + + + + + + + + + HOLD + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + HOLD + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + HOLD + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml index fdb478b0a2..91a50ef89d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml @@ -1,249 +1,249 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + + + + + + + + RECORD_CATEGORY + + + + + + + + + + + + + + + FILE_PLAN + RECORD_CATEGORY + RECORD_FOLDER + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml index 8b82723be3..9ca62f1f72 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml @@ -1,389 +1,389 @@ - - - - - - - - - - - - - - - - - - - RECORD - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + RECORD + RECORD_FOLDER + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml index dc42dd25f2..d22c69babd 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml @@ -1,230 +1,230 @@ - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + + + + + + + + + + + + + + RECORD_CATEGORY + + + + + + + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml index 459b7790a2..2ddba0e1ea 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml @@ -1,23 +1,23 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-rule-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-rule-context.xml index 3175faf8ed..1ad04ef1d7 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-rule-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-rule-context.xml @@ -1,20 +1,20 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml index 1d25bb38b2..2d390542d8 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml @@ -1,61 +1,61 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml index f019c27a3e..d7d9999f20 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml @@ -1,36 +1,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml index 9b40dfe679..be126f3e62 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml @@ -1,1046 +1,1046 @@ - - - - - - - Reports - 0318 - Reports - Record series for reports - - - - - - - - - - - - - AIS Audit Records - 0318-01 - AIS Audit Records - Consisting of AIS Security Officer or Terminal Area Security Officer weekly audit records of audit actions performed on all AIS as required by applicable policy which are maintained by any JS/combatant command activity. - week|1 - true - - - - - - - - - N1-218-00-4 item 023 - Cut off monthly, hold 1 month, then destroy. - - - - - - - - cutoff - monthend|1 - - - - - destroy - month|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - January AIS Audit Records - January AIS Audit Records - 0318-01-01 - week|1 - true - - - - - - - - - - - - - - - Unit Manning Documents - 0318-02 - Unit Manning Documents - Consisting of manpower document and monthly strength report forwarded to OSD and other activities which are maintained by personnel office as the official record copy. - - - - - - - - - N1-218-89-1 item 002 - Cut off every 3 months, hold 3 months, then destroy. - - - - - - - - cutoff - quarterend|1 - - - - - destroy - month|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - 1st Quarter Unit Manning Documents - 0318-02-01 - 1st Quarter Unit Manning Documents - - - - - - - - - - - - - - - Overtime Reports - 0318-03 - Overtime reports and related documents - Overtime reports and related documents which are maintained by JS/combatant controller as the official record copy. - - - - - - - - - N1-218-00-7 item 28 - Cut off at end of FY, hold 3 years, then destroy. - - - - - - - cutoff - fyend|1 - - - - - destroy - year|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - FY08 Overtime Reports - 0318-03-01 - FY08 Overtime Reports - - - - - - - - - - - - - - - Bi-Weekly Cost Reports - 0318-04 - Bi-Weekly Cost Reports - Bi-wekly cost reports which are maintained by JS/combatant command controler as the official record copy. - - - - - - - - - N1-218-00-7 item 2 - Cut off at end of CY, hold 2 years, then destroy. - - - - - - - cutoff - yearend|1 - - - - - destroy - year|2 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - CY08 Unit Manning Documents - 0318-04-01 - CY08 Unit Manning Documents - - - - - - - - - - - - - - - - Military Files - 0412 - Military Files - Record series for military files - - - - - - - - - - - - - Military Assignment Documents - 0412-01 - Military Assignment Documents - Policy matters pertaining to military assignments which are maintained by any JS/combatant command activity as the official record copy. - - - - - - - - - N1-218-00-3 item 30 - Cut off when superseded, hold 5 years, then destroy. - true - - - - - - - cutoff - superseded - - - - - destroy - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - - - - - - - - Official Military Personnel Privilege Card Applications - 0412-02 - Official Military Personnel Privilege Card Applications - Consisting of: documents reflecting applications for priviege cards and ration cards, including Department of Defense Forms (DD Forms) 1172 (Application for Unifomed Services Identification and Privilege Card) and similar documents which are maintained by any JS/combatant command activity. - - - - - - - - - N1-218-00-3 item 20 - Cut off when no longer needed and destroy immediately. - - - - - - - cutoff - no_longer_needed - - - - - destroy - immediately|0 - - - - - - - - - - - - COL Bob Johnson - 0412-02-01 - COL Bob Johnson - - - - - PFC Alan Murphy - 0412-02-02 - PFC Alan Murphy - - - - - - - - - - - - - - - Personnel Security Program Records - 0412-03 - Personnel Security Program Records - Position sensitivity files including requests for information relating to the designation of sensitive and non-sensitive personnel positions in an agency and results of final actions taken consisting of approved requests which are maintained by any JS/combatant command activity - - - - - - - - - N1-218-00-4 item 017 - Cutoff when position is abolished, re-designated, or no longer needed, whichever is later. Destroy immediately after cutoff. - - - - - - - cutoff - - abolished - re_designated - no_longer_needed - - and - - - - - destroy - immediately|0 - - - - - - - - - - - - Commander's Administrative Assistant - 0412-03-01 - Commander's Administrative Assistant - - - - - Equal Opportunity Coordinator - 0412-03-02 - Equal Opportunity Coordinator - - - - - - - - - - - - - - - - Civilian Files - 0430 - Civilian Files - Record series for civilian files - - - - - - - - - - - - - Employee Performance File System Records - 0430-01 - Employee Performance File System Records - Consisting of: performance records superseded through an administrative, judicial, or quasi-judicial procedure which are maintained by any JS/combatant command activity - - - - - - - - - GRS 1 item 23b(1) - Cutoff when superseded. Destroy immediately after cutoff - true - - - - - - - cutoff - superseded - - - - - destroy - immediately|0 - - - - - - - - - - - - - - - - - - - Foreign Employee Award Files - 0430-02 - Foreign Employee Award Files - Decorations to foreign nationals and US citizens not employed by the US Government consisting of: case files of recommendations, decisions, awards announcements, board meeting minutes, and related documents which are maintained by any JS/combatant command activity - - - - - - - - N1-218-00-3 item 18 - Permanent. Cut off on completion of case, hold 2 years, then retire to offline storage. Transfer to federal records holding area 5 years after retirement to offline storage. Transfer to NARA 25 years after cutoff. - - - - - - - cutoff - case_complete - - - - - transfer - Retire to offline storage. - Offline Storage - year|2 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - transfer - Transfer to federal records holding area. - Federal Records Holding - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}dispositionAsOf - - - - - accession - Transfer to NARA. - NARA - year|25 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - Christian Bohr - 0430-02-01 - Christian Bohr - - - - - Karl Planck - 0430-02-02 - Karl Planck - - - - - - - - - - - - - - - Case Files and Papers - 0430-03 - Case Files and Papers - Consisting of library containing information on personnel actions which are maintained by R&A Br and Deputy Chief Information Office - None - Disposal not authorized. Disposition pending NARA approval. - - - - - - - Gilbert Competency Hearing - 0430-03-01 - Gilbert Competency Hearing - - - - - - - - - - - - - - - Withholding of Within-Grade Increase (WGI) Records - 0430-04 - Withholding of Within-Grade Increase (WGI) Records - Files concerning an employee’s performance rating of record with work examples which establish less than fully successful performance, notice of withholding of WGI, employee's request for reconsideration of denied WGI, and decision concerning such a reconsideration request which are maintained by any JS/combatant command activity. - - - - - - - - - N1-218-00-3 item 16 - Cut off on completion of WGI action or on separation, whichever is earlier; hold 3 years, then destroy/delete. - - - - - - - cutoff - - WGI_action_complete - separation - - or - - - - - destroy - year|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - Gilbert WGI Records - 0430-04-01 - Gilbert WGI Records - - - - - - - - - - - - - - - Payroll Differential and Allowances - 0430-05 - Payroll Differential and Allowances - Consisting of: information to assist overseas civilian personnel offices to document employee eligibility for foreign post differential and foreign quarters and post allowances, including SF 1190 (Foreign Allowances Application, Grant, and Report) and similar information which are maintained by any JS/combatant command activity. - - - - - - - - - N1-218-00-3 item 3 - Cut off at end of Fiscal Year (FY) in which all allowances granted are terminated, hold 3 years, then destroy. - - - - - - - retain - all_allowances_granted_are_terminated - - - - - cutoff - fyend|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}dispositionAsOf - - - - - destroy - year|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - Martin Payroll Differential and Allowances - 0430-05-01 - Martin Payroll Differential and Allowances - - - - - - - - - - - - - - - - Miscellaneous Files - 0950 - Miscellaneous Files - Record series for miscellaneous files - - - - - - - - - - - - - Civilian Employee Training Program Records - 0950-01 - Civilian Employee Training Program Records - Decorations to foreign nationals and US citizens not employed by the US Government consisting of: case files of recommendations, decisions, awards announcements, board meeting minutes, and related documents which are maintained by any JS/combatant command activity - - - - - - - - GRS 1 item 29b - Cut off annually, hold 5 years, then destroy, or destroy when obsolete, whichever is earlier. - - - - - - - cutoff - year|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}dateFiled - - - - - destroy - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - obsolete - - - - - - - - - - - - Bob Prentice Training Records (2008) - 0950-01-01 - Bob Prentice Training Records (2008) - - - - - Beth Tanaka Training Records (2008) - 0950-01-02 - Beth Tanaka Training Records (2008) - - - - - Chuck Stevens Training Records (2008) - 0950-01-03 - Chuck Stevens Training Records (2008) - - - - - - - - - - - - - - - Purchase of Foreign Award Medals and Decorations - 0950-02 - Purchase of Foreign Award Medals and Decorations - Forms reflecting purchase of foreign award medals and decorations. - - - - - - - - - N1-218-00-3 item 11 - Cutoff when related record is transferred to inactive storage, hold 1 year, destroy. - true - - - - - - - cutoff - related_record_trasfered_inactive_storage - - - - - destroy - year|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - - - - - - - Monthly Cockpit Crew Training - 0950-03 - Monthly Cockpit/Crew Training - Consisting of skills training/evaluation forms, e.g., AF Form 4031. - - - - - - - - - N1-218-00-3 item 13 - Cutoff after training is complete, hold 1 year, destroy. - - - - - - - cutoff - training_complete - - - - - destroy - year|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - January Cockpit Crew Training - 0950-03-01 - January Cockpit/Crew Training - - - - - February Cockpit Crew Training - 0950-03-02 - February Cockpit/Crew Training - - - - - - - - - - - - - - - Science Advisor Records - 0950-04 - Science Advisor Records - Consisting of: reports, studies, tasking orders, and similar records. Reports are usually informal and unpublished. Records may be generated at all activities - - - - - - - - - N1-218-00-10 item 44 - Cut off on completion of study, hold 5 years, then transfer to Inactive Storage. Transfer to NARA 25 years after cutoff. - - - - - - - cutoff - study_complete - - - - - transfer - Transfer to inactive storage. - Inactive Storage - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - accession - Transfer to NARA. - NARA - year|25 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - Phoenix Mars Mission - 0950-04-01 - Phoenix Mars Mission - - - - - - - - - - - - + + + + + + + Reports + 0318 + Reports + Record series for reports + + + + + + + + + + + + + AIS Audit Records + 0318-01 + AIS Audit Records + Consisting of AIS Security Officer or Terminal Area Security Officer weekly audit records of audit actions performed on all AIS as required by applicable policy which are maintained by any JS/combatant command activity. + week|1 + true + + + + + + + + + N1-218-00-4 item 023 + Cut off monthly, hold 1 month, then destroy. + + + + + + + + cutoff + monthend|1 + + + + + destroy + month|1 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + + + January AIS Audit Records + January AIS Audit Records + 0318-01-01 + week|1 + true + + + + + + + + + + + + + + + Unit Manning Documents + 0318-02 + Unit Manning Documents + Consisting of manpower document and monthly strength report forwarded to OSD and other activities which are maintained by personnel office as the official record copy. + + + + + + + + + N1-218-89-1 item 002 + Cut off every 3 months, hold 3 months, then destroy. + + + + + + + + cutoff + quarterend|1 + + + + + destroy + month|3 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + + 1st Quarter Unit Manning Documents + 0318-02-01 + 1st Quarter Unit Manning Documents + + + + + + + + + + + + + + + Overtime Reports + 0318-03 + Overtime reports and related documents + Overtime reports and related documents which are maintained by JS/combatant controller as the official record copy. + + + + + + + + + N1-218-00-7 item 28 + Cut off at end of FY, hold 3 years, then destroy. + + + + + + + cutoff + fyend|1 + + + + + destroy + year|3 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + FY08 Overtime Reports + 0318-03-01 + FY08 Overtime Reports + + + + + + + + + + + + + + + Bi-Weekly Cost Reports + 0318-04 + Bi-Weekly Cost Reports + Bi-wekly cost reports which are maintained by JS/combatant command controler as the official record copy. + + + + + + + + + N1-218-00-7 item 2 + Cut off at end of CY, hold 2 years, then destroy. + + + + + + + cutoff + yearend|1 + + + + + destroy + year|2 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + CY08 Unit Manning Documents + 0318-04-01 + CY08 Unit Manning Documents + + + + + + + + + + + + + + + + Military Files + 0412 + Military Files + Record series for military files + + + + + + + + + + + + + Military Assignment Documents + 0412-01 + Military Assignment Documents + Policy matters pertaining to military assignments which are maintained by any JS/combatant command activity as the official record copy. + + + + + + + + + N1-218-00-3 item 30 + Cut off when superseded, hold 5 years, then destroy. + true + + + + + + + cutoff + superseded + + + + + destroy + year|5 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + + + + + + + + + + Official Military Personnel Privilege Card Applications + 0412-02 + Official Military Personnel Privilege Card Applications + Consisting of: documents reflecting applications for priviege cards and ration cards, including Department of Defense Forms (DD Forms) 1172 (Application for Unifomed Services Identification and Privilege Card) and similar documents which are maintained by any JS/combatant command activity. + + + + + + + + + N1-218-00-3 item 20 + Cut off when no longer needed and destroy immediately. + + + + + + + cutoff + no_longer_needed + + + + + destroy + immediately|0 + + + + + + + + + + + + COL Bob Johnson + 0412-02-01 + COL Bob Johnson + + + + + PFC Alan Murphy + 0412-02-02 + PFC Alan Murphy + + + + + + + + + + + + + + + Personnel Security Program Records + 0412-03 + Personnel Security Program Records + Position sensitivity files including requests for information relating to the designation of sensitive and non-sensitive personnel positions in an agency and results of final actions taken consisting of approved requests which are maintained by any JS/combatant command activity + + + + + + + + + N1-218-00-4 item 017 + Cutoff when position is abolished, re-designated, or no longer needed, whichever is later. Destroy immediately after cutoff. + + + + + + + cutoff + + abolished + re_designated + no_longer_needed + + and + + + + + destroy + immediately|0 + + + + + + + + + + + + Commander's Administrative Assistant + 0412-03-01 + Commander's Administrative Assistant + + + + + Equal Opportunity Coordinator + 0412-03-02 + Equal Opportunity Coordinator + + + + + + + + + + + + + + + + Civilian Files + 0430 + Civilian Files + Record series for civilian files + + + + + + + + + + + + + Employee Performance File System Records + 0430-01 + Employee Performance File System Records + Consisting of: performance records superseded through an administrative, judicial, or quasi-judicial procedure which are maintained by any JS/combatant command activity + + + + + + + + + GRS 1 item 23b(1) + Cutoff when superseded. Destroy immediately after cutoff + true + + + + + + + cutoff + superseded + + + + + destroy + immediately|0 + + + + + + + + + + + + + + + + + + + Foreign Employee Award Files + 0430-02 + Foreign Employee Award Files + Decorations to foreign nationals and US citizens not employed by the US Government consisting of: case files of recommendations, decisions, awards announcements, board meeting minutes, and related documents which are maintained by any JS/combatant command activity + + + + + + + + N1-218-00-3 item 18 + Permanent. Cut off on completion of case, hold 2 years, then retire to offline storage. Transfer to federal records holding area 5 years after retirement to offline storage. Transfer to NARA 25 years after cutoff. + + + + + + + cutoff + case_complete + + + + + transfer + Retire to offline storage. + Offline Storage + year|2 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + transfer + Transfer to federal records holding area. + Federal Records Holding + year|5 + {http://www.alfresco.org/model/recordsmanagement/1.0}dispositionAsOf + + + + + accession + Transfer to NARA. + NARA + year|25 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + Christian Bohr + 0430-02-01 + Christian Bohr + + + + + Karl Planck + 0430-02-02 + Karl Planck + + + + + + + + + + + + + + + Case Files and Papers + 0430-03 + Case Files and Papers + Consisting of library containing information on personnel actions which are maintained by R&A Br and Deputy Chief Information Office + None + Disposal not authorized. Disposition pending NARA approval. + + + + + + + Gilbert Competency Hearing + 0430-03-01 + Gilbert Competency Hearing + + + + + + + + + + + + + + + Withholding of Within-Grade Increase (WGI) Records + 0430-04 + Withholding of Within-Grade Increase (WGI) Records + Files concerning an employee’s performance rating of record with work examples which establish less than fully successful performance, notice of withholding of WGI, employee's request for reconsideration of denied WGI, and decision concerning such a reconsideration request which are maintained by any JS/combatant command activity. + + + + + + + + + N1-218-00-3 item 16 + Cut off on completion of WGI action or on separation, whichever is earlier; hold 3 years, then destroy/delete. + + + + + + + cutoff + + WGI_action_complete + separation + + or + + + + + destroy + year|3 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + Gilbert WGI Records + 0430-04-01 + Gilbert WGI Records + + + + + + + + + + + + + + + Payroll Differential and Allowances + 0430-05 + Payroll Differential and Allowances + Consisting of: information to assist overseas civilian personnel offices to document employee eligibility for foreign post differential and foreign quarters and post allowances, including SF 1190 (Foreign Allowances Application, Grant, and Report) and similar information which are maintained by any JS/combatant command activity. + + + + + + + + + N1-218-00-3 item 3 + Cut off at end of Fiscal Year (FY) in which all allowances granted are terminated, hold 3 years, then destroy. + + + + + + + retain + all_allowances_granted_are_terminated + + + + + cutoff + fyend|1 + {http://www.alfresco.org/model/recordsmanagement/1.0}dispositionAsOf + + + + + destroy + year|3 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + Martin Payroll Differential and Allowances + 0430-05-01 + Martin Payroll Differential and Allowances + + + + + + + + + + + + + + + + Miscellaneous Files + 0950 + Miscellaneous Files + Record series for miscellaneous files + + + + + + + + + + + + + Civilian Employee Training Program Records + 0950-01 + Civilian Employee Training Program Records + Decorations to foreign nationals and US citizens not employed by the US Government consisting of: case files of recommendations, decisions, awards announcements, board meeting minutes, and related documents which are maintained by any JS/combatant command activity + + + + + + + + GRS 1 item 29b + Cut off annually, hold 5 years, then destroy, or destroy when obsolete, whichever is earlier. + + + + + + + cutoff + year|1 + {http://www.alfresco.org/model/recordsmanagement/1.0}dateFiled + + + + + destroy + year|5 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + obsolete + + + + + + + + + + + + Bob Prentice Training Records (2008) + 0950-01-01 + Bob Prentice Training Records (2008) + + + + + Beth Tanaka Training Records (2008) + 0950-01-02 + Beth Tanaka Training Records (2008) + + + + + Chuck Stevens Training Records (2008) + 0950-01-03 + Chuck Stevens Training Records (2008) + + + + + + + + + + + + + + + Purchase of Foreign Award Medals and Decorations + 0950-02 + Purchase of Foreign Award Medals and Decorations + Forms reflecting purchase of foreign award medals and decorations. + + + + + + + + + N1-218-00-3 item 11 + Cutoff when related record is transferred to inactive storage, hold 1 year, destroy. + true + + + + + + + cutoff + related_record_trasfered_inactive_storage + + + + + destroy + year|1 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + + + + + + + + + Monthly Cockpit Crew Training + 0950-03 + Monthly Cockpit/Crew Training + Consisting of skills training/evaluation forms, e.g., AF Form 4031. + + + + + + + + + N1-218-00-3 item 13 + Cutoff after training is complete, hold 1 year, destroy. + + + + + + + cutoff + training_complete + + + + + destroy + year|1 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + January Cockpit Crew Training + 0950-03-01 + January Cockpit/Crew Training + + + + + February Cockpit Crew Training + 0950-03-02 + February Cockpit/Crew Training + + + + + + + + + + + + + + + Science Advisor Records + 0950-04 + Science Advisor Records + Consisting of: reports, studies, tasking orders, and similar records. Reports are usually informal and unpublished. Records may be generated at all activities + + + + + + + + + N1-218-00-10 item 44 + Cut off on completion of study, hold 5 years, then transfer to Inactive Storage. Transfer to NARA 25 years after cutoff. + + + + + + + cutoff + study_complete + + + + + transfer + Transfer to inactive storage. + Inactive Storage + year|5 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + accession + Transfer to NARA. + NARA + year|25 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + Phoenix Mars Mission + 0950-04-01 + Phoenix Mars Mission + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-capabilities-classification-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-capabilities-classification-context.xml index 04f71c3fa5..38866ec77a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-capabilities-classification-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-capabilities-classification-context.xml @@ -1,82 +1,82 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml index 3253405897..5d1b5768c0 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015-context.xml @@ -1,61 +1,61 @@ - - - - - - - - - - alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml - - - - - alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model - - - - - - - - - - - - - - - - - - - - - - alfresco.module.org_alfresco_module_rm.dod5015.messages.dod5015 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml + + + + + alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model + + + + + + + + + + + + + + + + + + + + + + alfresco.module.org_alfresco_module_rm.dod5015.messages.dod5015 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml index 2073d53b71..502f565bf6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/dod5015Model.xml @@ -1,434 +1,434 @@ - - - - - - - - DOD 5015 Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - Image Formats - - - Binary Image Interchange Format (BIIF) - GIF 89a - Graphic Image Format (GIF) 87a - Joint Photographic Experts Group (JPEG) (all versions) - Portable Network Graphics (PNG) 1.0 - Tagged Image Interchange Format (TIFF) 4.0 - TIFF 5.0 - TIFF 6.0 - - - true - - - - - - - - - DOD5015 Site - rma:rmsite - - - - - - DOD5015 File Plan - rma:filePlan - - - - - Record Series - rma:recordCategory - - - - - - - - - - DOD5015 Record - - - - Publication Date - d:date - true - - - - Originator - d:text - true - - true - false - false - - - - - Originating Organization - d:text - true - - true - false - false - - - - - Media Type - d:text - false - - true - false - false - - - - - Format - d:text - false - - true - false - false - - - - - Date Received - d:date - false - - - - - Addressee - d:text - false - - true - false - false - - - - Other Addressee - d:text - false - - true - false - false - - - - - - - - - Scanned Record - - - Image Format - d:text - - true - false - false - - - - Image Format and Version - d:text - true - - true - false - false - - - - - - - Image Resolution X - d:int - true - - - Image Resolution Y - d:int - true - - - Scanned Bit Depth - d:int - false - - - - - - PDF Record - - - Producing Application - d:text - true - - true - false - false - - - - Producing Application Version - d:text - true - - - PDF Version - d:text - true - - true - false - false - - - - Creating Application - d:text - false - - true - false - false - - - - Document Security Settings - d:text - false - - true - false - false - - - - - - - Digital Photograph Record - - - Caption - d:text - true - - - Photographer - d:text - false - - true - false - false - - - - Copyright - d:text - false - - true - false - false - - - - Bit Depth - d:text - false - - true - false - false - - - - Image Size X - d:int - false - - - Image Size Y - d:int - false - - - Image Source - d:text - false - - true - false - false - - - - Compression - d:text - false - - true - false - false - - - - ICC/ICM Profile - d:text - false - - true - false - false - - - - EXIF Information - d:text - false - - true - false - false - - - - - - - Web Record - - - Web File Name - d:text - true - - true - false - false - - - - Web Platform - d:text - true - - true - false - false - - - - Web Site Name - d:text - true - - true - false - false - - - - Web Site URL - d:text - true - - true - false - false - - - - Capture Method - d:text - true - - true - false - false - - - - Capture Date - d:date - true - - - Contact - d:text - true - - true - false - false - - - - Content Management System - d:text - false - - true - false - false - - - - - - - + + + + + + + + DOD 5015 Model + Roy Wetherall + 1.0 + + + + + + + + + + + + + + + + + + + + + + Image Formats + + + Binary Image Interchange Format (BIIF) + GIF 89a + Graphic Image Format (GIF) 87a + Joint Photographic Experts Group (JPEG) (all versions) + Portable Network Graphics (PNG) 1.0 + Tagged Image Interchange Format (TIFF) 4.0 + TIFF 5.0 + TIFF 6.0 + + + true + + + + + + + + + DOD5015 Site + rma:rmsite + + + + + + DOD5015 File Plan + rma:filePlan + + + + + Record Series + rma:recordCategory + + + + + + + + + + DOD5015 Record + + + + Publication Date + d:date + true + + + + Originator + d:text + true + + true + false + false + + + + + Originating Organization + d:text + true + + true + false + false + + + + + Media Type + d:text + false + + true + false + false + + + + + Format + d:text + false + + true + false + false + + + + + Date Received + d:date + false + + + + + Addressee + d:text + false + + true + false + false + + + + Other Addressee + d:text + false + + true + false + false + + + + + + + + + Scanned Record + + + Image Format + d:text + + true + false + false + + + + Image Format and Version + d:text + true + + true + false + false + + + + + + + Image Resolution X + d:int + true + + + Image Resolution Y + d:int + true + + + Scanned Bit Depth + d:int + false + + + + + + PDF Record + + + Producing Application + d:text + true + + true + false + false + + + + Producing Application Version + d:text + true + + + PDF Version + d:text + true + + true + false + false + + + + Creating Application + d:text + false + + true + false + false + + + + Document Security Settings + d:text + false + + true + false + false + + + + + + + Digital Photograph Record + + + Caption + d:text + true + + + Photographer + d:text + false + + true + false + false + + + + Copyright + d:text + false + + true + false + false + + + + Bit Depth + d:text + false + + true + false + false + + + + Image Size X + d:int + false + + + Image Size Y + d:int + false + + + Image Source + d:text + false + + true + false + false + + + + Compression + d:text + false + + true + false + false + + + + ICC/ICM Profile + d:text + false + + true + false + false + + + + EXIF Information + d:text + false + + true + false + false + + + + + + + Web Record + + + Web File Name + d:text + true + + true + false + false + + + + Web Platform + d:text + true + + true + false + false + + + + Web Site Name + d:text + true + + true + false + false + + + + Web Site URL + d:text + true + + true + false + false + + + + Capture Method + d:text + true + + true + false + false + + + + Capture Date + d:date + true + + + Contact + d:text + true + + true + false + false + + + + Content Management System + d:text + false + + true + false + false + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model.properties index 49e1248577..0fa8cbc480 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=DOD5015 Content Model - -dod_dod5015.type.dod_site.title=DOD5015 Site -dod_dod5015.type.dod_site.description=DOD5015 Site - -dod_dod5015.type.dod_filePlan.title=DOD5015 File Plan -dod_dod5015.type.dod_filePlan.description=DOD5015 File Plan - -dod_dod5015.type.dod_recordSeries.title=Record Series (Deprecated) -dod_dod5015.type.dod_recordSeries.description=Record Series (Deprecated) - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015 Record -dod_dod5015.aspect.dod_dod5015record.description=DOD5015 Record -dod_dod5015.property.dod_publicationDate.title=Publication Date -dod_dod5015.property.dod_publicationDate.decription=Publication Date -dod_dod5015.property.dod_originator.title=Originator -dod_dod5015.property.dod_originator.decription=Originator -dod_dod5015.property.dod_originatingOrganization.title=Originating Organization -dod_dod5015.property.dod_originatingOrganization.decription=Originating Organization -dod_dod5015.property.dod_mediaType.title=Media Type -dod_dod5015.property.dod_mediaType.decription=Media Type -dod_dod5015.property.dod_format.title=Format -dod_dod5015.property.dod_format.decription=Format -dod_dod5015.property.dod_dateReceived.title=Date Received -dod_dod5015.property.dod_dateReceived.decription=Date Received -dod_dod5015.property.dod_address.title=Addressee -dod_dod5015.property.dod_address.decription=Addressee -dod_dod5015.property.dod_otherAddress.title=Other Addressee -dod_dod5015.property.dod_otherAddress.decription=Other Addressee - -dod_dod5015.aspect.dod_scannedRecord.title=Scanned Record -dod_dod5015.aspect.dod_scannedRecord.description=Scanned Record -dod_dod5015.property.dod_scannedFormat.title=Image Format -dod_dod5015.property.dod_scannedFormat.description=Image Format -dod_dod5015.property.dod_scannedFormatVersion.title=Image Format and Version -dod_dod5015.property.dod_scannedFormatVersion.description=Image Format and Version -dod_dod5015.property.dod_resolutionX.title=Image Resolution X -dod_dod5015.property.dod_resolutionX.description=Image Resolution X -dod_dod5015.property.dod_resolutionY.title=Image Resolution Y -dod_dod5015.property.dod_resolutionY.description=Image Resolution Y -dod_dod5015.property.dod_scannedBitDepth.title=Scanned Bit Depth -dod_dod5015.property.dod_scannedBitDepth.description=Scanned Bit Depth - -dod_dod5015.aspect.dod_pdfRecord.title=PDF Record -dod_dod5015.aspect.dod_pdfRecord.description=PDF Record -dod_dod5015.property.dod_producingApplication.title=Producing Application -dod_dod5015.property.dod_producingApplication.description=Producing Application -dod_dod5015.property.dod_producingApplicationVersion.title=Producing Application Version -dod_dod5015.property.dod_producingApplicationVersion.description=Producing Application Version -dod_dod5015.property.dod_pdfVersion.title=PDF Version -dod_dod5015.property.dod_pdfVersion.description=PDF Version -dod_dod5015.property.dod_creatingApplication.title=Creating Application -dod_dod5015.property.dod_creatingApplication.description=Creating Application -dod_dod5015.property.dod_documentSecuritySettings.title=Document Security Settings -dod_dod5015.property.dod_documentSecuritySettings.description=Document Security Settings - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digital Photograph Record -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digital Photograph Record -dod_dod5015.property.dod_caption.title=Caption -dod_dod5015.property.dod_caption.description=Caption -dod_dod5015.property.dod_photographer.title=Photographer -dod_dod5015.property.dod_photographer.description=Photographer -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Bit Depth -dod_dod5015.property.dod_bitDepth.description=Bit Depth -dod_dod5015.property.dod_imageSizeX.title=Image Size X -dod_dod5015.property.dod_imageSizeX.description=Image Size X -dod_dod5015.property.dod_imageSizeY.title=Image Size Y -dod_dod5015.property.dod_imageSizeY.description=Image Size Y -dod_dod5015.property.dod_imageSource.title=Image Source -dod_dod5015.property.dod_imageSource.description=Image Source -dod_dod5015.property.dod_compression.title=Compression -dod_dod5015.property.dod_compression.description=Compression -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM Profile -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM Profile -dod_dod5015.property.dod_exifInformation.title=EXIF Information -dod_dod5015.property.dod_exifInformation.description=EXIF Information - -dod_dod5015.aspect.dod_webRecord.title=Web Record -dod_dod5015.aspect.dod_webRecord.description=Web Record -dod_dod5015.property.dod_webFileName.title=Web File Name -dod_dod5015.property.dod_webFileName.description=Web File Name -dod_dod5015.property.dod_webPlatform.title=Web Platform -dod_dod5015.property.dod_webPlatform.description=Web Platform -dod_dod5015.property.dod_webSiteName.title=Web Site Name -dod_dod5015.property.dod_webSiteName.description=Web Site Name -dod_dod5015.property.dod_webSiteURL.title=Web Site URL -dod_dod5015.property.dod_webSiteURL.description=Web Site URL -dod_dod5015.property.dod_captureMethod.title=Capture Method -dod_dod5015.property.dod_captureMethod.description=Capture Method -dod_dod5015.property.dod_captureDate.title=Capture Date -dod_dod5015.property.dod_captureDate.description=Capture Date -dod_dod5015.property.dod_contact.title=Contact -dod_dod5015.property.dod_contact.description=Contact -dod_dod5015.property.dod_contentManagementSystem.title=Content Management System -dod_dod5015.property.dod_contentManagementSystem.description=Content Management System - +dod_dod5015.description=DOD5015 Content Model + +dod_dod5015.type.dod_site.title=DOD5015 Site +dod_dod5015.type.dod_site.description=DOD5015 Site + +dod_dod5015.type.dod_filePlan.title=DOD5015 File Plan +dod_dod5015.type.dod_filePlan.description=DOD5015 File Plan + +dod_dod5015.type.dod_recordSeries.title=Record Series (Deprecated) +dod_dod5015.type.dod_recordSeries.description=Record Series (Deprecated) + +dod_dod5015.aspect.dod_dod5015record.title=DOD5015 Record +dod_dod5015.aspect.dod_dod5015record.description=DOD5015 Record +dod_dod5015.property.dod_publicationDate.title=Publication Date +dod_dod5015.property.dod_publicationDate.decription=Publication Date +dod_dod5015.property.dod_originator.title=Originator +dod_dod5015.property.dod_originator.decription=Originator +dod_dod5015.property.dod_originatingOrganization.title=Originating Organization +dod_dod5015.property.dod_originatingOrganization.decription=Originating Organization +dod_dod5015.property.dod_mediaType.title=Media Type +dod_dod5015.property.dod_mediaType.decription=Media Type +dod_dod5015.property.dod_format.title=Format +dod_dod5015.property.dod_format.decription=Format +dod_dod5015.property.dod_dateReceived.title=Date Received +dod_dod5015.property.dod_dateReceived.decription=Date Received +dod_dod5015.property.dod_address.title=Addressee +dod_dod5015.property.dod_address.decription=Addressee +dod_dod5015.property.dod_otherAddress.title=Other Addressee +dod_dod5015.property.dod_otherAddress.decription=Other Addressee + +dod_dod5015.aspect.dod_scannedRecord.title=Scanned Record +dod_dod5015.aspect.dod_scannedRecord.description=Scanned Record +dod_dod5015.property.dod_scannedFormat.title=Image Format +dod_dod5015.property.dod_scannedFormat.description=Image Format +dod_dod5015.property.dod_scannedFormatVersion.title=Image Format and Version +dod_dod5015.property.dod_scannedFormatVersion.description=Image Format and Version +dod_dod5015.property.dod_resolutionX.title=Image Resolution X +dod_dod5015.property.dod_resolutionX.description=Image Resolution X +dod_dod5015.property.dod_resolutionY.title=Image Resolution Y +dod_dod5015.property.dod_resolutionY.description=Image Resolution Y +dod_dod5015.property.dod_scannedBitDepth.title=Scanned Bit Depth +dod_dod5015.property.dod_scannedBitDepth.description=Scanned Bit Depth + +dod_dod5015.aspect.dod_pdfRecord.title=PDF Record +dod_dod5015.aspect.dod_pdfRecord.description=PDF Record +dod_dod5015.property.dod_producingApplication.title=Producing Application +dod_dod5015.property.dod_producingApplication.description=Producing Application +dod_dod5015.property.dod_producingApplicationVersion.title=Producing Application Version +dod_dod5015.property.dod_producingApplicationVersion.description=Producing Application Version +dod_dod5015.property.dod_pdfVersion.title=PDF Version +dod_dod5015.property.dod_pdfVersion.description=PDF Version +dod_dod5015.property.dod_creatingApplication.title=Creating Application +dod_dod5015.property.dod_creatingApplication.description=Creating Application +dod_dod5015.property.dod_documentSecuritySettings.title=Document Security Settings +dod_dod5015.property.dod_documentSecuritySettings.description=Document Security Settings + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digital Photograph Record +dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digital Photograph Record +dod_dod5015.property.dod_caption.title=Caption +dod_dod5015.property.dod_caption.description=Caption +dod_dod5015.property.dod_photographer.title=Photographer +dod_dod5015.property.dod_photographer.description=Photographer +dod_dod5015.property.dod_copyright.title=Copyright +dod_dod5015.property.dod_copyright.description=Copyright +dod_dod5015.property.dod_bitDepth.title=Bit Depth +dod_dod5015.property.dod_bitDepth.description=Bit Depth +dod_dod5015.property.dod_imageSizeX.title=Image Size X +dod_dod5015.property.dod_imageSizeX.description=Image Size X +dod_dod5015.property.dod_imageSizeY.title=Image Size Y +dod_dod5015.property.dod_imageSizeY.description=Image Size Y +dod_dod5015.property.dod_imageSource.title=Image Source +dod_dod5015.property.dod_imageSource.description=Image Source +dod_dod5015.property.dod_compression.title=Compression +dod_dod5015.property.dod_compression.description=Compression +dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM Profile +dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM Profile +dod_dod5015.property.dod_exifInformation.title=EXIF Information +dod_dod5015.property.dod_exifInformation.description=EXIF Information + +dod_dod5015.aspect.dod_webRecord.title=Web Record +dod_dod5015.aspect.dod_webRecord.description=Web Record +dod_dod5015.property.dod_webFileName.title=Web File Name +dod_dod5015.property.dod_webFileName.description=Web File Name +dod_dod5015.property.dod_webPlatform.title=Web Platform +dod_dod5015.property.dod_webPlatform.description=Web Platform +dod_dod5015.property.dod_webSiteName.title=Web Site Name +dod_dod5015.property.dod_webSiteName.description=Web Site Name +dod_dod5015.property.dod_webSiteURL.title=Web Site URL +dod_dod5015.property.dod_webSiteURL.description=Web Site URL +dod_dod5015.property.dod_captureMethod.title=Capture Method +dod_dod5015.property.dod_captureMethod.description=Capture Method +dod_dod5015.property.dod_captureDate.title=Capture Date +dod_dod5015.property.dod_captureDate.description=Capture Date +dod_dod5015.property.dod_contact.title=Contact +dod_dod5015.property.dod_contact.description=Contact +dod_dod5015.property.dod_contentManagementSystem.title=Content Management System +dod_dod5015.property.dod_contentManagementSystem.description=Content Management System + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_de.properties index f18c7be569..1c544629ef 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_de.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=DoD 5015-konformes Content-Modell - -dod_dod5015.type.dod_site.title=DoD 5015-konforme Site -dod_dod5015.type.dod_site.description=DoD 5015-konforme Site - -dod_dod5015.type.dod_filePlan.title=DoD 5015 Ablageplan -dod_dod5015.type.dod_filePlan.description=DoD 5015 Ablageplan - -dod_dod5015.type.dod_recordSeries.title=Record-Serien (abgelehnt) -dod_dod5015.type.dod_recordSeries.description=Record-Serien (abgelehnt) - -dod_dod5015.aspect.dod_dod5015record.title=DoD 5015-konformer Record -dod_dod5015.aspect.dod_dod5015record.description=DoD 5015-konformer Record -dod_dod5015.property.dod_publicationDate.title=Ver\u00f6ffentlichungsdatum -dod_dod5015.property.dod_publicationDate.decription=Ver\u00f6ffentlichungsdatum -dod_dod5015.property.dod_originator.title=Ersteller -dod_dod5015.property.dod_originator.decription=Ersteller -dod_dod5015.property.dod_originatingOrganization.title=Erstellende Organisation -dod_dod5015.property.dod_originatingOrganization.decription=Erstellende Organisation -dod_dod5015.property.dod_mediaType.title=Medientyp -dod_dod5015.property.dod_mediaType.decription=Medientyp -dod_dod5015.property.dod_format.title=Format -dod_dod5015.property.dod_format.decription=Format -dod_dod5015.property.dod_dateReceived.title=Eingangsdatum -dod_dod5015.property.dod_dateReceived.decription=Eingangsdatum -dod_dod5015.property.dod_address.title=Empf\u00e4nger -dod_dod5015.property.dod_address.decription=Empf\u00e4nger -dod_dod5015.property.dod_otherAddress.title=Anderer Empf\u00e4nger -dod_dod5015.property.dod_otherAddress.decription=Anderer Empf\u00e4nger - -dod_dod5015.aspect.dod_scannedRecord.title=Eingescannter Record -dod_dod5015.aspect.dod_scannedRecord.description=Eingescannter Record -dod_dod5015.property.dod_scannedFormat.title=Bildformat -dod_dod5015.property.dod_scannedFormat.description=Bildformat -dod_dod5015.property.dod_scannedFormatVersion.title=Bildformat und Version -dod_dod5015.property.dod_scannedFormatVersion.description=Bildformat und Version -dod_dod5015.property.dod_resolutionX.title=Bildaufl\u00f6sung X -dod_dod5015.property.dod_resolutionX.description=Bildaufl\u00f6sung X -dod_dod5015.property.dod_resolutionY.title=Bildaufl\u00f6sung Y -dod_dod5015.property.dod_resolutionY.description=Bildaufl\u00f6sung Y -dod_dod5015.property.dod_scannedBitDepth.title=Bittiefe des Scans -dod_dod5015.property.dod_scannedBitDepth.description=Bittiefe des Scans - -dod_dod5015.aspect.dod_pdfRecord.title=PDF-Record -dod_dod5015.aspect.dod_pdfRecord.description=PDF-Record -dod_dod5015.property.dod_producingApplication.title=Quellanwendung -dod_dod5015.property.dod_producingApplication.description=Quellanwendung -dod_dod5015.property.dod_producingApplicationVersion.title=Version der Quellanwendung -dod_dod5015.property.dod_producingApplicationVersion.description=Version der Quellanwendung -dod_dod5015.property.dod_pdfVersion.title=PDF-Version -dod_dod5015.property.dod_pdfVersion.description=PDF-Version -dod_dod5015.property.dod_creatingApplication.title=Quellsystem -dod_dod5015.property.dod_creatingApplication.description=Quellsystem -dod_dod5015.property.dod_documentSecuritySettings.title=Sicherheitseinstellungen des Dokuments -dod_dod5015.property.dod_documentSecuritySettings.description=Sicherheitseinstellungen des Dokuments - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Record - Digitales Bild -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Record - Digitales Bild -dod_dod5015.property.dod_caption.title=Beschriftung -dod_dod5015.property.dod_caption.description=Beschriftung -dod_dod5015.property.dod_photographer.title=Fotograf -dod_dod5015.property.dod_photographer.description=Fotograf -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Bittiefe -dod_dod5015.property.dod_bitDepth.description=Bittiefe -dod_dod5015.property.dod_imageSizeX.title=Bildgr\u00f6\u00dfe X -dod_dod5015.property.dod_imageSizeX.description=Bildgr\u00f6\u00dfe X -dod_dod5015.property.dod_imageSizeY.title=Bildgr\u00f6\u00dfe Y -dod_dod5015.property.dod_imageSizeY.description=Bildgr\u00f6\u00dfe Y -dod_dod5015.property.dod_imageSource.title=Bildquelle -dod_dod5015.property.dod_imageSource.description=Bildquelle -dod_dod5015.property.dod_compression.title=Komprimierung -dod_dod5015.property.dod_compression.description=Komprimierung -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM-Profil -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM-Profil -dod_dod5015.property.dod_exifInformation.title=EXIF-Informationen -dod_dod5015.property.dod_exifInformation.description=EXIF-Informationen - -dod_dod5015.aspect.dod_webRecord.title=Web-Record -dod_dod5015.aspect.dod_webRecord.description=Web-Record -dod_dod5015.property.dod_webFileName.title=Webdateiname -dod_dod5015.property.dod_webFileName.description=Webdateiname -dod_dod5015.property.dod_webPlatform.title=Webplattform -dod_dod5015.property.dod_webPlatform.description=Webplattform -dod_dod5015.property.dod_webSiteName.title=Website-Name -dod_dod5015.property.dod_webSiteName.description=Website-Name -dod_dod5015.property.dod_webSiteURL.title=Website-URL -dod_dod5015.property.dod_webSiteURL.description=Website-URL -dod_dod5015.property.dod_captureMethod.title=Erfassungsmethode -dod_dod5015.property.dod_captureMethod.description=Erfassungsmethode -dod_dod5015.property.dod_captureDate.title=Erfassungsdatum -dod_dod5015.property.dod_captureDate.description=Erfassungsdatum -dod_dod5015.property.dod_contact.title=Kontakt -dod_dod5015.property.dod_contact.description=Kontakt -dod_dod5015.property.dod_contentManagementSystem.title=Content Management System -dod_dod5015.property.dod_contentManagementSystem.description=Content Management System - +dod_dod5015.description=DoD 5015-konformes Content-Modell + +dod_dod5015.type.dod_site.title=DoD 5015-konforme Site +dod_dod5015.type.dod_site.description=DoD 5015-konforme Site + +dod_dod5015.type.dod_filePlan.title=DoD 5015 Ablageplan +dod_dod5015.type.dod_filePlan.description=DoD 5015 Ablageplan + +dod_dod5015.type.dod_recordSeries.title=Record-Serien (abgelehnt) +dod_dod5015.type.dod_recordSeries.description=Record-Serien (abgelehnt) + +dod_dod5015.aspect.dod_dod5015record.title=DoD 5015-konformer Record +dod_dod5015.aspect.dod_dod5015record.description=DoD 5015-konformer Record +dod_dod5015.property.dod_publicationDate.title=Ver\u00f6ffentlichungsdatum +dod_dod5015.property.dod_publicationDate.decription=Ver\u00f6ffentlichungsdatum +dod_dod5015.property.dod_originator.title=Ersteller +dod_dod5015.property.dod_originator.decription=Ersteller +dod_dod5015.property.dod_originatingOrganization.title=Erstellende Organisation +dod_dod5015.property.dod_originatingOrganization.decription=Erstellende Organisation +dod_dod5015.property.dod_mediaType.title=Medientyp +dod_dod5015.property.dod_mediaType.decription=Medientyp +dod_dod5015.property.dod_format.title=Format +dod_dod5015.property.dod_format.decription=Format +dod_dod5015.property.dod_dateReceived.title=Eingangsdatum +dod_dod5015.property.dod_dateReceived.decription=Eingangsdatum +dod_dod5015.property.dod_address.title=Empf\u00e4nger +dod_dod5015.property.dod_address.decription=Empf\u00e4nger +dod_dod5015.property.dod_otherAddress.title=Anderer Empf\u00e4nger +dod_dod5015.property.dod_otherAddress.decription=Anderer Empf\u00e4nger + +dod_dod5015.aspect.dod_scannedRecord.title=Eingescannter Record +dod_dod5015.aspect.dod_scannedRecord.description=Eingescannter Record +dod_dod5015.property.dod_scannedFormat.title=Bildformat +dod_dod5015.property.dod_scannedFormat.description=Bildformat +dod_dod5015.property.dod_scannedFormatVersion.title=Bildformat und Version +dod_dod5015.property.dod_scannedFormatVersion.description=Bildformat und Version +dod_dod5015.property.dod_resolutionX.title=Bildaufl\u00f6sung X +dod_dod5015.property.dod_resolutionX.description=Bildaufl\u00f6sung X +dod_dod5015.property.dod_resolutionY.title=Bildaufl\u00f6sung Y +dod_dod5015.property.dod_resolutionY.description=Bildaufl\u00f6sung Y +dod_dod5015.property.dod_scannedBitDepth.title=Bittiefe des Scans +dod_dod5015.property.dod_scannedBitDepth.description=Bittiefe des Scans + +dod_dod5015.aspect.dod_pdfRecord.title=PDF-Record +dod_dod5015.aspect.dod_pdfRecord.description=PDF-Record +dod_dod5015.property.dod_producingApplication.title=Quellanwendung +dod_dod5015.property.dod_producingApplication.description=Quellanwendung +dod_dod5015.property.dod_producingApplicationVersion.title=Version der Quellanwendung +dod_dod5015.property.dod_producingApplicationVersion.description=Version der Quellanwendung +dod_dod5015.property.dod_pdfVersion.title=PDF-Version +dod_dod5015.property.dod_pdfVersion.description=PDF-Version +dod_dod5015.property.dod_creatingApplication.title=Quellsystem +dod_dod5015.property.dod_creatingApplication.description=Quellsystem +dod_dod5015.property.dod_documentSecuritySettings.title=Sicherheitseinstellungen des Dokuments +dod_dod5015.property.dod_documentSecuritySettings.description=Sicherheitseinstellungen des Dokuments + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=Record - Digitales Bild +dod_dod5015.aspect.dod_digitalPhotographRecord.description=Record - Digitales Bild +dod_dod5015.property.dod_caption.title=Beschriftung +dod_dod5015.property.dod_caption.description=Beschriftung +dod_dod5015.property.dod_photographer.title=Fotograf +dod_dod5015.property.dod_photographer.description=Fotograf +dod_dod5015.property.dod_copyright.title=Copyright +dod_dod5015.property.dod_copyright.description=Copyright +dod_dod5015.property.dod_bitDepth.title=Bittiefe +dod_dod5015.property.dod_bitDepth.description=Bittiefe +dod_dod5015.property.dod_imageSizeX.title=Bildgr\u00f6\u00dfe X +dod_dod5015.property.dod_imageSizeX.description=Bildgr\u00f6\u00dfe X +dod_dod5015.property.dod_imageSizeY.title=Bildgr\u00f6\u00dfe Y +dod_dod5015.property.dod_imageSizeY.description=Bildgr\u00f6\u00dfe Y +dod_dod5015.property.dod_imageSource.title=Bildquelle +dod_dod5015.property.dod_imageSource.description=Bildquelle +dod_dod5015.property.dod_compression.title=Komprimierung +dod_dod5015.property.dod_compression.description=Komprimierung +dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM-Profil +dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM-Profil +dod_dod5015.property.dod_exifInformation.title=EXIF-Informationen +dod_dod5015.property.dod_exifInformation.description=EXIF-Informationen + +dod_dod5015.aspect.dod_webRecord.title=Web-Record +dod_dod5015.aspect.dod_webRecord.description=Web-Record +dod_dod5015.property.dod_webFileName.title=Webdateiname +dod_dod5015.property.dod_webFileName.description=Webdateiname +dod_dod5015.property.dod_webPlatform.title=Webplattform +dod_dod5015.property.dod_webPlatform.description=Webplattform +dod_dod5015.property.dod_webSiteName.title=Website-Name +dod_dod5015.property.dod_webSiteName.description=Website-Name +dod_dod5015.property.dod_webSiteURL.title=Website-URL +dod_dod5015.property.dod_webSiteURL.description=Website-URL +dod_dod5015.property.dod_captureMethod.title=Erfassungsmethode +dod_dod5015.property.dod_captureMethod.description=Erfassungsmethode +dod_dod5015.property.dod_captureDate.title=Erfassungsdatum +dod_dod5015.property.dod_captureDate.description=Erfassungsdatum +dod_dod5015.property.dod_contact.title=Kontakt +dod_dod5015.property.dod_contact.description=Kontakt +dod_dod5015.property.dod_contentManagementSystem.title=Content Management System +dod_dod5015.property.dod_contentManagementSystem.description=Content Management System + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_es.properties index b078119b7f..484926938a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_es.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=Modelo de contenido de DOD5015 - -dod_dod5015.type.dod_site.title=Sitio de DOD5015 -dod_dod5015.type.dod_site.description=Sitio de DOD5015 - -dod_dod5015.type.dod_filePlan.title=Plan de fichero DOD5015 -dod_dod5015.type.dod_filePlan.description=Plan de fichero DOD5015 - -dod_dod5015.type.dod_recordSeries.title=Serie de documentos de archivo (depreciada) -dod_dod5015.type.dod_recordSeries.description=Serie de documentos de archivo (depreciada) - -dod_dod5015.aspect.dod_dod5015record.title=Documento de archivo de DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=Documento de archivo de DOD5015 -dod_dod5015.property.dod_publicationDate.title=Fecha de publicaci\u00f3n -dod_dod5015.property.dod_publicationDate.decription=Fecha de publicaci\u00f3n -dod_dod5015.property.dod_originator.title=Creador -dod_dod5015.property.dod_originator.decription=Creador -dod_dod5015.property.dod_originatingOrganization.title=Organizaci\u00f3n creadora -dod_dod5015.property.dod_originatingOrganization.decription=Organizaci\u00f3n creadora -dod_dod5015.property.dod_mediaType.title=Tipo de medio -dod_dod5015.property.dod_mediaType.decription=Tipo de medio -dod_dod5015.property.dod_format.title=Formato -dod_dod5015.property.dod_format.decription=Formato -dod_dod5015.property.dod_dateReceived.title=Fecha de recepci\u00f3n -dod_dod5015.property.dod_dateReceived.decription=Fecha de recepci\u00f3n -dod_dod5015.property.dod_address.title=Destinatario -dod_dod5015.property.dod_address.decription=Destinatario -dod_dod5015.property.dod_otherAddress.title=Otro destinatario -dod_dod5015.property.dod_otherAddress.decription=Otro destinatario - -dod_dod5015.aspect.dod_scannedRecord.title=Documento de archivo escaneado -dod_dod5015.aspect.dod_scannedRecord.description=Documento de archivo escaneado -dod_dod5015.property.dod_scannedFormat.title=Formato de imagen -dod_dod5015.property.dod_scannedFormat.description=Formato de imagen -dod_dod5015.property.dod_scannedFormatVersion.title=Formato de imagen y versi\u00f3n -dod_dod5015.property.dod_scannedFormatVersion.description=Formato de imagen y versi\u00f3n -dod_dod5015.property.dod_resolutionX.title=Resoluci\u00f3n de imagen X -dod_dod5015.property.dod_resolutionX.description=Resoluci\u00f3n de imagen X -dod_dod5015.property.dod_resolutionY.title=Resoluci\u00f3n de imagen Y -dod_dod5015.property.dod_resolutionY.description=Resoluci\u00f3n de imagen Y -dod_dod5015.property.dod_scannedBitDepth.title=Profundidad de bits de escaneado -dod_dod5015.property.dod_scannedBitDepth.description=Profundidad de bits de escaneado - -dod_dod5015.aspect.dod_pdfRecord.title=Documento de archivo PDF -dod_dod5015.aspect.dod_pdfRecord.description=Documento de archivo PDF -dod_dod5015.property.dod_producingApplication.title=Produciendo aplicaci\u00f3n -dod_dod5015.property.dod_producingApplication.description=Produciendo aplicaci\u00f3n -dod_dod5015.property.dod_producingApplicationVersion.title=Produciendo versi\u00f3n de la aplicaci\u00f3n -dod_dod5015.property.dod_producingApplicationVersion.description=Produciendo versi\u00f3n de la aplicaci\u00f3n -dod_dod5015.property.dod_pdfVersion.title=Versi\u00f3n PDF -dod_dod5015.property.dod_pdfVersion.description=Versi\u00f3n PDF -dod_dod5015.property.dod_creatingApplication.title=Creando aplicaci\u00f3n -dod_dod5015.property.dod_creatingApplication.description=Creando aplicaci\u00f3n -dod_dod5015.property.dod_documentSecuritySettings.title=Configuraci\u00f3n de seguridad del documento -dod_dod5015.property.dod_documentSecuritySettings.description=Configuraci\u00f3n de seguridad del documento - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Documento de archivo fotogr\u00e1fico digital -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Documento de archivo fotogr\u00e1fico digital -dod_dod5015.property.dod_caption.title=T\u00edtulo -dod_dod5015.property.dod_caption.description=T\u00edtulo -dod_dod5015.property.dod_photographer.title=Fot\u00f3grafo -dod_dod5015.property.dod_photographer.description=Fot\u00f3grafo -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Profundidad de bits -dod_dod5015.property.dod_bitDepth.description=Profundidad de bits -dod_dod5015.property.dod_imageSizeX.title=Tama\u00f1o de imagen X -dod_dod5015.property.dod_imageSizeX.description=Tama\u00f1o de imagen X -dod_dod5015.property.dod_imageSizeY.title=Tama\u00f1o de imagen Y -dod_dod5015.property.dod_imageSizeY.description=Tama\u00f1o de imagen Y -dod_dod5015.property.dod_imageSource.title=Procedencia de la imagen -dod_dod5015.property.dod_imageSource.description=Procedencia de la imagen -dod_dod5015.property.dod_compression.title=Compresi\u00f3n -dod_dod5015.property.dod_compression.description=Compresi\u00f3n -dod_dod5015.property.dod_iccIcmProfile.title=Perfil ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=Perfil ICC/ICM -dod_dod5015.property.dod_exifInformation.title=Informaci\u00f3n EXIF -dod_dod5015.property.dod_exifInformation.description=Informaci\u00f3n EXIF - -dod_dod5015.aspect.dod_webRecord.title=Documento de archivo web -dod_dod5015.aspect.dod_webRecord.description=Documento de archivo web -dod_dod5015.property.dod_webFileName.title=Nombre del fichero web -dod_dod5015.property.dod_webFileName.description=Nombre del fichero web -dod_dod5015.property.dod_webPlatform.title=Plataforma web -dod_dod5015.property.dod_webPlatform.description=Plataforma web -dod_dod5015.property.dod_webSiteName.title=Nombre del sitio web -dod_dod5015.property.dod_webSiteName.description=Nombre del sitio web -dod_dod5015.property.dod_webSiteURL.title=URL del sitio web -dod_dod5015.property.dod_webSiteURL.description=URL del sitio web -dod_dod5015.property.dod_captureMethod.title=M\u00e9todo de captura -dod_dod5015.property.dod_captureMethod.description=M\u00e9todo de captura -dod_dod5015.property.dod_captureDate.title=Fecha de captura -dod_dod5015.property.dod_captureDate.description=Fecha de captura -dod_dod5015.property.dod_contact.title=Contacto -dod_dod5015.property.dod_contact.description=Contacto -dod_dod5015.property.dod_contentManagementSystem.title=Sistema de gesti\u00f3n de contenidos -dod_dod5015.property.dod_contentManagementSystem.description=Sistema de gesti\u00f3n de contenidos - +dod_dod5015.description=Modelo de contenido de DOD5015 + +dod_dod5015.type.dod_site.title=Sitio de DOD5015 +dod_dod5015.type.dod_site.description=Sitio de DOD5015 + +dod_dod5015.type.dod_filePlan.title=Plan de fichero DOD5015 +dod_dod5015.type.dod_filePlan.description=Plan de fichero DOD5015 + +dod_dod5015.type.dod_recordSeries.title=Serie de documentos de archivo (depreciada) +dod_dod5015.type.dod_recordSeries.description=Serie de documentos de archivo (depreciada) + +dod_dod5015.aspect.dod_dod5015record.title=Documento de archivo de DOD5015 +dod_dod5015.aspect.dod_dod5015record.description=Documento de archivo de DOD5015 +dod_dod5015.property.dod_publicationDate.title=Fecha de publicaci\u00f3n +dod_dod5015.property.dod_publicationDate.decription=Fecha de publicaci\u00f3n +dod_dod5015.property.dod_originator.title=Creador +dod_dod5015.property.dod_originator.decription=Creador +dod_dod5015.property.dod_originatingOrganization.title=Organizaci\u00f3n creadora +dod_dod5015.property.dod_originatingOrganization.decription=Organizaci\u00f3n creadora +dod_dod5015.property.dod_mediaType.title=Tipo de medio +dod_dod5015.property.dod_mediaType.decription=Tipo de medio +dod_dod5015.property.dod_format.title=Formato +dod_dod5015.property.dod_format.decription=Formato +dod_dod5015.property.dod_dateReceived.title=Fecha de recepci\u00f3n +dod_dod5015.property.dod_dateReceived.decription=Fecha de recepci\u00f3n +dod_dod5015.property.dod_address.title=Destinatario +dod_dod5015.property.dod_address.decription=Destinatario +dod_dod5015.property.dod_otherAddress.title=Otro destinatario +dod_dod5015.property.dod_otherAddress.decription=Otro destinatario + +dod_dod5015.aspect.dod_scannedRecord.title=Documento de archivo escaneado +dod_dod5015.aspect.dod_scannedRecord.description=Documento de archivo escaneado +dod_dod5015.property.dod_scannedFormat.title=Formato de imagen +dod_dod5015.property.dod_scannedFormat.description=Formato de imagen +dod_dod5015.property.dod_scannedFormatVersion.title=Formato de imagen y versi\u00f3n +dod_dod5015.property.dod_scannedFormatVersion.description=Formato de imagen y versi\u00f3n +dod_dod5015.property.dod_resolutionX.title=Resoluci\u00f3n de imagen X +dod_dod5015.property.dod_resolutionX.description=Resoluci\u00f3n de imagen X +dod_dod5015.property.dod_resolutionY.title=Resoluci\u00f3n de imagen Y +dod_dod5015.property.dod_resolutionY.description=Resoluci\u00f3n de imagen Y +dod_dod5015.property.dod_scannedBitDepth.title=Profundidad de bits de escaneado +dod_dod5015.property.dod_scannedBitDepth.description=Profundidad de bits de escaneado + +dod_dod5015.aspect.dod_pdfRecord.title=Documento de archivo PDF +dod_dod5015.aspect.dod_pdfRecord.description=Documento de archivo PDF +dod_dod5015.property.dod_producingApplication.title=Produciendo aplicaci\u00f3n +dod_dod5015.property.dod_producingApplication.description=Produciendo aplicaci\u00f3n +dod_dod5015.property.dod_producingApplicationVersion.title=Produciendo versi\u00f3n de la aplicaci\u00f3n +dod_dod5015.property.dod_producingApplicationVersion.description=Produciendo versi\u00f3n de la aplicaci\u00f3n +dod_dod5015.property.dod_pdfVersion.title=Versi\u00f3n PDF +dod_dod5015.property.dod_pdfVersion.description=Versi\u00f3n PDF +dod_dod5015.property.dod_creatingApplication.title=Creando aplicaci\u00f3n +dod_dod5015.property.dod_creatingApplication.description=Creando aplicaci\u00f3n +dod_dod5015.property.dod_documentSecuritySettings.title=Configuraci\u00f3n de seguridad del documento +dod_dod5015.property.dod_documentSecuritySettings.description=Configuraci\u00f3n de seguridad del documento + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=Documento de archivo fotogr\u00e1fico digital +dod_dod5015.aspect.dod_digitalPhotographRecord.description=Documento de archivo fotogr\u00e1fico digital +dod_dod5015.property.dod_caption.title=T\u00edtulo +dod_dod5015.property.dod_caption.description=T\u00edtulo +dod_dod5015.property.dod_photographer.title=Fot\u00f3grafo +dod_dod5015.property.dod_photographer.description=Fot\u00f3grafo +dod_dod5015.property.dod_copyright.title=Copyright +dod_dod5015.property.dod_copyright.description=Copyright +dod_dod5015.property.dod_bitDepth.title=Profundidad de bits +dod_dod5015.property.dod_bitDepth.description=Profundidad de bits +dod_dod5015.property.dod_imageSizeX.title=Tama\u00f1o de imagen X +dod_dod5015.property.dod_imageSizeX.description=Tama\u00f1o de imagen X +dod_dod5015.property.dod_imageSizeY.title=Tama\u00f1o de imagen Y +dod_dod5015.property.dod_imageSizeY.description=Tama\u00f1o de imagen Y +dod_dod5015.property.dod_imageSource.title=Procedencia de la imagen +dod_dod5015.property.dod_imageSource.description=Procedencia de la imagen +dod_dod5015.property.dod_compression.title=Compresi\u00f3n +dod_dod5015.property.dod_compression.description=Compresi\u00f3n +dod_dod5015.property.dod_iccIcmProfile.title=Perfil ICC/ICM +dod_dod5015.property.dod_iccIcmProfile.description=Perfil ICC/ICM +dod_dod5015.property.dod_exifInformation.title=Informaci\u00f3n EXIF +dod_dod5015.property.dod_exifInformation.description=Informaci\u00f3n EXIF + +dod_dod5015.aspect.dod_webRecord.title=Documento de archivo web +dod_dod5015.aspect.dod_webRecord.description=Documento de archivo web +dod_dod5015.property.dod_webFileName.title=Nombre del fichero web +dod_dod5015.property.dod_webFileName.description=Nombre del fichero web +dod_dod5015.property.dod_webPlatform.title=Plataforma web +dod_dod5015.property.dod_webPlatform.description=Plataforma web +dod_dod5015.property.dod_webSiteName.title=Nombre del sitio web +dod_dod5015.property.dod_webSiteName.description=Nombre del sitio web +dod_dod5015.property.dod_webSiteURL.title=URL del sitio web +dod_dod5015.property.dod_webSiteURL.description=URL del sitio web +dod_dod5015.property.dod_captureMethod.title=M\u00e9todo de captura +dod_dod5015.property.dod_captureMethod.description=M\u00e9todo de captura +dod_dod5015.property.dod_captureDate.title=Fecha de captura +dod_dod5015.property.dod_captureDate.description=Fecha de captura +dod_dod5015.property.dod_contact.title=Contacto +dod_dod5015.property.dod_contact.description=Contacto +dod_dod5015.property.dod_contentManagementSystem.title=Sistema de gesti\u00f3n de contenidos +dod_dod5015.property.dod_contentManagementSystem.description=Sistema de gesti\u00f3n de contenidos + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_fr.properties index b28bfbba96..6c59002dd6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_fr.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=Mod\u00e8le de contenu DOD5015 - -dod_dod5015.type.dod_site.title=Site DOD5015 -dod_dod5015.type.dod_site.description=Site DOD5015 - -dod_dod5015.type.dod_filePlan.title=Plan de classification DOD5015 -dod_dod5015.type.dod_filePlan.description=Plan de classification DOD5015 - -dod_dod5015.type.dod_recordSeries.title=S\u00e9rie de documents d'archives (\u00e0 \u00e9viter) -dod_dod5015.type.dod_recordSeries.description=S\u00e9rie de documents d'archives (\u00e0 \u00e9viter) - -dod_dod5015.aspect.dod_dod5015record.title=Document d'archives DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=Document d'archives DOD5015 -dod_dod5015.property.dod_publicationDate.title=Date de publication -dod_dod5015.property.dod_publicationDate.decription=Date de publication -dod_dod5015.property.dod_originator.title=\u00c9metteur -dod_dod5015.property.dod_originator.decription=\u00c9metteur -dod_dod5015.property.dod_originatingOrganization.title=Organisation \u00e9mettrice -dod_dod5015.property.dod_originatingOrganization.decription=Organisation \u00e9mettrice -dod_dod5015.property.dod_mediaType.title=Type de support -dod_dod5015.property.dod_mediaType.decription=Type de support -dod_dod5015.property.dod_format.title=Format -dod_dod5015.property.dod_format.decription=Format -dod_dod5015.property.dod_dateReceived.title=Date de r\u00e9ception -dod_dod5015.property.dod_dateReceived.decription=Date de r\u00e9ception -dod_dod5015.property.dod_address.title=Destinataire -dod_dod5015.property.dod_address.decription=Destinataire -dod_dod5015.property.dod_otherAddress.title=Autre destinataire -dod_dod5015.property.dod_otherAddress.decription=Autre destinataire - -dod_dod5015.aspect.dod_scannedRecord.title=Document d'archives num\u00e9ris\u00e9 -dod_dod5015.aspect.dod_scannedRecord.description=Document d'archives num\u00e9ris\u00e9 -dod_dod5015.property.dod_scannedFormat.title=Format d'image -dod_dod5015.property.dod_scannedFormat.description=Format d'image -dod_dod5015.property.dod_scannedFormatVersion.title=Format et version d'image -dod_dod5015.property.dod_scannedFormatVersion.description=Format et version d'image -dod_dod5015.property.dod_resolutionX.title=R\u00e9solution d'image X -dod_dod5015.property.dod_resolutionX.description=R\u00e9solution d'image X -dod_dod5015.property.dod_resolutionY.title=R\u00e9solution d'image Y -dod_dod5015.property.dod_resolutionY.description=R\u00e9solution d'image Y -dod_dod5015.property.dod_scannedBitDepth.title=Profondeur de couleur num\u00e9ris\u00e9e -dod_dod5015.property.dod_scannedBitDepth.description=Profondeur de couleur num\u00e9ris\u00e9e - -dod_dod5015.aspect.dod_pdfRecord.title=Document d'archives PDF -dod_dod5015.aspect.dod_pdfRecord.description=Document d'archives PDF -dod_dod5015.property.dod_producingApplication.title=Application native -dod_dod5015.property.dod_producingApplication.description=Application native -dod_dod5015.property.dod_producingApplicationVersion.title=Version de l'application native -dod_dod5015.property.dod_producingApplicationVersion.description=Version de l'application native -dod_dod5015.property.dod_pdfVersion.title=Version PDF -dod_dod5015.property.dod_pdfVersion.description=Version PDF -dod_dod5015.property.dod_creatingApplication.title=Application native -dod_dod5015.property.dod_creatingApplication.description=Application native -dod_dod5015.property.dod_documentSecuritySettings.title=Param\u00e8tres de s\u00e9curit\u00e9 du document -dod_dod5015.property.dod_documentSecuritySettings.description=Param\u00e8tres de s\u00e9curit\u00e9 du document - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Photographie num\u00e9rique d'archives -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Photographie num\u00e9rique d'archives -dod_dod5015.property.dod_caption.title=L\u00e9gende -dod_dod5015.property.dod_caption.description=L\u00e9gende -dod_dod5015.property.dod_photographer.title=Photographe -dod_dod5015.property.dod_photographer.description=Photographe -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Profondeur de couleur -dod_dod5015.property.dod_bitDepth.description=Profondeur de couleur -dod_dod5015.property.dod_imageSizeX.title=Taille d'image X -dod_dod5015.property.dod_imageSizeX.description=Taille d'image X -dod_dod5015.property.dod_imageSizeY.title=Taille d'image Y -dod_dod5015.property.dod_imageSizeY.description=Taille d'image Y -dod_dod5015.property.dod_imageSource.title=Source de l'image -dod_dod5015.property.dod_imageSource.description=Source de l'image -dod_dod5015.property.dod_compression.title=Compression -dod_dod5015.property.dod_compression.description=Compression -dod_dod5015.property.dod_iccIcmProfile.title=Profil ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=Profil ICC/ICM -dod_dod5015.property.dod_exifInformation.title=Informations EXIF -dod_dod5015.property.dod_exifInformation.description=Informations EXIF - -dod_dod5015.aspect.dod_webRecord.title=Document d'archives Web -dod_dod5015.aspect.dod_webRecord.description=Document d'archives Web -dod_dod5015.property.dod_webFileName.title=Nom de fichier Web -dod_dod5015.property.dod_webFileName.description=Nom de fichier Web -dod_dod5015.property.dod_webPlatform.title=Plate-forme Web -dod_dod5015.property.dod_webPlatform.description=Plate-forme Web -dod_dod5015.property.dod_webSiteName.title=Nom du site Web -dod_dod5015.property.dod_webSiteName.description=Nom du site Web -dod_dod5015.property.dod_webSiteURL.title=URL de site Web -dod_dod5015.property.dod_webSiteURL.description=URL de site Web -dod_dod5015.property.dod_captureMethod.title=M\u00e9thode de capture -dod_dod5015.property.dod_captureMethod.description=M\u00e9thode de capture -dod_dod5015.property.dod_captureDate.title=Date de capture -dod_dod5015.property.dod_captureDate.description=Date de capture -dod_dod5015.property.dod_contact.title=Contact -dod_dod5015.property.dod_contact.description=Contact -dod_dod5015.property.dod_contentManagementSystem.title=Syst\u00e8me de gestion de contenu -dod_dod5015.property.dod_contentManagementSystem.description=Syst\u00e8me de gestion de contenu - +dod_dod5015.description=Mod\u00e8le de contenu DOD5015 + +dod_dod5015.type.dod_site.title=Site DOD5015 +dod_dod5015.type.dod_site.description=Site DOD5015 + +dod_dod5015.type.dod_filePlan.title=Plan de classification DOD5015 +dod_dod5015.type.dod_filePlan.description=Plan de classification DOD5015 + +dod_dod5015.type.dod_recordSeries.title=S\u00e9rie de documents d'archives (\u00e0 \u00e9viter) +dod_dod5015.type.dod_recordSeries.description=S\u00e9rie de documents d'archives (\u00e0 \u00e9viter) + +dod_dod5015.aspect.dod_dod5015record.title=Document d'archives DOD5015 +dod_dod5015.aspect.dod_dod5015record.description=Document d'archives DOD5015 +dod_dod5015.property.dod_publicationDate.title=Date de publication +dod_dod5015.property.dod_publicationDate.decription=Date de publication +dod_dod5015.property.dod_originator.title=\u00c9metteur +dod_dod5015.property.dod_originator.decription=\u00c9metteur +dod_dod5015.property.dod_originatingOrganization.title=Organisation \u00e9mettrice +dod_dod5015.property.dod_originatingOrganization.decription=Organisation \u00e9mettrice +dod_dod5015.property.dod_mediaType.title=Type de support +dod_dod5015.property.dod_mediaType.decription=Type de support +dod_dod5015.property.dod_format.title=Format +dod_dod5015.property.dod_format.decription=Format +dod_dod5015.property.dod_dateReceived.title=Date de r\u00e9ception +dod_dod5015.property.dod_dateReceived.decription=Date de r\u00e9ception +dod_dod5015.property.dod_address.title=Destinataire +dod_dod5015.property.dod_address.decription=Destinataire +dod_dod5015.property.dod_otherAddress.title=Autre destinataire +dod_dod5015.property.dod_otherAddress.decription=Autre destinataire + +dod_dod5015.aspect.dod_scannedRecord.title=Document d'archives num\u00e9ris\u00e9 +dod_dod5015.aspect.dod_scannedRecord.description=Document d'archives num\u00e9ris\u00e9 +dod_dod5015.property.dod_scannedFormat.title=Format d'image +dod_dod5015.property.dod_scannedFormat.description=Format d'image +dod_dod5015.property.dod_scannedFormatVersion.title=Format et version d'image +dod_dod5015.property.dod_scannedFormatVersion.description=Format et version d'image +dod_dod5015.property.dod_resolutionX.title=R\u00e9solution d'image X +dod_dod5015.property.dod_resolutionX.description=R\u00e9solution d'image X +dod_dod5015.property.dod_resolutionY.title=R\u00e9solution d'image Y +dod_dod5015.property.dod_resolutionY.description=R\u00e9solution d'image Y +dod_dod5015.property.dod_scannedBitDepth.title=Profondeur de couleur num\u00e9ris\u00e9e +dod_dod5015.property.dod_scannedBitDepth.description=Profondeur de couleur num\u00e9ris\u00e9e + +dod_dod5015.aspect.dod_pdfRecord.title=Document d'archives PDF +dod_dod5015.aspect.dod_pdfRecord.description=Document d'archives PDF +dod_dod5015.property.dod_producingApplication.title=Application native +dod_dod5015.property.dod_producingApplication.description=Application native +dod_dod5015.property.dod_producingApplicationVersion.title=Version de l'application native +dod_dod5015.property.dod_producingApplicationVersion.description=Version de l'application native +dod_dod5015.property.dod_pdfVersion.title=Version PDF +dod_dod5015.property.dod_pdfVersion.description=Version PDF +dod_dod5015.property.dod_creatingApplication.title=Application native +dod_dod5015.property.dod_creatingApplication.description=Application native +dod_dod5015.property.dod_documentSecuritySettings.title=Param\u00e8tres de s\u00e9curit\u00e9 du document +dod_dod5015.property.dod_documentSecuritySettings.description=Param\u00e8tres de s\u00e9curit\u00e9 du document + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=Photographie num\u00e9rique d'archives +dod_dod5015.aspect.dod_digitalPhotographRecord.description=Photographie num\u00e9rique d'archives +dod_dod5015.property.dod_caption.title=L\u00e9gende +dod_dod5015.property.dod_caption.description=L\u00e9gende +dod_dod5015.property.dod_photographer.title=Photographe +dod_dod5015.property.dod_photographer.description=Photographe +dod_dod5015.property.dod_copyright.title=Copyright +dod_dod5015.property.dod_copyright.description=Copyright +dod_dod5015.property.dod_bitDepth.title=Profondeur de couleur +dod_dod5015.property.dod_bitDepth.description=Profondeur de couleur +dod_dod5015.property.dod_imageSizeX.title=Taille d'image X +dod_dod5015.property.dod_imageSizeX.description=Taille d'image X +dod_dod5015.property.dod_imageSizeY.title=Taille d'image Y +dod_dod5015.property.dod_imageSizeY.description=Taille d'image Y +dod_dod5015.property.dod_imageSource.title=Source de l'image +dod_dod5015.property.dod_imageSource.description=Source de l'image +dod_dod5015.property.dod_compression.title=Compression +dod_dod5015.property.dod_compression.description=Compression +dod_dod5015.property.dod_iccIcmProfile.title=Profil ICC/ICM +dod_dod5015.property.dod_iccIcmProfile.description=Profil ICC/ICM +dod_dod5015.property.dod_exifInformation.title=Informations EXIF +dod_dod5015.property.dod_exifInformation.description=Informations EXIF + +dod_dod5015.aspect.dod_webRecord.title=Document d'archives Web +dod_dod5015.aspect.dod_webRecord.description=Document d'archives Web +dod_dod5015.property.dod_webFileName.title=Nom de fichier Web +dod_dod5015.property.dod_webFileName.description=Nom de fichier Web +dod_dod5015.property.dod_webPlatform.title=Plate-forme Web +dod_dod5015.property.dod_webPlatform.description=Plate-forme Web +dod_dod5015.property.dod_webSiteName.title=Nom du site Web +dod_dod5015.property.dod_webSiteName.description=Nom du site Web +dod_dod5015.property.dod_webSiteURL.title=URL de site Web +dod_dod5015.property.dod_webSiteURL.description=URL de site Web +dod_dod5015.property.dod_captureMethod.title=M\u00e9thode de capture +dod_dod5015.property.dod_captureMethod.description=M\u00e9thode de capture +dod_dod5015.property.dod_captureDate.title=Date de capture +dod_dod5015.property.dod_captureDate.description=Date de capture +dod_dod5015.property.dod_contact.title=Contact +dod_dod5015.property.dod_contact.description=Contact +dod_dod5015.property.dod_contentManagementSystem.title=Syst\u00e8me de gestion de contenu +dod_dod5015.property.dod_contentManagementSystem.description=Syst\u00e8me de gestion de contenu + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_it.properties index a3bdf5d519..e507ac84b3 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_it.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=Modello di contenuto DOD5015 - -dod_dod5015.type.dod_site.title=Sito DOD5015 -dod_dod5015.type.dod_site.description=Sito DOD5015 - -dod_dod5015.type.dod_filePlan.title=Piano file DOD5015 -dod_dod5015.type.dod_filePlan.description=Piano file DOD5015 - -dod_dod5015.type.dod_recordSeries.title=Serie record (obsoleta) -dod_dod5015.type.dod_recordSeries.description=Serie record (obsoleta) - -dod_dod5015.aspect.dod_dod5015record.title=Record DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=Record DOD5015 -dod_dod5015.property.dod_publicationDate.title=Data di pubblicazione -dod_dod5015.property.dod_publicationDate.decription=Data di pubblicazione -dod_dod5015.property.dod_originator.title=Iniziatore -dod_dod5015.property.dod_originator.decription=Iniziatore -dod_dod5015.property.dod_originatingOrganization.title=Organizzazione di origine -dod_dod5015.property.dod_originatingOrganization.decription=Organizzazione di origine -dod_dod5015.property.dod_mediaType.title=Tipo di supporto -dod_dod5015.property.dod_mediaType.decription=Tipo di supporto -dod_dod5015.property.dod_format.title=Formato -dod_dod5015.property.dod_format.decription=Formato -dod_dod5015.property.dod_dateReceived.title=Data di ricezione -dod_dod5015.property.dod_dateReceived.decription=Data di ricezione -dod_dod5015.property.dod_address.title=Destinatario -dod_dod5015.property.dod_address.decription=Destinatario -dod_dod5015.property.dod_otherAddress.title=Altro destinatario -dod_dod5015.property.dod_otherAddress.decription=Altro destinatario - -dod_dod5015.aspect.dod_scannedRecord.title=Record scansionato -dod_dod5015.aspect.dod_scannedRecord.description=Record scansionato -dod_dod5015.property.dod_scannedFormat.title=Formato immagine -dod_dod5015.property.dod_scannedFormat.description=Formato immagine -dod_dod5015.property.dod_scannedFormatVersion.title=Formato immagine e versione -dod_dod5015.property.dod_scannedFormatVersion.description=Formato immagine e versione -dod_dod5015.property.dod_resolutionX.title=Risoluzione immagine X -dod_dod5015.property.dod_resolutionX.description=Risoluzione immagine X -dod_dod5015.property.dod_resolutionY.title=Risoluzione immagine Y -dod_dod5015.property.dod_resolutionY.description=Risoluzione immagine Y -dod_dod5015.property.dod_scannedBitDepth.title=Profondit\u00e0 in bit scansionata -dod_dod5015.property.dod_scannedBitDepth.description=Profondit\u00e0 in bit scansionata - -dod_dod5015.aspect.dod_pdfRecord.title=Record PDF -dod_dod5015.aspect.dod_pdfRecord.description=Record PDF -dod_dod5015.property.dod_producingApplication.title=Generazione applicazione -dod_dod5015.property.dod_producingApplication.description=Generazione applicazione -dod_dod5015.property.dod_producingApplicationVersion.title=Generazione versione applicazione -dod_dod5015.property.dod_producingApplicationVersion.description=Generazione versione applicazione -dod_dod5015.property.dod_pdfVersion.title=Versione PDF -dod_dod5015.property.dod_pdfVersion.description=Versione PDF -dod_dod5015.property.dod_creatingApplication.title=Creazione applicazione -dod_dod5015.property.dod_creatingApplication.description=Creazione applicazione -dod_dod5015.property.dod_documentSecuritySettings.title=Impostazioni di protezione documento -dod_dod5015.property.dod_documentSecuritySettings.description=Impostazioni di protezione documento - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Record fotografia digitale -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Record fotografia digitale -dod_dod5015.property.dod_caption.title=Didascalia -dod_dod5015.property.dod_caption.description=Didascalia -dod_dod5015.property.dod_photographer.title=Fotografo -dod_dod5015.property.dod_photographer.description=Fotografo -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Profondit\u00e0 in bit -dod_dod5015.property.dod_bitDepth.description=Profondit\u00e0 in bit -dod_dod5015.property.dod_imageSizeX.title=Dimensioni immagine X -dod_dod5015.property.dod_imageSizeX.description=Dimensioni immagine X -dod_dod5015.property.dod_imageSizeY.title=Dimensioni immagine Y -dod_dod5015.property.dod_imageSizeY.description=Dimensioni immagine Y -dod_dod5015.property.dod_imageSource.title=Origine immagine -dod_dod5015.property.dod_imageSource.description=Origine immagine -dod_dod5015.property.dod_compression.title=Compressione -dod_dod5015.property.dod_compression.description=Compressione -dod_dod5015.property.dod_iccIcmProfile.title=Profilo ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=Profilo ICC/ICM -dod_dod5015.property.dod_exifInformation.title=Informazioni EXIF -dod_dod5015.property.dod_exifInformation.description=Informazioni EXIF - -dod_dod5015.aspect.dod_webRecord.title=Record Web -dod_dod5015.aspect.dod_webRecord.description=Record Web -dod_dod5015.property.dod_webFileName.title=Nome file Web -dod_dod5015.property.dod_webFileName.description=Nome file Web -dod_dod5015.property.dod_webPlatform.title=Piattaforma Web -dod_dod5015.property.dod_webPlatform.description=Piattaforma Web -dod_dod5015.property.dod_webSiteName.title=Nome sito Web -dod_dod5015.property.dod_webSiteName.description=Nome sito Web -dod_dod5015.property.dod_webSiteURL.title=URL sito Web -dod_dod5015.property.dod_webSiteURL.description=URL sito Web -dod_dod5015.property.dod_captureMethod.title=Metodo di acquisizione -dod_dod5015.property.dod_captureMethod.description=Metodo di acquisizione -dod_dod5015.property.dod_captureDate.title=Data di acquisizione -dod_dod5015.property.dod_captureDate.description=Data di acquisizione -dod_dod5015.property.dod_contact.title=Contatto -dod_dod5015.property.dod_contact.description=Contatto -dod_dod5015.property.dod_contentManagementSystem.title=Sistema di gestione dei contenuti -dod_dod5015.property.dod_contentManagementSystem.description=Sistema di gestione dei contenuti - +dod_dod5015.description=Modello di contenuto DOD5015 + +dod_dod5015.type.dod_site.title=Sito DOD5015 +dod_dod5015.type.dod_site.description=Sito DOD5015 + +dod_dod5015.type.dod_filePlan.title=Piano file DOD5015 +dod_dod5015.type.dod_filePlan.description=Piano file DOD5015 + +dod_dod5015.type.dod_recordSeries.title=Serie record (obsoleta) +dod_dod5015.type.dod_recordSeries.description=Serie record (obsoleta) + +dod_dod5015.aspect.dod_dod5015record.title=Record DOD5015 +dod_dod5015.aspect.dod_dod5015record.description=Record DOD5015 +dod_dod5015.property.dod_publicationDate.title=Data di pubblicazione +dod_dod5015.property.dod_publicationDate.decription=Data di pubblicazione +dod_dod5015.property.dod_originator.title=Iniziatore +dod_dod5015.property.dod_originator.decription=Iniziatore +dod_dod5015.property.dod_originatingOrganization.title=Organizzazione di origine +dod_dod5015.property.dod_originatingOrganization.decription=Organizzazione di origine +dod_dod5015.property.dod_mediaType.title=Tipo di supporto +dod_dod5015.property.dod_mediaType.decription=Tipo di supporto +dod_dod5015.property.dod_format.title=Formato +dod_dod5015.property.dod_format.decription=Formato +dod_dod5015.property.dod_dateReceived.title=Data di ricezione +dod_dod5015.property.dod_dateReceived.decription=Data di ricezione +dod_dod5015.property.dod_address.title=Destinatario +dod_dod5015.property.dod_address.decription=Destinatario +dod_dod5015.property.dod_otherAddress.title=Altro destinatario +dod_dod5015.property.dod_otherAddress.decription=Altro destinatario + +dod_dod5015.aspect.dod_scannedRecord.title=Record scansionato +dod_dod5015.aspect.dod_scannedRecord.description=Record scansionato +dod_dod5015.property.dod_scannedFormat.title=Formato immagine +dod_dod5015.property.dod_scannedFormat.description=Formato immagine +dod_dod5015.property.dod_scannedFormatVersion.title=Formato immagine e versione +dod_dod5015.property.dod_scannedFormatVersion.description=Formato immagine e versione +dod_dod5015.property.dod_resolutionX.title=Risoluzione immagine X +dod_dod5015.property.dod_resolutionX.description=Risoluzione immagine X +dod_dod5015.property.dod_resolutionY.title=Risoluzione immagine Y +dod_dod5015.property.dod_resolutionY.description=Risoluzione immagine Y +dod_dod5015.property.dod_scannedBitDepth.title=Profondit\u00e0 in bit scansionata +dod_dod5015.property.dod_scannedBitDepth.description=Profondit\u00e0 in bit scansionata + +dod_dod5015.aspect.dod_pdfRecord.title=Record PDF +dod_dod5015.aspect.dod_pdfRecord.description=Record PDF +dod_dod5015.property.dod_producingApplication.title=Generazione applicazione +dod_dod5015.property.dod_producingApplication.description=Generazione applicazione +dod_dod5015.property.dod_producingApplicationVersion.title=Generazione versione applicazione +dod_dod5015.property.dod_producingApplicationVersion.description=Generazione versione applicazione +dod_dod5015.property.dod_pdfVersion.title=Versione PDF +dod_dod5015.property.dod_pdfVersion.description=Versione PDF +dod_dod5015.property.dod_creatingApplication.title=Creazione applicazione +dod_dod5015.property.dod_creatingApplication.description=Creazione applicazione +dod_dod5015.property.dod_documentSecuritySettings.title=Impostazioni di protezione documento +dod_dod5015.property.dod_documentSecuritySettings.description=Impostazioni di protezione documento + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=Record fotografia digitale +dod_dod5015.aspect.dod_digitalPhotographRecord.description=Record fotografia digitale +dod_dod5015.property.dod_caption.title=Didascalia +dod_dod5015.property.dod_caption.description=Didascalia +dod_dod5015.property.dod_photographer.title=Fotografo +dod_dod5015.property.dod_photographer.description=Fotografo +dod_dod5015.property.dod_copyright.title=Copyright +dod_dod5015.property.dod_copyright.description=Copyright +dod_dod5015.property.dod_bitDepth.title=Profondit\u00e0 in bit +dod_dod5015.property.dod_bitDepth.description=Profondit\u00e0 in bit +dod_dod5015.property.dod_imageSizeX.title=Dimensioni immagine X +dod_dod5015.property.dod_imageSizeX.description=Dimensioni immagine X +dod_dod5015.property.dod_imageSizeY.title=Dimensioni immagine Y +dod_dod5015.property.dod_imageSizeY.description=Dimensioni immagine Y +dod_dod5015.property.dod_imageSource.title=Origine immagine +dod_dod5015.property.dod_imageSource.description=Origine immagine +dod_dod5015.property.dod_compression.title=Compressione +dod_dod5015.property.dod_compression.description=Compressione +dod_dod5015.property.dod_iccIcmProfile.title=Profilo ICC/ICM +dod_dod5015.property.dod_iccIcmProfile.description=Profilo ICC/ICM +dod_dod5015.property.dod_exifInformation.title=Informazioni EXIF +dod_dod5015.property.dod_exifInformation.description=Informazioni EXIF + +dod_dod5015.aspect.dod_webRecord.title=Record Web +dod_dod5015.aspect.dod_webRecord.description=Record Web +dod_dod5015.property.dod_webFileName.title=Nome file Web +dod_dod5015.property.dod_webFileName.description=Nome file Web +dod_dod5015.property.dod_webPlatform.title=Piattaforma Web +dod_dod5015.property.dod_webPlatform.description=Piattaforma Web +dod_dod5015.property.dod_webSiteName.title=Nome sito Web +dod_dod5015.property.dod_webSiteName.description=Nome sito Web +dod_dod5015.property.dod_webSiteURL.title=URL sito Web +dod_dod5015.property.dod_webSiteURL.description=URL sito Web +dod_dod5015.property.dod_captureMethod.title=Metodo di acquisizione +dod_dod5015.property.dod_captureMethod.description=Metodo di acquisizione +dod_dod5015.property.dod_captureDate.title=Data di acquisizione +dod_dod5015.property.dod_captureDate.description=Data di acquisizione +dod_dod5015.property.dod_contact.title=Contatto +dod_dod5015.property.dod_contact.description=Contatto +dod_dod5015.property.dod_contentManagementSystem.title=Sistema di gestione dei contenuti +dod_dod5015.property.dod_contentManagementSystem.description=Sistema di gestione dei contenuti + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ja.properties index 9878f560cc..b3e892dda5 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ja.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=DOD5015\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb - -dod_dod5015.type.dod_site.title=DOD5015\u30b5\u30a4\u30c8 -dod_dod5015.type.dod_site.description=DOD5015\u30b5\u30a4\u30c8 - -dod_dod5015.type.dod_filePlan.title=DOD5015\u30d5\u30a1\u30a4\u30eb\u30d7\u30e9\u30f3 -dod_dod5015.type.dod_filePlan.description=DOD5015\u30d5\u30a1\u30a4\u30eb\u30d7\u30e9\u30f3 - -dod_dod5015.type.dod_recordSeries.title=\u30ec\u30b3\u30fc\u30c9\u30b7\u30ea\u30fc\u30ba\uff08\u975e\u63a8\u5968\uff09 -dod_dod5015.type.dod_recordSeries.description=\u30ec\u30b3\u30fc\u30c9\u30b7\u30ea\u30fc\u30ba\uff08\u975e\u63a8\u5968\uff09 - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_dod5015record.description=DOD5015\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_publicationDate.title=\u767a\u884c\u65e5 -dod_dod5015.property.dod_publicationDate.decription=\u767a\u884c\u65e5 -dod_dod5015.property.dod_originator.title=\u767a\u4fe1\u5143 -dod_dod5015.property.dod_originator.decription=\u767a\u4fe1\u5143 -dod_dod5015.property.dod_originatingOrganization.title=\u767a\u4fe1\u5143\u7d44\u7e54 -dod_dod5015.property.dod_originatingOrganization.decription=\u767a\u4fe1\u5143\u7d44\u7e54 -dod_dod5015.property.dod_mediaType.title=\u30e1\u30c7\u30a3\u30a2\u30bf\u30a4\u30d7 -dod_dod5015.property.dod_mediaType.decription=\u30e1\u30c7\u30a3\u30a2\u30bf\u30a4\u30d7 -dod_dod5015.property.dod_format.title=\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 -dod_dod5015.property.dod_format.decription=\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 -dod_dod5015.property.dod_dateReceived.title=\u53d7\u4fe1\u65e5 -dod_dod5015.property.dod_dateReceived.decription=\u53d7\u4fe1\u65e5 -dod_dod5015.property.dod_address.title=\u53d7\u4fe1\u8005 -dod_dod5015.property.dod_address.decription=\u53d7\u4fe1\u8005 -dod_dod5015.property.dod_otherAddress.title=\u305d\u306e\u4ed6\u306e\u53d7\u4fe1\u8005 -dod_dod5015.property.dod_otherAddress.decription=\u305d\u306e\u4ed6\u306e\u53d7\u4fe1\u8005 - -dod_dod5015.aspect.dod_scannedRecord.title=\u30b9\u30ad\u30e3\u30f3\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_scannedRecord.description=\u30b9\u30ad\u30e3\u30f3\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_scannedFormat.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 -dod_dod5015.property.dod_scannedFormat.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 -dod_dod5015.property.dod_scannedFormatVersion.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3068\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_scannedFormatVersion.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3068\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_resolutionX.title=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6X -dod_dod5015.property.dod_resolutionX.description=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6X -dod_dod5015.property.dod_resolutionY.title=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6Y -dod_dod5015.property.dod_resolutionY.description=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6Y -dod_dod5015.property.dod_scannedBitDepth.title=\u30b9\u30ad\u30e3\u30f3\u3057\u305f\u30d3\u30c3\u30c8\u6df1\u5ea6 -dod_dod5015.property.dod_scannedBitDepth.description=\u30b9\u30ad\u30e3\u30f3\u3057\u305f\u30d3\u30c3\u30c8\u6df1\u5ea6 - -dod_dod5015.aspect.dod_pdfRecord.title=PDF\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_pdfRecord.description=PDF\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_producingApplication.title=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_producingApplication.description=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_producingApplicationVersion.title=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_producingApplicationVersion.description=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_pdfVersion.title=PDF\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_pdfVersion.description=PDF\u30d0\u30fc\u30b8\u30e7\u30f3 -dod_dod5015.property.dod_creatingApplication.title=\u4f5c\u6210\u5143\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_creatingApplication.description=\u4f5c\u6210\u5143\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_documentSecuritySettings.title=\u6587\u66f8\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a -dod_dod5015.property.dod_documentSecuritySettings.description=\u6587\u66f8\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u30c7\u30b8\u30bf\u30eb\u5199\u771f\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u30c7\u30b8\u30bf\u30eb\u5199\u771f\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_caption.title=\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_caption.description=\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3 -dod_dod5015.property.dod_photographer.title=\u5199\u771f\u5bb6 -dod_dod5015.property.dod_photographer.description=\u5199\u771f\u5bb6 -dod_dod5015.property.dod_copyright.title=\u8457\u4f5c\u6a29 -dod_dod5015.property.dod_copyright.description=\u8457\u4f5c\u6a29 -dod_dod5015.property.dod_bitDepth.title=\u30d3\u30c3\u30c8\u6df1\u5ea6 -dod_dod5015.property.dod_bitDepth.description=\u30d3\u30c3\u30c8\u6df1\u5ea6 -dod_dod5015.property.dod_imageSizeX.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baX -dod_dod5015.property.dod_imageSizeX.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baX -dod_dod5015.property.dod_imageSizeY.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baY -dod_dod5015.property.dod_imageSizeY.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baY -dod_dod5015.property.dod_imageSource.title=\u30a4\u30e1\u30fc\u30b8\u30bd\u30fc\u30b9 -dod_dod5015.property.dod_imageSource.description=\u30a4\u30e1\u30fc\u30b8\u30bd\u30fc\u30b9 -dod_dod5015.property.dod_compression.title=\u5727\u7e2e -dod_dod5015.property.dod_compression.description=\u5727\u7e2e -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb -dod_dod5015.property.dod_exifInformation.title=EXIF\u60c5\u5831 -dod_dod5015.property.dod_exifInformation.description=EXIF\u60c5\u5831 - -dod_dod5015.aspect.dod_webRecord.title=Web\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.aspect.dod_webRecord.description=Web\u30ec\u30b3\u30fc\u30c9 -dod_dod5015.property.dod_webFileName.title=Web\u30d5\u30a1\u30a4\u30eb\u540d -dod_dod5015.property.dod_webFileName.description=Web\u30d5\u30a1\u30a4\u30eb\u540d -dod_dod5015.property.dod_webPlatform.title=Web\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0 -dod_dod5015.property.dod_webPlatform.description=Web\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0 -dod_dod5015.property.dod_webSiteName.title=Web\u30b5\u30a4\u30c8\u540d -dod_dod5015.property.dod_webSiteName.description=Web\u30b5\u30a4\u30c8\u540d -dod_dod5015.property.dod_webSiteURL.title=Web\u30b5\u30a4\u30c8URL -dod_dod5015.property.dod_webSiteURL.description=Web\u30b5\u30a4\u30c8URL -dod_dod5015.property.dod_captureMethod.title=\u30ad\u30e3\u30d7\u30c1\u30e3\u624b\u6cd5 -dod_dod5015.property.dod_captureMethod.description=\u30ad\u30e3\u30d7\u30c1\u30e3\u624b\u6cd5 -dod_dod5015.property.dod_captureDate.title=\u30ad\u30e3\u30d7\u30c1\u30e3\u65e5 -dod_dod5015.property.dod_captureDate.description=\u30ad\u30e3\u30d7\u30c1\u30e3\u65e5 -dod_dod5015.property.dod_contact.title=\u9023\u7d61\u5148 -dod_dod5015.property.dod_contact.description=\u9023\u7d61\u5148 -dod_dod5015.property.dod_contentManagementSystem.title=\u30b3\u30f3\u30c6\u30f3\u30c4\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0 -dod_dod5015.property.dod_contentManagementSystem.description=\u30b3\u30f3\u30c6\u30f3\u30c4\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0 - +dod_dod5015.description=DOD5015\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb + +dod_dod5015.type.dod_site.title=DOD5015\u30b5\u30a4\u30c8 +dod_dod5015.type.dod_site.description=DOD5015\u30b5\u30a4\u30c8 + +dod_dod5015.type.dod_filePlan.title=DOD5015\u30d5\u30a1\u30a4\u30eb\u30d7\u30e9\u30f3 +dod_dod5015.type.dod_filePlan.description=DOD5015\u30d5\u30a1\u30a4\u30eb\u30d7\u30e9\u30f3 + +dod_dod5015.type.dod_recordSeries.title=\u30ec\u30b3\u30fc\u30c9\u30b7\u30ea\u30fc\u30ba\uff08\u975e\u63a8\u5968\uff09 +dod_dod5015.type.dod_recordSeries.description=\u30ec\u30b3\u30fc\u30c9\u30b7\u30ea\u30fc\u30ba\uff08\u975e\u63a8\u5968\uff09 + +dod_dod5015.aspect.dod_dod5015record.title=DOD5015\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.aspect.dod_dod5015record.description=DOD5015\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.property.dod_publicationDate.title=\u767a\u884c\u65e5 +dod_dod5015.property.dod_publicationDate.decription=\u767a\u884c\u65e5 +dod_dod5015.property.dod_originator.title=\u767a\u4fe1\u5143 +dod_dod5015.property.dod_originator.decription=\u767a\u4fe1\u5143 +dod_dod5015.property.dod_originatingOrganization.title=\u767a\u4fe1\u5143\u7d44\u7e54 +dod_dod5015.property.dod_originatingOrganization.decription=\u767a\u4fe1\u5143\u7d44\u7e54 +dod_dod5015.property.dod_mediaType.title=\u30e1\u30c7\u30a3\u30a2\u30bf\u30a4\u30d7 +dod_dod5015.property.dod_mediaType.decription=\u30e1\u30c7\u30a3\u30a2\u30bf\u30a4\u30d7 +dod_dod5015.property.dod_format.title=\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 +dod_dod5015.property.dod_format.decription=\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 +dod_dod5015.property.dod_dateReceived.title=\u53d7\u4fe1\u65e5 +dod_dod5015.property.dod_dateReceived.decription=\u53d7\u4fe1\u65e5 +dod_dod5015.property.dod_address.title=\u53d7\u4fe1\u8005 +dod_dod5015.property.dod_address.decription=\u53d7\u4fe1\u8005 +dod_dod5015.property.dod_otherAddress.title=\u305d\u306e\u4ed6\u306e\u53d7\u4fe1\u8005 +dod_dod5015.property.dod_otherAddress.decription=\u305d\u306e\u4ed6\u306e\u53d7\u4fe1\u8005 + +dod_dod5015.aspect.dod_scannedRecord.title=\u30b9\u30ad\u30e3\u30f3\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.aspect.dod_scannedRecord.description=\u30b9\u30ad\u30e3\u30f3\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.property.dod_scannedFormat.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 +dod_dod5015.property.dod_scannedFormat.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8 +dod_dod5015.property.dod_scannedFormatVersion.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3068\u30d0\u30fc\u30b8\u30e7\u30f3 +dod_dod5015.property.dod_scannedFormatVersion.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3068\u30d0\u30fc\u30b8\u30e7\u30f3 +dod_dod5015.property.dod_resolutionX.title=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6X +dod_dod5015.property.dod_resolutionX.description=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6X +dod_dod5015.property.dod_resolutionY.title=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6Y +dod_dod5015.property.dod_resolutionY.description=\u30a4\u30e1\u30fc\u30b8\u306e\u89e3\u50cf\u5ea6Y +dod_dod5015.property.dod_scannedBitDepth.title=\u30b9\u30ad\u30e3\u30f3\u3057\u305f\u30d3\u30c3\u30c8\u6df1\u5ea6 +dod_dod5015.property.dod_scannedBitDepth.description=\u30b9\u30ad\u30e3\u30f3\u3057\u305f\u30d3\u30c3\u30c8\u6df1\u5ea6 + +dod_dod5015.aspect.dod_pdfRecord.title=PDF\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.aspect.dod_pdfRecord.description=PDF\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.property.dod_producingApplication.title=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 +dod_dod5015.property.dod_producingApplication.description=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 +dod_dod5015.property.dod_producingApplicationVersion.title=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3 +dod_dod5015.property.dod_producingApplicationVersion.description=\u88fd\u4f5c\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3 +dod_dod5015.property.dod_pdfVersion.title=PDF\u30d0\u30fc\u30b8\u30e7\u30f3 +dod_dod5015.property.dod_pdfVersion.description=PDF\u30d0\u30fc\u30b8\u30e7\u30f3 +dod_dod5015.property.dod_creatingApplication.title=\u4f5c\u6210\u5143\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 +dod_dod5015.property.dod_creatingApplication.description=\u4f5c\u6210\u5143\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 +dod_dod5015.property.dod_documentSecuritySettings.title=\u6587\u66f8\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a +dod_dod5015.property.dod_documentSecuritySettings.description=\u6587\u66f8\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u30c7\u30b8\u30bf\u30eb\u5199\u771f\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u30c7\u30b8\u30bf\u30eb\u5199\u771f\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.property.dod_caption.title=\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3 +dod_dod5015.property.dod_caption.description=\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3 +dod_dod5015.property.dod_photographer.title=\u5199\u771f\u5bb6 +dod_dod5015.property.dod_photographer.description=\u5199\u771f\u5bb6 +dod_dod5015.property.dod_copyright.title=\u8457\u4f5c\u6a29 +dod_dod5015.property.dod_copyright.description=\u8457\u4f5c\u6a29 +dod_dod5015.property.dod_bitDepth.title=\u30d3\u30c3\u30c8\u6df1\u5ea6 +dod_dod5015.property.dod_bitDepth.description=\u30d3\u30c3\u30c8\u6df1\u5ea6 +dod_dod5015.property.dod_imageSizeX.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baX +dod_dod5015.property.dod_imageSizeX.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baX +dod_dod5015.property.dod_imageSizeY.title=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baY +dod_dod5015.property.dod_imageSizeY.description=\u30a4\u30e1\u30fc\u30b8\u306e\u30b5\u30a4\u30baY +dod_dod5015.property.dod_imageSource.title=\u30a4\u30e1\u30fc\u30b8\u30bd\u30fc\u30b9 +dod_dod5015.property.dod_imageSource.description=\u30a4\u30e1\u30fc\u30b8\u30bd\u30fc\u30b9 +dod_dod5015.property.dod_compression.title=\u5727\u7e2e +dod_dod5015.property.dod_compression.description=\u5727\u7e2e +dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb +dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb +dod_dod5015.property.dod_exifInformation.title=EXIF\u60c5\u5831 +dod_dod5015.property.dod_exifInformation.description=EXIF\u60c5\u5831 + +dod_dod5015.aspect.dod_webRecord.title=Web\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.aspect.dod_webRecord.description=Web\u30ec\u30b3\u30fc\u30c9 +dod_dod5015.property.dod_webFileName.title=Web\u30d5\u30a1\u30a4\u30eb\u540d +dod_dod5015.property.dod_webFileName.description=Web\u30d5\u30a1\u30a4\u30eb\u540d +dod_dod5015.property.dod_webPlatform.title=Web\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0 +dod_dod5015.property.dod_webPlatform.description=Web\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0 +dod_dod5015.property.dod_webSiteName.title=Web\u30b5\u30a4\u30c8\u540d +dod_dod5015.property.dod_webSiteName.description=Web\u30b5\u30a4\u30c8\u540d +dod_dod5015.property.dod_webSiteURL.title=Web\u30b5\u30a4\u30c8URL +dod_dod5015.property.dod_webSiteURL.description=Web\u30b5\u30a4\u30c8URL +dod_dod5015.property.dod_captureMethod.title=\u30ad\u30e3\u30d7\u30c1\u30e3\u624b\u6cd5 +dod_dod5015.property.dod_captureMethod.description=\u30ad\u30e3\u30d7\u30c1\u30e3\u624b\u6cd5 +dod_dod5015.property.dod_captureDate.title=\u30ad\u30e3\u30d7\u30c1\u30e3\u65e5 +dod_dod5015.property.dod_captureDate.description=\u30ad\u30e3\u30d7\u30c1\u30e3\u65e5 +dod_dod5015.property.dod_contact.title=\u9023\u7d61\u5148 +dod_dod5015.property.dod_contact.description=\u9023\u7d61\u5148 +dod_dod5015.property.dod_contentManagementSystem.title=\u30b3\u30f3\u30c6\u30f3\u30c4\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0 +dod_dod5015.property.dod_contentManagementSystem.description=\u30b3\u30f3\u30c6\u30f3\u30c4\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0 + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties index 97b4cf3c1a..94eb04cae4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=DOD5015-innholdsmodell - -dod_dod5015.type.dod_site.title=DOD5015-omr\u00e5de -dod_dod5015.type.dod_site.description=DOD5015-omr\u00e5de - -dod_dod5015.type.dod_filePlan.title=DOD5015-filplan -dod_dod5015.type.dod_filePlan.description=DOD5015-filplan - -dod_dod5015.type.dod_recordSeries.title=Oppf\u00f8ringsserie (avskrevet) -dod_dod5015.type.dod_recordSeries.description=Oppf\u00f8ringsserie (avskrevet) - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015-oppf\u00f8ring -dod_dod5015.aspect.dod_dod5015record.description=DOD5015-oppf\u00f8ring -dod_dod5015.property.dod_publicationDate.title=Publikasjonsdato -dod_dod5015.property.dod_publicationDate.decription=Publikasjonsdato -dod_dod5015.property.dod_originator.title=Avsender -dod_dod5015.property.dod_originator.decription=Avsender -dod_dod5015.property.dod_originatingOrganization.title=Utgangsorganisasjon -dod_dod5015.property.dod_originatingOrganization.decription=Utgangsorganisasjon -dod_dod5015.property.dod_mediaType.title=Medietype -dod_dod5015.property.dod_mediaType.decription=Medietype -dod_dod5015.property.dod_format.title=Format -dod_dod5015.property.dod_format.decription=Format -dod_dod5015.property.dod_dateReceived.title=Dato mottatt -dod_dod5015.property.dod_dateReceived.decription=Dato mottatt -dod_dod5015.property.dod_address.title=Mottaker -dod_dod5015.property.dod_address.decription=Mottaker -dod_dod5015.property.dod_otherAddress.title=Andre mottakere -dod_dod5015.property.dod_otherAddress.decription=Andre mottakere - -dod_dod5015.aspect.dod_scannedRecord.title=Skannet oppf\u00f8ring -dod_dod5015.aspect.dod_scannedRecord.description=Skannet oppf\u00f8ring -dod_dod5015.property.dod_scannedFormat.title=Bildeformat -dod_dod5015.property.dod_scannedFormat.description=Bildeformat -dod_dod5015.property.dod_scannedFormatVersion.title=Bildeformat og -versjon -dod_dod5015.property.dod_scannedFormatVersion.description=Bildeformat og -versjon -dod_dod5015.property.dod_resolutionX.title=Bildeoppl\u00f8sning X -dod_dod5015.property.dod_resolutionX.description=Bildeoppl\u00f8sning X -dod_dod5015.property.dod_resolutionY.title=Bildeoppl\u00f8sning Y -dod_dod5015.property.dod_resolutionY.description=Bildeoppl\u00f8sning Y -dod_dod5015.property.dod_scannedBitDepth.title=Skannet bitdybde -dod_dod5015.property.dod_scannedBitDepth.description=Skannet bitdybde - -dod_dod5015.aspect.dod_pdfRecord.title=PDF-oppf\u00f8ring -dod_dod5015.aspect.dod_pdfRecord.description=PDF-oppf\u00f8ring -dod_dod5015.property.dod_producingApplication.title=Produserende program -dod_dod5015.property.dod_producingApplication.description=Produserende program -dod_dod5015.property.dod_producingApplicationVersion.title=Produserende programversjon -dod_dod5015.property.dod_producingApplicationVersion.description=Produserende programversjon -dod_dod5015.property.dod_pdfVersion.title=PDF-versjon -dod_dod5015.property.dod_pdfVersion.description=PDF-versjon -dod_dod5015.property.dod_creatingApplication.title=Opprette program -dod_dod5015.property.dod_creatingApplication.description=Opprette program -dod_dod5015.property.dod_documentSecuritySettings.title=Innstillinger ved dokumentsikkerhet -dod_dod5015.property.dod_documentSecuritySettings.description=Innstillinger ved dokumentsikkerhet - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digital bildeoppf\u00f8ring -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digital bildeoppf\u00f8ring -dod_dod5015.property.dod_caption.title=Tittel -dod_dod5015.property.dod_caption.description=Tittel -dod_dod5015.property.dod_photographer.title=Fotograf -dod_dod5015.property.dod_photographer.description=Fotograf -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Bitdybde -dod_dod5015.property.dod_bitDepth.description=Bitdybde -dod_dod5015.property.dod_imageSizeX.title=Bildest\u00f8rrelse X -dod_dod5015.property.dod_imageSizeX.description=Bildest\u00f8rrelse X -dod_dod5015.property.dod_imageSizeY.title=Bildest\u00f8rrelse Y -dod_dod5015.property.dod_imageSizeY.description=Bildest\u00f8rrelse Y -dod_dod5015.property.dod_imageSource.title=Bildekilde -dod_dod5015.property.dod_imageSource.description=Bildekilde -dod_dod5015.property.dod_compression.title=Komprimering -dod_dod5015.property.dod_compression.description=Komprimering -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM-profil -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM-profil -dod_dod5015.property.dod_exifInformation.title=EXIF-informasjon -dod_dod5015.property.dod_exifInformation.description=EXIF-informasjon - -dod_dod5015.aspect.dod_webRecord.title=Nettoppf\u00f8ring -dod_dod5015.aspect.dod_webRecord.description=Nettoppf\u00f8ring -dod_dod5015.property.dod_webFileName.title=Nettfilnavn -dod_dod5015.property.dod_webFileName.description=Nettfilnavn -dod_dod5015.property.dod_webPlatform.title=Nettplattform -dod_dod5015.property.dod_webPlatform.description=Nettplattform -dod_dod5015.property.dod_webSiteName.title=Nettstedsnavn -dod_dod5015.property.dod_webSiteName.description=Nettstedsnavn -dod_dod5015.property.dod_webSiteURL.title=Nettstedsadresse -dod_dod5015.property.dod_webSiteURL.description=Nettstedsadresse -dod_dod5015.property.dod_captureMethod.title=Opptaksmetode -dod_dod5015.property.dod_captureMethod.description=Opptaksmetode -dod_dod5015.property.dod_captureDate.title=Opptaksdato -dod_dod5015.property.dod_captureDate.description=Opptaksdato -dod_dod5015.property.dod_contact.title=Kontakt -dod_dod5015.property.dod_contact.description=Kontakt -dod_dod5015.property.dod_contentManagementSystem.title=Innholdsforvaltningssystem -dod_dod5015.property.dod_contentManagementSystem.description= Innholdsforvaltningssystem - +dod_dod5015.description=DOD5015-innholdsmodell + +dod_dod5015.type.dod_site.title=DOD5015-omr\u00e5de +dod_dod5015.type.dod_site.description=DOD5015-omr\u00e5de + +dod_dod5015.type.dod_filePlan.title=DOD5015-filplan +dod_dod5015.type.dod_filePlan.description=DOD5015-filplan + +dod_dod5015.type.dod_recordSeries.title=Oppf\u00f8ringsserie (avskrevet) +dod_dod5015.type.dod_recordSeries.description=Oppf\u00f8ringsserie (avskrevet) + +dod_dod5015.aspect.dod_dod5015record.title=DOD5015-oppf\u00f8ring +dod_dod5015.aspect.dod_dod5015record.description=DOD5015-oppf\u00f8ring +dod_dod5015.property.dod_publicationDate.title=Publikasjonsdato +dod_dod5015.property.dod_publicationDate.decription=Publikasjonsdato +dod_dod5015.property.dod_originator.title=Avsender +dod_dod5015.property.dod_originator.decription=Avsender +dod_dod5015.property.dod_originatingOrganization.title=Utgangsorganisasjon +dod_dod5015.property.dod_originatingOrganization.decription=Utgangsorganisasjon +dod_dod5015.property.dod_mediaType.title=Medietype +dod_dod5015.property.dod_mediaType.decription=Medietype +dod_dod5015.property.dod_format.title=Format +dod_dod5015.property.dod_format.decription=Format +dod_dod5015.property.dod_dateReceived.title=Dato mottatt +dod_dod5015.property.dod_dateReceived.decription=Dato mottatt +dod_dod5015.property.dod_address.title=Mottaker +dod_dod5015.property.dod_address.decription=Mottaker +dod_dod5015.property.dod_otherAddress.title=Andre mottakere +dod_dod5015.property.dod_otherAddress.decription=Andre mottakere + +dod_dod5015.aspect.dod_scannedRecord.title=Skannet oppf\u00f8ring +dod_dod5015.aspect.dod_scannedRecord.description=Skannet oppf\u00f8ring +dod_dod5015.property.dod_scannedFormat.title=Bildeformat +dod_dod5015.property.dod_scannedFormat.description=Bildeformat +dod_dod5015.property.dod_scannedFormatVersion.title=Bildeformat og -versjon +dod_dod5015.property.dod_scannedFormatVersion.description=Bildeformat og -versjon +dod_dod5015.property.dod_resolutionX.title=Bildeoppl\u00f8sning X +dod_dod5015.property.dod_resolutionX.description=Bildeoppl\u00f8sning X +dod_dod5015.property.dod_resolutionY.title=Bildeoppl\u00f8sning Y +dod_dod5015.property.dod_resolutionY.description=Bildeoppl\u00f8sning Y +dod_dod5015.property.dod_scannedBitDepth.title=Skannet bitdybde +dod_dod5015.property.dod_scannedBitDepth.description=Skannet bitdybde + +dod_dod5015.aspect.dod_pdfRecord.title=PDF-oppf\u00f8ring +dod_dod5015.aspect.dod_pdfRecord.description=PDF-oppf\u00f8ring +dod_dod5015.property.dod_producingApplication.title=Produserende program +dod_dod5015.property.dod_producingApplication.description=Produserende program +dod_dod5015.property.dod_producingApplicationVersion.title=Produserende programversjon +dod_dod5015.property.dod_producingApplicationVersion.description=Produserende programversjon +dod_dod5015.property.dod_pdfVersion.title=PDF-versjon +dod_dod5015.property.dod_pdfVersion.description=PDF-versjon +dod_dod5015.property.dod_creatingApplication.title=Opprette program +dod_dod5015.property.dod_creatingApplication.description=Opprette program +dod_dod5015.property.dod_documentSecuritySettings.title=Innstillinger ved dokumentsikkerhet +dod_dod5015.property.dod_documentSecuritySettings.description=Innstillinger ved dokumentsikkerhet + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digital bildeoppf\u00f8ring +dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digital bildeoppf\u00f8ring +dod_dod5015.property.dod_caption.title=Tittel +dod_dod5015.property.dod_caption.description=Tittel +dod_dod5015.property.dod_photographer.title=Fotograf +dod_dod5015.property.dod_photographer.description=Fotograf +dod_dod5015.property.dod_copyright.title=Copyright +dod_dod5015.property.dod_copyright.description=Copyright +dod_dod5015.property.dod_bitDepth.title=Bitdybde +dod_dod5015.property.dod_bitDepth.description=Bitdybde +dod_dod5015.property.dod_imageSizeX.title=Bildest\u00f8rrelse X +dod_dod5015.property.dod_imageSizeX.description=Bildest\u00f8rrelse X +dod_dod5015.property.dod_imageSizeY.title=Bildest\u00f8rrelse Y +dod_dod5015.property.dod_imageSizeY.description=Bildest\u00f8rrelse Y +dod_dod5015.property.dod_imageSource.title=Bildekilde +dod_dod5015.property.dod_imageSource.description=Bildekilde +dod_dod5015.property.dod_compression.title=Komprimering +dod_dod5015.property.dod_compression.description=Komprimering +dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM-profil +dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM-profil +dod_dod5015.property.dod_exifInformation.title=EXIF-informasjon +dod_dod5015.property.dod_exifInformation.description=EXIF-informasjon + +dod_dod5015.aspect.dod_webRecord.title=Nettoppf\u00f8ring +dod_dod5015.aspect.dod_webRecord.description=Nettoppf\u00f8ring +dod_dod5015.property.dod_webFileName.title=Nettfilnavn +dod_dod5015.property.dod_webFileName.description=Nettfilnavn +dod_dod5015.property.dod_webPlatform.title=Nettplattform +dod_dod5015.property.dod_webPlatform.description=Nettplattform +dod_dod5015.property.dod_webSiteName.title=Nettstedsnavn +dod_dod5015.property.dod_webSiteName.description=Nettstedsnavn +dod_dod5015.property.dod_webSiteURL.title=Nettstedsadresse +dod_dod5015.property.dod_webSiteURL.description=Nettstedsadresse +dod_dod5015.property.dod_captureMethod.title=Opptaksmetode +dod_dod5015.property.dod_captureMethod.description=Opptaksmetode +dod_dod5015.property.dod_captureDate.title=Opptaksdato +dod_dod5015.property.dod_captureDate.description=Opptaksdato +dod_dod5015.property.dod_contact.title=Kontakt +dod_dod5015.property.dod_contact.description=Kontakt +dod_dod5015.property.dod_contentManagementSystem.title=Innholdsforvaltningssystem +dod_dod5015.property.dod_contentManagementSystem.description= Innholdsforvaltningssystem + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nl.properties index 8c8bb68162..56a5f76aaf 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nl.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=DOD5015-contentmodel - -dod_dod5015.type.dod_site.title=DOD5015-site -dod_dod5015.type.dod_site.description=DOD5015-site - -dod_dod5015.type.dod_filePlan.title=DOD5015-ordeningsplan -dod_dod5015.type.dod_filePlan.description=DOD5015-ordeningsplan - -dod_dod5015.type.dod_recordSeries.title=Recordreeks (afgekeurd) -dod_dod5015.type.dod_recordSeries.description=Recordreeks (afgekeurd) - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015-record -dod_dod5015.aspect.dod_dod5015record.description=DOD5015-record -dod_dod5015.property.dod_publicationDate.title=Publicatiedatum -dod_dod5015.property.dod_publicationDate.decription=Publicatiedatum -dod_dod5015.property.dod_originator.title=Herkomst -dod_dod5015.property.dod_originator.decription=Herkomst -dod_dod5015.property.dod_originatingOrganization.title=Oorspronkelijke organisatie -dod_dod5015.property.dod_originatingOrganization.decription=Oorspronkelijke organisatie -dod_dod5015.property.dod_mediaType.title=Type medium -dod_dod5015.property.dod_mediaType.decription=Type medium -dod_dod5015.property.dod_format.title=Indeling -dod_dod5015.property.dod_format.decription=Indeling -dod_dod5015.property.dod_dateReceived.title=Datum ontvangen -dod_dod5015.property.dod_dateReceived.decription=Datum ontvangen -dod_dod5015.property.dod_address.title=Geadresseerde -dod_dod5015.property.dod_address.decription=Geadresseerde -dod_dod5015.property.dod_otherAddress.title=Andere geadresseerde -dod_dod5015.property.dod_otherAddress.decription=Andere geadresseerde - -dod_dod5015.aspect.dod_scannedRecord.title=Gescande record -dod_dod5015.aspect.dod_scannedRecord.description=Gescande record -dod_dod5015.property.dod_scannedFormat.title=Beeldindeling -dod_dod5015.property.dod_scannedFormat.description=Beeldindeling -dod_dod5015.property.dod_scannedFormatVersion.title=Beeldindeling en -versie -dod_dod5015.property.dod_scannedFormatVersion.description=Beeldindeling en -versie -dod_dod5015.property.dod_resolutionX.title=Beeldresolutie X -dod_dod5015.property.dod_resolutionX.description=Beeldresolutie X -dod_dod5015.property.dod_resolutionY.title=Beeldresolutie Y -dod_dod5015.property.dod_resolutionY.description=Beeldresolutie Y -dod_dod5015.property.dod_scannedBitDepth.title=Gescande bitdiepte -dod_dod5015.property.dod_scannedBitDepth.description=Gescande bitdiepte - -dod_dod5015.aspect.dod_pdfRecord.title=PDF-record -dod_dod5015.aspect.dod_pdfRecord.description=PDF-record -dod_dod5015.property.dod_producingApplication.title=Producerende applicatie -dod_dod5015.property.dod_producingApplication.description=Producerende applicatie -dod_dod5015.property.dod_producingApplicationVersion.title=Versie producerende applicatie -dod_dod5015.property.dod_producingApplicationVersion.description=Versie producerende applicatie -dod_dod5015.property.dod_pdfVersion.title=PDF-versie -dod_dod5015.property.dod_pdfVersion.description=PDF-versie -dod_dod5015.property.dod_creatingApplication.title=Producerende applicatie -dod_dod5015.property.dod_creatingApplication.description=Producerende applicatie -dod_dod5015.property.dod_documentSecuritySettings.title=Documentbeveiligingsinstellingen -dod_dod5015.property.dod_documentSecuritySettings.description=Documentbeveiligingsinstellingen - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digitale fotorecord -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digitale fotorecord -dod_dod5015.property.dod_caption.title=Bijschrift -dod_dod5015.property.dod_caption.description=Bijschrift -dod_dod5015.property.dod_photographer.title=Fotograaf -dod_dod5015.property.dod_photographer.description=Fotograaf -dod_dod5015.property.dod_copyright.title=Auteursrecht -dod_dod5015.property.dod_copyright.description=Auteursrecht -dod_dod5015.property.dod_bitDepth.title=Bitdiepte -dod_dod5015.property.dod_bitDepth.description=Bitdiepte -dod_dod5015.property.dod_imageSizeX.title=Beeldgrootte X -dod_dod5015.property.dod_imageSizeX.description=Beeldgrootte X -dod_dod5015.property.dod_imageSizeY.title=Beeldgrootte Y -dod_dod5015.property.dod_imageSizeY.description=Beeldgrootte Y -dod_dod5015.property.dod_imageSource.title=Beeldbron -dod_dod5015.property.dod_imageSource.description=Beeldbron -dod_dod5015.property.dod_compression.title=Compressie -dod_dod5015.property.dod_compression.description=Compressie -dod_dod5015.property.dod_iccIcmProfile.title=ICC-/ICM-profiel -dod_dod5015.property.dod_iccIcmProfile.description=ICC-/ICM-profiel -dod_dod5015.property.dod_exifInformation.title=EXIF-informatie -dod_dod5015.property.dod_exifInformation.description=EXIF-informatie - -dod_dod5015.aspect.dod_webRecord.title=Web-record -dod_dod5015.aspect.dod_webRecord.description=Web-record -dod_dod5015.property.dod_webFileName.title=Web-bestandsnaam -dod_dod5015.property.dod_webFileName.description=Web-bestandsnaam -dod_dod5015.property.dod_webPlatform.title=Web-platform -dod_dod5015.property.dod_webPlatform.description=Web-platform -dod_dod5015.property.dod_webSiteName.title=Websitenaam -dod_dod5015.property.dod_webSiteName.description=Websitenaam -dod_dod5015.property.dod_webSiteURL.title=Websiteadres -dod_dod5015.property.dod_webSiteURL.description=Websiteadres -dod_dod5015.property.dod_captureMethod.title=Methode van vastleggen -dod_dod5015.property.dod_captureMethod.description=Methode van vastleggen -dod_dod5015.property.dod_captureDate.title=Vastlegdatum -dod_dod5015.property.dod_captureDate.description=Vastlegdatum -dod_dod5015.property.dod_contact.title=Contact -dod_dod5015.property.dod_contact.description=Contact -dod_dod5015.property.dod_contentManagementSystem.title=Contentmanagementsysteem -dod_dod5015.property.dod_contentManagementSystem.description=Contentmanagementsysteem - +dod_dod5015.description=DOD5015-contentmodel + +dod_dod5015.type.dod_site.title=DOD5015-site +dod_dod5015.type.dod_site.description=DOD5015-site + +dod_dod5015.type.dod_filePlan.title=DOD5015-ordeningsplan +dod_dod5015.type.dod_filePlan.description=DOD5015-ordeningsplan + +dod_dod5015.type.dod_recordSeries.title=Recordreeks (afgekeurd) +dod_dod5015.type.dod_recordSeries.description=Recordreeks (afgekeurd) + +dod_dod5015.aspect.dod_dod5015record.title=DOD5015-record +dod_dod5015.aspect.dod_dod5015record.description=DOD5015-record +dod_dod5015.property.dod_publicationDate.title=Publicatiedatum +dod_dod5015.property.dod_publicationDate.decription=Publicatiedatum +dod_dod5015.property.dod_originator.title=Herkomst +dod_dod5015.property.dod_originator.decription=Herkomst +dod_dod5015.property.dod_originatingOrganization.title=Oorspronkelijke organisatie +dod_dod5015.property.dod_originatingOrganization.decription=Oorspronkelijke organisatie +dod_dod5015.property.dod_mediaType.title=Type medium +dod_dod5015.property.dod_mediaType.decription=Type medium +dod_dod5015.property.dod_format.title=Indeling +dod_dod5015.property.dod_format.decription=Indeling +dod_dod5015.property.dod_dateReceived.title=Datum ontvangen +dod_dod5015.property.dod_dateReceived.decription=Datum ontvangen +dod_dod5015.property.dod_address.title=Geadresseerde +dod_dod5015.property.dod_address.decription=Geadresseerde +dod_dod5015.property.dod_otherAddress.title=Andere geadresseerde +dod_dod5015.property.dod_otherAddress.decription=Andere geadresseerde + +dod_dod5015.aspect.dod_scannedRecord.title=Gescande record +dod_dod5015.aspect.dod_scannedRecord.description=Gescande record +dod_dod5015.property.dod_scannedFormat.title=Beeldindeling +dod_dod5015.property.dod_scannedFormat.description=Beeldindeling +dod_dod5015.property.dod_scannedFormatVersion.title=Beeldindeling en -versie +dod_dod5015.property.dod_scannedFormatVersion.description=Beeldindeling en -versie +dod_dod5015.property.dod_resolutionX.title=Beeldresolutie X +dod_dod5015.property.dod_resolutionX.description=Beeldresolutie X +dod_dod5015.property.dod_resolutionY.title=Beeldresolutie Y +dod_dod5015.property.dod_resolutionY.description=Beeldresolutie Y +dod_dod5015.property.dod_scannedBitDepth.title=Gescande bitdiepte +dod_dod5015.property.dod_scannedBitDepth.description=Gescande bitdiepte + +dod_dod5015.aspect.dod_pdfRecord.title=PDF-record +dod_dod5015.aspect.dod_pdfRecord.description=PDF-record +dod_dod5015.property.dod_producingApplication.title=Producerende applicatie +dod_dod5015.property.dod_producingApplication.description=Producerende applicatie +dod_dod5015.property.dod_producingApplicationVersion.title=Versie producerende applicatie +dod_dod5015.property.dod_producingApplicationVersion.description=Versie producerende applicatie +dod_dod5015.property.dod_pdfVersion.title=PDF-versie +dod_dod5015.property.dod_pdfVersion.description=PDF-versie +dod_dod5015.property.dod_creatingApplication.title=Producerende applicatie +dod_dod5015.property.dod_creatingApplication.description=Producerende applicatie +dod_dod5015.property.dod_documentSecuritySettings.title=Documentbeveiligingsinstellingen +dod_dod5015.property.dod_documentSecuritySettings.description=Documentbeveiligingsinstellingen + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digitale fotorecord +dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digitale fotorecord +dod_dod5015.property.dod_caption.title=Bijschrift +dod_dod5015.property.dod_caption.description=Bijschrift +dod_dod5015.property.dod_photographer.title=Fotograaf +dod_dod5015.property.dod_photographer.description=Fotograaf +dod_dod5015.property.dod_copyright.title=Auteursrecht +dod_dod5015.property.dod_copyright.description=Auteursrecht +dod_dod5015.property.dod_bitDepth.title=Bitdiepte +dod_dod5015.property.dod_bitDepth.description=Bitdiepte +dod_dod5015.property.dod_imageSizeX.title=Beeldgrootte X +dod_dod5015.property.dod_imageSizeX.description=Beeldgrootte X +dod_dod5015.property.dod_imageSizeY.title=Beeldgrootte Y +dod_dod5015.property.dod_imageSizeY.description=Beeldgrootte Y +dod_dod5015.property.dod_imageSource.title=Beeldbron +dod_dod5015.property.dod_imageSource.description=Beeldbron +dod_dod5015.property.dod_compression.title=Compressie +dod_dod5015.property.dod_compression.description=Compressie +dod_dod5015.property.dod_iccIcmProfile.title=ICC-/ICM-profiel +dod_dod5015.property.dod_iccIcmProfile.description=ICC-/ICM-profiel +dod_dod5015.property.dod_exifInformation.title=EXIF-informatie +dod_dod5015.property.dod_exifInformation.description=EXIF-informatie + +dod_dod5015.aspect.dod_webRecord.title=Web-record +dod_dod5015.aspect.dod_webRecord.description=Web-record +dod_dod5015.property.dod_webFileName.title=Web-bestandsnaam +dod_dod5015.property.dod_webFileName.description=Web-bestandsnaam +dod_dod5015.property.dod_webPlatform.title=Web-platform +dod_dod5015.property.dod_webPlatform.description=Web-platform +dod_dod5015.property.dod_webSiteName.title=Websitenaam +dod_dod5015.property.dod_webSiteName.description=Websitenaam +dod_dod5015.property.dod_webSiteURL.title=Websiteadres +dod_dod5015.property.dod_webSiteURL.description=Websiteadres +dod_dod5015.property.dod_captureMethod.title=Methode van vastleggen +dod_dod5015.property.dod_captureMethod.description=Methode van vastleggen +dod_dod5015.property.dod_captureDate.title=Vastlegdatum +dod_dod5015.property.dod_captureDate.description=Vastlegdatum +dod_dod5015.property.dod_contact.title=Contact +dod_dod5015.property.dod_contact.description=Contact +dod_dod5015.property.dod_contentManagementSystem.title=Contentmanagementsysteem +dod_dod5015.property.dod_contentManagementSystem.description=Contentmanagementsysteem + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_pt_BR.properties index b1574a51d2..cc4e8b091a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_pt_BR.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=Modelo de conte\u00fado DOD5015 - -dod_dod5015.type.dod_site.title=Site DOD5015 -dod_dod5015.type.dod_site.description=Site DOD5015 - -dod_dod5015.type.dod_filePlan.title=Plano de arquivo DOD5015 -dod_dod5015.type.dod_filePlan.description=Plano de arquivo DOD5015 - -dod_dod5015.type.dod_recordSeries.title=S\u00e9rie de documento arquiv\u00edstico (obsoleta) -dod_dod5015.type.dod_recordSeries.description=S\u00e9rie de documento arquiv\u00edstico (obsoleta) - -dod_dod5015.aspect.dod_dod5015record.title=Documento arquiv\u00edstico DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=Documento arquiv\u00edstico DOD5015 -dod_dod5015.property.dod_publicationDate.title=Data de publica\u00e7\u00e3o -dod_dod5015.property.dod_publicationDate.decription=Data de publica\u00e7\u00e3o -dod_dod5015.property.dod_originator.title=Originador -dod_dod5015.property.dod_originator.decription=Originador -dod_dod5015.property.dod_originatingOrganization.title=Organiza\u00e7\u00e3o de origem -dod_dod5015.property.dod_originatingOrganization.decription=Organiza\u00e7\u00e3o de origem -dod_dod5015.property.dod_mediaType.title=Tipo de m\u00eddia -dod_dod5015.property.dod_mediaType.decription=Tipo de m\u00eddia -dod_dod5015.property.dod_format.title=Formato -dod_dod5015.property.dod_format.decription=Formato -dod_dod5015.property.dod_dateReceived.title=Data de recebimento -dod_dod5015.property.dod_dateReceived.decription=Data de recebimento -dod_dod5015.property.dod_address.title=Destinat\u00e1rio -dod_dod5015.property.dod_address.decription=Destinat\u00e1rio -dod_dod5015.property.dod_otherAddress.title=Outro destinat\u00e1rio -dod_dod5015.property.dod_otherAddress.decription=Outro destinat\u00e1rio - -dod_dod5015.aspect.dod_scannedRecord.title=Documento arquiv\u00edstico escaneado -dod_dod5015.aspect.dod_scannedRecord.description=Documento arquiv\u00edstico escaneado -dod_dod5015.property.dod_scannedFormat.title=Formato da imagem -dod_dod5015.property.dod_scannedFormat.description=Formato da imagem -dod_dod5015.property.dod_scannedFormatVersion.title=Vers\u00e3o e formato da imagem -dod_dod5015.property.dod_scannedFormatVersion.description=Vers\u00e3o e formato da imagem -dod_dod5015.property.dod_resolutionX.title=Resolu\u00e7\u00e3o da imagem X -dod_dod5015.property.dod_resolutionX.description=Resolu\u00e7\u00e3o da imagem X -dod_dod5015.property.dod_resolutionY.title=Resolu\u00e7\u00e3o da imagem Y -dod_dod5015.property.dod_resolutionY.description=Resolu\u00e7\u00e3o da imagem Y -dod_dod5015.property.dod_scannedBitDepth.title=Intensidade de bits escaneada -dod_dod5015.property.dod_scannedBitDepth.description=Intensidade de bits escaneada - -dod_dod5015.aspect.dod_pdfRecord.title=Arquivo PDF -dod_dod5015.aspect.dod_pdfRecord.description=Arquivo PDF -dod_dod5015.property.dod_producingApplication.title=Aplicativo de produ\u00e7\u00e3o -dod_dod5015.property.dod_producingApplication.description=Aplicativo de produ\u00e7\u00e3o -dod_dod5015.property.dod_producingApplicationVersion.title=Vers\u00e3o do aplicativo de produ\u00e7\u00e3o -dod_dod5015.property.dod_producingApplicationVersion.description=Vers\u00e3o do aplicativo de produ\u00e7\u00e3o -dod_dod5015.property.dod_pdfVersion.title=Vers\u00e3o do PDF -dod_dod5015.property.dod_pdfVersion.description=Vers\u00e3o do PDF -dod_dod5015.property.dod_creatingApplication.title=Criando aplicativo -dod_dod5015.property.dod_creatingApplication.description=Criando aplicativo -dod_dod5015.property.dod_documentSecuritySettings.title=Configura\u00e7\u00f5es de seguran\u00e7a do documento -dod_dod5015.property.dod_documentSecuritySettings.description=Configura\u00e7\u00f5es de seguran\u00e7a do documento - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Documento arquiv\u00edstico fotogr\u00e1fico digital -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Documento arquiv\u00edstico fotogr\u00e1fico digital -dod_dod5015.property.dod_caption.title=Legenda -dod_dod5015.property.dod_caption.description=Legenda -dod_dod5015.property.dod_photographer.title=Fot\u00f3grafo -dod_dod5015.property.dod_photographer.description=Fot\u00f3grafo -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Intensidade de bit -dod_dod5015.property.dod_bitDepth.description=Intensidade de bit -dod_dod5015.property.dod_imageSizeX.title=Tamanho da imagem X -dod_dod5015.property.dod_imageSizeX.description=Tamanho da imagem X -dod_dod5015.property.dod_imageSizeY.title=Tamanho da imagem Y -dod_dod5015.property.dod_imageSizeY.description=Tamanho da imagem Y -dod_dod5015.property.dod_imageSource.title=Fonte da imagem -dod_dod5015.property.dod_imageSource.description=Fonte da imagem -dod_dod5015.property.dod_compression.title=Compress\u00e3o -dod_dod5015.property.dod_compression.description=Compress\u00e3o -dod_dod5015.property.dod_iccIcmProfile.title=Perfil ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=Perfil ICC/ICM -dod_dod5015.property.dod_exifInformation.title=Informa\u00e7\u00f5es EXIF -dod_dod5015.property.dod_exifInformation.description=Informa\u00e7\u00f5es EXIF - -dod_dod5015.aspect.dod_webRecord.title=Documento arquiv\u00edstico da Web -dod_dod5015.aspect.dod_webRecord.description=Documento arquiv\u00edstico da Web -dod_dod5015.property.dod_webFileName.title=Nome do arquivo da Web -dod_dod5015.property.dod_webFileName.description=Nome do arquivo da Web -dod_dod5015.property.dod_webPlatform.title=Plataforma da Web -dod_dod5015.property.dod_webPlatform.description=Plataforma da Web -dod_dod5015.property.dod_webSiteName.title=Nome do site -dod_dod5015.property.dod_webSiteName.description=Nome do site -dod_dod5015.property.dod_webSiteURL.title=URL do site -dod_dod5015.property.dod_webSiteURL.description=URL do site -dod_dod5015.property.dod_captureMethod.title=M\u00e9todo de captura -dod_dod5015.property.dod_captureMethod.description=M\u00e9todo de captura -dod_dod5015.property.dod_captureDate.title=Data de captura -dod_dod5015.property.dod_captureDate.description=Data de captura -dod_dod5015.property.dod_contact.title=Contato -dod_dod5015.property.dod_contact.description=Contato -dod_dod5015.property.dod_contentManagementSystem.title=Sistema de gerenciamento de conte\u00fado -dod_dod5015.property.dod_contentManagementSystem.description=Sistema de gerenciamento de conte\u00fado - +dod_dod5015.description=Modelo de conte\u00fado DOD5015 + +dod_dod5015.type.dod_site.title=Site DOD5015 +dod_dod5015.type.dod_site.description=Site DOD5015 + +dod_dod5015.type.dod_filePlan.title=Plano de arquivo DOD5015 +dod_dod5015.type.dod_filePlan.description=Plano de arquivo DOD5015 + +dod_dod5015.type.dod_recordSeries.title=S\u00e9rie de documento arquiv\u00edstico (obsoleta) +dod_dod5015.type.dod_recordSeries.description=S\u00e9rie de documento arquiv\u00edstico (obsoleta) + +dod_dod5015.aspect.dod_dod5015record.title=Documento arquiv\u00edstico DOD5015 +dod_dod5015.aspect.dod_dod5015record.description=Documento arquiv\u00edstico DOD5015 +dod_dod5015.property.dod_publicationDate.title=Data de publica\u00e7\u00e3o +dod_dod5015.property.dod_publicationDate.decription=Data de publica\u00e7\u00e3o +dod_dod5015.property.dod_originator.title=Originador +dod_dod5015.property.dod_originator.decription=Originador +dod_dod5015.property.dod_originatingOrganization.title=Organiza\u00e7\u00e3o de origem +dod_dod5015.property.dod_originatingOrganization.decription=Organiza\u00e7\u00e3o de origem +dod_dod5015.property.dod_mediaType.title=Tipo de m\u00eddia +dod_dod5015.property.dod_mediaType.decription=Tipo de m\u00eddia +dod_dod5015.property.dod_format.title=Formato +dod_dod5015.property.dod_format.decription=Formato +dod_dod5015.property.dod_dateReceived.title=Data de recebimento +dod_dod5015.property.dod_dateReceived.decription=Data de recebimento +dod_dod5015.property.dod_address.title=Destinat\u00e1rio +dod_dod5015.property.dod_address.decription=Destinat\u00e1rio +dod_dod5015.property.dod_otherAddress.title=Outro destinat\u00e1rio +dod_dod5015.property.dod_otherAddress.decription=Outro destinat\u00e1rio + +dod_dod5015.aspect.dod_scannedRecord.title=Documento arquiv\u00edstico escaneado +dod_dod5015.aspect.dod_scannedRecord.description=Documento arquiv\u00edstico escaneado +dod_dod5015.property.dod_scannedFormat.title=Formato da imagem +dod_dod5015.property.dod_scannedFormat.description=Formato da imagem +dod_dod5015.property.dod_scannedFormatVersion.title=Vers\u00e3o e formato da imagem +dod_dod5015.property.dod_scannedFormatVersion.description=Vers\u00e3o e formato da imagem +dod_dod5015.property.dod_resolutionX.title=Resolu\u00e7\u00e3o da imagem X +dod_dod5015.property.dod_resolutionX.description=Resolu\u00e7\u00e3o da imagem X +dod_dod5015.property.dod_resolutionY.title=Resolu\u00e7\u00e3o da imagem Y +dod_dod5015.property.dod_resolutionY.description=Resolu\u00e7\u00e3o da imagem Y +dod_dod5015.property.dod_scannedBitDepth.title=Intensidade de bits escaneada +dod_dod5015.property.dod_scannedBitDepth.description=Intensidade de bits escaneada + +dod_dod5015.aspect.dod_pdfRecord.title=Arquivo PDF +dod_dod5015.aspect.dod_pdfRecord.description=Arquivo PDF +dod_dod5015.property.dod_producingApplication.title=Aplicativo de produ\u00e7\u00e3o +dod_dod5015.property.dod_producingApplication.description=Aplicativo de produ\u00e7\u00e3o +dod_dod5015.property.dod_producingApplicationVersion.title=Vers\u00e3o do aplicativo de produ\u00e7\u00e3o +dod_dod5015.property.dod_producingApplicationVersion.description=Vers\u00e3o do aplicativo de produ\u00e7\u00e3o +dod_dod5015.property.dod_pdfVersion.title=Vers\u00e3o do PDF +dod_dod5015.property.dod_pdfVersion.description=Vers\u00e3o do PDF +dod_dod5015.property.dod_creatingApplication.title=Criando aplicativo +dod_dod5015.property.dod_creatingApplication.description=Criando aplicativo +dod_dod5015.property.dod_documentSecuritySettings.title=Configura\u00e7\u00f5es de seguran\u00e7a do documento +dod_dod5015.property.dod_documentSecuritySettings.description=Configura\u00e7\u00f5es de seguran\u00e7a do documento + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=Documento arquiv\u00edstico fotogr\u00e1fico digital +dod_dod5015.aspect.dod_digitalPhotographRecord.description=Documento arquiv\u00edstico fotogr\u00e1fico digital +dod_dod5015.property.dod_caption.title=Legenda +dod_dod5015.property.dod_caption.description=Legenda +dod_dod5015.property.dod_photographer.title=Fot\u00f3grafo +dod_dod5015.property.dod_photographer.description=Fot\u00f3grafo +dod_dod5015.property.dod_copyright.title=Copyright +dod_dod5015.property.dod_copyright.description=Copyright +dod_dod5015.property.dod_bitDepth.title=Intensidade de bit +dod_dod5015.property.dod_bitDepth.description=Intensidade de bit +dod_dod5015.property.dod_imageSizeX.title=Tamanho da imagem X +dod_dod5015.property.dod_imageSizeX.description=Tamanho da imagem X +dod_dod5015.property.dod_imageSizeY.title=Tamanho da imagem Y +dod_dod5015.property.dod_imageSizeY.description=Tamanho da imagem Y +dod_dod5015.property.dod_imageSource.title=Fonte da imagem +dod_dod5015.property.dod_imageSource.description=Fonte da imagem +dod_dod5015.property.dod_compression.title=Compress\u00e3o +dod_dod5015.property.dod_compression.description=Compress\u00e3o +dod_dod5015.property.dod_iccIcmProfile.title=Perfil ICC/ICM +dod_dod5015.property.dod_iccIcmProfile.description=Perfil ICC/ICM +dod_dod5015.property.dod_exifInformation.title=Informa\u00e7\u00f5es EXIF +dod_dod5015.property.dod_exifInformation.description=Informa\u00e7\u00f5es EXIF + +dod_dod5015.aspect.dod_webRecord.title=Documento arquiv\u00edstico da Web +dod_dod5015.aspect.dod_webRecord.description=Documento arquiv\u00edstico da Web +dod_dod5015.property.dod_webFileName.title=Nome do arquivo da Web +dod_dod5015.property.dod_webFileName.description=Nome do arquivo da Web +dod_dod5015.property.dod_webPlatform.title=Plataforma da Web +dod_dod5015.property.dod_webPlatform.description=Plataforma da Web +dod_dod5015.property.dod_webSiteName.title=Nome do site +dod_dod5015.property.dod_webSiteName.description=Nome do site +dod_dod5015.property.dod_webSiteURL.title=URL do site +dod_dod5015.property.dod_webSiteURL.description=URL do site +dod_dod5015.property.dod_captureMethod.title=M\u00e9todo de captura +dod_dod5015.property.dod_captureMethod.description=M\u00e9todo de captura +dod_dod5015.property.dod_captureDate.title=Data de captura +dod_dod5015.property.dod_captureDate.description=Data de captura +dod_dod5015.property.dod_contact.title=Contato +dod_dod5015.property.dod_contact.description=Contato +dod_dod5015.property.dod_contentManagementSystem.title=Sistema de gerenciamento de conte\u00fado +dod_dod5015.property.dod_contentManagementSystem.description=Sistema de gerenciamento de conte\u00fado + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ru.properties index 67956e54c0..d922a2c8ff 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_ru.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 DOD5015 - -dod_dod5015.type.dod_site.title=\u0421\u0430\u0439\u0442 DOD5015 -dod_dod5015.type.dod_site.description=\u0421\u0430\u0439\u0442 DOD5015 - -dod_dod5015.type.dod_filePlan.title=\u0410\u0440\u0445\u0438\u0432 DOD5015 -dod_dod5015.type.dod_filePlan.description=\u0410\u0440\u0445\u0438\u0432 DOD5015 - -dod_dod5015.type.dod_recordSeries.title=\u0421\u0435\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0443\u0441\u0442\u0430\u0440\u0435\u043b\u043e) -dod_dod5015.type.dod_recordSeries.description=\u0421\u0435\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0443\u0441\u0442\u0430\u0440\u0435\u043b\u043e) - -dod_dod5015.aspect.dod_dod5015record.title=\u0417\u0430\u043f\u0438\u0441\u044c DOD5015 -dod_dod5015.aspect.dod_dod5015record.description=\u0417\u0430\u043f\u0438\u0441\u044c DOD5015 -dod_dod5015.property.dod_publicationDate.title=\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 -dod_dod5015.property.dod_publicationDate.decription=\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 -dod_dod5015.property.dod_originator.title=\u0418\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440 -dod_dod5015.property.dod_originator.decription=\u0418\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440 -dod_dod5015.property.dod_originatingOrganization.title=\u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f -dod_dod5015.property.dod_originatingOrganization.decription=\u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f -dod_dod5015.property.dod_mediaType.title=\u0422\u0438\u043f \u043c\u0435\u0434\u0438\u0430 -dod_dod5015.property.dod_mediaType.decription=\u0422\u0438\u043f \u043c\u0435\u0434\u0438\u0430 -dod_dod5015.property.dod_format.title=\u0424\u043e\u0440\u043c\u0430\u0442 -dod_dod5015.property.dod_format.decription=\u0424\u043e\u0440\u043c\u0430\u0442 -dod_dod5015.property.dod_dateReceived.title=\u0414\u0430\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_dateReceived.decription=\u0414\u0430\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_address.title=\u0410\u0434\u0440\u0435\u0441\u0430\u0442 -dod_dod5015.property.dod_address.decription=\u0410\u0434\u0440\u0435\u0441\u0430\u0442 -dod_dod5015.property.dod_otherAddress.title=\u0414\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441\u0430\u0442 -dod_dod5015.property.dod_otherAddress.decription=\u0414\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441\u0430\u0442 - -dod_dod5015.aspect.dod_scannedRecord.title=\u041e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -dod_dod5015.aspect.dod_scannedRecord.description=\u041e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -dod_dod5015.property.dod_scannedFormat.title=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_scannedFormat.description=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_scannedFormatVersion.title=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_scannedFormatVersion.description=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_resolutionX.title=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X -dod_dod5015.property.dod_resolutionX.description=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X -dod_dod5015.property.dod_resolutionY.title=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y -dod_dod5015.property.dod_resolutionY.description=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y -dod_dod5015.property.dod_scannedBitDepth.title=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_scannedBitDepth.description=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f - -dod_dod5015.aspect.dod_pdfRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c PDF -dod_dod5015.aspect.dod_pdfRecord.description=\u0417\u0430\u043f\u0438\u0441\u044c PDF -dod_dod5015.property.dod_producingApplication.title=\u0412\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dod_dod5015.property.dod_producingApplication.description=\u0412\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dod_dod5015.property.dod_producingApplicationVersion.title=\u0412\u0435\u0440\u0441\u0438\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_producingApplicationVersion.description=\u0412\u0435\u0440\u0441\u0438\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_pdfVersion.title=\u0412\u0435\u0440\u0441\u0438\u044f PDF -dod_dod5015.property.dod_pdfVersion.description=\u0412\u0435\u0440\u0441\u0438\u044f PDF -dod_dod5015.property.dod_creatingApplication.title=\u0421\u043e\u0437\u0434\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dod_dod5015.property.dod_creatingApplication.description=\u0421\u043e\u0437\u0434\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -dod_dod5015.property.dod_documentSecuritySettings.title=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 -dod_dod5015.property.dod_documentSecuritySettings.description=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0432\u0438\u0434\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 -dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0432\u0438\u0434\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 -dod_dod5015.property.dod_caption.title=\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a -dod_dod5015.property.dod_caption.description=\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a -dod_dod5015.property.dod_photographer.title=\u0410\u0432\u0442\u043e\u0440 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 -dod_dod5015.property.dod_photographer.description=\u0410\u0432\u0442\u043e\u0440 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 -dod_dod5015.property.dod_copyright.title=\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 -dod_dod5015.property.dod_copyright.description=\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 -dod_dod5015.property.dod_bitDepth.title=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 -dod_dod5015.property.dod_bitDepth.description=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 -dod_dod5015.property.dod_imageSizeX.title=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X -dod_dod5015.property.dod_imageSizeX.description=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X -dod_dod5015.property.dod_imageSizeY.title=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y -dod_dod5015.property.dod_imageSizeY.description=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y -dod_dod5015.property.dod_imageSource.title=\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_imageSource.description=\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f -dod_dod5015.property.dod_compression.title=\u0421\u0436\u0430\u0442\u0438\u0435 -dod_dod5015.property.dod_compression.description=\u0421\u0436\u0430\u0442\u0438\u0435 -dod_dod5015.property.dod_iccIcmProfile.title=\u041f\u0440\u043e\u0444\u0438\u043b\u044c ICC/ICM -dod_dod5015.property.dod_iccIcmProfile.description=\u041f\u0440\u043e\u0444\u0438\u043b\u044c ICC/ICM -dod_dod5015.property.dod_exifInformation.title=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f EXIF -dod_dod5015.property.dod_exifInformation.description=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f EXIF - -dod_dod5015.aspect.dod_webRecord.title=\u0412\u0435\u0431-\u0437\u0430\u043f\u0438\u0441\u044c -dod_dod5015.aspect.dod_webRecord.description=\u0412\u0435\u0431-\u0437\u0430\u043f\u0438\u0441\u044c -dod_dod5015.property.dod_webFileName.title=\u0418\u043c\u044f \u0432\u0435\u0431-\u0444\u0430\u0439\u043b\u0430 -dod_dod5015.property.dod_webFileName.description=\u0418\u043c\u044f \u0432\u0435\u0431-\u0444\u0430\u0439\u043b\u0430 -dod_dod5015.property.dod_webPlatform.title=\u0412\u0435\u0431-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 -dod_dod5015.property.dod_webPlatform.description=\u0412\u0435\u0431-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 -dod_dod5015.property.dod_webSiteName.title=\u0418\u043c\u044f \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 -dod_dod5015.property.dod_webSiteName.description=\u0418\u043c\u044f \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 -dod_dod5015.property.dod_webSiteURL.title=URL-\u0430\u0434\u0440\u0435\u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 -dod_dod5015.property.dod_webSiteURL.description=URL-\u0430\u0434\u0440\u0435\u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 -dod_dod5015.property.dod_captureMethod.title=\u0421\u043f\u043e\u0441\u043e\u0431 \u0432\u0432\u043e\u0434\u0430 -dod_dod5015.property.dod_captureMethod.description=\u0421\u043f\u043e\u0441\u043e\u0431 \u0432\u0432\u043e\u0434\u0430 -dod_dod5015.property.dod_captureDate.title=\u0414\u0430\u0442\u0430 \u0441\u043d\u0438\u043c\u043a\u0430 -dod_dod5015.property.dod_captureDate.description=\u0414\u0430\u0442\u0430 \u0441\u043d\u0438\u043c\u043a\u0430 -dod_dod5015.property.dod_contact.title=\u041a\u043e\u043d\u0442\u0430\u043a\u0442 -dod_dod5015.property.dod_contact.description=\u041a\u043e\u043d\u0442\u0430\u043a\u0442 -dod_dod5015.property.dod_contentManagementSystem.title=\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c -dod_dod5015.property.dod_contentManagementSystem.description=\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c - +dod_dod5015.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 DOD5015 + +dod_dod5015.type.dod_site.title=\u0421\u0430\u0439\u0442 DOD5015 +dod_dod5015.type.dod_site.description=\u0421\u0430\u0439\u0442 DOD5015 + +dod_dod5015.type.dod_filePlan.title=\u0410\u0440\u0445\u0438\u0432 DOD5015 +dod_dod5015.type.dod_filePlan.description=\u0410\u0440\u0445\u0438\u0432 DOD5015 + +dod_dod5015.type.dod_recordSeries.title=\u0421\u0435\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0443\u0441\u0442\u0430\u0440\u0435\u043b\u043e) +dod_dod5015.type.dod_recordSeries.description=\u0421\u0435\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u0443\u0441\u0442\u0430\u0440\u0435\u043b\u043e) + +dod_dod5015.aspect.dod_dod5015record.title=\u0417\u0430\u043f\u0438\u0441\u044c DOD5015 +dod_dod5015.aspect.dod_dod5015record.description=\u0417\u0430\u043f\u0438\u0441\u044c DOD5015 +dod_dod5015.property.dod_publicationDate.title=\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 +dod_dod5015.property.dod_publicationDate.decription=\u0414\u0430\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 +dod_dod5015.property.dod_originator.title=\u0418\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440 +dod_dod5015.property.dod_originator.decription=\u0418\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440 +dod_dod5015.property.dod_originatingOrganization.title=\u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f +dod_dod5015.property.dod_originatingOrganization.decription=\u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f +dod_dod5015.property.dod_mediaType.title=\u0422\u0438\u043f \u043c\u0435\u0434\u0438\u0430 +dod_dod5015.property.dod_mediaType.decription=\u0422\u0438\u043f \u043c\u0435\u0434\u0438\u0430 +dod_dod5015.property.dod_format.title=\u0424\u043e\u0440\u043c\u0430\u0442 +dod_dod5015.property.dod_format.decription=\u0424\u043e\u0440\u043c\u0430\u0442 +dod_dod5015.property.dod_dateReceived.title=\u0414\u0430\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_dateReceived.decription=\u0414\u0430\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_address.title=\u0410\u0434\u0440\u0435\u0441\u0430\u0442 +dod_dod5015.property.dod_address.decription=\u0410\u0434\u0440\u0435\u0441\u0430\u0442 +dod_dod5015.property.dod_otherAddress.title=\u0414\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441\u0430\u0442 +dod_dod5015.property.dod_otherAddress.decription=\u0414\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441\u0430\u0442 + +dod_dod5015.aspect.dod_scannedRecord.title=\u041e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c +dod_dod5015.aspect.dod_scannedRecord.description=\u041e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c +dod_dod5015.property.dod_scannedFormat.title=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_scannedFormat.description=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_scannedFormatVersion.title=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_scannedFormatVersion.description=\u0424\u043e\u0440\u043c\u0430\u0442 \u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_resolutionX.title=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X +dod_dod5015.property.dod_resolutionX.description=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X +dod_dod5015.property.dod_resolutionY.title=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y +dod_dod5015.property.dod_resolutionY.description=\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y +dod_dod5015.property.dod_scannedBitDepth.title=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_scannedBitDepth.description=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u043e\u0442\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f + +dod_dod5015.aspect.dod_pdfRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c PDF +dod_dod5015.aspect.dod_pdfRecord.description=\u0417\u0430\u043f\u0438\u0441\u044c PDF +dod_dod5015.property.dod_producingApplication.title=\u0412\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 +dod_dod5015.property.dod_producingApplication.description=\u0412\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 +dod_dod5015.property.dod_producingApplicationVersion.title=\u0412\u0435\u0440\u0441\u0438\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_producingApplicationVersion.description=\u0412\u0435\u0440\u0441\u0438\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_pdfVersion.title=\u0412\u0435\u0440\u0441\u0438\u044f PDF +dod_dod5015.property.dod_pdfVersion.description=\u0412\u0435\u0440\u0441\u0438\u044f PDF +dod_dod5015.property.dod_creatingApplication.title=\u0421\u043e\u0437\u0434\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 +dod_dod5015.property.dod_creatingApplication.description=\u0421\u043e\u0437\u0434\u0430\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 +dod_dod5015.property.dod_documentSecuritySettings.title=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 +dod_dod5015.property.dod_documentSecuritySettings.description=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0432\u0438\u0434\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 +dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0432 \u0432\u0438\u0434\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 +dod_dod5015.property.dod_caption.title=\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a +dod_dod5015.property.dod_caption.description=\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a +dod_dod5015.property.dod_photographer.title=\u0410\u0432\u0442\u043e\u0440 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 +dod_dod5015.property.dod_photographer.description=\u0410\u0432\u0442\u043e\u0440 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 +dod_dod5015.property.dod_copyright.title=\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 +dod_dod5015.property.dod_copyright.description=\u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 +dod_dod5015.property.dod_bitDepth.title=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 +dod_dod5015.property.dod_bitDepth.description=\u0411\u0438\u0442\u043e\u0432\u0430\u044f \u0433\u043b\u0443\u0431\u0438\u043d\u0430 +dod_dod5015.property.dod_imageSizeX.title=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X +dod_dod5015.property.dod_imageSizeX.description=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 X +dod_dod5015.property.dod_imageSizeY.title=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y +dod_dod5015.property.dod_imageSizeY.description=\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0441\u0438 Y +dod_dod5015.property.dod_imageSource.title=\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_imageSource.description=\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f +dod_dod5015.property.dod_compression.title=\u0421\u0436\u0430\u0442\u0438\u0435 +dod_dod5015.property.dod_compression.description=\u0421\u0436\u0430\u0442\u0438\u0435 +dod_dod5015.property.dod_iccIcmProfile.title=\u041f\u0440\u043e\u0444\u0438\u043b\u044c ICC/ICM +dod_dod5015.property.dod_iccIcmProfile.description=\u041f\u0440\u043e\u0444\u0438\u043b\u044c ICC/ICM +dod_dod5015.property.dod_exifInformation.title=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f EXIF +dod_dod5015.property.dod_exifInformation.description=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f EXIF + +dod_dod5015.aspect.dod_webRecord.title=\u0412\u0435\u0431-\u0437\u0430\u043f\u0438\u0441\u044c +dod_dod5015.aspect.dod_webRecord.description=\u0412\u0435\u0431-\u0437\u0430\u043f\u0438\u0441\u044c +dod_dod5015.property.dod_webFileName.title=\u0418\u043c\u044f \u0432\u0435\u0431-\u0444\u0430\u0439\u043b\u0430 +dod_dod5015.property.dod_webFileName.description=\u0418\u043c\u044f \u0432\u0435\u0431-\u0444\u0430\u0439\u043b\u0430 +dod_dod5015.property.dod_webPlatform.title=\u0412\u0435\u0431-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 +dod_dod5015.property.dod_webPlatform.description=\u0412\u0435\u0431-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 +dod_dod5015.property.dod_webSiteName.title=\u0418\u043c\u044f \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 +dod_dod5015.property.dod_webSiteName.description=\u0418\u043c\u044f \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 +dod_dod5015.property.dod_webSiteURL.title=URL-\u0430\u0434\u0440\u0435\u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 +dod_dod5015.property.dod_webSiteURL.description=URL-\u0430\u0434\u0440\u0435\u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0430 +dod_dod5015.property.dod_captureMethod.title=\u0421\u043f\u043e\u0441\u043e\u0431 \u0432\u0432\u043e\u0434\u0430 +dod_dod5015.property.dod_captureMethod.description=\u0421\u043f\u043e\u0441\u043e\u0431 \u0432\u0432\u043e\u0434\u0430 +dod_dod5015.property.dod_captureDate.title=\u0414\u0430\u0442\u0430 \u0441\u043d\u0438\u043c\u043a\u0430 +dod_dod5015.property.dod_captureDate.description=\u0414\u0430\u0442\u0430 \u0441\u043d\u0438\u043c\u043a\u0430 +dod_dod5015.property.dod_contact.title=\u041a\u043e\u043d\u0442\u0430\u043a\u0442 +dod_dod5015.property.dod_contact.description=\u041a\u043e\u043d\u0442\u0430\u043a\u0442 +dod_dod5015.property.dod_contentManagementSystem.title=\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c +dod_dod5015.property.dod_contentManagementSystem.description=\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_zh_CN.properties index 660f640ae5..30dcfe4419 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_zh_CN.properties @@ -1,98 +1,98 @@ -dod_dod5015.description=DOD5015 \u5185\u5bb9\u6a21\u578b - -dod_dod5015.type.dod_site.title=DOD5015 \u7ad9\u70b9 -dod_dod5015.type.dod_site.description=DOD5015 \u7ad9\u70b9 - -dod_dod5015.type.dod_filePlan.title=DOD5015 \u5f52\u7c7b\u65b9\u6848 -dod_dod5015.type.dod_filePlan.description=DOD5015 \u5f52\u7c7b\u65b9\u6848 - -dod_dod5015.type.dod_recordSeries.title=\u8bb0\u5f55\u7cfb\u5217\uff08\u5df2\u5f03\u7528\uff09 -dod_dod5015.type.dod_recordSeries.description=\u8bb0\u5f55\u7cfb\u5217\uff08\u5df2\u5f03\u7528\uff09 - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015 \u8bb0\u5f55 -dod_dod5015.aspect.dod_dod5015record.description=DOD5015 \u8bb0\u5f55 -dod_dod5015.property.dod_publicationDate.title=\u53d1\u5e03\u65e5\u671f -dod_dod5015.property.dod_publicationDate.decription=\u53d1\u5e03\u65e5\u671f -dod_dod5015.property.dod_originator.title=\u5efa\u7acb\u8005 -dod_dod5015.property.dod_originator.decription=\u5efa\u7acb\u8005 -dod_dod5015.property.dod_originatingOrganization.title=\u8d77\u59cb\u7ec4\u7ec7 -dod_dod5015.property.dod_originatingOrganization.decription=\u8d77\u59cb\u7ec4\u7ec7 -dod_dod5015.property.dod_mediaType.title=\u5a92\u4f53\u7c7b\u578b -dod_dod5015.property.dod_mediaType.decription=\u5a92\u4f53\u7c7b\u578b -dod_dod5015.property.dod_format.title=\u683c\u5f0f -dod_dod5015.property.dod_format.decription=\u683c\u5f0f -dod_dod5015.property.dod_dateReceived.title=\u63a5\u6536\u65e5\u671f -dod_dod5015.property.dod_dateReceived.decription=\u63a5\u6536\u65e5\u671f -dod_dod5015.property.dod_address.title=\u6536\u4ef6\u4eba -dod_dod5015.property.dod_address.decription=\u6536\u4ef6\u4eba -dod_dod5015.property.dod_otherAddress.title=\u5176\u4ed6\u6536\u4ef6\u4eba -dod_dod5015.property.dod_otherAddress.decription=\u5176\u4ed6\u6536\u4ef6\u4eba - -dod_dod5015.aspect.dod_scannedRecord.title=\u626b\u63cf\u7684\u8bb0\u5f55 -dod_dod5015.aspect.dod_scannedRecord.description=\u626b\u63cf\u7684\u8bb0\u5f55 -dod_dod5015.property.dod_scannedFormat.title=\u56fe\u50cf\u683c\u5f0f -dod_dod5015.property.dod_scannedFormat.description=\u56fe\u50cf\u683c\u5f0f -dod_dod5015.property.dod_scannedFormatVersion.title=\u56fe\u50cf\u683c\u5f0f\u548c\u7248\u672c -dod_dod5015.property.dod_scannedFormatVersion.description=\u56fe\u50cf\u683c\u5f0f\u548c\u7248\u672c -dod_dod5015.property.dod_resolutionX.title=\u56fe\u50cf\u5206\u8fa8\u7387 X -dod_dod5015.property.dod_resolutionX.description=\u56fe\u50cf\u5206\u8fa8\u7387 X -dod_dod5015.property.dod_resolutionY.title=\u56fe\u50cf\u5206\u8fa8\u7387 Y -dod_dod5015.property.dod_resolutionY.description=\u56fe\u50cf\u5206\u8fa8\u7387 Y -dod_dod5015.property.dod_scannedBitDepth.title=\u626b\u63cf\u7684\u4f4d\u6df1 -dod_dod5015.property.dod_scannedBitDepth.description=\u626b\u63cf\u7684\u4f4d\u6df1 - -dod_dod5015.aspect.dod_pdfRecord.title=PDF \u8bb0\u5f55 -dod_dod5015.aspect.dod_pdfRecord.description=PDF \u8bb0\u5f55 -dod_dod5015.property.dod_producingApplication.title=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f -dod_dod5015.property.dod_producingApplication.description=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f -dod_dod5015.property.dod_producingApplicationVersion.title=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f\u7248\u672c -dod_dod5015.property.dod_producingApplicationVersion.description=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f\u7248\u672c -dod_dod5015.property.dod_pdfVersion.title=PDF \u7248\u672c -dod_dod5015.property.dod_pdfVersion.description=PDF \u7248\u672c -dod_dod5015.property.dod_creatingApplication.title=\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f -dod_dod5015.property.dod_creatingApplication.description=\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f -dod_dod5015.property.dod_documentSecuritySettings.title=\u6587\u6863\u5b89\u5168\u8bbe\u7f6e -dod_dod5015.property.dod_documentSecuritySettings.description=\u6587\u6863\u5b89\u5168\u8bbe\u7f6e - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u6570\u7801\u7167\u7247\u8bb0\u5f55 -dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u6570\u7801\u7167\u7247\u8bb0\u5f55 -dod_dod5015.property.dod_caption.title=\u6807\u9898 -dod_dod5015.property.dod_caption.description=\u6807\u9898 -dod_dod5015.property.dod_photographer.title=\u6444\u5f71\u5e08 -dod_dod5015.property.dod_photographer.description=\u6444\u5f71\u5e08 -dod_dod5015.property.dod_copyright.title=\u7248\u6743 -dod_dod5015.property.dod_copyright.description=\u7248\u6743 -dod_dod5015.property.dod_bitDepth.title=\u4f4d\u6df1 -dod_dod5015.property.dod_bitDepth.description=\u4f4d\u6df1 -dod_dod5015.property.dod_imageSizeX.title=\u56fe\u50cf\u5c3a\u5bf8 X -dod_dod5015.property.dod_imageSizeX.description=\u56fe\u50cf\u5c3a\u5bf8 X -dod_dod5015.property.dod_imageSizeY.title=\u56fe\u50cf\u5c3a\u5bf8 Y -dod_dod5015.property.dod_imageSizeY.description=\u56fe\u50cf\u5c3a\u5bf8 Y -dod_dod5015.property.dod_imageSource.title=\u56fe\u50cf\u6e90 -dod_dod5015.property.dod_imageSource.description=\u56fe\u50cf\u6e90 -dod_dod5015.property.dod_compression.title=\u538b\u7f29 -dod_dod5015.property.dod_compression.description=\u538b\u7f29 -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM \u914d\u7f6e\u6587\u4ef6 -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM \u914d\u7f6e\u6587\u4ef6 -dod_dod5015.property.dod_exifInformation.title=EXIF \u4fe1\u606f -dod_dod5015.property.dod_exifInformation.description=EXIF \u4fe1\u606f - -dod_dod5015.aspect.dod_webRecord.title=Web \u8bb0\u5f55 -dod_dod5015.aspect.dod_webRecord.description=Web \u8bb0\u5f55 -dod_dod5015.property.dod_webFileName.title=Web \u6587\u4ef6\u540d -dod_dod5015.property.dod_webFileName.description=Web \u6587\u4ef6\u540d -dod_dod5015.property.dod_webPlatform.title=Web \u5e73\u53f0 -dod_dod5015.property.dod_webPlatform.description=Web \u5e73\u53f0 -dod_dod5015.property.dod_webSiteName.title=\u7f51\u7ad9\u540d\u79f0 -dod_dod5015.property.dod_webSiteName.description=\u7f51\u7ad9\u540d\u79f0 -dod_dod5015.property.dod_webSiteURL.title=\u7f51\u7ad9 URL -dod_dod5015.property.dod_webSiteURL.description=\u7f51\u7ad9 URL -dod_dod5015.property.dod_captureMethod.title=\u6355\u6349\u65b9\u6cd5 -dod_dod5015.property.dod_captureMethod.description=\u6355\u6349\u65b9\u6cd5 -dod_dod5015.property.dod_captureDate.title=\u6355\u6349\u65e5\u671f -dod_dod5015.property.dod_captureDate.description=\u6355\u6349\u65e5\u671f -dod_dod5015.property.dod_contact.title=\u8054\u7cfb\u4eba -dod_dod5015.property.dod_contact.description=\u8054\u7cfb\u4eba -dod_dod5015.property.dod_contentManagementSystem.title=\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf -dod_dod5015.property.dod_contentManagementSystem.description=\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf - +dod_dod5015.description=DOD5015 \u5185\u5bb9\u6a21\u578b + +dod_dod5015.type.dod_site.title=DOD5015 \u7ad9\u70b9 +dod_dod5015.type.dod_site.description=DOD5015 \u7ad9\u70b9 + +dod_dod5015.type.dod_filePlan.title=DOD5015 \u5f52\u7c7b\u65b9\u6848 +dod_dod5015.type.dod_filePlan.description=DOD5015 \u5f52\u7c7b\u65b9\u6848 + +dod_dod5015.type.dod_recordSeries.title=\u8bb0\u5f55\u7cfb\u5217\uff08\u5df2\u5f03\u7528\uff09 +dod_dod5015.type.dod_recordSeries.description=\u8bb0\u5f55\u7cfb\u5217\uff08\u5df2\u5f03\u7528\uff09 + +dod_dod5015.aspect.dod_dod5015record.title=DOD5015 \u8bb0\u5f55 +dod_dod5015.aspect.dod_dod5015record.description=DOD5015 \u8bb0\u5f55 +dod_dod5015.property.dod_publicationDate.title=\u53d1\u5e03\u65e5\u671f +dod_dod5015.property.dod_publicationDate.decription=\u53d1\u5e03\u65e5\u671f +dod_dod5015.property.dod_originator.title=\u5efa\u7acb\u8005 +dod_dod5015.property.dod_originator.decription=\u5efa\u7acb\u8005 +dod_dod5015.property.dod_originatingOrganization.title=\u8d77\u59cb\u7ec4\u7ec7 +dod_dod5015.property.dod_originatingOrganization.decription=\u8d77\u59cb\u7ec4\u7ec7 +dod_dod5015.property.dod_mediaType.title=\u5a92\u4f53\u7c7b\u578b +dod_dod5015.property.dod_mediaType.decription=\u5a92\u4f53\u7c7b\u578b +dod_dod5015.property.dod_format.title=\u683c\u5f0f +dod_dod5015.property.dod_format.decription=\u683c\u5f0f +dod_dod5015.property.dod_dateReceived.title=\u63a5\u6536\u65e5\u671f +dod_dod5015.property.dod_dateReceived.decription=\u63a5\u6536\u65e5\u671f +dod_dod5015.property.dod_address.title=\u6536\u4ef6\u4eba +dod_dod5015.property.dod_address.decription=\u6536\u4ef6\u4eba +dod_dod5015.property.dod_otherAddress.title=\u5176\u4ed6\u6536\u4ef6\u4eba +dod_dod5015.property.dod_otherAddress.decription=\u5176\u4ed6\u6536\u4ef6\u4eba + +dod_dod5015.aspect.dod_scannedRecord.title=\u626b\u63cf\u7684\u8bb0\u5f55 +dod_dod5015.aspect.dod_scannedRecord.description=\u626b\u63cf\u7684\u8bb0\u5f55 +dod_dod5015.property.dod_scannedFormat.title=\u56fe\u50cf\u683c\u5f0f +dod_dod5015.property.dod_scannedFormat.description=\u56fe\u50cf\u683c\u5f0f +dod_dod5015.property.dod_scannedFormatVersion.title=\u56fe\u50cf\u683c\u5f0f\u548c\u7248\u672c +dod_dod5015.property.dod_scannedFormatVersion.description=\u56fe\u50cf\u683c\u5f0f\u548c\u7248\u672c +dod_dod5015.property.dod_resolutionX.title=\u56fe\u50cf\u5206\u8fa8\u7387 X +dod_dod5015.property.dod_resolutionX.description=\u56fe\u50cf\u5206\u8fa8\u7387 X +dod_dod5015.property.dod_resolutionY.title=\u56fe\u50cf\u5206\u8fa8\u7387 Y +dod_dod5015.property.dod_resolutionY.description=\u56fe\u50cf\u5206\u8fa8\u7387 Y +dod_dod5015.property.dod_scannedBitDepth.title=\u626b\u63cf\u7684\u4f4d\u6df1 +dod_dod5015.property.dod_scannedBitDepth.description=\u626b\u63cf\u7684\u4f4d\u6df1 + +dod_dod5015.aspect.dod_pdfRecord.title=PDF \u8bb0\u5f55 +dod_dod5015.aspect.dod_pdfRecord.description=PDF \u8bb0\u5f55 +dod_dod5015.property.dod_producingApplication.title=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f +dod_dod5015.property.dod_producingApplication.description=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f +dod_dod5015.property.dod_producingApplicationVersion.title=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f\u7248\u672c +dod_dod5015.property.dod_producingApplicationVersion.description=\u751f\u4ea7\u5e94\u7528\u7a0b\u5e8f\u7248\u672c +dod_dod5015.property.dod_pdfVersion.title=PDF \u7248\u672c +dod_dod5015.property.dod_pdfVersion.description=PDF \u7248\u672c +dod_dod5015.property.dod_creatingApplication.title=\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f +dod_dod5015.property.dod_creatingApplication.description=\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f +dod_dod5015.property.dod_documentSecuritySettings.title=\u6587\u6863\u5b89\u5168\u8bbe\u7f6e +dod_dod5015.property.dod_documentSecuritySettings.description=\u6587\u6863\u5b89\u5168\u8bbe\u7f6e + +dod_dod5015.aspect.dod_digitalPhotographRecord.title=\u6570\u7801\u7167\u7247\u8bb0\u5f55 +dod_dod5015.aspect.dod_digitalPhotographRecord.description=\u6570\u7801\u7167\u7247\u8bb0\u5f55 +dod_dod5015.property.dod_caption.title=\u6807\u9898 +dod_dod5015.property.dod_caption.description=\u6807\u9898 +dod_dod5015.property.dod_photographer.title=\u6444\u5f71\u5e08 +dod_dod5015.property.dod_photographer.description=\u6444\u5f71\u5e08 +dod_dod5015.property.dod_copyright.title=\u7248\u6743 +dod_dod5015.property.dod_copyright.description=\u7248\u6743 +dod_dod5015.property.dod_bitDepth.title=\u4f4d\u6df1 +dod_dod5015.property.dod_bitDepth.description=\u4f4d\u6df1 +dod_dod5015.property.dod_imageSizeX.title=\u56fe\u50cf\u5c3a\u5bf8 X +dod_dod5015.property.dod_imageSizeX.description=\u56fe\u50cf\u5c3a\u5bf8 X +dod_dod5015.property.dod_imageSizeY.title=\u56fe\u50cf\u5c3a\u5bf8 Y +dod_dod5015.property.dod_imageSizeY.description=\u56fe\u50cf\u5c3a\u5bf8 Y +dod_dod5015.property.dod_imageSource.title=\u56fe\u50cf\u6e90 +dod_dod5015.property.dod_imageSource.description=\u56fe\u50cf\u6e90 +dod_dod5015.property.dod_compression.title=\u538b\u7f29 +dod_dod5015.property.dod_compression.description=\u538b\u7f29 +dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM \u914d\u7f6e\u6587\u4ef6 +dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM \u914d\u7f6e\u6587\u4ef6 +dod_dod5015.property.dod_exifInformation.title=EXIF \u4fe1\u606f +dod_dod5015.property.dod_exifInformation.description=EXIF \u4fe1\u606f + +dod_dod5015.aspect.dod_webRecord.title=Web \u8bb0\u5f55 +dod_dod5015.aspect.dod_webRecord.description=Web \u8bb0\u5f55 +dod_dod5015.property.dod_webFileName.title=Web \u6587\u4ef6\u540d +dod_dod5015.property.dod_webFileName.description=Web \u6587\u4ef6\u540d +dod_dod5015.property.dod_webPlatform.title=Web \u5e73\u53f0 +dod_dod5015.property.dod_webPlatform.description=Web \u5e73\u53f0 +dod_dod5015.property.dod_webSiteName.title=\u7f51\u7ad9\u540d\u79f0 +dod_dod5015.property.dod_webSiteName.description=\u7f51\u7ad9\u540d\u79f0 +dod_dod5015.property.dod_webSiteURL.title=\u7f51\u7ad9 URL +dod_dod5015.property.dod_webSiteURL.description=\u7f51\u7ad9 URL +dod_dod5015.property.dod_captureMethod.title=\u6355\u6349\u65b9\u6cd5 +dod_dod5015.property.dod_captureMethod.description=\u6355\u6349\u65b9\u6cd5 +dod_dod5015.property.dod_captureDate.title=\u6355\u6349\u65e5\u671f +dod_dod5015.property.dod_captureDate.description=\u6355\u6349\u65e5\u671f +dod_dod5015.property.dod_contact.title=\u8054\u7cfb\u4eba +dod_dod5015.property.dod_contact.description=\u8054\u7cfb\u4eba +dod_dod5015.property.dod_contentManagementSystem.title=\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf +dod_dod5015.property.dod_contentManagementSystem.description=\u5185\u5bb9\u7ba1\u7406\u7cfb\u7edf + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015.properties index ae0fd1111b..23d5952dfc 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Classified Records -capability.UpdateClassificationDates.title=Update Classification Dates -capability.CreateModifyDestroyClassificationGuides.title=Create Modify Destroy Classification Guides -capability.UpgradeDowngradeAndDeclassifyRecords.title=Upgrade Downgrade and Declassify Records -capability.UpdateExemptionCategories.title=Update Exemption Categories -capability.MapClassificationGuideMetadata.title=Map Classification Guide Metadata +# Classified Records Capabilities +capability.group.classifiedRecords.title=Classified Records +capability.UpdateClassificationDates.title=Update Classification Dates +capability.CreateModifyDestroyClassificationGuides.title=Create Modify Destroy Classification Guides +capability.UpgradeDowngradeAndDeclassifyRecords.title=Upgrade Downgrade and Declassify Records +capability.UpdateExemptionCategories.title=Update Exemption Categories +capability.MapClassificationGuideMetadata.title=Map Classification Guide Metadata capability.CreateModifyDestroyTimeframes.title=Create Modify Destroy Time Frames \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_de.properties index 7d3c29ba1d..88de8c3e0e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_de.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Klassifizierte Records -capability.UpdateClassificationDates.title=Klassifizierungsdaten aktualisieren -capability.CreateModifyDestroyClassificationGuides.title=Klassifizierungsleitfaden erstellen/\u00e4ndern/vernichten -capability.UpgradeDowngradeAndDeclassifyRecords.title=Records h\u00f6her-/herunterstufen und ihre Klassifizierung aufheben -capability.UpdateExemptionCategories.title=Ausnahmekategorien aktualisieren -capability.MapClassificationGuideMetadata.title=Metadaten f\u00fcr Klassifizierungsleitfaden zuordnen +# Classified Records Capabilities +capability.group.classifiedRecords.title=Klassifizierte Records +capability.UpdateClassificationDates.title=Klassifizierungsdaten aktualisieren +capability.CreateModifyDestroyClassificationGuides.title=Klassifizierungsleitfaden erstellen/\u00e4ndern/vernichten +capability.UpgradeDowngradeAndDeclassifyRecords.title=Records h\u00f6her-/herunterstufen und ihre Klassifizierung aufheben +capability.UpdateExemptionCategories.title=Ausnahmekategorien aktualisieren +capability.MapClassificationGuideMetadata.title=Metadaten f\u00fcr Klassifizierungsleitfaden zuordnen capability.CreateModifyDestroyTimeframes.title=Zeitrahmen erstellen/\u00e4ndern/vernichten \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_es.properties index d65adbd457..18a13ca2e5 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_es.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Documentos de archivo clasificados -capability.UpdateClassificationDates.title=Actualizar fechas de clasificaci\u00f3n -capability.CreateModifyDestroyClassificationGuides.title=Crear Modificar Destruir gu\u00edas de clasificaci\u00f3n -capability.UpgradeDowngradeAndDeclassifyRecords.title=Actualizar, degradar y desclasificar documentos de archivo -capability.UpdateExemptionCategories.title=Actualizar categor\u00edas de exenci\u00f3n -capability.MapClassificationGuideMetadata.title=Asignar metadatos de gu\u00eda de clasificaci\u00f3n +# Classified Records Capabilities +capability.group.classifiedRecords.title=Documentos de archivo clasificados +capability.UpdateClassificationDates.title=Actualizar fechas de clasificaci\u00f3n +capability.CreateModifyDestroyClassificationGuides.title=Crear Modificar Destruir gu\u00edas de clasificaci\u00f3n +capability.UpgradeDowngradeAndDeclassifyRecords.title=Actualizar, degradar y desclasificar documentos de archivo +capability.UpdateExemptionCategories.title=Actualizar categor\u00edas de exenci\u00f3n +capability.MapClassificationGuideMetadata.title=Asignar metadatos de gu\u00eda de clasificaci\u00f3n capability.CreateModifyDestroyTimeframes.title=Crear Modificar Destruir plazos de tiempo \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_fr.properties index 5bc697184c..c20654908c 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_fr.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Document d'archives class\u00e9s -capability.UpdateClassificationDates.title=Mettre \u00e0 jour les dates de classement -capability.CreateModifyDestroyClassificationGuides.title=Cr\u00e9er Modifier D\u00e9truire des guides de classement -capability.UpgradeDowngradeAndDeclassifyRecords.title=Mettre \u00e0 jour R\u00e9trograder et D\u00e9classer des documents d'archives -capability.UpdateExemptionCategories.title=Mettre \u00e0 jour les cat\u00e9gories d'exemption -capability.MapClassificationGuideMetadata.title=Mapper les m\u00e9tadonn\u00e9es de guides de classement +# Classified Records Capabilities +capability.group.classifiedRecords.title=Document d'archives class\u00e9s +capability.UpdateClassificationDates.title=Mettre \u00e0 jour les dates de classement +capability.CreateModifyDestroyClassificationGuides.title=Cr\u00e9er Modifier D\u00e9truire des guides de classement +capability.UpgradeDowngradeAndDeclassifyRecords.title=Mettre \u00e0 jour R\u00e9trograder et D\u00e9classer des documents d'archives +capability.UpdateExemptionCategories.title=Mettre \u00e0 jour les cat\u00e9gories d'exemption +capability.MapClassificationGuideMetadata.title=Mapper les m\u00e9tadonn\u00e9es de guides de classement capability.CreateModifyDestroyTimeframes.title=Cr\u00e9er Modifier D\u00e9truire des d\u00e9lais \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_it.properties index c098e97e8a..59bfcf86d6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_it.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Record classificati -capability.UpdateClassificationDates.title=Aggiorna date di classificazione -capability.CreateModifyDestroyClassificationGuides.title=Crea Modifica Elimina definitivamente guide di classificazione -capability.UpgradeDowngradeAndDeclassifyRecords.title=Upgrade Downgrade e Declassifica record -capability.UpdateExemptionCategories.title=Aggiorna categorie di esenzione -capability.MapClassificationGuideMetadata.title=Esegui il mapping dei metadati della guida di classificazione +# Classified Records Capabilities +capability.group.classifiedRecords.title=Record classificati +capability.UpdateClassificationDates.title=Aggiorna date di classificazione +capability.CreateModifyDestroyClassificationGuides.title=Crea Modifica Elimina definitivamente guide di classificazione +capability.UpgradeDowngradeAndDeclassifyRecords.title=Upgrade Downgrade e Declassifica record +capability.UpdateExemptionCategories.title=Aggiorna categorie di esenzione +capability.MapClassificationGuideMetadata.title=Esegui il mapping dei metadati della guida di classificazione capability.CreateModifyDestroyTimeframes.title=Crea Modifica Elimina definitivamente intervalli di tempo \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ja.properties index de31d900f5..fdf2104d71 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ja.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=\u5206\u985e\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -capability.UpdateClassificationDates.title=\u5206\u985e\u65e5\u306e\u66f4\u65b0 -capability.CreateModifyDestroyClassificationGuides.title=\u5206\u985e\u30ac\u30a4\u30c9\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.UpgradeDowngradeAndDeclassifyRecords.title=\u30c0\u30a6\u30f3\u30b0\u30ec\u30fc\u30c9\u306e\u66f4\u65b0\u3068\u30ec\u30b3\u30fc\u30c9\u306e\u5206\u985e\u89e3\u9664 -capability.UpdateExemptionCategories.title=\u9664\u5916\u30ab\u30c6\u30b4\u30ea\u306e\u66f4\u65b0 -capability.MapClassificationGuideMetadata.title=\u5206\u985e\u30ac\u30a4\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30c3\u30d4\u30f3\u30b0 +# Classified Records Capabilities +capability.group.classifiedRecords.title=\u5206\u985e\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 +capability.UpdateClassificationDates.title=\u5206\u985e\u65e5\u306e\u66f4\u65b0 +capability.CreateModifyDestroyClassificationGuides.title=\u5206\u985e\u30ac\u30a4\u30c9\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.UpgradeDowngradeAndDeclassifyRecords.title=\u30c0\u30a6\u30f3\u30b0\u30ec\u30fc\u30c9\u306e\u66f4\u65b0\u3068\u30ec\u30b3\u30fc\u30c9\u306e\u5206\u985e\u89e3\u9664 +capability.UpdateExemptionCategories.title=\u9664\u5916\u30ab\u30c6\u30b4\u30ea\u306e\u66f4\u65b0 +capability.MapClassificationGuideMetadata.title=\u5206\u985e\u30ac\u30a4\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30c3\u30d4\u30f3\u30b0 capability.CreateModifyDestroyTimeframes.title=\u30bf\u30a4\u30e0\u30d5\u30ec\u30fc\u30e0\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties index 8afbcbda37..2b2676732c 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Klassifiserte oppf\u00f8ringer -capability.UpdateClassificationDates.title=Oppdater klassifiseringdatoer -capability.CreateModifyDestroyClassificationGuides.title=Opprett Endre Destruer klassifiseringeveiledninger -capability.UpgradeDowngradeAndDeclassifyRecords.title=Oppgrader, last ned og deklassifiser oppf\u00f8ringer -capability.UpdateExemptionCategories.title=Oppdater unntakskategorier -capability.MapClassificationGuideMetadata.title=Koble klassifiseringsveiledning metadata +# Classified Records Capabilities +capability.group.classifiedRecords.title=Klassifiserte oppf\u00f8ringer +capability.UpdateClassificationDates.title=Oppdater klassifiseringdatoer +capability.CreateModifyDestroyClassificationGuides.title=Opprett Endre Destruer klassifiseringeveiledninger +capability.UpgradeDowngradeAndDeclassifyRecords.title=Oppgrader, last ned og deklassifiser oppf\u00f8ringer +capability.UpdateExemptionCategories.title=Oppdater unntakskategorier +capability.MapClassificationGuideMetadata.title=Koble klassifiseringsveiledning metadata capability.CreateModifyDestroyTimeframes.title=Opprett Endre Destruer tidsrammer \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nl.properties index 3933dd2240..92c80ba122 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nl.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Niet geclassificeerde records -capability.UpdateClassificationDates.title=Classificatiedata bijwerken -capability.CreateModifyDestroyClassificationGuides.title=Classificatiegidsen maken aanpassen vernietigen -capability.UpgradeDowngradeAndDeclassifyRecords.title=Records upgraden, downgraden en declassificeren -capability.UpdateExemptionCategories.title=Uitzonderingscategorie\u00ebn bijwerken -capability.MapClassificationGuideMetadata.title=Metagegevens classificatiegids toewijzen +# Classified Records Capabilities +capability.group.classifiedRecords.title=Niet geclassificeerde records +capability.UpdateClassificationDates.title=Classificatiedata bijwerken +capability.CreateModifyDestroyClassificationGuides.title=Classificatiegidsen maken aanpassen vernietigen +capability.UpgradeDowngradeAndDeclassifyRecords.title=Records upgraden, downgraden en declassificeren +capability.UpdateExemptionCategories.title=Uitzonderingscategorie\u00ebn bijwerken +capability.MapClassificationGuideMetadata.title=Metagegevens classificatiegids toewijzen capability.CreateModifyDestroyTimeframes.title=Tijdsperiodes maken aanpassen vernietigen \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_pt_BR.properties index c229ea5a79..7ea8f652e5 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_pt_BR.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Documentos arquiv\u00edsticos classificados -capability.UpdateClassificationDates.title=Atualizar datas de classifica\u00e7\u00e3o -capability.CreateModifyDestroyClassificationGuides.title=Criar Modificar Destruir guias de classifica\u00e7\u00e3o -capability.UpgradeDowngradeAndDeclassifyRecords.title=Atualizar Downgrade e Desclassificar documentos arquiv\u00edsticos -capability.UpdateExemptionCategories.title=Atualizar categorias de isen\u00e7\u00e3o -capability.MapClassificationGuideMetadata.title=Mapear metadados do guia de classifica\u00e7\u00e3o +# Classified Records Capabilities +capability.group.classifiedRecords.title=Documentos arquiv\u00edsticos classificados +capability.UpdateClassificationDates.title=Atualizar datas de classifica\u00e7\u00e3o +capability.CreateModifyDestroyClassificationGuides.title=Criar Modificar Destruir guias de classifica\u00e7\u00e3o +capability.UpgradeDowngradeAndDeclassifyRecords.title=Atualizar Downgrade e Desclassificar documentos arquiv\u00edsticos +capability.UpdateExemptionCategories.title=Atualizar categorias de isen\u00e7\u00e3o +capability.MapClassificationGuideMetadata.title=Mapear metadados do guia de classifica\u00e7\u00e3o capability.CreateModifyDestroyTimeframes.title=Criar Modificar Destruir per\u00edodos de tempo \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ru.properties index 96a2e98583..d369d06dcb 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_ru.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.UpdateClassificationDates.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 -capability.CreateModifyDestroyClassificationGuides.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 -capability.UpgradeDowngradeAndDeclassifyRecords.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c, \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043a \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u043c \u0438 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.UpdateExemptionCategories.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 -capability.MapClassificationGuideMetadata.title=\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 +# Classified Records Capabilities +capability.group.classifiedRecords.title=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +capability.UpdateClassificationDates.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 +capability.CreateModifyDestroyClassificationGuides.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 +capability.UpgradeDowngradeAndDeclassifyRecords.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c, \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043a \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u043c \u0438 \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +capability.UpdateExemptionCategories.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 +capability.MapClassificationGuideMetadata.title=\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 capability.CreateModifyDestroyTimeframes.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_zh_CN.properties index 6c5d96c46a..7a88064b24 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_zh_CN.properties @@ -1,8 +1,8 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=\u5206\u7c7b\u7684\u8bb0\u5f55 -capability.UpdateClassificationDates.title=\u66f4\u65b0\u5206\u7c7b\u65e5\u671f -capability.CreateModifyDestroyClassificationGuides.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5206\u7c7b\u6307\u5357 -capability.UpgradeDowngradeAndDeclassifyRecords.title=\u8bb0\u5f55\u7684\u5347\u7ea7\u3001\u964d\u7ea7\u4ee5\u53ca\u53d6\u6d88\u5206\u7c7b -capability.UpdateExemptionCategories.title=\u66f4\u65b0\u8c41\u514d\u7c7b\u522b -capability.MapClassificationGuideMetadata.title=\u6620\u5c04\u5206\u7c7b\u6307\u5357\u5143\u6570\u636e +# Classified Records Capabilities +capability.group.classifiedRecords.title=\u5206\u7c7b\u7684\u8bb0\u5f55 +capability.UpdateClassificationDates.title=\u66f4\u65b0\u5206\u7c7b\u65e5\u671f +capability.CreateModifyDestroyClassificationGuides.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5206\u7c7b\u6307\u5357 +capability.UpgradeDowngradeAndDeclassifyRecords.title=\u8bb0\u5f55\u7684\u5347\u7ea7\u3001\u964d\u7ea7\u4ee5\u53ca\u53d6\u6d88\u5206\u7c7b +capability.UpdateExemptionCategories.title=\u66f4\u65b0\u8c41\u514d\u7c7b\u522b +capability.MapClassificationGuideMetadata.title=\u6620\u5c04\u5206\u7c7b\u6307\u5357\u5143\u6570\u636e capability.CreateModifyDestroyTimeframes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u65f6\u95f4\u8303\u56f4 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml index 27551507da..ea70bd391d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml @@ -1,265 +1,265 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.repo.security.permissions.impl.ExtendedPermissionService - - - - - - - - - - - - - - - - - - - - - - org.alfresco.service.cmr.security.PermissionService.getOwnerAuthority=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.getAllAuthorities=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.getAllPermission=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.getPermissions=ACL_NODE.0.sys:base.ReadPermissions - org.alfresco.service.cmr.security.PermissionService.getAllSetPermissions=ACL_NODE.0.sys:base.ReadPermissions - org.alfresco.service.cmr.security.PermissionService.getSettablePermissions=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.hasPermission=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.getReaders=ACL_METHOD.ROLE_ADMINISTRATOR - org.alfresco.repo.security.permissions.impl.ExtendedPermissionService.getWriters=ACL_METHOD.ROLE_ADMINISTRATOR - org.alfresco.repo.security.permissions.impl.ExtendedPermissionService.getReadersAndWriters=ACL_METHOD.ROLE_ADMINISTRATOR - org.alfresco.service.cmr.security.PermissionService.deletePermissions=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.deletePermission=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.setPermission=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.setInheritParentPermissions=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.getInheritParentPermissions=ACL_ALLOW - org.alfresco.service.cmr.security.PermissionService.clearPermission=ACL_NODE.0.sys:base.ChangePermissions - org.alfresco.service.cmr.security.PermissionService.*=ACL_DENY - - - - - - - - - - - - - - org.alfresco.writersTransactionalCache - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${rm.autocompletesuggestion.maxsuggestions.node} - - - - - - - - - ${rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes} - - - - - - - ${rm.autocompletesuggestion.maxsuggestions.date} - - - - - - - - - - - - - - - - - - - - - - false - - - - - ${rm.rule.runasadmin} - - - - - - - - - - - org.alfresco.repo.forms.FormService.getForm=ACL_ALLOW - org.alfresco.repo.forms.FormService.saveForm=ACL_ALLOW - org.alfresco.repo.forms.FormService.*=ACL_DENY - - - - - - - search - - - - - - - - - - - - ${spaces.store} - - - - - - true - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.repo.security.permissions.impl.ExtendedPermissionService + + + + + + + + + + + + + + + + + + + + + + org.alfresco.service.cmr.security.PermissionService.getOwnerAuthority=ACL_ALLOW + org.alfresco.service.cmr.security.PermissionService.getAllAuthorities=ACL_ALLOW + org.alfresco.service.cmr.security.PermissionService.getAllPermission=ACL_ALLOW + org.alfresco.service.cmr.security.PermissionService.getPermissions=ACL_NODE.0.sys:base.ReadPermissions + org.alfresco.service.cmr.security.PermissionService.getAllSetPermissions=ACL_NODE.0.sys:base.ReadPermissions + org.alfresco.service.cmr.security.PermissionService.getSettablePermissions=ACL_ALLOW + org.alfresco.service.cmr.security.PermissionService.hasPermission=ACL_ALLOW + org.alfresco.service.cmr.security.PermissionService.getReaders=ACL_METHOD.ROLE_ADMINISTRATOR + org.alfresco.repo.security.permissions.impl.ExtendedPermissionService.getWriters=ACL_METHOD.ROLE_ADMINISTRATOR + org.alfresco.repo.security.permissions.impl.ExtendedPermissionService.getReadersAndWriters=ACL_METHOD.ROLE_ADMINISTRATOR + org.alfresco.service.cmr.security.PermissionService.deletePermissions=ACL_NODE.0.sys:base.ChangePermissions + org.alfresco.service.cmr.security.PermissionService.deletePermission=ACL_NODE.0.sys:base.ChangePermissions + org.alfresco.service.cmr.security.PermissionService.setPermission=ACL_NODE.0.sys:base.ChangePermissions + org.alfresco.service.cmr.security.PermissionService.setInheritParentPermissions=ACL_NODE.0.sys:base.ChangePermissions + org.alfresco.service.cmr.security.PermissionService.getInheritParentPermissions=ACL_ALLOW + org.alfresco.service.cmr.security.PermissionService.clearPermission=ACL_NODE.0.sys:base.ChangePermissions + org.alfresco.service.cmr.security.PermissionService.*=ACL_DENY + + + + + + + + + + + + + + org.alfresco.writersTransactionalCache + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${rm.autocompletesuggestion.maxsuggestions.node} + + + + + + + + + ${rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes} + + + + + + + ${rm.autocompletesuggestion.maxsuggestions.date} + + + + + + + + + + + + + + + + + + + + + + false + + + + + ${rm.rule.runasadmin} + + + + + + + + + + + org.alfresco.repo.forms.FormService.getForm=ACL_ALLOW + org.alfresco.repo.forms.FormService.saveForm=ACL_ALLOW + org.alfresco.repo.forms.FormService.*=ACL_DENY + + + + + + + search + + + + + + + + + + + + ${spaces.store} + + + + + + true + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties index 83e724394e..dbdb7913fc 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/log4j.properties @@ -1,59 +1,59 @@ -# -# Warnings -# -log4j.logger.org.alfresco.module.org_alfresco_module_rm.caveat=warn -log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityPostProcessor=warn - -# -# Module patches -# -log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info - -# -# Set to 'debug' to see details of capability failures when AccessDenied is thrown. May be -# removed to enhance performance. -# -log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor=debug - -# -# RM permission debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.RMEntryVoter=debug -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.RMAfterInvocationProvider=debug -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.declarative=debug - -# -# RM Audit service debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService=debug - -# -# Job debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug - -# -# Script logging level -# -log4j.logger.org.alfresco.repo.jscript.ScriptLogger=error - -# -# Behaviour debug -# -log4j.logger.org.alfresco.repo.policy.annotation.AnnotatedBehaviourPostProcessor=info -log4j.logger.org.alfresco.module.org_alfresco_module_rm.behaviour.BaseBehaviourBean=info - -# -# Patch debug -# -log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info -# -# RM Audit service debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService=debug - -# -# Job debug -# -#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug +# +# Warnings +# +log4j.logger.org.alfresco.module.org_alfresco_module_rm.caveat=warn +log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityPostProcessor=warn + +# +# Module patches +# +log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info + +# +# Set to 'debug' to see details of capability failures when AccessDenied is thrown. May be +# removed to enhance performance. +# +log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor=debug + +# +# RM permission debug +# +#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.RMEntryVoter=debug +#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.RMAfterInvocationProvider=debug +#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.declarative=debug + +# +# RM Audit service debug +# +#log4j.logger.org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService=debug + +# +# Job debug +# +#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug + +# +# Script logging level +# +log4j.logger.org.alfresco.repo.jscript.ScriptLogger=error + +# +# Behaviour debug +# +log4j.logger.org.alfresco.repo.policy.annotation.AnnotatedBehaviourPostProcessor=info +log4j.logger.org.alfresco.module.org_alfresco_module_rm.behaviour.BaseBehaviourBean=info + +# +# Patch debug +# +log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=info +# +# RM Audit service debug +# +#log4j.logger.org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService=debug + +# +# Job debug +# +#log4j.logger.org.alfresco.module.org_alfresco_module_rm.job=debug log4j.logger.org.alfresco.repo.web.scripts.roles.DynamicAuthoritiesGet=info \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties index d18b73b95a..2c89111f41 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=The records management action {0} hasn't been defined. -rm.action.no-implicit-noderef=There was a system error so the action {0} might not be successful. -rm.action.record-not-declared=The retention action {0} couldn't be performed, because the record {1} isn't complete. -rm.action.expected-record-level=The retention action {0} couldn't be performed, because {1} isn't a record. -rm.action.not-all-records-declared=The retention action {0} couldn't be performed, because not all the records in the record folder are complete. (actionedUponNodeRef={1}) -rm.action.not-eligible=The record or record folder {1} isn't yet ready for retention action {0}. -rm.action.no-disposition-instructions=The retention action {0} couldn't be performed, because no retention instructions could be found. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=The retention action {0} couldn't be performed, because there's no available retention life-cycle set. (nodeRef={1}) -rm.action.next-disp-not-set=The retention action {0} couldn't be performed, because the next retention action isn't set. (nodeRef={1}) -rm.action.not-next-disp=The retention action {0} couldn't be performed, because this isn't the next retention action for this record or record folder. (nodeRef={1}) -rm.action.not-record-folder=The retention action {0} couldn't be performed, because {1} isn't a record folder. -rm.action.actioned-upon-not-record=The action {0} can't be performed because {1} isn't a record. -rm.action.custom-aspect-not-recognised=The custom type can't be applied because it's not recognised. (customAspect={0}) -rm.action.event-no-disp-lc=The event {0} can't be completed because it's not defined on the retention lifecycle. -rm.action.undeclared-only-records=Only records can be completed. (nodeRef={0}) -rm.action.no-declare-mand-prop=You need to set all the record's mandatory properties before you can complete the record. -rm.action.ghosted-prop-update=You can't update the properties of a previously destroyed record. -rm.action.valid-date-disp-asof=Enter a valid date for the retention action as of date. -rm.action.disp-asof-lifecycle-applied=You can't edit the retention as of date for a record or record folder which has a lifecycle applied. -rm.action.hold-edit-reason-none=You can't edit the hold reason because the hold was created without a reason. Try recreating the hold. -rm.action.hold-edit-type=You can't edit the hold reason for {1} because it isn't a hold. -rm.action.specify-avlid-date=Enter a valid date for the review as of date. -rm.action.review-details-only=You can only edit the review details of vital records. -rm.action.freeze-no-reason=You can't hold a record without a reason. Add a reason to the hold. -rm.action.freeze-only-records-folders=You can only hold records or record folders. -rm.action.no-open-record-folder=You can't reopen {0} because it's not a record folder. -rm.action.not-hold-type=You can't carry out the action on {1} because it isn't a hold. -rm.action.no-read-mime-message=The filetype message couldn't be read because {0}. -rm.action.email-declared=We couldn't split the email because the record is complete. (actionedUponNodeRef={0}) -rm.action.email-not-record=We couldn't split the email because the file, folder, or category isn't a record. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=We couldn't create a custom child association. -rm.action.node-already-transfer=The file, folder, or category is already being transferred. -rm.action.node-not-transfer=The file, folder, or category isn't a transfer object. -rm.action.undo-not-last=You can't undo the cut off because the last retention action wasn't cut off. -rm.action.records_only_undeclared=You can only complete records. -rm.action.event-not-undone=You can't undo the event {0} because it's not defined on the retention lifecycle. -rm.action.node-not-record-category=You can't create a retention schedule for ({0}) because it's not a record category. -rm.action.parameter-not-supplied=Add a ''{0}'' to continue. -rm.action.delete-not-hold-type=We couldn't delete the hold because {1} isn't of type {0}. -rm.action.cast-to-rm-type=You can't upload a custom folder type to the records management file plan. -rm.action.record-folder-create=You can't create a record folder in another record folder. - +rm.action.not-defined=The records management action {0} hasn't been defined. +rm.action.no-implicit-noderef=There was a system error so the action {0} might not be successful. +rm.action.record-not-declared=The retention action {0} couldn't be performed, because the record {1} isn't complete. +rm.action.expected-record-level=The retention action {0} couldn't be performed, because {1} isn't a record. +rm.action.not-all-records-declared=The retention action {0} couldn't be performed, because not all the records in the record folder are complete. (actionedUponNodeRef={1}) +rm.action.not-eligible=The record or record folder {1} isn't yet ready for retention action {0}. +rm.action.no-disposition-instructions=The retention action {0} couldn't be performed, because no retention instructions could be found. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=The retention action {0} couldn't be performed, because there's no available retention life-cycle set. (nodeRef={1}) +rm.action.next-disp-not-set=The retention action {0} couldn't be performed, because the next retention action isn't set. (nodeRef={1}) +rm.action.not-next-disp=The retention action {0} couldn't be performed, because this isn't the next retention action for this record or record folder. (nodeRef={1}) +rm.action.not-record-folder=The retention action {0} couldn't be performed, because {1} isn't a record folder. +rm.action.actioned-upon-not-record=The action {0} can't be performed because {1} isn't a record. +rm.action.custom-aspect-not-recognised=The custom type can't be applied because it's not recognised. (customAspect={0}) +rm.action.event-no-disp-lc=The event {0} can't be completed because it's not defined on the retention lifecycle. +rm.action.undeclared-only-records=Only records can be completed. (nodeRef={0}) +rm.action.no-declare-mand-prop=You need to set all the record's mandatory properties before you can complete the record. +rm.action.ghosted-prop-update=You can't update the properties of a previously destroyed record. +rm.action.valid-date-disp-asof=Enter a valid date for the retention action as of date. +rm.action.disp-asof-lifecycle-applied=You can't edit the retention as of date for a record or record folder which has a lifecycle applied. +rm.action.hold-edit-reason-none=You can't edit the hold reason because the hold was created without a reason. Try recreating the hold. +rm.action.hold-edit-type=You can't edit the hold reason for {1} because it isn't a hold. +rm.action.specify-avlid-date=Enter a valid date for the review as of date. +rm.action.review-details-only=You can only edit the review details of vital records. +rm.action.freeze-no-reason=You can't hold a record without a reason. Add a reason to the hold. +rm.action.freeze-only-records-folders=You can only hold records or record folders. +rm.action.no-open-record-folder=You can't reopen {0} because it's not a record folder. +rm.action.not-hold-type=You can't carry out the action on {1} because it isn't a hold. +rm.action.no-read-mime-message=The filetype message couldn't be read because {0}. +rm.action.email-declared=We couldn't split the email because the record is complete. (actionedUponNodeRef={0}) +rm.action.email-not-record=We couldn't split the email because the file, folder, or category isn't a record. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=We couldn't create a custom child association. +rm.action.node-already-transfer=The file, folder, or category is already being transferred. +rm.action.node-not-transfer=The file, folder, or category isn't a transfer object. +rm.action.undo-not-last=You can't undo the cut off because the last retention action wasn't cut off. +rm.action.records_only_undeclared=You can only complete records. +rm.action.event-not-undone=You can't undo the event {0} because it's not defined on the retention lifecycle. +rm.action.node-not-record-category=You can't create a retention schedule for ({0}) because it's not a record category. +rm.action.parameter-not-supplied=Add a ''{0}'' to continue. +rm.action.delete-not-hold-type=We couldn't delete the hold because {1} isn't of type {0}. +rm.action.cast-to-rm-type=You can't upload a custom folder type to the records management file plan. +rm.action.record-folder-create=You can't create a record folder in another record folder. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_de.properties index 8b3e0607ca..375adf65c2 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_de.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=Die Records Management Aktion {0} wurde nicht definiert. -rm.action.no-implicit-noderef=Es ist ein Systemfehler aufgetreten, sodass die Aktion {0} m\u00f6glicherweise nicht erfolgreich sein wird. -rm.action.record-not-declared=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da der Record {1} unvollst\u00e4ndig ist. -rm.action.expected-record-level=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da {1} kein Record ist. -rm.action.not-all-records-declared=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da nicht alle Records im Record-Ordner abgeschlossen sind. (actionedUponNodeRef={1}) -rm.action.not-eligible=Record oder Record-Ordner {1} ist noch nicht bereit f\u00fcr die Aufbewahrungsaktion {0}. -rm.action.no-disposition-instructions=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da keine Aufbewahrungsanweisungen gefunden wurden. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da kein verf\u00fcgbarer Aufbewahrungszyklus festgelegt wurde. (nodeRef={1}) -rm.action.next-disp-not-set=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da keine n\u00e4chste Aufbewahrungsaktion festgelegt wurde. (nodeRef={1}) -rm.action.not-next-disp=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da es sich hierbei nicht um die n\u00e4chste Aufbewahrungsaktion f\u00fcr den Record bzw. den Record-Ordner handelt. (nodeRef={1}) -rm.action.not-record-folder=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da {1} kein Record-Ordner ist. -rm.action.actioned-upon-not-record=Die Aktion {0} kann nicht durchgef\u00fchrt werden, da {1} kein Record ist. -rm.action.custom-aspect-not-recognised=Der benutzerdefinierte Typ kann nicht angewendet werden, da er nicht erkannt wird. (customAspect={0}) -rm.action.event-no-disp-lc=Das Ereignis {0} kann nicht abgeschlossen werden, da es nicht im Aufbewahrungszyklus definiert ist. -rm.action.undeclared-only-records=Nur Records k\u00f6nnen abgeschlossen werden. (nodeRef={0}) -rm.action.no-declare-mand-prop=Um den Record abzuschlie\u00dfen, m\u00fcssen Sie alle erforderlichen Eigenschaften des Record festlegen. -rm.action.ghosted-prop-update=Die Eigenschaften eines zuvor vernichteten Record k\u00f6nnen nicht aktualisiert werden. -rm.action.valid-date-disp-asof=Geben Sie ein zul\u00e4ssiges Datum als Startdatum der Aufbewahrungsaktion ein. -rm.action.disp-asof-lifecycle-applied=Sie k\u00f6nnen das Startdatum der Aufbewahrung f\u00fcr einen Record oder Record-Ordner mit festgelegtem Aufbewahrungszyklus nicht bearbeiten. -rm.action.hold-edit-reason-none=Der Sperrgrund kann nicht bearbeitet werden, da die Sperre ohne Grund erstellt wurde. Versuchen Sie, die Sperre erneut zu erstellen. -rm.action.hold-edit-type=Sie k\u00f6nnen den Sperrgrund f\u00fcr {1} nicht bearbeiten, da es sich nicht um eine Sperre handelt. -rm.action.specify-avlid-date=Geben Sie ein zul\u00e4ssiges Datum als Startdatum der \u00dcberpr\u00fcfung ein. -rm.action.review-details-only=Sie k\u00f6nnen nur die \u00dcberpr\u00fcfungsdetails besonders relevanter Records bearbeiten. -rm.action.freeze-no-reason=Ein Record kann nicht ohne Grund gesperrt werden. F\u00fcgen Sie einen Sperrgrund hinzu. -rm.action.freeze-only-records-folders=Sie k\u00f6nnen nur Records oder Record-Ordner sperren. -rm.action.no-open-record-folder=Sie k\u00f6nnen {0} nicht erneut \u00f6ffnen, da es sich nicht um einen Record-Ordner handelt. -rm.action.not-hold-type=Die Aktion kann nicht f\u00fcr {1} durchgef\u00fchrt werden, weil es sich nicht um eine Sperre handelt. -rm.action.no-read-mime-message=Die Dateityp-Nachricht konnte nicht gelesen werden, da {0}. -rm.action.email-declared=Die E-Mail konnte nicht geteilt werden, da der Record abgeschlossen ist. (actionedUponNodeRef={0}) -rm.action.email-not-record=Die E-Mail konnte nicht geteilt werden, da die Datei, der Ordner bzw. die Kategorie kein Record ist. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Benutzerdefinierte Kindzuordnung konnte nicht erstellt werden. -rm.action.node-already-transfer=Datei, Ordner oder Kategorie wird bereits \u00fcbertragen. -rm.action.node-not-transfer=Datei, Ordner oder Kategorie ist kein \u00dcbertragungsobjekt. -rm.action.undo-not-last=Trennung kann nicht aufgehoben werden, da die letzte Aufbewahrungsaktion nicht getrennt wurde. -rm.action.records_only_undeclared=Es k\u00f6nnen nur Records abgeschlossen werden. -rm.action.event-not-undone=Sie k\u00f6nnen das Ereignis {0} nicht r\u00fcckg\u00e4ngig machen, da es nicht im Aufbewahrungszyklus definiert ist. -rm.action.node-not-record-category=Sie k\u00f6nnen keinen Aufbewahrungsplan f\u00fcr ({0}) erstellen, da es sich nicht um eine Record-Kategorie handelt. -rm.action.parameter-not-supplied=F\u00fcgen Sie ''{0}'' hinzu, um fortzufahren. -rm.action.delete-not-hold-type=Die Sperre konnte nicht gel\u00f6scht werden, da {1} nicht vom Typ {0} ist. -rm.action.cast-to-rm-type=Ein benutzerdefinierter Ordnertyp kann nicht in einen Records Management Ablageplan hochgeladen werden. -rm.action.record-folder-create=Ein Record-Ordner kann nicht in einem anderen Record-Ordner erstellt werden. - +rm.action.not-defined=Die Records Management Aktion {0} wurde nicht definiert. +rm.action.no-implicit-noderef=Es ist ein Systemfehler aufgetreten, sodass die Aktion {0} m\u00f6glicherweise nicht erfolgreich sein wird. +rm.action.record-not-declared=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da der Record {1} unvollst\u00e4ndig ist. +rm.action.expected-record-level=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da {1} kein Record ist. +rm.action.not-all-records-declared=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da nicht alle Records im Record-Ordner abgeschlossen sind. (actionedUponNodeRef={1}) +rm.action.not-eligible=Record oder Record-Ordner {1} ist noch nicht bereit f\u00fcr die Aufbewahrungsaktion {0}. +rm.action.no-disposition-instructions=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da keine Aufbewahrungsanweisungen gefunden wurden. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da kein verf\u00fcgbarer Aufbewahrungszyklus festgelegt wurde. (nodeRef={1}) +rm.action.next-disp-not-set=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da keine n\u00e4chste Aufbewahrungsaktion festgelegt wurde. (nodeRef={1}) +rm.action.not-next-disp=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da es sich hierbei nicht um die n\u00e4chste Aufbewahrungsaktion f\u00fcr den Record bzw. den Record-Ordner handelt. (nodeRef={1}) +rm.action.not-record-folder=Die Aufbewahrungsaktion {0} konnte nicht durchgef\u00fchrt werden, da {1} kein Record-Ordner ist. +rm.action.actioned-upon-not-record=Die Aktion {0} kann nicht durchgef\u00fchrt werden, da {1} kein Record ist. +rm.action.custom-aspect-not-recognised=Der benutzerdefinierte Typ kann nicht angewendet werden, da er nicht erkannt wird. (customAspect={0}) +rm.action.event-no-disp-lc=Das Ereignis {0} kann nicht abgeschlossen werden, da es nicht im Aufbewahrungszyklus definiert ist. +rm.action.undeclared-only-records=Nur Records k\u00f6nnen abgeschlossen werden. (nodeRef={0}) +rm.action.no-declare-mand-prop=Um den Record abzuschlie\u00dfen, m\u00fcssen Sie alle erforderlichen Eigenschaften des Record festlegen. +rm.action.ghosted-prop-update=Die Eigenschaften eines zuvor vernichteten Record k\u00f6nnen nicht aktualisiert werden. +rm.action.valid-date-disp-asof=Geben Sie ein zul\u00e4ssiges Datum als Startdatum der Aufbewahrungsaktion ein. +rm.action.disp-asof-lifecycle-applied=Sie k\u00f6nnen das Startdatum der Aufbewahrung f\u00fcr einen Record oder Record-Ordner mit festgelegtem Aufbewahrungszyklus nicht bearbeiten. +rm.action.hold-edit-reason-none=Der Sperrgrund kann nicht bearbeitet werden, da die Sperre ohne Grund erstellt wurde. Versuchen Sie, die Sperre erneut zu erstellen. +rm.action.hold-edit-type=Sie k\u00f6nnen den Sperrgrund f\u00fcr {1} nicht bearbeiten, da es sich nicht um eine Sperre handelt. +rm.action.specify-avlid-date=Geben Sie ein zul\u00e4ssiges Datum als Startdatum der \u00dcberpr\u00fcfung ein. +rm.action.review-details-only=Sie k\u00f6nnen nur die \u00dcberpr\u00fcfungsdetails besonders relevanter Records bearbeiten. +rm.action.freeze-no-reason=Ein Record kann nicht ohne Grund gesperrt werden. F\u00fcgen Sie einen Sperrgrund hinzu. +rm.action.freeze-only-records-folders=Sie k\u00f6nnen nur Records oder Record-Ordner sperren. +rm.action.no-open-record-folder=Sie k\u00f6nnen {0} nicht erneut \u00f6ffnen, da es sich nicht um einen Record-Ordner handelt. +rm.action.not-hold-type=Die Aktion kann nicht f\u00fcr {1} durchgef\u00fchrt werden, weil es sich nicht um eine Sperre handelt. +rm.action.no-read-mime-message=Die Dateityp-Nachricht konnte nicht gelesen werden, da {0}. +rm.action.email-declared=Die E-Mail konnte nicht geteilt werden, da der Record abgeschlossen ist. (actionedUponNodeRef={0}) +rm.action.email-not-record=Die E-Mail konnte nicht geteilt werden, da die Datei, der Ordner bzw. die Kategorie kein Record ist. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=Benutzerdefinierte Kindzuordnung konnte nicht erstellt werden. +rm.action.node-already-transfer=Datei, Ordner oder Kategorie wird bereits \u00fcbertragen. +rm.action.node-not-transfer=Datei, Ordner oder Kategorie ist kein \u00dcbertragungsobjekt. +rm.action.undo-not-last=Trennung kann nicht aufgehoben werden, da die letzte Aufbewahrungsaktion nicht getrennt wurde. +rm.action.records_only_undeclared=Es k\u00f6nnen nur Records abgeschlossen werden. +rm.action.event-not-undone=Sie k\u00f6nnen das Ereignis {0} nicht r\u00fcckg\u00e4ngig machen, da es nicht im Aufbewahrungszyklus definiert ist. +rm.action.node-not-record-category=Sie k\u00f6nnen keinen Aufbewahrungsplan f\u00fcr ({0}) erstellen, da es sich nicht um eine Record-Kategorie handelt. +rm.action.parameter-not-supplied=F\u00fcgen Sie ''{0}'' hinzu, um fortzufahren. +rm.action.delete-not-hold-type=Die Sperre konnte nicht gel\u00f6scht werden, da {1} nicht vom Typ {0} ist. +rm.action.cast-to-rm-type=Ein benutzerdefinierter Ordnertyp kann nicht in einen Records Management Ablageplan hochgeladen werden. +rm.action.record-folder-create=Ein Record-Ordner kann nicht in einem anderen Record-Ordner erstellt werden. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_es.properties index 07a2febbd3..b24be31b4a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_es.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=No se ha definido la acci\u00f3n de Records Management ''{0}''. -rm.action.no-implicit-noderef=Se produjo un error en el sistema por lo que la acci\u00f3n ''{0}'' puede no ser correcta. -rm.action.record-not-declared=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque el documento de archivo ''{1}'' no est\u00e1 completo. -rm.action.expected-record-level=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque ''{1}'' no es un documento de archivo. -rm.action.not-all-records-declared=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque no todos los documentos de archivo de la carpeta de documentos de archivo est\u00e1n completos. (actionedUponNodeRef={1}) -rm.action.not-eligible=El documento de archivo o carpeta de documentos de archivo ''{1}'' no est\u00e1 preparada todav\u00eda para la acci\u00f3n de retenci\u00f3n ''{0}''. -rm.action.no-disposition-instructions=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque no se ha encontrado ninguna instrucci\u00f3n de retenci\u00f3n. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque no hay ning\u00fan ciclo de vida de retenci\u00f3n disponible. (nodeRef={1}) -rm.action.next-disp-not-set=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque la pr\u00f3xima acci\u00f3n de retenci\u00f3n no est\u00e1 definida. (nodeRef={1}) -rm.action.not-next-disp=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque no es la pr\u00f3xima acci\u00f3n de retenci\u00f3n para este documento de archivo o carpeta de documentos de archivo. (nodeRef={1}) -rm.action.not-record-folder=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque ''{1}'' no es una carpeta de documentos de archivo. -rm.action.actioned-upon-not-record=No se puede realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque ''{1}'' no es un documento de archivo. -rm.action.custom-aspect-not-recognised=El tipo personalizado no puede aplicarse porque no se reconoce. (customAspect={0}) -rm.action.event-no-disp-lc=No se puede completar el evento ''{0}'' porque no est\u00e1 definido en el ciclo de vida de la retenci\u00f3n. -rm.action.undeclared-only-records=Solo se pueden completar los documentos de archivo. (nodeRef={0}) -rm.action.no-declare-mand-prop=Debe definir todas las propiedades obligatorias del documento de archivo antes de poder completar el documento de archivo. -rm.action.ghosted-prop-update=No puede actualizar las propiedades de un documento de archivo destruido anteriormente. -rm.action.valid-date-disp-asof=Introduzca una fecha v\u00e1lida para la fecha de inicio de acci\u00f3n de la retenci\u00f3n. -rm.action.disp-asof-lifecycle-applied=No puede editar la fecha de inicio de la retenci\u00f3n para un documento de archivo o carpeta de documentos de archivo que tiene un ciclo de vida aplicado. -rm.action.hold-edit-reason-none=No puede editar la raz\u00f3n de bloqueo porque el bloqueo se cre\u00f3 sin una raz\u00f3n. Trate de recrear el bloqueo. -rm.action.hold-edit-type=No puede editar la raz\u00f3n de bloqueo ''{1}'' porque no es un bloqueo. -rm.action.specify-avlid-date=Introduzca una fecha v\u00e1lida para la fecha de inicio de la revisi\u00f3n. -rm.action.review-details-only=Solo puede editar los detalles de revisi\u00f3n de documentos de archivo vitales. -rm.action.freeze-no-reason=No puede bloquear un documento de archivo sin una raz\u00f3n. A\u00f1ada una raz\u00f3n al bloqueo. -rm.action.freeze-only-records-folders=Solo puede bloquear documentos de archivo o carpetas de documentos de archivo. -rm.action.no-open-record-folder=No puede volver a abrir ''{0}'' porque no es una carpeta de documentos de archivo. -rm.action.not-hold-type=No puede llevar a cabo la acci\u00f3n en ''{1}'' porque no es un bloqueo. -rm.action.no-read-mime-message=No se pudo leer el mensaje de tipo de fichero debido a ''{0}''. -rm.action.email-declared=No se pudo separar el correo electr\u00f3nico porque el documento de archivo est\u00e1 completo. (actionedUponNodeRef={0}) -rm.action.email-not-record=No se pudo separar el correo electr\u00f3nico porque el fichero, ni la carpeta ni la categor\u00eda son un documento de archivo. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=No se puedo crear una asociaci\u00f3n secundaria personalizada. -rm.action.node-already-transfer=El fichero, carpeta o categor\u00eda ya se est\u00e1 trasfiriendo. -rm.action.node-not-transfer=El fichero, carpeta o categor\u00eda no es un objeto de transferencia. -rm.action.undo-not-last=No puede deshacer la interrupci\u00f3n porque la \u00faltima acci\u00f3n de retenci\u00f3n no se interrumpi\u00f3. -rm.action.records_only_undeclared=Solo puede completar documentos de archivo. -rm.action.event-not-undone=No puede deshacer el evento ''{0}'' porque no se ha definido en el ciclo de vida de retenci\u00f3n. -rm.action.node-not-record-category=No puede crear una planificaci\u00f3n de retenci\u00f3n para (''{0}'') porque no es una categor\u00eda de documento de archivo. -rm.action.parameter-not-supplied=A\u00f1ada un ''{0}'' para continuar. -rm.action.delete-not-hold-type=No se pudo eliminar el bloqueo porque ''{1}'' no es del tipo ''{0}''. -rm.action.cast-to-rm-type=No puede cargar un tipo de carpeta personalizada al plan de ficheros de Records Management. -rm.action.record-folder-create=No puede crear una carpeta de documentos de archivo en otra carpeta de documentos de archivo. - +rm.action.not-defined=No se ha definido la acci\u00f3n de Records Management ''{0}''. +rm.action.no-implicit-noderef=Se produjo un error en el sistema por lo que la acci\u00f3n ''{0}'' puede no ser correcta. +rm.action.record-not-declared=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque el documento de archivo ''{1}'' no est\u00e1 completo. +rm.action.expected-record-level=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque ''{1}'' no es un documento de archivo. +rm.action.not-all-records-declared=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque no todos los documentos de archivo de la carpeta de documentos de archivo est\u00e1n completos. (actionedUponNodeRef={1}) +rm.action.not-eligible=El documento de archivo o carpeta de documentos de archivo ''{1}'' no est\u00e1 preparada todav\u00eda para la acci\u00f3n de retenci\u00f3n ''{0}''. +rm.action.no-disposition-instructions=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque no se ha encontrado ninguna instrucci\u00f3n de retenci\u00f3n. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque no hay ning\u00fan ciclo de vida de retenci\u00f3n disponible. (nodeRef={1}) +rm.action.next-disp-not-set=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque la pr\u00f3xima acci\u00f3n de retenci\u00f3n no est\u00e1 definida. (nodeRef={1}) +rm.action.not-next-disp=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque no es la pr\u00f3xima acci\u00f3n de retenci\u00f3n para este documento de archivo o carpeta de documentos de archivo. (nodeRef={1}) +rm.action.not-record-folder=No se pudo realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque ''{1}'' no es una carpeta de documentos de archivo. +rm.action.actioned-upon-not-record=No se puede realizar la acci\u00f3n de retenci\u00f3n ''{0}'' porque ''{1}'' no es un documento de archivo. +rm.action.custom-aspect-not-recognised=El tipo personalizado no puede aplicarse porque no se reconoce. (customAspect={0}) +rm.action.event-no-disp-lc=No se puede completar el evento ''{0}'' porque no est\u00e1 definido en el ciclo de vida de la retenci\u00f3n. +rm.action.undeclared-only-records=Solo se pueden completar los documentos de archivo. (nodeRef={0}) +rm.action.no-declare-mand-prop=Debe definir todas las propiedades obligatorias del documento de archivo antes de poder completar el documento de archivo. +rm.action.ghosted-prop-update=No puede actualizar las propiedades de un documento de archivo destruido anteriormente. +rm.action.valid-date-disp-asof=Introduzca una fecha v\u00e1lida para la fecha de inicio de acci\u00f3n de la retenci\u00f3n. +rm.action.disp-asof-lifecycle-applied=No puede editar la fecha de inicio de la retenci\u00f3n para un documento de archivo o carpeta de documentos de archivo que tiene un ciclo de vida aplicado. +rm.action.hold-edit-reason-none=No puede editar la raz\u00f3n de bloqueo porque el bloqueo se cre\u00f3 sin una raz\u00f3n. Trate de recrear el bloqueo. +rm.action.hold-edit-type=No puede editar la raz\u00f3n de bloqueo ''{1}'' porque no es un bloqueo. +rm.action.specify-avlid-date=Introduzca una fecha v\u00e1lida para la fecha de inicio de la revisi\u00f3n. +rm.action.review-details-only=Solo puede editar los detalles de revisi\u00f3n de documentos de archivo vitales. +rm.action.freeze-no-reason=No puede bloquear un documento de archivo sin una raz\u00f3n. A\u00f1ada una raz\u00f3n al bloqueo. +rm.action.freeze-only-records-folders=Solo puede bloquear documentos de archivo o carpetas de documentos de archivo. +rm.action.no-open-record-folder=No puede volver a abrir ''{0}'' porque no es una carpeta de documentos de archivo. +rm.action.not-hold-type=No puede llevar a cabo la acci\u00f3n en ''{1}'' porque no es un bloqueo. +rm.action.no-read-mime-message=No se pudo leer el mensaje de tipo de fichero debido a ''{0}''. +rm.action.email-declared=No se pudo separar el correo electr\u00f3nico porque el documento de archivo est\u00e1 completo. (actionedUponNodeRef={0}) +rm.action.email-not-record=No se pudo separar el correo electr\u00f3nico porque el fichero, ni la carpeta ni la categor\u00eda son un documento de archivo. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=No se puedo crear una asociaci\u00f3n secundaria personalizada. +rm.action.node-already-transfer=El fichero, carpeta o categor\u00eda ya se est\u00e1 trasfiriendo. +rm.action.node-not-transfer=El fichero, carpeta o categor\u00eda no es un objeto de transferencia. +rm.action.undo-not-last=No puede deshacer la interrupci\u00f3n porque la \u00faltima acci\u00f3n de retenci\u00f3n no se interrumpi\u00f3. +rm.action.records_only_undeclared=Solo puede completar documentos de archivo. +rm.action.event-not-undone=No puede deshacer el evento ''{0}'' porque no se ha definido en el ciclo de vida de retenci\u00f3n. +rm.action.node-not-record-category=No puede crear una planificaci\u00f3n de retenci\u00f3n para (''{0}'') porque no es una categor\u00eda de documento de archivo. +rm.action.parameter-not-supplied=A\u00f1ada un ''{0}'' para continuar. +rm.action.delete-not-hold-type=No se pudo eliminar el bloqueo porque ''{1}'' no es del tipo ''{0}''. +rm.action.cast-to-rm-type=No puede cargar un tipo de carpeta personalizada al plan de ficheros de Records Management. +rm.action.record-folder-create=No puede crear una carpeta de documentos de archivo en otra carpeta de documentos de archivo. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_fr.properties index 013ff52619..464ff32942 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_fr.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=L''action de gestion des archives {0} n''a pas \u00e9t\u00e9 d\u00e9finie. -rm.action.no-implicit-noderef=Suite \u00e0 une erreur syst\u00e8me, \u00e9chec de l''action {0} possible. -rm.action.record-not-declared=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car le document d''archives {1} n''est pas complet. -rm.action.expected-record-level=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un document d''archives. -rm.action.not-all-records-declared=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car les documents d''archives dans le dossier d''archives ne sont pas tous complets. (actionedUponNodeRef={1}) -rm.action.not-eligible=Le document d''archives ou dossier d''archives {1} n''est pas encore pr\u00eat pour l''action de r\u00e9tention {0}. -rm.action.no-disposition-instructions=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car aucune instruction de r\u00e9tention n''a \u00e9t\u00e9 trouv\u00e9e. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car aucun ensemble de cycles de vie de r\u00e9tention n''est disponible. (nodeRef={1}) -rm.action.next-disp-not-set=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car l''\u00e9tape suivante du d\u00e9lai de r\u00e9tention n''est pas d\u00e9finie. (nodeRef={1}) -rm.action.not-next-disp=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car il ne s''agit pas de l''\u00e9tape suivante du d\u00e9lai de r\u00e9tention pour ce document d''archives ou ce dossier d''archives. (nodeRef={1}) -rm.action.not-record-folder=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un dossier d''archives. -rm.action.actioned-upon-not-record=L''action {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un document d''archives. -rm.action.custom-aspect-not-recognised=Le type personnalis\u00e9 ne peut pas \u00eatre appliqu\u00e9, car il n''est pas reconnu. (customAspect={0}) -rm.action.event-no-disp-lc=L''\u00e9v\u00e9nement {0} ne peut pas \u00eatre compl\u00e9t\u00e9, car il n''est pas d\u00e9fini dans les \u00e9tapes du d\u00e9lai de r\u00e9tention. -rm.action.undeclared-only-records=Seuls les documents d''archives peuvent \u00eatre compl\u00e9t\u00e9s. (nodeRef={0}) -rm.action.no-declare-mand-prop=Avant de compl\u00e9ter le document d'archives, vous devez d\u00e9finir toutes ses propri\u00e9t\u00e9s obligatoires. -rm.action.ghosted-prop-update=Impossible de mettre \u00e0 jour les propri\u00e9t\u00e9s d'un document d'archives d\u00e9truit pr\u00e9c\u00e9demment. -rm.action.valid-date-disp-asof=Entrez une date valide pour la date de d\u00e9but de l'action de r\u00e9tention. -rm.action.disp-asof-lifecycle-applied=Vous ne pouvez pas modifier la date de d\u00e9but d'action de r\u00e9tention d'un document d'archives ou dossier d'archives auquel est appliqu\u00e9 un cycle de vie. -rm.action.hold-edit-reason-none=Impossible de modifier le motif de suspension car la suspension a \u00e9t\u00e9 cr\u00e9\u00e9e sans motif. Essayez de recr\u00e9er la suspension. -rm.action.hold-edit-type=Impossible de modifier le motif de suspension pour {1}, car ce n''est pas une suspension. -rm.action.specify-avlid-date=Entrez une date valide pour la date de d\u00e9but de la r\u00e9vision. -rm.action.review-details-only=Seules les informations de v\u00e9rification des documents d'archives essentiels peuvent \u00eatre modifi\u00e9es. -rm.action.freeze-no-reason=Un document d'archives ne peut pas \u00eatre suspendu sans motif. Ajoutez un motif pour la suspension. -rm.action.freeze-only-records-folders=Seuls des documents d'archives ou dossiers d'archives peuvent \u00eatre suspendus. -rm.action.no-open-record-folder=Impossible de rouvrir {0}, car ce n''est pas un dossier d''archives. -rm.action.not-hold-type=Impossible d''effectuer l''action sur {1}, car ce n''est pas une suspension. -rm.action.no-read-mime-message=Le message filetype est illisible, car {0}. -rm.action.email-declared=Impossible de partager l''e-mail, car le document d''archives n''est pas complet. (actionedUponNodeRef={0}) -rm.action.email-not-record=Impossible de partager l''e-mail, car le fichier, le dossier ou la cat\u00e9gorie n''est pas un document d''archives. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Impossible de cr\u00e9er une association d'enfant personnalis\u00e9e. -rm.action.node-already-transfer=Le fichier, le dossier ou la cat\u00e9gorie est d\u00e9j\u00e0 en cours de transfert. -rm.action.node-not-transfer=Le fichier, le dossier ou la cat\u00e9gorie n'est pas un objet de transfert. -rm.action.undo-not-last=Impossible d'annuler le d\u00e9classement car la derni\u00e8re action de r\u00e9tention n'\u00e9tait pas un d\u00e9classement. -rm.action.records_only_undeclared=Seuls les documents d'archives peuvent \u00eatre compl\u00e9t\u00e9s. -rm.action.event-not-undone=Impossible d''annuler l''\u00e9v\u00e9nement {0}, car il n''est pas d\u00e9fini dans les \u00e9tapes du d\u00e9lai de r\u00e9tention. -rm.action.node-not-record-category=Impossible de cr\u00e9er une r\u00e8gle de r\u00e9tention pour ({0}), car ce n''est pas une cat\u00e9gorie de document d''archives. -rm.action.parameter-not-supplied=Ajouter un(e) ''{0}'' pour continuer. -rm.action.delete-not-hold-type=Impossible de supprimer la suspension, car {1} n''est pas de type {0}. -rm.action.cast-to-rm-type=Impossible de t\u00e9l\u00e9charger un type de dossier personnalis\u00e9 dans le plan de classification de gestion des archives. -rm.action.record-folder-create=Impossible de cr\u00e9er un dossier d'archives dans un autre dossier d'archives. - +rm.action.not-defined=L''action de gestion des archives {0} n''a pas \u00e9t\u00e9 d\u00e9finie. +rm.action.no-implicit-noderef=Suite \u00e0 une erreur syst\u00e8me, \u00e9chec de l''action {0} possible. +rm.action.record-not-declared=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car le document d''archives {1} n''est pas complet. +rm.action.expected-record-level=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un document d''archives. +rm.action.not-all-records-declared=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car les documents d''archives dans le dossier d''archives ne sont pas tous complets. (actionedUponNodeRef={1}) +rm.action.not-eligible=Le document d''archives ou dossier d''archives {1} n''est pas encore pr\u00eat pour l''action de r\u00e9tention {0}. +rm.action.no-disposition-instructions=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car aucune instruction de r\u00e9tention n''a \u00e9t\u00e9 trouv\u00e9e. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car aucun ensemble de cycles de vie de r\u00e9tention n''est disponible. (nodeRef={1}) +rm.action.next-disp-not-set=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car l''\u00e9tape suivante du d\u00e9lai de r\u00e9tention n''est pas d\u00e9finie. (nodeRef={1}) +rm.action.not-next-disp=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car il ne s''agit pas de l''\u00e9tape suivante du d\u00e9lai de r\u00e9tention pour ce document d''archives ou ce dossier d''archives. (nodeRef={1}) +rm.action.not-record-folder=L''action de r\u00e9tention {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un dossier d''archives. +rm.action.actioned-upon-not-record=L''action {0} n''a pas pu \u00eatre ex\u00e9cut\u00e9e, car {1} n''est pas un document d''archives. +rm.action.custom-aspect-not-recognised=Le type personnalis\u00e9 ne peut pas \u00eatre appliqu\u00e9, car il n''est pas reconnu. (customAspect={0}) +rm.action.event-no-disp-lc=L''\u00e9v\u00e9nement {0} ne peut pas \u00eatre compl\u00e9t\u00e9, car il n''est pas d\u00e9fini dans les \u00e9tapes du d\u00e9lai de r\u00e9tention. +rm.action.undeclared-only-records=Seuls les documents d''archives peuvent \u00eatre compl\u00e9t\u00e9s. (nodeRef={0}) +rm.action.no-declare-mand-prop=Avant de compl\u00e9ter le document d'archives, vous devez d\u00e9finir toutes ses propri\u00e9t\u00e9s obligatoires. +rm.action.ghosted-prop-update=Impossible de mettre \u00e0 jour les propri\u00e9t\u00e9s d'un document d'archives d\u00e9truit pr\u00e9c\u00e9demment. +rm.action.valid-date-disp-asof=Entrez une date valide pour la date de d\u00e9but de l'action de r\u00e9tention. +rm.action.disp-asof-lifecycle-applied=Vous ne pouvez pas modifier la date de d\u00e9but d'action de r\u00e9tention d'un document d'archives ou dossier d'archives auquel est appliqu\u00e9 un cycle de vie. +rm.action.hold-edit-reason-none=Impossible de modifier le motif de suspension car la suspension a \u00e9t\u00e9 cr\u00e9\u00e9e sans motif. Essayez de recr\u00e9er la suspension. +rm.action.hold-edit-type=Impossible de modifier le motif de suspension pour {1}, car ce n''est pas une suspension. +rm.action.specify-avlid-date=Entrez une date valide pour la date de d\u00e9but de la r\u00e9vision. +rm.action.review-details-only=Seules les informations de v\u00e9rification des documents d'archives essentiels peuvent \u00eatre modifi\u00e9es. +rm.action.freeze-no-reason=Un document d'archives ne peut pas \u00eatre suspendu sans motif. Ajoutez un motif pour la suspension. +rm.action.freeze-only-records-folders=Seuls des documents d'archives ou dossiers d'archives peuvent \u00eatre suspendus. +rm.action.no-open-record-folder=Impossible de rouvrir {0}, car ce n''est pas un dossier d''archives. +rm.action.not-hold-type=Impossible d''effectuer l''action sur {1}, car ce n''est pas une suspension. +rm.action.no-read-mime-message=Le message filetype est illisible, car {0}. +rm.action.email-declared=Impossible de partager l''e-mail, car le document d''archives n''est pas complet. (actionedUponNodeRef={0}) +rm.action.email-not-record=Impossible de partager l''e-mail, car le fichier, le dossier ou la cat\u00e9gorie n''est pas un document d''archives. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=Impossible de cr\u00e9er une association d'enfant personnalis\u00e9e. +rm.action.node-already-transfer=Le fichier, le dossier ou la cat\u00e9gorie est d\u00e9j\u00e0 en cours de transfert. +rm.action.node-not-transfer=Le fichier, le dossier ou la cat\u00e9gorie n'est pas un objet de transfert. +rm.action.undo-not-last=Impossible d'annuler le d\u00e9classement car la derni\u00e8re action de r\u00e9tention n'\u00e9tait pas un d\u00e9classement. +rm.action.records_only_undeclared=Seuls les documents d'archives peuvent \u00eatre compl\u00e9t\u00e9s. +rm.action.event-not-undone=Impossible d''annuler l''\u00e9v\u00e9nement {0}, car il n''est pas d\u00e9fini dans les \u00e9tapes du d\u00e9lai de r\u00e9tention. +rm.action.node-not-record-category=Impossible de cr\u00e9er une r\u00e8gle de r\u00e9tention pour ({0}), car ce n''est pas une cat\u00e9gorie de document d''archives. +rm.action.parameter-not-supplied=Ajouter un(e) ''{0}'' pour continuer. +rm.action.delete-not-hold-type=Impossible de supprimer la suspension, car {1} n''est pas de type {0}. +rm.action.cast-to-rm-type=Impossible de t\u00e9l\u00e9charger un type de dossier personnalis\u00e9 dans le plan de classification de gestion des archives. +rm.action.record-folder-create=Impossible de cr\u00e9er un dossier d'archives dans un autre dossier d'archives. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_it.properties index e31fca1a7d..9ba4c44010 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_it.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=L''azione di gestione dei record {0} non \u00e8 stata definita. -rm.action.no-implicit-noderef=Si \u00e8 verificato un errore di sistema per cui l''azione {0} potrebbe non riuscire. -rm.action.record-not-declared=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 il record {1} \u00e8 incompleto. -rm.action.expected-record-level=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 {1} non costituisce un record. -rm.action.not-all-records-declared=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non tutti i record nella cartella di record sono completi. (actionedUponNodeRef={1}) -rm.action.not-eligible=Il record o la cartella di record {1} non sono pronti per l''azione di conservazione {0}. -rm.action.no-disposition-instructions=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non sono state trovate le istruzioni di conservazione. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non \u00e8 disponibile alcun set di ciclo di vita di conservazione. (nodeRef={1}) -rm.action.next-disp-not-set=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 l''azione di conservazione successiva non \u00e8 stata impostata. (nodeRef={1}) -rm.action.not-next-disp=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 quest''ultima non costituisce l''azione di conservazione successiva per questo record o cartella di record. (nodeRef={1}) -rm.action.not-record-folder=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 {1} non costituisce una cartella di record. -rm.action.actioned-upon-not-record=Impossibile eseguire l''azione {0}, poich\u00e9 {1} non costituisce un record. -rm.action.custom-aspect-not-recognised=Impossibile applicare il tipo personalizzato poich\u00e9 non viene riconosciuto. (customAspect={0}) -rm.action.event-no-disp-lc=Impossibile completare l''evento {0}, poich\u00e9 non \u00e8 definito nel ciclo di vita di conservazione. -rm.action.undeclared-only-records=Solo i record possono essere completati. (nodeRef={0}) -rm.action.no-declare-mand-prop=\u00c8 necessario impostare tutte le propriet\u00e0 obbligatorie del record prima di completare il record. -rm.action.ghosted-prop-update=Impossibile aggiornare le propriet\u00e0 di un record precedentemente eliminato in maniera definitiva. -rm.action.valid-date-disp-asof=Inserire una data valida come data di inizio dell'azione di conservazione. -rm.action.disp-asof-lifecycle-applied=Impossibile modificare la data di inizio di conservazione per un record o cartella di record per cui \u00e8 stato impostato un ciclo di vita. -rm.action.hold-edit-reason-none=Impossibile modificare il motivo della sospensione poich\u00e9 la sospensione \u00e8 stata creata senza un motivo. Provare a ricreare la sospensione. -rm.action.hold-edit-type=Impossibile modificare la sospensione per {1} poich\u00e9 non \u00e8 una sospensione. -rm.action.specify-avlid-date=Inserire una data valida come data di inizio dell'esame. -rm.action.review-details-only=\u00c8 possibile modificare solo i dettagli dell'esame dei record fondamentali. -rm.action.freeze-no-reason=Impossibile sospendere un record senza un motivo. Aggiungere un motivo alla sospensione. -rm.action.freeze-only-records-folders=\u00c8 possibile sospendere solo record o cartelle di record. -rm.action.no-open-record-folder=Impossibile riaprire {0} poich\u00e9 non si tratta di una cartella di record. -rm.action.not-hold-type=Impossibile eseguire l''azione su {1} poich\u00e9 non \u00e8 una sospensione. -rm.action.no-read-mime-message=Impossibile leggere il messaggio di tipo file, poich\u00e9 {0}. -rm.action.email-declared=Impossibile dividere l''e-mail poich\u00e9 il record \u00e8 completo. (actionedUponNodeRef={0}) -rm.action.email-not-record=Impossibile dividere l''e-mail poich\u00e9 il file, la cartella o la categoria non sono un record. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Impossibile creare un'associazione secondaria personalizzata. -rm.action.node-already-transfer=Il file, la cartella o la categoria sono gi\u00e0 in fase di trasferimento. -rm.action.node-not-transfer=Il file, la cartella o la categoria non sono oggetti da trasferire. -rm.action.undo-not-last=Impossibile annullare il cut off poich\u00e9 l'ultima azione di conservazione non \u00e8 stata interrotta. -rm.action.records_only_undeclared=\u00c8 solo possibile completare i record. -rm.action.event-not-undone=Non \u00e8 possibile annullare l''evento {0} poich\u00e9 non \u00e8 definito sul ciclo di vita di conservazione. -rm.action.node-not-record-category=Impossibile creare un programma di conservazione per {0} poich\u00e9 non si tratta di una categoria di record. -rm.action.parameter-not-supplied=Aggiungi un ''{0}'' per continuare. -rm.action.delete-not-hold-type=Impossibile eliminare la sospensione poich\u00e9 {1} non \u00e8 del tipo {0}. -rm.action.cast-to-rm-type=Impossibile caricare un tipo di cartella personalizzata sul piano file di Records Management. -rm.action.record-folder-create=Impossibile creare una cartella di record in un'altra cartella di record. - +rm.action.not-defined=L''azione di gestione dei record {0} non \u00e8 stata definita. +rm.action.no-implicit-noderef=Si \u00e8 verificato un errore di sistema per cui l''azione {0} potrebbe non riuscire. +rm.action.record-not-declared=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 il record {1} \u00e8 incompleto. +rm.action.expected-record-level=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 {1} non costituisce un record. +rm.action.not-all-records-declared=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non tutti i record nella cartella di record sono completi. (actionedUponNodeRef={1}) +rm.action.not-eligible=Il record o la cartella di record {1} non sono pronti per l''azione di conservazione {0}. +rm.action.no-disposition-instructions=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non sono state trovate le istruzioni di conservazione. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 non \u00e8 disponibile alcun set di ciclo di vita di conservazione. (nodeRef={1}) +rm.action.next-disp-not-set=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 l''azione di conservazione successiva non \u00e8 stata impostata. (nodeRef={1}) +rm.action.not-next-disp=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 quest''ultima non costituisce l''azione di conservazione successiva per questo record o cartella di record. (nodeRef={1}) +rm.action.not-record-folder=Non \u00e8 stato possibile eseguire l''azione di conservazione {0}, poich\u00e9 {1} non costituisce una cartella di record. +rm.action.actioned-upon-not-record=Impossibile eseguire l''azione {0}, poich\u00e9 {1} non costituisce un record. +rm.action.custom-aspect-not-recognised=Impossibile applicare il tipo personalizzato poich\u00e9 non viene riconosciuto. (customAspect={0}) +rm.action.event-no-disp-lc=Impossibile completare l''evento {0}, poich\u00e9 non \u00e8 definito nel ciclo di vita di conservazione. +rm.action.undeclared-only-records=Solo i record possono essere completati. (nodeRef={0}) +rm.action.no-declare-mand-prop=\u00c8 necessario impostare tutte le propriet\u00e0 obbligatorie del record prima di completare il record. +rm.action.ghosted-prop-update=Impossibile aggiornare le propriet\u00e0 di un record precedentemente eliminato in maniera definitiva. +rm.action.valid-date-disp-asof=Inserire una data valida come data di inizio dell'azione di conservazione. +rm.action.disp-asof-lifecycle-applied=Impossibile modificare la data di inizio di conservazione per un record o cartella di record per cui \u00e8 stato impostato un ciclo di vita. +rm.action.hold-edit-reason-none=Impossibile modificare il motivo della sospensione poich\u00e9 la sospensione \u00e8 stata creata senza un motivo. Provare a ricreare la sospensione. +rm.action.hold-edit-type=Impossibile modificare la sospensione per {1} poich\u00e9 non \u00e8 una sospensione. +rm.action.specify-avlid-date=Inserire una data valida come data di inizio dell'esame. +rm.action.review-details-only=\u00c8 possibile modificare solo i dettagli dell'esame dei record fondamentali. +rm.action.freeze-no-reason=Impossibile sospendere un record senza un motivo. Aggiungere un motivo alla sospensione. +rm.action.freeze-only-records-folders=\u00c8 possibile sospendere solo record o cartelle di record. +rm.action.no-open-record-folder=Impossibile riaprire {0} poich\u00e9 non si tratta di una cartella di record. +rm.action.not-hold-type=Impossibile eseguire l''azione su {1} poich\u00e9 non \u00e8 una sospensione. +rm.action.no-read-mime-message=Impossibile leggere il messaggio di tipo file, poich\u00e9 {0}. +rm.action.email-declared=Impossibile dividere l''e-mail poich\u00e9 il record \u00e8 completo. (actionedUponNodeRef={0}) +rm.action.email-not-record=Impossibile dividere l''e-mail poich\u00e9 il file, la cartella o la categoria non sono un record. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=Impossibile creare un'associazione secondaria personalizzata. +rm.action.node-already-transfer=Il file, la cartella o la categoria sono gi\u00e0 in fase di trasferimento. +rm.action.node-not-transfer=Il file, la cartella o la categoria non sono oggetti da trasferire. +rm.action.undo-not-last=Impossibile annullare il cut off poich\u00e9 l'ultima azione di conservazione non \u00e8 stata interrotta. +rm.action.records_only_undeclared=\u00c8 solo possibile completare i record. +rm.action.event-not-undone=Non \u00e8 possibile annullare l''evento {0} poich\u00e9 non \u00e8 definito sul ciclo di vita di conservazione. +rm.action.node-not-record-category=Impossibile creare un programma di conservazione per {0} poich\u00e9 non si tratta di una categoria di record. +rm.action.parameter-not-supplied=Aggiungi un ''{0}'' per continuare. +rm.action.delete-not-hold-type=Impossibile eliminare la sospensione poich\u00e9 {1} non \u00e8 del tipo {0}. +rm.action.cast-to-rm-type=Impossibile caricare un tipo di cartella personalizzata sul piano file di Records Management. +rm.action.record-folder-create=Impossibile creare una cartella di record in un'altra cartella di record. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ja.properties index b4ac62fa2f..62ebe34330 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ja.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u51e6\u7406 ''{0}'' \u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 -rm.action.no-implicit-noderef=\u30b7\u30b9\u30c6\u30e0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u305f\u3081\u3001\u51e6\u7406 ''{0}'' \u306f\u6b63\u5e38\u306b\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 -rm.action.record-not-declared=\u30ec\u30b3\u30fc\u30c9 ''{1}'' \u304c\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.expected-record-level=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.not-all-records-declared=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u4e00\u90e8\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={1}) -rm.action.not-eligible=\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 ''{1}'' \u306f\u3001\u307e\u3060\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u306e\u6e96\u5099\u304c\u3067\u304d\u3066\u3044\u307e\u305b\u3093\u3002 -rm.action.no-disposition-instructions=\u4fdd\u7ba1\u6307\u793a\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=\u4f7f\u7528\u53ef\u80fd\u306a\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u30bb\u30c3\u30c8\u304c\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) -rm.action.next-disp-not-set=\u6b21\u306e\u4fdd\u7ba1\u51e6\u7406\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) -rm.action.not-next-disp=\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u306f\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u7528\u306e\u6b21\u306e\u4fdd\u7ba1\u51e6\u7406\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) -rm.action.not-record-folder=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.actioned-upon-not-record=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.custom-aspect-not-recognised=\u30ab\u30b9\u30bf\u30e0\u30bf\u30a4\u30d7\u304c\u8a8d\u8b58\u3055\u308c\u306a\u3044\u305f\u3081\u3001\u9069\u7528\u3067\u304d\u307e\u305b\u3093\u3002 (customAspect={0}) -rm.action.event-no-disp-lc=\u30a4\u30d9\u30f3\u30c8 ''{0}'' \u306f\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u5b8c\u4e86\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.undeclared-only-records=\u5b8c\u4e86\u3067\u304d\u308b\u306e\u306f\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3067\u3059\u3002 (nodeRef={0}) -rm.action.no-declare-mand-prop=\u30ec\u30b3\u30fc\u30c9\u3092\u5b8c\u4e86\u3059\u308b\u306b\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u3059\u3079\u3066\u306e\u5fc5\u9808\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 -rm.action.ghosted-prop-update=\u4ee5\u524d\u306b\u7834\u68c4\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.valid-date-disp-asof=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u306b\u6709\u52b9\u306a\u65e5\u4ed8\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.disp-asof-lifecycle-applied=\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u304c\u9069\u7528\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u4fdd\u7ba1\u51e6\u7406\u5b9f\u884c\u65e5\u306f\u3001\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.hold-edit-reason-none=\u3053\u306e\u30db\u30fc\u30eb\u30c9\u306f\u7406\u7531\u306a\u3057\u3067\u4f5c\u6210\u3055\u308c\u305f\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u7406\u7531\u3092\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 \u30db\u30fc\u30eb\u30c9\u3092\u4f5c\u6210\u3057\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.hold-edit-type=''{1}'' \u306f\u30db\u30fc\u30eb\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u7406\u7531\u3092\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.specify-avlid-date=\u30ec\u30d3\u30e5\u30fc\u306e\u5b9f\u884c\u65e5\u306b\u6709\u52b9\u306a\u65e5\u4ed8\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.review-details-only=\u7de8\u96c6\u3067\u304d\u308b\u306e\u306f\u3001\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u306e\u8a73\u7d30\u306e\u307f\u3067\u3059\u3002 -rm.action.freeze-no-reason=\u7406\u7531\u304c\u306a\u3044\u3068\u3001\u30ec\u30b3\u30fc\u30c9\u3092\u30db\u30fc\u30eb\u30c9\u306b\u3067\u304d\u307e\u305b\u3093\u3002 \u30db\u30fc\u30eb\u30c9\u306b\u3059\u308b\u7406\u7531\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.freeze-only-records-folders=\u30db\u30fc\u30eb\u30c9\u306b\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u304b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3067\u3059\u3002 -rm.action.no-open-record-folder=''{0}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u518d\u5ea6\u958b\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.not-hold-type=''{1}'' \u306f\u30db\u30fc\u30eb\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u51e6\u7406\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.no-read-mime-message={0} \u306e\u305f\u3081\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u7a2e\u985e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8aad\u307f\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.email-declared=\u30ec\u30b3\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u305f\u3081\u3001E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={0}) -rm.action.email-not-record=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u30ab\u30c6\u30b4\u30ea\u306e\u3044\u305a\u308c\u304b\u304c\u30ec\u30b3\u30fc\u30c9\u3067\u306a\u3044\u305f\u3081\u3001E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=\u30ab\u30b9\u30bf\u30e0\u306e\u5b50\u95a2\u9023\u4ed8\u3051\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.node-already-transfer=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u307e\u305f\u306f\u30ab\u30c6\u30b4\u30ea\u304c\u3059\u3067\u306b\u8ee2\u9001\u4e2d\u3067\u3059\u3002 -rm.action.node-not-transfer=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u307e\u305f\u306f\u30ab\u30c6\u30b4\u30ea\u304c\u8ee2\u9001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 -rm.action.undo-not-last=\u76f4\u524d\u306e\u4fdd\u7ba1\u51e6\u7406\u306f\u30ab\u30c3\u30c8\u30aa\u30d5\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u5143\u306b\u623b\u3059\u64cd\u4f5c\u306f\u884c\u3048\u307e\u305b\u3093\u3002 -rm.action.records_only_undeclared=\u5b8c\u4e86\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3067\u3059\u3002 -rm.action.event-not-undone=\u30a4\u30d9\u30f3\u30c8 ''{0}'' \u306f\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u5143\u306b\u623b\u3059\u64cd\u4f5c\u306f\u884c\u3048\u307e\u305b\u3093\u3002 -rm.action.node-not-record-category=''{0}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.parameter-not-supplied=''{0}'' \u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.action.delete-not-hold-type=''{1}'' \u306f\u30bf\u30a4\u30d7 ''{0}'' \u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u3092\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.action.cast-to-rm-type=\u30ab\u30b9\u30bf\u30e0\u306e\u30d5\u30a9\u30eb\u30c0\u30bf\u30a4\u30d7\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3002 -rm.action.record-folder-create=\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 - +rm.action.not-defined=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u51e6\u7406 ''{0}'' \u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +rm.action.no-implicit-noderef=\u30b7\u30b9\u30c6\u30e0\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u305f\u3081\u3001\u51e6\u7406 ''{0}'' \u306f\u6b63\u5e38\u306b\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 +rm.action.record-not-declared=\u30ec\u30b3\u30fc\u30c9 ''{1}'' \u304c\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +rm.action.expected-record-level=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +rm.action.not-all-records-declared=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u4e00\u90e8\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={1}) +rm.action.not-eligible=\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 ''{1}'' \u306f\u3001\u307e\u3060\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u306e\u6e96\u5099\u304c\u3067\u304d\u3066\u3044\u307e\u305b\u3093\u3002 +rm.action.no-disposition-instructions=\u4fdd\u7ba1\u6307\u793a\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=\u4f7f\u7528\u53ef\u80fd\u306a\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u30bb\u30c3\u30c8\u304c\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) +rm.action.next-disp-not-set=\u6b21\u306e\u4fdd\u7ba1\u51e6\u7406\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) +rm.action.not-next-disp=\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u306f\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u7528\u306e\u6b21\u306e\u4fdd\u7ba1\u51e6\u7406\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={1}) +rm.action.not-record-folder=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +rm.action.actioned-upon-not-record=''{1}'' \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u51e6\u7406 ''{0}'' \u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +rm.action.custom-aspect-not-recognised=\u30ab\u30b9\u30bf\u30e0\u30bf\u30a4\u30d7\u304c\u8a8d\u8b58\u3055\u308c\u306a\u3044\u305f\u3081\u3001\u9069\u7528\u3067\u304d\u307e\u305b\u3093\u3002 (customAspect={0}) +rm.action.event-no-disp-lc=\u30a4\u30d9\u30f3\u30c8 ''{0}'' \u306f\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u5b8c\u4e86\u3067\u304d\u307e\u305b\u3093\u3002 +rm.action.undeclared-only-records=\u5b8c\u4e86\u3067\u304d\u308b\u306e\u306f\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3067\u3059\u3002 (nodeRef={0}) +rm.action.no-declare-mand-prop=\u30ec\u30b3\u30fc\u30c9\u3092\u5b8c\u4e86\u3059\u308b\u306b\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u3059\u3079\u3066\u306e\u5fc5\u9808\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +rm.action.ghosted-prop-update=\u4ee5\u524d\u306b\u7834\u68c4\u3057\u305f\u30ec\u30b3\u30fc\u30c9\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 +rm.action.valid-date-disp-asof=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u306b\u6709\u52b9\u306a\u65e5\u4ed8\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.action.disp-asof-lifecycle-applied=\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u304c\u9069\u7528\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u4fdd\u7ba1\u51e6\u7406\u5b9f\u884c\u65e5\u306f\u3001\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 +rm.action.hold-edit-reason-none=\u3053\u306e\u30db\u30fc\u30eb\u30c9\u306f\u7406\u7531\u306a\u3057\u3067\u4f5c\u6210\u3055\u308c\u305f\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u7406\u7531\u3092\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 \u30db\u30fc\u30eb\u30c9\u3092\u4f5c\u6210\u3057\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.action.hold-edit-type=''{1}'' \u306f\u30db\u30fc\u30eb\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u7406\u7531\u3092\u7de8\u96c6\u3067\u304d\u307e\u305b\u3093\u3002 +rm.action.specify-avlid-date=\u30ec\u30d3\u30e5\u30fc\u306e\u5b9f\u884c\u65e5\u306b\u6709\u52b9\u306a\u65e5\u4ed8\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.action.review-details-only=\u7de8\u96c6\u3067\u304d\u308b\u306e\u306f\u3001\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u306e\u8a73\u7d30\u306e\u307f\u3067\u3059\u3002 +rm.action.freeze-no-reason=\u7406\u7531\u304c\u306a\u3044\u3068\u3001\u30ec\u30b3\u30fc\u30c9\u3092\u30db\u30fc\u30eb\u30c9\u306b\u3067\u304d\u307e\u305b\u3093\u3002 \u30db\u30fc\u30eb\u30c9\u306b\u3059\u308b\u7406\u7531\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.action.freeze-only-records-folders=\u30db\u30fc\u30eb\u30c9\u306b\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u304b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3067\u3059\u3002 +rm.action.no-open-record-folder=''{0}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u518d\u5ea6\u958b\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 +rm.action.not-hold-type=''{1}'' \u306f\u30db\u30fc\u30eb\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u51e6\u7406\u3092\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u3002 +rm.action.no-read-mime-message={0} \u306e\u305f\u3081\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u7a2e\u985e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8aad\u307f\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +rm.action.email-declared=\u30ec\u30b3\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u305f\u3081\u3001E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={0}) +rm.action.email-not-record=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u30ab\u30c6\u30b4\u30ea\u306e\u3044\u305a\u308c\u304b\u304c\u30ec\u30b3\u30fc\u30c9\u3067\u306a\u3044\u305f\u3081\u3001E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=\u30ab\u30b9\u30bf\u30e0\u306e\u5b50\u95a2\u9023\u4ed8\u3051\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +rm.action.node-already-transfer=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u307e\u305f\u306f\u30ab\u30c6\u30b4\u30ea\u304c\u3059\u3067\u306b\u8ee2\u9001\u4e2d\u3067\u3059\u3002 +rm.action.node-not-transfer=\u30d5\u30a1\u30a4\u30eb\u3001\u30d5\u30a9\u30eb\u30c0\u3001\u307e\u305f\u306f\u30ab\u30c6\u30b4\u30ea\u304c\u8ee2\u9001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 +rm.action.undo-not-last=\u76f4\u524d\u306e\u4fdd\u7ba1\u51e6\u7406\u306f\u30ab\u30c3\u30c8\u30aa\u30d5\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u5143\u306b\u623b\u3059\u64cd\u4f5c\u306f\u884c\u3048\u307e\u305b\u3093\u3002 +rm.action.records_only_undeclared=\u5b8c\u4e86\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u307f\u3067\u3059\u3002 +rm.action.event-not-undone=\u30a4\u30d9\u30f3\u30c8 ''{0}'' \u306f\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u5143\u306b\u623b\u3059\u64cd\u4f5c\u306f\u884c\u3048\u307e\u305b\u3093\u3002 +rm.action.node-not-record-category=''{0}'' \u306f\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 +rm.action.parameter-not-supplied=''{0}'' \u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.action.delete-not-hold-type=''{1}'' \u306f\u30bf\u30a4\u30d7 ''{0}'' \u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30db\u30fc\u30eb\u30c9\u3092\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +rm.action.cast-to-rm-type=\u30ab\u30b9\u30bf\u30e0\u306e\u30d5\u30a9\u30eb\u30c0\u30bf\u30a4\u30d7\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3002 +rm.action.record-folder-create=\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties index 80aa41c6a0..f815e606b4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=Oppf\u00f8ringsh\u00e5ndteringshandlingen {0} er ikke definert. -rm.action.no-implicit-noderef=Det oppsto en systemfeil. derfor det mulig at handlingen {0} ikke var vellykket. -rm.action.record-not-declared=Retensjonshandlingen {0} kunne ikke utf\u00f8re fordi oppf\u00f8ringen {1} ikke er fullf\u00f8rt. -rm.action.expected-record-level=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi dette {1} ikke er en oppf\u00f8ring. -rm.action.not-all-records-declared=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi ikke alle oppf\u00f8ringene i oppf\u00f8ringsmappen var fullf\u00f8rt. (actionedUponNodeRef={1}) -rm.action.not-eligible=Oppf\u00f8ringen eller oppf\u00f8ringsmappen {1} er enn\u00e5 ikke klar for retensjonshandlingen {0}. -rm.action.no-disposition-instructions=Retensjonsh\u00e5ndlingen {0} kunne ikke utf\u00f8res fordi ingen retensjonsinstruksjoner ble funnet. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi det ikke fantes noe tilgjengelig livssyklussett ved retensjon. (nodeRef={1}) -rm.action.next-disp-not-set=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi neste retensjonshandling ikke er et sett. (nodeRef={1}) -rm.action.not-next-disp=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi dette ikke er den neste retensjonshandlingen til denne oppf\u00f8ringen eller oppf\u00f8ringsmappen. (nodeRef={1}) -rm.action.not-record-folder=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi {1} ikke er en oppf\u00f8ringsmappe. -rm.action.actioned-upon-not-record=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi {1} ikke er en oppf\u00f8ring. -rm.action.custom-aspect-not-recognised=Den tilpassede typen kan ikke brukes fordi den ikke gjenkjennes. (customAspect={0}) -rm.action.event-no-disp-lc=Hendelsen {0} kan ikke fullf\u00f8res fordi den ikke er definert p\u00e5 livssyklusen ved retensjon. -rm.action.undeclared-only-records=Kun oppf\u00f8ringer kan fullf\u00f8res. (nodeRef={0}) -rm.action.no-declare-mand-prop=Alle de obligatoriske egenskapene til oppf\u00f8ringen m\u00e5 stilles inn f\u00f8r oppf\u00f8ringen kan fullf\u00f8res. -rm.action.ghosted-prop-update=Du kan ikke oppdatere egenskapene til en oppf\u00f8ring som er destruert tidligere. -rm.action.valid-date-disp-asof=Angi en gyldig dato for retensjonshandlingen per datoen. -rm.action.disp-asof-lifecycle-applied=Retensjonen per en dato til en oppf\u00f8ring eller oppf\u00f8ringsmappe der en livssyklus er p\u00e5f\u00f8rt, kan ikke redigeres. -rm.action.hold-edit-reason-none=Grunnen til holdet kan ikke redigeres fordi holdet ble opprettet uten grunn. Pr\u00f8v \u00e5 opprette holdet p\u00e5 nytt. -rm.action.hold-edit-type=Grunnen til holdet for {1} kan ikke redigeres fordi det ikke er et hold. -rm.action.specify-avlid-date=Angi en gyldig dato for gjennomgang per datoen. -rm.action.review-details-only=Kun Gjennomgangsdetaljene til de sv\u00e6rt viktige oppf\u00f8ringene kan redigeres. -rm.action.freeze-no-reason=En oppf\u00f8ring kan ikke holdes uten grunn. Legg til en grunn til holdet. -rm.action.freeze-only-records-folders=Du kan bare holde oppf\u00f8ringer eller oppf\u00f8ringsmapper. -rm.action.no-open-record-folder={0} kan ikke \u00e5pnes p\u00e5 nytt fordi den er ikke en oppf\u00f8ringsmappe. -rm.action.not-hold-type=Handlingen kan ikke utf\u00f8res p\u00e5 {1} fordi den ikke er p\u00e5 hold. -rm.action.no-read-mime-message=Filtypemeldingen kunne ikke leses fordi {0}. -rm.action.email-declared=E-posten kan ikke deles fordi oppf\u00f8ringen er fullf\u00f8rt. (actionedUponNodeRef={0}) -rm.action.email-not-record=E-posten kan ikke deles fordi filen, mappen eller kategorien ikke er en oppf\u00f8ring. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Kunne ikke opprette en egendefinert barnassosiasjon. -rm.action.node-already-transfer=Filen, mappen eller kategorien er overf\u00f8res allerede. -rm.action.node-not-transfer=Filen, mappen eller kategorien er ikke et overf\u00f8ringselement. -rm.action.undo-not-last=Cut off kan ikke angres fordi den siste retensjonshandlingen ikke ble cut off. -rm.action.records_only_undeclared=Du kan bare fullf\u00f8re oppf\u00f8ringer. -rm.action.event-not-undone=Hendelsen {0} kan ikke angres fordi den ikke p\u00e5 definert i livssyklusen ved retensjon. -rm.action.node-not-record-category=Retensjonsplanen til {0} kan ikke opprett fordi den er ikke en oppf\u00f8ringskategori. -rm.action.parameter-not-supplied=Legg til ''{0}'' for \u00e5 fortsette. -rm.action.delete-not-hold-type=Holdet kan ikke slettes fordi {1} ikke er en type {0}. -rm.action.cast-to-rm-type=En tilpasset mappetype kan ikke lastes opp p\u00e5 oppf\u00f8ringsh\u00e5ndteringsfilplanen. -rm.action.record-folder-create=En oppf\u00f8ringsmappen kan ikke opprettes i en annen oppf\u00f8ringsmappe. - +rm.action.not-defined=Oppf\u00f8ringsh\u00e5ndteringshandlingen {0} er ikke definert. +rm.action.no-implicit-noderef=Det oppsto en systemfeil. derfor det mulig at handlingen {0} ikke var vellykket. +rm.action.record-not-declared=Retensjonshandlingen {0} kunne ikke utf\u00f8re fordi oppf\u00f8ringen {1} ikke er fullf\u00f8rt. +rm.action.expected-record-level=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi dette {1} ikke er en oppf\u00f8ring. +rm.action.not-all-records-declared=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi ikke alle oppf\u00f8ringene i oppf\u00f8ringsmappen var fullf\u00f8rt. (actionedUponNodeRef={1}) +rm.action.not-eligible=Oppf\u00f8ringen eller oppf\u00f8ringsmappen {1} er enn\u00e5 ikke klar for retensjonshandlingen {0}. +rm.action.no-disposition-instructions=Retensjonsh\u00e5ndlingen {0} kunne ikke utf\u00f8res fordi ingen retensjonsinstruksjoner ble funnet. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi det ikke fantes noe tilgjengelig livssyklussett ved retensjon. (nodeRef={1}) +rm.action.next-disp-not-set=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi neste retensjonshandling ikke er et sett. (nodeRef={1}) +rm.action.not-next-disp=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi dette ikke er den neste retensjonshandlingen til denne oppf\u00f8ringen eller oppf\u00f8ringsmappen. (nodeRef={1}) +rm.action.not-record-folder=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi {1} ikke er en oppf\u00f8ringsmappe. +rm.action.actioned-upon-not-record=Retensjonshandlingen {0} kunne ikke utf\u00f8res fordi {1} ikke er en oppf\u00f8ring. +rm.action.custom-aspect-not-recognised=Den tilpassede typen kan ikke brukes fordi den ikke gjenkjennes. (customAspect={0}) +rm.action.event-no-disp-lc=Hendelsen {0} kan ikke fullf\u00f8res fordi den ikke er definert p\u00e5 livssyklusen ved retensjon. +rm.action.undeclared-only-records=Kun oppf\u00f8ringer kan fullf\u00f8res. (nodeRef={0}) +rm.action.no-declare-mand-prop=Alle de obligatoriske egenskapene til oppf\u00f8ringen m\u00e5 stilles inn f\u00f8r oppf\u00f8ringen kan fullf\u00f8res. +rm.action.ghosted-prop-update=Du kan ikke oppdatere egenskapene til en oppf\u00f8ring som er destruert tidligere. +rm.action.valid-date-disp-asof=Angi en gyldig dato for retensjonshandlingen per datoen. +rm.action.disp-asof-lifecycle-applied=Retensjonen per en dato til en oppf\u00f8ring eller oppf\u00f8ringsmappe der en livssyklus er p\u00e5f\u00f8rt, kan ikke redigeres. +rm.action.hold-edit-reason-none=Grunnen til holdet kan ikke redigeres fordi holdet ble opprettet uten grunn. Pr\u00f8v \u00e5 opprette holdet p\u00e5 nytt. +rm.action.hold-edit-type=Grunnen til holdet for {1} kan ikke redigeres fordi det ikke er et hold. +rm.action.specify-avlid-date=Angi en gyldig dato for gjennomgang per datoen. +rm.action.review-details-only=Kun Gjennomgangsdetaljene til de sv\u00e6rt viktige oppf\u00f8ringene kan redigeres. +rm.action.freeze-no-reason=En oppf\u00f8ring kan ikke holdes uten grunn. Legg til en grunn til holdet. +rm.action.freeze-only-records-folders=Du kan bare holde oppf\u00f8ringer eller oppf\u00f8ringsmapper. +rm.action.no-open-record-folder={0} kan ikke \u00e5pnes p\u00e5 nytt fordi den er ikke en oppf\u00f8ringsmappe. +rm.action.not-hold-type=Handlingen kan ikke utf\u00f8res p\u00e5 {1} fordi den ikke er p\u00e5 hold. +rm.action.no-read-mime-message=Filtypemeldingen kunne ikke leses fordi {0}. +rm.action.email-declared=E-posten kan ikke deles fordi oppf\u00f8ringen er fullf\u00f8rt. (actionedUponNodeRef={0}) +rm.action.email-not-record=E-posten kan ikke deles fordi filen, mappen eller kategorien ikke er en oppf\u00f8ring. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=Kunne ikke opprette en egendefinert barnassosiasjon. +rm.action.node-already-transfer=Filen, mappen eller kategorien er overf\u00f8res allerede. +rm.action.node-not-transfer=Filen, mappen eller kategorien er ikke et overf\u00f8ringselement. +rm.action.undo-not-last=Cut off kan ikke angres fordi den siste retensjonshandlingen ikke ble cut off. +rm.action.records_only_undeclared=Du kan bare fullf\u00f8re oppf\u00f8ringer. +rm.action.event-not-undone=Hendelsen {0} kan ikke angres fordi den ikke p\u00e5 definert i livssyklusen ved retensjon. +rm.action.node-not-record-category=Retensjonsplanen til {0} kan ikke opprett fordi den er ikke en oppf\u00f8ringskategori. +rm.action.parameter-not-supplied=Legg til ''{0}'' for \u00e5 fortsette. +rm.action.delete-not-hold-type=Holdet kan ikke slettes fordi {1} ikke er en type {0}. +rm.action.cast-to-rm-type=En tilpasset mappetype kan ikke lastes opp p\u00e5 oppf\u00f8ringsh\u00e5ndteringsfilplanen. +rm.action.record-folder-create=En oppf\u00f8ringsmappen kan ikke opprettes i en annen oppf\u00f8ringsmappe. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nl.properties index 33c6ffdf99..084f6340e8 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nl.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=De Records Management-actie {0} is niet gedefinieerd. -rm.action.no-implicit-noderef=Er is een systeemfout opgetreden en de actie {0} is mogelijk niet geslaagd. -rm.action.record-not-declared=De retentieactie {0} kon niet worden uitgevoerd omdat de record {1} niet afgerond is. -rm.action.expected-record-level=De retentieactie {0} kon niet worden uitgevoerd omdat {1} geen record is. -rm.action.not-all-records-declared=De retentieactie {0} kon niet worden uitgevoerd omdat niet alle records in de archiefmap afgerond zijn. (actionedUponNodeRef={1}) -rm.action.not-eligible=De record of archiefmap {1} is nog niet gereed voor de retentieactie {0}. -rm.action.no-disposition-instructions=De retentieactie {0} kon niet worden uitgevoerd omdat er geen retentie-instructies zijn gevonden. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=De retentieactie {0} kon niet worden uitgevoerd omdat er geen retentiecyclus is ingesteld. (nodeRef={1}) -rm.action.next-disp-not-set=De retentiesactie {0} kon niet worden uitgevoerd omdat de volgende retentieactie niet is ingesteld. (nodeRef={1}) -rm.action.not-next-disp=De retentieactie {0} kon niet worden uitgevoerd omdat dit niet de volgende retentieactie voor deze record of deze archiefmap is. (nodeRef={1}) -rm.action.not-record-folder=De retentieactie {0} kon niet worden uitgevoerd omdat {1} geen archiefmap is. -rm.action.actioned-upon-not-record=De actie {0} kan niet worden uitgevoerd omdat {1} geen record is. -rm.action.custom-aspect-not-recognised=Het aangepaste type kan niet worden toegepast omdat het niet wordt herkend. (customAspect={0}) -rm.action.event-no-disp-lc=De gebeurtenis {0} kan niet worden afgerond omdat deze niet is gedefinieerd in de retentiecyclus. -rm.action.undeclared-only-records=Er kunnen alleen records worden afgerond. (nodeRef={0}) -rm.action.no-declare-mand-prop=U moet alle verplichte eigenschappen van de record instellen voordat u de record kunt afronden. -rm.action.ghosted-prop-update=U kunt de eigenschappen van een eerder vernietigde record niet bijwerken. -rm.action.valid-date-disp-asof=Voer een geldige datum in voor de begindatum van de retentieactie. -rm.action.disp-asof-lifecycle-applied=U kunt de begindatum van de retentie van een record of archiefmap waarvoor een levenscyclus is toegepast niet bewerken. -rm.action.hold-edit-reason-none=U kunt de reden van de wachtstand niet bewerken omdat de wachtstand is gemaakt zonder reden. Probeer de wachtstand opnieuw te maken. -rm.action.hold-edit-type=U kunt de reden van de wachtstand voor {1} niet bewerken omdat dit geen wachtstand is. -rm.action.specify-avlid-date=Voer een geldige datum in voor de begindatum van de revisie. -rm.action.review-details-only=U kunt alleen de revisiegegevens van vitale records bewerken. -rm.action.freeze-no-reason=U kunt een record niet zonder reden in de wachtstand plaatsen. Voeg een reden toe aan de wachtstand. -rm.action.freeze-only-records-folders=U kunt alleen records of archiefmappen in de wachtstand plaatsen. -rm.action.no-open-record-folder=U kunt {0} niet heropenen omdat dit geen archiefmap is. -rm.action.not-hold-type=U kunt de actie niet uitvoeren voor {1} omdat dit geen wachtstand is. -rm.action.no-read-mime-message=Het bestandstype kon niet worden gelezen omdat {0}. -rm.action.email-declared=De e-mail kan niet worden opgesplitst omdat de record is afgerond. (actionedUponNodeRef={0}) -rm.action.email-not-record=De e-mail kan niet worden opgesplitst omdat het bestand, de map of de categorie geen record is. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Er kan geen aangepaste onderliggende koppeling worden gemaakt. -rm.action.node-already-transfer=Het bestand, de map of de categorie wordt al overgezet. -rm.action.node-not-transfer=Het bestand, de map of de categorie is geen overzetobject. -rm.action.undo-not-last=U kunt het afsluiten niet ongedaan maken omdat de laatste retentieactie niet was afgesloten. -rm.action.records_only_undeclared=U kunt alleen records afronden. -rm.action.event-not-undone=U kunt de gebeurtenis {0} niet ongedaan maken omdat deze niet in de retentiecyclus is gedefinieerd. -rm.action.node-not-record-category=U kunt geen retentieschema maken voor {0} omdat dit geen recordcategorie is. -rm.action.parameter-not-supplied=Voeg een ''{0}'' toe om door te gaan. -rm.action.delete-not-hold-type=De wachtstand kan niet worden verwijderd omdat {1} niet van het type {0} is. -rm.action.cast-to-rm-type=U kunt geen aangepast maptype uploaden naar het ordeningsplan van Records Management. -rm.action.record-folder-create=U kunt geen archiefmap in een andere archiefmap maken. - +rm.action.not-defined=De Records Management-actie {0} is niet gedefinieerd. +rm.action.no-implicit-noderef=Er is een systeemfout opgetreden en de actie {0} is mogelijk niet geslaagd. +rm.action.record-not-declared=De retentieactie {0} kon niet worden uitgevoerd omdat de record {1} niet afgerond is. +rm.action.expected-record-level=De retentieactie {0} kon niet worden uitgevoerd omdat {1} geen record is. +rm.action.not-all-records-declared=De retentieactie {0} kon niet worden uitgevoerd omdat niet alle records in de archiefmap afgerond zijn. (actionedUponNodeRef={1}) +rm.action.not-eligible=De record of archiefmap {1} is nog niet gereed voor de retentieactie {0}. +rm.action.no-disposition-instructions=De retentieactie {0} kon niet worden uitgevoerd omdat er geen retentie-instructies zijn gevonden. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=De retentieactie {0} kon niet worden uitgevoerd omdat er geen retentiecyclus is ingesteld. (nodeRef={1}) +rm.action.next-disp-not-set=De retentiesactie {0} kon niet worden uitgevoerd omdat de volgende retentieactie niet is ingesteld. (nodeRef={1}) +rm.action.not-next-disp=De retentieactie {0} kon niet worden uitgevoerd omdat dit niet de volgende retentieactie voor deze record of deze archiefmap is. (nodeRef={1}) +rm.action.not-record-folder=De retentieactie {0} kon niet worden uitgevoerd omdat {1} geen archiefmap is. +rm.action.actioned-upon-not-record=De actie {0} kan niet worden uitgevoerd omdat {1} geen record is. +rm.action.custom-aspect-not-recognised=Het aangepaste type kan niet worden toegepast omdat het niet wordt herkend. (customAspect={0}) +rm.action.event-no-disp-lc=De gebeurtenis {0} kan niet worden afgerond omdat deze niet is gedefinieerd in de retentiecyclus. +rm.action.undeclared-only-records=Er kunnen alleen records worden afgerond. (nodeRef={0}) +rm.action.no-declare-mand-prop=U moet alle verplichte eigenschappen van de record instellen voordat u de record kunt afronden. +rm.action.ghosted-prop-update=U kunt de eigenschappen van een eerder vernietigde record niet bijwerken. +rm.action.valid-date-disp-asof=Voer een geldige datum in voor de begindatum van de retentieactie. +rm.action.disp-asof-lifecycle-applied=U kunt de begindatum van de retentie van een record of archiefmap waarvoor een levenscyclus is toegepast niet bewerken. +rm.action.hold-edit-reason-none=U kunt de reden van de wachtstand niet bewerken omdat de wachtstand is gemaakt zonder reden. Probeer de wachtstand opnieuw te maken. +rm.action.hold-edit-type=U kunt de reden van de wachtstand voor {1} niet bewerken omdat dit geen wachtstand is. +rm.action.specify-avlid-date=Voer een geldige datum in voor de begindatum van de revisie. +rm.action.review-details-only=U kunt alleen de revisiegegevens van vitale records bewerken. +rm.action.freeze-no-reason=U kunt een record niet zonder reden in de wachtstand plaatsen. Voeg een reden toe aan de wachtstand. +rm.action.freeze-only-records-folders=U kunt alleen records of archiefmappen in de wachtstand plaatsen. +rm.action.no-open-record-folder=U kunt {0} niet heropenen omdat dit geen archiefmap is. +rm.action.not-hold-type=U kunt de actie niet uitvoeren voor {1} omdat dit geen wachtstand is. +rm.action.no-read-mime-message=Het bestandstype kon niet worden gelezen omdat {0}. +rm.action.email-declared=De e-mail kan niet worden opgesplitst omdat de record is afgerond. (actionedUponNodeRef={0}) +rm.action.email-not-record=De e-mail kan niet worden opgesplitst omdat het bestand, de map of de categorie geen record is. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=Er kan geen aangepaste onderliggende koppeling worden gemaakt. +rm.action.node-already-transfer=Het bestand, de map of de categorie wordt al overgezet. +rm.action.node-not-transfer=Het bestand, de map of de categorie is geen overzetobject. +rm.action.undo-not-last=U kunt het afsluiten niet ongedaan maken omdat de laatste retentieactie niet was afgesloten. +rm.action.records_only_undeclared=U kunt alleen records afronden. +rm.action.event-not-undone=U kunt de gebeurtenis {0} niet ongedaan maken omdat deze niet in de retentiecyclus is gedefinieerd. +rm.action.node-not-record-category=U kunt geen retentieschema maken voor {0} omdat dit geen recordcategorie is. +rm.action.parameter-not-supplied=Voeg een ''{0}'' toe om door te gaan. +rm.action.delete-not-hold-type=De wachtstand kan niet worden verwijderd omdat {1} niet van het type {0} is. +rm.action.cast-to-rm-type=U kunt geen aangepast maptype uploaden naar het ordeningsplan van Records Management. +rm.action.record-folder-create=U kunt geen archiefmap in een andere archiefmap maken. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_pt_BR.properties index 97c8d07d13..fddaeebd06 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_pt_BR.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=A a\u00e7\u00e3o {0} do Records Management n\u00e3o foi definida. -rm.action.no-implicit-noderef=Houve um erro do sistema e a a\u00e7\u00e3o {0} pode n\u00e3o ter sucesso. -rm.action.record-not-declared=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois o documento arquiv\u00edstico {1} n\u00e3o est\u00e1 conclu\u00eddo. -rm.action.expected-record-level=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois {1} n\u00e3o \u00e9 um documento arquiv\u00edstico. -rm.action.not-all-records-declared=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois nem todos os documentos arquiv\u00edsticos na pasta de documentos arquiv\u00edsticos est\u00e3o conclu\u00eddos. (actionedUponNodeRef={1}) -rm.action.not-eligible=O documento arquiv\u00edstico ou pasta de documento arquiv\u00edstico {1} n\u00e3o est\u00e1 pronto para a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}. -rm.action.no-disposition-instructions=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois nenhuma instru\u00e7\u00e3o de reten\u00e7\u00e3o foi localizada. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois n\u00e3o h\u00e1 conjunto de ciclo de vida de reten\u00e7\u00e3o dispon\u00edvel. (nodeRef={1}) -rm.action.next-disp-not-set=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o n\u00e3o est\u00e1 definida. (nodeRef={1}) -rm.action.not-next-disp=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois esta n\u00e3o \u00e9 a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o para este documento arquiv\u00edstico ou esta pasta de documento arquiv\u00edstico. (nodeRef={1}) -rm.action.not-record-folder=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois {1} n\u00e3o \u00e9 uma pasta de documento arquiv\u00edstico. -rm.action.actioned-upon-not-record=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o {0} porque {1} n\u00e3o \u00e9 um documento arquiv\u00edstico. -rm.action.custom-aspect-not-recognised=N\u00e3o \u00e9 poss\u00edvel aplicar o tipo personalizado porque ele n\u00e3o \u00e9 reconhecido. (customAspect={0}) -rm.action.event-no-disp-lc=N\u00e3o \u00e9 poss\u00edvel concluir o evento {0}, pois ele n\u00e3o est\u00e1 definido no ciclo de vida da reten\u00e7\u00e3o. -rm.action.undeclared-only-records=Apenas documentos arquiv\u00edsticos podem ser conclu\u00eddos. (nodeRef={0}) -rm.action.no-declare-mand-prop=Voc\u00ea deve definir todas as propriedades obrigat\u00f3rias do documento arquiv\u00edstico antes de poder concluir o documento arquiv\u00edstico. -rm.action.ghosted-prop-update=N\u00e3o \u00e9 poss\u00edvel atualizar as propriedades de um documento arquiv\u00edstico destru\u00eddo anteriormente. -rm.action.valid-date-disp-asof=Insira uma data v\u00e1lida para a data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o. -rm.action.disp-asof-lifecycle-applied=N\u00e3o \u00e9 poss\u00edvel editar a data de in\u00edcio da reten\u00e7\u00e3o de um documento arquiv\u00edstico ou uma pasta de documento arquiv\u00edstico que tenha um ciclo de vida aplicado. -rm.action.hold-edit-reason-none=N\u00e3o \u00e9 poss\u00edvel editar o motivo para manter, pois a espera foi criada sem um motivo. Tente recriar a espera. -rm.action.hold-edit-type=N\u00e3o \u00e9 poss\u00edvel editar o motivo para manter de {1}, pois isso n\u00e3o \u00e9 uma espera. -rm.action.specify-avlid-date=Insira uma data v\u00e1lida para a data de in\u00edcio da revis\u00e3o. -rm.action.review-details-only=Voc\u00ea somente pode editar os detalhes de revis\u00e3o de documentos arquiv\u00edsticos vitais. -rm.action.freeze-no-reason=N\u00e3o \u00e9 poss\u00edvel manter um documento arquiv\u00edstico sem um motivo. Adicione um motivo para manter. -rm.action.freeze-only-records-folders=Voc\u00ea pode manter somente documentos arquiv\u00edsticos ou pastas de documentos arquiv\u00edsticos. -rm.action.no-open-record-folder=N\u00e3o \u00e9 poss\u00edvel reabrir {0}, pois isso n\u00e3o \u00e9 uma pasta de documento arquiv\u00edstico. -rm.action.not-hold-type=N\u00e3o \u00e9 poss\u00edvel realizar a a\u00e7\u00e3o em {1}, pois isso n\u00e3o \u00e9 uma espera. -rm.action.no-read-mime-message=N\u00e3o foi poss\u00edvel ler a mensagem de tipo de arquivo, pois {0}. -rm.action.email-declared=N\u00e3o foi poss\u00edvel dividir o e-mail, pois o documento arquiv\u00edstico est\u00e1 conclu\u00eddo. (actionedUponNodeRef={0}) -rm.action.email-not-record=N\u00e3o foi poss\u00edvel dividir o e-mail, pois o arquivo, pasta ou categoria n\u00e3o \u00e9 um documento arquiv\u00edstico. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=N\u00e3o foi poss\u00edvel criar uma associa\u00e7\u00e3o secund\u00e1ria personalizada. -rm.action.node-already-transfer=O arquivo, pasta ou categoria j\u00e1 est\u00e1 sendo transferido. -rm.action.node-not-transfer=O arquivo, pasta ou categoria n\u00e3o \u00e9 um objeto de transfer\u00eancia. -rm.action.undo-not-last=N\u00e3o \u00e9 poss\u00edvel desfazer o corte, pois a \u00faltima a\u00e7\u00e3o de reten\u00e7\u00e3o n\u00e3o foi cortada. -rm.action.records_only_undeclared=Voc\u00ea s\u00f3 pode concluir documentos arquiv\u00edsticos. -rm.action.event-not-undone=N\u00e3o \u00e9 poss\u00edvel desfazer o evento {0}, pois ele n\u00e3o est\u00e1 definido no ciclo de vida de reten\u00e7\u00e3o. -rm.action.node-not-record-category=N\u00e3o \u00e9 poss\u00edvel criar uma programa\u00e7\u00e3o de reten\u00e7\u00e3o para ({0}), pois n\u00e3o \u00e9 uma categoria de documento arquiv\u00edstico. -rm.action.parameter-not-supplied=Adicione um(a) ''{0}'' para continuar. -rm.action.delete-not-hold-type=N\u00e3o foi poss\u00edvel excluir a espera, pois {1} n\u00e3o \u00e9 do tipo {0}. -rm.action.cast-to-rm-type=N\u00e3o \u00e9 poss\u00edvel carregar um tipo de pasta personalizada para o plano de arquivo do Records Management. -rm.action.record-folder-create=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico em outra pasta de documento arquiv\u00edstico. - +rm.action.not-defined=A a\u00e7\u00e3o {0} do Records Management n\u00e3o foi definida. +rm.action.no-implicit-noderef=Houve um erro do sistema e a a\u00e7\u00e3o {0} pode n\u00e3o ter sucesso. +rm.action.record-not-declared=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois o documento arquiv\u00edstico {1} n\u00e3o est\u00e1 conclu\u00eddo. +rm.action.expected-record-level=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois {1} n\u00e3o \u00e9 um documento arquiv\u00edstico. +rm.action.not-all-records-declared=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois nem todos os documentos arquiv\u00edsticos na pasta de documentos arquiv\u00edsticos est\u00e3o conclu\u00eddos. (actionedUponNodeRef={1}) +rm.action.not-eligible=O documento arquiv\u00edstico ou pasta de documento arquiv\u00edstico {1} n\u00e3o est\u00e1 pronto para a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}. +rm.action.no-disposition-instructions=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois nenhuma instru\u00e7\u00e3o de reten\u00e7\u00e3o foi localizada. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois n\u00e3o h\u00e1 conjunto de ciclo de vida de reten\u00e7\u00e3o dispon\u00edvel. (nodeRef={1}) +rm.action.next-disp-not-set=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o n\u00e3o est\u00e1 definida. (nodeRef={1}) +rm.action.not-next-disp=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois esta n\u00e3o \u00e9 a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o para este documento arquiv\u00edstico ou esta pasta de documento arquiv\u00edstico. (nodeRef={1}) +rm.action.not-record-folder=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o de reten\u00e7\u00e3o {0}, pois {1} n\u00e3o \u00e9 uma pasta de documento arquiv\u00edstico. +rm.action.actioned-upon-not-record=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o {0} porque {1} n\u00e3o \u00e9 um documento arquiv\u00edstico. +rm.action.custom-aspect-not-recognised=N\u00e3o \u00e9 poss\u00edvel aplicar o tipo personalizado porque ele n\u00e3o \u00e9 reconhecido. (customAspect={0}) +rm.action.event-no-disp-lc=N\u00e3o \u00e9 poss\u00edvel concluir o evento {0}, pois ele n\u00e3o est\u00e1 definido no ciclo de vida da reten\u00e7\u00e3o. +rm.action.undeclared-only-records=Apenas documentos arquiv\u00edsticos podem ser conclu\u00eddos. (nodeRef={0}) +rm.action.no-declare-mand-prop=Voc\u00ea deve definir todas as propriedades obrigat\u00f3rias do documento arquiv\u00edstico antes de poder concluir o documento arquiv\u00edstico. +rm.action.ghosted-prop-update=N\u00e3o \u00e9 poss\u00edvel atualizar as propriedades de um documento arquiv\u00edstico destru\u00eddo anteriormente. +rm.action.valid-date-disp-asof=Insira uma data v\u00e1lida para a data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o. +rm.action.disp-asof-lifecycle-applied=N\u00e3o \u00e9 poss\u00edvel editar a data de in\u00edcio da reten\u00e7\u00e3o de um documento arquiv\u00edstico ou uma pasta de documento arquiv\u00edstico que tenha um ciclo de vida aplicado. +rm.action.hold-edit-reason-none=N\u00e3o \u00e9 poss\u00edvel editar o motivo para manter, pois a espera foi criada sem um motivo. Tente recriar a espera. +rm.action.hold-edit-type=N\u00e3o \u00e9 poss\u00edvel editar o motivo para manter de {1}, pois isso n\u00e3o \u00e9 uma espera. +rm.action.specify-avlid-date=Insira uma data v\u00e1lida para a data de in\u00edcio da revis\u00e3o. +rm.action.review-details-only=Voc\u00ea somente pode editar os detalhes de revis\u00e3o de documentos arquiv\u00edsticos vitais. +rm.action.freeze-no-reason=N\u00e3o \u00e9 poss\u00edvel manter um documento arquiv\u00edstico sem um motivo. Adicione um motivo para manter. +rm.action.freeze-only-records-folders=Voc\u00ea pode manter somente documentos arquiv\u00edsticos ou pastas de documentos arquiv\u00edsticos. +rm.action.no-open-record-folder=N\u00e3o \u00e9 poss\u00edvel reabrir {0}, pois isso n\u00e3o \u00e9 uma pasta de documento arquiv\u00edstico. +rm.action.not-hold-type=N\u00e3o \u00e9 poss\u00edvel realizar a a\u00e7\u00e3o em {1}, pois isso n\u00e3o \u00e9 uma espera. +rm.action.no-read-mime-message=N\u00e3o foi poss\u00edvel ler a mensagem de tipo de arquivo, pois {0}. +rm.action.email-declared=N\u00e3o foi poss\u00edvel dividir o e-mail, pois o documento arquiv\u00edstico est\u00e1 conclu\u00eddo. (actionedUponNodeRef={0}) +rm.action.email-not-record=N\u00e3o foi poss\u00edvel dividir o e-mail, pois o arquivo, pasta ou categoria n\u00e3o \u00e9 um documento arquiv\u00edstico. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=N\u00e3o foi poss\u00edvel criar uma associa\u00e7\u00e3o secund\u00e1ria personalizada. +rm.action.node-already-transfer=O arquivo, pasta ou categoria j\u00e1 est\u00e1 sendo transferido. +rm.action.node-not-transfer=O arquivo, pasta ou categoria n\u00e3o \u00e9 um objeto de transfer\u00eancia. +rm.action.undo-not-last=N\u00e3o \u00e9 poss\u00edvel desfazer o corte, pois a \u00faltima a\u00e7\u00e3o de reten\u00e7\u00e3o n\u00e3o foi cortada. +rm.action.records_only_undeclared=Voc\u00ea s\u00f3 pode concluir documentos arquiv\u00edsticos. +rm.action.event-not-undone=N\u00e3o \u00e9 poss\u00edvel desfazer o evento {0}, pois ele n\u00e3o est\u00e1 definido no ciclo de vida de reten\u00e7\u00e3o. +rm.action.node-not-record-category=N\u00e3o \u00e9 poss\u00edvel criar uma programa\u00e7\u00e3o de reten\u00e7\u00e3o para ({0}), pois n\u00e3o \u00e9 uma categoria de documento arquiv\u00edstico. +rm.action.parameter-not-supplied=Adicione um(a) ''{0}'' para continuar. +rm.action.delete-not-hold-type=N\u00e3o foi poss\u00edvel excluir a espera, pois {1} n\u00e3o \u00e9 do tipo {0}. +rm.action.cast-to-rm-type=N\u00e3o \u00e9 poss\u00edvel carregar um tipo de pasta personalizada para o plano de arquivo do Records Management. +rm.action.record-folder-create=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico em outra pasta de documento arquiv\u00edstico. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties index 20cab5a8ed..701808232d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 {0} \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e. -rm.action.no-implicit-noderef=\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 {0} \u043c\u043e\u0433\u043b\u043e \u0431\u044b\u0442\u044c \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e. -rm.action.record-not-declared=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0437\u0430\u043f\u0438\u0441\u044c {1} \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043b\u043d\u043e\u0439. -rm.action.expected-record-level=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. -rm.action.not-all-records-declared=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0432 \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. (actionedUponNodeRef={1}) -rm.action.not-eligible=\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 {1} \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}. -rm.action.no-disposition-instructions=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. (nodeRef={1}) -rm.action.next-disp-not-set=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. (nodeRef={1}) -rm.action.not-next-disp=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. (nodeRef={1}) -rm.action.not-record-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.actioned-upon-not-record=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. -rm.action.custom-aspect-not-recognised=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f: \u0442\u0438\u043f \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d. (customAspect={0}) -rm.action.event-no-disp-lc=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 {0}: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. -rm.action.undeclared-only-records=\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e. (nodeRef={0}) -rm.action.no-declare-mand-prop=\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.ghosted-prop-update=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.valid-date-disp-asof=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u0430\u0442\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443. -rm.action.disp-asof-lifecycle-applied=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u0430\u0442\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. -rm.action.hold-edit-reason-none=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438: \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443. -rm.action.hold-edit-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 {1}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. -rm.action.specify-avlid-date=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u0430\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0434\u0430\u0442\u0443. -rm.action.review-details-only=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.freeze-no-reason=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u044b. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438. -rm.action.freeze-only-records-folders=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043b\u0438 \u043f\u0430\u043f\u043e\u043a \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.no-open-record-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.action.not-hold-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 {1}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. -rm.action.no-read-mime-message=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0442\u0438\u043f\u0435 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437-\u0437\u0430 {0}. -rm.action.email-declared=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: \u0437\u0430\u043f\u0438\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0439. (actionedUponNodeRef={0}) -rm.action.email-not-record=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: \u0444\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0434\u043e\u0447\u0435\u0440\u043d\u044e\u044e \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u044e. -rm.action.node-already-transfer=\u0424\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f. -rm.action.node-not-transfer=\u0424\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438. -rm.action.undo-not-last=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435: \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435\u043c. -rm.action.records_only_undeclared=\u041c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.event-not-undone=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 {0}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. -rm.action.node-not-record-category=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f ({0}): \u0434\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.parameter-not-supplied=\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 ''{0}'', \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c. -rm.action.delete-not-hold-type=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443: {1} \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0442\u0438\u043f\u0443 {0}. -rm.action.cast-to-rm-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0442\u0438\u043f \u043f\u0430\u043f\u043a\u0438 \u0432 \u0430\u0440\u0445\u0438\u0432 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. -rm.action.record-folder-create=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. - +rm.action.not-defined=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 {0} \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e. +rm.action.no-implicit-noderef=\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 {0} \u043c\u043e\u0433\u043b\u043e \u0431\u044b\u0442\u044c \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e. +rm.action.record-not-declared=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0437\u0430\u043f\u0438\u0441\u044c {1} \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043b\u043d\u043e\u0439. +rm.action.expected-record-level=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. +rm.action.not-all-records-declared=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0432 \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. (actionedUponNodeRef={1}) +rm.action.not-eligible=\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 {1} \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}. +rm.action.no-disposition-instructions=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e. (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. (nodeRef={1}) +rm.action.next-disp-not-set=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. (nodeRef={1}) +rm.action.not-next-disp=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. (nodeRef={1}) +rm.action.not-record-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. +rm.action.actioned-upon-not-record=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 {1} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. +rm.action.custom-aspect-not-recognised=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f: \u0442\u0438\u043f \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d. (customAspect={0}) +rm.action.event-no-disp-lc=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 {0}: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. +rm.action.undeclared-only-records=\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e. (nodeRef={0}) +rm.action.no-declare-mand-prop=\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0441\u0438. +rm.action.ghosted-prop-update=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. +rm.action.valid-date-disp-asof=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u0430\u0442\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443. +rm.action.disp-asof-lifecycle-applied=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u0430\u0442\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b. +rm.action.hold-edit-reason-none=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438: \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443. +rm.action.hold-edit-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 {1}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. +rm.action.specify-avlid-date=\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0434\u0430\u0442\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0434\u0430\u0442\u0443. +rm.action.review-details-only=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. +rm.action.freeze-no-reason=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u044b. \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438. +rm.action.freeze-only-records-folders=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043b\u0438 \u043f\u0430\u043f\u043e\u043a \u0437\u0430\u043f\u0438\u0441\u0435\u0439. +rm.action.no-open-record-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c {0}: \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. +rm.action.not-hold-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 {1}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. +rm.action.no-read-mime-message=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0442\u0438\u043f\u0435 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437-\u0437\u0430 {0}. +rm.action.email-declared=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: \u0437\u0430\u043f\u0438\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0439. (actionedUponNodeRef={0}) +rm.action.email-not-record=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435: \u0444\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0434\u043e\u0447\u0435\u0440\u043d\u044e\u044e \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u044e. +rm.action.node-already-transfer=\u0424\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f. +rm.action.node-not-transfer=\u0424\u0430\u0439\u043b, \u043f\u0430\u043f\u043a\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438. +rm.action.undo-not-last=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435: \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435\u043c. +rm.action.records_only_undeclared=\u041c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438. +rm.action.event-not-undone=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 {0}: \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. +rm.action.node-not-record-category=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f ({0}): \u0434\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. +rm.action.parameter-not-supplied=\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 ''{0}'', \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c. +rm.action.delete-not-hold-type=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443: {1} \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0442\u0438\u043f\u0443 {0}. +rm.action.cast-to-rm-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0442\u0438\u043f \u043f\u0430\u043f\u043a\u0438 \u0432 \u0430\u0440\u0445\u0438\u0432 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. +rm.action.record-folder-create=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_zh_CN.properties index 2fdda420f1..44663bcb67 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service_zh_CN.properties @@ -1,42 +1,42 @@ -rm.action.not-defined=\u5c1a\u672a\u5b9a\u4e49\u8bb0\u5f55\u7ba1\u7406\u64cd\u4f5c {0}\u3002 -rm.action.no-implicit-noderef=\u5b58\u5728\u7cfb\u7edf\u9519\u8bef\uff0c\u56e0\u6b64\u64cd\u4f5c {0} \u65e0\u6cd5\u6210\u529f\u5b8c\u6210\u3002 -rm.action.record-not-declared=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u8bb0\u5f55 {1} \u4e0d\u5b8c\u6574\u3002 -rm.action.expected-record-level=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u3002 -rm.action.not-all-records-declared=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u5e76\u975e\u8bb0\u5f55\u6587\u4ef6\u5939\u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u90fd\u5b8c\u6574\u3002 (actionedUponNodeRef={1}) -rm.action.not-eligible=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 {1} \u672a\u505a\u597d\u4fdd\u7559\u64cd\u4f5c {0} \u51c6\u5907\u3002 -rm.action.no-disposition-instructions=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u65e0\u6cd5\u627e\u5230\u4fdd\u7559\u8bf4\u660e\u3002 (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u6ca1\u6709\u53ef\u7528\u7684\u4fdd\u7559\u751f\u547d\u5468\u671f\u8bbe\u7f6e\u3002 (nodeRef={1}) -rm.action.next-disp-not-set=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u6ca1\u6709\u8bbe\u7f6e\u4e0b\u4e2a\u4fdd\u7559\u64cd\u4f5c\u3002 (nodeRef={1}) -rm.action.not-next-disp=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u8fd9\u5e76\u975e\u8be5\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u4e0b\u4e2a\u4fdd\u7559\u64cd\u4f5c\u3002 (nodeRef={1}) -rm.action.not-record-folder=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.action.actioned-upon-not-record=\u65e0\u6cd5\u6267\u884c\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u3002 -rm.action.custom-aspect-not-recognised=\u56e0\u4e3a\u672a\u8bc6\u522b\u81ea\u5b9a\u4e49\u7c7b\u578b\uff0c\u6240\u4ee5\u65e0\u6cd5\u5e94\u7528\u3002 (customAspect={0}) -rm.action.event-no-disp-lc=\u65e0\u6cd5\u5b8c\u6210\u4e8b\u4ef6 {0}\uff0c\u56e0\u4e3a\u5176\u672a\u5728\u4fdd\u7559\u751f\u547d\u5468\u671f\u4e0a\u5b9a\u4e49\u3002 -rm.action.undeclared-only-records=\u4ec5\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 (nodeRef={0}) -rm.action.no-declare-mand-prop=\u60a8\u9700\u8981\u8bbe\u7f6e\u6240\u6709\u8bb0\u5f55\u7684\u5fc5\u9009\u5c5e\u6027\uff0c\u7136\u540e\u624d\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 -rm.action.ghosted-prop-update=\u60a8\u65e0\u6cd5\u66f4\u65b0\u5148\u524d\u5df2\u9500\u6bc1\u8bb0\u5f55\u7684\u5c5e\u6027\u3002 -rm.action.valid-date-disp-asof=\u8f93\u5165\u6709\u6548\u65e5\u671f\u4f5c\u4e3a\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f\u3002 -rm.action.disp-asof-lifecycle-applied=\u60a8\u65e0\u6cd5\u7f16\u8f91\u5e94\u7528\u4e86\u751f\u547d\u5468\u671f\u7684\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u4fdd\u7559\u622a\u6b62\u65e5\u671f\u3002 -rm.action.hold-edit-reason-none=\u60a8\u65e0\u6cd5\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0\uff0c\u56e0\u4e3a\u4fdd\u5b58\u662f\u5728\u6ca1\u6709\u539f\u56e0\u7684\u60c5\u51b5\u4e0b\u521b\u5efa\u7684\u3002 \u8bf7\u5c1d\u8bd5\u91cd\u65b0\u521b\u5efa\u4fdd\u5b58\u3002 -rm.action.hold-edit-type=\u60a8\u65e0\u6cd5\u7f16\u8f91 {1} \u7684\u4fdd\u5b58\u539f\u56e0\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u4fdd\u5b58\u3002 -rm.action.specify-avlid-date=\u8f93\u5165\u6709\u6548\u65e5\u671f\u4f5c\u4e3a\u590d\u67e5\u622a\u6b62\u65e5\u671f\u3002 -rm.action.review-details-only=\u60a8\u53ea\u80fd\u7f16\u8f91\u6709\u6548\u8bb0\u5f55\u7684\u590d\u67e5\u8be6\u7ec6\u4fe1\u606f\u3002 -rm.action.freeze-no-reason=\u60a8\u4e0d\u80fd\u5728\u6ca1\u6709\u539f\u56e0\u7684\u60c5\u51b5\u4e0b\u4fdd\u5b58\u8bb0\u5f55\u3002 \u6dfb\u52a0\u4fdd\u5b58\u7684\u539f\u56e0\u3002 -rm.action.freeze-only-records-folders=\u60a8\u53ea\u80fd\u4fdd\u5b58\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.action.no-open-record-folder=\u60a8\u65e0\u6cd5\u91cd\u65b0\u6253\u5f00 {0}\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.action.not-hold-type=\u60a8\u65e0\u6cd5\u5bf9 {1} \u6267\u884c\u64cd\u4f5c\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u4fdd\u5b58\u3002 -rm.action.no-read-mime-message=\u65e0\u6cd5\u8bfb\u53d6\u6587\u4ef6\u7c7b\u578b\u6d88\u606f\uff0c\u539f\u56e0\u4e3a {0}\u3002 -rm.action.email-declared=\u6211\u4eec\u65e0\u6cd5\u62c6\u5206\u7535\u5b50\u90ae\u4ef6\uff0c\u56e0\u4e3a\u8bb0\u5f55\u5df2\u5b8c\u6210\u3002 (actionedUponNodeRef={0}) -rm.action.email-not-record=\u6211\u4eec\u65e0\u6cd5\u62c6\u5206\u7535\u5b50\u90ae\u4ef6\uff0c\u56e0\u4e3a\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u4e0d\u662f\u8bb0\u5f55\u3002 (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u81ea\u5b9a\u4e49\u5b50\u5173\u8054\u3002 -rm.action.node-already-transfer=\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u5df2\u88ab\u4f20\u8f93\u3002 -rm.action.node-not-transfer=\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u4e0d\u662f\u4f20\u8f93\u5bf9\u8c61\u3002 -rm.action.undo-not-last=\u60a8\u65e0\u6cd5\u64a4\u9500\u4e2d\u65ad\uff0c\u56e0\u4e3a\u4e0a\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u6ca1\u6709\u4e2d\u65ad\u3002 -rm.action.records_only_undeclared=\u60a8\u53ea\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 -rm.action.event-not-undone=\u60a8\u65e0\u6cd5\u64a4\u9500\u4e8b\u4ef6 {0}\uff0c\u56e0\u4e3a\u5176\u672a\u5728\u4fdd\u7559\u751f\u547d\u5468\u671f\u4e0a\u5b9a\u4e49\u3002 -rm.action.node-not-record-category=\u60a8\u65e0\u6cd5\u4e3a ({0}) \u521b\u5efa\u4fdd\u7559\u8ba1\u5212\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u8bb0\u5f55\u7c7b\u522b\u3002 -rm.action.parameter-not-supplied=\u6dfb\u52a0\u4e00\u4e2a ''{0}'' \u4ee5\u7ee7\u7eed\u3002 -rm.action.delete-not-hold-type=\u6211\u4eec\u65e0\u6cd5\u5220\u9664\u4fdd\u5b58\uff0c\u56e0\u4e3a {1} \u5e76\u672a {0} \u7c7b\u578b\u3002 -rm.action.cast-to-rm-type=\u60a8\u65e0\u6cd5\u4e0a\u4f20\u81ea\u5b9a\u4e49\u6587\u4ef6\u5939\u7c7b\u578b\u5230\u8bb0\u5f55\u7ba1\u7406\u5f52\u7c7b\u65b9\u6848\u3002 -rm.action.record-folder-create=\u60a8\u65e0\u6cd5\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 - +rm.action.not-defined=\u5c1a\u672a\u5b9a\u4e49\u8bb0\u5f55\u7ba1\u7406\u64cd\u4f5c {0}\u3002 +rm.action.no-implicit-noderef=\u5b58\u5728\u7cfb\u7edf\u9519\u8bef\uff0c\u56e0\u6b64\u64cd\u4f5c {0} \u65e0\u6cd5\u6210\u529f\u5b8c\u6210\u3002 +rm.action.record-not-declared=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u8bb0\u5f55 {1} \u4e0d\u5b8c\u6574\u3002 +rm.action.expected-record-level=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u3002 +rm.action.not-all-records-declared=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u5e76\u975e\u8bb0\u5f55\u6587\u4ef6\u5939\u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u90fd\u5b8c\u6574\u3002 (actionedUponNodeRef={1}) +rm.action.not-eligible=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 {1} \u672a\u505a\u597d\u4fdd\u7559\u64cd\u4f5c {0} \u51c6\u5907\u3002 +rm.action.no-disposition-instructions=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u65e0\u6cd5\u627e\u5230\u4fdd\u7559\u8bf4\u660e\u3002 (nodeRef={1}) +rm.action.no-disposition-lisfecycle-set=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u6ca1\u6709\u53ef\u7528\u7684\u4fdd\u7559\u751f\u547d\u5468\u671f\u8bbe\u7f6e\u3002 (nodeRef={1}) +rm.action.next-disp-not-set=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u6ca1\u6709\u8bbe\u7f6e\u4e0b\u4e2a\u4fdd\u7559\u64cd\u4f5c\u3002 (nodeRef={1}) +rm.action.not-next-disp=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a\u8fd9\u5e76\u975e\u8be5\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u4e0b\u4e2a\u4fdd\u7559\u64cd\u4f5c\u3002 (nodeRef={1}) +rm.action.not-record-folder=\u65e0\u6cd5\u6267\u884c\u4fdd\u7559\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 +rm.action.actioned-upon-not-record=\u65e0\u6cd5\u6267\u884c\u64cd\u4f5c {0}\uff0c\u56e0\u4e3a {1} \u4e0d\u662f\u8bb0\u5f55\u3002 +rm.action.custom-aspect-not-recognised=\u56e0\u4e3a\u672a\u8bc6\u522b\u81ea\u5b9a\u4e49\u7c7b\u578b\uff0c\u6240\u4ee5\u65e0\u6cd5\u5e94\u7528\u3002 (customAspect={0}) +rm.action.event-no-disp-lc=\u65e0\u6cd5\u5b8c\u6210\u4e8b\u4ef6 {0}\uff0c\u56e0\u4e3a\u5176\u672a\u5728\u4fdd\u7559\u751f\u547d\u5468\u671f\u4e0a\u5b9a\u4e49\u3002 +rm.action.undeclared-only-records=\u4ec5\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 (nodeRef={0}) +rm.action.no-declare-mand-prop=\u60a8\u9700\u8981\u8bbe\u7f6e\u6240\u6709\u8bb0\u5f55\u7684\u5fc5\u9009\u5c5e\u6027\uff0c\u7136\u540e\u624d\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 +rm.action.ghosted-prop-update=\u60a8\u65e0\u6cd5\u66f4\u65b0\u5148\u524d\u5df2\u9500\u6bc1\u8bb0\u5f55\u7684\u5c5e\u6027\u3002 +rm.action.valid-date-disp-asof=\u8f93\u5165\u6709\u6548\u65e5\u671f\u4f5c\u4e3a\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f\u3002 +rm.action.disp-asof-lifecycle-applied=\u60a8\u65e0\u6cd5\u7f16\u8f91\u5e94\u7528\u4e86\u751f\u547d\u5468\u671f\u7684\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u4fdd\u7559\u622a\u6b62\u65e5\u671f\u3002 +rm.action.hold-edit-reason-none=\u60a8\u65e0\u6cd5\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0\uff0c\u56e0\u4e3a\u4fdd\u5b58\u662f\u5728\u6ca1\u6709\u539f\u56e0\u7684\u60c5\u51b5\u4e0b\u521b\u5efa\u7684\u3002 \u8bf7\u5c1d\u8bd5\u91cd\u65b0\u521b\u5efa\u4fdd\u5b58\u3002 +rm.action.hold-edit-type=\u60a8\u65e0\u6cd5\u7f16\u8f91 {1} \u7684\u4fdd\u5b58\u539f\u56e0\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u4fdd\u5b58\u3002 +rm.action.specify-avlid-date=\u8f93\u5165\u6709\u6548\u65e5\u671f\u4f5c\u4e3a\u590d\u67e5\u622a\u6b62\u65e5\u671f\u3002 +rm.action.review-details-only=\u60a8\u53ea\u80fd\u7f16\u8f91\u6709\u6548\u8bb0\u5f55\u7684\u590d\u67e5\u8be6\u7ec6\u4fe1\u606f\u3002 +rm.action.freeze-no-reason=\u60a8\u4e0d\u80fd\u5728\u6ca1\u6709\u539f\u56e0\u7684\u60c5\u51b5\u4e0b\u4fdd\u5b58\u8bb0\u5f55\u3002 \u6dfb\u52a0\u4fdd\u5b58\u7684\u539f\u56e0\u3002 +rm.action.freeze-only-records-folders=\u60a8\u53ea\u80fd\u4fdd\u5b58\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 +rm.action.no-open-record-folder=\u60a8\u65e0\u6cd5\u91cd\u65b0\u6253\u5f00 {0}\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 +rm.action.not-hold-type=\u60a8\u65e0\u6cd5\u5bf9 {1} \u6267\u884c\u64cd\u4f5c\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u4fdd\u5b58\u3002 +rm.action.no-read-mime-message=\u65e0\u6cd5\u8bfb\u53d6\u6587\u4ef6\u7c7b\u578b\u6d88\u606f\uff0c\u539f\u56e0\u4e3a {0}\u3002 +rm.action.email-declared=\u6211\u4eec\u65e0\u6cd5\u62c6\u5206\u7535\u5b50\u90ae\u4ef6\uff0c\u56e0\u4e3a\u8bb0\u5f55\u5df2\u5b8c\u6210\u3002 (actionedUponNodeRef={0}) +rm.action.email-not-record=\u6211\u4eec\u65e0\u6cd5\u62c6\u5206\u7535\u5b50\u90ae\u4ef6\uff0c\u56e0\u4e3a\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u4e0d\u662f\u8bb0\u5f55\u3002 (actionedUponNodeRef={0}) +rm.action.email-create-child-assoc=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u81ea\u5b9a\u4e49\u5b50\u5173\u8054\u3002 +rm.action.node-already-transfer=\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u5df2\u88ab\u4f20\u8f93\u3002 +rm.action.node-not-transfer=\u6587\u4ef6\u3001\u6587\u4ef6\u5939\u6216\u7c7b\u522b\u4e0d\u662f\u4f20\u8f93\u5bf9\u8c61\u3002 +rm.action.undo-not-last=\u60a8\u65e0\u6cd5\u64a4\u9500\u4e2d\u65ad\uff0c\u56e0\u4e3a\u4e0a\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u6ca1\u6709\u4e2d\u65ad\u3002 +rm.action.records_only_undeclared=\u60a8\u53ea\u80fd\u5b8c\u6210\u8bb0\u5f55\u3002 +rm.action.event-not-undone=\u60a8\u65e0\u6cd5\u64a4\u9500\u4e8b\u4ef6 {0}\uff0c\u56e0\u4e3a\u5176\u672a\u5728\u4fdd\u7559\u751f\u547d\u5468\u671f\u4e0a\u5b9a\u4e49\u3002 +rm.action.node-not-record-category=\u60a8\u65e0\u6cd5\u4e3a ({0}) \u521b\u5efa\u4fdd\u7559\u8ba1\u5212\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u8bb0\u5f55\u7c7b\u522b\u3002 +rm.action.parameter-not-supplied=\u6dfb\u52a0\u4e00\u4e2a ''{0}'' \u4ee5\u7ee7\u7eed\u3002 +rm.action.delete-not-hold-type=\u6211\u4eec\u65e0\u6cd5\u5220\u9664\u4fdd\u5b58\uff0c\u56e0\u4e3a {1} \u5e76\u672a {0} \u7c7b\u578b\u3002 +rm.action.cast-to-rm-type=\u60a8\u65e0\u6cd5\u4e0a\u4f20\u81ea\u5b9a\u4e49\u6587\u4ef6\u5939\u7c7b\u578b\u5230\u8bb0\u5f55\u7ba1\u7406\u5f52\u7c7b\u65b9\u6848\u3002 +rm.action.record-folder-create=\u60a8\u65e0\u6cd5\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties index 40fa60e0d6..3b4c93b3d4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Classified by Retention Schedule -isClassified.description=Records or record folders been classified by a retention schedule - -# Are cutoff -isCutoff.title=Cut Off -isCutoff.description=Records or record folders are cut off - -# Are declared -isDeclared.title=Record Completed -isDeclared.description=Record is complete - -# Is on hold -isFrozen.title=On Hold -isFrozen.description=Record or record folder on hold - -# Are filed -isRecordFiled.title=Record Filed -isRecordFiled.description=Record is filed - -# Are closed record folders -isRecordFolderClosed.title=Record Folder Closed -isRecordFolderClosed.description=Record folder is closed - -# Are vital -isVital.title=Vital Record -isVital.description=Record or record folder is a vital record - -# Have Rentention Action -hasDispositionAction.title=Has Retention Action -hasDispositionAction.description=Records and folders have the specified associated retention action at the specified relative position - -# Are kind -isKind.title=Type of Records Management Item -isKind.description=Items are a file plan component kind -isKind.kind.display-label=Kind - -# Are Record Type -isRecordType.title=Has Record Type -isRecordType.description=Records have a specified record type - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=Declare as Record -create-record.description=Declares file as a record -create-record.file-plan.display-label=File Plan -create-record.hide-record.display-label=Hide Record -# Declare As Version Record -declare-as-version-record.title=Declare Version as Record -declare-as-version-record.description=Declares this version of the file as a record -declare-as-version-record.file-plan.display-label=File Plan -# Complete record -declareRecord.title=Complete Record -declareRecord.description=Completes a record -# Reopens record -undeclareRecord.title=Reopen Record -undeclareRecord.description=Reopens a record -# Open record folder -openRecordFolder.title=Open Record Folder -openRecordFolder.description=Opens a record folder -# Close record folder -closeRecordFolder.title=Close Record Folder -closeRecordFolder.description=Closes a Record Folder -# Complete event -completeEvent.title=Complete Event -completeEvent.description=Completes an event -completeEvent.eventName.display-label=Event -# Freeze -freeze.title=Freeze -freeze.description=Freezes a record -freeze.reason.display-label=Reason -# Unfreeze -unfreeze.title=Unfreeze -unfreeze.description=Unfreezes a record -# File to -fileTo.title=File to -fileTo.description=Files a record to the specified record folder -fileTo.path.display-label=Path to Record Folder -fileTo.createRecordPath.display-label=Create Record Path -# Copy to -copyTo.title=Copy to -copyTo.description=Copies a record to the specified record folder -copyTo.path.display-label=Path to Record Folder -copyTo.createRecordPath.display-label=Create Record Path -# Move to -moveTo.title=Move to -moveTo.description=Moves a record to the specified record folder -moveTo.path.display-label=Path to Record Folder -moveTo.createRecordPath.display-label=Create Record Path -# Link to -linkTo.title=Link to -linkTo.description=Links a record to the specified record folder -linkTo.path.display-label=Path to Record Folder -linkTo.createRecordPath.display-label=Create Record Path -# Reject -reject.title=Reject -reject.description=Rejects a record and moves the file to its original location -reject.reason.display-label=Reject Reason -# Request Information -requestInfo.title=Request Information -requestInfo.description=Starts a workflow for requesting more information for a record -# Execute script -executeScript.title=Execute Script -executeScript.description=Execute a script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Send Email -sendEmail.description=Send an email -# Set Property -setPropertyValue.title=Set Property Value -setPropertyValue.description=Set a property value - -# Edit Hold Reason -editHoldReason.title=Edit Hold Reason -editHoldReason.description=Edit the hold reason -# Relinquish Hold -relinquishHold.title=Relinquish Hold -relinquishHold.description=Relinquish the hold -# Edit Review As Of Date -editReviewAsOfDate.title=Edit Review As Of Date -editReviewAsOfDate.description=Edit review as of date -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Edit Retention Action As Of Date -editDispositionActionAsOfDate.description=Edit the retention action as of date -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Broadcast Vital Record Definition -broadcastVitalRecordDefinition.description=Broadcast the vital record definition -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Broadcast Retention Action Definition Update -broadcastDispositionActionDefinitionUpdate.description=Broadcast retention action definition update -# Undo Event -undoEvent.title=Undo Event -undoEvent.description=Undo event -# Transfer Complete -transferComplete.title=Transfer Complete -transferComplete.description=Transfer complete -# Accession Complete -accessionComplete.title=Accession Complete -accessionComplete.description=Accession complete -# Split Email -splitEmail.title=Split Email -splitEmail.description=Split email -# Create Rentention Schedule -createDispositionSchedule.title=Create Retention Schedule -createDispositionSchedule.description=Create retention schedule -# File Destruction Report -fileDestructionReport.title=File Destruction Report -fileDestructionReport.description=File destruction report -# Cut off -cutoff.title=Cut Off -cutoff.description=Cut off -# Destroy -destroy.title=Destroy -destroy.description=Destroy -# Reviewed -reviewed.title=Reviewed -reviewed.description=Reviewed -# Hide Record -hide-record.title=Hide Record -hide-record.description=Hide record -# Transfer -transfer.title=Transfer -transfer.description=Transfer -# Uncut off -unCutoff.title=Undo Cut Off -unCutoff.description=Undo cut off -# Accession -accession.title=Accession -accession.description=Accession -# Retain -retain.title=Retain -retain.description=Retain -# Add Record Types -addRecordTypes.title=Add Record Types -addRecordTypes.description=Adds the selected type(s) to the record -# File report -fileReport.title=File Report -fileReport.description=File report -# Delete Hold -deleteHold.title=Delete Hold -deleteHold.description=Delete hold -# Move DM record -move-dm-record.title=Move Record -move-dm-record.description=Move record -# Unlink from -unlinkFrom.title=Unlink from -unlinkFrom.description=Unlink from - -# Recordable version config -recordable-version-config.title=Auto-Declare Options -recordable-version-config.description=Auto-Declare Options -recordable-version-config.version.display-label=Automatically declare versions as records - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Record Category -rm-ac-is-kind-kinds.record_folder=Record Folder -rm-ac-is-kind-kinds.record=Record - -rm-ac-disposition-action-relative-positions.next=Next -rm-ac-disposition-action-relative-positions.previous=Previous -rm-ac-disposition-action-relative-positions.any=Any - -ac-versions.none=Never -ac-versions.major_only=For major versions only +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=Classified by Retention Schedule +isClassified.description=Records or record folders been classified by a retention schedule + +# Are cutoff +isCutoff.title=Cut Off +isCutoff.description=Records or record folders are cut off + +# Are declared +isDeclared.title=Record Completed +isDeclared.description=Record is complete + +# Is on hold +isFrozen.title=On Hold +isFrozen.description=Record or record folder on hold + +# Are filed +isRecordFiled.title=Record Filed +isRecordFiled.description=Record is filed + +# Are closed record folders +isRecordFolderClosed.title=Record Folder Closed +isRecordFolderClosed.description=Record folder is closed + +# Are vital +isVital.title=Vital Record +isVital.description=Record or record folder is a vital record + +# Have Rentention Action +hasDispositionAction.title=Has Retention Action +hasDispositionAction.description=Records and folders have the specified associated retention action at the specified relative position + +# Are kind +isKind.title=Type of Records Management Item +isKind.description=Items are a file plan component kind +isKind.kind.display-label=Kind + +# Are Record Type +isRecordType.title=Has Record Type +isRecordType.description=Records have a specified record type + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=Declare as Record +create-record.description=Declares file as a record +create-record.file-plan.display-label=File Plan +create-record.hide-record.display-label=Hide Record +# Declare As Version Record +declare-as-version-record.title=Declare Version as Record +declare-as-version-record.description=Declares this version of the file as a record +declare-as-version-record.file-plan.display-label=File Plan +# Complete record +declareRecord.title=Complete Record +declareRecord.description=Completes a record +# Reopens record +undeclareRecord.title=Reopen Record +undeclareRecord.description=Reopens a record +# Open record folder +openRecordFolder.title=Open Record Folder +openRecordFolder.description=Opens a record folder +# Close record folder +closeRecordFolder.title=Close Record Folder +closeRecordFolder.description=Closes a Record Folder +# Complete event +completeEvent.title=Complete Event +completeEvent.description=Completes an event +completeEvent.eventName.display-label=Event +# Freeze +freeze.title=Freeze +freeze.description=Freezes a record +freeze.reason.display-label=Reason +# Unfreeze +unfreeze.title=Unfreeze +unfreeze.description=Unfreezes a record +# File to +fileTo.title=File to +fileTo.description=Files a record to the specified record folder +fileTo.path.display-label=Path to Record Folder +fileTo.createRecordPath.display-label=Create Record Path +# Copy to +copyTo.title=Copy to +copyTo.description=Copies a record to the specified record folder +copyTo.path.display-label=Path to Record Folder +copyTo.createRecordPath.display-label=Create Record Path +# Move to +moveTo.title=Move to +moveTo.description=Moves a record to the specified record folder +moveTo.path.display-label=Path to Record Folder +moveTo.createRecordPath.display-label=Create Record Path +# Link to +linkTo.title=Link to +linkTo.description=Links a record to the specified record folder +linkTo.path.display-label=Path to Record Folder +linkTo.createRecordPath.display-label=Create Record Path +# Reject +reject.title=Reject +reject.description=Rejects a record and moves the file to its original location +reject.reason.display-label=Reject Reason +# Request Information +requestInfo.title=Request Information +requestInfo.description=Starts a workflow for requesting more information for a record +# Execute script +executeScript.title=Execute Script +executeScript.description=Execute a script +executeScript.script-ref.display-label=Script +# Send Email +sendEmail.title=Send Email +sendEmail.description=Send an email +# Set Property +setPropertyValue.title=Set Property Value +setPropertyValue.description=Set a property value + +# Edit Hold Reason +editHoldReason.title=Edit Hold Reason +editHoldReason.description=Edit the hold reason +# Relinquish Hold +relinquishHold.title=Relinquish Hold +relinquishHold.description=Relinquish the hold +# Edit Review As Of Date +editReviewAsOfDate.title=Edit Review As Of Date +editReviewAsOfDate.description=Edit review as of date +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=Edit Retention Action As Of Date +editDispositionActionAsOfDate.description=Edit the retention action as of date +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=Broadcast Vital Record Definition +broadcastVitalRecordDefinition.description=Broadcast the vital record definition +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=Broadcast Retention Action Definition Update +broadcastDispositionActionDefinitionUpdate.description=Broadcast retention action definition update +# Undo Event +undoEvent.title=Undo Event +undoEvent.description=Undo event +# Transfer Complete +transferComplete.title=Transfer Complete +transferComplete.description=Transfer complete +# Accession Complete +accessionComplete.title=Accession Complete +accessionComplete.description=Accession complete +# Split Email +splitEmail.title=Split Email +splitEmail.description=Split email +# Create Rentention Schedule +createDispositionSchedule.title=Create Retention Schedule +createDispositionSchedule.description=Create retention schedule +# File Destruction Report +fileDestructionReport.title=File Destruction Report +fileDestructionReport.description=File destruction report +# Cut off +cutoff.title=Cut Off +cutoff.description=Cut off +# Destroy +destroy.title=Destroy +destroy.description=Destroy +# Reviewed +reviewed.title=Reviewed +reviewed.description=Reviewed +# Hide Record +hide-record.title=Hide Record +hide-record.description=Hide record +# Transfer +transfer.title=Transfer +transfer.description=Transfer +# Uncut off +unCutoff.title=Undo Cut Off +unCutoff.description=Undo cut off +# Accession +accession.title=Accession +accession.description=Accession +# Retain +retain.title=Retain +retain.description=Retain +# Add Record Types +addRecordTypes.title=Add Record Types +addRecordTypes.description=Adds the selected type(s) to the record +# File report +fileReport.title=File Report +fileReport.description=File report +# Delete Hold +deleteHold.title=Delete Hold +deleteHold.description=Delete hold +# Move DM record +move-dm-record.title=Move Record +move-dm-record.description=Move record +# Unlink from +unlinkFrom.title=Unlink from +unlinkFrom.description=Unlink from + +# Recordable version config +recordable-version-config.title=Auto-Declare Options +recordable-version-config.description=Auto-Declare Options +recordable-version-config.version.display-label=Automatically declare versions as records + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=Record Category +rm-ac-is-kind-kinds.record_folder=Record Folder +rm-ac-is-kind-kinds.record=Record + +rm-ac-disposition-action-relative-positions.next=Next +rm-ac-disposition-action-relative-positions.previous=Previous +rm-ac-disposition-action-relative-positions.any=Any + +ac-versions.none=Never +ac-versions.major_only=For major versions only ac-versions.all=For all major and minor versions \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties index 99e6c1ead2..9d16bc1422 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Nach Aufbewahrungsplan klassifiziert -isClassified.description=Records oder Record-Ordner wurden nach einem Aufbewahrungsplan klassifiziert. - -# Are cutoff -isCutoff.title=Trennen -isCutoff.description=Records oder Record-Ordner sind getrennt. - -# Are declared -isDeclared.title=Record abgeschlossen -isDeclared.description=Record ist abgeschlossen. - -# Is on hold -isFrozen.title=Gesperrt -isFrozen.description=Record oder Record-Ordner ist gesperrt. - -# Are filed -isRecordFiled.title=Record abgelegt -isRecordFiled.description=Record ist angelegt. - -# Are closed record folders -isRecordFolderClosed.title=Record-Ordner geschlossen -isRecordFolderClosed.description=Record-Ordner ist geschlossen. - -# Are vital -isVital.title=Besonders relevanter Record -isVital.description=Record oder Record-Ordner ist ein besonders relevanter Record. - -# Have Rentention Action -hasDispositionAction.title=Hat Aufbewahrungsaktion -hasDispositionAction.description=Records und Ordner verf\u00fcgen \u00fcber die angegebene zugeordnete Aufbewahrungsaktion an der angegebenen relativen Position. - -# Are kind -isKind.title=Typ des Records Management Elements -isKind.description=Elemente sind vom Typ Ablageplan-Komponente. -isKind.kind.display-label=Art - -# Are Record Type -isRecordType.title=Hat Record-Typ -isRecordType.description=Records verf\u00fcgen \u00fcber einen angegebenen Record-Typ. - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=Als Record deklarieren -create-record.description=Deklariert die Datei als Record -create-record.file-plan.display-label=Ablageplan -create-record.hide-record.display-label=Record ausblenden -# Declare As Version Record -declare-as-version-record.title=Version als Record deklarieren -declare-as-version-record.description=Deklariert diese Version der Datei als Record -declare-as-version-record.file-plan.display-label=Ablageplan -# Complete record -declareRecord.title=Record abschlie\u00dfen -declareRecord.description=Schlie\u00dft einen Record ab -# Reopens record -undeclareRecord.title=Record neu \u00f6ffnen -undeclareRecord.description=\u00d6ffnet einen Record neu -# Open record folder -openRecordFolder.title=Record-Ordner \u00f6ffnen -openRecordFolder.description=\u00d6ffnet einen Record-Ordner -# Close record folder -closeRecordFolder.title=Record-Ordner schlie\u00dfen -closeRecordFolder.description=Schlie\u00dft einen Record-Ordner -# Complete event -completeEvent.title=Ereignis abschlie\u00dfen -completeEvent.description=Schlie\u00dft ein Ereignis ab -completeEvent.eventName.display-label=Ereignis -# Freeze -freeze.title=Fixieren -freeze.description=Fixiert einen Record -freeze.reason.display-label=Grund -# Unfreeze -unfreeze.title=Fixierung aufheben -unfreeze.description=Hebt die Fixierung eines Record auf -# File to -fileTo.title=Ablegen unter -fileTo.description=Legt einen Record in einem bestimmten Record-Ordner ab -fileTo.path.display-label=Pfad zum Record-Ordner -fileTo.createRecordPath.display-label=Record-Pfad erstellen -# Copy to -copyTo.title=Kopieren nach -copyTo.description=Kopiert einen Record in einen bestimmten Record-Ordner -copyTo.path.display-label=Pfad zum Record-Ordner -copyTo.createRecordPath.display-label=Record-Pfad erstellen -# Move to -moveTo.title=Verschieben nach -moveTo.description=Verschiebt einen Record in einen bestimmten Record-Ordner -moveTo.path.display-label=Pfad zum Record-Ordner -moveTo.createRecordPath.display-label=Record-Pfad erstellen -# Link to -linkTo.title=Link zu -linkTo.description=Verkn\u00fcpft einen Record mit einem bestimmten Record-Ordner -linkTo.path.display-label=Pfad zum Record-Ordner -linkTo.createRecordPath.display-label=Record-Pfad erstellen -# Reject -reject.title=Ablehnen -reject.description=Lehnt einen Record ab und verschiebt die Datei an ihren urspr\u00fcnglichen Speicherort -reject.reason.display-label=Ablehnungsgrund -# Request Information -requestInfo.title=Informationen anfordern -requestInfo.description=Startet einen Workflow zur Anforderung weiterer Informationen zu einem Record. -# Execute script -executeScript.title=Skript ausf\u00fchren -executeScript.description=F\u00fchrt ein Skript aus -executeScript.script-ref.display-label=Skript -# Send Email -sendEmail.title=E-Mail senden -sendEmail.description=Sendet eine E-Mail -# Set Property -setPropertyValue.title=Wert einer Eigenschaft setzen -setPropertyValue.description=Setzt den Wert einer Eigenschaft - -# Edit Hold Reason -editHoldReason.title=Sperrgrund bearbeiten -editHoldReason.description=Bearbeitet den Sperrgrund -# Relinquish Hold -relinquishHold.title=Sperre aufheben -relinquishHold.description=Hebt eine Sperre auf -# Edit Review As Of Date -editReviewAsOfDate.title=Startdatum der \u00dcberpr\u00fcfung bearbeiten -editReviewAsOfDate.description=Bearbeitet das Startdatum der \u00dcberpr\u00fcfung -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Startdatum der Aufbewahrungsaktion bearbeiten -editDispositionActionAsOfDate.description=Bearbeitet das Startdatum der Aufbewahrungsaktion -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Definition f\u00fcr besonders relevanten Record senden -broadcastVitalRecordDefinition.description=Sendet die Definition f\u00fcr einen besonders relevanten Record -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Aktualisierung der Definition der Aufbewahrungsaktion senden -broadcastDispositionActionDefinitionUpdate.description=Sendet die Aktualisierung der Definition der Aufbewahrungsaktion -# Undo Event -undoEvent.title=Ereignis r\u00fcckg\u00e4ngig machen -undoEvent.description=Ereignis r\u00fcckg\u00e4ngig machen -# Transfer Complete -transferComplete.title=\u00dcbertragung abgeschlossen -transferComplete.description=\u00dcbertragung abgeschlossen -# Accession Complete -accessionComplete.title=Aufnahme abgeschlossen -accessionComplete.description=Aufnahme abgeschlossen -# Split Email -splitEmail.title=E-Mail teilen -splitEmail.description=E-Mail teilen -# Create Rentention Schedule -createDispositionSchedule.title=Aufbewahrungsplan erstellen -createDispositionSchedule.description=Erstellt einen Aufbewahrungsplan -# File Destruction Report -fileDestructionReport.title=Vernichtungsprotokoll ablegen -fileDestructionReport.description=Vernichtungsprotokoll ablegen -# Cut off -cutoff.title=Trennen -cutoff.description=Trennen -# Destroy -destroy.title=Vernichten -destroy.description=Vernichten -# Reviewed -reviewed.title=\u00dcberpr\u00fcft -reviewed.description=\u00dcberpr\u00fcft -# Hide Record -hide-record.title=Record ausblenden -hide-record.description=Record ausblenden -# Transfer -transfer.title=\u00dcbertragen -transfer.description=\u00dcbertragen -# Uncut off -unCutoff.title=Trennung aufheben -unCutoff.description=Trennung aufheben -# Accession -accession.title=Aufnahme -accession.description=Aufnahme -# Retain -retain.title=Aufbewahren -retain.description=Aufbewahren -# Add Record Types -addRecordTypes.title=Record-Typen hinzuf\u00fcgen -addRecordTypes.description=F\u00fcgt ausgew\u00e4hlte Typen zum Record hinzu -# File report -fileReport.title=Bericht ablegen -fileReport.description=Bericht ablegen -# Delete Hold -deleteHold.title=Sperrbereich l\u00f6schen -deleteHold.description=Sperrbereich l\u00f6schen -# Move DM record -move-dm-record.title=Record verschieben -move-dm-record.description=Record verschieben -# Unlink from -unlinkFrom.title=Verkn\u00fcpfung aufheben von -unlinkFrom.description=Verkn\u00fcpfung aufheben von - -# Recordable version config -recordable-version-config.title=Optionen f\u00fcr automatische Deklaration -recordable-version-config.description=Optionen f\u00fcr automatische Deklaration -recordable-version-config.version.display-label=Versionen automatisch als Record deklarieren - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Record-Kategorie -rm-ac-is-kind-kinds.record_folder=Record-Ordner -rm-ac-is-kind-kinds.record=Record - -rm-ac-disposition-action-relative-positions.next=Weiter -rm-ac-disposition-action-relative-positions.previous=Vorherige -rm-ac-disposition-action-relative-positions.any=Jede - -ac-versions.none=Nie -ac-versions.major_only=Nur f\u00fcr Hauptversionen +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=Nach Aufbewahrungsplan klassifiziert +isClassified.description=Records oder Record-Ordner wurden nach einem Aufbewahrungsplan klassifiziert. + +# Are cutoff +isCutoff.title=Trennen +isCutoff.description=Records oder Record-Ordner sind getrennt. + +# Are declared +isDeclared.title=Record abgeschlossen +isDeclared.description=Record ist abgeschlossen. + +# Is on hold +isFrozen.title=Gesperrt +isFrozen.description=Record oder Record-Ordner ist gesperrt. + +# Are filed +isRecordFiled.title=Record abgelegt +isRecordFiled.description=Record ist angelegt. + +# Are closed record folders +isRecordFolderClosed.title=Record-Ordner geschlossen +isRecordFolderClosed.description=Record-Ordner ist geschlossen. + +# Are vital +isVital.title=Besonders relevanter Record +isVital.description=Record oder Record-Ordner ist ein besonders relevanter Record. + +# Have Rentention Action +hasDispositionAction.title=Hat Aufbewahrungsaktion +hasDispositionAction.description=Records und Ordner verf\u00fcgen \u00fcber die angegebene zugeordnete Aufbewahrungsaktion an der angegebenen relativen Position. + +# Are kind +isKind.title=Typ des Records Management Elements +isKind.description=Elemente sind vom Typ Ablageplan-Komponente. +isKind.kind.display-label=Art + +# Are Record Type +isRecordType.title=Hat Record-Typ +isRecordType.description=Records verf\u00fcgen \u00fcber einen angegebenen Record-Typ. + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=Als Record deklarieren +create-record.description=Deklariert die Datei als Record +create-record.file-plan.display-label=Ablageplan +create-record.hide-record.display-label=Record ausblenden +# Declare As Version Record +declare-as-version-record.title=Version als Record deklarieren +declare-as-version-record.description=Deklariert diese Version der Datei als Record +declare-as-version-record.file-plan.display-label=Ablageplan +# Complete record +declareRecord.title=Record abschlie\u00dfen +declareRecord.description=Schlie\u00dft einen Record ab +# Reopens record +undeclareRecord.title=Record neu \u00f6ffnen +undeclareRecord.description=\u00d6ffnet einen Record neu +# Open record folder +openRecordFolder.title=Record-Ordner \u00f6ffnen +openRecordFolder.description=\u00d6ffnet einen Record-Ordner +# Close record folder +closeRecordFolder.title=Record-Ordner schlie\u00dfen +closeRecordFolder.description=Schlie\u00dft einen Record-Ordner +# Complete event +completeEvent.title=Ereignis abschlie\u00dfen +completeEvent.description=Schlie\u00dft ein Ereignis ab +completeEvent.eventName.display-label=Ereignis +# Freeze +freeze.title=Fixieren +freeze.description=Fixiert einen Record +freeze.reason.display-label=Grund +# Unfreeze +unfreeze.title=Fixierung aufheben +unfreeze.description=Hebt die Fixierung eines Record auf +# File to +fileTo.title=Ablegen unter +fileTo.description=Legt einen Record in einem bestimmten Record-Ordner ab +fileTo.path.display-label=Pfad zum Record-Ordner +fileTo.createRecordPath.display-label=Record-Pfad erstellen +# Copy to +copyTo.title=Kopieren nach +copyTo.description=Kopiert einen Record in einen bestimmten Record-Ordner +copyTo.path.display-label=Pfad zum Record-Ordner +copyTo.createRecordPath.display-label=Record-Pfad erstellen +# Move to +moveTo.title=Verschieben nach +moveTo.description=Verschiebt einen Record in einen bestimmten Record-Ordner +moveTo.path.display-label=Pfad zum Record-Ordner +moveTo.createRecordPath.display-label=Record-Pfad erstellen +# Link to +linkTo.title=Link zu +linkTo.description=Verkn\u00fcpft einen Record mit einem bestimmten Record-Ordner +linkTo.path.display-label=Pfad zum Record-Ordner +linkTo.createRecordPath.display-label=Record-Pfad erstellen +# Reject +reject.title=Ablehnen +reject.description=Lehnt einen Record ab und verschiebt die Datei an ihren urspr\u00fcnglichen Speicherort +reject.reason.display-label=Ablehnungsgrund +# Request Information +requestInfo.title=Informationen anfordern +requestInfo.description=Startet einen Workflow zur Anforderung weiterer Informationen zu einem Record. +# Execute script +executeScript.title=Skript ausf\u00fchren +executeScript.description=F\u00fchrt ein Skript aus +executeScript.script-ref.display-label=Skript +# Send Email +sendEmail.title=E-Mail senden +sendEmail.description=Sendet eine E-Mail +# Set Property +setPropertyValue.title=Wert einer Eigenschaft setzen +setPropertyValue.description=Setzt den Wert einer Eigenschaft + +# Edit Hold Reason +editHoldReason.title=Sperrgrund bearbeiten +editHoldReason.description=Bearbeitet den Sperrgrund +# Relinquish Hold +relinquishHold.title=Sperre aufheben +relinquishHold.description=Hebt eine Sperre auf +# Edit Review As Of Date +editReviewAsOfDate.title=Startdatum der \u00dcberpr\u00fcfung bearbeiten +editReviewAsOfDate.description=Bearbeitet das Startdatum der \u00dcberpr\u00fcfung +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=Startdatum der Aufbewahrungsaktion bearbeiten +editDispositionActionAsOfDate.description=Bearbeitet das Startdatum der Aufbewahrungsaktion +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=Definition f\u00fcr besonders relevanten Record senden +broadcastVitalRecordDefinition.description=Sendet die Definition f\u00fcr einen besonders relevanten Record +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=Aktualisierung der Definition der Aufbewahrungsaktion senden +broadcastDispositionActionDefinitionUpdate.description=Sendet die Aktualisierung der Definition der Aufbewahrungsaktion +# Undo Event +undoEvent.title=Ereignis r\u00fcckg\u00e4ngig machen +undoEvent.description=Ereignis r\u00fcckg\u00e4ngig machen +# Transfer Complete +transferComplete.title=\u00dcbertragung abgeschlossen +transferComplete.description=\u00dcbertragung abgeschlossen +# Accession Complete +accessionComplete.title=Aufnahme abgeschlossen +accessionComplete.description=Aufnahme abgeschlossen +# Split Email +splitEmail.title=E-Mail teilen +splitEmail.description=E-Mail teilen +# Create Rentention Schedule +createDispositionSchedule.title=Aufbewahrungsplan erstellen +createDispositionSchedule.description=Erstellt einen Aufbewahrungsplan +# File Destruction Report +fileDestructionReport.title=Vernichtungsprotokoll ablegen +fileDestructionReport.description=Vernichtungsprotokoll ablegen +# Cut off +cutoff.title=Trennen +cutoff.description=Trennen +# Destroy +destroy.title=Vernichten +destroy.description=Vernichten +# Reviewed +reviewed.title=\u00dcberpr\u00fcft +reviewed.description=\u00dcberpr\u00fcft +# Hide Record +hide-record.title=Record ausblenden +hide-record.description=Record ausblenden +# Transfer +transfer.title=\u00dcbertragen +transfer.description=\u00dcbertragen +# Uncut off +unCutoff.title=Trennung aufheben +unCutoff.description=Trennung aufheben +# Accession +accession.title=Aufnahme +accession.description=Aufnahme +# Retain +retain.title=Aufbewahren +retain.description=Aufbewahren +# Add Record Types +addRecordTypes.title=Record-Typen hinzuf\u00fcgen +addRecordTypes.description=F\u00fcgt ausgew\u00e4hlte Typen zum Record hinzu +# File report +fileReport.title=Bericht ablegen +fileReport.description=Bericht ablegen +# Delete Hold +deleteHold.title=Sperrbereich l\u00f6schen +deleteHold.description=Sperrbereich l\u00f6schen +# Move DM record +move-dm-record.title=Record verschieben +move-dm-record.description=Record verschieben +# Unlink from +unlinkFrom.title=Verkn\u00fcpfung aufheben von +unlinkFrom.description=Verkn\u00fcpfung aufheben von + +# Recordable version config +recordable-version-config.title=Optionen f\u00fcr automatische Deklaration +recordable-version-config.description=Optionen f\u00fcr automatische Deklaration +recordable-version-config.version.display-label=Versionen automatisch als Record deklarieren + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=Record-Kategorie +rm-ac-is-kind-kinds.record_folder=Record-Ordner +rm-ac-is-kind-kinds.record=Record + +rm-ac-disposition-action-relative-positions.next=Weiter +rm-ac-disposition-action-relative-positions.previous=Vorherige +rm-ac-disposition-action-relative-positions.any=Jede + +ac-versions.none=Nie +ac-versions.major_only=Nur f\u00fcr Hauptversionen ac-versions.all=F\u00fcr alle Haupt- und Nebenversionen \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties index f95845da4a..f6514b27d5 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Clasificado por planificaci\u00f3n de retenci\u00f3n -isClassified.description=Los documentos de archivo o las carpetas de documentos de archivo se han clasificado por una planificaci\u00f3n de retenci\u00f3n - -# Are cutoff -isCutoff.title=Interrumpir -isCutoff.description=Los documentos de archivo o las carpetas de documentos de archivo est\u00e1n interrumpidos - -# Are declared -isDeclared.title=Documento de archivo completado -isDeclared.description=Documento de archivo completo - -# Is on hold -isFrozen.title=En espera -isFrozen.description=Documento de archivo o carpeta de documentos de archivo en espera - -# Are filed -isRecordFiled.title=Documento de archivo archivado -isRecordFiled.description=El documento de archivo se ha archivado - -# Are closed record folders -isRecordFolderClosed.title=Carpeta de documentos de archivo cerrada -isRecordFolderClosed.description=La carpeta de documentos de archivo est\u00e1 cerrada - -# Are vital -isVital.title=Documento de archivo vital -isVital.description=El documento de archivo o la carpeta de documentos de archivo es un documento de archivo vital - -# Have Rentention Action -hasDispositionAction.title=Tiene acci\u00f3n de retenci\u00f3n -hasDispositionAction.description=Los documentos de archivo y las carpetas tienen la acci\u00f3n de retenci\u00f3n asociada especificada en la posici\u00f3n relativa especificada - -# Are kind -isKind.title=Tipo de elemento de Records Management -isKind.description=Los elementos son una clase de componente del plan de ficheros -isKind.kind.display-label=Clase - -# Are Record Type -isRecordType.title=Tiene tipo de documento de archivo -isRecordType.description=Los documentos de archivo tienen un tipo de documento de archivo especificado - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=Declarar como documento de archivo -create-record.description=Declara el fichero como un documento de archivo -create-record.file-plan.display-label=Plan de ficheros -create-record.hide-record.display-label=Ocultar documento de archivo -# Declare As Version Record -declare-as-version-record.title=Declarar la versi\u00f3n como documento de archivo -declare-as-version-record.description=Declara esta versi\u00f3n del fichero como un documento de archivo -declare-as-version-record.file-plan.display-label=Plan de ficheros -# Complete record -declareRecord.title=Documento de archivo completo -declareRecord.description=Completa un documento de archivo -# Reopens record -undeclareRecord.title=Reabrir documento de archivo -undeclareRecord.description=Reabre un documento de archivo -# Open record folder -openRecordFolder.title=Abrir carpeta de documentos de archivo -openRecordFolder.description=Abre una carpeta de documentos de archivo -# Close record folder -closeRecordFolder.title=Cerrar carpeta de documentos de archivo -closeRecordFolder.description=Cierra una carpeta de documentos de archivo -# Complete event -completeEvent.title=Completar evento -completeEvent.description=Completa un evento -completeEvent.eventName.display-label=Evento -# Freeze -freeze.title=Congelar -freeze.description=Congela un documento de archivo -freeze.reason.display-label=Raz\u00f3n -# Unfreeze -unfreeze.title=Descongelar -unfreeze.description=Descongela un documento de archivo -# File to -fileTo.title=Archivar en -fileTo.description=Archiva un documento de archivo en la carpeta de documentos de archivo especificada -fileTo.path.display-label=Ruta a la carpeta de documentos de archivo -fileTo.createRecordPath.display-label=Crear ruta de documentos de archivo -# Copy to -copyTo.title=Copiar a -copyTo.description=Copia un documento de archivo en la carpeta de documentos de archivo especificada -copyTo.path.display-label=Ruta a la carpeta de documentos de archivo -copyTo.createRecordPath.display-label=Crear ruta de documentos de archivo -# Move to -moveTo.title=Mover a -moveTo.description=Mueve un documento de archivo a la carpeta de documentos de archivo especificada -moveTo.path.display-label=Ruta a la carpeta de documentos de archivo -moveTo.createRecordPath.display-label=Crear ruta de documentos de archivo -# Link to -linkTo.title=Enlace a -linkTo.description=Enlaza un documento de archivo a la carpeta de documentos de archivo especificada -linkTo.path.display-label=Ruta a la carpeta de documentos de archivo -linkTo.createRecordPath.display-label=Crear ruta de documentos de archivo -# Reject -reject.title=Rechazar -reject.description=Rechaza un documento de archivo y mueve el fichero a su ubicaci\u00f3n original -reject.reason.display-label=Rechazar raz\u00f3n -# Request Information -requestInfo.title=Solicitar informaci\u00f3n -requestInfo.description=Inicia un flujo de trabajo para solicitar m\u00e1s informaci\u00f3n para un documento de archivo -# Execute script -executeScript.title=Ejecutar script -executeScript.description=Ejecuta un script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Env\u00edar correo electr\u00f3nico -sendEmail.description=Env\u00eda un correo electr\u00f3nico -# Set Property -setPropertyValue.title=Establecer valor de la propiedad -setPropertyValue.description=Establece un valor de la propiedad - -# Edit Hold Reason -editHoldReason.title=Editar raz\u00f3n de bloqueo -editHoldReason.description=Edita la raz\u00f3n de bloqueo -# Relinquish Hold -relinquishHold.title=Eliminar bloqueo -relinquishHold.description=Elimina el bloqueo -# Edit Review As Of Date -editReviewAsOfDate.title=Editar fecha de inicio de revisi\u00f3n -editReviewAsOfDate.description=Editar fecha de inicio de revisi\u00f3n -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Editar fecha de inicio de acci\u00f3n de disposici\u00f3n -editDispositionActionAsOfDate.description=Editar fecha de inicio de la acci\u00f3n de retenci\u00f3n -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Difundir definici\u00f3n de documento de archivo vital -broadcastVitalRecordDefinition.description=Difunde la definici\u00f3n de documento de archivo vital -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Difundir actualizaci\u00f3n de definici\u00f3n de acciones de retenci\u00f3n -broadcastDispositionActionDefinitionUpdate.description=Difunde actualizaci\u00f3n de definici\u00f3n de acciones de retenci\u00f3n -# Undo Event -undoEvent.title=Deshacer evento -undoEvent.description=Deshace evento -# Transfer Complete -transferComplete.title=Transferencia completa -transferComplete.description=Transferencia completa -# Accession Complete -accessionComplete.title=Adhesi\u00f3n completa -accessionComplete.description=Adhesi\u00f3n completa -# Split Email -splitEmail.title=Separar correo electr\u00f3nico -splitEmail.description=Separa correo electr\u00f3nico -# Create Rentention Schedule -createDispositionSchedule.title=Crear planificaci\u00f3n de retenci\u00f3n -createDispositionSchedule.description=Crea planificaci\u00f3n de retenci\u00f3n -# File Destruction Report -fileDestructionReport.title=Archivar informe de destrucci\u00f3n -fileDestructionReport.description=Archiva informe de destrucci\u00f3n -# Cut off -cutoff.title=Interrumpir -cutoff.description=Interrumpe -# Destroy -destroy.title=Destruir -destroy.description=Destruye -# Reviewed -reviewed.title=Revisado -reviewed.description=Revisado -# Hide Record -hide-record.title=Ocultar documento de archivo -hide-record.description=Oculta documento de archivo -# Transfer -transfer.title=Transferencia -transfer.description=Transferencia -# Uncut off -unCutoff.title=Deshacer interrupci\u00f3n -unCutoff.description=Deshace interrupci\u00f3n -# Accession -accession.title=Adhesi\u00f3n -accession.description=Adhesi\u00f3n -# Retain -retain.title=Retener -retain.description=Retiene -# Add Record Types -addRecordTypes.title=A\u00f1adir tipos de documento de archivo -addRecordTypes.description=A\u00f1ade los tipos seleccionados al documento de archivo -# File report -fileReport.title=Archivar informe -fileReport.description=Archiva informe -# Delete Hold -deleteHold.title=Eliminar bloqueo -deleteHold.description=Elimina bloqueo -# Move DM record -move-dm-record.title=Mover documento de archivo -move-dm-record.description=Mueve documento de archivo -# Unlink from -unlinkFrom.title=Desvincular de -unlinkFrom.description=Desvincula de - -# Recordable version config -recordable-version-config.title=Opciones de declaraci\u00f3n autom\u00e1tica -recordable-version-config.description=Opciones de declaraci\u00f3n autom\u00e1tica -recordable-version-config.version.display-label=Declarar autom\u00e1ticamente versiones como documentos de archivo - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Categor\u00eda de documentos de archivo -rm-ac-is-kind-kinds.record_folder=Carpeta de documentos de archivo -rm-ac-is-kind-kinds.record=Documento de archivo - -rm-ac-disposition-action-relative-positions.next=Siguiente -rm-ac-disposition-action-relative-positions.previous=Anterior -rm-ac-disposition-action-relative-positions.any=Cualquiera - -ac-versions.none=Nunca -ac-versions.major_only=Solo para versiones mayores +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=Clasificado por planificaci\u00f3n de retenci\u00f3n +isClassified.description=Los documentos de archivo o las carpetas de documentos de archivo se han clasificado por una planificaci\u00f3n de retenci\u00f3n + +# Are cutoff +isCutoff.title=Interrumpir +isCutoff.description=Los documentos de archivo o las carpetas de documentos de archivo est\u00e1n interrumpidos + +# Are declared +isDeclared.title=Documento de archivo completado +isDeclared.description=Documento de archivo completo + +# Is on hold +isFrozen.title=En espera +isFrozen.description=Documento de archivo o carpeta de documentos de archivo en espera + +# Are filed +isRecordFiled.title=Documento de archivo archivado +isRecordFiled.description=El documento de archivo se ha archivado + +# Are closed record folders +isRecordFolderClosed.title=Carpeta de documentos de archivo cerrada +isRecordFolderClosed.description=La carpeta de documentos de archivo est\u00e1 cerrada + +# Are vital +isVital.title=Documento de archivo vital +isVital.description=El documento de archivo o la carpeta de documentos de archivo es un documento de archivo vital + +# Have Rentention Action +hasDispositionAction.title=Tiene acci\u00f3n de retenci\u00f3n +hasDispositionAction.description=Los documentos de archivo y las carpetas tienen la acci\u00f3n de retenci\u00f3n asociada especificada en la posici\u00f3n relativa especificada + +# Are kind +isKind.title=Tipo de elemento de Records Management +isKind.description=Los elementos son una clase de componente del plan de ficheros +isKind.kind.display-label=Clase + +# Are Record Type +isRecordType.title=Tiene tipo de documento de archivo +isRecordType.description=Los documentos de archivo tienen un tipo de documento de archivo especificado + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=Declarar como documento de archivo +create-record.description=Declara el fichero como un documento de archivo +create-record.file-plan.display-label=Plan de ficheros +create-record.hide-record.display-label=Ocultar documento de archivo +# Declare As Version Record +declare-as-version-record.title=Declarar la versi\u00f3n como documento de archivo +declare-as-version-record.description=Declara esta versi\u00f3n del fichero como un documento de archivo +declare-as-version-record.file-plan.display-label=Plan de ficheros +# Complete record +declareRecord.title=Documento de archivo completo +declareRecord.description=Completa un documento de archivo +# Reopens record +undeclareRecord.title=Reabrir documento de archivo +undeclareRecord.description=Reabre un documento de archivo +# Open record folder +openRecordFolder.title=Abrir carpeta de documentos de archivo +openRecordFolder.description=Abre una carpeta de documentos de archivo +# Close record folder +closeRecordFolder.title=Cerrar carpeta de documentos de archivo +closeRecordFolder.description=Cierra una carpeta de documentos de archivo +# Complete event +completeEvent.title=Completar evento +completeEvent.description=Completa un evento +completeEvent.eventName.display-label=Evento +# Freeze +freeze.title=Congelar +freeze.description=Congela un documento de archivo +freeze.reason.display-label=Raz\u00f3n +# Unfreeze +unfreeze.title=Descongelar +unfreeze.description=Descongela un documento de archivo +# File to +fileTo.title=Archivar en +fileTo.description=Archiva un documento de archivo en la carpeta de documentos de archivo especificada +fileTo.path.display-label=Ruta a la carpeta de documentos de archivo +fileTo.createRecordPath.display-label=Crear ruta de documentos de archivo +# Copy to +copyTo.title=Copiar a +copyTo.description=Copia un documento de archivo en la carpeta de documentos de archivo especificada +copyTo.path.display-label=Ruta a la carpeta de documentos de archivo +copyTo.createRecordPath.display-label=Crear ruta de documentos de archivo +# Move to +moveTo.title=Mover a +moveTo.description=Mueve un documento de archivo a la carpeta de documentos de archivo especificada +moveTo.path.display-label=Ruta a la carpeta de documentos de archivo +moveTo.createRecordPath.display-label=Crear ruta de documentos de archivo +# Link to +linkTo.title=Enlace a +linkTo.description=Enlaza un documento de archivo a la carpeta de documentos de archivo especificada +linkTo.path.display-label=Ruta a la carpeta de documentos de archivo +linkTo.createRecordPath.display-label=Crear ruta de documentos de archivo +# Reject +reject.title=Rechazar +reject.description=Rechaza un documento de archivo y mueve el fichero a su ubicaci\u00f3n original +reject.reason.display-label=Rechazar raz\u00f3n +# Request Information +requestInfo.title=Solicitar informaci\u00f3n +requestInfo.description=Inicia un flujo de trabajo para solicitar m\u00e1s informaci\u00f3n para un documento de archivo +# Execute script +executeScript.title=Ejecutar script +executeScript.description=Ejecuta un script +executeScript.script-ref.display-label=Script +# Send Email +sendEmail.title=Env\u00edar correo electr\u00f3nico +sendEmail.description=Env\u00eda un correo electr\u00f3nico +# Set Property +setPropertyValue.title=Establecer valor de la propiedad +setPropertyValue.description=Establece un valor de la propiedad + +# Edit Hold Reason +editHoldReason.title=Editar raz\u00f3n de bloqueo +editHoldReason.description=Edita la raz\u00f3n de bloqueo +# Relinquish Hold +relinquishHold.title=Eliminar bloqueo +relinquishHold.description=Elimina el bloqueo +# Edit Review As Of Date +editReviewAsOfDate.title=Editar fecha de inicio de revisi\u00f3n +editReviewAsOfDate.description=Editar fecha de inicio de revisi\u00f3n +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=Editar fecha de inicio de acci\u00f3n de disposici\u00f3n +editDispositionActionAsOfDate.description=Editar fecha de inicio de la acci\u00f3n de retenci\u00f3n +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=Difundir definici\u00f3n de documento de archivo vital +broadcastVitalRecordDefinition.description=Difunde la definici\u00f3n de documento de archivo vital +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=Difundir actualizaci\u00f3n de definici\u00f3n de acciones de retenci\u00f3n +broadcastDispositionActionDefinitionUpdate.description=Difunde actualizaci\u00f3n de definici\u00f3n de acciones de retenci\u00f3n +# Undo Event +undoEvent.title=Deshacer evento +undoEvent.description=Deshace evento +# Transfer Complete +transferComplete.title=Transferencia completa +transferComplete.description=Transferencia completa +# Accession Complete +accessionComplete.title=Adhesi\u00f3n completa +accessionComplete.description=Adhesi\u00f3n completa +# Split Email +splitEmail.title=Separar correo electr\u00f3nico +splitEmail.description=Separa correo electr\u00f3nico +# Create Rentention Schedule +createDispositionSchedule.title=Crear planificaci\u00f3n de retenci\u00f3n +createDispositionSchedule.description=Crea planificaci\u00f3n de retenci\u00f3n +# File Destruction Report +fileDestructionReport.title=Archivar informe de destrucci\u00f3n +fileDestructionReport.description=Archiva informe de destrucci\u00f3n +# Cut off +cutoff.title=Interrumpir +cutoff.description=Interrumpe +# Destroy +destroy.title=Destruir +destroy.description=Destruye +# Reviewed +reviewed.title=Revisado +reviewed.description=Revisado +# Hide Record +hide-record.title=Ocultar documento de archivo +hide-record.description=Oculta documento de archivo +# Transfer +transfer.title=Transferencia +transfer.description=Transferencia +# Uncut off +unCutoff.title=Deshacer interrupci\u00f3n +unCutoff.description=Deshace interrupci\u00f3n +# Accession +accession.title=Adhesi\u00f3n +accession.description=Adhesi\u00f3n +# Retain +retain.title=Retener +retain.description=Retiene +# Add Record Types +addRecordTypes.title=A\u00f1adir tipos de documento de archivo +addRecordTypes.description=A\u00f1ade los tipos seleccionados al documento de archivo +# File report +fileReport.title=Archivar informe +fileReport.description=Archiva informe +# Delete Hold +deleteHold.title=Eliminar bloqueo +deleteHold.description=Elimina bloqueo +# Move DM record +move-dm-record.title=Mover documento de archivo +move-dm-record.description=Mueve documento de archivo +# Unlink from +unlinkFrom.title=Desvincular de +unlinkFrom.description=Desvincula de + +# Recordable version config +recordable-version-config.title=Opciones de declaraci\u00f3n autom\u00e1tica +recordable-version-config.description=Opciones de declaraci\u00f3n autom\u00e1tica +recordable-version-config.version.display-label=Declarar autom\u00e1ticamente versiones como documentos de archivo + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=Categor\u00eda de documentos de archivo +rm-ac-is-kind-kinds.record_folder=Carpeta de documentos de archivo +rm-ac-is-kind-kinds.record=Documento de archivo + +rm-ac-disposition-action-relative-positions.next=Siguiente +rm-ac-disposition-action-relative-positions.previous=Anterior +rm-ac-disposition-action-relative-positions.any=Cualquiera + +ac-versions.none=Nunca +ac-versions.major_only=Solo para versiones mayores ac-versions.all=Para todas las versiones mayores y menores \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties index a7d4d1e999..7ddffe7a72 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Class\u00e9 par r\u00e8gle de r\u00e9tention -isClassified.description=Les documents d'archives ou dossiers d'archives sont class\u00e9s par une r\u00e8gle de r\u00e9tention - -# Are cutoff -isCutoff.title=D\u00e9classer -isCutoff.description=Les documents d'archives ou dossiers d'archives sont d\u00e9class\u00e9s - -# Are declared -isDeclared.title=Document d'archives termin\u00e9 -isDeclared.description=Le document d'archives est termin\u00e9 - -# Is on hold -isFrozen.title=Suspendu -isFrozen.description=Le document d'archives ou le dossier d'archives est suspendu - -# Are filed -isRecordFiled.title=Document d'archives archiv\u00e9 -isRecordFiled.description=Le document d'archives est archiv\u00e9 - -# Are closed record folders -isRecordFolderClosed.title=Dossier d'archives ferm\u00e9 -isRecordFolderClosed.description=Le dossier d'archives est ferm\u00e9 - -# Are vital -isVital.title=Document d'archives essentiel -isVital.description=Le document d'archives ou le dossier d'archives est essentiel - -# Have Rentention Action -hasDispositionAction.title=A une action de r\u00e9tention -hasDispositionAction.description=Les documents d'archives et dossiers d'archives ont l'action de r\u00e9tention associ\u00e9e d\u00e9finie \u00e0 la position relative d\u00e9finie - -# Are kind -isKind.title=Type d'\u00e9l\u00e9ment de gestion des archives -isKind.description=Les \u00e9l\u00e9ments sont un type de composant du plan de classification -isKind.kind.display-label=Type - -# Are Record Type -isRecordType.title=A le type de document d'archives -isRecordType.description=Les documents d'archives ont un type de document d'archives d\u00e9fini - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=D\u00e9clarer comme document d'archives -create-record.description=D\u00e9clare un fichier comme document d'archives -create-record.file-plan.display-label=Plan de classification -create-record.hide-record.display-label=Masquer le document d'archives -# Declare As Version Record -declare-as-version-record.title=D\u00e9clarer la version comme document d'archives -declare-as-version-record.description=D\u00e9clare cette version du fichier comme document d'archives -declare-as-version-record.file-plan.display-label=Plan de classification -# Complete record -declareRecord.title=Compl\u00e9ter un document d'archives -declareRecord.description=Compl\u00e8te un document d'archives -# Reopens record -undeclareRecord.title=Rouvrir un document d'archives -undeclareRecord.description=Rouvre un document d'archives -# Open record folder -openRecordFolder.title=Ouvrir un dossier d'archives -openRecordFolder.description=Ouvre un dossier d'archives -# Close record folder -closeRecordFolder.title=Fermer un dossier d'archives -closeRecordFolder.description=Ferme un dossier d'archives -# Complete event -completeEvent.title=Compl\u00e9ter un \u00e9v\u00e9nement -completeEvent.description=Compl\u00e8te un \u00e9v\u00e9nement -completeEvent.eventName.display-label=Ev\u00e9nement -# Freeze -freeze.title=Geler -freeze.description=G\u00e8le un document d'archives -freeze.reason.display-label=Motif -# Unfreeze -unfreeze.title=D\u00e9geler -unfreeze.description=D\u00e9g\u00e8le un document d'archives -# File to -fileTo.title=Archiver dans -fileTo.description=Archive un document d'archives dans le dossier d'archives d\u00e9fini -fileTo.path.display-label=Chemin de dossier d'archives -fileTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives -# Copy to -copyTo.title=Copier vers... -copyTo.description=Copie un document d'archives vers le dossier d'archives d\u00e9fini -copyTo.path.display-label=Chemin de dossier d'archives -copyTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives -# Move to -moveTo.title=D\u00e9placer vers... -moveTo.description=D\u00e9place un document d'archives vers le dossier d'archives d\u00e9fini -moveTo.path.display-label=Chemin de dossier d'archives -moveTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives -# Link to -linkTo.title=Lier \u00e0 -linkTo.description=Lie un document d'archives vers le dossier d'archives d\u00e9fini -linkTo.path.display-label=Chemin de dossier d'archives -linkTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives -# Reject -reject.title=Rejeter -reject.description=Rejette un document d'archives et place le fichier dans son emplacement d'origine -reject.reason.display-label=Motif du rejet -# Request Information -requestInfo.title=Demander des informations -requestInfo.description=D\u00e9marre un workflow pour demander plus d'informations sur un document d'archives -# Execute script -executeScript.title=Ex\u00e9cuter le script -executeScript.description=Ex\u00e9cuter un script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Envoyer un e-mail -sendEmail.description=Envoyer un e-mail -# Set Property -setPropertyValue.title=D\u00e9finir la valeur de la propri\u00e9t\u00e9 -setPropertyValue.description=D\u00e9finir une valeur de propri\u00e9t\u00e9 - -# Edit Hold Reason -editHoldReason.title=Modifier le motif de suspension -editHoldReason.description=Modifier le motif de suspension -# Relinquish Hold -relinquishHold.title=Lever la suspension -relinquishHold.description=Lever la suspension -# Edit Review As Of Date -editReviewAsOfDate.title=Modifier la date de d\u00e9but de la r\u00e9vision -editReviewAsOfDate.description=Modifier la date de d\u00e9but de la r\u00e9vision -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Modifier la date de d\u00e9but de l'action de r\u00e9tention -editDispositionActionAsOfDate.description=Modifier la date de d\u00e9but de l'action de r\u00e9tention -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=D\u00e9finition du document d'archives essentiel diffus\u00e9e -broadcastVitalRecordDefinition.description=D\u00e9finition du document d'archives essentiel diffus\u00e9e -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Mise \u00e0 jour de la d\u00e9finition de l'action de r\u00e9tention diffus\u00e9e -broadcastDispositionActionDefinitionUpdate.description=Mise \u00e0 jour de la d\u00e9finition de l'action de r\u00e9tention diffus\u00e9e -# Undo Event -undoEvent.title=Annuler l'\u00e9v\u00e9nement -undoEvent.description=Annuler l'\u00e9v\u00e9nement -# Transfer Complete -transferComplete.title=Transfert termin\u00e9 -transferComplete.description=Transfert termin\u00e9 -# Accession Complete -accessionComplete.title=Versement \u00e0 un autre organisme termin\u00e9 -accessionComplete.description=Versement \u00e0 un autre organisme termin\u00e9 -# Split Email -splitEmail.title=Partager l'e-mail -splitEmail.description=Partager l'e-mail -# Create Rentention Schedule -createDispositionSchedule.title=Cr\u00e9er une r\u00e8gle de r\u00e9tention -createDispositionSchedule.description=Cr\u00e9er une r\u00e8gle de r\u00e9tention -# File Destruction Report -fileDestructionReport.title=Rapport de destruction de fichier -fileDestructionReport.description=Rapport de destruction de fichier -# Cut off -cutoff.title=D\u00e9classer -cutoff.description=D\u00e9classer -# Destroy -destroy.title=D\u00e9truire -destroy.description=D\u00e9truire -# Reviewed -reviewed.title=V\u00e9rifi\u00e9 -reviewed.description=V\u00e9rifi\u00e9 -# Hide Record -hide-record.title=Masquer le document d'archives -hide-record.description=Masquer le document d'archives -# Transfer -transfer.title=Transf\u00e9rer -transfer.description=Transf\u00e9rer -# Uncut off -unCutoff.title=Annuler le d\u00e9classement -unCutoff.description=Annuler le d\u00e9classement -# Accession -accession.title=Versement \u00e0 un autre organisme -accession.description=Versement \u00e0 un autre organisme -# Retain -retain.title=Retenir -retain.description=Retenir -# Add Record Types -addRecordTypes.title=Ajouter des types de document d'archives -addRecordTypes.description=Ajoute le(s) type(s) s\u00e9lectionn\u00e9(s) au document d'archives -# File report -fileReport.title=Archiver le rapport -fileReport.description=Archiver le rapport -# Delete Hold -deleteHold.title=Supprimer la suspension -deleteHold.description=Supprimer la suspension -# Move DM record -move-dm-record.title=D\u00e9placer le document d'archives -move-dm-record.description=D\u00e9placer le document d'archives -# Unlink from -unlinkFrom.title=Supprimer le lien de -unlinkFrom.description=Supprimer le lien de - -# Recordable version config -recordable-version-config.title=Options de d\u00e9claration automatique -recordable-version-config.description=Options de d\u00e9claration automatique -recordable-version-config.version.display-label=D\u00e9clarer automatiquement les versions comme documents d'archives - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Cat\u00e9gorie de document d'archives -rm-ac-is-kind-kinds.record_folder=Dossier d'archives -rm-ac-is-kind-kinds.record=Document d'archives - -rm-ac-disposition-action-relative-positions.next=Suivant -rm-ac-disposition-action-relative-positions.previous=Pr\u00e9c\u00e9dent -rm-ac-disposition-action-relative-positions.any=N'importe lequel - -ac-versions.none=Jamais -ac-versions.major_only=Uniquement les versions majeures +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=Class\u00e9 par r\u00e8gle de r\u00e9tention +isClassified.description=Les documents d'archives ou dossiers d'archives sont class\u00e9s par une r\u00e8gle de r\u00e9tention + +# Are cutoff +isCutoff.title=D\u00e9classer +isCutoff.description=Les documents d'archives ou dossiers d'archives sont d\u00e9class\u00e9s + +# Are declared +isDeclared.title=Document d'archives termin\u00e9 +isDeclared.description=Le document d'archives est termin\u00e9 + +# Is on hold +isFrozen.title=Suspendu +isFrozen.description=Le document d'archives ou le dossier d'archives est suspendu + +# Are filed +isRecordFiled.title=Document d'archives archiv\u00e9 +isRecordFiled.description=Le document d'archives est archiv\u00e9 + +# Are closed record folders +isRecordFolderClosed.title=Dossier d'archives ferm\u00e9 +isRecordFolderClosed.description=Le dossier d'archives est ferm\u00e9 + +# Are vital +isVital.title=Document d'archives essentiel +isVital.description=Le document d'archives ou le dossier d'archives est essentiel + +# Have Rentention Action +hasDispositionAction.title=A une action de r\u00e9tention +hasDispositionAction.description=Les documents d'archives et dossiers d'archives ont l'action de r\u00e9tention associ\u00e9e d\u00e9finie \u00e0 la position relative d\u00e9finie + +# Are kind +isKind.title=Type d'\u00e9l\u00e9ment de gestion des archives +isKind.description=Les \u00e9l\u00e9ments sont un type de composant du plan de classification +isKind.kind.display-label=Type + +# Are Record Type +isRecordType.title=A le type de document d'archives +isRecordType.description=Les documents d'archives ont un type de document d'archives d\u00e9fini + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=D\u00e9clarer comme document d'archives +create-record.description=D\u00e9clare un fichier comme document d'archives +create-record.file-plan.display-label=Plan de classification +create-record.hide-record.display-label=Masquer le document d'archives +# Declare As Version Record +declare-as-version-record.title=D\u00e9clarer la version comme document d'archives +declare-as-version-record.description=D\u00e9clare cette version du fichier comme document d'archives +declare-as-version-record.file-plan.display-label=Plan de classification +# Complete record +declareRecord.title=Compl\u00e9ter un document d'archives +declareRecord.description=Compl\u00e8te un document d'archives +# Reopens record +undeclareRecord.title=Rouvrir un document d'archives +undeclareRecord.description=Rouvre un document d'archives +# Open record folder +openRecordFolder.title=Ouvrir un dossier d'archives +openRecordFolder.description=Ouvre un dossier d'archives +# Close record folder +closeRecordFolder.title=Fermer un dossier d'archives +closeRecordFolder.description=Ferme un dossier d'archives +# Complete event +completeEvent.title=Compl\u00e9ter un \u00e9v\u00e9nement +completeEvent.description=Compl\u00e8te un \u00e9v\u00e9nement +completeEvent.eventName.display-label=Ev\u00e9nement +# Freeze +freeze.title=Geler +freeze.description=G\u00e8le un document d'archives +freeze.reason.display-label=Motif +# Unfreeze +unfreeze.title=D\u00e9geler +unfreeze.description=D\u00e9g\u00e8le un document d'archives +# File to +fileTo.title=Archiver dans +fileTo.description=Archive un document d'archives dans le dossier d'archives d\u00e9fini +fileTo.path.display-label=Chemin de dossier d'archives +fileTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives +# Copy to +copyTo.title=Copier vers... +copyTo.description=Copie un document d'archives vers le dossier d'archives d\u00e9fini +copyTo.path.display-label=Chemin de dossier d'archives +copyTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives +# Move to +moveTo.title=D\u00e9placer vers... +moveTo.description=D\u00e9place un document d'archives vers le dossier d'archives d\u00e9fini +moveTo.path.display-label=Chemin de dossier d'archives +moveTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives +# Link to +linkTo.title=Lier \u00e0 +linkTo.description=Lie un document d'archives vers le dossier d'archives d\u00e9fini +linkTo.path.display-label=Chemin de dossier d'archives +linkTo.createRecordPath.display-label=Cr\u00e9er un chemin d'acc\u00e8s du document d'archives +# Reject +reject.title=Rejeter +reject.description=Rejette un document d'archives et place le fichier dans son emplacement d'origine +reject.reason.display-label=Motif du rejet +# Request Information +requestInfo.title=Demander des informations +requestInfo.description=D\u00e9marre un workflow pour demander plus d'informations sur un document d'archives +# Execute script +executeScript.title=Ex\u00e9cuter le script +executeScript.description=Ex\u00e9cuter un script +executeScript.script-ref.display-label=Script +# Send Email +sendEmail.title=Envoyer un e-mail +sendEmail.description=Envoyer un e-mail +# Set Property +setPropertyValue.title=D\u00e9finir la valeur de la propri\u00e9t\u00e9 +setPropertyValue.description=D\u00e9finir une valeur de propri\u00e9t\u00e9 + +# Edit Hold Reason +editHoldReason.title=Modifier le motif de suspension +editHoldReason.description=Modifier le motif de suspension +# Relinquish Hold +relinquishHold.title=Lever la suspension +relinquishHold.description=Lever la suspension +# Edit Review As Of Date +editReviewAsOfDate.title=Modifier la date de d\u00e9but de la r\u00e9vision +editReviewAsOfDate.description=Modifier la date de d\u00e9but de la r\u00e9vision +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=Modifier la date de d\u00e9but de l'action de r\u00e9tention +editDispositionActionAsOfDate.description=Modifier la date de d\u00e9but de l'action de r\u00e9tention +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=D\u00e9finition du document d'archives essentiel diffus\u00e9e +broadcastVitalRecordDefinition.description=D\u00e9finition du document d'archives essentiel diffus\u00e9e +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=Mise \u00e0 jour de la d\u00e9finition de l'action de r\u00e9tention diffus\u00e9e +broadcastDispositionActionDefinitionUpdate.description=Mise \u00e0 jour de la d\u00e9finition de l'action de r\u00e9tention diffus\u00e9e +# Undo Event +undoEvent.title=Annuler l'\u00e9v\u00e9nement +undoEvent.description=Annuler l'\u00e9v\u00e9nement +# Transfer Complete +transferComplete.title=Transfert termin\u00e9 +transferComplete.description=Transfert termin\u00e9 +# Accession Complete +accessionComplete.title=Versement \u00e0 un autre organisme termin\u00e9 +accessionComplete.description=Versement \u00e0 un autre organisme termin\u00e9 +# Split Email +splitEmail.title=Partager l'e-mail +splitEmail.description=Partager l'e-mail +# Create Rentention Schedule +createDispositionSchedule.title=Cr\u00e9er une r\u00e8gle de r\u00e9tention +createDispositionSchedule.description=Cr\u00e9er une r\u00e8gle de r\u00e9tention +# File Destruction Report +fileDestructionReport.title=Rapport de destruction de fichier +fileDestructionReport.description=Rapport de destruction de fichier +# Cut off +cutoff.title=D\u00e9classer +cutoff.description=D\u00e9classer +# Destroy +destroy.title=D\u00e9truire +destroy.description=D\u00e9truire +# Reviewed +reviewed.title=V\u00e9rifi\u00e9 +reviewed.description=V\u00e9rifi\u00e9 +# Hide Record +hide-record.title=Masquer le document d'archives +hide-record.description=Masquer le document d'archives +# Transfer +transfer.title=Transf\u00e9rer +transfer.description=Transf\u00e9rer +# Uncut off +unCutoff.title=Annuler le d\u00e9classement +unCutoff.description=Annuler le d\u00e9classement +# Accession +accession.title=Versement \u00e0 un autre organisme +accession.description=Versement \u00e0 un autre organisme +# Retain +retain.title=Retenir +retain.description=Retenir +# Add Record Types +addRecordTypes.title=Ajouter des types de document d'archives +addRecordTypes.description=Ajoute le(s) type(s) s\u00e9lectionn\u00e9(s) au document d'archives +# File report +fileReport.title=Archiver le rapport +fileReport.description=Archiver le rapport +# Delete Hold +deleteHold.title=Supprimer la suspension +deleteHold.description=Supprimer la suspension +# Move DM record +move-dm-record.title=D\u00e9placer le document d'archives +move-dm-record.description=D\u00e9placer le document d'archives +# Unlink from +unlinkFrom.title=Supprimer le lien de +unlinkFrom.description=Supprimer le lien de + +# Recordable version config +recordable-version-config.title=Options de d\u00e9claration automatique +recordable-version-config.description=Options de d\u00e9claration automatique +recordable-version-config.version.display-label=D\u00e9clarer automatiquement les versions comme documents d'archives + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=Cat\u00e9gorie de document d'archives +rm-ac-is-kind-kinds.record_folder=Dossier d'archives +rm-ac-is-kind-kinds.record=Document d'archives + +rm-ac-disposition-action-relative-positions.next=Suivant +rm-ac-disposition-action-relative-positions.previous=Pr\u00e9c\u00e9dent +rm-ac-disposition-action-relative-positions.any=N'importe lequel + +ac-versions.none=Jamais +ac-versions.major_only=Uniquement les versions majeures ac-versions.all=Versions majeures et mineures \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties index caa872c432..36cc1cd0d4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Classificato in base al programma di conservazione -isClassified.description=I record o le cartelle di record sono stati classificati in base al programma di conservazione - -# Are cutoff -isCutoff.title=Cut off -isCutoff.description=Record o cartelle di record separati - -# Are declared -isDeclared.title=Record completati -isDeclared.description=Il record \u00e8 completo - -# Is on hold -isFrozen.title=Sospeso -isFrozen.description=Il record o la cartella di record sono in sospeso - -# Are filed -isRecordFiled.title=Record archiviato -isRecordFiled.description=Il record \u00e8 archiviato - -# Are closed record folders -isRecordFolderClosed.title=Cartella di record chiusa -isRecordFolderClosed.description=La cartella di record \u00e8 chiusa - -# Are vital -isVital.title=Record fondamentale -isVital.description=Il record o la cartella di record sono record fondamentali - -# Have Rentention Action -hasDispositionAction.title=Con azione di conservazione -hasDispositionAction.description=I record e le cartelle hanno ottenuto la relativa azione di conservazione specificata alla relativa posizione specificata - -# Are kind -isKind.title=Tipo di elemento di Records Management -isKind.description=Gli elementi sono del tipo componente piano file -isKind.kind.display-label=Tipo - -# Are Record Type -isRecordType.title=Con tipo di record -isRecordType.description=I record hanno un tipo di record specificato - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=Dichiara come record -create-record.description=Dichiara file come record -create-record.file-plan.display-label=Piano file -create-record.hide-record.display-label=Nascondi record -# Declare As Version Record -declare-as-version-record.title=Dichiara versione come record -declare-as-version-record.description=Dichiara questa versione del file come record -declare-as-version-record.file-plan.display-label=Piano file -# Complete record -declareRecord.title=Completa record -declareRecord.description=Completa un record. -# Reopens record -undeclareRecord.title=Riapri record -undeclareRecord.description=Riapre un record -# Open record folder -openRecordFolder.title=Apri cartella di record -openRecordFolder.description=Apre una cartella di record -# Close record folder -closeRecordFolder.title=Chiudi cartella di record -closeRecordFolder.description=Chiude una cartella di record -# Complete event -completeEvent.title=Completa evento -completeEvent.description=Completa un evento -completeEvent.eventName.display-label=Evento -# Freeze -freeze.title=Blocca -freeze.description=Blocca un record -freeze.reason.display-label=Motivo -# Unfreeze -unfreeze.title=Sblocca -unfreeze.description=Sblocca un record -# File to -fileTo.title=Archivia in -fileTo.description=Archivia un record nella cartella di record specificata -fileTo.path.display-label=Indirizza nella cartella di record -fileTo.createRecordPath.display-label=Crea percorso del record -# Copy to -copyTo.title=Copia in -copyTo.description=Copia un record nella cartella di record specificata -copyTo.path.display-label=Indirizza nella cartella di record -copyTo.createRecordPath.display-label=Crea percorso del record -# Move to -moveTo.title=Sposta in -moveTo.description=Sposta un record nella cartella di record specificata -moveTo.path.display-label=Indirizza nella cartella di record -moveTo.createRecordPath.display-label=Crea percorso del record -# Link to -linkTo.title=Collega a -linkTo.description=Collega un record alla cartella di record specificata -linkTo.path.display-label=Indirizza nella cartella di record -linkTo.createRecordPath.display-label=Crea percorso del record -# Reject -reject.title=Respingi -reject.description=Respinge un record e sposta il file nella sua posizione originale -reject.reason.display-label=Respingi motivo -# Request Information -requestInfo.title=Richiedi informazioni -requestInfo.description=Avvia un flusso di lavoro per richiedere pi\u00f9 informazioni per un record -# Execute script -executeScript.title=Esegui script -executeScript.description=Esegui uno script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Invia e-mail -sendEmail.description=Invia un'e-mail -# Set Property -setPropertyValue.title=Imposta valore di propriet\u00e0 -setPropertyValue.description=Imposta un valore di propriet\u00e0 - -# Edit Hold Reason -editHoldReason.title=Modifica motivo sospensione -editHoldReason.description=Modifica il motivo della sospensione -# Relinquish Hold -relinquishHold.title=Lascia sospensione -relinquishHold.description=Lascia la sospensione -# Edit Review As Of Date -editReviewAsOfDate.title=Modifica data di inizio esame -editReviewAsOfDate.description=Modifica data di inizio esame -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Modifica data di inizio azione di conservazione -editDispositionActionAsOfDate.description=Modifica la data di inizio azione di conservazione -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Trasmetti definizione di record fondamentale -broadcastVitalRecordDefinition.description=Trasmetti la definizione di record fondamentale -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Trasmetti aggiornamento definizione di azione di conservazione -broadcastDispositionActionDefinitionUpdate.description=Trasmetti aggiornamento definizione di azione di conservazione -# Undo Event -undoEvent.title=Annulla evento -undoEvent.description=Annulla evento -# Transfer Complete -transferComplete.title=Trasferimento completato -transferComplete.description=Trasferimento completato -# Accession Complete -accessionComplete.title=Trasferimento ad altri completato -accessionComplete.description=Trasferimento ad altri completato -# Split Email -splitEmail.title=Dividi e-mail -splitEmail.description=Dividi e-mail -# Create Rentention Schedule -createDispositionSchedule.title=Crea Programma di conservazione -createDispositionSchedule.description=Crea Programma di conservazione -# File Destruction Report -fileDestructionReport.title=Archivia rapporto di eliminazione definitiva -fileDestructionReport.description=Archivia rapporto di eliminazione definitiva -# Cut off -cutoff.title=Cut off -cutoff.description=Cut off -# Destroy -destroy.title=Elimina definitivamente -destroy.description=Elimina definitivamente -# Reviewed -reviewed.title=Esaminato -reviewed.description=Esaminato -# Hide Record -hide-record.title=Nascondi record -hide-record.description=Nascondi record -# Transfer -transfer.title=Trasferisci -transfer.description=Trasferisci -# Uncut off -unCutoff.title=Annulla cut off -unCutoff.description=Annulla cut off -# Accession -accession.title=Trasferimento ad altri -accession.description=Trasferimento ad altri -# Retain -retain.title=Conserva -retain.description=Conserva -# Add Record Types -addRecordTypes.title=Aggiungi tipi di record -addRecordTypes.description=Aggiunge i tipi selezionati al record -# File report -fileReport.title=Archivia rapporto -fileReport.description=Archivia rapporto -# Delete Hold -deleteHold.title=Annulla sospensione -deleteHold.description=Annulla sospensione -# Move DM record -move-dm-record.title=Sposta record -move-dm-record.description=Sposta record -# Unlink from -unlinkFrom.title=Scollega da -unlinkFrom.description=Scollega da - -# Recordable version config -recordable-version-config.title=Opzioni di dichiarazione automatica -recordable-version-config.description=Opzioni di dichiarazione automatica -recordable-version-config.version.display-label=Dichiara automaticamente versioni come record - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Categoria record -rm-ac-is-kind-kinds.record_folder=Cartella di record -rm-ac-is-kind-kinds.record=Record - -rm-ac-disposition-action-relative-positions.next=Successivo -rm-ac-disposition-action-relative-positions.previous=Precedente -rm-ac-disposition-action-relative-positions.any=Qualsiasi - -ac-versions.none=Mai -ac-versions.major_only=Solo per versioni maggiori +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=Classificato in base al programma di conservazione +isClassified.description=I record o le cartelle di record sono stati classificati in base al programma di conservazione + +# Are cutoff +isCutoff.title=Cut off +isCutoff.description=Record o cartelle di record separati + +# Are declared +isDeclared.title=Record completati +isDeclared.description=Il record \u00e8 completo + +# Is on hold +isFrozen.title=Sospeso +isFrozen.description=Il record o la cartella di record sono in sospeso + +# Are filed +isRecordFiled.title=Record archiviato +isRecordFiled.description=Il record \u00e8 archiviato + +# Are closed record folders +isRecordFolderClosed.title=Cartella di record chiusa +isRecordFolderClosed.description=La cartella di record \u00e8 chiusa + +# Are vital +isVital.title=Record fondamentale +isVital.description=Il record o la cartella di record sono record fondamentali + +# Have Rentention Action +hasDispositionAction.title=Con azione di conservazione +hasDispositionAction.description=I record e le cartelle hanno ottenuto la relativa azione di conservazione specificata alla relativa posizione specificata + +# Are kind +isKind.title=Tipo di elemento di Records Management +isKind.description=Gli elementi sono del tipo componente piano file +isKind.kind.display-label=Tipo + +# Are Record Type +isRecordType.title=Con tipo di record +isRecordType.description=I record hanno un tipo di record specificato + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=Dichiara come record +create-record.description=Dichiara file come record +create-record.file-plan.display-label=Piano file +create-record.hide-record.display-label=Nascondi record +# Declare As Version Record +declare-as-version-record.title=Dichiara versione come record +declare-as-version-record.description=Dichiara questa versione del file come record +declare-as-version-record.file-plan.display-label=Piano file +# Complete record +declareRecord.title=Completa record +declareRecord.description=Completa un record. +# Reopens record +undeclareRecord.title=Riapri record +undeclareRecord.description=Riapre un record +# Open record folder +openRecordFolder.title=Apri cartella di record +openRecordFolder.description=Apre una cartella di record +# Close record folder +closeRecordFolder.title=Chiudi cartella di record +closeRecordFolder.description=Chiude una cartella di record +# Complete event +completeEvent.title=Completa evento +completeEvent.description=Completa un evento +completeEvent.eventName.display-label=Evento +# Freeze +freeze.title=Blocca +freeze.description=Blocca un record +freeze.reason.display-label=Motivo +# Unfreeze +unfreeze.title=Sblocca +unfreeze.description=Sblocca un record +# File to +fileTo.title=Archivia in +fileTo.description=Archivia un record nella cartella di record specificata +fileTo.path.display-label=Indirizza nella cartella di record +fileTo.createRecordPath.display-label=Crea percorso del record +# Copy to +copyTo.title=Copia in +copyTo.description=Copia un record nella cartella di record specificata +copyTo.path.display-label=Indirizza nella cartella di record +copyTo.createRecordPath.display-label=Crea percorso del record +# Move to +moveTo.title=Sposta in +moveTo.description=Sposta un record nella cartella di record specificata +moveTo.path.display-label=Indirizza nella cartella di record +moveTo.createRecordPath.display-label=Crea percorso del record +# Link to +linkTo.title=Collega a +linkTo.description=Collega un record alla cartella di record specificata +linkTo.path.display-label=Indirizza nella cartella di record +linkTo.createRecordPath.display-label=Crea percorso del record +# Reject +reject.title=Respingi +reject.description=Respinge un record e sposta il file nella sua posizione originale +reject.reason.display-label=Respingi motivo +# Request Information +requestInfo.title=Richiedi informazioni +requestInfo.description=Avvia un flusso di lavoro per richiedere pi\u00f9 informazioni per un record +# Execute script +executeScript.title=Esegui script +executeScript.description=Esegui uno script +executeScript.script-ref.display-label=Script +# Send Email +sendEmail.title=Invia e-mail +sendEmail.description=Invia un'e-mail +# Set Property +setPropertyValue.title=Imposta valore di propriet\u00e0 +setPropertyValue.description=Imposta un valore di propriet\u00e0 + +# Edit Hold Reason +editHoldReason.title=Modifica motivo sospensione +editHoldReason.description=Modifica il motivo della sospensione +# Relinquish Hold +relinquishHold.title=Lascia sospensione +relinquishHold.description=Lascia la sospensione +# Edit Review As Of Date +editReviewAsOfDate.title=Modifica data di inizio esame +editReviewAsOfDate.description=Modifica data di inizio esame +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=Modifica data di inizio azione di conservazione +editDispositionActionAsOfDate.description=Modifica la data di inizio azione di conservazione +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=Trasmetti definizione di record fondamentale +broadcastVitalRecordDefinition.description=Trasmetti la definizione di record fondamentale +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=Trasmetti aggiornamento definizione di azione di conservazione +broadcastDispositionActionDefinitionUpdate.description=Trasmetti aggiornamento definizione di azione di conservazione +# Undo Event +undoEvent.title=Annulla evento +undoEvent.description=Annulla evento +# Transfer Complete +transferComplete.title=Trasferimento completato +transferComplete.description=Trasferimento completato +# Accession Complete +accessionComplete.title=Trasferimento ad altri completato +accessionComplete.description=Trasferimento ad altri completato +# Split Email +splitEmail.title=Dividi e-mail +splitEmail.description=Dividi e-mail +# Create Rentention Schedule +createDispositionSchedule.title=Crea Programma di conservazione +createDispositionSchedule.description=Crea Programma di conservazione +# File Destruction Report +fileDestructionReport.title=Archivia rapporto di eliminazione definitiva +fileDestructionReport.description=Archivia rapporto di eliminazione definitiva +# Cut off +cutoff.title=Cut off +cutoff.description=Cut off +# Destroy +destroy.title=Elimina definitivamente +destroy.description=Elimina definitivamente +# Reviewed +reviewed.title=Esaminato +reviewed.description=Esaminato +# Hide Record +hide-record.title=Nascondi record +hide-record.description=Nascondi record +# Transfer +transfer.title=Trasferisci +transfer.description=Trasferisci +# Uncut off +unCutoff.title=Annulla cut off +unCutoff.description=Annulla cut off +# Accession +accession.title=Trasferimento ad altri +accession.description=Trasferimento ad altri +# Retain +retain.title=Conserva +retain.description=Conserva +# Add Record Types +addRecordTypes.title=Aggiungi tipi di record +addRecordTypes.description=Aggiunge i tipi selezionati al record +# File report +fileReport.title=Archivia rapporto +fileReport.description=Archivia rapporto +# Delete Hold +deleteHold.title=Annulla sospensione +deleteHold.description=Annulla sospensione +# Move DM record +move-dm-record.title=Sposta record +move-dm-record.description=Sposta record +# Unlink from +unlinkFrom.title=Scollega da +unlinkFrom.description=Scollega da + +# Recordable version config +recordable-version-config.title=Opzioni di dichiarazione automatica +recordable-version-config.description=Opzioni di dichiarazione automatica +recordable-version-config.version.display-label=Dichiara automaticamente versioni come record + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=Categoria record +rm-ac-is-kind-kinds.record_folder=Cartella di record +rm-ac-is-kind-kinds.record=Record + +rm-ac-disposition-action-relative-positions.next=Successivo +rm-ac-disposition-action-relative-positions.previous=Precedente +rm-ac-disposition-action-relative-positions.any=Qualsiasi + +ac-versions.none=Mai +ac-versions.major_only=Solo per versioni maggiori ac-versions.all=Per tutte le versioni maggiori e minori \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties index b08182692c..3a487c02aa 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u308a\u5206\u985e\u6e08\u307f -isClassified.description=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u3063\u3066\u5206\u985e\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 - -# Are cutoff -isCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -isCutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 - -# Are declared -isDeclared.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -isDeclared.description=\u30ec\u30b3\u30fc\u30c9\u306f\u5b8c\u4e86\u3057\u3066\u3044\u307e\u3059 - -# Is on hold -isFrozen.title=\u30db\u30fc\u30eb\u30c9\u4e2d -isFrozen.description=\u30db\u30fc\u30eb\u30c9\u4e2d\u306e\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 - -# Are filed -isRecordFiled.title=\u6574\u7406\u4fdd\u7ba1\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -isRecordFiled.description=\u30ec\u30b3\u30fc\u30c9\u306f\u6574\u7406\u4fdd\u7ba1\u3055\u308c\u3066\u3044\u307e\u3059 - -# Are closed record folders -isRecordFolderClosed.title=\u9589\u3058\u3089\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -isRecordFolderClosed.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u9589\u3058\u3089\u308c\u3066\u3044\u307e\u3059 - -# Are vital -isVital.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -isVital.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5206\u985e\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 - -# Have Rentention Action -hasDispositionAction.title=\u4fdd\u7ba1\u51e6\u7406\u3042\u308a -hasDispositionAction.description=\u7279\u5b9a\u306e\u76f8\u5bfe\u4f4d\u7f6e\u306b\u4fdd\u7ba1\u51e6\u7406\u304c\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u3068\u30d5\u30a9\u30eb\u30c0 - -# Are kind -isKind.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30a2\u30a4\u30c6\u30e0\u306e\u30bf\u30a4\u30d7 -isKind.description=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u4e00\u90e8\u3092\u306a\u3059\u30a2\u30a4\u30c6\u30e0 -isKind.kind.display-label=\u7a2e\u985e - -# Are Record Type -isRecordType.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u3042\u308a -isRecordType.description=\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u3092\u6301\u3064\u30ec\u30b3\u30fc\u30c9 - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b -create-record.description=\u30d5\u30a1\u30a4\u30eb\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u307e\u3059 -create-record.file-plan.display-label=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3 -create-record.hide-record.display-label=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3059\u308b -# Declare As Version Record -declare-as-version-record.title=\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b -declare-as-version-record.description=\u30d5\u30a1\u30a4\u30eb\u306e\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u307e\u3059 -declare-as-version-record.file-plan.display-label=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3 -# Complete record -declareRecord.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5b8c\u4e86 -declareRecord.description=\u30ec\u30b3\u30fc\u30c9\u3092\u5b8c\u4e86\u3057\u307e\u3059 -# Reopens record -undeclareRecord.title=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304f -undeclareRecord.description=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304d\u307e\u3059 -# Open record folder -openRecordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u304f -openRecordFolder.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u304d\u307e\u3059 -# Close record folder -closeRecordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u308b -closeRecordFolder.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u307e\u3059 -# Complete event -completeEvent.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86 -completeEvent.description=\u30a4\u30d9\u30f3\u30c8\u3092\u5b8c\u4e86\u3057\u307e\u3059 -completeEvent.eventName.display-label=\u30a4\u30d9\u30f3\u30c8 -# Freeze -freeze.title=\u51cd\u7d50 -freeze.description=\u30ec\u30b3\u30fc\u30c9\u3092\u51cd\u7d50\u3057\u307e\u3059 -freeze.reason.display-label=\u7406\u7531 -# Unfreeze -unfreeze.title=\u51cd\u7d50\u89e3\u9664 -unfreeze.description=\u30ec\u30b3\u30fc\u30c9\u306e\u51cd\u7d50\u3092\u89e3\u9664\u3057\u307e\u3059 -# File to -fileTo.title=\u6574\u7406\u4fdd\u7ba1\u5148 -fileTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059 -fileTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 -fileTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 -# Copy to -copyTo.title=\u30b3\u30d4\u30fc\u5148 -copyTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059 -copyTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 -copyTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 -# Move to -moveTo.title=\u79fb\u52d5\u5148 -moveTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3057\u307e\u3059 -moveTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 -moveTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 -# Link to -linkTo.title=\u30ea\u30f3\u30af\u5148 -linkTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u30ea\u30f3\u30af\u3057\u307e\u3059 -linkTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 -linkTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 -# Reject -reject.title=\u5374\u4e0b -reject.description=\u30ec\u30b3\u30fc\u30c9\u3092\u5374\u4e0b\u3057\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u5143\u306e\u5834\u6240\u306b\u79fb\u52d5\u3057\u307e\u3059 -reject.reason.display-label=\u5374\u4e0b\u306e\u7406\u7531 -# Request Information -requestInfo.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8 -requestInfo.description=\u30ec\u30b3\u30fc\u30c9\u306e\u8a73\u7d30\u60c5\u5831\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u3092\u958b\u59cb\u3057\u307e\u3059 -# Execute script -executeScript.title=\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u884c -executeScript.description=\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059 -executeScript.script-ref.display-label=\u30b9\u30af\u30ea\u30d7\u30c8 -# Send Email -sendEmail.title=E \u30e1\u30fc\u30eb\u306e\u9001\u4fe1 -sendEmail.description=E \u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u307e\u3059 -# Set Property -setPropertyValue.title=\u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u306e\u8a2d\u5b9a -setPropertyValue.description=\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059 - -# Edit Hold Reason -editHoldReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531\u306e\u7de8\u96c6 -editHoldReason.description=\u30db\u30fc\u30eb\u30c9\u306e\u7406\u7531\u3092\u7de8\u96c6\u3057\u307e\u3059 -# Relinquish Hold -relinquishHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u89e3\u9664 -relinquishHold.description=\u30db\u30fc\u30eb\u30c9\u3092\u89e3\u9664\u3057\u307e\u3059 -# Edit Review As Of Date -editReviewAsOfDate.title=\u30ec\u30d3\u30e5\u30fc\u5b9f\u884c\u65e5\u306e\u7de8\u96c6 -editReviewAsOfDate.description=\u30ec\u30d3\u30e5\u30fc\u5b9f\u884c\u65e5\u3092\u7de8\u96c6\u3057\u307e\u3059 -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u3092\u7de8\u96c6 -editDispositionActionAsOfDate.description=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u3092\u7de8\u96c6\u3057\u307e\u3059 -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 -broadcastVitalRecordDefinition.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8\u3057\u307e\u3059 -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u306e\u66f4\u65b0\u60c5\u5831\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 -broadcastDispositionActionDefinitionUpdate.description=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u306e\u66f4\u65b0\u60c5\u5831\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8\u3057\u307e\u3059 -# Undo Event -undoEvent.title=\u30a4\u30d9\u30f3\u30c8\u3092\u5143\u306b\u623b\u3059 -undoEvent.description=\u30a4\u30d9\u30f3\u30c8\u3092\u5143\u306b\u623b\u3057\u307e\u3059 -# Transfer Complete -transferComplete.title=\u8ee2\u9001\u5b8c\u4e86 -transferComplete.description=\u8ee2\u9001\u5b8c\u4e86 -# Accession Complete -accessionComplete.title=\u53d7\u8afe\u5b8c\u4e86 -accessionComplete.description=\u53d7\u8afe\u5b8c\u4e86 -# Split Email -splitEmail.title=E \u30e1\u30fc\u30eb\u306e\u5206\u96e2 -splitEmail.description=E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3057\u307e\u3059 -# Create Rentention Schedule -createDispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306e\u4f5c\u6210 -createDispositionSchedule.description=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059 -# File Destruction Report -fileDestructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -fileDestructionReport.description=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u3092\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059 -# Cut off -cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -cutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5 -# Destroy -destroy.title=\u7834\u68c4 -destroy.description=\u7834\u68c4 -# Reviewed -reviewed.title=\u30ec\u30d3\u30e5\u30fc\u6e08\u307f -reviewed.description=\u30ec\u30d3\u30e5\u30fc\u6e08\u307f -# Hide Record -hide-record.title=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3059\u308b -hide-record.description=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3057\u307e\u3059 -# Transfer -transfer.title=\u8ee2\u9001 -transfer.description=\u8ee2\u9001 -# Uncut off -unCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u53d6\u308a\u6d88\u3059 -unCutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u53d6\u308a\u6d88\u3057\u307e\u3059 -# Accession -accession.title=\u53d7\u8afe -accession.description=\u53d7\u8afe -# Retain -retain.title=\u4fdd\u7ba1 -retain.description=\u4fdd\u7ba1 -# Add Record Types -addRecordTypes.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306e\u8ffd\u52a0 -addRecordTypes.description=\u9078\u629e\u3057\u305f\u30bf\u30a4\u30d7\u3092\u30ec\u30b3\u30fc\u30c9\u306b\u8ffd\u52a0\u3057\u307e\u3059 -# File report -fileReport.title=\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -fileReport.description=\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -# Delete Hold -deleteHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 -deleteHold.description=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 -# Move DM record -move-dm-record.title=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 -move-dm-record.description=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 -# Unlink from -unlinkFrom.title=\u30ea\u30f3\u30af\u306e\u89e3\u9664\u5143 -unlinkFrom.description=\u30ea\u30f3\u30af\u306e\u89e3\u9664\u5143 - -# Recordable version config -recordable-version-config.title=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 -recordable-version-config.description=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 -recordable-version-config.version.display-label=\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u81ea\u52d5\u7684\u306b\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea -rm-ac-is-kind-kinds.record_folder=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rm-ac-is-kind-kinds.record=\u30ec\u30b3\u30fc\u30c9 - -rm-ac-disposition-action-relative-positions.next=\u6b21\u3078 -rm-ac-disposition-action-relative-positions.previous=\u524d\u3078 -rm-ac-disposition-action-relative-positions.any=\u4efb\u610f - -ac-versions.none=\u8a2d\u5b9a\u3057\u306a\u3044 -ac-versions.major_only=\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u307f +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u308a\u5206\u985e\u6e08\u307f +isClassified.description=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u3063\u3066\u5206\u985e\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 + +# Are cutoff +isCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 +isCutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 + +# Are declared +isDeclared.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 +isDeclared.description=\u30ec\u30b3\u30fc\u30c9\u306f\u5b8c\u4e86\u3057\u3066\u3044\u307e\u3059 + +# Is on hold +isFrozen.title=\u30db\u30fc\u30eb\u30c9\u4e2d +isFrozen.description=\u30db\u30fc\u30eb\u30c9\u4e2d\u306e\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 + +# Are filed +isRecordFiled.title=\u6574\u7406\u4fdd\u7ba1\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 +isRecordFiled.description=\u30ec\u30b3\u30fc\u30c9\u306f\u6574\u7406\u4fdd\u7ba1\u3055\u308c\u3066\u3044\u307e\u3059 + +# Are closed record folders +isRecordFolderClosed.title=\u9589\u3058\u3089\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +isRecordFolderClosed.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u9589\u3058\u3089\u308c\u3066\u3044\u307e\u3059 + +# Are vital +isVital.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 +isVital.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5206\u985e\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 + +# Have Rentention Action +hasDispositionAction.title=\u4fdd\u7ba1\u51e6\u7406\u3042\u308a +hasDispositionAction.description=\u7279\u5b9a\u306e\u76f8\u5bfe\u4f4d\u7f6e\u306b\u4fdd\u7ba1\u51e6\u7406\u304c\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u3068\u30d5\u30a9\u30eb\u30c0 + +# Are kind +isKind.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30a2\u30a4\u30c6\u30e0\u306e\u30bf\u30a4\u30d7 +isKind.description=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u4e00\u90e8\u3092\u306a\u3059\u30a2\u30a4\u30c6\u30e0 +isKind.kind.display-label=\u7a2e\u985e + +# Are Record Type +isRecordType.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u3042\u308a +isRecordType.description=\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u3092\u6301\u3064\u30ec\u30b3\u30fc\u30c9 + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b +create-record.description=\u30d5\u30a1\u30a4\u30eb\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u307e\u3059 +create-record.file-plan.display-label=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3 +create-record.hide-record.display-label=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3059\u308b +# Declare As Version Record +declare-as-version-record.title=\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b +declare-as-version-record.description=\u30d5\u30a1\u30a4\u30eb\u306e\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u307e\u3059 +declare-as-version-record.file-plan.display-label=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3 +# Complete record +declareRecord.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5b8c\u4e86 +declareRecord.description=\u30ec\u30b3\u30fc\u30c9\u3092\u5b8c\u4e86\u3057\u307e\u3059 +# Reopens record +undeclareRecord.title=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304f +undeclareRecord.description=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304d\u307e\u3059 +# Open record folder +openRecordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u304f +openRecordFolder.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u304d\u307e\u3059 +# Close record folder +closeRecordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u308b +closeRecordFolder.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u307e\u3059 +# Complete event +completeEvent.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86 +completeEvent.description=\u30a4\u30d9\u30f3\u30c8\u3092\u5b8c\u4e86\u3057\u307e\u3059 +completeEvent.eventName.display-label=\u30a4\u30d9\u30f3\u30c8 +# Freeze +freeze.title=\u51cd\u7d50 +freeze.description=\u30ec\u30b3\u30fc\u30c9\u3092\u51cd\u7d50\u3057\u307e\u3059 +freeze.reason.display-label=\u7406\u7531 +# Unfreeze +unfreeze.title=\u51cd\u7d50\u89e3\u9664 +unfreeze.description=\u30ec\u30b3\u30fc\u30c9\u306e\u51cd\u7d50\u3092\u89e3\u9664\u3057\u307e\u3059 +# File to +fileTo.title=\u6574\u7406\u4fdd\u7ba1\u5148 +fileTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059 +fileTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 +fileTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 +# Copy to +copyTo.title=\u30b3\u30d4\u30fc\u5148 +copyTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059 +copyTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 +copyTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 +# Move to +moveTo.title=\u79fb\u52d5\u5148 +moveTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3057\u307e\u3059 +moveTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 +moveTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 +# Link to +linkTo.title=\u30ea\u30f3\u30af\u5148 +linkTo.description=\u30ec\u30b3\u30fc\u30c9\u3092\u7279\u5b9a\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306b\u30ea\u30f3\u30af\u3057\u307e\u3059 +linkTo.path.display-label=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9 +linkTo.createRecordPath.display-label=\u30ec\u30b3\u30fc\u30c9\u30d1\u30b9\u306e\u4f5c\u6210 +# Reject +reject.title=\u5374\u4e0b +reject.description=\u30ec\u30b3\u30fc\u30c9\u3092\u5374\u4e0b\u3057\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u5143\u306e\u5834\u6240\u306b\u79fb\u52d5\u3057\u307e\u3059 +reject.reason.display-label=\u5374\u4e0b\u306e\u7406\u7531 +# Request Information +requestInfo.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8 +requestInfo.description=\u30ec\u30b3\u30fc\u30c9\u306e\u8a73\u7d30\u60c5\u5831\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u3092\u958b\u59cb\u3057\u307e\u3059 +# Execute script +executeScript.title=\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u884c +executeScript.description=\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059 +executeScript.script-ref.display-label=\u30b9\u30af\u30ea\u30d7\u30c8 +# Send Email +sendEmail.title=E \u30e1\u30fc\u30eb\u306e\u9001\u4fe1 +sendEmail.description=E \u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u307e\u3059 +# Set Property +setPropertyValue.title=\u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u306e\u8a2d\u5b9a +setPropertyValue.description=\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059 + +# Edit Hold Reason +editHoldReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531\u306e\u7de8\u96c6 +editHoldReason.description=\u30db\u30fc\u30eb\u30c9\u306e\u7406\u7531\u3092\u7de8\u96c6\u3057\u307e\u3059 +# Relinquish Hold +relinquishHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u89e3\u9664 +relinquishHold.description=\u30db\u30fc\u30eb\u30c9\u3092\u89e3\u9664\u3057\u307e\u3059 +# Edit Review As Of Date +editReviewAsOfDate.title=\u30ec\u30d3\u30e5\u30fc\u5b9f\u884c\u65e5\u306e\u7de8\u96c6 +editReviewAsOfDate.description=\u30ec\u30d3\u30e5\u30fc\u5b9f\u884c\u65e5\u3092\u7de8\u96c6\u3057\u307e\u3059 +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u3092\u7de8\u96c6 +editDispositionActionAsOfDate.description=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u65e5\u3092\u7de8\u96c6\u3057\u307e\u3059 +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 +broadcastVitalRecordDefinition.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8\u3057\u307e\u3059 +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u306e\u66f4\u65b0\u60c5\u5831\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8 +broadcastDispositionActionDefinitionUpdate.description=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u306e\u66f4\u65b0\u60c5\u5831\u3092\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8\u3057\u307e\u3059 +# Undo Event +undoEvent.title=\u30a4\u30d9\u30f3\u30c8\u3092\u5143\u306b\u623b\u3059 +undoEvent.description=\u30a4\u30d9\u30f3\u30c8\u3092\u5143\u306b\u623b\u3057\u307e\u3059 +# Transfer Complete +transferComplete.title=\u8ee2\u9001\u5b8c\u4e86 +transferComplete.description=\u8ee2\u9001\u5b8c\u4e86 +# Accession Complete +accessionComplete.title=\u53d7\u8afe\u5b8c\u4e86 +accessionComplete.description=\u53d7\u8afe\u5b8c\u4e86 +# Split Email +splitEmail.title=E \u30e1\u30fc\u30eb\u306e\u5206\u96e2 +splitEmail.description=E \u30e1\u30fc\u30eb\u3092\u5206\u96e2\u3057\u307e\u3059 +# Create Rentention Schedule +createDispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306e\u4f5c\u6210 +createDispositionSchedule.description=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059 +# File Destruction Report +fileDestructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 +fileDestructionReport.description=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u3092\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059 +# Cut off +cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 +cutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5 +# Destroy +destroy.title=\u7834\u68c4 +destroy.description=\u7834\u68c4 +# Reviewed +reviewed.title=\u30ec\u30d3\u30e5\u30fc\u6e08\u307f +reviewed.description=\u30ec\u30d3\u30e5\u30fc\u6e08\u307f +# Hide Record +hide-record.title=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3059\u308b +hide-record.description=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3057\u307e\u3059 +# Transfer +transfer.title=\u8ee2\u9001 +transfer.description=\u8ee2\u9001 +# Uncut off +unCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u53d6\u308a\u6d88\u3059 +unCutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5\u3092\u53d6\u308a\u6d88\u3057\u307e\u3059 +# Accession +accession.title=\u53d7\u8afe +accession.description=\u53d7\u8afe +# Retain +retain.title=\u4fdd\u7ba1 +retain.description=\u4fdd\u7ba1 +# Add Record Types +addRecordTypes.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306e\u8ffd\u52a0 +addRecordTypes.description=\u9078\u629e\u3057\u305f\u30bf\u30a4\u30d7\u3092\u30ec\u30b3\u30fc\u30c9\u306b\u8ffd\u52a0\u3057\u307e\u3059 +# File report +fileReport.title=\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 +fileReport.description=\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 +# Delete Hold +deleteHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 +deleteHold.description=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 +# Move DM record +move-dm-record.title=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 +move-dm-record.description=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 +# Unlink from +unlinkFrom.title=\u30ea\u30f3\u30af\u306e\u89e3\u9664\u5143 +unlinkFrom.description=\u30ea\u30f3\u30af\u306e\u89e3\u9664\u5143 + +# Recordable version config +recordable-version-config.title=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 +recordable-version-config.description=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 +recordable-version-config.version.display-label=\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u81ea\u52d5\u7684\u306b\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea +rm-ac-is-kind-kinds.record_folder=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +rm-ac-is-kind-kinds.record=\u30ec\u30b3\u30fc\u30c9 + +rm-ac-disposition-action-relative-positions.next=\u6b21\u3078 +rm-ac-disposition-action-relative-positions.previous=\u524d\u3078 +rm-ac-disposition-action-relative-positions.any=\u4efb\u610f + +ac-versions.none=\u8a2d\u5b9a\u3057\u306a\u3044 +ac-versions.major_only=\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u307f ac-versions.all=\u3059\u3079\u3066\u306e\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u30de\u30a4\u30ca\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties index 030f8b1f9b..f042d4f798 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Klassifisert etter retensjonsplanen -isClassified.description=Oppf\u00f8ringer og oppf\u00f8ringsmapper klassifisert etter en retensjonsplan - -# Are cutoff -isCutoff.title=Cut off -isCutoff.description=Cut off av oppf\u00f8ringer og oppf\u00f8ringsmapper. - -# Are declared -isDeclared.title=Oppf\u00f8ring fullf\u00f8rt -isDeclared.description=Oppf\u00f8ring er fullf\u00f8rt - -# Is on hold -isFrozen.title=P\u00e5 hold -isFrozen.description=Oppf\u00f8ring eller oppf\u00f8ringsmappe p\u00e5 hold. - -# Are filed -isRecordFiled.title=Oppf\u00f8ring registrert -isRecordFiled.description=Oppf\u00f8ring er registrert - -# Are closed record folders -isRecordFolderClosed.title=Oppf\u00f8ringsmappe lukket -isRecordFolderClosed.description=Oppf\u00f8ringsmappe er lukket - -# Are vital -isVital.title=Sv\u00e6rt viktig oppf\u00f8ring -isVital.description=Oppf\u00f8ring eller oppf\u00f8ringsmappe er en v\u00e6rt viktig oppf\u00f8ring - -# Have Rentention Action -hasDispositionAction.title=Har retensjonshandling -hasDispositionAction.description=Oppf\u00f8ringene og mappene har de spesifikke assosierte retensjonshandlingen p\u00e5 den spesifiserte relative posisjonen - -# Are kind -isKind.title=Type element ved oppf\u00f8ringsh\u00e5ndtering -isKind.description=Elementer er en type filplankomponent -isKind.kind.display-label=Type - -# Are Record Type -isRecordType.title=Har oppf\u00f8ringstype -isRecordType.description=Oppf\u00f8ringer har en bestemt oppf\u00f8ringstype - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=Erkl\u00e6r som oppf\u00f8ring -create-record.description=Erkl\u00e6rer filen som oppf\u00f8ring -create-record.file-plan.display-label=Filplan -create-record.hide-record.display-label=Skjul oppf\u00f8ring -# Declare As Version Record -declare-as-version-record.title=Erkl\u00e6r versjonen som oppf\u00f8ring -declare-as-version-record.description=Erkl\u00e6rer denne versjonen av filen som er oppf\u00f8ring -declare-as-version-record.file-plan.display-label=Filplan -# Complete record -declareRecord.title=Fullf\u00f8r oppf\u00f8ring -declareRecord.description=Fullf\u00f8rer en oppf\u00f8ring -# Reopens record -undeclareRecord.title=\u00c5pne oppf\u00f8ring p\u00e5 nytt -undeclareRecord.description=\u00c5pner en oppf\u00f8ring p\u00e5 nytt -# Open record folder -openRecordFolder.title=\u00c5pne oppf\u00f8ringsmappe -openRecordFolder.description=\u00c5pner en oppf\u00f8ringsmappe -# Close record folder -closeRecordFolder.title=Lukk oppf\u00f8ringsmappe -closeRecordFolder.description=Lukker en oppf\u00f8ringsmappe -# Complete event -completeEvent.title=Fullf\u00f8r hendelse -completeEvent.description=Fullf\u00f8rer en hendelse -completeEvent.eventName.display-label=Hendelse -# Freeze -freeze.title=Frys -freeze.description=Fryser en oppf\u00f8ring -freeze.reason.display-label=Grunn -# Unfreeze -unfreeze.title=T\u00f8 opp -unfreeze.description=T\u00f8r opp en oppf\u00f8ring -# File to -fileTo.title=Arkiver i -fileTo.description=En oppf\u00f8ring arkiveres i en bestemt oppf\u00f8ringsmappe -fileTo.path.display-label=Bane til oppf\u00f8ringsmappe -fileTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane -# Copy to -copyTo.title=Kopier til -copyTo.description=En oppf\u00f8ring kopieres i en bestemt oppf\u00f8ringsmappe -copyTo.path.display-label=Bane til oppf\u00f8ringsmappe -copyTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane -# Move to -moveTo.title=Flytt til -moveTo.description=En oppf\u00f8ring flyttes til i en bestemt oppf\u00f8ringsmappe -moveTo.path.display-label=Bane til oppf\u00f8ringsmappe -moveTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane -# Link to -linkTo.title=Koble til -linkTo.description=En oppf\u00f8ring kobles til i en bestemt oppf\u00f8ringsmappe -linkTo.path.display-label=Bane til oppf\u00f8ringsmappe -linkTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane -# Reject -reject.title=Avvis -reject.description=En oppf\u00f8ring avvises, og filen flyttes til det opprinnelige stedet -reject.reason.display-label=\u00c5rsak til avvisning -# Request Information -requestInfo.title=Be om informasjon -requestInfo.description=Starter en arbeidsflyt for \u00e5 be om mer informasjon om en oppf\u00f8ring -# Execute script -executeScript.title=Kj\u00f8r skript -executeScript.description=Kj\u00f8r et skript. -executeScript.script-ref.display-label=Skript -# Send Email -sendEmail.title=Send e-post -sendEmail.description=Send en e-post -# Set Property -setPropertyValue.title=Still inn egenskapsverdi -setPropertyValue.description=Still inn en egenskapsverdi - -# Edit Hold Reason -editHoldReason.title=Rediger grunn til holdet -editHoldReason.description=Rediger grunnen til holdet -# Relinquish Hold -relinquishHold.title=Avslutt hold -relinquishHold.description=Avslutt holdet -# Edit Review As Of Date -editReviewAsOfDate.title=Rediger gjennomgang per datoen -editReviewAsOfDate.description=Rediger gjennomgang per datoen -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Rediger retensjonshandling per datoen -editDispositionActionAsOfDate.description=Rediger retensjonshandlingen per datoen -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Kringkast definisjonen til sv\u00e6rt viktig oppf\u00f8ring -broadcastVitalRecordDefinition.description=Kringkast definisjonen til den sv\u00e6rt viktige oppf\u00f8ringen -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Kringkast oppdatering av definisjonen til retensjonshandling -broadcastDispositionActionDefinitionUpdate.description=Kringkast oppdatering av definisjonen til retensjonshandling -# Undo Event -undoEvent.title=Angre hendelse -undoEvent.description=Angre hendelse -# Transfer Complete -transferComplete.title=Overf\u00f8ring fullf\u00f8rt -transferComplete.description=Overf\u00f8ring fullf\u00f8rt -# Accession Complete -accessionComplete.title=Tilgang fullf\u00f8rt -accessionComplete.description=Tilgang fullf\u00f8rt -# Split Email -splitEmail.title=Delt e-post -splitEmail.description=Delt e-post -# Create Rentention Schedule -createDispositionSchedule.title=Opprett retensjonsplan -createDispositionSchedule.description=Opprett retensjonsplan -# File Destruction Report -fileDestructionReport.title=Fildestruksjonsrapport -fileDestructionReport.description=Fildestruksjonsrapport -# Cut off -cutoff.title=Cut off -cutoff.description=Cut off -# Destroy -destroy.title=Destruer -destroy.description=Destruer -# Reviewed -reviewed.title=Gjennomg\u00e5tt -reviewed.description=Gjennomg\u00e5tt -# Hide Record -hide-record.title=Skjul oppf\u00f8ring -hide-record.description=Skjul oppf\u00f8ring -# Transfer -transfer.title=Overf\u00f8r -transfer.description=Overf\u00f8r -# Uncut off -unCutoff.title=Angre cut off -unCutoff.description=Angre cut off -# Accession -accession.title=Tilgang -accession.description=Tilgang -# Retain -retain.title=Behold -retain.description=Behold -# Add Record Types -addRecordTypes.title=Legg til oppf\u00f8ringstyper -addRecordTypes.description=Legger valgt(e) type(r) til oppf\u00f8ringen -# File report -fileReport.title=Registrer rapport -fileReport.description=Registrer rapport -# Delete Hold -deleteHold.title=Slett hold -deleteHold.description=Slett hold -# Move DM record -move-dm-record.title=Flytt oppf\u00f8ring -move-dm-record.description=Flytt oppf\u00f8ring -# Unlink from -unlinkFrom.title=Koble fra -unlinkFrom.description=Koble fra - -# Recordable version config -recordable-version-config.title=Alternativer med automatiske erkl\u00e6ringer -recordable-version-config.description=Alternativer med automatiske erkl\u00e6ringer -recordable-version-config.version.display-label=Erkl\u00e6rer alternativene med automatiske erkl\u00e6ringer som oppf\u00f8ringer - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Oppf\u00f8ringskategori -rm-ac-is-kind-kinds.record_folder=Oppf\u00f8ringsmappe -rm-ac-is-kind-kinds.record=Oppf\u00f8ring - -rm-ac-disposition-action-relative-positions.next=Neste -rm-ac-disposition-action-relative-positions.previous=Forrige -rm-ac-disposition-action-relative-positions.any=Enhver - -ac-versions.none=Aldri -ac-versions.major_only=Kun hovedversjoner +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=Klassifisert etter retensjonsplanen +isClassified.description=Oppf\u00f8ringer og oppf\u00f8ringsmapper klassifisert etter en retensjonsplan + +# Are cutoff +isCutoff.title=Cut off +isCutoff.description=Cut off av oppf\u00f8ringer og oppf\u00f8ringsmapper. + +# Are declared +isDeclared.title=Oppf\u00f8ring fullf\u00f8rt +isDeclared.description=Oppf\u00f8ring er fullf\u00f8rt + +# Is on hold +isFrozen.title=P\u00e5 hold +isFrozen.description=Oppf\u00f8ring eller oppf\u00f8ringsmappe p\u00e5 hold. + +# Are filed +isRecordFiled.title=Oppf\u00f8ring registrert +isRecordFiled.description=Oppf\u00f8ring er registrert + +# Are closed record folders +isRecordFolderClosed.title=Oppf\u00f8ringsmappe lukket +isRecordFolderClosed.description=Oppf\u00f8ringsmappe er lukket + +# Are vital +isVital.title=Sv\u00e6rt viktig oppf\u00f8ring +isVital.description=Oppf\u00f8ring eller oppf\u00f8ringsmappe er en v\u00e6rt viktig oppf\u00f8ring + +# Have Rentention Action +hasDispositionAction.title=Har retensjonshandling +hasDispositionAction.description=Oppf\u00f8ringene og mappene har de spesifikke assosierte retensjonshandlingen p\u00e5 den spesifiserte relative posisjonen + +# Are kind +isKind.title=Type element ved oppf\u00f8ringsh\u00e5ndtering +isKind.description=Elementer er en type filplankomponent +isKind.kind.display-label=Type + +# Are Record Type +isRecordType.title=Har oppf\u00f8ringstype +isRecordType.description=Oppf\u00f8ringer har en bestemt oppf\u00f8ringstype + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=Erkl\u00e6r som oppf\u00f8ring +create-record.description=Erkl\u00e6rer filen som oppf\u00f8ring +create-record.file-plan.display-label=Filplan +create-record.hide-record.display-label=Skjul oppf\u00f8ring +# Declare As Version Record +declare-as-version-record.title=Erkl\u00e6r versjonen som oppf\u00f8ring +declare-as-version-record.description=Erkl\u00e6rer denne versjonen av filen som er oppf\u00f8ring +declare-as-version-record.file-plan.display-label=Filplan +# Complete record +declareRecord.title=Fullf\u00f8r oppf\u00f8ring +declareRecord.description=Fullf\u00f8rer en oppf\u00f8ring +# Reopens record +undeclareRecord.title=\u00c5pne oppf\u00f8ring p\u00e5 nytt +undeclareRecord.description=\u00c5pner en oppf\u00f8ring p\u00e5 nytt +# Open record folder +openRecordFolder.title=\u00c5pne oppf\u00f8ringsmappe +openRecordFolder.description=\u00c5pner en oppf\u00f8ringsmappe +# Close record folder +closeRecordFolder.title=Lukk oppf\u00f8ringsmappe +closeRecordFolder.description=Lukker en oppf\u00f8ringsmappe +# Complete event +completeEvent.title=Fullf\u00f8r hendelse +completeEvent.description=Fullf\u00f8rer en hendelse +completeEvent.eventName.display-label=Hendelse +# Freeze +freeze.title=Frys +freeze.description=Fryser en oppf\u00f8ring +freeze.reason.display-label=Grunn +# Unfreeze +unfreeze.title=T\u00f8 opp +unfreeze.description=T\u00f8r opp en oppf\u00f8ring +# File to +fileTo.title=Arkiver i +fileTo.description=En oppf\u00f8ring arkiveres i en bestemt oppf\u00f8ringsmappe +fileTo.path.display-label=Bane til oppf\u00f8ringsmappe +fileTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane +# Copy to +copyTo.title=Kopier til +copyTo.description=En oppf\u00f8ring kopieres i en bestemt oppf\u00f8ringsmappe +copyTo.path.display-label=Bane til oppf\u00f8ringsmappe +copyTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane +# Move to +moveTo.title=Flytt til +moveTo.description=En oppf\u00f8ring flyttes til i en bestemt oppf\u00f8ringsmappe +moveTo.path.display-label=Bane til oppf\u00f8ringsmappe +moveTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane +# Link to +linkTo.title=Koble til +linkTo.description=En oppf\u00f8ring kobles til i en bestemt oppf\u00f8ringsmappe +linkTo.path.display-label=Bane til oppf\u00f8ringsmappe +linkTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane +# Reject +reject.title=Avvis +reject.description=En oppf\u00f8ring avvises, og filen flyttes til det opprinnelige stedet +reject.reason.display-label=\u00c5rsak til avvisning +# Request Information +requestInfo.title=Be om informasjon +requestInfo.description=Starter en arbeidsflyt for \u00e5 be om mer informasjon om en oppf\u00f8ring +# Execute script +executeScript.title=Kj\u00f8r skript +executeScript.description=Kj\u00f8r et skript. +executeScript.script-ref.display-label=Skript +# Send Email +sendEmail.title=Send e-post +sendEmail.description=Send en e-post +# Set Property +setPropertyValue.title=Still inn egenskapsverdi +setPropertyValue.description=Still inn en egenskapsverdi + +# Edit Hold Reason +editHoldReason.title=Rediger grunn til holdet +editHoldReason.description=Rediger grunnen til holdet +# Relinquish Hold +relinquishHold.title=Avslutt hold +relinquishHold.description=Avslutt holdet +# Edit Review As Of Date +editReviewAsOfDate.title=Rediger gjennomgang per datoen +editReviewAsOfDate.description=Rediger gjennomgang per datoen +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=Rediger retensjonshandling per datoen +editDispositionActionAsOfDate.description=Rediger retensjonshandlingen per datoen +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=Kringkast definisjonen til sv\u00e6rt viktig oppf\u00f8ring +broadcastVitalRecordDefinition.description=Kringkast definisjonen til den sv\u00e6rt viktige oppf\u00f8ringen +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=Kringkast oppdatering av definisjonen til retensjonshandling +broadcastDispositionActionDefinitionUpdate.description=Kringkast oppdatering av definisjonen til retensjonshandling +# Undo Event +undoEvent.title=Angre hendelse +undoEvent.description=Angre hendelse +# Transfer Complete +transferComplete.title=Overf\u00f8ring fullf\u00f8rt +transferComplete.description=Overf\u00f8ring fullf\u00f8rt +# Accession Complete +accessionComplete.title=Tilgang fullf\u00f8rt +accessionComplete.description=Tilgang fullf\u00f8rt +# Split Email +splitEmail.title=Delt e-post +splitEmail.description=Delt e-post +# Create Rentention Schedule +createDispositionSchedule.title=Opprett retensjonsplan +createDispositionSchedule.description=Opprett retensjonsplan +# File Destruction Report +fileDestructionReport.title=Fildestruksjonsrapport +fileDestructionReport.description=Fildestruksjonsrapport +# Cut off +cutoff.title=Cut off +cutoff.description=Cut off +# Destroy +destroy.title=Destruer +destroy.description=Destruer +# Reviewed +reviewed.title=Gjennomg\u00e5tt +reviewed.description=Gjennomg\u00e5tt +# Hide Record +hide-record.title=Skjul oppf\u00f8ring +hide-record.description=Skjul oppf\u00f8ring +# Transfer +transfer.title=Overf\u00f8r +transfer.description=Overf\u00f8r +# Uncut off +unCutoff.title=Angre cut off +unCutoff.description=Angre cut off +# Accession +accession.title=Tilgang +accession.description=Tilgang +# Retain +retain.title=Behold +retain.description=Behold +# Add Record Types +addRecordTypes.title=Legg til oppf\u00f8ringstyper +addRecordTypes.description=Legger valgt(e) type(r) til oppf\u00f8ringen +# File report +fileReport.title=Registrer rapport +fileReport.description=Registrer rapport +# Delete Hold +deleteHold.title=Slett hold +deleteHold.description=Slett hold +# Move DM record +move-dm-record.title=Flytt oppf\u00f8ring +move-dm-record.description=Flytt oppf\u00f8ring +# Unlink from +unlinkFrom.title=Koble fra +unlinkFrom.description=Koble fra + +# Recordable version config +recordable-version-config.title=Alternativer med automatiske erkl\u00e6ringer +recordable-version-config.description=Alternativer med automatiske erkl\u00e6ringer +recordable-version-config.version.display-label=Erkl\u00e6rer alternativene med automatiske erkl\u00e6ringer som oppf\u00f8ringer + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=Oppf\u00f8ringskategori +rm-ac-is-kind-kinds.record_folder=Oppf\u00f8ringsmappe +rm-ac-is-kind-kinds.record=Oppf\u00f8ring + +rm-ac-disposition-action-relative-positions.next=Neste +rm-ac-disposition-action-relative-positions.previous=Forrige +rm-ac-disposition-action-relative-positions.any=Enhver + +ac-versions.none=Aldri +ac-versions.major_only=Kun hovedversjoner ac-versions.all=Til alle hovedversjoner og mindre versjoner \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties index 46ef73ce32..9dccabde5d 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Geclassificeerd op retentieschema -isClassified.description=Records of archiefmappen zijn geclassificeerd op een retentieschema - -# Are cutoff -isCutoff.title=Afsluiten -isCutoff.description=Records of archiefmappen zijn afgesloten - -# Are declared -isDeclared.title=Record afgerond -isDeclared.description=Record is afgerond - -# Is on hold -isFrozen.title=In wachtstand -isFrozen.description=Record of archiefmap in wachtstand - -# Are filed -isRecordFiled.title=Record gearchiveerd -isRecordFiled.description=Record is gearchiveerd - -# Are closed record folders -isRecordFolderClosed.title=Archiefmap gesloten -isRecordFolderClosed.description=Archiefmap is gesloten - -# Are vital -isVital.title=Vitale record -isVital.description=Record of archiefmap is een vitale record - -# Have Rentention Action -hasDispositionAction.title=Heeft retentieactie -hasDispositionAction.description=Records en mappen hebben de opgegeven gekoppelde retentieactie op de opgegeven relatieve positie - -# Are kind -isKind.title=Type onderdeel Records Management -isKind.description=Onderdelen zijn van een type ordeningsplancomponent -isKind.kind.display-label=Type - -# Are Record Type -isRecordType.title=Heeft recordtype -isRecordType.description=Records hebben een opgegeven recordtype - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=Declareren als record -create-record.description=Hiermee wordt een bestand gedeclareerd als een record -create-record.file-plan.display-label=Ordeningsplan -create-record.hide-record.display-label=Record verbergen -# Declare As Version Record -declare-as-version-record.title=Versie declareren als record -declare-as-version-record.description=Hiermee wordt deze versie van het bestand gedeclareerd als een record -declare-as-version-record.file-plan.display-label=Ordeningsplan -# Complete record -declareRecord.title=Record afronden -declareRecord.description=Hiermee wordt een record afgerond -# Reopens record -undeclareRecord.title=Record heropenen -undeclareRecord.description=Hiermee wordt een record heropend -# Open record folder -openRecordFolder.title=Archiefmap openen -openRecordFolder.description=Hiermee wordt een archiefmap geopend -# Close record folder -closeRecordFolder.title=Archiefmap sluiten -closeRecordFolder.description=Hiermee wordt een archiefmap gesloten -# Complete event -completeEvent.title=Gebeurtenis afronden -completeEvent.description=Hiermee wordt een gebeurtenis afgerond -completeEvent.eventName.display-label=Gebeurtenis -# Freeze -freeze.title=Bevriezen -freeze.description=Hiermee wordt een record bevroren -freeze.reason.display-label=Reden -# Unfreeze -unfreeze.title=Bevriezen opheffen -unfreeze.description=Hiermee wordt de bevriezing van een record opgeheven -# File to -fileTo.title=Archiveren in -fileTo.description=Hiermee wordt een record gearchiveerd in de opgegeven archiefmap -fileTo.path.display-label=Pad naar archiefmap -fileTo.createRecordPath.display-label=Recordpad maken -# Copy to -copyTo.title=Kopi\u00ebren naar -copyTo.description=Hiermee wordt een record gekopieerd naar de opgegeven archiefmap -copyTo.path.display-label=Pad naar archiefmap -copyTo.createRecordPath.display-label=Recordpad maken -# Move to -moveTo.title=Verplaatsen naar -moveTo.description=Hiermee wordt een record verplaatst naar de opgegeven archiefmap -moveTo.path.display-label=Pad naar archiefmap -moveTo.createRecordPath.display-label=Recordpad maken -# Link to -linkTo.title=Koppelen naar -linkTo.description=Hiermee wordt een record gekoppeld naar de opgegeven archiefmap -linkTo.path.display-label=Pad naar archiefmap -linkTo.createRecordPath.display-label=Recordpad maken -# Reject -reject.title=Afwijzen -reject.description=Hiermee wordt een record afgewezen en wordt het document naar de originele locatie verplaatst -reject.reason.display-label=Reden voor afwijzing -# Request Information -requestInfo.title=Informatie aanvragen -requestInfo.description=Hiermee wordt een workflow gestart voor het aanvragen van meer informatie over een record. -# Execute script -executeScript.title=Script uitvoeren -executeScript.description=Een script uitvoeren -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=E-mail verzenden -sendEmail.description=Een e-mail verzenden -# Set Property -setPropertyValue.title=Eigenschapwaarde instellen -setPropertyValue.description=Een eigenschapwaarde instellen - -# Edit Hold Reason -editHoldReason.title=Reden van wachtstand bewerken -editHoldReason.description=De reden van de wachtstand bewerken -# Relinquish Hold -relinquishHold.title=Wachtstand afwijzen -relinquishHold.description=De wachtstand afwijzen -# Edit Review As Of Date -editReviewAsOfDate.title=Begindatum revisie bewerken -editReviewAsOfDate.description=Begindatum revisie bewerken -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Begindatum retentieactie bewerken -editDispositionActionAsOfDate.description=De begindatum van de retentieactie bewerken -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Definitie vitale record uitzenden -broadcastVitalRecordDefinition.description=Definitie van de vitale record uitzenden -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Update van definitie retentieactie uitzenden -broadcastDispositionActionDefinitionUpdate.description=Update van definitie retentieactie uitzenden -# Undo Event -undoEvent.title=Gebeurtenis ongedaan maken -undoEvent.description=Gebeurtenis ongedaan maken -# Transfer Complete -transferComplete.title=Overzetten afgerond -transferComplete.description=Overzetten afgerond -# Accession Complete -accessionComplete.title=Overdracht afgerond -accessionComplete.description=Overdracht afgerond -# Split Email -splitEmail.title=E-mail opsplitsen -splitEmail.description=E-mail opsplitsen -# Create Rentention Schedule -createDispositionSchedule.title=Retentieschema maken -createDispositionSchedule.description=Retentieschema maken -# File Destruction Report -fileDestructionReport.title=Vernietigingsrapport archiveren -fileDestructionReport.description=Vernietigingsrapport archiveren -# Cut off -cutoff.title=Afsluiten -cutoff.description=Afsluiten -# Destroy -destroy.title=Vernietigen -destroy.description=Vernietigen -# Reviewed -reviewed.title=Gereviseerd -reviewed.description=Gereviseerd -# Hide Record -hide-record.title=Record verbergen -hide-record.description=Record verbergen -# Transfer -transfer.title=Overzetten -transfer.description=Overzetten -# Uncut off -unCutoff.title=Afsluiten ongedaan maken -unCutoff.description=Afsluiten ongedaan maken -# Accession -accession.title=Overdracht -accession.description=Overdracht -# Retain -retain.title=Behouden -retain.description=Behouden -# Add Record Types -addRecordTypes.title=Recordtypes toevoegen -addRecordTypes.description=Hiermee worden de geselecteerde types aan de record toegevoegd. -# File report -fileReport.title=Rapport archiveren -fileReport.description=Rapport archiveren -# Delete Hold -deleteHold.title=Wachtstand verwijderen -deleteHold.description=Wachtstand verwijderen -# Move DM record -move-dm-record.title=Record verplaatsen -move-dm-record.description=Record verplaatsen -# Unlink from -unlinkFrom.title=Koppeling opheffen met -unlinkFrom.description=Koppeling opheffen met - -# Recordable version config -recordable-version-config.title=Opties voor automatisch declareren -recordable-version-config.description=Opties voor automatisch declareren -recordable-version-config.version.display-label=Versies automatisch declareren als records - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Recordcategorie -rm-ac-is-kind-kinds.record_folder=Archiefmap -rm-ac-is-kind-kinds.record=Record - -rm-ac-disposition-action-relative-positions.next=Volgende -rm-ac-disposition-action-relative-positions.previous=Vorige -rm-ac-disposition-action-relative-positions.any=Willekeurig - -ac-versions.none=Nooit -ac-versions.major_only=Alleen voor primaire versies +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=Geclassificeerd op retentieschema +isClassified.description=Records of archiefmappen zijn geclassificeerd op een retentieschema + +# Are cutoff +isCutoff.title=Afsluiten +isCutoff.description=Records of archiefmappen zijn afgesloten + +# Are declared +isDeclared.title=Record afgerond +isDeclared.description=Record is afgerond + +# Is on hold +isFrozen.title=In wachtstand +isFrozen.description=Record of archiefmap in wachtstand + +# Are filed +isRecordFiled.title=Record gearchiveerd +isRecordFiled.description=Record is gearchiveerd + +# Are closed record folders +isRecordFolderClosed.title=Archiefmap gesloten +isRecordFolderClosed.description=Archiefmap is gesloten + +# Are vital +isVital.title=Vitale record +isVital.description=Record of archiefmap is een vitale record + +# Have Rentention Action +hasDispositionAction.title=Heeft retentieactie +hasDispositionAction.description=Records en mappen hebben de opgegeven gekoppelde retentieactie op de opgegeven relatieve positie + +# Are kind +isKind.title=Type onderdeel Records Management +isKind.description=Onderdelen zijn van een type ordeningsplancomponent +isKind.kind.display-label=Type + +# Are Record Type +isRecordType.title=Heeft recordtype +isRecordType.description=Records hebben een opgegeven recordtype + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=Declareren als record +create-record.description=Hiermee wordt een bestand gedeclareerd als een record +create-record.file-plan.display-label=Ordeningsplan +create-record.hide-record.display-label=Record verbergen +# Declare As Version Record +declare-as-version-record.title=Versie declareren als record +declare-as-version-record.description=Hiermee wordt deze versie van het bestand gedeclareerd als een record +declare-as-version-record.file-plan.display-label=Ordeningsplan +# Complete record +declareRecord.title=Record afronden +declareRecord.description=Hiermee wordt een record afgerond +# Reopens record +undeclareRecord.title=Record heropenen +undeclareRecord.description=Hiermee wordt een record heropend +# Open record folder +openRecordFolder.title=Archiefmap openen +openRecordFolder.description=Hiermee wordt een archiefmap geopend +# Close record folder +closeRecordFolder.title=Archiefmap sluiten +closeRecordFolder.description=Hiermee wordt een archiefmap gesloten +# Complete event +completeEvent.title=Gebeurtenis afronden +completeEvent.description=Hiermee wordt een gebeurtenis afgerond +completeEvent.eventName.display-label=Gebeurtenis +# Freeze +freeze.title=Bevriezen +freeze.description=Hiermee wordt een record bevroren +freeze.reason.display-label=Reden +# Unfreeze +unfreeze.title=Bevriezen opheffen +unfreeze.description=Hiermee wordt de bevriezing van een record opgeheven +# File to +fileTo.title=Archiveren in +fileTo.description=Hiermee wordt een record gearchiveerd in de opgegeven archiefmap +fileTo.path.display-label=Pad naar archiefmap +fileTo.createRecordPath.display-label=Recordpad maken +# Copy to +copyTo.title=Kopi\u00ebren naar +copyTo.description=Hiermee wordt een record gekopieerd naar de opgegeven archiefmap +copyTo.path.display-label=Pad naar archiefmap +copyTo.createRecordPath.display-label=Recordpad maken +# Move to +moveTo.title=Verplaatsen naar +moveTo.description=Hiermee wordt een record verplaatst naar de opgegeven archiefmap +moveTo.path.display-label=Pad naar archiefmap +moveTo.createRecordPath.display-label=Recordpad maken +# Link to +linkTo.title=Koppelen naar +linkTo.description=Hiermee wordt een record gekoppeld naar de opgegeven archiefmap +linkTo.path.display-label=Pad naar archiefmap +linkTo.createRecordPath.display-label=Recordpad maken +# Reject +reject.title=Afwijzen +reject.description=Hiermee wordt een record afgewezen en wordt het document naar de originele locatie verplaatst +reject.reason.display-label=Reden voor afwijzing +# Request Information +requestInfo.title=Informatie aanvragen +requestInfo.description=Hiermee wordt een workflow gestart voor het aanvragen van meer informatie over een record. +# Execute script +executeScript.title=Script uitvoeren +executeScript.description=Een script uitvoeren +executeScript.script-ref.display-label=Script +# Send Email +sendEmail.title=E-mail verzenden +sendEmail.description=Een e-mail verzenden +# Set Property +setPropertyValue.title=Eigenschapwaarde instellen +setPropertyValue.description=Een eigenschapwaarde instellen + +# Edit Hold Reason +editHoldReason.title=Reden van wachtstand bewerken +editHoldReason.description=De reden van de wachtstand bewerken +# Relinquish Hold +relinquishHold.title=Wachtstand afwijzen +relinquishHold.description=De wachtstand afwijzen +# Edit Review As Of Date +editReviewAsOfDate.title=Begindatum revisie bewerken +editReviewAsOfDate.description=Begindatum revisie bewerken +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=Begindatum retentieactie bewerken +editDispositionActionAsOfDate.description=De begindatum van de retentieactie bewerken +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=Definitie vitale record uitzenden +broadcastVitalRecordDefinition.description=Definitie van de vitale record uitzenden +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=Update van definitie retentieactie uitzenden +broadcastDispositionActionDefinitionUpdate.description=Update van definitie retentieactie uitzenden +# Undo Event +undoEvent.title=Gebeurtenis ongedaan maken +undoEvent.description=Gebeurtenis ongedaan maken +# Transfer Complete +transferComplete.title=Overzetten afgerond +transferComplete.description=Overzetten afgerond +# Accession Complete +accessionComplete.title=Overdracht afgerond +accessionComplete.description=Overdracht afgerond +# Split Email +splitEmail.title=E-mail opsplitsen +splitEmail.description=E-mail opsplitsen +# Create Rentention Schedule +createDispositionSchedule.title=Retentieschema maken +createDispositionSchedule.description=Retentieschema maken +# File Destruction Report +fileDestructionReport.title=Vernietigingsrapport archiveren +fileDestructionReport.description=Vernietigingsrapport archiveren +# Cut off +cutoff.title=Afsluiten +cutoff.description=Afsluiten +# Destroy +destroy.title=Vernietigen +destroy.description=Vernietigen +# Reviewed +reviewed.title=Gereviseerd +reviewed.description=Gereviseerd +# Hide Record +hide-record.title=Record verbergen +hide-record.description=Record verbergen +# Transfer +transfer.title=Overzetten +transfer.description=Overzetten +# Uncut off +unCutoff.title=Afsluiten ongedaan maken +unCutoff.description=Afsluiten ongedaan maken +# Accession +accession.title=Overdracht +accession.description=Overdracht +# Retain +retain.title=Behouden +retain.description=Behouden +# Add Record Types +addRecordTypes.title=Recordtypes toevoegen +addRecordTypes.description=Hiermee worden de geselecteerde types aan de record toegevoegd. +# File report +fileReport.title=Rapport archiveren +fileReport.description=Rapport archiveren +# Delete Hold +deleteHold.title=Wachtstand verwijderen +deleteHold.description=Wachtstand verwijderen +# Move DM record +move-dm-record.title=Record verplaatsen +move-dm-record.description=Record verplaatsen +# Unlink from +unlinkFrom.title=Koppeling opheffen met +unlinkFrom.description=Koppeling opheffen met + +# Recordable version config +recordable-version-config.title=Opties voor automatisch declareren +recordable-version-config.description=Opties voor automatisch declareren +recordable-version-config.version.display-label=Versies automatisch declareren als records + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=Recordcategorie +rm-ac-is-kind-kinds.record_folder=Archiefmap +rm-ac-is-kind-kinds.record=Record + +rm-ac-disposition-action-relative-positions.next=Volgende +rm-ac-disposition-action-relative-positions.previous=Vorige +rm-ac-disposition-action-relative-positions.any=Willekeurig + +ac-versions.none=Nooit +ac-versions.major_only=Alleen voor primaire versies ac-versions.all=Voor alle primaire en secundaire versies \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties index 3bbf0484da..565de14090 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Classificado por programa\u00e7\u00e3o de reten\u00e7\u00e3o -isClassified.description=Os documentos arquiv\u00edsticos ou as pastas de documentos arquiv\u00edsticos foram classificados por uma programa\u00e7\u00e3o de reten\u00e7\u00e3o - -# Are cutoff -isCutoff.title=Cortar -isCutoff.description=Os documentos arquiv\u00edsticos ou as pastas de documentos arquiv\u00edsticos s\u00e3o cortados - -# Are declared -isDeclared.title=Documento arquiv\u00edstico conclu\u00eddo -isDeclared.description=Documento arquiv\u00edstico foi conclu\u00eddo - -# Is on hold -isFrozen.title=Em espera -isFrozen.description=O documento arquiv\u00edstico ou a pasta de documento arquiv\u00edstico est\u00e1 em espera - -# Are filed -isRecordFiled.title=Documento arquiv\u00edstico arquivado -isRecordFiled.description=Documento arquiv\u00edstico est\u00e1 arquivado - -# Are closed record folders -isRecordFolderClosed.title=Pasta de documento arquiv\u00edstico fechada -isRecordFolderClosed.description=Pasta de documento arquiv\u00edstico est\u00e1 fechada - -# Are vital -isVital.title=Documento arquiv\u00edstico vital -isVital.description=O documento arquiv\u00edstico ou a pasta de documento arquiv\u00edstico \u00e9 um documento arquiv\u00edstico vital - -# Have Rentention Action -hasDispositionAction.title=Tem a\u00e7\u00e3o de reten\u00e7\u00e3o -hasDispositionAction.description=Os documentos arquiv\u00edsticos e pastas obtiveram a a\u00e7\u00e3o de reten\u00e7\u00e3o associada especificada na posi\u00e7\u00e3o relativa especificada - -# Are kind -isKind.title=Tipo de item do Records Management -isKind.description=Os itens s\u00e3o de um tipo de componente de plano de arquivo -isKind.kind.display-label=Tipo - -# Are Record Type -isRecordType.title=Tem tipo de documento arquiv\u00edstico -isRecordType.description=Os documentos arquiv\u00edsticos t\u00eam um tipo de documento arquiv\u00edstico especificado - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=Declarar como documento arquiv\u00edstico -create-record.description=Declara o arquivo com um documento arquiv\u00edstico. -create-record.file-plan.display-label=Plano de arquivo -create-record.hide-record.display-label=Ocultar documento arquiv\u00edstico -# Declare As Version Record -declare-as-version-record.title=Declarar vers\u00e3o como documento arquiv\u00edstico -declare-as-version-record.description=Declara essa vers\u00e3o do arquivo como um documento arquiv\u00edstico -declare-as-version-record.file-plan.display-label=Plano de arquivo -# Complete record -declareRecord.title=Concluir documento arquiv\u00edstico -declareRecord.description=Conclui um documento arquiv\u00edstico -# Reopens record -undeclareRecord.title=Reabrir documento arquiv\u00edstico -undeclareRecord.description=Reabre um documento arquiv\u00edstico -# Open record folder -openRecordFolder.title=Abrir pasta de documento arquiv\u00edstico -openRecordFolder.description=Abre uma pasta de documento arquiv\u00edstico -# Close record folder -closeRecordFolder.title=Fechar pasta de documento arquiv\u00edstico -closeRecordFolder.description=Fecha uma pasta de documento arquiv\u00edstico -# Complete event -completeEvent.title=Concluir evento -completeEvent.description=Conclui um evento -completeEvent.eventName.display-label=Evento -# Freeze -freeze.title=Congelar -freeze.description=Congela um documento arquiv\u00edstico -freeze.reason.display-label=Motivo -# Unfreeze -unfreeze.title=Descongelar -unfreeze.description=Descongela um documento arquiv\u00edstico -# File to -fileTo.title=Arquivar em -fileTo.description=Arquiva um documento arquiv\u00edstico na pasta de documento arquiv\u00edstico especificada -fileTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico -fileTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico -# Copy to -copyTo.title=Copiar para -copyTo.description=Copia um documento arquiv\u00edstico para a pasta de documento arquiv\u00edstico especificada -copyTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico -copyTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico -# Move to -moveTo.title=Mover para -moveTo.description=Move um documento arquiv\u00edstico para a pasta de documento arquiv\u00edstico especificada -moveTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico -moveTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico -# Link to -linkTo.title=Vincular a -linkTo.description=Vincula um documento arquiv\u00edstico \u00e0 pasta de documento arquiv\u00edstico especificada -linkTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico -linkTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico -# Reject -reject.title=Rejeitar -reject.description=Rejeita um documento arquiv\u00edstico e move o arquivo para seu local original -reject.reason.display-label=Motivo da rejei\u00e7\u00e3o -# Request Information -requestInfo.title=Solicitar informa\u00e7\u00f5es -requestInfo.description=Inicia um fluxo de trabalho para solicitar mais informa\u00e7\u00f5es de um documento arquiv\u00edstico -# Execute script -executeScript.title=Executar script -executeScript.description=Executa um script -executeScript.script-ref.display-label=Script -# Send Email -sendEmail.title=Enviar e-mail -sendEmail.description=Envia um e-mail -# Set Property -setPropertyValue.title=Definir valor da propriedade -setPropertyValue.description=Define um valor de propriedade - -# Edit Hold Reason -editHoldReason.title=Editar motivo para manter -editHoldReason.description=Edita o motivo para manter -# Relinquish Hold -relinquishHold.title=Desistir da espera -relinquishHold.description=Desiste da espera -# Edit Review As Of Date -editReviewAsOfDate.title=Editar data inicial de revis\u00e3o -editReviewAsOfDate.description=Editar data inicial de revis\u00e3o -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Editar data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o -editDispositionActionAsOfDate.description=Editar a data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Transmitir defini\u00e7\u00e3o do documento arquiv\u00edstico vital -broadcastVitalRecordDefinition.description=Transmitir a defini\u00e7\u00e3o do documento arquiv\u00edstico vital -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Transmitir atualiza\u00e7\u00e3o da defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o -broadcastDispositionActionDefinitionUpdate.description=Transmitir atualiza\u00e7\u00e3o da defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o -# Undo Event -undoEvent.title=Desfazer evento -undoEvent.description=Desfazer evento -# Transfer Complete -transferComplete.title=Transfer\u00eancia conclu\u00edda -transferComplete.description=Transfer\u00eancia conclu\u00edda -# Accession Complete -accessionComplete.title=Ades\u00e3o conclu\u00edda -accessionComplete.description=Ades\u00e3o conclu\u00edda -# Split Email -splitEmail.title=Dividir e-mail -splitEmail.description=Dividir e-mail -# Create Rentention Schedule -createDispositionSchedule.title=Criar programa\u00e7\u00e3o de reten\u00e7\u00e3o -createDispositionSchedule.description=Criar programa\u00e7\u00e3o de reten\u00e7\u00e3o -# File Destruction Report -fileDestructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos -fileDestructionReport.description=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos -# Cut off -cutoff.title=Cortar -cutoff.description=Cortar -# Destroy -destroy.title=Destruir -destroy.description=Destruir -# Reviewed -reviewed.title=Revisado -reviewed.description=Revisado -# Hide Record -hide-record.title=Ocultar documento arquiv\u00edstico -hide-record.description=Ocultar documento arquiv\u00edstico -# Transfer -transfer.title=Transferir -transfer.description=Transferir -# Uncut off -unCutoff.title=Desfazer corte -unCutoff.description=Desfazer corte -# Accession -accession.title=Ades\u00e3o -accession.description=Ades\u00e3o -# Retain -retain.title=Manter -retain.description=Manter -# Add Record Types -addRecordTypes.title=Adicionar tipos de documento arquiv\u00edstico -addRecordTypes.description=Adiciona o(s) tipo(s) selecionado(s) ao documento arquiv\u00edstico -# File report -fileReport.title=Arquivar relat\u00f3rio -fileReport.description=Arquivar relat\u00f3rio -# Delete Hold -deleteHold.title=Excluir espera -deleteHold.description=Excluir espera -# Move DM record -move-dm-record.title=Mover documento arquiv\u00edstico -move-dm-record.description=Mover documento arquiv\u00edstico -# Unlink from -unlinkFrom.title=Desvincular de -unlinkFrom.description=Desvincular de - -# Recordable version config -recordable-version-config.title=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o -recordable-version-config.description=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o -recordable-version-config.version.display-label=Declarar automaticamente vers\u00f5es como documentos arquiv\u00edsticos - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Categoria de documento arquiv\u00edstico -rm-ac-is-kind-kinds.record_folder=Pasta de documento arquiv\u00edstico -rm-ac-is-kind-kinds.record=Documento arquiv\u00edstico - -rm-ac-disposition-action-relative-positions.next=Pr\u00f3ximo -rm-ac-disposition-action-relative-positions.previous=Anterior -rm-ac-disposition-action-relative-positions.any=Qualquer - -ac-versions.none=Nunca -ac-versions.major_only=Somente para vers\u00f5es principais +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=Classificado por programa\u00e7\u00e3o de reten\u00e7\u00e3o +isClassified.description=Os documentos arquiv\u00edsticos ou as pastas de documentos arquiv\u00edsticos foram classificados por uma programa\u00e7\u00e3o de reten\u00e7\u00e3o + +# Are cutoff +isCutoff.title=Cortar +isCutoff.description=Os documentos arquiv\u00edsticos ou as pastas de documentos arquiv\u00edsticos s\u00e3o cortados + +# Are declared +isDeclared.title=Documento arquiv\u00edstico conclu\u00eddo +isDeclared.description=Documento arquiv\u00edstico foi conclu\u00eddo + +# Is on hold +isFrozen.title=Em espera +isFrozen.description=O documento arquiv\u00edstico ou a pasta de documento arquiv\u00edstico est\u00e1 em espera + +# Are filed +isRecordFiled.title=Documento arquiv\u00edstico arquivado +isRecordFiled.description=Documento arquiv\u00edstico est\u00e1 arquivado + +# Are closed record folders +isRecordFolderClosed.title=Pasta de documento arquiv\u00edstico fechada +isRecordFolderClosed.description=Pasta de documento arquiv\u00edstico est\u00e1 fechada + +# Are vital +isVital.title=Documento arquiv\u00edstico vital +isVital.description=O documento arquiv\u00edstico ou a pasta de documento arquiv\u00edstico \u00e9 um documento arquiv\u00edstico vital + +# Have Rentention Action +hasDispositionAction.title=Tem a\u00e7\u00e3o de reten\u00e7\u00e3o +hasDispositionAction.description=Os documentos arquiv\u00edsticos e pastas obtiveram a a\u00e7\u00e3o de reten\u00e7\u00e3o associada especificada na posi\u00e7\u00e3o relativa especificada + +# Are kind +isKind.title=Tipo de item do Records Management +isKind.description=Os itens s\u00e3o de um tipo de componente de plano de arquivo +isKind.kind.display-label=Tipo + +# Are Record Type +isRecordType.title=Tem tipo de documento arquiv\u00edstico +isRecordType.description=Os documentos arquiv\u00edsticos t\u00eam um tipo de documento arquiv\u00edstico especificado + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=Declarar como documento arquiv\u00edstico +create-record.description=Declara o arquivo com um documento arquiv\u00edstico. +create-record.file-plan.display-label=Plano de arquivo +create-record.hide-record.display-label=Ocultar documento arquiv\u00edstico +# Declare As Version Record +declare-as-version-record.title=Declarar vers\u00e3o como documento arquiv\u00edstico +declare-as-version-record.description=Declara essa vers\u00e3o do arquivo como um documento arquiv\u00edstico +declare-as-version-record.file-plan.display-label=Plano de arquivo +# Complete record +declareRecord.title=Concluir documento arquiv\u00edstico +declareRecord.description=Conclui um documento arquiv\u00edstico +# Reopens record +undeclareRecord.title=Reabrir documento arquiv\u00edstico +undeclareRecord.description=Reabre um documento arquiv\u00edstico +# Open record folder +openRecordFolder.title=Abrir pasta de documento arquiv\u00edstico +openRecordFolder.description=Abre uma pasta de documento arquiv\u00edstico +# Close record folder +closeRecordFolder.title=Fechar pasta de documento arquiv\u00edstico +closeRecordFolder.description=Fecha uma pasta de documento arquiv\u00edstico +# Complete event +completeEvent.title=Concluir evento +completeEvent.description=Conclui um evento +completeEvent.eventName.display-label=Evento +# Freeze +freeze.title=Congelar +freeze.description=Congela um documento arquiv\u00edstico +freeze.reason.display-label=Motivo +# Unfreeze +unfreeze.title=Descongelar +unfreeze.description=Descongela um documento arquiv\u00edstico +# File to +fileTo.title=Arquivar em +fileTo.description=Arquiva um documento arquiv\u00edstico na pasta de documento arquiv\u00edstico especificada +fileTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico +fileTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico +# Copy to +copyTo.title=Copiar para +copyTo.description=Copia um documento arquiv\u00edstico para a pasta de documento arquiv\u00edstico especificada +copyTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico +copyTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico +# Move to +moveTo.title=Mover para +moveTo.description=Move um documento arquiv\u00edstico para a pasta de documento arquiv\u00edstico especificada +moveTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico +moveTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico +# Link to +linkTo.title=Vincular a +linkTo.description=Vincula um documento arquiv\u00edstico \u00e0 pasta de documento arquiv\u00edstico especificada +linkTo.path.display-label=Caminho para pasta de documento arquiv\u00edstico +linkTo.createRecordPath.display-label=Criar caminho do documento arquiv\u00edstico +# Reject +reject.title=Rejeitar +reject.description=Rejeita um documento arquiv\u00edstico e move o arquivo para seu local original +reject.reason.display-label=Motivo da rejei\u00e7\u00e3o +# Request Information +requestInfo.title=Solicitar informa\u00e7\u00f5es +requestInfo.description=Inicia um fluxo de trabalho para solicitar mais informa\u00e7\u00f5es de um documento arquiv\u00edstico +# Execute script +executeScript.title=Executar script +executeScript.description=Executa um script +executeScript.script-ref.display-label=Script +# Send Email +sendEmail.title=Enviar e-mail +sendEmail.description=Envia um e-mail +# Set Property +setPropertyValue.title=Definir valor da propriedade +setPropertyValue.description=Define um valor de propriedade + +# Edit Hold Reason +editHoldReason.title=Editar motivo para manter +editHoldReason.description=Edita o motivo para manter +# Relinquish Hold +relinquishHold.title=Desistir da espera +relinquishHold.description=Desiste da espera +# Edit Review As Of Date +editReviewAsOfDate.title=Editar data inicial de revis\u00e3o +editReviewAsOfDate.description=Editar data inicial de revis\u00e3o +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=Editar data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o +editDispositionActionAsOfDate.description=Editar a data de in\u00edcio da a\u00e7\u00e3o de reten\u00e7\u00e3o +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=Transmitir defini\u00e7\u00e3o do documento arquiv\u00edstico vital +broadcastVitalRecordDefinition.description=Transmitir a defini\u00e7\u00e3o do documento arquiv\u00edstico vital +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=Transmitir atualiza\u00e7\u00e3o da defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o +broadcastDispositionActionDefinitionUpdate.description=Transmitir atualiza\u00e7\u00e3o da defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o +# Undo Event +undoEvent.title=Desfazer evento +undoEvent.description=Desfazer evento +# Transfer Complete +transferComplete.title=Transfer\u00eancia conclu\u00edda +transferComplete.description=Transfer\u00eancia conclu\u00edda +# Accession Complete +accessionComplete.title=Ades\u00e3o conclu\u00edda +accessionComplete.description=Ades\u00e3o conclu\u00edda +# Split Email +splitEmail.title=Dividir e-mail +splitEmail.description=Dividir e-mail +# Create Rentention Schedule +createDispositionSchedule.title=Criar programa\u00e7\u00e3o de reten\u00e7\u00e3o +createDispositionSchedule.description=Criar programa\u00e7\u00e3o de reten\u00e7\u00e3o +# File Destruction Report +fileDestructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos +fileDestructionReport.description=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos +# Cut off +cutoff.title=Cortar +cutoff.description=Cortar +# Destroy +destroy.title=Destruir +destroy.description=Destruir +# Reviewed +reviewed.title=Revisado +reviewed.description=Revisado +# Hide Record +hide-record.title=Ocultar documento arquiv\u00edstico +hide-record.description=Ocultar documento arquiv\u00edstico +# Transfer +transfer.title=Transferir +transfer.description=Transferir +# Uncut off +unCutoff.title=Desfazer corte +unCutoff.description=Desfazer corte +# Accession +accession.title=Ades\u00e3o +accession.description=Ades\u00e3o +# Retain +retain.title=Manter +retain.description=Manter +# Add Record Types +addRecordTypes.title=Adicionar tipos de documento arquiv\u00edstico +addRecordTypes.description=Adiciona o(s) tipo(s) selecionado(s) ao documento arquiv\u00edstico +# File report +fileReport.title=Arquivar relat\u00f3rio +fileReport.description=Arquivar relat\u00f3rio +# Delete Hold +deleteHold.title=Excluir espera +deleteHold.description=Excluir espera +# Move DM record +move-dm-record.title=Mover documento arquiv\u00edstico +move-dm-record.description=Mover documento arquiv\u00edstico +# Unlink from +unlinkFrom.title=Desvincular de +unlinkFrom.description=Desvincular de + +# Recordable version config +recordable-version-config.title=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o +recordable-version-config.description=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o +recordable-version-config.version.display-label=Declarar automaticamente vers\u00f5es como documentos arquiv\u00edsticos + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=Categoria de documento arquiv\u00edstico +rm-ac-is-kind-kinds.record_folder=Pasta de documento arquiv\u00edstico +rm-ac-is-kind-kinds.record=Documento arquiv\u00edstico + +rm-ac-disposition-action-relative-positions.next=Pr\u00f3ximo +rm-ac-disposition-action-relative-positions.previous=Anterior +rm-ac-disposition-action-relative-positions.any=Qualquer + +ac-versions.none=Nunca +ac-versions.major_only=Somente para vers\u00f5es principais ac-versions.all=Para todas as vers\u00f5es principais e secund\u00e1rias \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties index 8bbcdb49c1..313be895b1 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -isClassified.description=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f - -# Are cutoff -isCutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -isCutoff.description=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u044b - -# Are declared -isDeclared.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 -isDeclared.description=\u0417\u0430\u043f\u0438\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0439 - -# Is on hold -isFrozen.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 -isFrozen.description=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 - -# Are filed -isRecordFiled.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0432 \u0444\u0430\u0439\u043b -isRecordFiled.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0432 \u0444\u0430\u0439\u043b - -# Are closed record folders -isRecordFolderClosed.title=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u0430\u043a\u0440\u044b\u0442\u0430 -isRecordFolderClosed.description=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u0430\u043a\u0440\u044b\u0442\u0430 - -# Are vital -isVital.title=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -isVital.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e - -# Have Rentention Action -hasDispositionAction.title=\u0415\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -hasDispositionAction.description=\u0423 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u043f\u0430\u043f\u043e\u043a \u0435\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438 - -# Are kind -isKind.title=\u0422\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -isKind.description=\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438 \u0430\u0440\u0445\u0438\u0432\u0430 -isKind.kind.display-label=\u0422\u0438\u043f - -# Are Record Type -isRecordType.title=\u0415\u0441\u0442\u044c \u0442\u0438\u043f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -isRecordType.description=\u0412 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0435\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u044c -create-record.description=\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044c\u044e -create-record.file-plan.display-label=\u0410\u0440\u0445\u0438\u0432 -create-record.hide-record.display-label=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -# Declare As Version Record -declare-as-version-record.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044c\u044e -declare-as-version-record.description=\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044c\u044e -declare-as-version-record.file-plan.display-label=\u0410\u0440\u0445\u0438\u0432 -# Complete record -declareRecord.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -declareRecord.description=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -# Reopens record -undeclareRecord.title=\u041f\u0435\u0440\u0435\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -undeclareRecord.description=\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -# Open record folder -openRecordFolder.title=\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -openRecordFolder.description=\u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -# Close record folder -closeRecordFolder.title=\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -closeRecordFolder.description=\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -# Complete event -completeEvent.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -completeEvent.description=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f -completeEvent.eventName.display-label=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 -# Freeze -freeze.title=\u0417\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c -freeze.description=\u0417\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -freeze.reason.display-label=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 -# Unfreeze -unfreeze.title=\u041e\u0442\u043a\u0440\u0435\u043f\u0438\u0442\u044c -unfreeze.description=\u041e\u0442\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -# File to -fileTo.title=\u0421\u0434\u0430\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0432 -fileTo.description=\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -fileTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -fileTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# Copy to -copyTo.title=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 -copyTo.description=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -copyTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -copyTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# Move to -moveTo.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 -moveTo.description=\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -moveTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -moveTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# Link to -linkTo.title=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0441 -linkTo.description=\u0421\u0432\u044f\u0437\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -linkTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -linkTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# Reject -reject.title=\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c -reject.description=\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -reject.reason.display-label=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f -# Request Information -requestInfo.title=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e -requestInfo.description=\u0417\u0430\u043f\u0443\u0441\u043a \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0437\u0430\u043f\u0438\u0441\u0438 -# Execute script -executeScript.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 -executeScript.description=\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 -executeScript.script-ref.display-label=\u0421\u043a\u0440\u0438\u043f\u0442 -# Send Email -sendEmail.title=\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 -sendEmail.description=\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f -# Set Property -setPropertyValue.title=\u0417\u0430\u0434\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 -setPropertyValue.description=\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 - -# Edit Hold Reason -editHoldReason.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -editHoldReason.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -# Relinquish Hold -relinquishHold.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -relinquishHold.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -# Edit Review As Of Date -editReviewAsOfDate.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0434\u0430\u0442\u0443 -editReviewAsOfDate.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0434\u0430\u0442\u0443 -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 -editDispositionActionAsOfDate.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -broadcastVitalRecordDefinition.description=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -broadcastDispositionActionDefinitionUpdate.description=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -# Undo Event -undoEvent.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -undoEvent.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -# Transfer Complete -transferComplete.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 -transferComplete.description=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 -# Accession Complete -accessionComplete.title=\u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d -accessionComplete.description=\u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d -# Split Email -splitEmail.title=\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 -splitEmail.description=\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 -# Create Rentention Schedule -createDispositionSchedule.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -createDispositionSchedule.description=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -# File Destruction Report -fileDestructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 -fileDestructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 -# Cut off -cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -cutoff.description=\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c -# Destroy -destroy.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c -destroy.description=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c -# Reviewed -reviewed.title=\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e -reviewed.description=\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e -# Hide Record -hide-record.title=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -hide-record.description=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -# Transfer -transfer.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c -transfer.description=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c -# Uncut off -unCutoff.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435 -unCutoff.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435 -# Accession -accession.title=\u0414\u043e\u0441\u0442\u0443\u043f -accession.description=\u0414\u043e\u0441\u0442\u0443\u043f -# Retain -retain.title=\u0425\u0440\u0430\u043d\u0438\u0442\u044c -retain.description=\u0425\u0440\u0430\u043d\u0438\u0442\u044c -# Add Record Types -addRecordTypes.title=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -addRecordTypes.description=\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -# File report -fileReport.title=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b -fileReport.description=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b -# Delete Hold -deleteHold.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -deleteHold.description=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -# Move DM record -move-dm-record.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -move-dm-record.description=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -# Unlink from -unlinkFrom.title=\u041e\u0442\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043e\u0442 -unlinkFrom.description=\u041e\u0442\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043e\u0442 - -# Recordable version config -recordable-version-config.title=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f -recordable-version-config.description=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f -recordable-version-config.version.display-label=\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0438 - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rm-ac-is-kind-kinds.record_folder=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rm-ac-is-kind-kinds.record=\u0417\u0430\u043f\u0438\u0441\u044c - -rm-ac-disposition-action-relative-positions.next=\u0414\u0430\u043b\u0435\u0435 -rm-ac-disposition-action-relative-positions.previous=\u041d\u0430\u0437\u0430\u0434 -rm-ac-disposition-action-relative-positions.any=\u041b\u044e\u0431\u043e\u0439 - -ac-versions.none=\u041d\u0438\u043a\u043e\u0433\u0434\u0430 -ac-versions.major_only=\u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=\u041a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +isClassified.description=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f + +# Are cutoff +isCutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c +isCutoff.description=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u044b + +# Are declared +isDeclared.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 +isDeclared.description=\u0417\u0430\u043f\u0438\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0439 + +# Is on hold +isFrozen.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 +isFrozen.description=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 + +# Are filed +isRecordFiled.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0432 \u0444\u0430\u0439\u043b +isRecordFiled.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0432 \u0444\u0430\u0439\u043b + +# Are closed record folders +isRecordFolderClosed.title=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u0430\u043a\u0440\u044b\u0442\u0430 +isRecordFolderClosed.description=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u0430\u043a\u0440\u044b\u0442\u0430 + +# Are vital +isVital.title=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c +isVital.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e + +# Have Rentention Action +hasDispositionAction.title=\u0415\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +hasDispositionAction.description=\u0423 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u043f\u0430\u043f\u043e\u043a \u0435\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438 + +# Are kind +isKind.title=\u0422\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +isKind.description=\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438 \u0430\u0440\u0445\u0438\u0432\u0430 +isKind.kind.display-label=\u0422\u0438\u043f + +# Are Record Type +isRecordType.title=\u0415\u0441\u0442\u044c \u0442\u0438\u043f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +isRecordType.description=\u0412 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0435\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u044c +create-record.description=\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044c\u044e +create-record.file-plan.display-label=\u0410\u0440\u0445\u0438\u0432 +create-record.hide-record.display-label=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c +# Declare As Version Record +declare-as-version-record.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044c\u044e +declare-as-version-record.description=\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044c\u044e +declare-as-version-record.file-plan.display-label=\u0410\u0440\u0445\u0438\u0432 +# Complete record +declareRecord.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c +declareRecord.description=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +# Reopens record +undeclareRecord.title=\u041f\u0435\u0440\u0435\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c +undeclareRecord.description=\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +# Open record folder +openRecordFolder.title=\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +openRecordFolder.description=\u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +# Close record folder +closeRecordFolder.title=\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +closeRecordFolder.description=\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +# Complete event +completeEvent.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +completeEvent.description=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f +completeEvent.eventName.display-label=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 +# Freeze +freeze.title=\u0417\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c +freeze.description=\u0417\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +freeze.reason.display-label=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 +# Unfreeze +unfreeze.title=\u041e\u0442\u043a\u0440\u0435\u043f\u0438\u0442\u044c +unfreeze.description=\u041e\u0442\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +# File to +fileTo.title=\u0421\u0434\u0430\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0432 +fileTo.description=\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +fileTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +fileTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 +# Copy to +copyTo.title=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 +copyTo.description=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +copyTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +copyTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 +# Move to +moveTo.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 +moveTo.description=\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +moveTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +moveTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 +# Link to +linkTo.title=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0441 +linkTo.description=\u0421\u0432\u044f\u0437\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +linkTo.path.display-label=\u041f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +linkTo.createRecordPath.display-label=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 +# Reject +reject.title=\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c +reject.description=\u041e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 +reject.reason.display-label=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f +# Request Information +requestInfo.title=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e +requestInfo.description=\u0417\u0430\u043f\u0443\u0441\u043a \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0437\u0430\u043f\u0438\u0441\u0438 +# Execute script +executeScript.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 +executeScript.description=\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 +executeScript.script-ref.display-label=\u0421\u043a\u0440\u0438\u043f\u0442 +# Send Email +sendEmail.title=\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 +sendEmail.description=\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f +# Set Property +setPropertyValue.title=\u0417\u0430\u0434\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 +setPropertyValue.description=\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 + +# Edit Hold Reason +editHoldReason.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +editHoldReason.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +# Relinquish Hold +relinquishHold.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 +relinquishHold.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 +# Edit Review As Of Date +editReviewAsOfDate.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0434\u0430\u0442\u0443 +editReviewAsOfDate.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0434\u0430\u0442\u0443 +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 +editDispositionActionAsOfDate.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 +broadcastVitalRecordDefinition.description=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +broadcastDispositionActionDefinitionUpdate.description=\u0420\u0430\u0437\u043e\u0441\u043b\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +# Undo Event +undoEvent.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +undoEvent.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +# Transfer Complete +transferComplete.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 +transferComplete.description=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 +# Accession Complete +accessionComplete.title=\u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d +accessionComplete.description=\u0414\u043e\u0441\u0442\u0443\u043f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d +# Split Email +splitEmail.title=\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 +splitEmail.description=\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 +# Create Rentention Schedule +createDispositionSchedule.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +createDispositionSchedule.description=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +# File Destruction Report +fileDestructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 +fileDestructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 +# Cut off +cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c +cutoff.description=\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c +# Destroy +destroy.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c +destroy.description=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c +# Reviewed +reviewed.title=\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e +reviewed.description=\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e +# Hide Record +hide-record.title=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c +hide-record.description=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c +# Transfer +transfer.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c +transfer.description=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c +# Uncut off +unCutoff.title=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435 +unCutoff.description=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u0435 +# Accession +accession.title=\u0414\u043e\u0441\u0442\u0443\u043f +accession.description=\u0414\u043e\u0441\u0442\u0443\u043f +# Retain +retain.title=\u0425\u0440\u0430\u043d\u0438\u0442\u044c +retain.description=\u0425\u0440\u0430\u043d\u0438\u0442\u044c +# Add Record Types +addRecordTypes.title=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +addRecordTypes.description=\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 +# File report +fileReport.title=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b +fileReport.description=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b +# Delete Hold +deleteHold.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 +deleteHold.description=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 +# Move DM record +move-dm-record.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c +move-dm-record.description=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c +# Unlink from +unlinkFrom.title=\u041e\u0442\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043e\u0442 +unlinkFrom.description=\u041e\u0442\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043e\u0442 + +# Recordable version config +recordable-version-config.title=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f +recordable-version-config.description=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f +recordable-version-config.version.display-label=\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0438 + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +rm-ac-is-kind-kinds.record_folder=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +rm-ac-is-kind-kinds.record=\u0417\u0430\u043f\u0438\u0441\u044c + +rm-ac-disposition-action-relative-positions.next=\u0414\u0430\u043b\u0435\u0435 +rm-ac-disposition-action-relative-positions.previous=\u041d\u0430\u0437\u0430\u0434 +rm-ac-disposition-action-relative-positions.any=\u041b\u044e\u0431\u043e\u0439 + +ac-versions.none=\u041d\u0438\u043a\u043e\u0433\u0434\u0430 +ac-versions.major_only=\u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 ac-versions.all=\u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties index 3dcd87f502..8ce93cfa0f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties @@ -1,211 +1,211 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=\u6309\u4fdd\u7559\u8ba1\u5212\u5206\u7c7b -isClassified.description=\u6309\u4fdd\u7559\u8ba1\u5212\u5c06\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u5206\u7c7b - -# Are cutoff -isCutoff.title=\u4e2d\u65ad -isCutoff.description=\u5df2\u4e2d\u65ad\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 - -# Are declared -isDeclared.title=\u8bb0\u5f55\u5df2\u5b8c\u6210 -isDeclared.description=\u8bb0\u5f55\u5df2\u5b8c\u6210 - -# Is on hold -isFrozen.title=\u4fdd\u5b58\u4e2d -isFrozen.description=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u5728\u4fdd\u5b58\u4e2d - -# Are filed -isRecordFiled.title=\u8bb0\u5f55\u5df2\u7acb\u5377 -isRecordFiled.description=\u8bb0\u5f55\u5df2\u7acb\u5377 - -# Are closed record folders -isRecordFolderClosed.title=\u8bb0\u5f55\u6587\u4ef6\u5939\u5df2\u5173\u95ed -isRecordFolderClosed.description=\u8bb0\u5f55\u6587\u4ef6\u5939\u5df2\u5173\u95ed - -# Are vital -isVital.title=\u6838\u5fc3\u8bb0\u5f55 -isVital.description=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u4e3a\u6838\u5fc3\u8bb0\u5f55 - -# Have Rentention Action -hasDispositionAction.title=\u5177\u6709\u4fdd\u7559\u64cd\u4f5c -hasDispositionAction.description=\u8bb0\u5f55\u548c\u6587\u4ef6\u5939\u5728\u6307\u5b9a\u7684\u76f8\u5173\u4f4d\u7f6e\u6267\u884c\u4e86\u6307\u5b9a\u7684\u76f8\u5173\u4fdd\u7559\u64cd\u4f5c - -# Are kind -isKind.title=\u8bb0\u5f55\u7ba1\u7406\u9879\u76ee\u7684\u7c7b\u578b -isKind.description=\u9879\u76ee\u4e3a\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6\u7c7b\u578b -isKind.kind.display-label=\u7c7b\u578b - -# Are Record Type -isRecordType.title=\u5177\u6709\u8bb0\u5f55\u7c7b\u578b -isRecordType.description=\u8bb0\u5f55\u5177\u6709\u6307\u5b9a\u7684\u8bb0\u5f55\u7c7b\u578b - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=\u58f0\u660e\u4e3a\u8bb0\u5f55 -create-record.description=\u5c06\u6587\u4ef6\u58f0\u660e\u4e3a\u8bb0\u5f55 -create-record.file-plan.display-label=\u5f52\u7c7b\u65b9\u6848 -create-record.hide-record.display-label=\u9690\u85cf\u8bb0\u5f55 -# Declare As Version Record -declare-as-version-record.title=\u5c06\u7248\u672c\u58f0\u660e\u4e3a\u8bb0\u5f55 -declare-as-version-record.description=\u5c06\u6587\u4ef6\u7684\u6b64\u7248\u672c\u58f0\u660e\u4e3a\u8bb0\u5f55 -declare-as-version-record.file-plan.display-label=\u5f52\u7c7b\u65b9\u6848 -# Complete record -declareRecord.title=\u5b8c\u6210\u8bb0\u5f55 -declareRecord.description=\u5b8c\u6210\u8bb0\u5f55 -# Reopens record -undeclareRecord.title=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 -undeclareRecord.description=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 -# Open record folder -openRecordFolder.title=\u6253\u5f00\u8bb0\u5f55\u6587\u4ef6\u5939 -openRecordFolder.description=\u6253\u5f00\u8bb0\u5f55\u6587\u4ef6\u5939 -# Close record folder -closeRecordFolder.title=\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939 -closeRecordFolder.description=\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939 -# Complete event -completeEvent.title=\u5b8c\u6210\u4e8b\u4ef6 -completeEvent.description=\u5b8c\u6210\u4e8b\u4ef6 -completeEvent.eventName.display-label=\u4e8b\u4ef6 -# Freeze -freeze.title=\u4fdd\u5b58 -freeze.description=\u4fdd\u5b58\u8bb0\u5f55 -freeze.reason.display-label=\u539f\u56e0 -# Unfreeze -unfreeze.title=\u53d6\u6d88\u4fdd\u5b58 -unfreeze.description=\u53d6\u6d88\u4fdd\u5b58\u8bb0\u5f55 -# File to -fileTo.title=\u7acb\u5377\u81f3 -fileTo.description=\u5c06\u8bb0\u5f55\u7acb\u5377\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 -fileTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 -fileTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 -# Copy to -copyTo.title=\u590d\u5236\u5230 -copyTo.description=\u5c06\u8bb0\u5f55\u590d\u5236\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 -copyTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 -copyTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 -# Move to -moveTo.title=\u79fb\u52a8\u5230 -moveTo.description=\u5c06\u8bb0\u5f55\u79fb\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 -moveTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 -moveTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 -# Link to -linkTo.title=\u94fe\u63a5\u5230 -linkTo.description=\u5c06\u8bb0\u5f55\u94fe\u63a5\u5230\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 -linkTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 -linkTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 -# Reject -reject.title=\u62d2\u7edd -reject.description=\u62d2\u7edd\u8bb0\u5f55\u5e76\u5c06\u6587\u4ef6\u79fb\u52a8\u81f3\u5176\u539f\u59cb\u4f4d\u7f6e -reject.reason.display-label=\u62d2\u7edd\u539f\u56e0 -# Request Information -requestInfo.title=\u8bf7\u6c42\u4fe1\u606f -requestInfo.description=\u5f00\u59cb\u8bf7\u6c42\u8bb0\u5f55\u7684\u66f4\u591a\u4fe1\u606f\u7684\u5de5\u4f5c\u6d41\u7a0b -# Execute script -executeScript.title=\u6267\u884c\u811a\u672c -executeScript.description=\u6267\u884c\u811a\u672c -executeScript.script-ref.display-label=\u811a\u672c -# Send Email -sendEmail.title=\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 -sendEmail.description=\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 -# Set Property -setPropertyValue.title=\u8bbe\u7f6e\u5c5e\u6027\u503c -setPropertyValue.description=\u8bbe\u7f6e\u5c5e\u6027\u503c - -# Edit Hold Reason -editHoldReason.title=\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0 -editHoldReason.description=\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0 -# Relinquish Hold -relinquishHold.title=\u653e\u5f03\u4fdd\u5b58 -relinquishHold.description=\u653e\u5f03\u4fdd\u5b58 -# Edit Review As Of Date -editReviewAsOfDate.title=\u7f16\u8f91\u5ba1\u67e5\u622a\u6b62\u65e5\u671f -editReviewAsOfDate.description=\u7f16\u8f91\u5ba1\u67e5\u622a\u6b62\u65e5\u671f -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=\u7f16\u8f91\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f -editDispositionActionAsOfDate.description=\u7f16\u8f91\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=\u5e7f\u64ad\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 -broadcastVitalRecordDefinition.description=\u5e7f\u64ad\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=\u5e7f\u64ad\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\u66f4\u65b0 -broadcastDispositionActionDefinitionUpdate.description=\u5e7f\u64ad\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\u66f4\u65b0 -# Undo Event -undoEvent.title=\u64a4\u6d88\u4e8b\u4ef6 -undoEvent.description=\u64a4\u6d88\u4e8b\u4ef6 -# Transfer Complete -transferComplete.title=\u79fb\u4ea4\u5b8c\u6210 -transferComplete.description=\u79fb\u4ea4\u5b8c\u6210 -# Accession Complete -accessionComplete.title=\u5165\u7ba1\u5b8c\u6210 -accessionComplete.description=\u5165\u7ba1\u5b8c\u6210 -# Split Email -splitEmail.title=\u62c6\u5206\u7535\u5b50\u90ae\u4ef6 -splitEmail.description=\u62c6\u5206\u7535\u5b50\u90ae\u4ef6 -# Create Rentention Schedule -createDispositionSchedule.title=\u521b\u5efa\u4fdd\u7559\u8ba1\u5212 -createDispositionSchedule.description=\u521b\u5efa\u4fdd\u7559\u8ba1\u5212 -# File Destruction Report -fileDestructionReport.title=\u7acb\u5377\u9500\u6bc1\u62a5\u544a -fileDestructionReport.description=\u7acb\u5377\u9500\u6bc1\u62a5\u544a -# Cut off -cutoff.title=\u4e2d\u65ad -cutoff.description=\u4e2d\u65ad -# Destroy -destroy.title=\u9500\u6bc1 -destroy.description=\u9500\u6bc1 -# Reviewed -reviewed.title=\u5df2\u5ba1\u67e5 -reviewed.description=\u5df2\u5ba1\u67e5 -# Hide Record -hide-record.title=\u9690\u85cf\u8bb0\u5f55 -hide-record.description=\u9690\u85cf\u8bb0\u5f55 -# Transfer -transfer.title=\u79fb\u4ea4 -transfer.description=\u79fb\u4ea4 -# Uncut off -unCutoff.title=\u64a4\u6d88\u4e2d\u65ad -unCutoff.description=\u64a4\u6d88\u4e2d\u65ad -# Accession -accession.title=\u5165\u7ba1 -accession.description=\u5165\u7ba1 -# Retain -retain.title=\u4fdd\u7559 -retain.description=\u4fdd\u7559 -# Add Record Types -addRecordTypes.title=\u6dfb\u52a0\u8bb0\u5f55\u7c7b\u578b -addRecordTypes.description=\u5c06\u6240\u9009\u7c7b\u578b\u6dfb\u52a0\u81f3\u8bb0\u5f55 -# File report -fileReport.title=\u7acb\u5377\u62a5\u544a -fileReport.description=\u7acb\u5377\u62a5\u544a -# Delete Hold -deleteHold.title=\u5220\u9664\u4fdd\u5b58 -deleteHold.description=\u5220\u9664\u4fdd\u5b58 -# Move DM record -move-dm-record.title=\u79fb\u52a8\u8bb0\u5f55 -move-dm-record.description=\u79fb\u52a8\u8bb0\u5f55 -# Unlink from -unlinkFrom.title=\u53d6\u6d88\u94fe\u63a5 -unlinkFrom.description=\u53d6\u6d88\u94fe\u63a5 - -# Recordable version config -recordable-version-config.title=\u81ea\u52a8\u58f0\u660e\u9009\u9879 -recordable-version-config.description=\u81ea\u52a8\u58f0\u660e\u9009\u9879 -recordable-version-config.version.display-label=\u81ea\u52a8\u58f0\u660e\u7248\u672c\u4e3a\u8bb0\u5f55 - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=\u8bb0\u5f55\u7c7b\u522b -rm-ac-is-kind-kinds.record_folder=\u8bb0\u5f55\u6587\u4ef6\u5939 -rm-ac-is-kind-kinds.record=\u8bb0\u5f55 - -rm-ac-disposition-action-relative-positions.next=\u4e0b\u4e00\u6b65 -rm-ac-disposition-action-relative-positions.previous=\u4e0a\u4e00\u6b65 -rm-ac-disposition-action-relative-positions.any=\u4efb\u4f55 - -ac-versions.none=\u4ece\u4e0d -ac-versions.major_only=\u4ec5\u9002\u7528\u4e8e\u4e3b\u8981\u7248\u672c +# +# i18n for Records Management Action Conditions +# +# Are classified +isClassified.title=\u6309\u4fdd\u7559\u8ba1\u5212\u5206\u7c7b +isClassified.description=\u6309\u4fdd\u7559\u8ba1\u5212\u5c06\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u5206\u7c7b + +# Are cutoff +isCutoff.title=\u4e2d\u65ad +isCutoff.description=\u5df2\u4e2d\u65ad\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 + +# Are declared +isDeclared.title=\u8bb0\u5f55\u5df2\u5b8c\u6210 +isDeclared.description=\u8bb0\u5f55\u5df2\u5b8c\u6210 + +# Is on hold +isFrozen.title=\u4fdd\u5b58\u4e2d +isFrozen.description=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u5728\u4fdd\u5b58\u4e2d + +# Are filed +isRecordFiled.title=\u8bb0\u5f55\u5df2\u7acb\u5377 +isRecordFiled.description=\u8bb0\u5f55\u5df2\u7acb\u5377 + +# Are closed record folders +isRecordFolderClosed.title=\u8bb0\u5f55\u6587\u4ef6\u5939\u5df2\u5173\u95ed +isRecordFolderClosed.description=\u8bb0\u5f55\u6587\u4ef6\u5939\u5df2\u5173\u95ed + +# Are vital +isVital.title=\u6838\u5fc3\u8bb0\u5f55 +isVital.description=\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939\u4e3a\u6838\u5fc3\u8bb0\u5f55 + +# Have Rentention Action +hasDispositionAction.title=\u5177\u6709\u4fdd\u7559\u64cd\u4f5c +hasDispositionAction.description=\u8bb0\u5f55\u548c\u6587\u4ef6\u5939\u5728\u6307\u5b9a\u7684\u76f8\u5173\u4f4d\u7f6e\u6267\u884c\u4e86\u6307\u5b9a\u7684\u76f8\u5173\u4fdd\u7559\u64cd\u4f5c + +# Are kind +isKind.title=\u8bb0\u5f55\u7ba1\u7406\u9879\u76ee\u7684\u7c7b\u578b +isKind.description=\u9879\u76ee\u4e3a\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6\u7c7b\u578b +isKind.kind.display-label=\u7c7b\u578b + +# Are Record Type +isRecordType.title=\u5177\u6709\u8bb0\u5f55\u7c7b\u578b +isRecordType.description=\u8bb0\u5f55\u5177\u6709\u6307\u5b9a\u7684\u8bb0\u5f55\u7c7b\u578b + + +# +# i18n for Records Management Actions +# +# Declare As Record +create-record.title=\u58f0\u660e\u4e3a\u8bb0\u5f55 +create-record.description=\u5c06\u6587\u4ef6\u58f0\u660e\u4e3a\u8bb0\u5f55 +create-record.file-plan.display-label=\u5f52\u7c7b\u65b9\u6848 +create-record.hide-record.display-label=\u9690\u85cf\u8bb0\u5f55 +# Declare As Version Record +declare-as-version-record.title=\u5c06\u7248\u672c\u58f0\u660e\u4e3a\u8bb0\u5f55 +declare-as-version-record.description=\u5c06\u6587\u4ef6\u7684\u6b64\u7248\u672c\u58f0\u660e\u4e3a\u8bb0\u5f55 +declare-as-version-record.file-plan.display-label=\u5f52\u7c7b\u65b9\u6848 +# Complete record +declareRecord.title=\u5b8c\u6210\u8bb0\u5f55 +declareRecord.description=\u5b8c\u6210\u8bb0\u5f55 +# Reopens record +undeclareRecord.title=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 +undeclareRecord.description=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 +# Open record folder +openRecordFolder.title=\u6253\u5f00\u8bb0\u5f55\u6587\u4ef6\u5939 +openRecordFolder.description=\u6253\u5f00\u8bb0\u5f55\u6587\u4ef6\u5939 +# Close record folder +closeRecordFolder.title=\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939 +closeRecordFolder.description=\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939 +# Complete event +completeEvent.title=\u5b8c\u6210\u4e8b\u4ef6 +completeEvent.description=\u5b8c\u6210\u4e8b\u4ef6 +completeEvent.eventName.display-label=\u4e8b\u4ef6 +# Freeze +freeze.title=\u4fdd\u5b58 +freeze.description=\u4fdd\u5b58\u8bb0\u5f55 +freeze.reason.display-label=\u539f\u56e0 +# Unfreeze +unfreeze.title=\u53d6\u6d88\u4fdd\u5b58 +unfreeze.description=\u53d6\u6d88\u4fdd\u5b58\u8bb0\u5f55 +# File to +fileTo.title=\u7acb\u5377\u81f3 +fileTo.description=\u5c06\u8bb0\u5f55\u7acb\u5377\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 +fileTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 +fileTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 +# Copy to +copyTo.title=\u590d\u5236\u5230 +copyTo.description=\u5c06\u8bb0\u5f55\u590d\u5236\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 +copyTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 +copyTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 +# Move to +moveTo.title=\u79fb\u52a8\u5230 +moveTo.description=\u5c06\u8bb0\u5f55\u79fb\u81f3\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 +moveTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 +moveTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 +# Link to +linkTo.title=\u94fe\u63a5\u5230 +linkTo.description=\u5c06\u8bb0\u5f55\u94fe\u63a5\u5230\u6307\u5b9a\u8bb0\u5f55\u6587\u4ef6\u5939 +linkTo.path.display-label=\u8bb0\u5f55\u6587\u4ef6\u5939\u7684\u8def\u5f84 +linkTo.createRecordPath.display-label=\u521b\u5efa\u8bb0\u5f55\u8def\u5f84 +# Reject +reject.title=\u62d2\u7edd +reject.description=\u62d2\u7edd\u8bb0\u5f55\u5e76\u5c06\u6587\u4ef6\u79fb\u52a8\u81f3\u5176\u539f\u59cb\u4f4d\u7f6e +reject.reason.display-label=\u62d2\u7edd\u539f\u56e0 +# Request Information +requestInfo.title=\u8bf7\u6c42\u4fe1\u606f +requestInfo.description=\u5f00\u59cb\u8bf7\u6c42\u8bb0\u5f55\u7684\u66f4\u591a\u4fe1\u606f\u7684\u5de5\u4f5c\u6d41\u7a0b +# Execute script +executeScript.title=\u6267\u884c\u811a\u672c +executeScript.description=\u6267\u884c\u811a\u672c +executeScript.script-ref.display-label=\u811a\u672c +# Send Email +sendEmail.title=\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 +sendEmail.description=\u53d1\u9001\u7535\u5b50\u90ae\u4ef6 +# Set Property +setPropertyValue.title=\u8bbe\u7f6e\u5c5e\u6027\u503c +setPropertyValue.description=\u8bbe\u7f6e\u5c5e\u6027\u503c + +# Edit Hold Reason +editHoldReason.title=\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0 +editHoldReason.description=\u7f16\u8f91\u4fdd\u5b58\u539f\u56e0 +# Relinquish Hold +relinquishHold.title=\u653e\u5f03\u4fdd\u5b58 +relinquishHold.description=\u653e\u5f03\u4fdd\u5b58 +# Edit Review As Of Date +editReviewAsOfDate.title=\u7f16\u8f91\u5ba1\u67e5\u622a\u6b62\u65e5\u671f +editReviewAsOfDate.description=\u7f16\u8f91\u5ba1\u67e5\u622a\u6b62\u65e5\u671f +# Edit Disposition Action As Of Date +editDispositionActionAsOfDate.title=\u7f16\u8f91\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f +editDispositionActionAsOfDate.description=\u7f16\u8f91\u4fdd\u7559\u64cd\u4f5c\u622a\u6b62\u65e5\u671f +# Broadcast Vital Record Definition +broadcastVitalRecordDefinition.title=\u5e7f\u64ad\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 +broadcastVitalRecordDefinition.description=\u5e7f\u64ad\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 +# Broadcast Disposition Action Definition Update +broadcastDispositionActionDefinitionUpdate.title=\u5e7f\u64ad\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\u66f4\u65b0 +broadcastDispositionActionDefinitionUpdate.description=\u5e7f\u64ad\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\u66f4\u65b0 +# Undo Event +undoEvent.title=\u64a4\u6d88\u4e8b\u4ef6 +undoEvent.description=\u64a4\u6d88\u4e8b\u4ef6 +# Transfer Complete +transferComplete.title=\u79fb\u4ea4\u5b8c\u6210 +transferComplete.description=\u79fb\u4ea4\u5b8c\u6210 +# Accession Complete +accessionComplete.title=\u5165\u7ba1\u5b8c\u6210 +accessionComplete.description=\u5165\u7ba1\u5b8c\u6210 +# Split Email +splitEmail.title=\u62c6\u5206\u7535\u5b50\u90ae\u4ef6 +splitEmail.description=\u62c6\u5206\u7535\u5b50\u90ae\u4ef6 +# Create Rentention Schedule +createDispositionSchedule.title=\u521b\u5efa\u4fdd\u7559\u8ba1\u5212 +createDispositionSchedule.description=\u521b\u5efa\u4fdd\u7559\u8ba1\u5212 +# File Destruction Report +fileDestructionReport.title=\u7acb\u5377\u9500\u6bc1\u62a5\u544a +fileDestructionReport.description=\u7acb\u5377\u9500\u6bc1\u62a5\u544a +# Cut off +cutoff.title=\u4e2d\u65ad +cutoff.description=\u4e2d\u65ad +# Destroy +destroy.title=\u9500\u6bc1 +destroy.description=\u9500\u6bc1 +# Reviewed +reviewed.title=\u5df2\u5ba1\u67e5 +reviewed.description=\u5df2\u5ba1\u67e5 +# Hide Record +hide-record.title=\u9690\u85cf\u8bb0\u5f55 +hide-record.description=\u9690\u85cf\u8bb0\u5f55 +# Transfer +transfer.title=\u79fb\u4ea4 +transfer.description=\u79fb\u4ea4 +# Uncut off +unCutoff.title=\u64a4\u6d88\u4e2d\u65ad +unCutoff.description=\u64a4\u6d88\u4e2d\u65ad +# Accession +accession.title=\u5165\u7ba1 +accession.description=\u5165\u7ba1 +# Retain +retain.title=\u4fdd\u7559 +retain.description=\u4fdd\u7559 +# Add Record Types +addRecordTypes.title=\u6dfb\u52a0\u8bb0\u5f55\u7c7b\u578b +addRecordTypes.description=\u5c06\u6240\u9009\u7c7b\u578b\u6dfb\u52a0\u81f3\u8bb0\u5f55 +# File report +fileReport.title=\u7acb\u5377\u62a5\u544a +fileReport.description=\u7acb\u5377\u62a5\u544a +# Delete Hold +deleteHold.title=\u5220\u9664\u4fdd\u5b58 +deleteHold.description=\u5220\u9664\u4fdd\u5b58 +# Move DM record +move-dm-record.title=\u79fb\u52a8\u8bb0\u5f55 +move-dm-record.description=\u79fb\u52a8\u8bb0\u5f55 +# Unlink from +unlinkFrom.title=\u53d6\u6d88\u94fe\u63a5 +unlinkFrom.description=\u53d6\u6d88\u94fe\u63a5 + +# Recordable version config +recordable-version-config.title=\u81ea\u52a8\u58f0\u660e\u9009\u9879 +recordable-version-config.description=\u81ea\u52a8\u58f0\u660e\u9009\u9879 +recordable-version-config.version.display-label=\u81ea\u52a8\u58f0\u660e\u7248\u672c\u4e3a\u8bb0\u5f55 + +# Action parameter constraints +rm-ac-is-kind-kinds.record_category=\u8bb0\u5f55\u7c7b\u522b +rm-ac-is-kind-kinds.record_folder=\u8bb0\u5f55\u6587\u4ef6\u5939 +rm-ac-is-kind-kinds.record=\u8bb0\u5f55 + +rm-ac-disposition-action-relative-positions.next=\u4e0b\u4e00\u6b65 +rm-ac-disposition-action-relative-positions.previous=\u4e0a\u4e00\u6b65 +rm-ac-disposition-action-relative-positions.any=\u4efb\u4f55 + +ac-versions.none=\u4ece\u4e0d +ac-versions.major_only=\u4ec5\u9002\u7528\u4e8e\u4e3b\u8981\u7248\u672c ac-versions.all=\u9002\u7528\u4e8e\u6240\u6709\u4e3b\u8981\u548c\u6b21\u8981\u7248\u672c \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties index 72795b810f..bccf2546cb 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=The customization service hasn't been started. -rm.admin.not-customisable=The class {0} isn't customizable. -rm.admin.invalid-custom-aspect=We couldn't find custom aspect {0} for customisable class {1}. -rm.admin.property-already-exists=Property {0} already exists. -rm.admin.cannot-apply-constraint=You can't apply constraint {0} to property {1} with datatype {2}. (expected: dataType = TEXT) -rm.admin.prop-exist=We couldn't find custom property {0}. -rm.admin.custom-prop-exist=The custom model doesn't contain the property {0}. -rm.admin.unknown-aspect=Unknown aspect {0}. -rm.admin.constraint-exists=The constraint {0} already exists. -rm.admin.contraint-cannot-find=We couldn't find the definition for constraint {0}. -rm.admin.unexpected_type_constraint=Unexpected type {0} for constraint {1}. The expected is {2}. -rm.admin.custom-model-not-found=We couldn't find custom model {0}. -rm.admin.custom-model-no-content=The custom model has no content. (nodeRef={0}) -rm.admin.error-write-custom-model=We hit a problem writing custom model content. (nodeRef={0}). -rm.admin.error-client-id=We couldn't generate the client ID because it's already in use. (clientid={0}) +rm.admin.service-not-init=The customization service hasn't been started. +rm.admin.not-customisable=The class {0} isn't customizable. +rm.admin.invalid-custom-aspect=We couldn't find custom aspect {0} for customisable class {1}. +rm.admin.property-already-exists=Property {0} already exists. +rm.admin.cannot-apply-constraint=You can't apply constraint {0} to property {1} with datatype {2}. (expected: dataType = TEXT) +rm.admin.prop-exist=We couldn't find custom property {0}. +rm.admin.custom-prop-exist=The custom model doesn't contain the property {0}. +rm.admin.unknown-aspect=Unknown aspect {0}. +rm.admin.constraint-exists=The constraint {0} already exists. +rm.admin.contraint-cannot-find=We couldn't find the definition for constraint {0}. +rm.admin.unexpected_type_constraint=Unexpected type {0} for constraint {1}. The expected is {2}. +rm.admin.custom-model-not-found=We couldn't find custom model {0}. +rm.admin.custom-model-no-content=The custom model has no content. (nodeRef={0}) +rm.admin.error-write-custom-model=We hit a problem writing custom model content. (nodeRef={0}). +rm.admin.error-client-id=We couldn't generate the client ID because it's already in use. (clientid={0}) rm.admin.error-split-id=We couldn't split ID {0}. because separator {1} isn't present. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties index b74d43631e..eb2075564c 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=Der Anpassungsservice wurde nicht gestartet. -rm.admin.not-customisable=Die Klasse {0} kann nicht angepasst werden. -rm.admin.invalid-custom-aspect=Der benutzerdefinierte Aspekt {0} f\u00fcr die anpassbare Klasse {1} wurde nicht gefunden. -rm.admin.property-already-exists=Eigenschaft {0} bereits vorhanden. -rm.admin.cannot-apply-constraint=Randbedingung {0} kann nicht auf Eigenschaft {1} mit Datentyp {2} angewendet werden. (erwartet: Datentyp = TEXT) -rm.admin.prop-exist=Benutzerdefinierte Eigenschaft {0} wurde nicht gefunden. -rm.admin.custom-prop-exist=Das benutzerdefinierte Modell enth\u00e4lt nicht die Eigenschaft {0}. -rm.admin.unknown-aspect=Unbekannter Aspekt {0}. -rm.admin.constraint-exists=Randbedingung {0} bereits vorhanden. -rm.admin.contraint-cannot-find=Die Definition f\u00fcr Randbedingung {0} wurde nicht gefunden. -rm.admin.unexpected_type_constraint=Unerwarteter Typ {0} f\u00fcr Randbedingung {1}. Erwartet wird {2}. -rm.admin.custom-model-not-found=Benutzerdefiniertes Modell {0} wurde nicht gefunden. -rm.admin.custom-model-no-content=Benutzerdefiniertes Modell hat keinen Inhalt. (nodeRef={0}) -rm.admin.error-write-custom-model=Beim Schreiben von benutzerdefiniertem Modellinhalt ist ein Problem aufgetreten. (nodeRef={0}). -rm.admin.error-client-id=Client-ID konnte nicht generiert werden, da diese bereits verwendet wird. (clientid={0}) +rm.admin.service-not-init=Der Anpassungsservice wurde nicht gestartet. +rm.admin.not-customisable=Die Klasse {0} kann nicht angepasst werden. +rm.admin.invalid-custom-aspect=Der benutzerdefinierte Aspekt {0} f\u00fcr die anpassbare Klasse {1} wurde nicht gefunden. +rm.admin.property-already-exists=Eigenschaft {0} bereits vorhanden. +rm.admin.cannot-apply-constraint=Randbedingung {0} kann nicht auf Eigenschaft {1} mit Datentyp {2} angewendet werden. (erwartet: Datentyp = TEXT) +rm.admin.prop-exist=Benutzerdefinierte Eigenschaft {0} wurde nicht gefunden. +rm.admin.custom-prop-exist=Das benutzerdefinierte Modell enth\u00e4lt nicht die Eigenschaft {0}. +rm.admin.unknown-aspect=Unbekannter Aspekt {0}. +rm.admin.constraint-exists=Randbedingung {0} bereits vorhanden. +rm.admin.contraint-cannot-find=Die Definition f\u00fcr Randbedingung {0} wurde nicht gefunden. +rm.admin.unexpected_type_constraint=Unerwarteter Typ {0} f\u00fcr Randbedingung {1}. Erwartet wird {2}. +rm.admin.custom-model-not-found=Benutzerdefiniertes Modell {0} wurde nicht gefunden. +rm.admin.custom-model-no-content=Benutzerdefiniertes Modell hat keinen Inhalt. (nodeRef={0}) +rm.admin.error-write-custom-model=Beim Schreiben von benutzerdefiniertem Modellinhalt ist ein Problem aufgetreten. (nodeRef={0}). +rm.admin.error-client-id=Client-ID konnte nicht generiert werden, da diese bereits verwendet wird. (clientid={0}) rm.admin.error-split-id=ID {0} kann nicht getrennt werden, da das Trennzeichen {1} nicht vorhanden ist. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties index ac4387ef8c..4f2219488a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=El servicio de personalizaci\u00f3n no se ha iniciado. -rm.admin.not-customisable=La clase ''{0}'' no es personalizable. -rm.admin.invalid-custom-aspect=No se pudo encontrar el aspecto personalizado ''{0}'' para la clase personalizable ''{1}''. -rm.admin.property-already-exists=La propiedad ''{0}'' ya existe. -rm.admin.cannot-apply-constraint=No puede aplicar la restricci\u00f3n ''{0}'' a la propiedad ''{1}'' con el tipo de datos ''{2}''. (previsto: tipo de datos = TEXT) -rm.admin.prop-exist=No se pudo encontrar la propiedad personalizada ''{0}''. -rm.admin.custom-prop-exist=El modelo personalizado no contiene la propiedad ''{0}''. -rm.admin.unknown-aspect=Aspecto desconocido ''{0}''. -rm.admin.constraint-exists=La restricci\u00f3n ''{0}'' ya existe. -rm.admin.contraint-cannot-find=No se pudo encontrar la definici\u00f3n para la restricci\u00f3n ''{0}''. -rm.admin.unexpected_type_constraint=Tipo inesperado ''{0}'' para la restricci\u00f3n ''{1}''. Lo esperado es ''{2}''. -rm.admin.custom-model-not-found=No se pudo encontrar el modelo personalizado ''{0}''. -rm.admin.custom-model-no-content=El modelo personalizado no tiene contenido. (nodeRef={0}) -rm.admin.error-write-custom-model=Se produjo un problema al escribir el contenido del modelo personalizado. (nodeRef={0}) -rm.admin.error-client-id=No se pudo generar el ID de cliente porque ya est\u00e1 en uso. (clientid={0}) +rm.admin.service-not-init=El servicio de personalizaci\u00f3n no se ha iniciado. +rm.admin.not-customisable=La clase ''{0}'' no es personalizable. +rm.admin.invalid-custom-aspect=No se pudo encontrar el aspecto personalizado ''{0}'' para la clase personalizable ''{1}''. +rm.admin.property-already-exists=La propiedad ''{0}'' ya existe. +rm.admin.cannot-apply-constraint=No puede aplicar la restricci\u00f3n ''{0}'' a la propiedad ''{1}'' con el tipo de datos ''{2}''. (previsto: tipo de datos = TEXT) +rm.admin.prop-exist=No se pudo encontrar la propiedad personalizada ''{0}''. +rm.admin.custom-prop-exist=El modelo personalizado no contiene la propiedad ''{0}''. +rm.admin.unknown-aspect=Aspecto desconocido ''{0}''. +rm.admin.constraint-exists=La restricci\u00f3n ''{0}'' ya existe. +rm.admin.contraint-cannot-find=No se pudo encontrar la definici\u00f3n para la restricci\u00f3n ''{0}''. +rm.admin.unexpected_type_constraint=Tipo inesperado ''{0}'' para la restricci\u00f3n ''{1}''. Lo esperado es ''{2}''. +rm.admin.custom-model-not-found=No se pudo encontrar el modelo personalizado ''{0}''. +rm.admin.custom-model-no-content=El modelo personalizado no tiene contenido. (nodeRef={0}) +rm.admin.error-write-custom-model=Se produjo un problema al escribir el contenido del modelo personalizado. (nodeRef={0}) +rm.admin.error-client-id=No se pudo generar el ID de cliente porque ya est\u00e1 en uso. (clientid={0}) rm.admin.error-split-id=No se pudo separar el ID ''{0}''. porque el separador ''{1}'' no est\u00e1 presente. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties index bf03899a0a..fb29061e3f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=Le service de personnalisation n'a pas \u00e9t\u00e9 d\u00e9marr\u00e9. -rm.admin.not-customisable=La classe {0} n''est pas personnalisable. -rm.admin.invalid-custom-aspect=L''aspect personnalis\u00e9 {0} pour la classe personnalisable {1} est introuvable. -rm.admin.property-already-exists=La propri\u00e9t\u00e9 {0} existe d\u00e9j\u00e0. -rm.admin.cannot-apply-constraint=Impossible d''appliquer la contrainte {0} \u00e0 la propri\u00e9t\u00e9 {1} avec le datatype {2}. (attendu\u00a0: dataType = TEXT) -rm.admin.prop-exist=La m\u00e9tadonn\u00e9e personnalis\u00e9e {0} est introuvable. -rm.admin.custom-prop-exist=Le mod\u00e8le personnalis\u00e9 ne contient pas la propri\u00e9t\u00e9 {0}. -rm.admin.unknown-aspect=Aspect {0} inconnu. -rm.admin.constraint-exists=La contrainte {0} existe d\u00e9j\u00e0. -rm.admin.contraint-cannot-find=La d\u00e9finition de la contrainte {0} est introuvable. -rm.admin.unexpected_type_constraint=Type {0} inattendu pour la contrainte {1}. Attendu\u00a0: {2} -rm.admin.custom-model-not-found=Le mod\u00e8le personnalis\u00e9 {0} est introuvable. -rm.admin.custom-model-no-content=Le mod\u00e8le personnalis\u00e9 n''a pas de contenu. (nodeRef={0}) -rm.admin.error-write-custom-model=Un probl\u00e8me est survenu pendant l''\u00e9criture du contenu du mod\u00e8le personnalis\u00e9. (nodeRef={0}). -rm.admin.error-client-id=Impossible de g\u00e9n\u00e9rer l''ID client car il est d\u00e9j\u00e0 en cours d''utilisation. (clientid={0}) +rm.admin.service-not-init=Le service de personnalisation n'a pas \u00e9t\u00e9 d\u00e9marr\u00e9. +rm.admin.not-customisable=La classe {0} n''est pas personnalisable. +rm.admin.invalid-custom-aspect=L''aspect personnalis\u00e9 {0} pour la classe personnalisable {1} est introuvable. +rm.admin.property-already-exists=La propri\u00e9t\u00e9 {0} existe d\u00e9j\u00e0. +rm.admin.cannot-apply-constraint=Impossible d''appliquer la contrainte {0} \u00e0 la propri\u00e9t\u00e9 {1} avec le datatype {2}. (attendu\u00a0: dataType = TEXT) +rm.admin.prop-exist=La m\u00e9tadonn\u00e9e personnalis\u00e9e {0} est introuvable. +rm.admin.custom-prop-exist=Le mod\u00e8le personnalis\u00e9 ne contient pas la propri\u00e9t\u00e9 {0}. +rm.admin.unknown-aspect=Aspect {0} inconnu. +rm.admin.constraint-exists=La contrainte {0} existe d\u00e9j\u00e0. +rm.admin.contraint-cannot-find=La d\u00e9finition de la contrainte {0} est introuvable. +rm.admin.unexpected_type_constraint=Type {0} inattendu pour la contrainte {1}. Attendu\u00a0: {2} +rm.admin.custom-model-not-found=Le mod\u00e8le personnalis\u00e9 {0} est introuvable. +rm.admin.custom-model-no-content=Le mod\u00e8le personnalis\u00e9 n''a pas de contenu. (nodeRef={0}) +rm.admin.error-write-custom-model=Un probl\u00e8me est survenu pendant l''\u00e9criture du contenu du mod\u00e8le personnalis\u00e9. (nodeRef={0}). +rm.admin.error-client-id=Impossible de g\u00e9n\u00e9rer l''ID client car il est d\u00e9j\u00e0 en cours d''utilisation. (clientid={0}) rm.admin.error-split-id=Impossible de fractionner l''ID {0}. Le s\u00e9parateur {1} n''est pas pr\u00e9sent. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties index 815ba21b3c..238c74cf67 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=Il servizio di personalizzazione non \u00e8 stato avviato. -rm.admin.not-customisable=Non \u00e8 possibile personalizzare la classe {0}. -rm.admin.invalid-custom-aspect=Impossibile trovare un aspetto personalizzato {0} per la classe personalizzabile {1}. -rm.admin.property-already-exists=La propriet\u00e0 {0} \u00e8 gi\u00e0 esistente. -rm.admin.cannot-apply-constraint=Impossibile applicare il vincolo {0} alla propriet\u00e0 {1} con il tipo di dati {2}. (expected: dataType = TEXT) -rm.admin.prop-exist=Impossibile trovare la propriet\u00e0 personalizzata {0}. -rm.admin.custom-prop-exist=Il modello personalizzato non contiene la propriet\u00e0 {0}. -rm.admin.unknown-aspect=Aspetto {0} sconosciuto. -rm.admin.constraint-exists=Il vincolo {0} \u00e8 gi\u00e0 esistente. -rm.admin.contraint-cannot-find=Impossibile trovare la definizione per il vincolo {0}. -rm.admin.unexpected_type_constraint=Tipo {0} inaspettato per vincolo {1}. Ci\u00f2 che si aspetta \u00e8 {2}. -rm.admin.custom-model-not-found=Impossibile trovare il modello personalizzato {0}. -rm.admin.custom-model-no-content=Il modello personalizzato non ha contenuti. (nodeRef={0}) -rm.admin.error-write-custom-model=Si \u00e8 verificato un problema durante la scrittura dei contenuti del modello personalizzato. (nodeRef={0}) -rm.admin.error-client-id=Impossibile generare l''ID client, poich\u00e9 gi\u00e0 in uso. (clientid={0}) +rm.admin.service-not-init=Il servizio di personalizzazione non \u00e8 stato avviato. +rm.admin.not-customisable=Non \u00e8 possibile personalizzare la classe {0}. +rm.admin.invalid-custom-aspect=Impossibile trovare un aspetto personalizzato {0} per la classe personalizzabile {1}. +rm.admin.property-already-exists=La propriet\u00e0 {0} \u00e8 gi\u00e0 esistente. +rm.admin.cannot-apply-constraint=Impossibile applicare il vincolo {0} alla propriet\u00e0 {1} con il tipo di dati {2}. (expected: dataType = TEXT) +rm.admin.prop-exist=Impossibile trovare la propriet\u00e0 personalizzata {0}. +rm.admin.custom-prop-exist=Il modello personalizzato non contiene la propriet\u00e0 {0}. +rm.admin.unknown-aspect=Aspetto {0} sconosciuto. +rm.admin.constraint-exists=Il vincolo {0} \u00e8 gi\u00e0 esistente. +rm.admin.contraint-cannot-find=Impossibile trovare la definizione per il vincolo {0}. +rm.admin.unexpected_type_constraint=Tipo {0} inaspettato per vincolo {1}. Ci\u00f2 che si aspetta \u00e8 {2}. +rm.admin.custom-model-not-found=Impossibile trovare il modello personalizzato {0}. +rm.admin.custom-model-no-content=Il modello personalizzato non ha contenuti. (nodeRef={0}) +rm.admin.error-write-custom-model=Si \u00e8 verificato un problema durante la scrittura dei contenuti del modello personalizzato. (nodeRef={0}) +rm.admin.error-client-id=Impossibile generare l''ID client, poich\u00e9 gi\u00e0 in uso. (clientid={0}) rm.admin.error-split-id=Impossibile dividere l''ID ''{0}'' poich\u00e9 non \u00e8 presente il separatore {1}. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties index 9032ff5947..37e6f1e4a3 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u30b5\u30fc\u30d3\u30b9\u304c\u958b\u59cb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 -rm.admin.not-customisable=\u30af\u30e9\u30b9 ''{0}'' \u306f\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u305b\u3093\u3002 -rm.admin.invalid-custom-aspect=\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u53ef\u80fd\u306a\u30af\u30e9\u30b9 ''{1}'' \u306e\u30ab\u30b9\u30bf\u30e0\u30a2\u30b9\u30da\u30af\u30c8 ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 -rm.admin.property-already-exists=\u30d7\u30ed\u30d1\u30c6\u30a3 ''{0}'' \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 -rm.admin.cannot-apply-constraint=\u5236\u7d04 ''{0}'' \u306f\u3001\u30c7\u30fc\u30bf\u578b\u304c ''{2}'' \u306e\u30d7\u30ed\u30d1\u30c6\u30a3 ''{1}'' \u306b\u306f\u9069\u7528\u3067\u304d\u307e\u305b\u3093\u3002 (expected: dataType = TEXT) -rm.admin.prop-exist=\u30ab\u30b9\u30bf\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3 ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 -rm.admin.custom-prop-exist=\u3053\u306e\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306b\u306f\u30d7\u30ed\u30d1\u30c6\u30a3 ''{0}'' \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093\u3002 -rm.admin.unknown-aspect=\u4e0d\u660e\u306a\u30a2\u30b9\u30da\u30af\u30c8 ''{0}''\u3002 -rm.admin.constraint-exists=\u5236\u7d04 ''{0}'' \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 -rm.admin.contraint-cannot-find=\u5236\u7d04 ''{0}'' \u306e\u5b9a\u7fa9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 -rm.admin.unexpected_type_constraint=\u30bf\u30a4\u30d7 ''{0}'' \u306f\u5236\u7d04 ''{1}'' \u306b\u9069\u3057\u307e\u305b\u3093\u3002 \u6709\u52b9\u306a\u30bf\u30a4\u30d7\u306f ''{2}'' \u3067\u3059\u3002 -rm.admin.custom-model-not-found=\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 -rm.admin.custom-model-no-content=\u3053\u306e\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306b\u306f\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u3042\u308a\u307e\u305b\u3093\u3002 (nodeRef={0}) -rm.admin.error-write-custom-model=\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u66f8\u304d\u8fbc\u307f\u4e2d\u306b\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 (nodeRef={0}). -rm.admin.error-client-id=\u3053\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID \u306f\u3059\u3067\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 (clientid={0}) +rm.admin.service-not-init=\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u30b5\u30fc\u30d3\u30b9\u304c\u958b\u59cb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +rm.admin.not-customisable=\u30af\u30e9\u30b9 ''{0}'' \u306f\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u305b\u3093\u3002 +rm.admin.invalid-custom-aspect=\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u53ef\u80fd\u306a\u30af\u30e9\u30b9 ''{1}'' \u306e\u30ab\u30b9\u30bf\u30e0\u30a2\u30b9\u30da\u30af\u30c8 ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 +rm.admin.property-already-exists=\u30d7\u30ed\u30d1\u30c6\u30a3 ''{0}'' \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 +rm.admin.cannot-apply-constraint=\u5236\u7d04 ''{0}'' \u306f\u3001\u30c7\u30fc\u30bf\u578b\u304c ''{2}'' \u306e\u30d7\u30ed\u30d1\u30c6\u30a3 ''{1}'' \u306b\u306f\u9069\u7528\u3067\u304d\u307e\u305b\u3093\u3002 (expected: dataType = TEXT) +rm.admin.prop-exist=\u30ab\u30b9\u30bf\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3 ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 +rm.admin.custom-prop-exist=\u3053\u306e\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306b\u306f\u30d7\u30ed\u30d1\u30c6\u30a3 ''{0}'' \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093\u3002 +rm.admin.unknown-aspect=\u4e0d\u660e\u306a\u30a2\u30b9\u30da\u30af\u30c8 ''{0}''\u3002 +rm.admin.constraint-exists=\u5236\u7d04 ''{0}'' \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 +rm.admin.contraint-cannot-find=\u5236\u7d04 ''{0}'' \u306e\u5b9a\u7fa9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 +rm.admin.unexpected_type_constraint=\u30bf\u30a4\u30d7 ''{0}'' \u306f\u5236\u7d04 ''{1}'' \u306b\u9069\u3057\u307e\u305b\u3093\u3002 \u6709\u52b9\u306a\u30bf\u30a4\u30d7\u306f ''{2}'' \u3067\u3059\u3002 +rm.admin.custom-model-not-found=\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb ''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 +rm.admin.custom-model-no-content=\u3053\u306e\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306b\u306f\u30b3\u30f3\u30c6\u30f3\u30c4\u304c\u3042\u308a\u307e\u305b\u3093\u3002 (nodeRef={0}) +rm.admin.error-write-custom-model=\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u66f8\u304d\u8fbc\u307f\u4e2d\u306b\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002 (nodeRef={0}). +rm.admin.error-client-id=\u3053\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID \u306f\u3059\u3067\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 (clientid={0}) rm.admin.error-split-id=\u533a\u5207\u308a\u6587\u5b57 ({1}) \u304c\u306a\u3044\u305f\u3081\u3001ID ''{0}'' \u3092\u5206\u5272\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties index 60217ae49c..9f42e6440a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=Tilpasningstjenesten er ikke startet. -rm.admin.not-customisable=Klassen {0} er ikke tilpasset. -rm.admin.invalid-custom-aspect=Finner ikke det tilpassede aspektet {0} for klassen {1} som kan tilpasses. -rm.admin.property-already-exists=Egenskapen {0} finnes allerede. -rm.admin.cannot-apply-constraint=Kan ikke p\u00e5f\u00f8re restriksjonen {0} p\u00e5 egenskapen {1} med datatype {2}. (forventet datatype = TEKST) -rm.admin.prop-exist=Kunne ikke finne den tilpassede egenskapen {0}. -rm.admin.custom-prop-exist=Den tilpassede modellen kan ikke inneholde egenskapen {0}. -rm.admin.unknown-aspect=Ukjent aspekt {0}. -rm.admin.constraint-exists=Restriksjonen {0} finnes allerede. -rm.admin.contraint-cannot-find=Kunne ikke finne definisjonen til restriksjonen {0}. -rm.admin.unexpected_type_constraint=Uventet type {0} ved restriksjonen {1}. {2} var forventet... -rm.admin.custom-model-not-found=Kunne ikke finne den tilpassede modellen {0}. -rm.admin.custom-model-no-content=Den tilpassede modellen har ikke innhold. (nodeRef={0}) -rm.admin.error-write-custom-model=Det oppsto et problem med \u00e5 skrive innholdet til den tilpassede modellen. (nodeRef={0}). -rm.admin.error-client-id=Kunne ikke generere klient-ID for den er allerede i bruk. (clientid={0}) +rm.admin.service-not-init=Tilpasningstjenesten er ikke startet. +rm.admin.not-customisable=Klassen {0} er ikke tilpasset. +rm.admin.invalid-custom-aspect=Finner ikke det tilpassede aspektet {0} for klassen {1} som kan tilpasses. +rm.admin.property-already-exists=Egenskapen {0} finnes allerede. +rm.admin.cannot-apply-constraint=Kan ikke p\u00e5f\u00f8re restriksjonen {0} p\u00e5 egenskapen {1} med datatype {2}. (forventet datatype = TEKST) +rm.admin.prop-exist=Kunne ikke finne den tilpassede egenskapen {0}. +rm.admin.custom-prop-exist=Den tilpassede modellen kan ikke inneholde egenskapen {0}. +rm.admin.unknown-aspect=Ukjent aspekt {0}. +rm.admin.constraint-exists=Restriksjonen {0} finnes allerede. +rm.admin.contraint-cannot-find=Kunne ikke finne definisjonen til restriksjonen {0}. +rm.admin.unexpected_type_constraint=Uventet type {0} ved restriksjonen {1}. {2} var forventet... +rm.admin.custom-model-not-found=Kunne ikke finne den tilpassede modellen {0}. +rm.admin.custom-model-no-content=Den tilpassede modellen har ikke innhold. (nodeRef={0}) +rm.admin.error-write-custom-model=Det oppsto et problem med \u00e5 skrive innholdet til den tilpassede modellen. (nodeRef={0}). +rm.admin.error-client-id=Kunne ikke generere klient-ID for den er allerede i bruk. (clientid={0}) rm.admin.error-split-id=Kunne ikke dele ID-en {0}. fordi grensetegnet {1} ikke fantes. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties index d4c43a8453..8518804253 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=De aanpassingsservice is niet gestart. -rm.admin.not-customisable=De klasse {0} kan niet worden aangepast. -rm.admin.invalid-custom-aspect=Kan het aangepaste aspect {0} voor aanpasbare klasse {1} niet vinden. -rm.admin.property-already-exists=Eigenschap {0} bestaat al. -rm.admin.cannot-apply-constraint=U kunt beperking {0} niet toepassen op eigenschap {1} met gegevenstype {2}. (verwacht: dataType = TEXT) -rm.admin.prop-exist=Kan aangepaste eigenschap {0} niet vinden. -rm.admin.custom-prop-exist=Het aangepaste model bevat de eigenschap {0} niet. -rm.admin.unknown-aspect=Onbekend aspect {0}. -rm.admin.constraint-exists=De beperking {0} bestaat al. -rm.admin.contraint-cannot-find=Kan de definitie voor beperking {0} niet vinden. -rm.admin.unexpected_type_constraint=Onverwacht type {0} voor beperking {1}. Het verwachte type is {2}. -rm.admin.custom-model-not-found=Kan aangepast model {0} niet vinden. -rm.admin.custom-model-no-content=Het aangepaste model heeft geen content. (nodeRef={0}) -rm.admin.error-write-custom-model=Er is een probleem opgetreden bij het schrijven van aangepaste-modelcontent. (nodeRef={0}). -rm.admin.error-client-id=Kan de client-id niet genereren omdat deze al in gebruik is. (clientid={0}) +rm.admin.service-not-init=De aanpassingsservice is niet gestart. +rm.admin.not-customisable=De klasse {0} kan niet worden aangepast. +rm.admin.invalid-custom-aspect=Kan het aangepaste aspect {0} voor aanpasbare klasse {1} niet vinden. +rm.admin.property-already-exists=Eigenschap {0} bestaat al. +rm.admin.cannot-apply-constraint=U kunt beperking {0} niet toepassen op eigenschap {1} met gegevenstype {2}. (verwacht: dataType = TEXT) +rm.admin.prop-exist=Kan aangepaste eigenschap {0} niet vinden. +rm.admin.custom-prop-exist=Het aangepaste model bevat de eigenschap {0} niet. +rm.admin.unknown-aspect=Onbekend aspect {0}. +rm.admin.constraint-exists=De beperking {0} bestaat al. +rm.admin.contraint-cannot-find=Kan de definitie voor beperking {0} niet vinden. +rm.admin.unexpected_type_constraint=Onverwacht type {0} voor beperking {1}. Het verwachte type is {2}. +rm.admin.custom-model-not-found=Kan aangepast model {0} niet vinden. +rm.admin.custom-model-no-content=Het aangepaste model heeft geen content. (nodeRef={0}) +rm.admin.error-write-custom-model=Er is een probleem opgetreden bij het schrijven van aangepaste-modelcontent. (nodeRef={0}). +rm.admin.error-client-id=Kan de client-id niet genereren omdat deze al in gebruik is. (clientid={0}) rm.admin.error-split-id=Kan id {0} niet opsplitsen omdat scheiding {1} niet aanwezig is. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties index 4a14fe870c..ed7091a363 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=O servi\u00e7o de personaliza\u00e7\u00e3o n\u00e3o foi iniciado. -rm.admin.not-customisable=A classe {0} n\u00e3o \u00e9 personaliz\u00e1vel. -rm.admin.invalid-custom-aspect=N\u00e3o foi poss\u00edvel encontrar aspecto personalizado {0} para a classe personaliz\u00e1vel {1}. -rm.admin.property-already-exists=A propriedade {0} j\u00e1 existe. -rm.admin.cannot-apply-constraint=N\u00e3o \u00e9 poss\u00edvel aplicar a reserva {0} \u00e0 propriedade {1} com o tipo de dados {2}. (esperado: dataType = TEXT) -rm.admin.prop-exist=N\u00e3o foi poss\u00edvel encontrar a propriedade personalizada {0}. -rm.admin.custom-prop-exist=O modelo personalizado n\u00e3o cont\u00e9m a propriedade {0}. -rm.admin.unknown-aspect=Aspecto desconhecido {0}. -rm.admin.constraint-exists=A reserva {0} j\u00e1 existe. -rm.admin.contraint-cannot-find=N\u00e3o foi poss\u00edvel encontrar a defini\u00e7\u00e3o para a reserva {0}. -rm.admin.unexpected_type_constraint=Tipo inesperado {0} para a reserva {1}. O tipo esperado \u00e9 {2}. -rm.admin.custom-model-not-found=N\u00e3o foi poss\u00edvel encontrar o modelo personalizado {0}. -rm.admin.custom-model-no-content=O modelo personalizado n\u00e3o tem conte\u00fado. (nodeRef={0}) -rm.admin.error-write-custom-model=Encontramos um problema ao gravar o conte\u00fado do modelo personalizado. (nodeRef={0}). -rm.admin.error-client-id=N\u00e3o foi poss\u00edvel gerar o ID do cliente, pois ele j\u00e1 est\u00e1 em uso. (clientid={0}) +rm.admin.service-not-init=O servi\u00e7o de personaliza\u00e7\u00e3o n\u00e3o foi iniciado. +rm.admin.not-customisable=A classe {0} n\u00e3o \u00e9 personaliz\u00e1vel. +rm.admin.invalid-custom-aspect=N\u00e3o foi poss\u00edvel encontrar aspecto personalizado {0} para a classe personaliz\u00e1vel {1}. +rm.admin.property-already-exists=A propriedade {0} j\u00e1 existe. +rm.admin.cannot-apply-constraint=N\u00e3o \u00e9 poss\u00edvel aplicar a reserva {0} \u00e0 propriedade {1} com o tipo de dados {2}. (esperado: dataType = TEXT) +rm.admin.prop-exist=N\u00e3o foi poss\u00edvel encontrar a propriedade personalizada {0}. +rm.admin.custom-prop-exist=O modelo personalizado n\u00e3o cont\u00e9m a propriedade {0}. +rm.admin.unknown-aspect=Aspecto desconhecido {0}. +rm.admin.constraint-exists=A reserva {0} j\u00e1 existe. +rm.admin.contraint-cannot-find=N\u00e3o foi poss\u00edvel encontrar a defini\u00e7\u00e3o para a reserva {0}. +rm.admin.unexpected_type_constraint=Tipo inesperado {0} para a reserva {1}. O tipo esperado \u00e9 {2}. +rm.admin.custom-model-not-found=N\u00e3o foi poss\u00edvel encontrar o modelo personalizado {0}. +rm.admin.custom-model-no-content=O modelo personalizado n\u00e3o tem conte\u00fado. (nodeRef={0}) +rm.admin.error-write-custom-model=Encontramos um problema ao gravar o conte\u00fado do modelo personalizado. (nodeRef={0}). +rm.admin.error-client-id=N\u00e3o foi poss\u00edvel gerar o ID do cliente, pois ele j\u00e1 est\u00e1 em uso. (clientid={0}) rm.admin.error-split-id=N\u00e3o foi poss\u00edvel dividir o ID {0}. pois o separador {1} n\u00e3o est\u00e1 presente. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties index acfe4805bd..63c64d52d9 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=\u0421\u043b\u0443\u0436\u0431\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430. -rm.admin.not-customisable=\u041a\u043b\u0430\u0441\u0441 {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c. -rm.admin.invalid-custom-aspect=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0} \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 {1}. -rm.admin.property-already-exists=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e {0} \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. -rm.admin.cannot-apply-constraint=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 {0} \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 {1} \u0441 \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 {2}. (\u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f: dataType = TEXT) -rm.admin.prop-exist=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. -rm.admin.custom-prop-exist=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e {0}. -rm.admin.unknown-aspect=\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. -rm.admin.constraint-exists=\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 {0} \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. -rm.admin.contraint-cannot-find=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f {0}. -rm.admin.unexpected_type_constraint=\u041d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f {0} \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f {1}. \u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f: {2}. -rm.admin.custom-model-not-found=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c {0}. -rm.admin.custom-model-no-content=\u041d\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. (nodeRef={0}) -rm.admin.error-write-custom-model=\u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. (nodeRef={0}). -rm.admin.error-client-id=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430: \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. (clientid={0}) +rm.admin.service-not-init=\u0421\u043b\u0443\u0436\u0431\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430. +rm.admin.not-customisable=\u041a\u043b\u0430\u0441\u0441 {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c. +rm.admin.invalid-custom-aspect=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0} \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 {1}. +rm.admin.property-already-exists=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e {0} \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. +rm.admin.cannot-apply-constraint=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 {0} \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 {1} \u0441 \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 {2}. (\u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f: dataType = TEXT) +rm.admin.prop-exist=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. +rm.admin.custom-prop-exist=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e {0}. +rm.admin.unknown-aspect=\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. +rm.admin.constraint-exists=\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 {0} \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. +rm.admin.contraint-cannot-find=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f {0}. +rm.admin.unexpected_type_constraint=\u041d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f {0} \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f {1}. \u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f: {2}. +rm.admin.custom-model-not-found=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c {0}. +rm.admin.custom-model-no-content=\u041d\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. (nodeRef={0}) +rm.admin.error-write-custom-model=\u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. (nodeRef={0}). +rm.admin.error-client-id=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430: \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. (clientid={0}) rm.admin.error-split-id=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 {0}: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0438\u043c\u0432\u043e\u043b-\u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c {1}. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties index 5a851f5f19..12b84d6341 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties @@ -1,16 +1,16 @@ -rm.admin.service-not-init=\u5c1a\u672a\u542f\u52a8\u81ea\u5b9a\u4e49\u670d\u52a1\u3002 -rm.admin.not-customisable=\u7c7b\u522b {0} \u4e0d\u53ef\u81ea\u5b9a\u4e49\u3002 -rm.admin.invalid-custom-aspect=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u53ef\u81ea\u5b9a\u4e49\u7c7b\u522b {1} \u7684\u81ea\u5b9a\u4e49\u5207\u9762 {0}\u3002 -rm.admin.property-already-exists=\u5c5e\u6027 {0} \u5df2\u5b58\u5728\u3002 -rm.admin.cannot-apply-constraint=\u60a8\u65e0\u6cd5\u5c06\u7ea6\u675f {0} \u5e94\u7528\u4e8e\u6570\u636e\u7c7b\u578b\u4e3a {2} \u7684\u5c5e\u6027 {1}\u3002 \uff08\u9884\u671f\uff1adataType = TEXT\uff09 -rm.admin.prop-exist=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u81ea\u5b9a\u4e49\u5c5e\u6027\uff1a{0}\u3002 -rm.admin.custom-prop-exist=\u81ea\u5b9a\u4e49\u6a21\u578b\u4e0d\u5305\u542b\u5c5e\u6027 {0}\u3002 -rm.admin.unknown-aspect=\u672a\u77e5\u5207\u9762 {0}\u3002 -rm.admin.constraint-exists=\u7ea6\u675f {0} \u5df2\u5b58\u5728\u3002 -rm.admin.contraint-cannot-find=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u7ea6\u675f {0} \u7684\u5b9a\u4e49\u3002 -rm.admin.unexpected_type_constraint=\u7ea6\u675f {1} \u7684\u610f\u5916\u7c7b\u578b {0}\u3002 \u9884\u671f\u4e3a {2}\u3002 -rm.admin.custom-model-not-found=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u81ea\u5b9a\u4e49\u6a21\u578b\uff1a{0}\u3002 -rm.admin.custom-model-no-content=\u81ea\u5b9a\u4e49\u6a21\u578b\u6ca1\u6709\u5185\u5bb9\u3002 (nodeRef={0}) -rm.admin.error-write-custom-model=\u6211\u4eec\u5728\u7f16\u5199\u81ea\u5b9a\u4e49\u6a21\u578b\u5185\u5bb9\u65f6\u9047\u5230\u95ee\u9898\u3002 (nodeRef={0})\u3002 -rm.admin.error-client-id=\u6211\u4eec\u65e0\u6cd5\u751f\u6210\u5ba2\u6237\u7aef ID\uff0c\u56e0\u4e3a\u5b83\u5df2\u88ab\u4f7f\u7528\u3002 (clientid={0}) +rm.admin.service-not-init=\u5c1a\u672a\u542f\u52a8\u81ea\u5b9a\u4e49\u670d\u52a1\u3002 +rm.admin.not-customisable=\u7c7b\u522b {0} \u4e0d\u53ef\u81ea\u5b9a\u4e49\u3002 +rm.admin.invalid-custom-aspect=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u53ef\u81ea\u5b9a\u4e49\u7c7b\u522b {1} \u7684\u81ea\u5b9a\u4e49\u5207\u9762 {0}\u3002 +rm.admin.property-already-exists=\u5c5e\u6027 {0} \u5df2\u5b58\u5728\u3002 +rm.admin.cannot-apply-constraint=\u60a8\u65e0\u6cd5\u5c06\u7ea6\u675f {0} \u5e94\u7528\u4e8e\u6570\u636e\u7c7b\u578b\u4e3a {2} \u7684\u5c5e\u6027 {1}\u3002 \uff08\u9884\u671f\uff1adataType = TEXT\uff09 +rm.admin.prop-exist=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u81ea\u5b9a\u4e49\u5c5e\u6027\uff1a{0}\u3002 +rm.admin.custom-prop-exist=\u81ea\u5b9a\u4e49\u6a21\u578b\u4e0d\u5305\u542b\u5c5e\u6027 {0}\u3002 +rm.admin.unknown-aspect=\u672a\u77e5\u5207\u9762 {0}\u3002 +rm.admin.constraint-exists=\u7ea6\u675f {0} \u5df2\u5b58\u5728\u3002 +rm.admin.contraint-cannot-find=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u7ea6\u675f {0} \u7684\u5b9a\u4e49\u3002 +rm.admin.unexpected_type_constraint=\u7ea6\u675f {1} \u7684\u610f\u5916\u7c7b\u578b {0}\u3002 \u9884\u671f\u4e3a {2}\u3002 +rm.admin.custom-model-not-found=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e\u81ea\u5b9a\u4e49\u6a21\u578b\uff1a{0}\u3002 +rm.admin.custom-model-no-content=\u81ea\u5b9a\u4e49\u6a21\u578b\u6ca1\u6709\u5185\u5bb9\u3002 (nodeRef={0}) +rm.admin.error-write-custom-model=\u6211\u4eec\u5728\u7f16\u5199\u81ea\u5b9a\u4e49\u6a21\u578b\u5185\u5bb9\u65f6\u9047\u5230\u95ee\u9898\u3002 (nodeRef={0})\u3002 +rm.admin.error-client-id=\u6211\u4eec\u65e0\u6cd5\u751f\u6210\u5ba2\u6237\u7aef ID\uff0c\u56e0\u4e3a\u5b83\u5df2\u88ab\u4f7f\u7528\u3002 (clientid={0}) rm.admin.error-split-id=\u6211\u4eec\u65e0\u6cd5\u62c6\u5206 ID {0}\uff0c \u56e0\u4e3a\u5206\u9694\u7b26 {1} \u4e0d\u5b58\u5728\u3002 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties index e00b96333c..f4f9ea6937 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=Updated Metadata -rm.audit.created-object=Created Object -rm.audit.delete-object=Delete Object -rm.audit.login-succeeded=Login Successful -rm.audit.login-failed=Login Unsuccessful -rm.audit.create-person=Create User -rm.audit.linkTo=Link to -rm.audit.moveTo=Move to -rm.audit.copyTo=Copy to -rm.audit.fileTo=File to -rm.audit.audit-start=Audit Start -rm.audit.audit-stop=Audit Stop -rm.audit.audit-clear=Audit Clear -rm.audit.audit-view=Audit View -rm.audit.trail-file-fail=We couldn't generate an audit report. Check the audit details and try again, or speak with your I.T. Dept. -rm.audit.audit-report=Audit Report +rm.audit.updated-metadata=Updated Metadata +rm.audit.created-object=Created Object +rm.audit.delete-object=Delete Object +rm.audit.login-succeeded=Login Successful +rm.audit.login-failed=Login Unsuccessful +rm.audit.create-person=Create User +rm.audit.linkTo=Link to +rm.audit.moveTo=Move to +rm.audit.copyTo=Copy to +rm.audit.fileTo=File to +rm.audit.audit-start=Audit Start +rm.audit.audit-stop=Audit Stop +rm.audit.audit-clear=Audit Clear +rm.audit.audit-view=Audit View +rm.audit.trail-file-fail=We couldn't generate an audit report. Check the audit details and try again, or speak with your I.T. Dept. +rm.audit.audit-report=Audit Report recordable-version-config=Auto-Declare Options \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties index e5c55ab3d9..701288eee2 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=Metadaten aktualisiert -rm.audit.created-object=Objekt erstellt -rm.audit.delete-object=Objekt gel\u00f6scht -rm.audit.login-succeeded=Anmeldung erfolgreich -rm.audit.login-failed=Anmeldung fehlgeschlagen -rm.audit.create-person=Benutzer anlegen -rm.audit.linkTo=Link zu -rm.audit.moveTo=Verschieben nach -rm.audit.copyTo=Kopieren nach -rm.audit.fileTo=Ablegen unter -rm.audit.audit-start=Audit starten -rm.audit.audit-stop=Audit stoppen -rm.audit.audit-clear=Audit l\u00f6schen -rm.audit.audit-view=Audit anzeigen -rm.audit.trail-file-fail=Audit-Bericht konnte nicht generiert werden. \u00dcberpr\u00fcfen Sie die Audit-Details und versuchen Sie es erneut. Sie k\u00f6nnen sich auch an Ihre IT-Abteilung wenden. -rm.audit.audit-report=Audit-Bericht +rm.audit.updated-metadata=Metadaten aktualisiert +rm.audit.created-object=Objekt erstellt +rm.audit.delete-object=Objekt gel\u00f6scht +rm.audit.login-succeeded=Anmeldung erfolgreich +rm.audit.login-failed=Anmeldung fehlgeschlagen +rm.audit.create-person=Benutzer anlegen +rm.audit.linkTo=Link zu +rm.audit.moveTo=Verschieben nach +rm.audit.copyTo=Kopieren nach +rm.audit.fileTo=Ablegen unter +rm.audit.audit-start=Audit starten +rm.audit.audit-stop=Audit stoppen +rm.audit.audit-clear=Audit l\u00f6schen +rm.audit.audit-view=Audit anzeigen +rm.audit.trail-file-fail=Audit-Bericht konnte nicht generiert werden. \u00dcberpr\u00fcfen Sie die Audit-Details und versuchen Sie es erneut. Sie k\u00f6nnen sich auch an Ihre IT-Abteilung wenden. +rm.audit.audit-report=Audit-Bericht recordable-version-config=Optionen f\u00fcr automatische Deklaration \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties index e3b2551df5..7b92873769 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=Metadatos actualizados -rm.audit.created-object=Objeto creado -rm.audit.delete-object=Eliminar objeto -rm.audit.login-succeeded=Inicio de sesi\u00f3n correcto -rm.audit.login-failed=Error de inicio de sesi\u00f3n -rm.audit.create-person=Crear usuario -rm.audit.linkTo=Enlace a -rm.audit.moveTo=Mover a -rm.audit.copyTo=Copiar a -rm.audit.fileTo=Archivar en -rm.audit.audit-start=Iniciar auditor\u00eda -rm.audit.audit-stop=Detener auditor\u00eda -rm.audit.audit-clear=Limpiar auditor\u00eda -rm.audit.audit-view=Ver auditor\u00eda -rm.audit.trail-file-fail=No se pudo generar un informe de auditor\u00eda. Compruebe los detalles de auditor\u00eda y vuelva a intentarlo, o hable con el dep. de TI. -rm.audit.audit-report=Informe de auditor\u00eda +rm.audit.updated-metadata=Metadatos actualizados +rm.audit.created-object=Objeto creado +rm.audit.delete-object=Eliminar objeto +rm.audit.login-succeeded=Inicio de sesi\u00f3n correcto +rm.audit.login-failed=Error de inicio de sesi\u00f3n +rm.audit.create-person=Crear usuario +rm.audit.linkTo=Enlace a +rm.audit.moveTo=Mover a +rm.audit.copyTo=Copiar a +rm.audit.fileTo=Archivar en +rm.audit.audit-start=Iniciar auditor\u00eda +rm.audit.audit-stop=Detener auditor\u00eda +rm.audit.audit-clear=Limpiar auditor\u00eda +rm.audit.audit-view=Ver auditor\u00eda +rm.audit.trail-file-fail=No se pudo generar un informe de auditor\u00eda. Compruebe los detalles de auditor\u00eda y vuelva a intentarlo, o hable con el dep. de TI. +rm.audit.audit-report=Informe de auditor\u00eda recordable-version-config=Opciones de declaraci\u00f3n autom\u00e1tica \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties index e56c749129..5f817fd90e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=M\u00e9tadonn\u00e9es mises \u00e0 jour -rm.audit.created-object=Objet cr\u00e9\u00e9 -rm.audit.delete-object=Supprimer l'objet -rm.audit.login-succeeded=La connexion a abouti -rm.audit.login-failed=La connexion a \u00e9chou\u00e9 -rm.audit.create-person=Cr\u00e9er un utilisateur -rm.audit.linkTo=Lier \u00e0 -rm.audit.moveTo=D\u00e9placer vers... -rm.audit.copyTo=Copier vers... -rm.audit.fileTo=Archiver dans -rm.audit.audit-start=Audit d\u00e9marr\u00e9 -rm.audit.audit-stop=Audit arr\u00eat\u00e9 -rm.audit.audit-clear=Audit supprim\u00e9 -rm.audit.audit-view=Audit affich\u00e9 -rm.audit.trail-file-fail=Impossible de g\u00e9n\u00e9rer un rapport d'audit. V\u00e9rifiez les informations d'audit et r\u00e9essayez ou contactez votre DSI. -rm.audit.audit-report=Rapport d'audit +rm.audit.updated-metadata=M\u00e9tadonn\u00e9es mises \u00e0 jour +rm.audit.created-object=Objet cr\u00e9\u00e9 +rm.audit.delete-object=Supprimer l'objet +rm.audit.login-succeeded=La connexion a abouti +rm.audit.login-failed=La connexion a \u00e9chou\u00e9 +rm.audit.create-person=Cr\u00e9er un utilisateur +rm.audit.linkTo=Lier \u00e0 +rm.audit.moveTo=D\u00e9placer vers... +rm.audit.copyTo=Copier vers... +rm.audit.fileTo=Archiver dans +rm.audit.audit-start=Audit d\u00e9marr\u00e9 +rm.audit.audit-stop=Audit arr\u00eat\u00e9 +rm.audit.audit-clear=Audit supprim\u00e9 +rm.audit.audit-view=Audit affich\u00e9 +rm.audit.trail-file-fail=Impossible de g\u00e9n\u00e9rer un rapport d'audit. V\u00e9rifiez les informations d'audit et r\u00e9essayez ou contactez votre DSI. +rm.audit.audit-report=Rapport d'audit recordable-version-config=Options de d\u00e9claration automatique \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties index 4b11723317..6d5d99557f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=Metadati aggiornati -rm.audit.created-object=Oggetto creato -rm.audit.delete-object=Elimina oggetto -rm.audit.login-succeeded=Login riuscito -rm.audit.login-failed=Login non riuscito -rm.audit.create-person=Crea utente -rm.audit.linkTo=Collega a -rm.audit.moveTo=Sposta in -rm.audit.copyTo=Copia in -rm.audit.fileTo=Archivia in -rm.audit.audit-start=Avvio audit -rm.audit.audit-stop=Interruzione audit -rm.audit.audit-clear=Cancellazione audit -rm.audit.audit-view=Visualizzazione audit -rm.audit.trail-file-fail=Impossibile generare il rapporto di audit. Verificare i dettagli dell'audit e riprovare o contattare il proprio dipartimento I.T. I.T. -rm.audit.audit-report=Rapporto audit +rm.audit.updated-metadata=Metadati aggiornati +rm.audit.created-object=Oggetto creato +rm.audit.delete-object=Elimina oggetto +rm.audit.login-succeeded=Login riuscito +rm.audit.login-failed=Login non riuscito +rm.audit.create-person=Crea utente +rm.audit.linkTo=Collega a +rm.audit.moveTo=Sposta in +rm.audit.copyTo=Copia in +rm.audit.fileTo=Archivia in +rm.audit.audit-start=Avvio audit +rm.audit.audit-stop=Interruzione audit +rm.audit.audit-clear=Cancellazione audit +rm.audit.audit-view=Visualizzazione audit +rm.audit.trail-file-fail=Impossibile generare il rapporto di audit. Verificare i dettagli dell'audit e riprovare o contattare il proprio dipartimento I.T. I.T. +rm.audit.audit-report=Rapporto audit recordable-version-config=Opzioni di dichiarazione automatica \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties index b5da3d1ef0..7505e1aeea 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=\u66f4\u65b0\u6e08\u307f\u30e1\u30bf\u30c7\u30fc\u30bf -rm.audit.created-object=\u4f5c\u6210\u6e08\u307f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 -rm.audit.delete-object=\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u524a\u9664 -rm.audit.login-succeeded=\u30ed\u30b0\u30a4\u30f3\u6210\u529f -rm.audit.login-failed=\u30ed\u30b0\u30a4\u30f3\u5931\u6557 -rm.audit.create-person=\u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210 -rm.audit.linkTo=\u30ea\u30f3\u30af\u5148 -rm.audit.moveTo=\u79fb\u52d5\u5148 -rm.audit.copyTo=\u30b3\u30d4\u30fc\u5148 -rm.audit.fileTo=\u6574\u7406\u4fdd\u7ba1\u5148 -rm.audit.audit-start=\u76e3\u67fb\u306e\u958b\u59cb -rm.audit.audit-stop=\u76e3\u67fb\u306e\u505c\u6b62 -rm.audit.audit-clear=\u76e3\u67fb\u306e\u6d88\u53bb -rm.audit.audit-view=\u76e3\u67fb\u306e\u8868\u793a -rm.audit.trail-file-fail=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 \u76e3\u67fb\u306e\u8a73\u7d30\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3059\u304b\u3001IT \u62c5\u5f53\u8005\u306b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.audit.audit-report=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8 +rm.audit.updated-metadata=\u66f4\u65b0\u6e08\u307f\u30e1\u30bf\u30c7\u30fc\u30bf +rm.audit.created-object=\u4f5c\u6210\u6e08\u307f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 +rm.audit.delete-object=\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u524a\u9664 +rm.audit.login-succeeded=\u30ed\u30b0\u30a4\u30f3\u6210\u529f +rm.audit.login-failed=\u30ed\u30b0\u30a4\u30f3\u5931\u6557 +rm.audit.create-person=\u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210 +rm.audit.linkTo=\u30ea\u30f3\u30af\u5148 +rm.audit.moveTo=\u79fb\u52d5\u5148 +rm.audit.copyTo=\u30b3\u30d4\u30fc\u5148 +rm.audit.fileTo=\u6574\u7406\u4fdd\u7ba1\u5148 +rm.audit.audit-start=\u76e3\u67fb\u306e\u958b\u59cb +rm.audit.audit-stop=\u76e3\u67fb\u306e\u505c\u6b62 +rm.audit.audit-clear=\u76e3\u67fb\u306e\u6d88\u53bb +rm.audit.audit-view=\u76e3\u67fb\u306e\u8868\u793a +rm.audit.trail-file-fail=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 \u76e3\u67fb\u306e\u8a73\u7d30\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3059\u304b\u3001IT \u62c5\u5f53\u8005\u306b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.audit.audit-report=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8 recordable-version-config=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties index 95fcc8b0fa..9f6d9093b7 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=Oppdatert metadata -rm.audit.created-object=Opprettet element -rm.audit.delete-object=Slett element -rm.audit.login-succeeded=Vellykket p\u00e5logging -rm.audit.login-failed=Mislykket p\u00e5logging -rm.audit.create-person=Opprett bruker -rm.audit.linkTo=Koble til -rm.audit.moveTo=Flytt til -rm.audit.copyTo=Kopier til -rm.audit.fileTo=Arkiver i -rm.audit.audit-start=Revisjonsstart -rm.audit.audit-stop=Revisjonsstopp -rm.audit.audit-clear=Slett revisjon -rm.audit.audit-view=Vis revisjon -rm.audit.trail-file-fail=Kunne ikke generere en revisjonsrapport. Kontroller revisjonsdetaljene, og pr\u00f8v igjen eller snakk med din IT- avdeling. -rm.audit.audit-report=Revisjonsrapport +rm.audit.updated-metadata=Oppdatert metadata +rm.audit.created-object=Opprettet element +rm.audit.delete-object=Slett element +rm.audit.login-succeeded=Vellykket p\u00e5logging +rm.audit.login-failed=Mislykket p\u00e5logging +rm.audit.create-person=Opprett bruker +rm.audit.linkTo=Koble til +rm.audit.moveTo=Flytt til +rm.audit.copyTo=Kopier til +rm.audit.fileTo=Arkiver i +rm.audit.audit-start=Revisjonsstart +rm.audit.audit-stop=Revisjonsstopp +rm.audit.audit-clear=Slett revisjon +rm.audit.audit-view=Vis revisjon +rm.audit.trail-file-fail=Kunne ikke generere en revisjonsrapport. Kontroller revisjonsdetaljene, og pr\u00f8v igjen eller snakk med din IT- avdeling. +rm.audit.audit-report=Revisjonsrapport recordable-version-config=Alternativer med automatiske erkl\u00e6ringer \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties index 6a6b7b8079..9709a79d15 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=Bijgewerkte metagegevens -rm.audit.created-object=Object gemaakt -rm.audit.delete-object=Object verwijderen -rm.audit.login-succeeded=Aanmelden geslaagd -rm.audit.login-failed=Aanmelden niet geslaagd -rm.audit.create-person=Gebruiker maken -rm.audit.linkTo=Koppelen naar -rm.audit.moveTo=Verplaatsen naar -rm.audit.copyTo=Kopi\u00ebren naar -rm.audit.fileTo=Archiveren in -rm.audit.audit-start=Audit starten -rm.audit.audit-stop=Audit stoppen -rm.audit.audit-clear=Audit wissen -rm.audit.audit-view=Audit bekijken -rm.audit.trail-file-fail=Kan geen auditrapport maken. Controleer de auditgegevens en probeer het opnieuw of neem contact op met uw IT- afdeling -rm.audit.audit-report=Auditrapport +rm.audit.updated-metadata=Bijgewerkte metagegevens +rm.audit.created-object=Object gemaakt +rm.audit.delete-object=Object verwijderen +rm.audit.login-succeeded=Aanmelden geslaagd +rm.audit.login-failed=Aanmelden niet geslaagd +rm.audit.create-person=Gebruiker maken +rm.audit.linkTo=Koppelen naar +rm.audit.moveTo=Verplaatsen naar +rm.audit.copyTo=Kopi\u00ebren naar +rm.audit.fileTo=Archiveren in +rm.audit.audit-start=Audit starten +rm.audit.audit-stop=Audit stoppen +rm.audit.audit-clear=Audit wissen +rm.audit.audit-view=Audit bekijken +rm.audit.trail-file-fail=Kan geen auditrapport maken. Controleer de auditgegevens en probeer het opnieuw of neem contact op met uw IT- afdeling +rm.audit.audit-report=Auditrapport recordable-version-config=Opties voor automatisch declareren \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties index 9e9cb583cd..0a2f60ed7d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=Metadados atualizados -rm.audit.created-object=Objeto criado -rm.audit.delete-object=Excluir objeto -rm.audit.login-succeeded=Login bem-sucedido -rm.audit.login-failed=Login malsucedido -rm.audit.create-person=Criar usu\u00e1rio -rm.audit.linkTo=Vincular a -rm.audit.moveTo=Mover para -rm.audit.copyTo=Copiar para -rm.audit.fileTo=Arquivar em -rm.audit.audit-start=In\u00edcio da auditoria -rm.audit.audit-stop=Parada da auditoria -rm.audit.audit-clear=Limpeza de auditoria -rm.audit.audit-view=Exibi\u00e7\u00e3o de auditoria -rm.audit.trail-file-fail=N\u00e3o \u00e9 poss\u00edvel gerar um relat\u00f3rio de auditoria. Verifique os detalhes de auditoria e tente novamente, ou entre em contato com o Dept. de TI. -rm.audit.audit-report=Relat\u00f3rio de auditoria +rm.audit.updated-metadata=Metadados atualizados +rm.audit.created-object=Objeto criado +rm.audit.delete-object=Excluir objeto +rm.audit.login-succeeded=Login bem-sucedido +rm.audit.login-failed=Login malsucedido +rm.audit.create-person=Criar usu\u00e1rio +rm.audit.linkTo=Vincular a +rm.audit.moveTo=Mover para +rm.audit.copyTo=Copiar para +rm.audit.fileTo=Arquivar em +rm.audit.audit-start=In\u00edcio da auditoria +rm.audit.audit-stop=Parada da auditoria +rm.audit.audit-clear=Limpeza de auditoria +rm.audit.audit-view=Exibi\u00e7\u00e3o de auditoria +rm.audit.trail-file-fail=N\u00e3o \u00e9 poss\u00edvel gerar um relat\u00f3rio de auditoria. Verifique os detalhes de auditoria e tente novamente, ou entre em contato com o Dept. de TI. +rm.audit.audit-report=Relat\u00f3rio de auditoria recordable-version-config=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties index b191bb0c3b..eb60080e3b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 -rm.audit.created-object=\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 -rm.audit.delete-object=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 -rm.audit.login-succeeded=\u0412\u0445\u043e\u0434 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d -rm.audit.login-failed=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 -rm.audit.create-person=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f -rm.audit.linkTo=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0441 -rm.audit.moveTo=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 -rm.audit.copyTo=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 -rm.audit.fileTo=\u0421\u0434\u0430\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0432 -rm.audit.audit-start=\u0417\u0430\u043f\u0443\u0441\u043a \u0430\u0443\u0434\u0438\u0442\u0430 -rm.audit.audit-stop=\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0430\u0443\u0434\u0438\u0442\u0430 -rm.audit.audit-clear=\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0430\u0443\u0434\u0438\u0442\u0430 -rm.audit.audit-view=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0430\u0443\u0434\u0438\u0442\u0430 -rm.audit.trail-file-fail=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u0442\u0430 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 IT- \u043e\u0442\u0434\u0435\u043b. -rm.audit.audit-report=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435 +rm.audit.updated-metadata=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 +rm.audit.created-object=\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 +rm.audit.delete-object=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 +rm.audit.login-succeeded=\u0412\u0445\u043e\u0434 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d +rm.audit.login-failed=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 +rm.audit.create-person=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f +rm.audit.linkTo=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0441 +rm.audit.moveTo=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 +rm.audit.copyTo=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 +rm.audit.fileTo=\u0421\u0434\u0430\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0432 +rm.audit.audit-start=\u0417\u0430\u043f\u0443\u0441\u043a \u0430\u0443\u0434\u0438\u0442\u0430 +rm.audit.audit-stop=\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0430\u0443\u0434\u0438\u0442\u0430 +rm.audit.audit-clear=\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0430\u0443\u0434\u0438\u0442\u0430 +rm.audit.audit-view=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0430\u0443\u0434\u0438\u0442\u0430 +rm.audit.trail-file-fail=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435. \u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u0442\u0430 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 IT- \u043e\u0442\u0434\u0435\u043b. +rm.audit.audit-report=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435 recordable-version-config=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties index 174b309dd8..f3887ab661 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties @@ -1,17 +1,17 @@ -rm.audit.updated-metadata=\u66f4\u65b0\u7684\u5143\u6570\u636e -rm.audit.created-object=\u521b\u5efa\u7684\u5bf9\u8c61 -rm.audit.delete-object=\u5220\u9664\u5bf9\u8c61 -rm.audit.login-succeeded=\u767b\u5f55\u6210\u529f -rm.audit.login-failed=\u767b\u5f55\u5931\u8d25 -rm.audit.create-person=\u521b\u5efa\u7528\u6237 -rm.audit.linkTo=\u94fe\u63a5\u5230 -rm.audit.moveTo=\u79fb\u52a8\u5230 -rm.audit.copyTo=\u590d\u5236\u5230 -rm.audit.fileTo=\u7acb\u5377\u81f3 -rm.audit.audit-start=\u5f00\u59cb\u5ba1\u8ba1 -rm.audit.audit-stop=\u505c\u6b62\u5ba1\u8ba1 -rm.audit.audit-clear=\u6e05\u9664\u5ba1\u8ba1 -rm.audit.audit-view=\u67e5\u770b\u5ba1\u8ba1 -rm.audit.trail-file-fail=\u6211\u4eec\u65e0\u6cd5\u751f\u6210\u5ba1\u8ba1\u62a5\u544a\u3002 \u68c0\u67e5\u5ba1\u8ba1\u8be6\u7ec6\u4fe1\u606f\u5e76\u91cd\u8bd5\uff0c\u6216\u8005\u54a8\u8be2\u60a8\u7684 IT \u90e8\u95e8\u3002 -rm.audit.audit-report=\u5ba1\u8ba1\u62a5\u544a +rm.audit.updated-metadata=\u66f4\u65b0\u7684\u5143\u6570\u636e +rm.audit.created-object=\u521b\u5efa\u7684\u5bf9\u8c61 +rm.audit.delete-object=\u5220\u9664\u5bf9\u8c61 +rm.audit.login-succeeded=\u767b\u5f55\u6210\u529f +rm.audit.login-failed=\u767b\u5f55\u5931\u8d25 +rm.audit.create-person=\u521b\u5efa\u7528\u6237 +rm.audit.linkTo=\u94fe\u63a5\u5230 +rm.audit.moveTo=\u79fb\u52a8\u5230 +rm.audit.copyTo=\u590d\u5236\u5230 +rm.audit.fileTo=\u7acb\u5377\u81f3 +rm.audit.audit-start=\u5f00\u59cb\u5ba1\u8ba1 +rm.audit.audit-stop=\u505c\u6b62\u5ba1\u8ba1 +rm.audit.audit-clear=\u6e05\u9664\u5ba1\u8ba1 +rm.audit.audit-view=\u67e5\u770b\u5ba1\u8ba1 +rm.audit.trail-file-fail=\u6211\u4eec\u65e0\u6cd5\u751f\u6210\u5ba1\u8ba1\u62a5\u544a\u3002 \u68c0\u67e5\u5ba1\u8ba1\u8be6\u7ec6\u4fe1\u606f\u5e76\u91cd\u8bd5\uff0c\u6216\u8005\u54a8\u8be2\u60a8\u7684 IT \u90e8\u95e8\u3002 +rm.audit.audit-report=\u5ba1\u8ba1\u62a5\u544a recordable-version-config=\u81ea\u52a8\u58f0\u660e\u9009\u9879 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties index 5f73d46a9d..97ab98883d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=Records -capability.DeclareRecords.title=Complete Records -capability.ViewRecords.title=View Records -capability.UndeclareRecords.title=Reopen Records -capability.CreateRecords.title=Create Records -capability.RequestRecordInformation.title=Request Record Information -capability.RejectRecords.title=Reject Records -capability.FileUnfiledRecords.title=File Unfiled Records -capability.LinkToRecords.title=Link Records -capability.DeleteLinks.title=Unlink Records - -# Metadata Control -capability.group.metadataControl.title=Metadata Control -capability.EditRecordMetadata.title=Edit Record Metadata -capability.EditDeclaredRecordMetadata.title=Edit Completed Record Metadata -capability.EditNonRecordMetadata.title=Edit Non-Record Metadata -capability.MoveRecords.title=Move Records - -# Folder Control -capability.group.folderControl.title=Folder Control -capability.CreateModifyDestroyFolders.title=Create Modify Destroy Folders -capability.CloseFolders.title=Close Folders -capability.ReOpenFolders.title=Re-Open Folders -capability.DeclareRecordsInClosedFolders.title=Complete Records in Closed Folders - -# Vital Records -capability.group.vitalRecords.title=Vital Records -capability.UpdateVitalRecordCycleInformation.title=Update Vital Record Cycle Information -capability.CycleVitalRecords.title=Cycle Vital Records -capability.PlanningReviewCycles.title=Planning Review Cycles - -# References and Links -capability.group.references.title=References -capability.ChangeOrDeleteReferences.title=Change or Delete References - -# Events -capability.group.events.title=Events -capability.CreateModifyDestroyEvents.title=Create Modify Destroy Events -capability.AddModifyEventDates.title=Add Modify Event Dates - -# Cutoff -capability.group.cutoff.title=Cut Off -capability.ApproveRecordsScheduledForCutoff.title=Approve Records Scheduled for Cut Off -capability.CreateModifyRecordsInCutoffFolders.title=Create Modify Records in Cut Off Folders - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Retention and Transfers -capability.UpdateTriggerDates.title=Update Trigger Dates -capability.ManuallyChangeDispositionDates.title=Manually Change Retention Dates -capability.AuthorizeNominatedTransfers.title=Authorize Nominated Transfers -capability.AuthorizeAllTransfers.title=Authorize All Transfers -capability.DestroyRecordsScheduledForDestruction.title=Destroy Record or Record Folder Scheduled for Destruction -capability.DestroyRecords.title=Destroy Records -capability.DeleteRecords.title=Delete Records -capability.TriggerAnEvent.title=Trigger an Event -capability.FileDestructionReport.title=File Destruction Report -capability.FileTransferReport.title=File Transfer Report -capability.EndRetention.title=End Retention - -# Hold Controls -capability.group.holdControls.title=Hold Controls -capability.ExtendRetentionPeriodOrFreeze.title=Extend Retention Period or Freeze -capability.Unfreeze.title=Unfreeze -capability.ViewUpdateReasonsForFreeze.title=View Update Reasons for Freeze -capability.CreateHold.title=Create Hold -capability.AddToHold.title=Add to Hold -capability.RemoveFromHold.title=Remove from Hold -capability.FileHoldReport.title=File Hold Report -capability.DeleteHold.title=Delete Hold -capability.EditHold.title=Edit Hold - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=Declare Audit as Record -capability.EnableDisableAuditByTypes.title=Enable Disable Audit by Types -capability.DeleteAudit.title=Delete Audit -capability.SelectAuditMetadata.title=Select Audit Metadata -capability.AccessAudit.title=Access Audit -capability.ExportAudit.title=Export Audit - -# Security -capability.group.security.title=Security -capability.CreateModifyDestroyRoles.title=Create Modify Destroy Roles -capability.CreateModifyDestroyUsersAndGroups.title=Create Modify Destroy Users and Groups -capability.PasswordControl.title=Password Control -capability.DisplayRightsReport.title=Display Rights Report -capability.ManageAccessControls.title=Group and User Role Assignment -capability.ManageAccessRights.title=Manage Permissions - -# Configuration -capability.group.config.title=Configuration -capability.CreateModifyDestroyFileplanMetadata.title=Create Modify Destroy File Plan Metadata -capability.CreateModifyDestroyFileplanTypes.title=Create Modify Destroy File Plan Types -capability.CreateModifyDestroyRecordTypes.title=Create Modify Destroy Record Types -capability.CreateAndAssociateSelectionLists.title=Create and Associate Selection Lists -capability.EditSelectionLists.title=Edit Selection Lists -capability.CreateModifyDestroyReferenceTypes.title=Create Modify Destroy Reference Types -capability.AttachRulesToMetadataProperties.title=Attach Rules to Metadata Properties -capability.MakeOptionalParametersMandatory.title=Make Optional Parameters Mandatory -capability.MapEmailMetadata.title=Map Email Metadata - -# Rules -capability.group.rules.title=Rules +# Records +capability.group.records.title=Records +capability.DeclareRecords.title=Complete Records +capability.ViewRecords.title=View Records +capability.UndeclareRecords.title=Reopen Records +capability.CreateRecords.title=Create Records +capability.RequestRecordInformation.title=Request Record Information +capability.RejectRecords.title=Reject Records +capability.FileUnfiledRecords.title=File Unfiled Records +capability.LinkToRecords.title=Link Records +capability.DeleteLinks.title=Unlink Records + +# Metadata Control +capability.group.metadataControl.title=Metadata Control +capability.EditRecordMetadata.title=Edit Record Metadata +capability.EditDeclaredRecordMetadata.title=Edit Completed Record Metadata +capability.EditNonRecordMetadata.title=Edit Non-Record Metadata +capability.MoveRecords.title=Move Records + +# Folder Control +capability.group.folderControl.title=Folder Control +capability.CreateModifyDestroyFolders.title=Create Modify Destroy Folders +capability.CloseFolders.title=Close Folders +capability.ReOpenFolders.title=Re-Open Folders +capability.DeclareRecordsInClosedFolders.title=Complete Records in Closed Folders + +# Vital Records +capability.group.vitalRecords.title=Vital Records +capability.UpdateVitalRecordCycleInformation.title=Update Vital Record Cycle Information +capability.CycleVitalRecords.title=Cycle Vital Records +capability.PlanningReviewCycles.title=Planning Review Cycles + +# References and Links +capability.group.references.title=References +capability.ChangeOrDeleteReferences.title=Change or Delete References + +# Events +capability.group.events.title=Events +capability.CreateModifyDestroyEvents.title=Create Modify Destroy Events +capability.AddModifyEventDates.title=Add Modify Event Dates + +# Cutoff +capability.group.cutoff.title=Cut Off +capability.ApproveRecordsScheduledForCutoff.title=Approve Records Scheduled for Cut Off +capability.CreateModifyRecordsInCutoffFolders.title=Create Modify Records in Cut Off Folders + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=Retention and Transfers +capability.UpdateTriggerDates.title=Update Trigger Dates +capability.ManuallyChangeDispositionDates.title=Manually Change Retention Dates +capability.AuthorizeNominatedTransfers.title=Authorize Nominated Transfers +capability.AuthorizeAllTransfers.title=Authorize All Transfers +capability.DestroyRecordsScheduledForDestruction.title=Destroy Record or Record Folder Scheduled for Destruction +capability.DestroyRecords.title=Destroy Records +capability.DeleteRecords.title=Delete Records +capability.TriggerAnEvent.title=Trigger an Event +capability.FileDestructionReport.title=File Destruction Report +capability.FileTransferReport.title=File Transfer Report +capability.EndRetention.title=End Retention + +# Hold Controls +capability.group.holdControls.title=Hold Controls +capability.ExtendRetentionPeriodOrFreeze.title=Extend Retention Period or Freeze +capability.Unfreeze.title=Unfreeze +capability.ViewUpdateReasonsForFreeze.title=View Update Reasons for Freeze +capability.CreateHold.title=Create Hold +capability.AddToHold.title=Add to Hold +capability.RemoveFromHold.title=Remove from Hold +capability.FileHoldReport.title=File Hold Report +capability.DeleteHold.title=Delete Hold +capability.EditHold.title=Edit Hold + +# Audit +capability.group.audit.title=Audit +capability.DeclareAuditAsRecord.title=Declare Audit as Record +capability.EnableDisableAuditByTypes.title=Enable Disable Audit by Types +capability.DeleteAudit.title=Delete Audit +capability.SelectAuditMetadata.title=Select Audit Metadata +capability.AccessAudit.title=Access Audit +capability.ExportAudit.title=Export Audit + +# Security +capability.group.security.title=Security +capability.CreateModifyDestroyRoles.title=Create Modify Destroy Roles +capability.CreateModifyDestroyUsersAndGroups.title=Create Modify Destroy Users and Groups +capability.PasswordControl.title=Password Control +capability.DisplayRightsReport.title=Display Rights Report +capability.ManageAccessControls.title=Group and User Role Assignment +capability.ManageAccessRights.title=Manage Permissions + +# Configuration +capability.group.config.title=Configuration +capability.CreateModifyDestroyFileplanMetadata.title=Create Modify Destroy File Plan Metadata +capability.CreateModifyDestroyFileplanTypes.title=Create Modify Destroy File Plan Types +capability.CreateModifyDestroyRecordTypes.title=Create Modify Destroy Record Types +capability.CreateAndAssociateSelectionLists.title=Create and Associate Selection Lists +capability.EditSelectionLists.title=Edit Selection Lists +capability.CreateModifyDestroyReferenceTypes.title=Create Modify Destroy Reference Types +capability.AttachRulesToMetadataProperties.title=Attach Rules to Metadata Properties +capability.MakeOptionalParametersMandatory.title=Make Optional Parameters Mandatory +capability.MapEmailMetadata.title=Map Email Metadata + +# Rules +capability.group.rules.title=Rules capability.ManageRules.title=Manage Rules \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties index 4c27782746..cd9feee3db 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=Records -capability.DeclareRecords.title=Records abschlie\u00dfen -capability.ViewRecords.title=Records anzeigen -capability.UndeclareRecords.title=Records erneut \u00f6ffnen -capability.CreateRecords.title=Records erstellen -capability.RequestRecordInformation.title=Record-Informationen anfordern -capability.RejectRecords.title=Records ablehnen -capability.FileUnfiledRecords.title=Nicht abgelegte Records ablegen -capability.LinkToRecords.title=Records verkn\u00fcpfen -capability.DeleteLinks.title=Verkn\u00fcpfung zu Records aufheben - -# Metadata Control -capability.group.metadataControl.title=Metadaten-Steuerung -capability.EditRecordMetadata.title=Record-Metadaten bearbeiten -capability.EditDeclaredRecordMetadata.title=Metadaten von abgeschlossenem Record bearbeiten -capability.EditNonRecordMetadata.title=Record-fremde Metadaten bearbeiten -capability.MoveRecords.title=Records verschieben - -# Folder Control -capability.group.folderControl.title=Ordnersteuerung -capability.CreateModifyDestroyFolders.title=Ordner erstellen/\u00e4ndern/vernichten -capability.CloseFolders.title=Ordner schlie\u00dfen -capability.ReOpenFolders.title=Ordner erneut \u00f6ffnen -capability.DeclareRecordsInClosedFolders.title=Records in geschlossenen Ordnern abschlie\u00dfen - -# Vital Records -capability.group.vitalRecords.title=Besonders relevante Records -capability.UpdateVitalRecordCycleInformation.title=Zyklusinformationen besonders relevanter Records aktualisieren -capability.CycleVitalRecords.title=Zyklus besonders relevanter Records -capability.PlanningReviewCycles.title=\u00dcberpr\u00fcfungszyklen planen - -# References and Links -capability.group.references.title=Referenzen -capability.ChangeOrDeleteReferences.title=Referenzen \u00e4ndern oder l\u00f6schen - -# Events -capability.group.events.title=Ereignisse -capability.CreateModifyDestroyEvents.title=Ereignisse erstellen/\u00e4ndern/vernichten -capability.AddModifyEventDates.title=Ereignisdaten hinzuf\u00fcgen/\u00e4ndern - -# Cutoff -capability.group.cutoff.title=Trennen -capability.ApproveRecordsScheduledForCutoff.title=F\u00fcr Trennung geplante Records genehmigen -capability.CreateModifyRecordsInCutoffFolders.title=Records in getrennten Ordnern erstellen/\u00e4ndern - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Aufbewahrung und \u00dcbertragungen -capability.UpdateTriggerDates.title=Triggerdaten aktualisieren -capability.ManuallyChangeDispositionDates.title=Aufbewahrungsdaten manuell \u00e4ndern -capability.AuthorizeNominatedTransfers.title=Nominierte \u00dcbertragungen autorisieren -capability.AuthorizeAllTransfers.title=Alle \u00dcbertragungen autorisieren -capability.DestroyRecordsScheduledForDestruction.title=Zur Vernichtung vorgesehenen Record oder Record-Ordner vernichten -capability.DestroyRecords.title=Records vernichten -capability.DeleteRecords.title=Records l\u00f6schen -capability.TriggerAnEvent.title=Ereignis ausl\u00f6sen -capability.FileDestructionReport.title=Vernichtungsprotokoll ablegen -capability.FileTransferReport.title=\u00dcbertragungsbericht ablegen -capability.EndRetention.title=Aufbewahrung beenden - -# Hold Controls -capability.group.holdControls.title=Sperrsteuerung -capability.ExtendRetentionPeriodOrFreeze.title=Aufbewahrungsfrist verl\u00e4ngern oder fixieren -capability.Unfreeze.title=Fixierung aufheben -capability.ViewUpdateReasonsForFreeze.title=Aktualisierungsgrund f\u00fcr Fixierung anzeigen -capability.CreateHold.title=Sperrbereich erstellen -capability.AddToHold.title=Zum Sperrbereich hinzuf\u00fcgen -capability.RemoveFromHold.title=Vom Sperrbereich entfernen -capability.FileHoldReport.title=Sperrbericht ablegen -capability.DeleteHold.title=Sperrbereich l\u00f6schen -capability.EditHold.title=Sperrbereich bearbeiten - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=Audit als Record deklarieren -capability.EnableDisableAuditByTypes.title=Audit nach Typen aktivieren/deaktivieren -capability.DeleteAudit.title=Audit l\u00f6schen -capability.SelectAuditMetadata.title=Audit-Metadaten ausw\u00e4hlen -capability.AccessAudit.title=Auf Audit zugreifen -capability.ExportAudit.title=Audit exportieren - -# Security -capability.group.security.title=Sicherheit -capability.CreateModifyDestroyRoles.title=Rollen erstellen/\u00e4ndern/vernichten -capability.CreateModifyDestroyUsersAndGroups.title=Benutzer und Gruppen erstellen/\u00e4ndern/vernichten -capability.PasswordControl.title=Passwortsteuerung -capability.DisplayRightsReport.title=Rechtebericht anzeigen -capability.ManageAccessControls.title=Zuweisung von Gruppen- und Benutzerrollen -capability.ManageAccessRights.title=Berechtigungen verwalten - -# Configuration -capability.group.config.title=Konfiguration -capability.CreateModifyDestroyFileplanMetadata.title=Ablageplan-Metadaten erstellen/\u00e4ndern/vernichten -capability.CreateModifyDestroyFileplanTypes.title=Ablageplan-Typen erstellen/\u00e4ndern/vernichten -capability.CreateModifyDestroyRecordTypes.title=Record-Typen erstellen/\u00e4ndern/vernichten -capability.CreateAndAssociateSelectionLists.title=Auswahllisten erstellen und zuordnen -capability.EditSelectionLists.title=Auswahllisten bearbeiten -capability.CreateModifyDestroyReferenceTypes.title=Referenztypen erstellen/\u00e4ndern/vernichten -capability.AttachRulesToMetadataProperties.title=Regeln an Metadaten-Eigenschaften anh\u00e4ngen -capability.MakeOptionalParametersMandatory.title=Optionale Parameter als erforderlich festlegen -capability.MapEmailMetadata.title=E-Mail-Metadaten zuordnen - -# Rules -capability.group.rules.title=Regeln +# Records +capability.group.records.title=Records +capability.DeclareRecords.title=Records abschlie\u00dfen +capability.ViewRecords.title=Records anzeigen +capability.UndeclareRecords.title=Records erneut \u00f6ffnen +capability.CreateRecords.title=Records erstellen +capability.RequestRecordInformation.title=Record-Informationen anfordern +capability.RejectRecords.title=Records ablehnen +capability.FileUnfiledRecords.title=Nicht abgelegte Records ablegen +capability.LinkToRecords.title=Records verkn\u00fcpfen +capability.DeleteLinks.title=Verkn\u00fcpfung zu Records aufheben + +# Metadata Control +capability.group.metadataControl.title=Metadaten-Steuerung +capability.EditRecordMetadata.title=Record-Metadaten bearbeiten +capability.EditDeclaredRecordMetadata.title=Metadaten von abgeschlossenem Record bearbeiten +capability.EditNonRecordMetadata.title=Record-fremde Metadaten bearbeiten +capability.MoveRecords.title=Records verschieben + +# Folder Control +capability.group.folderControl.title=Ordnersteuerung +capability.CreateModifyDestroyFolders.title=Ordner erstellen/\u00e4ndern/vernichten +capability.CloseFolders.title=Ordner schlie\u00dfen +capability.ReOpenFolders.title=Ordner erneut \u00f6ffnen +capability.DeclareRecordsInClosedFolders.title=Records in geschlossenen Ordnern abschlie\u00dfen + +# Vital Records +capability.group.vitalRecords.title=Besonders relevante Records +capability.UpdateVitalRecordCycleInformation.title=Zyklusinformationen besonders relevanter Records aktualisieren +capability.CycleVitalRecords.title=Zyklus besonders relevanter Records +capability.PlanningReviewCycles.title=\u00dcberpr\u00fcfungszyklen planen + +# References and Links +capability.group.references.title=Referenzen +capability.ChangeOrDeleteReferences.title=Referenzen \u00e4ndern oder l\u00f6schen + +# Events +capability.group.events.title=Ereignisse +capability.CreateModifyDestroyEvents.title=Ereignisse erstellen/\u00e4ndern/vernichten +capability.AddModifyEventDates.title=Ereignisdaten hinzuf\u00fcgen/\u00e4ndern + +# Cutoff +capability.group.cutoff.title=Trennen +capability.ApproveRecordsScheduledForCutoff.title=F\u00fcr Trennung geplante Records genehmigen +capability.CreateModifyRecordsInCutoffFolders.title=Records in getrennten Ordnern erstellen/\u00e4ndern + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=Aufbewahrung und \u00dcbertragungen +capability.UpdateTriggerDates.title=Triggerdaten aktualisieren +capability.ManuallyChangeDispositionDates.title=Aufbewahrungsdaten manuell \u00e4ndern +capability.AuthorizeNominatedTransfers.title=Nominierte \u00dcbertragungen autorisieren +capability.AuthorizeAllTransfers.title=Alle \u00dcbertragungen autorisieren +capability.DestroyRecordsScheduledForDestruction.title=Zur Vernichtung vorgesehenen Record oder Record-Ordner vernichten +capability.DestroyRecords.title=Records vernichten +capability.DeleteRecords.title=Records l\u00f6schen +capability.TriggerAnEvent.title=Ereignis ausl\u00f6sen +capability.FileDestructionReport.title=Vernichtungsprotokoll ablegen +capability.FileTransferReport.title=\u00dcbertragungsbericht ablegen +capability.EndRetention.title=Aufbewahrung beenden + +# Hold Controls +capability.group.holdControls.title=Sperrsteuerung +capability.ExtendRetentionPeriodOrFreeze.title=Aufbewahrungsfrist verl\u00e4ngern oder fixieren +capability.Unfreeze.title=Fixierung aufheben +capability.ViewUpdateReasonsForFreeze.title=Aktualisierungsgrund f\u00fcr Fixierung anzeigen +capability.CreateHold.title=Sperrbereich erstellen +capability.AddToHold.title=Zum Sperrbereich hinzuf\u00fcgen +capability.RemoveFromHold.title=Vom Sperrbereich entfernen +capability.FileHoldReport.title=Sperrbericht ablegen +capability.DeleteHold.title=Sperrbereich l\u00f6schen +capability.EditHold.title=Sperrbereich bearbeiten + +# Audit +capability.group.audit.title=Audit +capability.DeclareAuditAsRecord.title=Audit als Record deklarieren +capability.EnableDisableAuditByTypes.title=Audit nach Typen aktivieren/deaktivieren +capability.DeleteAudit.title=Audit l\u00f6schen +capability.SelectAuditMetadata.title=Audit-Metadaten ausw\u00e4hlen +capability.AccessAudit.title=Auf Audit zugreifen +capability.ExportAudit.title=Audit exportieren + +# Security +capability.group.security.title=Sicherheit +capability.CreateModifyDestroyRoles.title=Rollen erstellen/\u00e4ndern/vernichten +capability.CreateModifyDestroyUsersAndGroups.title=Benutzer und Gruppen erstellen/\u00e4ndern/vernichten +capability.PasswordControl.title=Passwortsteuerung +capability.DisplayRightsReport.title=Rechtebericht anzeigen +capability.ManageAccessControls.title=Zuweisung von Gruppen- und Benutzerrollen +capability.ManageAccessRights.title=Berechtigungen verwalten + +# Configuration +capability.group.config.title=Konfiguration +capability.CreateModifyDestroyFileplanMetadata.title=Ablageplan-Metadaten erstellen/\u00e4ndern/vernichten +capability.CreateModifyDestroyFileplanTypes.title=Ablageplan-Typen erstellen/\u00e4ndern/vernichten +capability.CreateModifyDestroyRecordTypes.title=Record-Typen erstellen/\u00e4ndern/vernichten +capability.CreateAndAssociateSelectionLists.title=Auswahllisten erstellen und zuordnen +capability.EditSelectionLists.title=Auswahllisten bearbeiten +capability.CreateModifyDestroyReferenceTypes.title=Referenztypen erstellen/\u00e4ndern/vernichten +capability.AttachRulesToMetadataProperties.title=Regeln an Metadaten-Eigenschaften anh\u00e4ngen +capability.MakeOptionalParametersMandatory.title=Optionale Parameter als erforderlich festlegen +capability.MapEmailMetadata.title=E-Mail-Metadaten zuordnen + +# Rules +capability.group.rules.title=Regeln capability.ManageRules.title=Regeln verwalten \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties index eadb084b32..ebf247032a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=Documentos de archivo -capability.DeclareRecords.title=Documentos de archivo completo -capability.ViewRecords.title=Ver documentos de archivo -capability.UndeclareRecords.title=Reabrir documentos de archivo -capability.CreateRecords.title=Crear documentos de archivo -capability.RequestRecordInformation.title=Solicitar informaci\u00f3n sobre documento de archivo -capability.RejectRecords.title=Rechazar documentos de archivo -capability.FileUnfiledRecords.title=Archivar documentos de archivo no archivados -capability.LinkToRecords.title=Enlazar documentos de archivo -capability.DeleteLinks.title=Desvincular documentos de archivo - -# Metadata Control -capability.group.metadataControl.title=Control de metadatos -capability.EditRecordMetadata.title=Editar metadatos de documento de archivo -capability.EditDeclaredRecordMetadata.title=Editar metadatos de documento de archivo completados -capability.EditNonRecordMetadata.title=Editar metadatos que no son de documentos de archivo -capability.MoveRecords.title=Mover documentos de archivo - -# Folder Control -capability.group.folderControl.title=Control de carpetas -capability.CreateModifyDestroyFolders.title=Crear Modificar Destruir carpetas -capability.CloseFolders.title=Cerrar carpetas -capability.ReOpenFolders.title=Reabrir carpetas -capability.DeclareRecordsInClosedFolders.title=Completar documentos de archivo en carpetas cerradas - -# Vital Records -capability.group.vitalRecords.title=Documentos de archivo vitales -capability.UpdateVitalRecordCycleInformation.title=Actualizar informaci\u00f3n de ciclo de documentos de archivo vitales -capability.CycleVitalRecords.title=Documentos de archivo vitales de ciclo -capability.PlanningReviewCycles.title=Planificaci\u00f3n de ciclos de revisi\u00f3n - -# References and Links -capability.group.references.title=Referencias -capability.ChangeOrDeleteReferences.title=Cambiar o eliminar referencias - -# Events -capability.group.events.title=Eventos -capability.CreateModifyDestroyEvents.title=Crear Modificar Destruir eventos -capability.AddModifyEventDates.title=Agregar o modificar fechas de eventos - -# Cutoff -capability.group.cutoff.title=Interrumpir -capability.ApproveRecordsScheduledForCutoff.title=Aprobar documentos de archivo planificados para interrupci\u00f3n -capability.CreateModifyRecordsInCutoffFolders.title=Crear o modificar documentos de archivo en carpetas de interrupci\u00f3n - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Retenci\u00f3n y transferencias -capability.UpdateTriggerDates.title=Actualizar fechas de ejecuci\u00f3n -capability.ManuallyChangeDispositionDates.title=Cambiar las fechas de retenci\u00f3n manualmente -capability.AuthorizeNominatedTransfers.title=Autorizar transferencias nominadas -capability.AuthorizeAllTransfers.title=Autorizar todas las transferencias -capability.DestroyRecordsScheduledForDestruction.title=Destruir documento de archivo o carpeta de documentos de archivo planificada para destrucci\u00f3n -capability.DestroyRecords.title=Destruir documentos de archivo -capability.DeleteRecords.title=Eliminar documentos de archivo -capability.TriggerAnEvent.title=Ejecutar un evento -capability.FileDestructionReport.title=Archivar informe de destrucci\u00f3n -capability.FileTransferReport.title=Archivar informe de transferencia -capability.EndRetention.title=Terminar retenci\u00f3n - -# Hold Controls -capability.group.holdControls.title=Bloquear controles -capability.ExtendRetentionPeriodOrFreeze.title=Extender periodo de retenci\u00f3n o congelar -capability.Unfreeze.title=Descongelar -capability.ViewUpdateReasonsForFreeze.title=Ver razones actualizadas de congelaci\u00f3n -capability.CreateHold.title=Crear bloqueo -capability.AddToHold.title=A\u00f1adir a bloqueo -capability.RemoveFromHold.title=Eliminar de bloqueo -capability.FileHoldReport.title=Archivar informe de bloqueo -capability.DeleteHold.title=Eliminar bloqueo -capability.EditHold.title=Editar bloqueo - -# Audit -capability.group.audit.title=Auditor\u00eda -capability.DeclareAuditAsRecord.title=Declarar auditor\u00eda como documento de archivo -capability.EnableDisableAuditByTypes.title=Activar o desactivar auditor\u00eda por tipos -capability.DeleteAudit.title=Eliminar auditor\u00eda -capability.SelectAuditMetadata.title=Seleccionar metadatos de auditor\u00eda -capability.AccessAudit.title=Acceder a auditor\u00eda -capability.ExportAudit.title=Exportar auditor\u00eda - -# Security -capability.group.security.title=Seguridad -capability.CreateModifyDestroyRoles.title=Crear Modificar Destruir roles -capability.CreateModifyDestroyUsersAndGroups.title=Crear Modificar Destruir usuarios y grupos -capability.PasswordControl.title=Control de contrase\u00f1a -capability.DisplayRightsReport.title=Informe de derechos de presentaci\u00f3n -capability.ManageAccessControls.title=Asignaci\u00f3n de rol de usuario y grupo -capability.ManageAccessRights.title=Administrar permisos - -# Configuration -capability.group.config.title=Configuraci\u00f3n -capability.CreateModifyDestroyFileplanMetadata.title=Crear Modificar Destruir metadatos de plan de ficheros -capability.CreateModifyDestroyFileplanTypes.title=Crear Modificar Destruir tipos de plan de ficheros -capability.CreateModifyDestroyRecordTypes.title=Crear Modificar Destruir tipos de documento de archivo -capability.CreateAndAssociateSelectionLists.title=Crear y asociar listas de selecci\u00f3n -capability.EditSelectionLists.title=Editar listas de selecci\u00f3n -capability.CreateModifyDestroyReferenceTypes.title=Crear Modificar Destruir tipos de referencia -capability.AttachRulesToMetadataProperties.title=Vincular reglas a las propiedades de metadatos -capability.MakeOptionalParametersMandatory.title=Establecer como obligatorios los par\u00e1metros opcionales -capability.MapEmailMetadata.title=Asignar metadatos de correo electr\u00f3nico - -# Rules -capability.group.rules.title=Reglas +# Records +capability.group.records.title=Documentos de archivo +capability.DeclareRecords.title=Documentos de archivo completo +capability.ViewRecords.title=Ver documentos de archivo +capability.UndeclareRecords.title=Reabrir documentos de archivo +capability.CreateRecords.title=Crear documentos de archivo +capability.RequestRecordInformation.title=Solicitar informaci\u00f3n sobre documento de archivo +capability.RejectRecords.title=Rechazar documentos de archivo +capability.FileUnfiledRecords.title=Archivar documentos de archivo no archivados +capability.LinkToRecords.title=Enlazar documentos de archivo +capability.DeleteLinks.title=Desvincular documentos de archivo + +# Metadata Control +capability.group.metadataControl.title=Control de metadatos +capability.EditRecordMetadata.title=Editar metadatos de documento de archivo +capability.EditDeclaredRecordMetadata.title=Editar metadatos de documento de archivo completados +capability.EditNonRecordMetadata.title=Editar metadatos que no son de documentos de archivo +capability.MoveRecords.title=Mover documentos de archivo + +# Folder Control +capability.group.folderControl.title=Control de carpetas +capability.CreateModifyDestroyFolders.title=Crear Modificar Destruir carpetas +capability.CloseFolders.title=Cerrar carpetas +capability.ReOpenFolders.title=Reabrir carpetas +capability.DeclareRecordsInClosedFolders.title=Completar documentos de archivo en carpetas cerradas + +# Vital Records +capability.group.vitalRecords.title=Documentos de archivo vitales +capability.UpdateVitalRecordCycleInformation.title=Actualizar informaci\u00f3n de ciclo de documentos de archivo vitales +capability.CycleVitalRecords.title=Documentos de archivo vitales de ciclo +capability.PlanningReviewCycles.title=Planificaci\u00f3n de ciclos de revisi\u00f3n + +# References and Links +capability.group.references.title=Referencias +capability.ChangeOrDeleteReferences.title=Cambiar o eliminar referencias + +# Events +capability.group.events.title=Eventos +capability.CreateModifyDestroyEvents.title=Crear Modificar Destruir eventos +capability.AddModifyEventDates.title=Agregar o modificar fechas de eventos + +# Cutoff +capability.group.cutoff.title=Interrumpir +capability.ApproveRecordsScheduledForCutoff.title=Aprobar documentos de archivo planificados para interrupci\u00f3n +capability.CreateModifyRecordsInCutoffFolders.title=Crear o modificar documentos de archivo en carpetas de interrupci\u00f3n + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=Retenci\u00f3n y transferencias +capability.UpdateTriggerDates.title=Actualizar fechas de ejecuci\u00f3n +capability.ManuallyChangeDispositionDates.title=Cambiar las fechas de retenci\u00f3n manualmente +capability.AuthorizeNominatedTransfers.title=Autorizar transferencias nominadas +capability.AuthorizeAllTransfers.title=Autorizar todas las transferencias +capability.DestroyRecordsScheduledForDestruction.title=Destruir documento de archivo o carpeta de documentos de archivo planificada para destrucci\u00f3n +capability.DestroyRecords.title=Destruir documentos de archivo +capability.DeleteRecords.title=Eliminar documentos de archivo +capability.TriggerAnEvent.title=Ejecutar un evento +capability.FileDestructionReport.title=Archivar informe de destrucci\u00f3n +capability.FileTransferReport.title=Archivar informe de transferencia +capability.EndRetention.title=Terminar retenci\u00f3n + +# Hold Controls +capability.group.holdControls.title=Bloquear controles +capability.ExtendRetentionPeriodOrFreeze.title=Extender periodo de retenci\u00f3n o congelar +capability.Unfreeze.title=Descongelar +capability.ViewUpdateReasonsForFreeze.title=Ver razones actualizadas de congelaci\u00f3n +capability.CreateHold.title=Crear bloqueo +capability.AddToHold.title=A\u00f1adir a bloqueo +capability.RemoveFromHold.title=Eliminar de bloqueo +capability.FileHoldReport.title=Archivar informe de bloqueo +capability.DeleteHold.title=Eliminar bloqueo +capability.EditHold.title=Editar bloqueo + +# Audit +capability.group.audit.title=Auditor\u00eda +capability.DeclareAuditAsRecord.title=Declarar auditor\u00eda como documento de archivo +capability.EnableDisableAuditByTypes.title=Activar o desactivar auditor\u00eda por tipos +capability.DeleteAudit.title=Eliminar auditor\u00eda +capability.SelectAuditMetadata.title=Seleccionar metadatos de auditor\u00eda +capability.AccessAudit.title=Acceder a auditor\u00eda +capability.ExportAudit.title=Exportar auditor\u00eda + +# Security +capability.group.security.title=Seguridad +capability.CreateModifyDestroyRoles.title=Crear Modificar Destruir roles +capability.CreateModifyDestroyUsersAndGroups.title=Crear Modificar Destruir usuarios y grupos +capability.PasswordControl.title=Control de contrase\u00f1a +capability.DisplayRightsReport.title=Informe de derechos de presentaci\u00f3n +capability.ManageAccessControls.title=Asignaci\u00f3n de rol de usuario y grupo +capability.ManageAccessRights.title=Administrar permisos + +# Configuration +capability.group.config.title=Configuraci\u00f3n +capability.CreateModifyDestroyFileplanMetadata.title=Crear Modificar Destruir metadatos de plan de ficheros +capability.CreateModifyDestroyFileplanTypes.title=Crear Modificar Destruir tipos de plan de ficheros +capability.CreateModifyDestroyRecordTypes.title=Crear Modificar Destruir tipos de documento de archivo +capability.CreateAndAssociateSelectionLists.title=Crear y asociar listas de selecci\u00f3n +capability.EditSelectionLists.title=Editar listas de selecci\u00f3n +capability.CreateModifyDestroyReferenceTypes.title=Crear Modificar Destruir tipos de referencia +capability.AttachRulesToMetadataProperties.title=Vincular reglas a las propiedades de metadatos +capability.MakeOptionalParametersMandatory.title=Establecer como obligatorios los par\u00e1metros opcionales +capability.MapEmailMetadata.title=Asignar metadatos de correo electr\u00f3nico + +# Rules +capability.group.rules.title=Reglas capability.ManageRules.title=Gestionar reglas \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties index 3f43a35ae8..4c35992d83 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=Documents d'archives -capability.DeclareRecords.title=Compl\u00e9ter des documents d'archives -capability.ViewRecords.title=Afficher des documents d'archives -capability.UndeclareRecords.title=Rouvrir des documents d'archives -capability.CreateRecords.title=Cr\u00e9er des documents d'archives -capability.RequestRecordInformation.title=Demander des informations sur un document d'archives -capability.RejectRecords.title=Rejeter des documents d'archives -capability.FileUnfiledRecords.title=Classer des documents d'archives non class\u00e9s -capability.LinkToRecords.title=Lier des documents d'archives -capability.DeleteLinks.title=Supprimer le lien des enregistrements - -# Metadata Control -capability.group.metadataControl.title=Contr\u00f4le des m\u00e9tadonn\u00e9es -capability.EditRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document d'archives -capability.EditDeclaredRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document d'archives compl\u00e9t\u00e9 -capability.EditNonRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document qui n'est pas un document d'archives -capability.MoveRecords.title=D\u00e9placer des documents d'archives - -# Folder Control -capability.group.folderControl.title=Contr\u00f4le de dossiers -capability.CreateModifyDestroyFolders.title=Cr\u00e9er Modifier D\u00e9truire Dossiers -capability.CloseFolders.title=Fermer des dossiers -capability.ReOpenFolders.title=Rouvrir des dossiers -capability.DeclareRecordsInClosedFolders.title=Compl\u00e9ter des documents d'archives dans des dossiers ferm\u00e9s - -# Vital Records -capability.group.vitalRecords.title=Documents d'archives essentiels -capability.UpdateVitalRecordCycleInformation.title=Actualiser les informations concernant le cycle des documents d'archives essentiels -capability.CycleVitalRecords.title=Cycle des documents d'archives essentiels -capability.PlanningReviewCycles.title=Planifier les cycles de r\u00e9vision - -# References and Links -capability.group.references.title=R\u00e9f\u00e9rences -capability.ChangeOrDeleteReferences.title=Modifier ou supprimer des r\u00e9f\u00e9rences - -# Events -capability.group.events.title=Ev\u00e9nements -capability.CreateModifyDestroyEvents.title=Cr\u00e9er Modifier D\u00e9truire Ev\u00e9nements -capability.AddModifyEventDates.title=Ajouter Modifier Dates d'\u00e9v\u00e9nements - -# Cutoff -capability.group.cutoff.title=D\u00e9classer -capability.ApproveRecordsScheduledForCutoff.title=Approuver les documents d'archives planifi\u00e9s pour un d\u00e9classement -capability.CreateModifyRecordsInCutoffFolders.title=Cr\u00e9er Modifier des documents d'archives dans des dossiers d\u00e9class\u00e9s - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=R\u00e9tention et transferts -capability.UpdateTriggerDates.title=Actualiser les dates de d\u00e9clenchement -capability.ManuallyChangeDispositionDates.title=Modifier manuellement les dates de r\u00e9tention -capability.AuthorizeNominatedTransfers.title=Autoriser les transferts nominatifs -capability.AuthorizeAllTransfers.title=Autoriser tous les transferts -capability.DestroyRecordsScheduledForDestruction.title=D\u00e9truire un document ou un dossier d'archives dont la destruction est planifi\u00e9e -capability.DestroyRecords.title=D\u00e9truire des documents d'archives -capability.DeleteRecords.title=Supprimer des documents d'archives -capability.TriggerAnEvent.title=D\u00e9clencher un \u00e9v\u00e9nement -capability.FileDestructionReport.title=Rapport de destruction de fichier -capability.FileTransferReport.title=Rapport de transfert de fichier -capability.EndRetention.title=Mettre fin \u00e0 la r\u00e9tention - -# Hold Controls -capability.group.holdControls.title=Suspendre les contr\u00f4les -capability.ExtendRetentionPeriodOrFreeze.title=Prolonger la p\u00e9riode de r\u00e9tention ou le gel -capability.Unfreeze.title=D\u00e9geler -capability.ViewUpdateReasonsForFreeze.title=Voir les motifs d'actualisation d'un gel -capability.CreateHold.title=Cr\u00e9er une suspension -capability.AddToHold.title=Ajouter \u00e0 la suspension -capability.RemoveFromHold.title=Supprimer de la suspension -capability.FileHoldReport.title=Archiver le rapport de suspension -capability.DeleteHold.title=Supprimer la suspension -capability.EditHold.title=Modifier la suspension - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=D\u00e9clarer l'audit en tant que document d'archives -capability.EnableDisableAuditByTypes.title=Activer D\u00e9sactiver l'audit par types -capability.DeleteAudit.title=Supprimer un audit -capability.SelectAuditMetadata.title=S\u00e9lectionner les m\u00e9tadonn\u00e9es d'un audit -capability.AccessAudit.title=Acc\u00e9der \u00e0 un audit -capability.ExportAudit.title=Exporter l'audit - -# Security -capability.group.security.title=S\u00e9curit\u00e9 -capability.CreateModifyDestroyRoles.title=Cr\u00e9er Modifier D\u00e9truire des r\u00f4les -capability.CreateModifyDestroyUsersAndGroups.title=Cr\u00e9er Modifier D\u00e9truire des utilisateurs et des groupes -capability.PasswordControl.title=Contr\u00f4le des mots de passe -capability.DisplayRightsReport.title=Afficher le rapport sur les droits -capability.ManageAccessControls.title=Affectation de r\u00f4les aux groupes et utilisateurs -capability.ManageAccessRights.title=G\u00e9rer les permissions - -# Configuration -capability.group.config.title=Configuration -capability.CreateModifyDestroyFileplanMetadata.title=Cr\u00e9er Modifier D\u00e9truire des m\u00e9tadonn\u00e9es de plan de classification -capability.CreateModifyDestroyFileplanTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de plan de classification -capability.CreateModifyDestroyRecordTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de document d'archives -capability.CreateAndAssociateSelectionLists.title=Cr\u00e9er et associer des listes de s\u00e9lections -capability.EditSelectionLists.title=Modifier des listes de s\u00e9lections -capability.CreateModifyDestroyReferenceTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de r\u00e9f\u00e9rence -capability.AttachRulesToMetadataProperties.title=Attacher des r\u00e8gles aux propri\u00e9t\u00e9s des m\u00e9tadonn\u00e9es -capability.MakeOptionalParametersMandatory.title=Rendre obligatoires des param\u00e8tres facultatifs -capability.MapEmailMetadata.title=Mapper des m\u00e9tadonn\u00e9es d'e-mail - -# Rules -capability.group.rules.title=R\u00e8gles +# Records +capability.group.records.title=Documents d'archives +capability.DeclareRecords.title=Compl\u00e9ter des documents d'archives +capability.ViewRecords.title=Afficher des documents d'archives +capability.UndeclareRecords.title=Rouvrir des documents d'archives +capability.CreateRecords.title=Cr\u00e9er des documents d'archives +capability.RequestRecordInformation.title=Demander des informations sur un document d'archives +capability.RejectRecords.title=Rejeter des documents d'archives +capability.FileUnfiledRecords.title=Classer des documents d'archives non class\u00e9s +capability.LinkToRecords.title=Lier des documents d'archives +capability.DeleteLinks.title=Supprimer le lien des enregistrements + +# Metadata Control +capability.group.metadataControl.title=Contr\u00f4le des m\u00e9tadonn\u00e9es +capability.EditRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document d'archives +capability.EditDeclaredRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document d'archives compl\u00e9t\u00e9 +capability.EditNonRecordMetadata.title=Modifier les m\u00e9tadonn\u00e9es d'un document qui n'est pas un document d'archives +capability.MoveRecords.title=D\u00e9placer des documents d'archives + +# Folder Control +capability.group.folderControl.title=Contr\u00f4le de dossiers +capability.CreateModifyDestroyFolders.title=Cr\u00e9er Modifier D\u00e9truire Dossiers +capability.CloseFolders.title=Fermer des dossiers +capability.ReOpenFolders.title=Rouvrir des dossiers +capability.DeclareRecordsInClosedFolders.title=Compl\u00e9ter des documents d'archives dans des dossiers ferm\u00e9s + +# Vital Records +capability.group.vitalRecords.title=Documents d'archives essentiels +capability.UpdateVitalRecordCycleInformation.title=Actualiser les informations concernant le cycle des documents d'archives essentiels +capability.CycleVitalRecords.title=Cycle des documents d'archives essentiels +capability.PlanningReviewCycles.title=Planifier les cycles de r\u00e9vision + +# References and Links +capability.group.references.title=R\u00e9f\u00e9rences +capability.ChangeOrDeleteReferences.title=Modifier ou supprimer des r\u00e9f\u00e9rences + +# Events +capability.group.events.title=Ev\u00e9nements +capability.CreateModifyDestroyEvents.title=Cr\u00e9er Modifier D\u00e9truire Ev\u00e9nements +capability.AddModifyEventDates.title=Ajouter Modifier Dates d'\u00e9v\u00e9nements + +# Cutoff +capability.group.cutoff.title=D\u00e9classer +capability.ApproveRecordsScheduledForCutoff.title=Approuver les documents d'archives planifi\u00e9s pour un d\u00e9classement +capability.CreateModifyRecordsInCutoffFolders.title=Cr\u00e9er Modifier des documents d'archives dans des dossiers d\u00e9class\u00e9s + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=R\u00e9tention et transferts +capability.UpdateTriggerDates.title=Actualiser les dates de d\u00e9clenchement +capability.ManuallyChangeDispositionDates.title=Modifier manuellement les dates de r\u00e9tention +capability.AuthorizeNominatedTransfers.title=Autoriser les transferts nominatifs +capability.AuthorizeAllTransfers.title=Autoriser tous les transferts +capability.DestroyRecordsScheduledForDestruction.title=D\u00e9truire un document ou un dossier d'archives dont la destruction est planifi\u00e9e +capability.DestroyRecords.title=D\u00e9truire des documents d'archives +capability.DeleteRecords.title=Supprimer des documents d'archives +capability.TriggerAnEvent.title=D\u00e9clencher un \u00e9v\u00e9nement +capability.FileDestructionReport.title=Rapport de destruction de fichier +capability.FileTransferReport.title=Rapport de transfert de fichier +capability.EndRetention.title=Mettre fin \u00e0 la r\u00e9tention + +# Hold Controls +capability.group.holdControls.title=Suspendre les contr\u00f4les +capability.ExtendRetentionPeriodOrFreeze.title=Prolonger la p\u00e9riode de r\u00e9tention ou le gel +capability.Unfreeze.title=D\u00e9geler +capability.ViewUpdateReasonsForFreeze.title=Voir les motifs d'actualisation d'un gel +capability.CreateHold.title=Cr\u00e9er une suspension +capability.AddToHold.title=Ajouter \u00e0 la suspension +capability.RemoveFromHold.title=Supprimer de la suspension +capability.FileHoldReport.title=Archiver le rapport de suspension +capability.DeleteHold.title=Supprimer la suspension +capability.EditHold.title=Modifier la suspension + +# Audit +capability.group.audit.title=Audit +capability.DeclareAuditAsRecord.title=D\u00e9clarer l'audit en tant que document d'archives +capability.EnableDisableAuditByTypes.title=Activer D\u00e9sactiver l'audit par types +capability.DeleteAudit.title=Supprimer un audit +capability.SelectAuditMetadata.title=S\u00e9lectionner les m\u00e9tadonn\u00e9es d'un audit +capability.AccessAudit.title=Acc\u00e9der \u00e0 un audit +capability.ExportAudit.title=Exporter l'audit + +# Security +capability.group.security.title=S\u00e9curit\u00e9 +capability.CreateModifyDestroyRoles.title=Cr\u00e9er Modifier D\u00e9truire des r\u00f4les +capability.CreateModifyDestroyUsersAndGroups.title=Cr\u00e9er Modifier D\u00e9truire des utilisateurs et des groupes +capability.PasswordControl.title=Contr\u00f4le des mots de passe +capability.DisplayRightsReport.title=Afficher le rapport sur les droits +capability.ManageAccessControls.title=Affectation de r\u00f4les aux groupes et utilisateurs +capability.ManageAccessRights.title=G\u00e9rer les permissions + +# Configuration +capability.group.config.title=Configuration +capability.CreateModifyDestroyFileplanMetadata.title=Cr\u00e9er Modifier D\u00e9truire des m\u00e9tadonn\u00e9es de plan de classification +capability.CreateModifyDestroyFileplanTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de plan de classification +capability.CreateModifyDestroyRecordTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de document d'archives +capability.CreateAndAssociateSelectionLists.title=Cr\u00e9er et associer des listes de s\u00e9lections +capability.EditSelectionLists.title=Modifier des listes de s\u00e9lections +capability.CreateModifyDestroyReferenceTypes.title=Cr\u00e9er Modifier D\u00e9truire des types de r\u00e9f\u00e9rence +capability.AttachRulesToMetadataProperties.title=Attacher des r\u00e8gles aux propri\u00e9t\u00e9s des m\u00e9tadonn\u00e9es +capability.MakeOptionalParametersMandatory.title=Rendre obligatoires des param\u00e8tres facultatifs +capability.MapEmailMetadata.title=Mapper des m\u00e9tadonn\u00e9es d'e-mail + +# Rules +capability.group.rules.title=R\u00e8gles capability.ManageRules.title=G\u00e9rer les r\u00e8gles \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties index dd3d6c7571..725dc6f8ac 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=Record -capability.DeclareRecords.title=Completa record -capability.ViewRecords.title=Visualizza record -capability.UndeclareRecords.title=Riapri record -capability.CreateRecords.title=Crea record -capability.RequestRecordInformation.title=Richiedi informazioni record -capability.RejectRecords.title=Respingi record -capability.FileUnfiledRecords.title=Archivia record non archiviati -capability.LinkToRecords.title=Collega record -capability.DeleteLinks.title=Scollega record - -# Metadata Control -capability.group.metadataControl.title=Controllo metadati -capability.EditRecordMetadata.title=Modifica metadati del record -capability.EditDeclaredRecordMetadata.title=Modifica metadati del record completati -capability.EditNonRecordMetadata.title=Modifica metadati del non record -capability.MoveRecords.title=Sposta record - -# Folder Control -capability.group.folderControl.title=Controllo cartelle -capability.CreateModifyDestroyFolders.title=Crea Modifica Elimina definitivamente cartelle -capability.CloseFolders.title=Chiudi cartelle -capability.ReOpenFolders.title=Riapri cartelle -capability.DeclareRecordsInClosedFolders.title=Completa record nelle cartelle chiuse - -# Vital Records -capability.group.vitalRecords.title=Record fondamentali -capability.UpdateVitalRecordCycleInformation.title=Aggiorna informazioni ciclo di record fondamentale -capability.CycleVitalRecords.title=Record fondamentali del ciclo -capability.PlanningReviewCycles.title=Programma cicli di esame - -# References and Links -capability.group.references.title=Riferimenti -capability.ChangeOrDeleteReferences.title=Cambia o elimina riferimenti - -# Events -capability.group.events.title=Eventi -capability.CreateModifyDestroyEvents.title=Crea Modifica Elimina definitivamente eventi -capability.AddModifyEventDates.title=Aggiungi Modifica date eventi - -# Cutoff -capability.group.cutoff.title=Cut off -capability.ApproveRecordsScheduledForCutoff.title=Approva record programmati per il cut off -capability.CreateModifyRecordsInCutoffFolders.title=Crea Modifica record nelle cartelle di cut off - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Conservazione e trasferimenti -capability.UpdateTriggerDates.title=Aggiorna date di attivazione -capability.ManuallyChangeDispositionDates.title=Cambia manualmente le date di conservazione -capability.AuthorizeNominatedTransfers.title=Autorizza trasferimenti nominati -capability.AuthorizeAllTransfers.title=Autorizza tutti i trasferimenti -capability.DestroyRecordsScheduledForDestruction.title=Elimina definitivamente record o cartella di record programmati per l'eliminazione definitiva -capability.DestroyRecords.title=Elimina definitivamente record -capability.DeleteRecords.title=Elimina record -capability.TriggerAnEvent.title=Attiva un evento -capability.FileDestructionReport.title=Archivia rapporto di eliminazione definitiva -capability.FileTransferReport.title=Archivia rapporto di trasferimento -capability.EndRetention.title=Termina conservazione - -# Hold Controls -capability.group.holdControls.title=Sospendi controlli -capability.ExtendRetentionPeriodOrFreeze.title=Estendi periodo di conservazione o blocca -capability.Unfreeze.title=Sblocca -capability.ViewUpdateReasonsForFreeze.title=Visualizza Aggiorna motivi blocco -capability.CreateHold.title=Crea sospensione -capability.AddToHold.title=Aggiungi a sospesi -capability.RemoveFromHold.title=Rimuovi da sospesi -capability.FileHoldReport.title=Archivia rapporto di sospensione -capability.DeleteHold.title=Annulla sospensione -capability.EditHold.title=Modifica sospensione - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=Dichiara audit come record -capability.EnableDisableAuditByTypes.title=Abilita Disabilita audit per tipo -capability.DeleteAudit.title=Elimina audit -capability.SelectAuditMetadata.title=Seleziona metadati di audit -capability.AccessAudit.title=Accedi audit -capability.ExportAudit.title=Esporta audit - -# Security -capability.group.security.title=Sicurezza -capability.CreateModifyDestroyRoles.title=Crea Modifica Elimina definitivamente ruoli -capability.CreateModifyDestroyUsersAndGroups.title=Crea Modifica Elimina definitivamente utenti e gruppi -capability.PasswordControl.title=Controllo password -capability.DisplayRightsReport.title=Mostra rapporto diritti -capability.ManageAccessControls.title=Assegnazione gruppo e ruolo utente -capability.ManageAccessRights.title=Gestisci permessi - -# Configuration -capability.group.config.title=Configurazione -capability.CreateModifyDestroyFileplanMetadata.title=Crea Modifica Elimina definitivamente metadati di piano file -capability.CreateModifyDestroyFileplanTypes.title=Crea Modifica Elimina definitivamente tipi di piano file -capability.CreateModifyDestroyRecordTypes.title=Crea Modifica Elimina definitivamente tipi di record -capability.CreateAndAssociateSelectionLists.title=Crea e associa elenchi di selezione -capability.EditSelectionLists.title=Modifica elenchi di selezione -capability.CreateModifyDestroyReferenceTypes.title=Crea Modifica Elimina definitivamente tipi di riferimento -capability.AttachRulesToMetadataProperties.title=Allega regole a propriet\u00e0 di metadati -capability.MakeOptionalParametersMandatory.title=Rendi obbligatori i parametri opzionali -capability.MapEmailMetadata.title=Esegui il mapping dei metadati di e-mail - -# Rules -capability.group.rules.title=Regole +# Records +capability.group.records.title=Record +capability.DeclareRecords.title=Completa record +capability.ViewRecords.title=Visualizza record +capability.UndeclareRecords.title=Riapri record +capability.CreateRecords.title=Crea record +capability.RequestRecordInformation.title=Richiedi informazioni record +capability.RejectRecords.title=Respingi record +capability.FileUnfiledRecords.title=Archivia record non archiviati +capability.LinkToRecords.title=Collega record +capability.DeleteLinks.title=Scollega record + +# Metadata Control +capability.group.metadataControl.title=Controllo metadati +capability.EditRecordMetadata.title=Modifica metadati del record +capability.EditDeclaredRecordMetadata.title=Modifica metadati del record completati +capability.EditNonRecordMetadata.title=Modifica metadati del non record +capability.MoveRecords.title=Sposta record + +# Folder Control +capability.group.folderControl.title=Controllo cartelle +capability.CreateModifyDestroyFolders.title=Crea Modifica Elimina definitivamente cartelle +capability.CloseFolders.title=Chiudi cartelle +capability.ReOpenFolders.title=Riapri cartelle +capability.DeclareRecordsInClosedFolders.title=Completa record nelle cartelle chiuse + +# Vital Records +capability.group.vitalRecords.title=Record fondamentali +capability.UpdateVitalRecordCycleInformation.title=Aggiorna informazioni ciclo di record fondamentale +capability.CycleVitalRecords.title=Record fondamentali del ciclo +capability.PlanningReviewCycles.title=Programma cicli di esame + +# References and Links +capability.group.references.title=Riferimenti +capability.ChangeOrDeleteReferences.title=Cambia o elimina riferimenti + +# Events +capability.group.events.title=Eventi +capability.CreateModifyDestroyEvents.title=Crea Modifica Elimina definitivamente eventi +capability.AddModifyEventDates.title=Aggiungi Modifica date eventi + +# Cutoff +capability.group.cutoff.title=Cut off +capability.ApproveRecordsScheduledForCutoff.title=Approva record programmati per il cut off +capability.CreateModifyRecordsInCutoffFolders.title=Crea Modifica record nelle cartelle di cut off + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=Conservazione e trasferimenti +capability.UpdateTriggerDates.title=Aggiorna date di attivazione +capability.ManuallyChangeDispositionDates.title=Cambia manualmente le date di conservazione +capability.AuthorizeNominatedTransfers.title=Autorizza trasferimenti nominati +capability.AuthorizeAllTransfers.title=Autorizza tutti i trasferimenti +capability.DestroyRecordsScheduledForDestruction.title=Elimina definitivamente record o cartella di record programmati per l'eliminazione definitiva +capability.DestroyRecords.title=Elimina definitivamente record +capability.DeleteRecords.title=Elimina record +capability.TriggerAnEvent.title=Attiva un evento +capability.FileDestructionReport.title=Archivia rapporto di eliminazione definitiva +capability.FileTransferReport.title=Archivia rapporto di trasferimento +capability.EndRetention.title=Termina conservazione + +# Hold Controls +capability.group.holdControls.title=Sospendi controlli +capability.ExtendRetentionPeriodOrFreeze.title=Estendi periodo di conservazione o blocca +capability.Unfreeze.title=Sblocca +capability.ViewUpdateReasonsForFreeze.title=Visualizza Aggiorna motivi blocco +capability.CreateHold.title=Crea sospensione +capability.AddToHold.title=Aggiungi a sospesi +capability.RemoveFromHold.title=Rimuovi da sospesi +capability.FileHoldReport.title=Archivia rapporto di sospensione +capability.DeleteHold.title=Annulla sospensione +capability.EditHold.title=Modifica sospensione + +# Audit +capability.group.audit.title=Audit +capability.DeclareAuditAsRecord.title=Dichiara audit come record +capability.EnableDisableAuditByTypes.title=Abilita Disabilita audit per tipo +capability.DeleteAudit.title=Elimina audit +capability.SelectAuditMetadata.title=Seleziona metadati di audit +capability.AccessAudit.title=Accedi audit +capability.ExportAudit.title=Esporta audit + +# Security +capability.group.security.title=Sicurezza +capability.CreateModifyDestroyRoles.title=Crea Modifica Elimina definitivamente ruoli +capability.CreateModifyDestroyUsersAndGroups.title=Crea Modifica Elimina definitivamente utenti e gruppi +capability.PasswordControl.title=Controllo password +capability.DisplayRightsReport.title=Mostra rapporto diritti +capability.ManageAccessControls.title=Assegnazione gruppo e ruolo utente +capability.ManageAccessRights.title=Gestisci permessi + +# Configuration +capability.group.config.title=Configurazione +capability.CreateModifyDestroyFileplanMetadata.title=Crea Modifica Elimina definitivamente metadati di piano file +capability.CreateModifyDestroyFileplanTypes.title=Crea Modifica Elimina definitivamente tipi di piano file +capability.CreateModifyDestroyRecordTypes.title=Crea Modifica Elimina definitivamente tipi di record +capability.CreateAndAssociateSelectionLists.title=Crea e associa elenchi di selezione +capability.EditSelectionLists.title=Modifica elenchi di selezione +capability.CreateModifyDestroyReferenceTypes.title=Crea Modifica Elimina definitivamente tipi di riferimento +capability.AttachRulesToMetadataProperties.title=Allega regole a propriet\u00e0 di metadati +capability.MakeOptionalParametersMandatory.title=Rendi obbligatori i parametri opzionali +capability.MapEmailMetadata.title=Esegui il mapping dei metadati di e-mail + +# Rules +capability.group.rules.title=Regole capability.ManageRules.title=Gestisci regole \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties index bab3c4e28b..64392020e6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=\u30ec\u30b3\u30fc\u30c9 -capability.DeclareRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5b8c\u4e86 -capability.ViewRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u8868\u793a -capability.UndeclareRecords.title=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304f -capability.CreateRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u4f5c\u6210 -capability.RequestRecordInformation.title=\u30ec\u30b3\u30fc\u30c9\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8 -capability.RejectRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5374\u4e0b -capability.FileUnfiledRecords.title=\u672a\u6574\u7406\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1 -capability.LinkToRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u30ea\u30f3\u30af -capability.DeleteLinks.title=\u30ec\u30b3\u30fc\u30c9\u306e\u30ea\u30f3\u30af\u89e3\u9664 - -# Metadata Control -capability.group.metadataControl.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7ba1\u7406 -capability.EditRecordMetadata.title=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 -capability.EditDeclaredRecordMetadata.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 -capability.EditNonRecordMetadata.title=\u975e\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 -capability.MoveRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 - -# Folder Control -capability.group.folderControl.title=\u30d5\u30a9\u30eb\u30c0\u306e\u7ba1\u7406 -capability.CreateModifyDestroyFolders.title=\u30d5\u30a9\u30eb\u30c0\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CloseFolders.title=\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u308b -capability.ReOpenFolders.title=\u30d5\u30a9\u30eb\u30c0\u3092\u518d\u5ea6\u958b\u304f -capability.DeclareRecordsInClosedFolders.title=\u9589\u3058\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9 - -# Vital Records -capability.group.vitalRecords.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -capability.UpdateVitalRecordCycleInformation.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30b5\u30a4\u30af\u30eb\u60c5\u5831\u306e\u66f4\u65b0 -capability.CycleVitalRecords.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30b5\u30a4\u30af\u30eb -capability.PlanningReviewCycles.title=\u30ec\u30d3\u30e5\u30fc\u30b5\u30a4\u30af\u30eb\u306e\u30d7\u30e9\u30f3\u30cb\u30f3\u30b0 - -# References and Links -capability.group.references.title=\u53c2\u7167 -capability.ChangeOrDeleteReferences.title=\u53c2\u7167\u306e\u5909\u66f4\u307e\u305f\u306f\u524a\u9664 - -# Events -capability.group.events.title=\u30a4\u30d9\u30f3\u30c8 -capability.CreateModifyDestroyEvents.title=\u30a4\u30d9\u30f3\u30c8\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.AddModifyEventDates.title=\u30a4\u30d9\u30f3\u30c8\u306e\u65e5\u4ed8\u306e\u8ffd\u52a0/\u5909\u66f4 - -# Cutoff -capability.group.cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -capability.ApproveRecordsScheduledForCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u306e\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f\u30ec\u30b3\u30fc\u30c9\u306e\u627f\u8a8d -capability.CreateModifyRecordsInCutoffFolders.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u30d5\u30a9\u30eb\u30c0\u5185\u3067\u4fee\u6b63\u30ec\u30b3\u30fc\u30c9\u3092\u4f5c\u6210 - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=\u4fdd\u7ba1\u3068\u8ee2\u9001 -capability.UpdateTriggerDates.title=\u30c8\u30ea\u30ac\u30fc\u65e5\u306e\u66f4\u65b0 -capability.ManuallyChangeDispositionDates.title=\u4fdd\u7ba1\u65e5\u3092\u624b\u52d5\u3067\u5909\u66f4\u3059\u308b -capability.AuthorizeNominatedTransfers.title=\u7533\u8acb\u3055\u308c\u305f\u8ee2\u9001\u3092\u627f\u8a8d\u3059\u308b -capability.AuthorizeAllTransfers.title=\u3059\u3079\u3066\u306e\u8ee2\u9001\u3092\u627f\u8a8d\u3059\u308b -capability.DestroyRecordsScheduledForDestruction.title=\u7834\u68c4\u304c\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u7834\u68c4\u3059\u308b -capability.DestroyRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u7834\u68c4 -capability.DeleteRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u524a\u9664 -capability.TriggerAnEvent.title=\u30a4\u30d9\u30f3\u30c8\u306e\u30c8\u30ea\u30ac\u30fc -capability.FileDestructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -capability.FileTransferReport.title=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -capability.EndRetention.title=\u4fdd\u7ba1\u306e\u7d42\u4e86 - -# Hold Controls -capability.group.holdControls.title=\u30db\u30fc\u30eb\u30c9\u306e\u7ba1\u7406 -capability.ExtendRetentionPeriodOrFreeze.title=\u4fdd\u7ba1\u671f\u9593\u306e\u5ef6\u9577\u307e\u305f\u306f\u51cd\u7d50 -capability.Unfreeze.title=\u51cd\u7d50\u89e3\u9664 -capability.ViewUpdateReasonsForFreeze.title=\u51cd\u7d50\u306e\u66f4\u65b0\u7406\u7531\u3092\u8868\u793a -capability.CreateHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u4f5c\u6210 -capability.AddToHold.title=\u30db\u30fc\u30eb\u30c9\u306b\u8ffd\u52a0 -capability.RemoveFromHold.title=\u30db\u30fc\u30eb\u30c9\u304b\u3089\u524a\u9664 -capability.FileHoldReport.title=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -capability.DeleteHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 -capability.EditHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u7de8\u96c6 - -# Audit -capability.group.audit.title=\u76e3\u67fb -capability.DeclareAuditAsRecord.title=\u76e3\u67fb\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b -capability.EnableDisableAuditByTypes.title=\u76e3\u67fb\u3092\u30bf\u30a4\u30d7\u5225\u306b\u6709\u52b9\u5316/\u7121\u52b9\u5316\u3059\u308b -capability.DeleteAudit.title=\u76e3\u67fb\u306e\u524a\u9664 -capability.SelectAuditMetadata.title=\u76e3\u67fb\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u9078\u629e -capability.AccessAudit.title=\u76e3\u67fb\u306b\u30a2\u30af\u30bb\u30b9 -capability.ExportAudit.title=\u76e3\u67fb\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8 - -# Security -capability.group.security.title=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3 -capability.CreateModifyDestroyRoles.title=\u5f79\u5272\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CreateModifyDestroyUsersAndGroups.title=\u30e6\u30fc\u30b6\u30fc\u3068\u30b0\u30eb\u30fc\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.PasswordControl.title=\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u7ba1\u7406 -capability.DisplayRightsReport.title=\u6a29\u9650\u30ec\u30dd\u30fc\u30c8\u306e\u8868\u793a -capability.ManageAccessControls.title=\u30b0\u30eb\u30fc\u30d7\u3068\u30e6\u30fc\u30b6\u30fc\u306e\u5f79\u5272\u306e\u5272\u308a\u5f53\u3066 -capability.ManageAccessRights.title=\u6a29\u9650\u306e\u7ba1\u7406 - -# Configuration -capability.group.config.title=\u8a2d\u5b9a -capability.CreateModifyDestroyFileplanMetadata.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CreateModifyDestroyFileplanTypes.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CreateModifyDestroyRecordTypes.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.CreateAndAssociateSelectionLists.title=\u9078\u629e\u30ea\u30b9\u30c8\u306e\u4f5c\u6210\u3068\u95a2\u9023\u4ed8\u3051 -capability.EditSelectionLists.title=\u9078\u629e\u30ea\u30b9\u30c8\u306e\u7de8\u96c6 -capability.CreateModifyDestroyReferenceTypes.title=\u53c2\u7167\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 -capability.AttachRulesToMetadataProperties.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30eb\u30fc\u30eb\u3092\u9069\u7528 -capability.MakeOptionalParametersMandatory.title=\u30aa\u30d7\u30b7\u30e7\u30f3\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5fc5\u9808\u306b\u3059\u308b -capability.MapEmailMetadata.title=E \u30e1\u30fc\u30eb\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30c3\u30d4\u30f3\u30b0 - -# Rules -capability.group.rules.title=\u30eb\u30fc\u30eb +# Records +capability.group.records.title=\u30ec\u30b3\u30fc\u30c9 +capability.DeclareRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5b8c\u4e86 +capability.ViewRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u8868\u793a +capability.UndeclareRecords.title=\u30ec\u30b3\u30fc\u30c9\u3092\u518d\u5ea6\u958b\u304f +capability.CreateRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u4f5c\u6210 +capability.RequestRecordInformation.title=\u30ec\u30b3\u30fc\u30c9\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8 +capability.RejectRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5374\u4e0b +capability.FileUnfiledRecords.title=\u672a\u6574\u7406\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1 +capability.LinkToRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u30ea\u30f3\u30af +capability.DeleteLinks.title=\u30ec\u30b3\u30fc\u30c9\u306e\u30ea\u30f3\u30af\u89e3\u9664 + +# Metadata Control +capability.group.metadataControl.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7ba1\u7406 +capability.EditRecordMetadata.title=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 +capability.EditDeclaredRecordMetadata.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 +capability.EditNonRecordMetadata.title=\u975e\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u7de8\u96c6 +capability.MoveRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 + +# Folder Control +capability.group.folderControl.title=\u30d5\u30a9\u30eb\u30c0\u306e\u7ba1\u7406 +capability.CreateModifyDestroyFolders.title=\u30d5\u30a9\u30eb\u30c0\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.CloseFolders.title=\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u308b +capability.ReOpenFolders.title=\u30d5\u30a9\u30eb\u30c0\u3092\u518d\u5ea6\u958b\u304f +capability.DeclareRecordsInClosedFolders.title=\u9589\u3058\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9 + +# Vital Records +capability.group.vitalRecords.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 +capability.UpdateVitalRecordCycleInformation.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30b5\u30a4\u30af\u30eb\u60c5\u5831\u306e\u66f4\u65b0 +capability.CycleVitalRecords.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30b5\u30a4\u30af\u30eb +capability.PlanningReviewCycles.title=\u30ec\u30d3\u30e5\u30fc\u30b5\u30a4\u30af\u30eb\u306e\u30d7\u30e9\u30f3\u30cb\u30f3\u30b0 + +# References and Links +capability.group.references.title=\u53c2\u7167 +capability.ChangeOrDeleteReferences.title=\u53c2\u7167\u306e\u5909\u66f4\u307e\u305f\u306f\u524a\u9664 + +# Events +capability.group.events.title=\u30a4\u30d9\u30f3\u30c8 +capability.CreateModifyDestroyEvents.title=\u30a4\u30d9\u30f3\u30c8\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.AddModifyEventDates.title=\u30a4\u30d9\u30f3\u30c8\u306e\u65e5\u4ed8\u306e\u8ffd\u52a0/\u5909\u66f4 + +# Cutoff +capability.group.cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 +capability.ApproveRecordsScheduledForCutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u306e\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f\u30ec\u30b3\u30fc\u30c9\u306e\u627f\u8a8d +capability.CreateModifyRecordsInCutoffFolders.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u30d5\u30a9\u30eb\u30c0\u5185\u3067\u4fee\u6b63\u30ec\u30b3\u30fc\u30c9\u3092\u4f5c\u6210 + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=\u4fdd\u7ba1\u3068\u8ee2\u9001 +capability.UpdateTriggerDates.title=\u30c8\u30ea\u30ac\u30fc\u65e5\u306e\u66f4\u65b0 +capability.ManuallyChangeDispositionDates.title=\u4fdd\u7ba1\u65e5\u3092\u624b\u52d5\u3067\u5909\u66f4\u3059\u308b +capability.AuthorizeNominatedTransfers.title=\u7533\u8acb\u3055\u308c\u305f\u8ee2\u9001\u3092\u627f\u8a8d\u3059\u308b +capability.AuthorizeAllTransfers.title=\u3059\u3079\u3066\u306e\u8ee2\u9001\u3092\u627f\u8a8d\u3059\u308b +capability.DestroyRecordsScheduledForDestruction.title=\u7834\u68c4\u304c\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u307e\u305f\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u7834\u68c4\u3059\u308b +capability.DestroyRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u7834\u68c4 +capability.DeleteRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u524a\u9664 +capability.TriggerAnEvent.title=\u30a4\u30d9\u30f3\u30c8\u306e\u30c8\u30ea\u30ac\u30fc +capability.FileDestructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 +capability.FileTransferReport.title=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 +capability.EndRetention.title=\u4fdd\u7ba1\u306e\u7d42\u4e86 + +# Hold Controls +capability.group.holdControls.title=\u30db\u30fc\u30eb\u30c9\u306e\u7ba1\u7406 +capability.ExtendRetentionPeriodOrFreeze.title=\u4fdd\u7ba1\u671f\u9593\u306e\u5ef6\u9577\u307e\u305f\u306f\u51cd\u7d50 +capability.Unfreeze.title=\u51cd\u7d50\u89e3\u9664 +capability.ViewUpdateReasonsForFreeze.title=\u51cd\u7d50\u306e\u66f4\u65b0\u7406\u7531\u3092\u8868\u793a +capability.CreateHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u4f5c\u6210 +capability.AddToHold.title=\u30db\u30fc\u30eb\u30c9\u306b\u8ffd\u52a0 +capability.RemoveFromHold.title=\u30db\u30fc\u30eb\u30c9\u304b\u3089\u524a\u9664 +capability.FileHoldReport.title=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 +capability.DeleteHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 +capability.EditHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u7de8\u96c6 + +# Audit +capability.group.audit.title=\u76e3\u67fb +capability.DeclareAuditAsRecord.title=\u76e3\u67fb\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b +capability.EnableDisableAuditByTypes.title=\u76e3\u67fb\u3092\u30bf\u30a4\u30d7\u5225\u306b\u6709\u52b9\u5316/\u7121\u52b9\u5316\u3059\u308b +capability.DeleteAudit.title=\u76e3\u67fb\u306e\u524a\u9664 +capability.SelectAuditMetadata.title=\u76e3\u67fb\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u9078\u629e +capability.AccessAudit.title=\u76e3\u67fb\u306b\u30a2\u30af\u30bb\u30b9 +capability.ExportAudit.title=\u76e3\u67fb\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8 + +# Security +capability.group.security.title=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3 +capability.CreateModifyDestroyRoles.title=\u5f79\u5272\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.CreateModifyDestroyUsersAndGroups.title=\u30e6\u30fc\u30b6\u30fc\u3068\u30b0\u30eb\u30fc\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.PasswordControl.title=\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u7ba1\u7406 +capability.DisplayRightsReport.title=\u6a29\u9650\u30ec\u30dd\u30fc\u30c8\u306e\u8868\u793a +capability.ManageAccessControls.title=\u30b0\u30eb\u30fc\u30d7\u3068\u30e6\u30fc\u30b6\u30fc\u306e\u5f79\u5272\u306e\u5272\u308a\u5f53\u3066 +capability.ManageAccessRights.title=\u6a29\u9650\u306e\u7ba1\u7406 + +# Configuration +capability.group.config.title=\u8a2d\u5b9a +capability.CreateModifyDestroyFileplanMetadata.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.CreateModifyDestroyFileplanTypes.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.CreateModifyDestroyRecordTypes.title=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.CreateAndAssociateSelectionLists.title=\u9078\u629e\u30ea\u30b9\u30c8\u306e\u4f5c\u6210\u3068\u95a2\u9023\u4ed8\u3051 +capability.EditSelectionLists.title=\u9078\u629e\u30ea\u30b9\u30c8\u306e\u7de8\u96c6 +capability.CreateModifyDestroyReferenceTypes.title=\u53c2\u7167\u30bf\u30a4\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 +capability.AttachRulesToMetadataProperties.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30eb\u30fc\u30eb\u3092\u9069\u7528 +capability.MakeOptionalParametersMandatory.title=\u30aa\u30d7\u30b7\u30e7\u30f3\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5fc5\u9808\u306b\u3059\u308b +capability.MapEmailMetadata.title=E \u30e1\u30fc\u30eb\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30c3\u30d4\u30f3\u30b0 + +# Rules +capability.group.rules.title=\u30eb\u30fc\u30eb capability.ManageRules.title=\u30eb\u30fc\u30eb\u306e\u7ba1\u7406 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties index 80a4b1df24..8a8248b59b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=Oppf\u00f8ringer -capability.DeclareRecords.title=Fullf\u00f8r oppf\u00f8ringer -capability.ViewRecords.title=Vis oppf\u00f8ringer -capability.UndeclareRecords.title=\u00c5pne oppf\u00f8ringer p\u00e5 nytt -capability.CreateRecords.title=Opprett oppf\u00f8ringer -capability.RequestRecordInformation.title=Be om oppf\u00f8ringsinformasjon -capability.RejectRecords.title=Avvis oppf\u00f8ringer -capability.FileUnfiledRecords.title=Registrer oppf\u00f8ringer som ikke er registrert -capability.LinkToRecords.title=Koble oppf\u00f8ringer -capability.DeleteLinks.title=Koble fra oppf\u00f8ringer - -# Metadata Control -capability.group.metadataControl.title=Metadatakontroll -capability.EditRecordMetadata.title=Rediger registrering av metadata -capability.EditDeclaredRecordMetadata.title=Rediger fullf\u00f8rte registrerte metadata -capability.EditNonRecordMetadata.title=Rediger metadata som ikke er registrert -capability.MoveRecords.title=Flytt oppf\u00f8ringer - -# Folder Control -capability.group.folderControl.title=Mappekontroll -capability.CreateModifyDestroyFolders.title=Opprett Endre Destruer mapper -capability.CloseFolders.title=Lukk mapper -capability.ReOpenFolders.title=\u00c5pne mapper p\u00e5 nytt -capability.DeclareRecordsInClosedFolders.title=Fullf\u00f8r oppf\u00f8ringer i lukkede mapper - -# Vital Records -capability.group.vitalRecords.title=Sv\u00e6t viktige oppf\u00f8ringer -capability.UpdateVitalRecordCycleInformation.title=Oppdater syklusinformasjon til de sv\u00e6rt viktige oppf\u00f8ringene -capability.CycleVitalRecords.title=Sirkuler sv\u00e6rt viktige oppf\u00f8ringer -capability.PlanningReviewCycles.title=Planlegge gjennomgangsykluser - -# References and Links -capability.group.references.title=Referanser -capability.ChangeOrDeleteReferences.title=Endre eller slett referanser - -# Events -capability.group.events.title=Hendelser -capability.CreateModifyDestroyEvents.title=Opprett Endre Destruer hendelser -capability.AddModifyEventDates.title=Legg til Endre hendelsesdatoer - -# Cutoff -capability.group.cutoff.title=Cut off -capability.ApproveRecordsScheduledForCutoff.title=Godkjenn oppf\u00f8ringer der planen er cut off -capability.CreateModifyRecordsInCutoffFolders.title=Opprett Endre oppf\u00f8ringer i cut off-mapper - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Forfall og overf\u00f8ringer -capability.UpdateTriggerDates.title=Oppdater utl\u00f8serdatoer -capability.ManuallyChangeDispositionDates.title=Endre forfallsdatoer manuelt -capability.AuthorizeNominatedTransfers.title=Godkjenn nominerte overf\u00f8ringer -capability.AuthorizeAllTransfers.title=Godkjenn alle overf\u00f8ringer -capability.DestroyRecordsScheduledForDestruction.title=Destruer oppf\u00f8ring eller oppf\u00f8ringsmappe der planen er \u00e5 destruere den -capability.DestroyRecords.title=Destruer oppf\u00f8ringer -capability.DeleteRecords.title=Slett oppf\u00f8ringer -capability.TriggerAnEvent.title=Utl\u00f8s en hendelse -capability.FileDestructionReport.title=Fildestruksjonsrapport -capability.FileTransferReport.title=Filoverf\u00f8ringsrapport -capability.EndRetention.title=Avslutt retensjon - -# Hold Controls -capability.group.holdControls.title=Hold kontroller -capability.ExtendRetentionPeriodOrFreeze.title=Forleng oppbevaringstiden eller frys -capability.Unfreeze.title=T\u00f8 opp -capability.ViewUpdateReasonsForFreeze.title=Vis oppdatering av \u00e5rsaker til \u00e5 fryse -capability.CreateHold.title=Opprett hold -capability.AddToHold.title=Legg til hold -capability.RemoveFromHold.title=Fjern fra hold -capability.FileHoldReport.title=Filholdrapport -capability.DeleteHold.title=Slett hold -capability.EditHold.title=Rediger hold - -# Audit -capability.group.audit.title=Revisjon -capability.DeclareAuditAsRecord.title=Erkl\u00e6r revisjon som oppf\u00f8ring -capability.EnableDisableAuditByTypes.title=Aktiver/Deaktiver revisjon etter typer -capability.DeleteAudit.title=Slett revisjon -capability.SelectAuditMetadata.title=Velg revisjon av metadata -capability.AccessAudit.title=G\u00e5 til revisjon -capability.ExportAudit.title=Eksporter revisjon - -# Security -capability.group.security.title=Sikkerhet -capability.CreateModifyDestroyRoles.title=Opprett Endre Destruer roller -capability.CreateModifyDestroyUsersAndGroups.title=Opprett Endre Destruer brukere og grupper -capability.PasswordControl.title=Passordkontroll -capability.DisplayRightsReport.title=Vis rettighetsrapport -capability.ManageAccessControls.title=Gruppe- og brukerrolletildeling -capability.ManageAccessRights.title=Administrer tillatelser - -# Configuration -capability.group.config.title=Konfigurasjon -capability.CreateModifyDestroyFileplanMetadata.title=Opprett Endre Destruer filplanmetadata -capability.CreateModifyDestroyFileplanTypes.title=Opprett Endre Destruer filplantyper -capability.CreateModifyDestroyRecordTypes.title=Opprett Endre Destruer oppf\u00f8ringstyper -capability.CreateAndAssociateSelectionLists.title=Opprett og koble valglister -capability.EditSelectionLists.title=Rediger valglister -capability.CreateModifyDestroyReferenceTypes.title=Opprett Endre Destruer referansetyper -capability.AttachRulesToMetadataProperties.title=Legg ved regler til metadataegenskaper -capability.MakeOptionalParametersMandatory.title=P\u00e5legg valgfrie parametere -capability.MapEmailMetadata.title=Koble e-postmetadata - -# Rules -capability.group.rules.title=Regler +# Records +capability.group.records.title=Oppf\u00f8ringer +capability.DeclareRecords.title=Fullf\u00f8r oppf\u00f8ringer +capability.ViewRecords.title=Vis oppf\u00f8ringer +capability.UndeclareRecords.title=\u00c5pne oppf\u00f8ringer p\u00e5 nytt +capability.CreateRecords.title=Opprett oppf\u00f8ringer +capability.RequestRecordInformation.title=Be om oppf\u00f8ringsinformasjon +capability.RejectRecords.title=Avvis oppf\u00f8ringer +capability.FileUnfiledRecords.title=Registrer oppf\u00f8ringer som ikke er registrert +capability.LinkToRecords.title=Koble oppf\u00f8ringer +capability.DeleteLinks.title=Koble fra oppf\u00f8ringer + +# Metadata Control +capability.group.metadataControl.title=Metadatakontroll +capability.EditRecordMetadata.title=Rediger registrering av metadata +capability.EditDeclaredRecordMetadata.title=Rediger fullf\u00f8rte registrerte metadata +capability.EditNonRecordMetadata.title=Rediger metadata som ikke er registrert +capability.MoveRecords.title=Flytt oppf\u00f8ringer + +# Folder Control +capability.group.folderControl.title=Mappekontroll +capability.CreateModifyDestroyFolders.title=Opprett Endre Destruer mapper +capability.CloseFolders.title=Lukk mapper +capability.ReOpenFolders.title=\u00c5pne mapper p\u00e5 nytt +capability.DeclareRecordsInClosedFolders.title=Fullf\u00f8r oppf\u00f8ringer i lukkede mapper + +# Vital Records +capability.group.vitalRecords.title=Sv\u00e6t viktige oppf\u00f8ringer +capability.UpdateVitalRecordCycleInformation.title=Oppdater syklusinformasjon til de sv\u00e6rt viktige oppf\u00f8ringene +capability.CycleVitalRecords.title=Sirkuler sv\u00e6rt viktige oppf\u00f8ringer +capability.PlanningReviewCycles.title=Planlegge gjennomgangsykluser + +# References and Links +capability.group.references.title=Referanser +capability.ChangeOrDeleteReferences.title=Endre eller slett referanser + +# Events +capability.group.events.title=Hendelser +capability.CreateModifyDestroyEvents.title=Opprett Endre Destruer hendelser +capability.AddModifyEventDates.title=Legg til Endre hendelsesdatoer + +# Cutoff +capability.group.cutoff.title=Cut off +capability.ApproveRecordsScheduledForCutoff.title=Godkjenn oppf\u00f8ringer der planen er cut off +capability.CreateModifyRecordsInCutoffFolders.title=Opprett Endre oppf\u00f8ringer i cut off-mapper + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=Forfall og overf\u00f8ringer +capability.UpdateTriggerDates.title=Oppdater utl\u00f8serdatoer +capability.ManuallyChangeDispositionDates.title=Endre forfallsdatoer manuelt +capability.AuthorizeNominatedTransfers.title=Godkjenn nominerte overf\u00f8ringer +capability.AuthorizeAllTransfers.title=Godkjenn alle overf\u00f8ringer +capability.DestroyRecordsScheduledForDestruction.title=Destruer oppf\u00f8ring eller oppf\u00f8ringsmappe der planen er \u00e5 destruere den +capability.DestroyRecords.title=Destruer oppf\u00f8ringer +capability.DeleteRecords.title=Slett oppf\u00f8ringer +capability.TriggerAnEvent.title=Utl\u00f8s en hendelse +capability.FileDestructionReport.title=Fildestruksjonsrapport +capability.FileTransferReport.title=Filoverf\u00f8ringsrapport +capability.EndRetention.title=Avslutt retensjon + +# Hold Controls +capability.group.holdControls.title=Hold kontroller +capability.ExtendRetentionPeriodOrFreeze.title=Forleng oppbevaringstiden eller frys +capability.Unfreeze.title=T\u00f8 opp +capability.ViewUpdateReasonsForFreeze.title=Vis oppdatering av \u00e5rsaker til \u00e5 fryse +capability.CreateHold.title=Opprett hold +capability.AddToHold.title=Legg til hold +capability.RemoveFromHold.title=Fjern fra hold +capability.FileHoldReport.title=Filholdrapport +capability.DeleteHold.title=Slett hold +capability.EditHold.title=Rediger hold + +# Audit +capability.group.audit.title=Revisjon +capability.DeclareAuditAsRecord.title=Erkl\u00e6r revisjon som oppf\u00f8ring +capability.EnableDisableAuditByTypes.title=Aktiver/Deaktiver revisjon etter typer +capability.DeleteAudit.title=Slett revisjon +capability.SelectAuditMetadata.title=Velg revisjon av metadata +capability.AccessAudit.title=G\u00e5 til revisjon +capability.ExportAudit.title=Eksporter revisjon + +# Security +capability.group.security.title=Sikkerhet +capability.CreateModifyDestroyRoles.title=Opprett Endre Destruer roller +capability.CreateModifyDestroyUsersAndGroups.title=Opprett Endre Destruer brukere og grupper +capability.PasswordControl.title=Passordkontroll +capability.DisplayRightsReport.title=Vis rettighetsrapport +capability.ManageAccessControls.title=Gruppe- og brukerrolletildeling +capability.ManageAccessRights.title=Administrer tillatelser + +# Configuration +capability.group.config.title=Konfigurasjon +capability.CreateModifyDestroyFileplanMetadata.title=Opprett Endre Destruer filplanmetadata +capability.CreateModifyDestroyFileplanTypes.title=Opprett Endre Destruer filplantyper +capability.CreateModifyDestroyRecordTypes.title=Opprett Endre Destruer oppf\u00f8ringstyper +capability.CreateAndAssociateSelectionLists.title=Opprett og koble valglister +capability.EditSelectionLists.title=Rediger valglister +capability.CreateModifyDestroyReferenceTypes.title=Opprett Endre Destruer referansetyper +capability.AttachRulesToMetadataProperties.title=Legg ved regler til metadataegenskaper +capability.MakeOptionalParametersMandatory.title=P\u00e5legg valgfrie parametere +capability.MapEmailMetadata.title=Koble e-postmetadata + +# Rules +capability.group.rules.title=Regler capability.ManageRules.title=Administrer regler \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties index 74fb230576..5d73c044e1 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=Records -capability.DeclareRecords.title=Records afronden -capability.ViewRecords.title=Records bekijken -capability.UndeclareRecords.title=Records heropenen -capability.CreateRecords.title=Records maken -capability.RequestRecordInformation.title=Recordgegevens opvragen -capability.RejectRecords.title=Records afwijzen -capability.FileUnfiledRecords.title=Niet gearchiveerde records archiveren -capability.LinkToRecords.title=Records koppelen -capability.DeleteLinks.title=Recordkoppeling opheffen - -# Metadata Control -capability.group.metadataControl.title=Metagegevensbeheer -capability.EditRecordMetadata.title=Metagegevens van record bewerken -capability.EditDeclaredRecordMetadata.title=Metagegevens van afgeronde record bewerken -capability.EditNonRecordMetadata.title=Metagegevens zonder record bewerken -capability.MoveRecords.title=Records verplaatsen - -# Folder Control -capability.group.folderControl.title=Mapbeheer -capability.CreateModifyDestroyFolders.title=Mappen maken aanpassen vernietigen -capability.CloseFolders.title=Mappen sluiten -capability.ReOpenFolders.title=Mappen heropenen -capability.DeclareRecordsInClosedFolders.title=Records in gesloten mappen afronden - -# Vital Records -capability.group.vitalRecords.title=Vitale records -capability.UpdateVitalRecordCycleInformation.title=Cyclusgegevens van vitale record bijwerken -capability.CycleVitalRecords.title=Cyclus vitale records -capability.PlanningReviewCycles.title=Planning revisiecycli - -# References and Links -capability.group.references.title=Verwijzingen -capability.ChangeOrDeleteReferences.title=Verwijzingen veranderen of verwijderen - -# Events -capability.group.events.title=Gebeurtenissen -capability.CreateModifyDestroyEvents.title=Gebeurtenissen maken aanpassen vernietigen -capability.AddModifyEventDates.title=Datums van gebeurtenis wijzigen toevoegen - -# Cutoff -capability.group.cutoff.title=Afsluiten -capability.ApproveRecordsScheduledForCutoff.title=Records goedkeuren die zijn ingepland voor afsluiten -capability.CreateModifyRecordsInCutoffFolders.title=Veranderingsrecords in afsluitmappen maken - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Retentie en overzettingen -capability.UpdateTriggerDates.title=Triggerdatums bijwerken -capability.ManuallyChangeDispositionDates.title=Retentiedatums handmatig wijzigen -capability.AuthorizeNominatedTransfers.title=Genomineerde overzettingen autoriseren -capability.AuthorizeAllTransfers.title=Alle overzettingen autoriseren -capability.DestroyRecordsScheduledForDestruction.title=Record of archiefmap vernietigen die is ingepland voor vernietiging -capability.DestroyRecords.title=Records vernietigen -capability.DeleteRecords.title=Records verwijderen -capability.TriggerAnEvent.title=Een gebeurtenis triggeren -capability.FileDestructionReport.title=Vernietigingsrapport archiveren -capability.FileTransferReport.title=Overzetrapport archiveren -capability.EndRetention.title=Retentie be\u00ebindigen - -# Hold Controls -capability.group.holdControls.title=Wachtstandbeheer -capability.ExtendRetentionPeriodOrFreeze.title=Retentieperiode of bevriezen verlengen -capability.Unfreeze.title=Bevriezen opheffen -capability.ViewUpdateReasonsForFreeze.title=Redenen voor bevriezen bijwerken bekijken -capability.CreateHold.title=Wachtstand maken -capability.AddToHold.title=Toevoegen aan wachtstand -capability.RemoveFromHold.title=Verwijderen uit wachtstand -capability.FileHoldReport.title=Wachtstandrapport archiveren -capability.DeleteHold.title=Wachtstand verwijderen -capability.EditHold.title=Wachtstand bewerken - -# Audit -capability.group.audit.title=Audit -capability.DeclareAuditAsRecord.title=Audit declareren als record -capability.EnableDisableAuditByTypes.title=Audit op type uitschakelen inschakelen -capability.DeleteAudit.title=Audit verwijderen -capability.SelectAuditMetadata.title=Metagegevens van audit selecteren -capability.AccessAudit.title=Audit openen -capability.ExportAudit.title=Audit exporteren - -# Security -capability.group.security.title=Beveiliging -capability.CreateModifyDestroyRoles.title=Rollen maken aanpassen vernietigen -capability.CreateModifyDestroyUsersAndGroups.title=Gebruikers en groepen maken aanpassen vernietigen -capability.PasswordControl.title=Wachtwoordbeheer -capability.DisplayRightsReport.title=Rechtenrapport weergeven -capability.ManageAccessControls.title=Groeps- en gebruikersroltoewijzing -capability.ManageAccessRights.title=Rechten beheren - -# Configuration -capability.group.config.title=Configuratie -capability.CreateModifyDestroyFileplanMetadata.title=Metagegevens voor ordeningsplan maken aanpassen vernietigen -capability.CreateModifyDestroyFileplanTypes.title=Ordeningsplantypes maken aanpassen vernietigen -capability.CreateModifyDestroyRecordTypes.title=Recordtypes maken aanpassen vernietigen -capability.CreateAndAssociateSelectionLists.title=Selectielijsten maken en toewijzen -capability.EditSelectionLists.title=Selectielijsten bewerken -capability.CreateModifyDestroyReferenceTypes.title=Verwijzingstypes maken aanpassen vernietigen -capability.AttachRulesToMetadataProperties.title=Regels aan metagegevenseigenschappen koppelen -capability.MakeOptionalParametersMandatory.title=Optionele parameters verplicht maken -capability.MapEmailMetadata.title=Metagegevens e-mail toewijzen - -# Rules -capability.group.rules.title=Regels +# Records +capability.group.records.title=Records +capability.DeclareRecords.title=Records afronden +capability.ViewRecords.title=Records bekijken +capability.UndeclareRecords.title=Records heropenen +capability.CreateRecords.title=Records maken +capability.RequestRecordInformation.title=Recordgegevens opvragen +capability.RejectRecords.title=Records afwijzen +capability.FileUnfiledRecords.title=Niet gearchiveerde records archiveren +capability.LinkToRecords.title=Records koppelen +capability.DeleteLinks.title=Recordkoppeling opheffen + +# Metadata Control +capability.group.metadataControl.title=Metagegevensbeheer +capability.EditRecordMetadata.title=Metagegevens van record bewerken +capability.EditDeclaredRecordMetadata.title=Metagegevens van afgeronde record bewerken +capability.EditNonRecordMetadata.title=Metagegevens zonder record bewerken +capability.MoveRecords.title=Records verplaatsen + +# Folder Control +capability.group.folderControl.title=Mapbeheer +capability.CreateModifyDestroyFolders.title=Mappen maken aanpassen vernietigen +capability.CloseFolders.title=Mappen sluiten +capability.ReOpenFolders.title=Mappen heropenen +capability.DeclareRecordsInClosedFolders.title=Records in gesloten mappen afronden + +# Vital Records +capability.group.vitalRecords.title=Vitale records +capability.UpdateVitalRecordCycleInformation.title=Cyclusgegevens van vitale record bijwerken +capability.CycleVitalRecords.title=Cyclus vitale records +capability.PlanningReviewCycles.title=Planning revisiecycli + +# References and Links +capability.group.references.title=Verwijzingen +capability.ChangeOrDeleteReferences.title=Verwijzingen veranderen of verwijderen + +# Events +capability.group.events.title=Gebeurtenissen +capability.CreateModifyDestroyEvents.title=Gebeurtenissen maken aanpassen vernietigen +capability.AddModifyEventDates.title=Datums van gebeurtenis wijzigen toevoegen + +# Cutoff +capability.group.cutoff.title=Afsluiten +capability.ApproveRecordsScheduledForCutoff.title=Records goedkeuren die zijn ingepland voor afsluiten +capability.CreateModifyRecordsInCutoffFolders.title=Veranderingsrecords in afsluitmappen maken + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=Retentie en overzettingen +capability.UpdateTriggerDates.title=Triggerdatums bijwerken +capability.ManuallyChangeDispositionDates.title=Retentiedatums handmatig wijzigen +capability.AuthorizeNominatedTransfers.title=Genomineerde overzettingen autoriseren +capability.AuthorizeAllTransfers.title=Alle overzettingen autoriseren +capability.DestroyRecordsScheduledForDestruction.title=Record of archiefmap vernietigen die is ingepland voor vernietiging +capability.DestroyRecords.title=Records vernietigen +capability.DeleteRecords.title=Records verwijderen +capability.TriggerAnEvent.title=Een gebeurtenis triggeren +capability.FileDestructionReport.title=Vernietigingsrapport archiveren +capability.FileTransferReport.title=Overzetrapport archiveren +capability.EndRetention.title=Retentie be\u00ebindigen + +# Hold Controls +capability.group.holdControls.title=Wachtstandbeheer +capability.ExtendRetentionPeriodOrFreeze.title=Retentieperiode of bevriezen verlengen +capability.Unfreeze.title=Bevriezen opheffen +capability.ViewUpdateReasonsForFreeze.title=Redenen voor bevriezen bijwerken bekijken +capability.CreateHold.title=Wachtstand maken +capability.AddToHold.title=Toevoegen aan wachtstand +capability.RemoveFromHold.title=Verwijderen uit wachtstand +capability.FileHoldReport.title=Wachtstandrapport archiveren +capability.DeleteHold.title=Wachtstand verwijderen +capability.EditHold.title=Wachtstand bewerken + +# Audit +capability.group.audit.title=Audit +capability.DeclareAuditAsRecord.title=Audit declareren als record +capability.EnableDisableAuditByTypes.title=Audit op type uitschakelen inschakelen +capability.DeleteAudit.title=Audit verwijderen +capability.SelectAuditMetadata.title=Metagegevens van audit selecteren +capability.AccessAudit.title=Audit openen +capability.ExportAudit.title=Audit exporteren + +# Security +capability.group.security.title=Beveiliging +capability.CreateModifyDestroyRoles.title=Rollen maken aanpassen vernietigen +capability.CreateModifyDestroyUsersAndGroups.title=Gebruikers en groepen maken aanpassen vernietigen +capability.PasswordControl.title=Wachtwoordbeheer +capability.DisplayRightsReport.title=Rechtenrapport weergeven +capability.ManageAccessControls.title=Groeps- en gebruikersroltoewijzing +capability.ManageAccessRights.title=Rechten beheren + +# Configuration +capability.group.config.title=Configuratie +capability.CreateModifyDestroyFileplanMetadata.title=Metagegevens voor ordeningsplan maken aanpassen vernietigen +capability.CreateModifyDestroyFileplanTypes.title=Ordeningsplantypes maken aanpassen vernietigen +capability.CreateModifyDestroyRecordTypes.title=Recordtypes maken aanpassen vernietigen +capability.CreateAndAssociateSelectionLists.title=Selectielijsten maken en toewijzen +capability.EditSelectionLists.title=Selectielijsten bewerken +capability.CreateModifyDestroyReferenceTypes.title=Verwijzingstypes maken aanpassen vernietigen +capability.AttachRulesToMetadataProperties.title=Regels aan metagegevenseigenschappen koppelen +capability.MakeOptionalParametersMandatory.title=Optionele parameters verplicht maken +capability.MapEmailMetadata.title=Metagegevens e-mail toewijzen + +# Rules +capability.group.rules.title=Regels capability.ManageRules.title=Regels beheren \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties index 3a9ddb9151..73f87b8668 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=Documentos arquiv\u00edsticos -capability.DeclareRecords.title=Concluir documentos arquiv\u00edsticos -capability.ViewRecords.title=Visualizar documentos arquiv\u00edsticos -capability.UndeclareRecords.title=Reabrir documentos arquiv\u00edsticos -capability.CreateRecords.title=Criar documentos arquiv\u00edsticos -capability.RequestRecordInformation.title=Solicitar informa\u00e7\u00f5es de documentos arquiv\u00edsticos -capability.RejectRecords.title=Rejeitar documentos arquiv\u00edsticos -capability.FileUnfiledRecords.title=Arquivar documentos arquiv\u00edsticos n\u00e3o arquivados -capability.LinkToRecords.title=Vincular documentos arquiv\u00edsticos -capability.DeleteLinks.title=Anular v\u00ednculo dos documentos arquiv\u00edsticos - -# Metadata Control -capability.group.metadataControl.title=Controle de metadados -capability.EditRecordMetadata.title=Editar metadados de documentos arquiv\u00edsticos -capability.EditDeclaredRecordMetadata.title=Editar metadados de documentos arquiv\u00edsticos conclu\u00eddos -capability.EditNonRecordMetadata.title=Editar metadados n\u00e3o de documento arquiv\u00edstico -capability.MoveRecords.title=Mover documentos arquiv\u00edsticos - -# Folder Control -capability.group.folderControl.title=Controle de pasta -capability.CreateModifyDestroyFolders.title=Criar Modificar Destruir pastas -capability.CloseFolders.title=Fechar pastas -capability.ReOpenFolders.title=Reabrir pastas -capability.DeclareRecordsInClosedFolders.title=Concluir documentos arquiv\u00edsticos em pastas fechadas - -# Vital Records -capability.group.vitalRecords.title=Documentos arquiv\u00edsticos vitais -capability.UpdateVitalRecordCycleInformation.title=Atualizar informa\u00e7\u00f5es do ciclo de documentos arquiv\u00edsticos vitais -capability.CycleVitalRecords.title=Executar ciclo de documentos arquiv\u00edsticos vitais -capability.PlanningReviewCycles.title=Ciclos de revis\u00e3o de planejamento - -# References and Links -capability.group.references.title=Refer\u00eancias -capability.ChangeOrDeleteReferences.title=Alterar ou excluir refer\u00eancias - -# Events -capability.group.events.title=Eventos -capability.CreateModifyDestroyEvents.title=Criar Modificar Destruir eventos -capability.AddModifyEventDates.title=Adicionar Modificar datas de eventos - -# Cutoff -capability.group.cutoff.title=Cortar -capability.ApproveRecordsScheduledForCutoff.title=Aprovar documentos arquiv\u00edsticos programados para corte -capability.CreateModifyRecordsInCutoffFolders.title=Criar Modificar documentos arquiv\u00edsticos em pastas de corte - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Reten\u00e7\u00e3o e transfer\u00eancias -capability.UpdateTriggerDates.title=Atualizar datas de disparo -capability.ManuallyChangeDispositionDates.title=Alterar datas de reten\u00e7\u00e3o manualmente -capability.AuthorizeNominatedTransfers.title=Autorizar transfer\u00eancias nomeadas -capability.AuthorizeAllTransfers.title=Autorizar todas as transfer\u00eancias -capability.DestroyRecordsScheduledForDestruction.title=Destruir documento arquiv\u00edstico ou pasta de documento arquiv\u00edstico programado para destrui\u00e7\u00e3o -capability.DestroyRecords.title=Destruir documentos arquiv\u00edsticos -capability.DeleteRecords.title=Excluir documentos arquiv\u00edsticos -capability.TriggerAnEvent.title=Disparar um evento -capability.FileDestructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos -capability.FileTransferReport.title=Relat\u00f3rio de transfer\u00eancia de arquivos -capability.EndRetention.title=Encerrar reten\u00e7\u00e3o - -# Hold Controls -capability.group.holdControls.title=Controles de espera -capability.ExtendRetentionPeriodOrFreeze.title=Estender per\u00edodo de reten\u00e7\u00e3o ou congelar -capability.Unfreeze.title=Descongelar -capability.ViewUpdateReasonsForFreeze.title=Visualizar motivos de atualiza\u00e7\u00e3o para congelar -capability.CreateHold.title=Criar espera -capability.AddToHold.title=Adicionar \u00e0 espera -capability.RemoveFromHold.title=Remover da espera -capability.FileHoldReport.title=Arquivar relat\u00f3rio de espera -capability.DeleteHold.title=Excluir espera -capability.EditHold.title=Editar espera - -# Audit -capability.group.audit.title=Auditoria -capability.DeclareAuditAsRecord.title=Declarar auditoria como documento arquiv\u00edstico -capability.EnableDisableAuditByTypes.title=Ativar Desativar auditoria por tipos -capability.DeleteAudit.title=Excluir auditoria -capability.SelectAuditMetadata.title=Selecionar metadados de auditoria -capability.AccessAudit.title=Acessar auditoria -capability.ExportAudit.title=Exportar auditoria - -# Security -capability.group.security.title=Seguran\u00e7a -capability.CreateModifyDestroyRoles.title=Criar Modificar Destruir fun\u00e7\u00f5es -capability.CreateModifyDestroyUsersAndGroups.title=Criar Modificar Destruir usu\u00e1rios e grupos -capability.PasswordControl.title=Controle de senha -capability.DisplayRightsReport.title=Exibir relat\u00f3rio de direitos -capability.ManageAccessControls.title=Grupo e atribui\u00e7\u00e3o de cargo do usu\u00e1rio -capability.ManageAccessRights.title=Gerenciar permiss\u00f5es - -# Configuration -capability.group.config.title=Configura\u00e7\u00e3o -capability.CreateModifyDestroyFileplanMetadata.title=Criar Modificar Destruir metadados de planos de arquivo -capability.CreateModifyDestroyFileplanTypes.title=Criar Modificar Destruir tipos de planos de arquivo -capability.CreateModifyDestroyRecordTypes.title=Criar Modificar Destruir tipos de documentos arquiv\u00edsticos -capability.CreateAndAssociateSelectionLists.title=Criar e Associar listas de sele\u00e7\u00e3o -capability.EditSelectionLists.title=Editar listas de sele\u00e7\u00e3o -capability.CreateModifyDestroyReferenceTypes.title=Criar Modificar Destruir tipos de refer\u00eancia -capability.AttachRulesToMetadataProperties.title=Anexar regras a propriedades de metadados -capability.MakeOptionalParametersMandatory.title=Tornar par\u00e2metros opcionais obrigat\u00f3rios -capability.MapEmailMetadata.title=Mapear metadados de e-mail - -# Rules -capability.group.rules.title=Regras +# Records +capability.group.records.title=Documentos arquiv\u00edsticos +capability.DeclareRecords.title=Concluir documentos arquiv\u00edsticos +capability.ViewRecords.title=Visualizar documentos arquiv\u00edsticos +capability.UndeclareRecords.title=Reabrir documentos arquiv\u00edsticos +capability.CreateRecords.title=Criar documentos arquiv\u00edsticos +capability.RequestRecordInformation.title=Solicitar informa\u00e7\u00f5es de documentos arquiv\u00edsticos +capability.RejectRecords.title=Rejeitar documentos arquiv\u00edsticos +capability.FileUnfiledRecords.title=Arquivar documentos arquiv\u00edsticos n\u00e3o arquivados +capability.LinkToRecords.title=Vincular documentos arquiv\u00edsticos +capability.DeleteLinks.title=Anular v\u00ednculo dos documentos arquiv\u00edsticos + +# Metadata Control +capability.group.metadataControl.title=Controle de metadados +capability.EditRecordMetadata.title=Editar metadados de documentos arquiv\u00edsticos +capability.EditDeclaredRecordMetadata.title=Editar metadados de documentos arquiv\u00edsticos conclu\u00eddos +capability.EditNonRecordMetadata.title=Editar metadados n\u00e3o de documento arquiv\u00edstico +capability.MoveRecords.title=Mover documentos arquiv\u00edsticos + +# Folder Control +capability.group.folderControl.title=Controle de pasta +capability.CreateModifyDestroyFolders.title=Criar Modificar Destruir pastas +capability.CloseFolders.title=Fechar pastas +capability.ReOpenFolders.title=Reabrir pastas +capability.DeclareRecordsInClosedFolders.title=Concluir documentos arquiv\u00edsticos em pastas fechadas + +# Vital Records +capability.group.vitalRecords.title=Documentos arquiv\u00edsticos vitais +capability.UpdateVitalRecordCycleInformation.title=Atualizar informa\u00e7\u00f5es do ciclo de documentos arquiv\u00edsticos vitais +capability.CycleVitalRecords.title=Executar ciclo de documentos arquiv\u00edsticos vitais +capability.PlanningReviewCycles.title=Ciclos de revis\u00e3o de planejamento + +# References and Links +capability.group.references.title=Refer\u00eancias +capability.ChangeOrDeleteReferences.title=Alterar ou excluir refer\u00eancias + +# Events +capability.group.events.title=Eventos +capability.CreateModifyDestroyEvents.title=Criar Modificar Destruir eventos +capability.AddModifyEventDates.title=Adicionar Modificar datas de eventos + +# Cutoff +capability.group.cutoff.title=Cortar +capability.ApproveRecordsScheduledForCutoff.title=Aprovar documentos arquiv\u00edsticos programados para corte +capability.CreateModifyRecordsInCutoffFolders.title=Criar Modificar documentos arquiv\u00edsticos em pastas de corte + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=Reten\u00e7\u00e3o e transfer\u00eancias +capability.UpdateTriggerDates.title=Atualizar datas de disparo +capability.ManuallyChangeDispositionDates.title=Alterar datas de reten\u00e7\u00e3o manualmente +capability.AuthorizeNominatedTransfers.title=Autorizar transfer\u00eancias nomeadas +capability.AuthorizeAllTransfers.title=Autorizar todas as transfer\u00eancias +capability.DestroyRecordsScheduledForDestruction.title=Destruir documento arquiv\u00edstico ou pasta de documento arquiv\u00edstico programado para destrui\u00e7\u00e3o +capability.DestroyRecords.title=Destruir documentos arquiv\u00edsticos +capability.DeleteRecords.title=Excluir documentos arquiv\u00edsticos +capability.TriggerAnEvent.title=Disparar um evento +capability.FileDestructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos +capability.FileTransferReport.title=Relat\u00f3rio de transfer\u00eancia de arquivos +capability.EndRetention.title=Encerrar reten\u00e7\u00e3o + +# Hold Controls +capability.group.holdControls.title=Controles de espera +capability.ExtendRetentionPeriodOrFreeze.title=Estender per\u00edodo de reten\u00e7\u00e3o ou congelar +capability.Unfreeze.title=Descongelar +capability.ViewUpdateReasonsForFreeze.title=Visualizar motivos de atualiza\u00e7\u00e3o para congelar +capability.CreateHold.title=Criar espera +capability.AddToHold.title=Adicionar \u00e0 espera +capability.RemoveFromHold.title=Remover da espera +capability.FileHoldReport.title=Arquivar relat\u00f3rio de espera +capability.DeleteHold.title=Excluir espera +capability.EditHold.title=Editar espera + +# Audit +capability.group.audit.title=Auditoria +capability.DeclareAuditAsRecord.title=Declarar auditoria como documento arquiv\u00edstico +capability.EnableDisableAuditByTypes.title=Ativar Desativar auditoria por tipos +capability.DeleteAudit.title=Excluir auditoria +capability.SelectAuditMetadata.title=Selecionar metadados de auditoria +capability.AccessAudit.title=Acessar auditoria +capability.ExportAudit.title=Exportar auditoria + +# Security +capability.group.security.title=Seguran\u00e7a +capability.CreateModifyDestroyRoles.title=Criar Modificar Destruir fun\u00e7\u00f5es +capability.CreateModifyDestroyUsersAndGroups.title=Criar Modificar Destruir usu\u00e1rios e grupos +capability.PasswordControl.title=Controle de senha +capability.DisplayRightsReport.title=Exibir relat\u00f3rio de direitos +capability.ManageAccessControls.title=Grupo e atribui\u00e7\u00e3o de cargo do usu\u00e1rio +capability.ManageAccessRights.title=Gerenciar permiss\u00f5es + +# Configuration +capability.group.config.title=Configura\u00e7\u00e3o +capability.CreateModifyDestroyFileplanMetadata.title=Criar Modificar Destruir metadados de planos de arquivo +capability.CreateModifyDestroyFileplanTypes.title=Criar Modificar Destruir tipos de planos de arquivo +capability.CreateModifyDestroyRecordTypes.title=Criar Modificar Destruir tipos de documentos arquiv\u00edsticos +capability.CreateAndAssociateSelectionLists.title=Criar e Associar listas de sele\u00e7\u00e3o +capability.EditSelectionLists.title=Editar listas de sele\u00e7\u00e3o +capability.CreateModifyDestroyReferenceTypes.title=Criar Modificar Destruir tipos de refer\u00eancia +capability.AttachRulesToMetadataProperties.title=Anexar regras a propriedades de metadados +capability.MakeOptionalParametersMandatory.title=Tornar par\u00e2metros opcionais obrigat\u00f3rios +capability.MapEmailMetadata.title=Mapear metadados de e-mail + +# Rules +capability.group.rules.title=Regras capability.ManageRules.title=Gerenciar regras \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties index 0d10685435..e32f85f1f4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=\u0417\u0430\u043f\u0438\u0441\u0438 -capability.DeclareRecords.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.ViewRecords.title=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.UndeclareRecords.title=\u041f\u0435\u0440\u0435\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.CreateRecords.title=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.RequestRecordInformation.title=\u0417\u0430\u043f\u0440\u043e\u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0437\u0430\u043f\u0438\u0441\u0438 -capability.RejectRecords.title=\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 -capability.FileUnfiledRecords.title=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.LinkToRecords.title=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 -capability.DeleteLinks.title=\u0420\u0430\u0437\u043e\u0440\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u0438 \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -# Metadata Control -capability.group.metadataControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 -capability.EditRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.EditDeclaredRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.EditNonRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0437\u0430\u043f\u0438\u0441\u0438 -capability.MoveRecords.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 - -# Folder Control -capability.group.folderControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u043e\u0439 -capability.CreateModifyDestroyFolders.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u043f\u0430\u043f\u043a\u0438 -capability.CloseFolders.title=\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0438 -capability.ReOpenFolders.title=\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0438 -capability.DeclareRecordsInClosedFolders.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0430\u043f\u043a\u0430\u0445 - -# Vital Records -capability.group.vitalRecords.title=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.UpdateVitalRecordCycleInformation.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0446\u0438\u043a\u043b\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -capability.CycleVitalRecords.title=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0446\u0438\u043a\u043b\u0435 -capability.PlanningReviewCycles.title=\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 - -# References and Links -capability.group.references.title=\u0421\u0441\u044b\u043b\u043a\u0438 -capability.ChangeOrDeleteReferences.title=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 - -# Events -capability.group.events.title=\u0421\u043e\u0431\u044b\u0442\u0438\u044f -capability.CreateModifyDestroyEvents.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f -capability.AddModifyEventDates.title=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u0439 - -# Cutoff -capability.group.cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -capability.ApproveRecordsScheduledForCutoff.title=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438, \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 -capability.CreateModifyRecordsInCutoffFolders.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043f\u043a\u0430\u0445 - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 -capability.UpdateTriggerDates.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430 -capability.ManuallyChangeDispositionDates.title=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e -capability.AuthorizeNominatedTransfers.title=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044b -capability.AuthorizeAllTransfers.title=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -capability.DestroyRecordsScheduledForDestruction.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0434 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 -capability.DestroyRecords.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 -capability.DeleteRecords.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0417\u0430\u043f\u0438\u0441\u044c -capability.TriggerAnEvent.title=\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -capability.FileDestructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 -capability.FileTransferReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0444\u0430\u0439\u043b\u0430 -capability.EndRetention.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 - -# Hold Controls -capability.group.holdControls.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c -capability.ExtendRetentionPeriodOrFreeze.title=\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c -capability.Unfreeze.title=\u041e\u0442\u043a\u0440\u0435\u043f\u0438\u0442\u044c -capability.ViewUpdateReasonsForFreeze.title=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u0447\u0438\u043d \u0434\u043b\u044f \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f -capability.CreateHold.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 -capability.AddToHold.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c -capability.RemoveFromHold.title=\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c -capability.FileHoldReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 -capability.DeleteHold.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -capability.EditHold.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 - -# Audit -capability.group.audit.title=\u0410\u0443\u0434\u0438\u0442 -capability.DeclareAuditAsRecord.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u044c -capability.EnableDisableAuditByTypes.title=\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c/\u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 \u043f\u043e \u0442\u0438\u043f\u0430\u043c -capability.DeleteAudit.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 -capability.SelectAuditMetadata.title=\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u0442\u0430 -capability.AccessAudit.title=\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0430\u0443\u0434\u0438\u0442 -capability.ExportAudit.title=\u042d\u043a\u0441\u043f\u043e\u0440\u0442 \u0430\u0443\u0434\u0438\u0442\u0430 - -# Security -capability.group.security.title=\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c -capability.CreateModifyDestroyRoles.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0440\u043e\u043b\u0438 -capability.CreateModifyDestroyUsersAndGroups.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0433\u0440\u0443\u043f\u043f\u044b -capability.PasswordControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438 -capability.DisplayRightsReport.title=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0447\u0435\u0442\u0430 \u043f\u043e \u043f\u0440\u0430\u0432\u0430\u043c -capability.ManageAccessControls.title=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e -capability.ManageAccessRights.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 - -# Configuration -capability.group.config.title=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f -capability.CreateModifyDestroyFileplanMetadata.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0410\u0440\u0445\u0438\u0432 -capability.CreateModifyDestroyFileplanTypes.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0410\u0440\u0445\u0438\u0432 -capability.CreateModifyDestroyRecordTypes.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -capability.CreateAndAssociateSelectionLists.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 -capability.EditSelectionLists.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 -capability.CreateModifyDestroyReferenceTypes.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0441\u0441\u044b\u043b\u043e\u043a -capability.AttachRulesToMetadataProperties.title=\u041f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 -capability.MakeOptionalParametersMandatory.title=\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 -capability.MapEmailMetadata.title=\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b - -# Rules -capability.group.rules.title=\u041f\u0440\u0430\u0432\u0438\u043b\u0430 +# Records +capability.group.records.title=\u0417\u0430\u043f\u0438\u0441\u0438 +capability.DeclareRecords.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +capability.ViewRecords.title=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +capability.UndeclareRecords.title=\u041f\u0435\u0440\u0435\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +capability.CreateRecords.title=\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +capability.RequestRecordInformation.title=\u0417\u0430\u043f\u0440\u043e\u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0437\u0430\u043f\u0438\u0441\u0438 +capability.RejectRecords.title=\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 +capability.FileUnfiledRecords.title=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +capability.LinkToRecords.title=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 +capability.DeleteLinks.title=\u0420\u0430\u0437\u043e\u0440\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u0438 \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 + +# Metadata Control +capability.group.metadataControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 +capability.EditRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +capability.EditDeclaredRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 +capability.EditNonRecordMetadata.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0437\u0430\u043f\u0438\u0441\u0438 +capability.MoveRecords.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 + +# Folder Control +capability.group.folderControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u043e\u0439 +capability.CreateModifyDestroyFolders.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u043f\u0430\u043f\u043a\u0438 +capability.CloseFolders.title=\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0438 +capability.ReOpenFolders.title=\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0438 +capability.DeclareRecordsInClosedFolders.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0430\u043f\u043a\u0430\u0445 + +# Vital Records +capability.group.vitalRecords.title=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +capability.UpdateVitalRecordCycleInformation.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0446\u0438\u043a\u043b\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 +capability.CycleVitalRecords.title=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0446\u0438\u043a\u043b\u0435 +capability.PlanningReviewCycles.title=\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0438\u043a\u043b\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 + +# References and Links +capability.group.references.title=\u0421\u0441\u044b\u043b\u043a\u0438 +capability.ChangeOrDeleteReferences.title=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 + +# Events +capability.group.events.title=\u0421\u043e\u0431\u044b\u0442\u0438\u044f +capability.CreateModifyDestroyEvents.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f +capability.AddModifyEventDates.title=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u0439 + +# Cutoff +capability.group.cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c +capability.ApproveRecordsScheduledForCutoff.title=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438, \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 +capability.CreateModifyRecordsInCutoffFolders.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043f\u043a\u0430\u0445 + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 +capability.UpdateTriggerDates.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430 +capability.ManuallyChangeDispositionDates.title=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u0442\u044b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e +capability.AuthorizeNominatedTransfers.title=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044b +capability.AuthorizeAllTransfers.title=\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 +capability.DestroyRecordsScheduledForDestruction.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0434 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 +capability.DestroyRecords.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 +capability.DeleteRecords.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0417\u0430\u043f\u0438\u0441\u044c +capability.TriggerAnEvent.title=\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f +capability.FileDestructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 +capability.FileTransferReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0444\u0430\u0439\u043b\u0430 +capability.EndRetention.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 + +# Hold Controls +capability.group.holdControls.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c +capability.ExtendRetentionPeriodOrFreeze.title=\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c +capability.Unfreeze.title=\u041e\u0442\u043a\u0440\u0435\u043f\u0438\u0442\u044c +capability.ViewUpdateReasonsForFreeze.title=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043f\u0440\u0438\u0447\u0438\u043d \u0434\u043b\u044f \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u044f +capability.CreateHold.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 +capability.AddToHold.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c +capability.RemoveFromHold.title=\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c +capability.FileHoldReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 +capability.DeleteHold.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 +capability.EditHold.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 + +# Audit +capability.group.audit.title=\u0410\u0443\u0434\u0438\u0442 +capability.DeclareAuditAsRecord.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u044c +capability.EnableDisableAuditByTypes.title=\u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c/\u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 \u043f\u043e \u0442\u0438\u043f\u0430\u043c +capability.DeleteAudit.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442 +capability.SelectAuditMetadata.title=\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u0442\u0430 +capability.AccessAudit.title=\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0430\u0443\u0434\u0438\u0442 +capability.ExportAudit.title=\u042d\u043a\u0441\u043f\u043e\u0440\u0442 \u0430\u0443\u0434\u0438\u0442\u0430 + +# Security +capability.group.security.title=\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c +capability.CreateModifyDestroyRoles.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0440\u043e\u043b\u0438 +capability.CreateModifyDestroyUsersAndGroups.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0433\u0440\u0443\u043f\u043f\u044b +capability.PasswordControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438 +capability.DisplayRightsReport.title=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0447\u0435\u0442\u0430 \u043f\u043e \u043f\u0440\u0430\u0432\u0430\u043c +capability.ManageAccessControls.title=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e +capability.ManageAccessRights.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 + +# Configuration +capability.group.config.title=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f +capability.CreateModifyDestroyFileplanMetadata.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0410\u0440\u0445\u0438\u0432 +capability.CreateModifyDestroyFileplanTypes.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0410\u0440\u0445\u0438\u0432 +capability.CreateModifyDestroyRecordTypes.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +capability.CreateAndAssociateSelectionLists.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 +capability.EditSelectionLists.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 +capability.CreateModifyDestroyReferenceTypes.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0441\u0441\u044b\u043b\u043e\u043a +capability.AttachRulesToMetadataProperties.title=\u041f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 +capability.MakeOptionalParametersMandatory.title=\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 +capability.MapEmailMetadata.title=\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b + +# Rules +capability.group.rules.title=\u041f\u0440\u0430\u0432\u0438\u043b\u0430 capability.ManageRules.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties index e561311ed4..4e7889575c 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties @@ -1,105 +1,105 @@ -# Records -capability.group.records.title=\u8bb0\u5f55 -capability.DeclareRecords.title=\u5b8c\u6210\u8bb0\u5f55 -capability.ViewRecords.title=\u67e5\u770b\u8bb0\u5f55 -capability.UndeclareRecords.title=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 -capability.CreateRecords.title=\u521b\u5efa\u8bb0\u5f55 -capability.RequestRecordInformation.title=\u8bf7\u6c42\u8bb0\u5f55\u4fe1\u606f -capability.RejectRecords.title=\u62d2\u7edd\u8bb0\u5f55 -capability.FileUnfiledRecords.title=\u5bf9\u672a\u7acb\u5377\u7684\u8bb0\u5f55\u7acb\u5377 -capability.LinkToRecords.title=\u94fe\u63a5\u8bb0\u5f55 -capability.DeleteLinks.title=\u53d6\u6d88\u8bb0\u5f55\u7684\u94fe\u63a5 - -# Metadata Control -capability.group.metadataControl.title=\u5143\u6570\u636e\u63a7\u5236 -capability.EditRecordMetadata.title=\u7f16\u8f91\u8bb0\u5f55\u5143\u6570\u636e -capability.EditDeclaredRecordMetadata.title=\u7f16\u8f91\u5b8c\u6210\u7684\u8bb0\u5f55\u5143\u6570\u636e -capability.EditNonRecordMetadata.title=\u7f16\u8f91\u975e\u8bb0\u5f55\u5143\u6570\u636e -capability.MoveRecords.title=\u79fb\u52a8\u8bb0\u5f55 - -# Folder Control -capability.group.folderControl.title=\u6587\u4ef6\u5939\u63a7\u5236 -capability.CreateModifyDestroyFolders.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u6587\u4ef6\u5939 -capability.CloseFolders.title=\u5173\u95ed\u6587\u4ef6\u5939 -capability.ReOpenFolders.title=\u91cd\u65b0\u6253\u5f00\u6587\u4ef6\u5939 -capability.DeclareRecordsInClosedFolders.title=\u5b8c\u6210\u5df2\u5173\u95ed\u6587\u4ef6\u5939\u4e2d\u7684\u8bb0\u5f55 - -# Vital Records -capability.group.vitalRecords.title=\u6838\u5fc3\u8bb0\u5f55 -capability.UpdateVitalRecordCycleInformation.title=\u66f4\u65b0\u6838\u5fc3\u8bb0\u5f55\u5468\u671f\u4fe1\u606f -capability.CycleVitalRecords.title=\u5468\u671f\u6838\u5fc3\u8bb0\u5f55 -capability.PlanningReviewCycles.title=\u8ba1\u5212\u5ba1\u67e5\u5468\u671f - -# References and Links -capability.group.references.title=\u53c2\u8003 -capability.ChangeOrDeleteReferences.title=\u66f4\u6539\u6216\u5220\u9664\u53c2\u8003 - -# Events -capability.group.events.title=\u4e8b\u4ef6 -capability.CreateModifyDestroyEvents.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u4e8b\u4ef6 -capability.AddModifyEventDates.title=\u6dfb\u52a0\u4fee\u6539\u4e8b\u4ef6\u65e5\u671f - -# Cutoff -capability.group.cutoff.title=\u4e2d\u65ad -capability.ApproveRecordsScheduledForCutoff.title=\u6279\u51c6\u8ba1\u5212\u8981\u4e2d\u65ad\u7684\u8bb0\u5f55 -capability.CreateModifyRecordsInCutoffFolders.title=\u5728\u4e2d\u65ad\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4fee\u6539\u8bb0\u5f55 - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=\u4fdd\u7559\u548c\u4f20\u8f93 -capability.UpdateTriggerDates.title=\u66f4\u65b0\u89e6\u53d1\u65e5\u671f -capability.ManuallyChangeDispositionDates.title=\u624b\u52a8\u66f4\u6539\u4fdd\u7559\u65e5\u671f -capability.AuthorizeNominatedTransfers.title=\u6388\u6743\u6307\u5b9a\u79fb\u4ea4 -capability.AuthorizeAllTransfers.title=\u6388\u6743\u6240\u6709\u79fb\u4ea4 -capability.DestroyRecordsScheduledForDestruction.title=\u9500\u6bc1\u8ba1\u5212\u8981\u9500\u6bc1\u7684\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 -capability.DestroyRecords.title=\u9500\u6bc1\u8bb0\u5f55 -capability.DeleteRecords.title=\u5220\u9664\u8bb0\u5f55 -capability.TriggerAnEvent.title=\u89e6\u53d1\u4e8b\u4ef6 -capability.FileDestructionReport.title=\u7acb\u5377\u9500\u6bc1\u62a5\u544a -capability.FileTransferReport.title=\u7acb\u5377\u79fb\u4ea4\u62a5\u544a -capability.EndRetention.title=\u7ed3\u675f\u4fdd\u7559 - -# Hold Controls -capability.group.holdControls.title=\u4fdd\u5b58\u63a7\u5236 -capability.ExtendRetentionPeriodOrFreeze.title=\u5ef6\u957f\u4fdd\u7559\u671f\u95f4\u6216\u4fdd\u5b58 -capability.Unfreeze.title=\u53d6\u6d88\u4fdd\u5b58 -capability.ViewUpdateReasonsForFreeze.title=\u67e5\u770b\u4fdd\u5b58\u7684\u66f4\u65b0\u539f\u56e0 -capability.CreateHold.title=\u521b\u5efa\u4fdd\u5b58 -capability.AddToHold.title=\u52a0\u5165\u4fdd\u5b58 -capability.RemoveFromHold.title=\u89e3\u9664\u4fdd\u5b58 -capability.FileHoldReport.title=\u7acb\u5377\u4fdd\u5b58\u62a5\u544a -capability.DeleteHold.title=\u5220\u9664\u4fdd\u5b58 -capability.EditHold.title=\u7f16\u8f91\u4fdd\u5b58 - -# Audit -capability.group.audit.title=\u5ba1\u8ba1 -capability.DeclareAuditAsRecord.title=\u5c06\u5ba1\u8ba1\u58f0\u660e\u4e3a\u8bb0\u5f55 -capability.EnableDisableAuditByTypes.title=\u6309\u7c7b\u578b\u542f\u7528\u3001\u7981\u7528\u5ba1\u8ba1 -capability.DeleteAudit.title=\u5220\u9664\u5ba1\u8ba1 -capability.SelectAuditMetadata.title=\u9009\u62e9\u5ba1\u8ba1\u5143\u6570\u636e -capability.AccessAudit.title=\u8bbf\u95ee\u5ba1\u8ba1 -capability.ExportAudit.title=\u5bfc\u51fa\u5ba1\u8ba1 - -# Security -capability.group.security.title=\u5b89\u5168\u6027 -capability.CreateModifyDestroyRoles.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u89d2\u8272 -capability.CreateModifyDestroyUsersAndGroups.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u7528\u6237\u548c\u7ec4 -capability.PasswordControl.title=\u5bc6\u7801\u63a7\u5236 -capability.DisplayRightsReport.title=\u663e\u793a\u6743\u9650\u62a5\u544a -capability.ManageAccessControls.title=\u7ec4\u548c\u7528\u6237\u89d2\u8272\u5206\u914d -capability.ManageAccessRights.title=\u7ba1\u7406\u6743\u9650 - -# Configuration -capability.group.config.title=\u914d\u7f6e -capability.CreateModifyDestroyFileplanMetadata.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5f52\u7c7b\u65b9\u6848\u5143\u6570\u636e -capability.CreateModifyDestroyFileplanTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5f52\u7c7b\u65b9\u6848\u7c7b\u578b -capability.CreateModifyDestroyRecordTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u8bb0\u5f55\u7c7b\u578b -capability.CreateAndAssociateSelectionLists.title=\u521b\u5efa\u548c\u5173\u8054\u9009\u62e9\u5217\u8868 -capability.EditSelectionLists.title=\u7f16\u8f91\u9009\u62e9\u5217\u8868 -capability.CreateModifyDestroyReferenceTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u53c2\u8003\u7c7b\u578b -capability.AttachRulesToMetadataProperties.title=\u5c06\u89c4\u5219\u9644\u52a0\u81f3\u5143\u6570\u636e\u5c5e\u6027 -capability.MakeOptionalParametersMandatory.title=\u5c06\u53ef\u9009\u53c2\u6570\u53d8\u4e3a\u5fc5\u8981\u53c2\u6570 -capability.MapEmailMetadata.title=\u6620\u5c04\u7535\u5b50\u90ae\u4ef6\u5143\u6570\u636e - -# Rules -capability.group.rules.title=\u89c4\u5219 +# Records +capability.group.records.title=\u8bb0\u5f55 +capability.DeclareRecords.title=\u5b8c\u6210\u8bb0\u5f55 +capability.ViewRecords.title=\u67e5\u770b\u8bb0\u5f55 +capability.UndeclareRecords.title=\u91cd\u65b0\u6253\u5f00\u8bb0\u5f55 +capability.CreateRecords.title=\u521b\u5efa\u8bb0\u5f55 +capability.RequestRecordInformation.title=\u8bf7\u6c42\u8bb0\u5f55\u4fe1\u606f +capability.RejectRecords.title=\u62d2\u7edd\u8bb0\u5f55 +capability.FileUnfiledRecords.title=\u5bf9\u672a\u7acb\u5377\u7684\u8bb0\u5f55\u7acb\u5377 +capability.LinkToRecords.title=\u94fe\u63a5\u8bb0\u5f55 +capability.DeleteLinks.title=\u53d6\u6d88\u8bb0\u5f55\u7684\u94fe\u63a5 + +# Metadata Control +capability.group.metadataControl.title=\u5143\u6570\u636e\u63a7\u5236 +capability.EditRecordMetadata.title=\u7f16\u8f91\u8bb0\u5f55\u5143\u6570\u636e +capability.EditDeclaredRecordMetadata.title=\u7f16\u8f91\u5b8c\u6210\u7684\u8bb0\u5f55\u5143\u6570\u636e +capability.EditNonRecordMetadata.title=\u7f16\u8f91\u975e\u8bb0\u5f55\u5143\u6570\u636e +capability.MoveRecords.title=\u79fb\u52a8\u8bb0\u5f55 + +# Folder Control +capability.group.folderControl.title=\u6587\u4ef6\u5939\u63a7\u5236 +capability.CreateModifyDestroyFolders.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u6587\u4ef6\u5939 +capability.CloseFolders.title=\u5173\u95ed\u6587\u4ef6\u5939 +capability.ReOpenFolders.title=\u91cd\u65b0\u6253\u5f00\u6587\u4ef6\u5939 +capability.DeclareRecordsInClosedFolders.title=\u5b8c\u6210\u5df2\u5173\u95ed\u6587\u4ef6\u5939\u4e2d\u7684\u8bb0\u5f55 + +# Vital Records +capability.group.vitalRecords.title=\u6838\u5fc3\u8bb0\u5f55 +capability.UpdateVitalRecordCycleInformation.title=\u66f4\u65b0\u6838\u5fc3\u8bb0\u5f55\u5468\u671f\u4fe1\u606f +capability.CycleVitalRecords.title=\u5468\u671f\u6838\u5fc3\u8bb0\u5f55 +capability.PlanningReviewCycles.title=\u8ba1\u5212\u5ba1\u67e5\u5468\u671f + +# References and Links +capability.group.references.title=\u53c2\u8003 +capability.ChangeOrDeleteReferences.title=\u66f4\u6539\u6216\u5220\u9664\u53c2\u8003 + +# Events +capability.group.events.title=\u4e8b\u4ef6 +capability.CreateModifyDestroyEvents.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u4e8b\u4ef6 +capability.AddModifyEventDates.title=\u6dfb\u52a0\u4fee\u6539\u4e8b\u4ef6\u65e5\u671f + +# Cutoff +capability.group.cutoff.title=\u4e2d\u65ad +capability.ApproveRecordsScheduledForCutoff.title=\u6279\u51c6\u8ba1\u5212\u8981\u4e2d\u65ad\u7684\u8bb0\u5f55 +capability.CreateModifyRecordsInCutoffFolders.title=\u5728\u4e2d\u65ad\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4fee\u6539\u8bb0\u5f55 + +# Disposition and Transfers +capability.group.dispositionAndTransfers.title=\u4fdd\u7559\u548c\u4f20\u8f93 +capability.UpdateTriggerDates.title=\u66f4\u65b0\u89e6\u53d1\u65e5\u671f +capability.ManuallyChangeDispositionDates.title=\u624b\u52a8\u66f4\u6539\u4fdd\u7559\u65e5\u671f +capability.AuthorizeNominatedTransfers.title=\u6388\u6743\u6307\u5b9a\u79fb\u4ea4 +capability.AuthorizeAllTransfers.title=\u6388\u6743\u6240\u6709\u79fb\u4ea4 +capability.DestroyRecordsScheduledForDestruction.title=\u9500\u6bc1\u8ba1\u5212\u8981\u9500\u6bc1\u7684\u8bb0\u5f55\u6216\u8bb0\u5f55\u6587\u4ef6\u5939 +capability.DestroyRecords.title=\u9500\u6bc1\u8bb0\u5f55 +capability.DeleteRecords.title=\u5220\u9664\u8bb0\u5f55 +capability.TriggerAnEvent.title=\u89e6\u53d1\u4e8b\u4ef6 +capability.FileDestructionReport.title=\u7acb\u5377\u9500\u6bc1\u62a5\u544a +capability.FileTransferReport.title=\u7acb\u5377\u79fb\u4ea4\u62a5\u544a +capability.EndRetention.title=\u7ed3\u675f\u4fdd\u7559 + +# Hold Controls +capability.group.holdControls.title=\u4fdd\u5b58\u63a7\u5236 +capability.ExtendRetentionPeriodOrFreeze.title=\u5ef6\u957f\u4fdd\u7559\u671f\u95f4\u6216\u4fdd\u5b58 +capability.Unfreeze.title=\u53d6\u6d88\u4fdd\u5b58 +capability.ViewUpdateReasonsForFreeze.title=\u67e5\u770b\u4fdd\u5b58\u7684\u66f4\u65b0\u539f\u56e0 +capability.CreateHold.title=\u521b\u5efa\u4fdd\u5b58 +capability.AddToHold.title=\u52a0\u5165\u4fdd\u5b58 +capability.RemoveFromHold.title=\u89e3\u9664\u4fdd\u5b58 +capability.FileHoldReport.title=\u7acb\u5377\u4fdd\u5b58\u62a5\u544a +capability.DeleteHold.title=\u5220\u9664\u4fdd\u5b58 +capability.EditHold.title=\u7f16\u8f91\u4fdd\u5b58 + +# Audit +capability.group.audit.title=\u5ba1\u8ba1 +capability.DeclareAuditAsRecord.title=\u5c06\u5ba1\u8ba1\u58f0\u660e\u4e3a\u8bb0\u5f55 +capability.EnableDisableAuditByTypes.title=\u6309\u7c7b\u578b\u542f\u7528\u3001\u7981\u7528\u5ba1\u8ba1 +capability.DeleteAudit.title=\u5220\u9664\u5ba1\u8ba1 +capability.SelectAuditMetadata.title=\u9009\u62e9\u5ba1\u8ba1\u5143\u6570\u636e +capability.AccessAudit.title=\u8bbf\u95ee\u5ba1\u8ba1 +capability.ExportAudit.title=\u5bfc\u51fa\u5ba1\u8ba1 + +# Security +capability.group.security.title=\u5b89\u5168\u6027 +capability.CreateModifyDestroyRoles.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u89d2\u8272 +capability.CreateModifyDestroyUsersAndGroups.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u7528\u6237\u548c\u7ec4 +capability.PasswordControl.title=\u5bc6\u7801\u63a7\u5236 +capability.DisplayRightsReport.title=\u663e\u793a\u6743\u9650\u62a5\u544a +capability.ManageAccessControls.title=\u7ec4\u548c\u7528\u6237\u89d2\u8272\u5206\u914d +capability.ManageAccessRights.title=\u7ba1\u7406\u6743\u9650 + +# Configuration +capability.group.config.title=\u914d\u7f6e +capability.CreateModifyDestroyFileplanMetadata.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5f52\u7c7b\u65b9\u6848\u5143\u6570\u636e +capability.CreateModifyDestroyFileplanTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u5f52\u7c7b\u65b9\u6848\u7c7b\u578b +capability.CreateModifyDestroyRecordTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u8bb0\u5f55\u7c7b\u578b +capability.CreateAndAssociateSelectionLists.title=\u521b\u5efa\u548c\u5173\u8054\u9009\u62e9\u5217\u8868 +capability.EditSelectionLists.title=\u7f16\u8f91\u9009\u62e9\u5217\u8868 +capability.CreateModifyDestroyReferenceTypes.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u53c2\u8003\u7c7b\u578b +capability.AttachRulesToMetadataProperties.title=\u5c06\u89c4\u5219\u9644\u52a0\u81f3\u5143\u6570\u636e\u5c5e\u6027 +capability.MakeOptionalParametersMandatory.title=\u5c06\u53ef\u9009\u53c2\u6570\u53d8\u4e3a\u5fc5\u8981\u53c2\u6570 +capability.MapEmailMetadata.title=\u6620\u5c04\u7535\u5b50\u90ae\u4ef6\u5143\u6570\u636e + +# Rules +capability.group.rules.title=\u89c4\u5219 capability.ManageRules.title=\u7ba1\u7406\u89c4\u5219 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service.properties index 4adb771e20..5ba8e758ce 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=Records due for Review Notification -notification.superseded.subject=Record Superseded Notification +notification.dueforreview.subject=Records due for Review Notification +notification.superseded.subject=Record Superseded Notification notification.rejected.subject=Record Rejected Notification \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_de.properties index d4fd2a292f..516e806803 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_de.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=Benachrichtigung bei Records mit f\u00e4lliger \u00dcberpr\u00fcfung -notification.superseded.subject=Benachrichtigung bei abgel\u00f6stem Record +notification.dueforreview.subject=Benachrichtigung bei Records mit f\u00e4lliger \u00dcberpr\u00fcfung +notification.superseded.subject=Benachrichtigung bei abgel\u00f6stem Record notification.rejected.subject=Benachrichtigung bei abgelehntem Record \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_es.properties index b48cd5681c..dc443b8c59 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_es.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=Documentos de archivo pendientes de notificaci\u00f3n de revisi\u00f3n -notification.superseded.subject=Notificaci\u00f3n de documento de archivo reemplazada +notification.dueforreview.subject=Documentos de archivo pendientes de notificaci\u00f3n de revisi\u00f3n +notification.superseded.subject=Notificaci\u00f3n de documento de archivo reemplazada notification.rejected.subject=Notificaci\u00f3n de documento de archivo rechazada \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_fr.properties index 73845f54b1..f342374560 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_fr.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=Documents d'archives arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification -notification.superseded.subject=Le document d'archives a remplac\u00e9 la notification +notification.dueforreview.subject=Documents d'archives arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification +notification.superseded.subject=Le document d'archives a remplac\u00e9 la notification notification.rejected.subject=Le document d'archives a rejet\u00e9 la notification \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_it.properties index f61ba052a4..4e8da1a212 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_it.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=Notifica record da esaminare -notification.superseded.subject=Notifica record sostituito +notification.dueforreview.subject=Notifica record da esaminare +notification.superseded.subject=Notifica record sostituito notification.rejected.subject=Notifica record respinto \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ja.properties index 9d523fdd4b..37a7ba7c2b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ja.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u30ec\u30b3\u30fc\u30c9\u306e\u901a\u77e5 -notification.superseded.subject=\u30ec\u30b3\u30fc\u30c9\u306e\u5dee\u3057\u66ff\u3048\u901a\u77e5 +notification.dueforreview.subject=\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u30ec\u30b3\u30fc\u30c9\u306e\u901a\u77e5 +notification.superseded.subject=\u30ec\u30b3\u30fc\u30c9\u306e\u5dee\u3057\u66ff\u3048\u901a\u77e5 notification.rejected.subject=\u30ec\u30b3\u30fc\u30c9\u306e\u5374\u4e0b\u901a\u77e5 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties index 56349a3443..38c9c0886f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=Oppf\u00f8ringer med melding der det skal v\u00e6re gjennomgang -notification.superseded.subject=Oppf\u00f8ring erstattet melding +notification.dueforreview.subject=Oppf\u00f8ringer med melding der det skal v\u00e6re gjennomgang +notification.superseded.subject=Oppf\u00f8ring erstattet melding notification.rejected.subject=Oppf\u00f8ring avviste melding \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nl.properties index 278210cbba..4faef1f017 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nl.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=Melding Records gereed voor revisie -notification.superseded.subject=Melding Record vervangen +notification.dueforreview.subject=Melding Records gereed voor revisie +notification.superseded.subject=Melding Record vervangen notification.rejected.subject=Melding Record geweigerd \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_pt_BR.properties index 43fd3e51f0..76a932db7a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_pt_BR.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=Notifica\u00e7\u00e3o de prazo para revis\u00e3o de documentos arquiv\u00edsticos -notification.superseded.subject=Notifica\u00e7\u00e3o de documento arquiv\u00edstico substitu\u00eddo +notification.dueforreview.subject=Notifica\u00e7\u00e3o de prazo para revis\u00e3o de documentos arquiv\u00edsticos +notification.superseded.subject=Notifica\u00e7\u00e3o de documento arquiv\u00edstico substitu\u00eddo notification.rejected.subject=Notifica\u00e7\u00e3o de documento arquiv\u00edstico rejeitado \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ru.properties index 99fb21f7ad..69ac12cfce 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_ru.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 -notification.superseded.subject=\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043c\u0435\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +notification.dueforreview.subject=\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 +notification.superseded.subject=\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043c\u0435\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 notification.rejected.subject=\u0423\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_zh_CN.properties index 3ec73c184a..b6a0599398 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_zh_CN.properties @@ -1,3 +1,3 @@ -notification.dueforreview.subject=\u8bb0\u5f55\u5ba1\u67e5\u5230\u671f\u901a\u77e5 -notification.superseded.subject=\u8bb0\u5f55\u88ab\u53d6\u4ee3\u901a\u77e5 +notification.dueforreview.subject=\u8bb0\u5f55\u5ba1\u67e5\u5230\u671f\u901a\u77e5 +notification.superseded.subject=\u8bb0\u5f55\u88ab\u53d6\u4ee3\u901a\u77e5 notification.rejected.subject=\u8bb0\u5f55\u88ab\u62d2\u7edd\u901a\u77e5 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties index 6d55f96355..8b57ef264e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=You can only file records to a record folder. -rm.service.update-disposition-action-def=You can't update the retention action definition because changes made to the retention schedule are being saved. Try again in a few minutes. -rm.service.set-id=You can't change the ID of {0} because it's read-only. -rm.service.path-node=We couldn't find {0}. Try refreshing your browser or contact your I.T. Dept. -rm.service.invalid-rm-node=The records management node isn't valid because the aspect {0} isn't present. -rm.service.no-root=We couldn't find the records management root. Try filing the record again. -rm.service.dup-root=You can't create a file plan here as there's already one created in this folder hierarchy. -rm.service.root-type=We can't create the file plan because type {0} isn't a sub-type of rma:filePlan. Try again using a different type. -rm.service.container-parent-type=You can only create a record category at the top level of the file plan or in another record category (rma:recordCategory). -rm.service.container-type=You can only create a record category at the top level of the file plan or in another record category (rma:recordsManagementContainer or sub-type). -rm.service.container-expected=You can only find record category contents in a record category (rma:recordCategory or sub-type). -rm.service.record-folder-expected=The action can only be completed using a record folder of type rma:recordFolder. -rm.service.parent-record-folder-root=You can't create a record folder here. Try creating it in a record category. -rm.service.parent-record-folder-type=You can't create a record folder here. Try creating it in a record category. -rm.service.record-folder-type=We can't create record folder unless you use the type rma:recordFolder or a sub-type. -rm.service.not-record=The node {0} is not a record. -rm.service.vital-def-missing=Vital record definition aspect is not present on node. (nodeRef={0}) -rm.service.close-record-folder-not-folder=The record folder couldn't be closed because it's not defined as a record folder.(nodeRef={0}) -rm.service.node-has-aspect=The record type {1} is already showing for record {0}. -rm.service.final-version=Final +rm.service.error-add-content-container=You can only file records to a record folder. +rm.service.update-disposition-action-def=You can't update the retention action definition because changes made to the retention schedule are being saved. Try again in a few minutes. +rm.service.set-id=You can't change the ID of {0} because it's read-only. +rm.service.path-node=We couldn't find {0}. Try refreshing your browser or contact your I.T. Dept. +rm.service.invalid-rm-node=The records management node isn't valid because the aspect {0} isn't present. +rm.service.no-root=We couldn't find the records management root. Try filing the record again. +rm.service.dup-root=You can't create a file plan here as there's already one created in this folder hierarchy. +rm.service.root-type=We can't create the file plan because type {0} isn't a sub-type of rma:filePlan. Try again using a different type. +rm.service.container-parent-type=You can only create a record category at the top level of the file plan or in another record category (rma:recordCategory). +rm.service.container-type=You can only create a record category at the top level of the file plan or in another record category (rma:recordsManagementContainer or sub-type). +rm.service.container-expected=You can only find record category contents in a record category (rma:recordCategory or sub-type). +rm.service.record-folder-expected=The action can only be completed using a record folder of type rma:recordFolder. +rm.service.parent-record-folder-root=You can't create a record folder here. Try creating it in a record category. +rm.service.parent-record-folder-type=You can't create a record folder here. Try creating it in a record category. +rm.service.record-folder-type=We can't create record folder unless you use the type rma:recordFolder or a sub-type. +rm.service.not-record=The node {0} is not a record. +rm.service.vital-def-missing=Vital record definition aspect is not present on node. (nodeRef={0}) +rm.service.close-record-folder-not-folder=The record folder couldn't be closed because it's not defined as a record folder.(nodeRef={0}) +rm.service.node-has-aspect=The record type {1} is already showing for record {0}. +rm.service.final-version=Final rm.service.final-version-description=The final archived record version \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties index f339081c21..e400bc2b6a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=Records k\u00f6nnen nur in einem Record-Ordner abgelegt werden. -rm.service.update-disposition-action-def=Sie k\u00f6nnen die Definition der Aufbewahrungsaktion nicht aktualisieren, da \u00c4nderungen am Aufbewahrungsplan gespeichert werden. Versuchen Sie es in ein paar Minuten erneut. -rm.service.set-id=Sie k\u00f6nnen die ID von {0} nicht \u00e4ndern (schreibgesch\u00fctzt). -rm.service.path-node=''{0}'' wurde nicht gefunden. Aktualisieren Sie Ihren Browser, um es noch einmal zu versuchen, oder kontaktieren Sie Ihre IT-Abteilung. -rm.service.invalid-rm-node=Der Records Management Knoten ist ung\u00fcltig, da der Aspekt {0} nicht vorhanden ist. -rm.service.no-root=Records Management Root wurde nicht gefunden. Versuchen Sie, den Record erneut abzulegen. -rm.service.dup-root=Sie k\u00f6nnen hier keinen Ablageplan erstellen, da bereits einer in dieser Ordnerhierarchie erstellt wurde. -rm.service.root-type=Ablageplan kann nicht erstellt werden, da Typ {0} ein Subtyp von rma:filePlan ist. Versuchen Sie es mit einem anderen Typ. -rm.service.container-parent-type=Eine Record-Kategorie kann nur auf oberster Ebene des Ablageplans oder in einer anderen Record-Kategorie (rma:recordCategory) erstellt werden. -rm.service.container-type=Eine Record-Kategorie kann nur auf oberster Ebene des Ablageplans oder in einer anderen Record-Kategorie (rma:recordsManagementContainer oder Subtyp) erstellt werden. -rm.service.container-expected=Inhalte einer Record-Kategorie k\u00f6nnen nur in einer Record-Kategorie (rma:recordCategory oder Subtyp) gefunden werden. -rm.service.record-folder-expected=Die Aktion kann nur \u00fcber einen Record-Ordner vom Typ rma:recordFolder abgeschlossen werden. -rm.service.parent-record-folder-root=Sie k\u00f6nnen hier keinen Record-Ordner erstellen. Versuchen Sie, diesen in einer Record-Kategorie zu erstellen. -rm.service.parent-record-folder-type=Sie k\u00f6nnen hier keinen Record-Ordner erstellen. Versuchen Sie, diesen in einer Record-Kategorie zu erstellen. -rm.service.record-folder-type=Record-Ordner kann erst erstellt werden, wenn Sie den Typ rma:recordFolder oder einen Subtyp verwenden. -rm.service.not-record=Knoten {0} ist kein Record. -rm.service.vital-def-missing=Definitionsaspekt von besonders relevantem Record ist auf dem Knoten nicht vorhanden. (nodeRef={0}) -rm.service.close-record-folder-not-folder=Der Record-Ordner konnte nicht geschlossen werden, da er nicht als Record-Ordner definiert ist. (nodeRef={0}) -rm.service.node-has-aspect=Record-Typ {1} wird bereits f\u00fcr Record {0} angezeigt. -rm.service.final-version=Endg\u00fcltig +rm.service.error-add-content-container=Records k\u00f6nnen nur in einem Record-Ordner abgelegt werden. +rm.service.update-disposition-action-def=Sie k\u00f6nnen die Definition der Aufbewahrungsaktion nicht aktualisieren, da \u00c4nderungen am Aufbewahrungsplan gespeichert werden. Versuchen Sie es in ein paar Minuten erneut. +rm.service.set-id=Sie k\u00f6nnen die ID von {0} nicht \u00e4ndern (schreibgesch\u00fctzt). +rm.service.path-node=''{0}'' wurde nicht gefunden. Aktualisieren Sie Ihren Browser, um es noch einmal zu versuchen, oder kontaktieren Sie Ihre IT-Abteilung. +rm.service.invalid-rm-node=Der Records Management Knoten ist ung\u00fcltig, da der Aspekt {0} nicht vorhanden ist. +rm.service.no-root=Records Management Root wurde nicht gefunden. Versuchen Sie, den Record erneut abzulegen. +rm.service.dup-root=Sie k\u00f6nnen hier keinen Ablageplan erstellen, da bereits einer in dieser Ordnerhierarchie erstellt wurde. +rm.service.root-type=Ablageplan kann nicht erstellt werden, da Typ {0} ein Subtyp von rma:filePlan ist. Versuchen Sie es mit einem anderen Typ. +rm.service.container-parent-type=Eine Record-Kategorie kann nur auf oberster Ebene des Ablageplans oder in einer anderen Record-Kategorie (rma:recordCategory) erstellt werden. +rm.service.container-type=Eine Record-Kategorie kann nur auf oberster Ebene des Ablageplans oder in einer anderen Record-Kategorie (rma:recordsManagementContainer oder Subtyp) erstellt werden. +rm.service.container-expected=Inhalte einer Record-Kategorie k\u00f6nnen nur in einer Record-Kategorie (rma:recordCategory oder Subtyp) gefunden werden. +rm.service.record-folder-expected=Die Aktion kann nur \u00fcber einen Record-Ordner vom Typ rma:recordFolder abgeschlossen werden. +rm.service.parent-record-folder-root=Sie k\u00f6nnen hier keinen Record-Ordner erstellen. Versuchen Sie, diesen in einer Record-Kategorie zu erstellen. +rm.service.parent-record-folder-type=Sie k\u00f6nnen hier keinen Record-Ordner erstellen. Versuchen Sie, diesen in einer Record-Kategorie zu erstellen. +rm.service.record-folder-type=Record-Ordner kann erst erstellt werden, wenn Sie den Typ rma:recordFolder oder einen Subtyp verwenden. +rm.service.not-record=Knoten {0} ist kein Record. +rm.service.vital-def-missing=Definitionsaspekt von besonders relevantem Record ist auf dem Knoten nicht vorhanden. (nodeRef={0}) +rm.service.close-record-folder-not-folder=Der Record-Ordner konnte nicht geschlossen werden, da er nicht als Record-Ordner definiert ist. (nodeRef={0}) +rm.service.node-has-aspect=Record-Typ {1} wird bereits f\u00fcr Record {0} angezeigt. +rm.service.final-version=Endg\u00fcltig rm.service.final-version-description=Die endg\u00fcltige archivierte Version des Records \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties index 73ae8a43c4..433c98d10f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=Solo puede archivar documentos de archivo en una carpeta de documentos de archivo. -rm.service.update-disposition-action-def=No puede actualizar la definici\u00f3n de acci\u00f3n de retenci\u00f3n porque los cambios hechos en la planificaci\u00f3n de retenci\u00f3n se est\u00e1n guardando. Vuelva a intentarlo despu\u00e9s de unos minutos. -rm.service.set-id=No puede cambiar el ID de ''{0}'' porque es de solo lectura. -rm.service.path-node=No se pudo encontrar ''{0}''. Trate de actualizar el navegador o p\u00f3ngase en contacto con el dep. de TI. -rm.service.invalid-rm-node=El nodo de Records Management no es v\u00e1lido porque el aspecto ''{0}'' no est\u00e1 presente. -rm.service.no-root=No se pudo encontrar la ra\u00edz de Records Management. Trate de archivar el documento de archivo de nuevo. -rm.service.dup-root=No puede crear un plan de ficheros aqu\u00ed porque ya hay uno creado en esta jerarqu\u00eda de carpetas. -rm.service.root-type=No se puede crear el plan de ficheros porque el tipo ''{0}'' no es un subtipo de rma:filePlan. Vuelva a intentarlo usando un tipo diferente. -rm.service.container-parent-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del plan de ficheros o en otra categor\u00eda de documentos de archivo (rma:recordCategory). -rm.service.container-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del plan de ficheros o en otra categor\u00eda de documentos de archivo (rma:recordsManagementContainer o subtipo). -rm.service.container-expected=Solo puede encontrar contenidos de categor\u00eda de documentos de archivo en una categor\u00eda de documentos de archivo (rma:recordCategory o subtipo). -rm.service.record-folder-expected=La acci\u00f3n solo puede completarse usando una carpeta de documentos de archivo del tipo rma:recordFolder. -rm.service.parent-record-folder-root=No puede crear una carpeta de documentos de archivo aqu\u00ed. Trate de crearla en una categor\u00eda de documentos de archivo. -rm.service.parent-record-folder-type=No puede crear una carpeta de documentos de archivo aqu\u00ed. Trate de crearla en una categor\u00eda de documentos de archivo. -rm.service.record-folder-type=No se puede crear una carpeta de documentos de archivo a menos que use el tipo rma:recordFolder o un subtipo. -rm.service.not-record=El nodo ''{0}'' no es un documento de archivo. -rm.service.vital-def-missing=El aspecto de definici\u00f3n de documento de archivo vital no est\u00e1 presenta en el nodo. (nodeRef=''{0}'') -rm.service.close-record-folder-not-folder=No se pudo cerrar la carpeta de documentos de archivo porque no est\u00e1 definida como una carpeta de documentos de archivo.(nodeRef=''{0}'') -rm.service.node-has-aspect=El tipo de documento de archivo ''{1}'' ya se est\u00e1 mostrando para el documento de archivo ''{0}''. -rm.service.final-version=Final +rm.service.error-add-content-container=Solo puede archivar documentos de archivo en una carpeta de documentos de archivo. +rm.service.update-disposition-action-def=No puede actualizar la definici\u00f3n de acci\u00f3n de retenci\u00f3n porque los cambios hechos en la planificaci\u00f3n de retenci\u00f3n se est\u00e1n guardando. Vuelva a intentarlo despu\u00e9s de unos minutos. +rm.service.set-id=No puede cambiar el ID de ''{0}'' porque es de solo lectura. +rm.service.path-node=No se pudo encontrar ''{0}''. Trate de actualizar el navegador o p\u00f3ngase en contacto con el dep. de TI. +rm.service.invalid-rm-node=El nodo de Records Management no es v\u00e1lido porque el aspecto ''{0}'' no est\u00e1 presente. +rm.service.no-root=No se pudo encontrar la ra\u00edz de Records Management. Trate de archivar el documento de archivo de nuevo. +rm.service.dup-root=No puede crear un plan de ficheros aqu\u00ed porque ya hay uno creado en esta jerarqu\u00eda de carpetas. +rm.service.root-type=No se puede crear el plan de ficheros porque el tipo ''{0}'' no es un subtipo de rma:filePlan. Vuelva a intentarlo usando un tipo diferente. +rm.service.container-parent-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del plan de ficheros o en otra categor\u00eda de documentos de archivo (rma:recordCategory). +rm.service.container-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del plan de ficheros o en otra categor\u00eda de documentos de archivo (rma:recordsManagementContainer o subtipo). +rm.service.container-expected=Solo puede encontrar contenidos de categor\u00eda de documentos de archivo en una categor\u00eda de documentos de archivo (rma:recordCategory o subtipo). +rm.service.record-folder-expected=La acci\u00f3n solo puede completarse usando una carpeta de documentos de archivo del tipo rma:recordFolder. +rm.service.parent-record-folder-root=No puede crear una carpeta de documentos de archivo aqu\u00ed. Trate de crearla en una categor\u00eda de documentos de archivo. +rm.service.parent-record-folder-type=No puede crear una carpeta de documentos de archivo aqu\u00ed. Trate de crearla en una categor\u00eda de documentos de archivo. +rm.service.record-folder-type=No se puede crear una carpeta de documentos de archivo a menos que use el tipo rma:recordFolder o un subtipo. +rm.service.not-record=El nodo ''{0}'' no es un documento de archivo. +rm.service.vital-def-missing=El aspecto de definici\u00f3n de documento de archivo vital no est\u00e1 presenta en el nodo. (nodeRef=''{0}'') +rm.service.close-record-folder-not-folder=No se pudo cerrar la carpeta de documentos de archivo porque no est\u00e1 definida como una carpeta de documentos de archivo.(nodeRef=''{0}'') +rm.service.node-has-aspect=El tipo de documento de archivo ''{1}'' ya se est\u00e1 mostrando para el documento de archivo ''{0}''. +rm.service.final-version=Final rm.service.final-version-description=La versi\u00f3n final del documento de archivo archivado \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties index 5cb9ff2ec3..4b51a851bf 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=Les documents d'archives peuvent \u00eatre class\u00e9s uniquement dans un dossier d'archives. -rm.service.update-disposition-action-def=Impossible de mettre \u00e0 jour la d\u00e9finition de l'action de r\u00e9tention, car des modifications de la r\u00e8gle de r\u00e9tention sont en cours d'enregistrement. R\u00e9essayez dans quelques minutes. -rm.service.set-id=Impossible de modifier l''ID de {0}, car cet \u00e9l\u00e9ment est en lecture seule. -rm.service.path-node={0} est introuvable. Essayez d''actualiser votre navigateur ou contactez votre DSI. -rm.service.invalid-rm-node=Le n\u0153ud de gestion des archives n''est pas valide, car l''aspect {0} n''est pas pr\u00e9sent. -rm.service.no-root=La racine du site de gestion des archives est introuvable. Essayez d'archiver \u00e0 nouveau le document d'archives. -rm.service.dup-root=Impossible de cr\u00e9er un plan de classification ici, car il en existe d\u00e9j\u00e0 un dans cette hi\u00e9rarchie de dossiers. -rm.service.root-type=Impossible de cr\u00e9er le plan de classification, car le type {0} n''est pas un sous-type de rma:filePlan. R\u00e9essayez avec un type diff\u00e9rent. -rm.service.container-parent-type=Une cat\u00e9gorie de document d'archives peut \u00eatre cr\u00e9\u00e9e uniquement au niveau sup\u00e9rieur du plan de classification ou dans une autre cat\u00e9gorie de document d'archives (rma:recordCategory). -rm.service.container-type=Une cat\u00e9gorie de document d'archives peut \u00eatre cr\u00e9\u00e9e uniquement au niveau sup\u00e9rieur du plan de classification ou dans une autre cat\u00e9gorie de document d'archives (rma:recordsManagementContainer ou sous-type). -rm.service.container-expected=Vous trouverez des contenus de cat\u00e9gorie de document d'archives uniquement dans une cat\u00e9gorie de document d'archives (rma:recordCategory ou sous-type). -rm.service.record-folder-expected=L'action peut \u00eatre effectu\u00e9e uniquement avec un dossier d'archives de type rma:recordFolder. -rm.service.parent-record-folder-root=Impossible de cr\u00e9er un dossier d'archives ici. Essayez de le cr\u00e9er dans une cat\u00e9gorie de document d'archives. -rm.service.parent-record-folder-type=Impossible de cr\u00e9er un dossier d'archives ici. Essayez de le cr\u00e9er dans une cat\u00e9gorie de document d'archives. -rm.service.record-folder-type=Impossible de cr\u00e9er un dossier d'archives \u00e0 moins d'utiliser le type rma:recordFolder ou un sous-type. -rm.service.not-record=Le n\u0153ud {0} n''est pas un document d''archives. -rm.service.vital-def-missing=L''aspect de d\u00e9finition de document d''archives essentiel n''est pas pr\u00e9sent sur le n\u0153ud. (nodeRef={0}) -rm.service.close-record-folder-not-folder=Le dossier d''archives n''a pas pu \u00eatre ferm\u00e9, car il n''est pas d\u00e9fini comme dossier d''archives.(nodeRef={0}) -rm.service.node-has-aspect=Le type de document d''archives {1} est d\u00e9j\u00e0 affich\u00e9 pour le document d''archives {0}. -rm.service.final-version=Finale +rm.service.error-add-content-container=Les documents d'archives peuvent \u00eatre class\u00e9s uniquement dans un dossier d'archives. +rm.service.update-disposition-action-def=Impossible de mettre \u00e0 jour la d\u00e9finition de l'action de r\u00e9tention, car des modifications de la r\u00e8gle de r\u00e9tention sont en cours d'enregistrement. R\u00e9essayez dans quelques minutes. +rm.service.set-id=Impossible de modifier l''ID de {0}, car cet \u00e9l\u00e9ment est en lecture seule. +rm.service.path-node={0} est introuvable. Essayez d''actualiser votre navigateur ou contactez votre DSI. +rm.service.invalid-rm-node=Le n\u0153ud de gestion des archives n''est pas valide, car l''aspect {0} n''est pas pr\u00e9sent. +rm.service.no-root=La racine du site de gestion des archives est introuvable. Essayez d'archiver \u00e0 nouveau le document d'archives. +rm.service.dup-root=Impossible de cr\u00e9er un plan de classification ici, car il en existe d\u00e9j\u00e0 un dans cette hi\u00e9rarchie de dossiers. +rm.service.root-type=Impossible de cr\u00e9er le plan de classification, car le type {0} n''est pas un sous-type de rma:filePlan. R\u00e9essayez avec un type diff\u00e9rent. +rm.service.container-parent-type=Une cat\u00e9gorie de document d'archives peut \u00eatre cr\u00e9\u00e9e uniquement au niveau sup\u00e9rieur du plan de classification ou dans une autre cat\u00e9gorie de document d'archives (rma:recordCategory). +rm.service.container-type=Une cat\u00e9gorie de document d'archives peut \u00eatre cr\u00e9\u00e9e uniquement au niveau sup\u00e9rieur du plan de classification ou dans une autre cat\u00e9gorie de document d'archives (rma:recordsManagementContainer ou sous-type). +rm.service.container-expected=Vous trouverez des contenus de cat\u00e9gorie de document d'archives uniquement dans une cat\u00e9gorie de document d'archives (rma:recordCategory ou sous-type). +rm.service.record-folder-expected=L'action peut \u00eatre effectu\u00e9e uniquement avec un dossier d'archives de type rma:recordFolder. +rm.service.parent-record-folder-root=Impossible de cr\u00e9er un dossier d'archives ici. Essayez de le cr\u00e9er dans une cat\u00e9gorie de document d'archives. +rm.service.parent-record-folder-type=Impossible de cr\u00e9er un dossier d'archives ici. Essayez de le cr\u00e9er dans une cat\u00e9gorie de document d'archives. +rm.service.record-folder-type=Impossible de cr\u00e9er un dossier d'archives \u00e0 moins d'utiliser le type rma:recordFolder ou un sous-type. +rm.service.not-record=Le n\u0153ud {0} n''est pas un document d''archives. +rm.service.vital-def-missing=L''aspect de d\u00e9finition de document d''archives essentiel n''est pas pr\u00e9sent sur le n\u0153ud. (nodeRef={0}) +rm.service.close-record-folder-not-folder=Le dossier d''archives n''a pas pu \u00eatre ferm\u00e9, car il n''est pas d\u00e9fini comme dossier d''archives.(nodeRef={0}) +rm.service.node-has-aspect=Le type de document d''archives {1} est d\u00e9j\u00e0 affich\u00e9 pour le document d''archives {0}. +rm.service.final-version=Finale rm.service.final-version-description=Version finale du document archiv\u00e9 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties index f5bb088504..868d68aa01 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=\u00c8 possibile archiviare i record solo in cartelle di record. -rm.service.update-disposition-action-def=Impossibile aggiornare la definizione dell'azione di conservazione poich\u00e9 le modifiche effettuate al programma di conservazione vengono salvate. Riprovare tra alcuni minuti. -rm.service.set-id=Impossibile modificare l''ID di {0} poich\u00e9 \u00e8 di sola lettura. -rm.service.path-node=Impossibile trovare {0}. Provare ad aggiornare il browser o contattare il proprio dipartimento I.T. I.T. -rm.service.invalid-rm-node=Il nodo di gestione dei record non \u00e8 valido poich\u00e9 l''aspetto {0} non \u00e8 presente. -rm.service.no-root=Impossibile trovare la radice di Records Management. Provare ad archiviare nuovamente il record. -rm.service.dup-root=Impossibile creare un piano file qui poich\u00e9 nella gerarchia di questa cartella ne \u00e8 gi\u00e0 stato creato uno. -rm.service.root-type=Impossibile creare il piano file poich\u00e9 il tipo {0} non \u00e8 un sottotipo di rma:filePlan. Prova ancora usando un dipo differente. -rm.service.container-parent-type=\u00c8 possibile solo creare una categoria di record nel livello superiore del piano file o in un'altra categoria di record (rma:recordCategory). -rm.service.container-type=\u00c8 possibile solo creare una categoria di record nel livello superiore del piano file o in un'altra categoria di record (rma:recordsManagementContainer o sottotipo). -rm.service.container-expected=\u00c8 possibile trovare i contenuti di una categoria di record solo in una categoria di record (rma:recordCategory o sottotipo). -rm.service.record-folder-expected=L'azione pu\u00f2 essere completata solo utilizzando una cartella di record del tipo rma:recordFolder. -rm.service.parent-record-folder-root=Impossibile creare una cartella di record qui. Provare a crearla in un'altra categoria di record. -rm.service.parent-record-folder-type=Impossibile creare una cartella di record qui. Provare a crearla in un'altra categoria di record. -rm.service.record-folder-type=Impossibile creare una cartella di record a meno che si utilizzi il tipo rma:recordFolder o un sottotipo. -rm.service.not-record=Il nodo {0} non \u00e8 un record. -rm.service.vital-def-missing=L''aspetto di definizione di record fondamentale non \u00e8 presente su nodo. (nodeRef={0}) -rm.service.close-record-folder-not-folder=Non \u00e8 stato possibile chiudere la cartella di record, poich\u00e9 non \u00e8 definita come cartella di record.(nodeRef={0}) -rm.service.node-has-aspect=Il tipo di record {1} sta gi\u00e0 visualizzando per il record {0}. -rm.service.final-version=Finale +rm.service.error-add-content-container=\u00c8 possibile archiviare i record solo in cartelle di record. +rm.service.update-disposition-action-def=Impossibile aggiornare la definizione dell'azione di conservazione poich\u00e9 le modifiche effettuate al programma di conservazione vengono salvate. Riprovare tra alcuni minuti. +rm.service.set-id=Impossibile modificare l''ID di {0} poich\u00e9 \u00e8 di sola lettura. +rm.service.path-node=Impossibile trovare {0}. Provare ad aggiornare il browser o contattare il proprio dipartimento I.T. I.T. +rm.service.invalid-rm-node=Il nodo di gestione dei record non \u00e8 valido poich\u00e9 l''aspetto {0} non \u00e8 presente. +rm.service.no-root=Impossibile trovare la radice di Records Management. Provare ad archiviare nuovamente il record. +rm.service.dup-root=Impossibile creare un piano file qui poich\u00e9 nella gerarchia di questa cartella ne \u00e8 gi\u00e0 stato creato uno. +rm.service.root-type=Impossibile creare il piano file poich\u00e9 il tipo {0} non \u00e8 un sottotipo di rma:filePlan. Prova ancora usando un dipo differente. +rm.service.container-parent-type=\u00c8 possibile solo creare una categoria di record nel livello superiore del piano file o in un'altra categoria di record (rma:recordCategory). +rm.service.container-type=\u00c8 possibile solo creare una categoria di record nel livello superiore del piano file o in un'altra categoria di record (rma:recordsManagementContainer o sottotipo). +rm.service.container-expected=\u00c8 possibile trovare i contenuti di una categoria di record solo in una categoria di record (rma:recordCategory o sottotipo). +rm.service.record-folder-expected=L'azione pu\u00f2 essere completata solo utilizzando una cartella di record del tipo rma:recordFolder. +rm.service.parent-record-folder-root=Impossibile creare una cartella di record qui. Provare a crearla in un'altra categoria di record. +rm.service.parent-record-folder-type=Impossibile creare una cartella di record qui. Provare a crearla in un'altra categoria di record. +rm.service.record-folder-type=Impossibile creare una cartella di record a meno che si utilizzi il tipo rma:recordFolder o un sottotipo. +rm.service.not-record=Il nodo {0} non \u00e8 un record. +rm.service.vital-def-missing=L''aspetto di definizione di record fondamentale non \u00e8 presente su nodo. (nodeRef={0}) +rm.service.close-record-folder-not-folder=Non \u00e8 stato possibile chiudere la cartella di record, poich\u00e9 non \u00e8 definita come cartella di record.(nodeRef={0}) +rm.service.node-has-aspect=Il tipo di record {1} sta gi\u00e0 visualizzando per il record {0}. +rm.service.final-version=Finale rm.service.final-version-description=Versione del record archiviata finale \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties index bb41193a0a..de19a21bbd 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=\u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1\u5148\u306b\u4f7f\u7528\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3067\u3059\u3002 -rm.service.update-disposition-action-def=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306e\u5909\u66f4\u3092\u4fdd\u5b58\u4e2d\u306e\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u3092\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 \u6570\u5206\u5f8c\u306b\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.set-id=''{0}'' \u306f\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u305f\u3081\u3001ID \u3092\u5909\u66f4\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.path-node=''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 \u30d6\u30e9\u30a6\u30b6\u3092\u518d\u8aad\u307f\u8fbc\u307f\u3059\u308b\u304b\u3001IT \u62c5\u5f53\u8005\u306b\u9023\u7d61\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.invalid-rm-node=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30ce\u30fc\u30c9\u306b\u306f\u30a2\u30b9\u30da\u30af\u30c8 ''{0}'' \u304c\u306a\u3044\u305f\u3081\u3001\u7121\u52b9\u3067\u3059\u3002 -rm.service.no-root=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.dup-root=\u3053\u306e\u30d5\u30a9\u30eb\u30c0\u968e\u5c64\u306b\u306f\u3059\u3067\u306b\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u304c 1 \u3064\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.root-type=\u30bf\u30a4\u30d7 ''{0}'' \u306f rma:filePlan \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 \u5225\u306e\u30bf\u30a4\u30d7\u3092\u4f7f\u3063\u3066\u3001\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.container-parent-type=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306f\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u6700\u4e0a\u4f4d\u304b\u3001\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordCategory) \u5185\u306b\u3057\u304b\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.container-type=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306f\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u6700\u4e0a\u4f4d\u304b\u3001\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordsManagementContainer or sub-type) \u5185\u306b\u3057\u304b\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.container-expected=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordCategory or sub-type) \u5185\u3067\u3057\u304b\u691c\u7d22\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.record-folder-expected=\u3053\u306e\u51e6\u7406\u3092\u5b8c\u4e86\u3059\u308b\u306b\u306f\u3001rma:recordFolder \u30bf\u30a4\u30d7\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 -rm.service.parent-record-folder-root=\u3053\u3053\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u5185\u3067\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.parent-record-folder-type=\u3053\u3053\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u5185\u3067\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -rm.service.record-folder-type=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001rma:recordFolder \u30bf\u30a4\u30d7\u307e\u305f\u306f\u30b5\u30d6\u30bf\u30a4\u30d7\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 -rm.service.not-record=\u30ce\u30fc\u30c9 ''{0}'' \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 -rm.service.vital-def-missing=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u30a2\u30b9\u30da\u30af\u30c8\u304c\u30ce\u30fc\u30c9\u306b\u5b58\u5728\u3057\u307e\u305b\u3093\u3002 (nodeRef={0}) -rm.service.close-record-folder-not-folder=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3068\u3057\u3066\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u9589\u3058\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={0}) -rm.service.node-has-aspect=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7 ''{1}'' \u306f\u3059\u3067\u306b\u30ec\u30b3\u30fc\u30c9 ''{0}'' \u306e\u3082\u306e\u3068\u3057\u3066\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002 -rm.service.final-version=\u6700\u7d42\u7248 +rm.service.error-add-content-container=\u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1\u5148\u306b\u4f7f\u7528\u3067\u304d\u308b\u306e\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3067\u3059\u3002 +rm.service.update-disposition-action-def=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306e\u5909\u66f4\u3092\u4fdd\u5b58\u4e2d\u306e\u305f\u3081\u3001\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9\u3092\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 \u6570\u5206\u5f8c\u306b\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.service.set-id=''{0}'' \u306f\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u305f\u3081\u3001ID \u3092\u5909\u66f4\u3067\u304d\u307e\u305b\u3093\u3002 +rm.service.path-node=''{0}'' \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 \u30d6\u30e9\u30a6\u30b6\u3092\u518d\u8aad\u307f\u8fbc\u307f\u3059\u308b\u304b\u3001IT \u62c5\u5f53\u8005\u306b\u9023\u7d61\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.service.invalid-rm-node=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30ce\u30fc\u30c9\u306b\u306f\u30a2\u30b9\u30da\u30af\u30c8 ''{0}'' \u304c\u306a\u3044\u305f\u3081\u3001\u7121\u52b9\u3067\u3059\u3002 +rm.service.no-root=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.service.dup-root=\u3053\u306e\u30d5\u30a9\u30eb\u30c0\u968e\u5c64\u306b\u306f\u3059\u3067\u306b\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u304c 1 \u3064\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 +rm.service.root-type=\u30bf\u30a4\u30d7 ''{0}'' \u306f rma:filePlan \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 \u5225\u306e\u30bf\u30a4\u30d7\u3092\u4f7f\u3063\u3066\u3001\u64cd\u4f5c\u3092\u3084\u308a\u76f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.service.container-parent-type=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306f\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u6700\u4e0a\u4f4d\u304b\u3001\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordCategory) \u5185\u306b\u3057\u304b\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 +rm.service.container-type=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306f\u3001\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u306e\u6700\u4e0a\u4f4d\u304b\u3001\u5225\u306e\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordsManagementContainer or sub-type) \u5185\u306b\u3057\u304b\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 +rm.service.container-expected=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u3001\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea (rma:recordCategory or sub-type) \u5185\u3067\u3057\u304b\u691c\u7d22\u3067\u304d\u307e\u305b\u3093\u3002 +rm.service.record-folder-expected=\u3053\u306e\u51e6\u7406\u3092\u5b8c\u4e86\u3059\u308b\u306b\u306f\u3001rma:recordFolder \u30bf\u30a4\u30d7\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +rm.service.parent-record-folder-root=\u3053\u3053\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u5185\u3067\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.service.parent-record-folder-type=\u3053\u3053\u306b\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea\u5185\u3067\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +rm.service.record-folder-type=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001rma:recordFolder \u30bf\u30a4\u30d7\u307e\u305f\u306f\u30b5\u30d6\u30bf\u30a4\u30d7\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 +rm.service.not-record=\u30ce\u30fc\u30c9 ''{0}'' \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 +rm.service.vital-def-missing=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u30a2\u30b9\u30da\u30af\u30c8\u304c\u30ce\u30fc\u30c9\u306b\u5b58\u5728\u3057\u307e\u305b\u3093\u3002 (nodeRef={0}) +rm.service.close-record-folder-not-folder=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3068\u3057\u3066\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u9589\u3058\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 (nodeRef={0}) +rm.service.node-has-aspect=\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7 ''{1}'' \u306f\u3059\u3067\u306b\u30ec\u30b3\u30fc\u30c9 ''{0}'' \u306e\u3082\u306e\u3068\u3057\u3066\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002 +rm.service.final-version=\u6700\u7d42\u7248 rm.service.final-version-description=\u30ec\u30b3\u30fc\u30c9\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u6e08\u307f\u6700\u7d42\u30d0\u30fc\u30b8\u30e7\u30f3 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties index a23052c3f9..239c3af449 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=Du kan bare arkivere oppf\u00f8ringer i en oppf\u00f8ringsmappe. -rm.service.update-disposition-action-def=Definisjonen av retensjonshandlingen kan ikke oppdateres fordi endringene som ble gjort i retensjonsplanen lagres. Pr\u00f8v igjen om noen f\u00e5 minutter. -rm.service.set-id=ID-en til {0} kan ikke endres fordi den er skrivebeskyttet. -rm.service.path-node=Kunne ikke finne {0}. Pr\u00f8v \u00e5 oppdatere nettleseren, eller kontakt din IT- avdeling. -rm.service.invalid-rm-node=Oppf\u00f8ringsh\u00e5ndteringsnoden er ikke gyldig fordi aspektet {0} ikke finnes. -rm.service.no-root=Kunne ikke finne oppf\u00f8ringsh\u00e5ndteringsroten. Fors\u00f8k \u00e5 registrere oppf\u00f8ringen p\u00e5 nytt. -rm.service.dup-root=En filplan kan ikke opprettes her fordi det finnes allerede en filplan i dette mappehierarkiet. -rm.service.root-type=Kunne ikke opprette en filplan fordi typen {0} er ikke en undertype av rma:filePlan. Pr\u00f8v igjen med en annen type. -rm.service.container-parent-type=Du kan bare opprette en oppf\u00f8ringskategori p\u00e5 filplanens toppniv\u00e5 eller i en annen oppf\u00f8ringskategori (rma:recordCategory). -rm.service.container-type=Du kan bare opprette en oppf\u00f8ringskategori p\u00e5 filplanens toppniv\u00e5 eller i en annen oppf\u00f8ringskategori (rma:recordsManagementContainer eller undertype). -rm.service.container-expected=Du finner bare innholdet til overf\u00f8ringskategorien i en oppf\u00f8ringskategori (rma:recordCategory eller undertype). -rm.service.record-folder-expected=Handlingen kan bare fullf\u00f8resmed en oppf\u00f8ringsmappe av typen rma:recordFolder. -rm.service.parent-record-folder-root=En oppf\u00f8ringsmappen kan ikke opprettes her. Pr\u00f8v \u00e5 opprette den i en oppf\u00f8ringskategori. -rm.service.parent-record-folder-type=En oppf\u00f8ringsmappen kan ikke opprettes her. Pr\u00f8v \u00e5 opprette den i en oppf\u00f8ringskategori. -rm.service.record-folder-type=Det kan ikke opprettes en oppf\u00f8ringsmappe med mindre du bruker typen rma:recordFolder eller en undertype. -rm.service.not-record=Noden {0} er ikke en oppf\u00f8ring. -rm.service.vital-def-missing=Aspektet ved definisjonen til sv\u00e6rt viktige oppf\u00f8ringer finnes ikke p\u00e5 noden. (nodeRef={0}) -rm.service.close-record-folder-not-folder=Oppf\u00f8ringsmappen kan ikke lukkes fordi den ikke er definert som en oppf\u00f8ringsmappe.(nodeRef={0}) -rm.service.node-has-aspect=Oppf\u00f8ringstypen {1} vises allerede i oppf\u00f8ringen {0}. -rm.service.final-version=Endelig +rm.service.error-add-content-container=Du kan bare arkivere oppf\u00f8ringer i en oppf\u00f8ringsmappe. +rm.service.update-disposition-action-def=Definisjonen av retensjonshandlingen kan ikke oppdateres fordi endringene som ble gjort i retensjonsplanen lagres. Pr\u00f8v igjen om noen f\u00e5 minutter. +rm.service.set-id=ID-en til {0} kan ikke endres fordi den er skrivebeskyttet. +rm.service.path-node=Kunne ikke finne {0}. Pr\u00f8v \u00e5 oppdatere nettleseren, eller kontakt din IT- avdeling. +rm.service.invalid-rm-node=Oppf\u00f8ringsh\u00e5ndteringsnoden er ikke gyldig fordi aspektet {0} ikke finnes. +rm.service.no-root=Kunne ikke finne oppf\u00f8ringsh\u00e5ndteringsroten. Fors\u00f8k \u00e5 registrere oppf\u00f8ringen p\u00e5 nytt. +rm.service.dup-root=En filplan kan ikke opprettes her fordi det finnes allerede en filplan i dette mappehierarkiet. +rm.service.root-type=Kunne ikke opprette en filplan fordi typen {0} er ikke en undertype av rma:filePlan. Pr\u00f8v igjen med en annen type. +rm.service.container-parent-type=Du kan bare opprette en oppf\u00f8ringskategori p\u00e5 filplanens toppniv\u00e5 eller i en annen oppf\u00f8ringskategori (rma:recordCategory). +rm.service.container-type=Du kan bare opprette en oppf\u00f8ringskategori p\u00e5 filplanens toppniv\u00e5 eller i en annen oppf\u00f8ringskategori (rma:recordsManagementContainer eller undertype). +rm.service.container-expected=Du finner bare innholdet til overf\u00f8ringskategorien i en oppf\u00f8ringskategori (rma:recordCategory eller undertype). +rm.service.record-folder-expected=Handlingen kan bare fullf\u00f8resmed en oppf\u00f8ringsmappe av typen rma:recordFolder. +rm.service.parent-record-folder-root=En oppf\u00f8ringsmappen kan ikke opprettes her. Pr\u00f8v \u00e5 opprette den i en oppf\u00f8ringskategori. +rm.service.parent-record-folder-type=En oppf\u00f8ringsmappen kan ikke opprettes her. Pr\u00f8v \u00e5 opprette den i en oppf\u00f8ringskategori. +rm.service.record-folder-type=Det kan ikke opprettes en oppf\u00f8ringsmappe med mindre du bruker typen rma:recordFolder eller en undertype. +rm.service.not-record=Noden {0} er ikke en oppf\u00f8ring. +rm.service.vital-def-missing=Aspektet ved definisjonen til sv\u00e6rt viktige oppf\u00f8ringer finnes ikke p\u00e5 noden. (nodeRef={0}) +rm.service.close-record-folder-not-folder=Oppf\u00f8ringsmappen kan ikke lukkes fordi den ikke er definert som en oppf\u00f8ringsmappe.(nodeRef={0}) +rm.service.node-has-aspect=Oppf\u00f8ringstypen {1} vises allerede i oppf\u00f8ringen {0}. +rm.service.final-version=Endelig rm.service.final-version-description=Den endelig arkiverte oppf\u00f8ringsversjonen \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties index 5795df641e..af5d8602e1 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=U kunt records alleen archiveren in een archiefmap. -rm.service.update-disposition-action-def=U kunt de definitie van de retentieactie niet bijwerken omdat er wijzigingen in het retentieschema worden opgeslagen. Probeer het over een paar minuten opnieuw. -rm.service.set-id=U kunt de id van {0} niet wijzigen omdat dit de eigenschap Alleen-lezen heeft. -rm.service.path-node=Kan {0} niet vinden. Vernieuw de browser of neem contact op met uw IT- afdeling -rm.service.invalid-rm-node=De node voor Records Management is niet geldig omdat het aspect {0} niet aanwezig is. -rm.service.no-root=Kan de Records Management-oorsprong niet vinden. Probeer de record opnieuw te archiveren. -rm.service.dup-root=U kunt hier geen ordeningsplan maken omdat er al een is gemaakt in deze maphi\u00ebrarchie. -rm.service.root-type=Kan het ordeningsplan niet maken omdat type {0} geen subtype is van rma:filePlan. Probeer het opnieuw met een ander type. -rm.service.container-parent-type=U kunt alleen een recordcategorie maken op het hoogste niveau van het ordeningsplan of in een andere recordcategorie (rma:recordCategory). -rm.service.container-type=U kunt alleen een recordcategorie maken op het hoogste niveau van het ordeningsplan of in een andere recordcategorie (rma:recordsManagementContainer of subtype). -rm.service.container-expected=U kunt alleen recordcategoriecontent vinden in een recordcategorie (rma:recordCategory of subtype). -rm.service.record-folder-expected=De actie kan alleen worden afgerond met behulp van een archiefmap van het type rma:recordFolder. -rm.service.parent-record-folder-root=U kunt hier geen archiefmap maken. Probeer de map te maken in een recordcategorie. -rm.service.parent-record-folder-type=U kunt hier geen archiefmap maken. Probeer de map te maken in een recordcategorie. -rm.service.record-folder-type=Kan geen archiefmap maken tenzij u het type rma:recordFolder of een subtype gebruikt. -rm.service.not-record=De node {0} is geen record. -rm.service.vital-def-missing=Definitie-aspect van vitale record is niet aanwezig op node. (nodeRef={0}) -rm.service.close-record-folder-not-folder=De archiefmap kan niet worden gesloten omdat hij niet als een archiefmap is gedefinieerd.(nodeRef={0}) -rm.service.node-has-aspect=Het recordtype {1} wordt al weergegeven voor record {0}. -rm.service.final-version=Definitief +rm.service.error-add-content-container=U kunt records alleen archiveren in een archiefmap. +rm.service.update-disposition-action-def=U kunt de definitie van de retentieactie niet bijwerken omdat er wijzigingen in het retentieschema worden opgeslagen. Probeer het over een paar minuten opnieuw. +rm.service.set-id=U kunt de id van {0} niet wijzigen omdat dit de eigenschap Alleen-lezen heeft. +rm.service.path-node=Kan {0} niet vinden. Vernieuw de browser of neem contact op met uw IT- afdeling +rm.service.invalid-rm-node=De node voor Records Management is niet geldig omdat het aspect {0} niet aanwezig is. +rm.service.no-root=Kan de Records Management-oorsprong niet vinden. Probeer de record opnieuw te archiveren. +rm.service.dup-root=U kunt hier geen ordeningsplan maken omdat er al een is gemaakt in deze maphi\u00ebrarchie. +rm.service.root-type=Kan het ordeningsplan niet maken omdat type {0} geen subtype is van rma:filePlan. Probeer het opnieuw met een ander type. +rm.service.container-parent-type=U kunt alleen een recordcategorie maken op het hoogste niveau van het ordeningsplan of in een andere recordcategorie (rma:recordCategory). +rm.service.container-type=U kunt alleen een recordcategorie maken op het hoogste niveau van het ordeningsplan of in een andere recordcategorie (rma:recordsManagementContainer of subtype). +rm.service.container-expected=U kunt alleen recordcategoriecontent vinden in een recordcategorie (rma:recordCategory of subtype). +rm.service.record-folder-expected=De actie kan alleen worden afgerond met behulp van een archiefmap van het type rma:recordFolder. +rm.service.parent-record-folder-root=U kunt hier geen archiefmap maken. Probeer de map te maken in een recordcategorie. +rm.service.parent-record-folder-type=U kunt hier geen archiefmap maken. Probeer de map te maken in een recordcategorie. +rm.service.record-folder-type=Kan geen archiefmap maken tenzij u het type rma:recordFolder of een subtype gebruikt. +rm.service.not-record=De node {0} is geen record. +rm.service.vital-def-missing=Definitie-aspect van vitale record is niet aanwezig op node. (nodeRef={0}) +rm.service.close-record-folder-not-folder=De archiefmap kan niet worden gesloten omdat hij niet als een archiefmap is gedefinieerd.(nodeRef={0}) +rm.service.node-has-aspect=Het recordtype {1} wordt al weergegeven voor record {0}. +rm.service.final-version=Definitief rm.service.final-version-description=De definitieve gearchiveerde recordversie \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties index 0dd40a4880..a23a48eedf 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=\u00c9 poss\u00edvel arquivar somente documentos arquiv\u00edsticos em uma pasta de documentos arquiv\u00edsticos. -rm.service.update-disposition-action-def=N\u00e3o \u00e9 poss\u00edvel atualizar a defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o, pois as altera\u00e7\u00f5es feitas na programa\u00e7\u00e3o de reten\u00e7\u00e3o est\u00e3o sendo salvas. Tente novamente em alguns minutos. -rm.service.set-id=N\u00e3o \u00e9 poss\u00edvel alterar o ID de {0}, pois \u00e9 somente leitura. -rm.service.path-node=N\u00e3o foi poss\u00edvel localizar {0}. Tente atualizar seu navegador ou entre em contato com o Dept. de TI. -rm.service.invalid-rm-node=O n\u00f3 do Records Management n\u00e3o \u00e9 v\u00e1lido, pois o aspecto {0} n\u00e3o est\u00e1 presente. -rm.service.no-root=N\u00e3o foi poss\u00edvel localizar a raiz do Records Management. Tente arquivar o documento arquiv\u00edstico novamente. -rm.service.dup-root=N\u00e3o \u00e9 poss\u00edvel criar um plano de arquivo aqui, pois j\u00e1 h\u00e1 um criado nessa hierarquia de pastas. -rm.service.root-type=N\u00e3o \u00e9 poss\u00edvel criar o plano de arquivo, pois o tipo {0} n\u00e3o \u00e9 um subtipo de rma:filePlan. Tente novamente usando um tipo diferente. -rm.service.container-parent-type=Voc\u00ea s\u00f3 pode criar uma categoria de documento arquiv\u00edstico no n\u00edvel superior do plano de arquivo ou em outra categoria de documento arquiv\u00edstico (rma:recordCategory). -rm.service.container-type=Voc\u00ea s\u00f3 pode criar uma categoria de documento arquiv\u00edstico no n\u00edvel superior do plano de arquivo ou em outra categoria de documento arquiv\u00edstico (rma:recordsManagementContainer ou subtipo). -rm.service.container-expected=Voc\u00ea s\u00f3 pode encontrar conte\u00fado de categoria de documento arquiv\u00edstico em uma categoria de documento arquiv\u00edstico (rma:recordCategory ou subtipo). -rm.service.record-folder-expected=A a\u00e7\u00e3o somente pode ser conclu\u00edda usando uma pasta de documento arquiv\u00edstico do tipo rma:recordFolder. -rm.service.parent-record-folder-root=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico aqui. Tente cri\u00e1-la em uma categoria de documento arquiv\u00edstico. -rm.service.parent-record-folder-type=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico aqui. Tente cri\u00e1-la em uma categoria de documento arquiv\u00edstico. -rm.service.record-folder-type=N\u00e3o podemos criar uma pasta de documento arquiv\u00edstico, a menos que voc\u00ea use o tipo rma:recordFolder ou um subtipo. -rm.service.not-record=O n\u00f3 {0} n\u00e3o \u00e9 um documento arquiv\u00edstico. -rm.service.vital-def-missing=O aspecto de defini\u00e7\u00e3o do documento arquiv\u00edstico vital n\u00e3o est\u00e1 presente no n\u00f3. (nodeRef={0}) -rm.service.close-record-folder-not-folder=N\u00e3o foi poss\u00edvel fechar a pasta de documento arquiv\u00edstico porque ela n\u00e3o est\u00e1 definida como uma pasta de documento arquiv\u00edstico.(nodeRef={0}) -rm.service.node-has-aspect=O tipo de documento arquiv\u00edstico {1} j\u00e1 est\u00e1 sendo mostrado para o documento arquiv\u00edstico {0}. -rm.service.final-version=Final +rm.service.error-add-content-container=\u00c9 poss\u00edvel arquivar somente documentos arquiv\u00edsticos em uma pasta de documentos arquiv\u00edsticos. +rm.service.update-disposition-action-def=N\u00e3o \u00e9 poss\u00edvel atualizar a defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o, pois as altera\u00e7\u00f5es feitas na programa\u00e7\u00e3o de reten\u00e7\u00e3o est\u00e3o sendo salvas. Tente novamente em alguns minutos. +rm.service.set-id=N\u00e3o \u00e9 poss\u00edvel alterar o ID de {0}, pois \u00e9 somente leitura. +rm.service.path-node=N\u00e3o foi poss\u00edvel localizar {0}. Tente atualizar seu navegador ou entre em contato com o Dept. de TI. +rm.service.invalid-rm-node=O n\u00f3 do Records Management n\u00e3o \u00e9 v\u00e1lido, pois o aspecto {0} n\u00e3o est\u00e1 presente. +rm.service.no-root=N\u00e3o foi poss\u00edvel localizar a raiz do Records Management. Tente arquivar o documento arquiv\u00edstico novamente. +rm.service.dup-root=N\u00e3o \u00e9 poss\u00edvel criar um plano de arquivo aqui, pois j\u00e1 h\u00e1 um criado nessa hierarquia de pastas. +rm.service.root-type=N\u00e3o \u00e9 poss\u00edvel criar o plano de arquivo, pois o tipo {0} n\u00e3o \u00e9 um subtipo de rma:filePlan. Tente novamente usando um tipo diferente. +rm.service.container-parent-type=Voc\u00ea s\u00f3 pode criar uma categoria de documento arquiv\u00edstico no n\u00edvel superior do plano de arquivo ou em outra categoria de documento arquiv\u00edstico (rma:recordCategory). +rm.service.container-type=Voc\u00ea s\u00f3 pode criar uma categoria de documento arquiv\u00edstico no n\u00edvel superior do plano de arquivo ou em outra categoria de documento arquiv\u00edstico (rma:recordsManagementContainer ou subtipo). +rm.service.container-expected=Voc\u00ea s\u00f3 pode encontrar conte\u00fado de categoria de documento arquiv\u00edstico em uma categoria de documento arquiv\u00edstico (rma:recordCategory ou subtipo). +rm.service.record-folder-expected=A a\u00e7\u00e3o somente pode ser conclu\u00edda usando uma pasta de documento arquiv\u00edstico do tipo rma:recordFolder. +rm.service.parent-record-folder-root=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico aqui. Tente cri\u00e1-la em uma categoria de documento arquiv\u00edstico. +rm.service.parent-record-folder-type=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de documento arquiv\u00edstico aqui. Tente cri\u00e1-la em uma categoria de documento arquiv\u00edstico. +rm.service.record-folder-type=N\u00e3o podemos criar uma pasta de documento arquiv\u00edstico, a menos que voc\u00ea use o tipo rma:recordFolder ou um subtipo. +rm.service.not-record=O n\u00f3 {0} n\u00e3o \u00e9 um documento arquiv\u00edstico. +rm.service.vital-def-missing=O aspecto de defini\u00e7\u00e3o do documento arquiv\u00edstico vital n\u00e3o est\u00e1 presente no n\u00f3. (nodeRef={0}) +rm.service.close-record-folder-not-folder=N\u00e3o foi poss\u00edvel fechar a pasta de documento arquiv\u00edstico porque ela n\u00e3o est\u00e1 definida como uma pasta de documento arquiv\u00edstico.(nodeRef={0}) +rm.service.node-has-aspect=O tipo de documento arquiv\u00edstico {1} j\u00e1 est\u00e1 sendo mostrado para o documento arquiv\u00edstico {0}. +rm.service.final-version=Final rm.service.final-version-description=A vers\u00e3o do documento arquiv\u00edstico arquivado final \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties index 05b55382f3..f5b889cae4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.service.update-disposition-action-def=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e: \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442. -rm.service.set-id=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 {0}: \u043e\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. -rm.service.path-node=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 {0}. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 IT- \u043e\u0442\u0434\u0435\u043b. -rm.service.invalid-rm-node=\u0423\u0437\u0435\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043d\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. -rm.service.no-root=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e. -rm.service.dup-root=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043f\u0430\u043f\u043e\u043a \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0430\u0440\u0445\u0438\u0432. -rm.service.root-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432: \u0442\u0438\u043f {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u043c rma:filePlan. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0438\u043f. -rm.service.container-parent-type=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u044b\u0441\u0448\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u0440\u0445\u0438\u0432\u0430 \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordCategory). -rm.service.container-type=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u044b\u0441\u0448\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u0440\u0445\u0438\u0432\u0430 \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordsManagementContainer \u0438\u043b\u0438 \u0435\u0435 \u043f\u043e\u0434\u0442\u0438\u043f). -rm.service.container-expected=\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordCategory \u0438\u043b\u0438 \u0435\u0435 \u043f\u043e\u0434\u0442\u0438\u043f). -rm.service.record-folder-expected=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0438\u043f\u0430 rma:recordFolder. -rm.service.parent-record-folder-root=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0435 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.service.parent-record-folder-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0435 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. -rm.service.record-folder-type=\u041f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0438\u043f\u0430 rma:recordFolder \u0438\u043b\u0438 \u0435\u0433\u043e \u043f\u043e\u0434\u0442\u0438\u043f\u0430. -rm.service.not-record=\u041e\u0431\u044a\u0435\u043a\u0442 {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. -rm.service.vital-def-missing=\u0414\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0441\u043f\u0435\u043a\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. (nodeRef={0}) -rm.service.close-record-folder-not-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439: \u043f\u0430\u043f\u043a\u0430 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. (nodeRef={0}) -rm.service.node-has-aspect=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u0438\u043f\u0430 {1} \u0443\u0436\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 {0}. -rm.service.final-version=\u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f +rm.service.error-add-content-container=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. +rm.service.update-disposition-action-def=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e: \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442. +rm.service.set-id=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 {0}: \u043e\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. +rm.service.path-node=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 {0}. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 IT- \u043e\u0442\u0434\u0435\u043b. +rm.service.invalid-rm-node=\u0423\u0437\u0435\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043d\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. +rm.service.no-root=\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e. +rm.service.dup-root=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432: \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043f\u0430\u043f\u043e\u043a \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0430\u0440\u0445\u0438\u0432. +rm.service.root-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432: \u0442\u0438\u043f {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u043c rma:filePlan. \u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0438\u043f. +rm.service.container-parent-type=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u044b\u0441\u0448\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u0440\u0445\u0438\u0432\u0430 \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordCategory). +rm.service.container-type=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u044b\u0441\u0448\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u0440\u0445\u0438\u0432\u0430 \u0438\u043b\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordsManagementContainer \u0438\u043b\u0438 \u0435\u0435 \u043f\u043e\u0434\u0442\u0438\u043f). +rm.service.container-expected=\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (rma:recordCategory \u0438\u043b\u0438 \u0435\u0435 \u043f\u043e\u0434\u0442\u0438\u043f). +rm.service.record-folder-expected=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0438\u043f\u0430 rma:recordFolder. +rm.service.parent-record-folder-root=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0435 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. +rm.service.parent-record-folder-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0435 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. +rm.service.record-folder-type=\u041f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0438\u043f\u0430 rma:recordFolder \u0438\u043b\u0438 \u0435\u0433\u043e \u043f\u043e\u0434\u0442\u0438\u043f\u0430. +rm.service.not-record=\u041e\u0431\u044a\u0435\u043a\u0442 {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. +rm.service.vital-def-missing=\u0414\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0441\u043f\u0435\u043a\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. (nodeRef={0}) +rm.service.close-record-folder-not-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439: \u043f\u0430\u043f\u043a\u0430 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. (nodeRef={0}) +rm.service.node-has-aspect=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u0438\u043f\u0430 {1} \u0443\u0436\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 {0}. +rm.service.final-version=\u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f rm.service.final-version-description=\u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0430\u0440\u0445\u0438\u0432\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties index 8ee0abb6f6..dcd666aa37 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties @@ -1,21 +1,21 @@ -rm.service.error-add-content-container=\u60a8\u667a\u80fd\u5c06\u8bb0\u5f55\u7acb\u5377\u5230\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.service.update-disposition-action-def=\u60a8\u65e0\u6cd5\u66f4\u65b0\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\uff0c\u56e0\u4e3a\u4fdd\u7559\u8ba1\u5212\u7684\u66f4\u6539\u6b63\u5728\u4fdd\u5b58\u4e2d\u3002 \u8bf7\u5728\u51e0\u5206\u949f\u540e\u91cd\u8bd5\u3002 -rm.service.set-id=\u60a8\u65e0\u6cd5\u66f4\u6539 {0} \u7684 ID\uff0c\u56e0\u4e3a\u5b83\u4e3a\u53ea\u8bfb\u3002 -rm.service.path-node=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e {0}\u3002 \u8bf7\u5c1d\u8bd5\u5237\u65b0\u60a8\u7684\u6d4f\u89c8\u5668\u6216\u8054\u7cfb\u60a8\u7684 IT \u90e8\u95e8\u3002 -rm.service.invalid-rm-node=\u8bb0\u5f55\u7ba1\u7406\u8282\u70b9\u65e0\u6548\uff0c\u56e0\u4e3a\u5207\u9762 {0} \u4e0d\u5b58\u5728\u3002 -rm.service.no-root=\u6211\u4eec\u627e\u4e0d\u5230\u8bb0\u5f55\u7ba1\u7406\u5de5\u5177\u3002 \u8bf7\u91cd\u65b0\u5bf9\u8bb0\u5f55\u7acb\u5377\u3002 -rm.service.dup-root=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u5f52\u7c7b\u65b9\u6848\uff0c\u56e0\u4e3a\u6b64\u6587\u4ef6\u5939\u5c42\u6b21\u7ed3\u6784\u4e2d\u5df2\u5b58\u5728\u521b\u5efa\u7684\u5f52\u7c7b\u65b9\u6848\u3002 -rm.service.root-type=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u5f52\u7c7b\u65b9\u6848\uff0c\u56e0\u4e3a\u7c7b\u578b {0} \u4e0d\u662f rma:filePlan \u7684\u5b50\u7c7b\u578b\u3002 \u4f7f\u7528\u4e0d\u540c\u7684\u7c7b\u578b\u91cd\u8bd5\u3002 -rm.service.container-parent-type=\u60a8\u53ea\u80fd\u5728\u5f52\u7c7b\u65b9\u6848\u7684\u9876\u5c42\u6216\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u8bb0\u5f55\u7c7b\u522b (rma:recordCategory)\u3002 -rm.service.container-type=\u60a8\u53ea\u80fd\u5728\u5f52\u7c7b\u65b9\u6848\u7684\u9876\u5c42\u6216\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u8bb0\u5f55\u7c7b\u522b\uff08rma:recordsManagementContainer \u6216\u5b50\u7c7b\u578b\uff09\u3002 -rm.service.container-expected=\u60a8\u53ea\u80fd\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u67e5\u627e\u8bb0\u5f55\u7c7b\u522b\u5185\u5bb9\uff08rma:recordCategory \u6216\u5b50\u7c7b\u578b\uff09\u3002 -rm.service.record-folder-expected=\u8be5\u64cd\u4f5c\u53ea\u80fd\u4f7f\u7528 rma:recordFolder \u7c7b\u578b\u7684\u8bb0\u5f55\u6587\u4ef6\u5939\u5b8c\u6210\u3002 -rm.service.parent-record-folder-root=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 \u8bf7\u5c1d\u8bd5\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u3002 -rm.service.parent-record-folder-type=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 \u8bf7\u5c1d\u8bd5\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u3002 -rm.service.record-folder-type=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\uff0c\u9664\u975e\u60a8\u4f7f\u7528\u7c7b\u578b rma:recordFolder \u6216\u5b50\u7c7b\u578b\u3002 -rm.service.not-record=\u8282\u70b9 {0} \u5e76\u975e\u8bb0\u5f55\u3002 -rm.service.vital-def-missing=\u8282\u70b9\u4e0a\u4e0d\u5b58\u5728\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49\u5207\u9762\u3002 (nodeRef={0}) -rm.service.close-record-folder-not-folder=\u65e0\u6cd5\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939\uff0c\u56e0\u4e3a\u5e76\u672a\u5c06\u5176\u5b9a\u4e49\u4e3a\u8bb0\u5f55\u6587\u4ef6\u5939\u3002(nodeRef={0}) -rm.service.node-has-aspect=\u8bb0\u5f55\u7c7b\u578b {1} \u5df2\u4e3a\u8bb0\u5f55 {0} \u663e\u793a\u3002 -rm.service.final-version=\u6700\u7ec8 +rm.service.error-add-content-container=\u60a8\u667a\u80fd\u5c06\u8bb0\u5f55\u7acb\u5377\u5230\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 +rm.service.update-disposition-action-def=\u60a8\u65e0\u6cd5\u66f4\u65b0\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49\uff0c\u56e0\u4e3a\u4fdd\u7559\u8ba1\u5212\u7684\u66f4\u6539\u6b63\u5728\u4fdd\u5b58\u4e2d\u3002 \u8bf7\u5728\u51e0\u5206\u949f\u540e\u91cd\u8bd5\u3002 +rm.service.set-id=\u60a8\u65e0\u6cd5\u66f4\u6539 {0} \u7684 ID\uff0c\u56e0\u4e3a\u5b83\u4e3a\u53ea\u8bfb\u3002 +rm.service.path-node=\u6211\u4eec\u65e0\u6cd5\u67e5\u627e {0}\u3002 \u8bf7\u5c1d\u8bd5\u5237\u65b0\u60a8\u7684\u6d4f\u89c8\u5668\u6216\u8054\u7cfb\u60a8\u7684 IT \u90e8\u95e8\u3002 +rm.service.invalid-rm-node=\u8bb0\u5f55\u7ba1\u7406\u8282\u70b9\u65e0\u6548\uff0c\u56e0\u4e3a\u5207\u9762 {0} \u4e0d\u5b58\u5728\u3002 +rm.service.no-root=\u6211\u4eec\u627e\u4e0d\u5230\u8bb0\u5f55\u7ba1\u7406\u5de5\u5177\u3002 \u8bf7\u91cd\u65b0\u5bf9\u8bb0\u5f55\u7acb\u5377\u3002 +rm.service.dup-root=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u5f52\u7c7b\u65b9\u6848\uff0c\u56e0\u4e3a\u6b64\u6587\u4ef6\u5939\u5c42\u6b21\u7ed3\u6784\u4e2d\u5df2\u5b58\u5728\u521b\u5efa\u7684\u5f52\u7c7b\u65b9\u6848\u3002 +rm.service.root-type=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u5f52\u7c7b\u65b9\u6848\uff0c\u56e0\u4e3a\u7c7b\u578b {0} \u4e0d\u662f rma:filePlan \u7684\u5b50\u7c7b\u578b\u3002 \u4f7f\u7528\u4e0d\u540c\u7684\u7c7b\u578b\u91cd\u8bd5\u3002 +rm.service.container-parent-type=\u60a8\u53ea\u80fd\u5728\u5f52\u7c7b\u65b9\u6848\u7684\u9876\u5c42\u6216\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u8bb0\u5f55\u7c7b\u522b (rma:recordCategory)\u3002 +rm.service.container-type=\u60a8\u53ea\u80fd\u5728\u5f52\u7c7b\u65b9\u6848\u7684\u9876\u5c42\u6216\u5728\u53e6\u4e00\u4e2a\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u8bb0\u5f55\u7c7b\u522b\uff08rma:recordsManagementContainer \u6216\u5b50\u7c7b\u578b\uff09\u3002 +rm.service.container-expected=\u60a8\u53ea\u80fd\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u67e5\u627e\u8bb0\u5f55\u7c7b\u522b\u5185\u5bb9\uff08rma:recordCategory \u6216\u5b50\u7c7b\u578b\uff09\u3002 +rm.service.record-folder-expected=\u8be5\u64cd\u4f5c\u53ea\u80fd\u4f7f\u7528 rma:recordFolder \u7c7b\u578b\u7684\u8bb0\u5f55\u6587\u4ef6\u5939\u5b8c\u6210\u3002 +rm.service.parent-record-folder-root=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 \u8bf7\u5c1d\u8bd5\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u3002 +rm.service.parent-record-folder-type=\u60a8\u65e0\u6cd5\u5728\u6b64\u5904\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 \u8bf7\u5c1d\u8bd5\u5728\u8bb0\u5f55\u7c7b\u522b\u4e2d\u521b\u5efa\u3002 +rm.service.record-folder-type=\u6211\u4eec\u65e0\u6cd5\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u5939\uff0c\u9664\u975e\u60a8\u4f7f\u7528\u7c7b\u578b rma:recordFolder \u6216\u5b50\u7c7b\u578b\u3002 +rm.service.not-record=\u8282\u70b9 {0} \u5e76\u975e\u8bb0\u5f55\u3002 +rm.service.vital-def-missing=\u8282\u70b9\u4e0a\u4e0d\u5b58\u5728\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49\u5207\u9762\u3002 (nodeRef={0}) +rm.service.close-record-folder-not-folder=\u65e0\u6cd5\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939\uff0c\u56e0\u4e3a\u5e76\u672a\u5c06\u5176\u5b9a\u4e49\u4e3a\u8bb0\u5f55\u6587\u4ef6\u5939\u3002(nodeRef={0}) +rm.service.node-has-aspect=\u8bb0\u5f55\u7c7b\u578b {1} \u5df2\u4e3a\u8bb0\u5f55 {0} \u663e\u793a\u3002 +rm.service.final-version=\u6700\u7ec8 rm.service.final-version-description=\u6700\u7ec8\u5b58\u6863\u7684\u8bb0\u5f55\u7248\u672c \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model.properties index 1260a8cb1a..ab689a6057 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=Records Management Content Model - -rma_recordsmanagement.type.rma_rmsite.title=Records Management Site -rma_recordsmanagement.type.rma_rmsite.description=Specialized Site for Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Security Controls Configuration -rma_recordsmanagement.type.rma_caveatConfig.decription=Security Controls Configuration - -rma_recordsmanagement.type.rma_emailConfig.title=Email Configuration -rma_recordsmanagement.type.rma_emailConfig.decription=Email Configuration - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Records Management Container -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Records Management Container - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Records Management Root Container -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Records Management Root Container - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Retention Schedule -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retention Schedule - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Retention Authority -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retention Authority - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Retention Instructions -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retention Instructions - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Record Level Retention -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Record Level Retention - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retention Actions -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retention Actions - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Retention Action Definition -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Retention Action Definition -rma_recordsmanagement.property.rma_dispositionActionName.title=Retention Action Name -rma_recordsmanagement.property.rma_dispositionActionName.decription=Retention Action Name -rma_recordsmanagement.property.rma_dispositionDescription.title=Retention Description -rma_recordsmanagement.property.rma_dispositionDescription.decription=Retention Description -rma_recordsmanagement.property.rma_dispositionLocation.title=Retention Location -rma_recordsmanagement.property.rma_dispositionLocation.decription=Retention Location -rma_recordsmanagement.property.rma_dispositionPeriod.title=Retention Period -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retention Period -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Retention Period Property -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Retention Period Property -rma_recordsmanagement.property.rma_dispositionEvent.title=Retention Event -rma_recordsmanagement.property.rma_dispositionEvent.decription=Retention Event -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Retention Event Combination -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Retention Event Combination - -rma_recordsmanagement.type.rma_recordFolder.title=Record Folder -rma_recordsmanagement.type.rma_recordFolder.decription=Record Folder -rma_recordsmanagement.property.rma_isClosed.title=Record -rma_recordsmanagement.property.rma_isClosed.decription=Record - -rma_recordsmanagement.type.rma_recordCategory.title=Record Category -rma_recordsmanagement.type.rma_recordCategory.decription=Record Category - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Non-Electronic Document -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Non-Electronic Document -rma_recordsmanagement.property.rma_physicalSize.title=Physical Size -rma_recordsmanagement.property.rma_physicalSize.decription=The size of the document measured in linear meters. -rma_recordsmanagement.property.rma_numberOfCopies.title=Number of Copies -rma_recordsmanagement.property.rma_numberOfCopies.description=The number of copies of the document. -rma_recordsmanagement.property.rma_storageLocation.title=Storage Location -rma_recordsmanagement.property.rma_storageLocation.decription=The physical storage location of the record. -rma_recordsmanagement.property.rma_shelf.title=Shelf -rma_recordsmanagement.property.rma_shelf.decription=The shelf the record is stored on. -rma_recordsmanagement.property.rma_box.title=Box -rma_recordsmanagement.property.rma_box.description=The box the record is stored in. -rma_recordsmanagement.property.rma_file.title=File -rma_recordsmanagement.property.rma_file.decription=The file the record is stored in. - -rma_recordsmanagement.type.rma_dispositionAction.title=Retention Action -rma_recordsmanagement.type.rma_dispositionAction.decription=Retention Action -rma_recordsmanagement.property.rma_dispositionActionId.title=Retention Action ID -rma_recordsmanagement.property.rma_dispositionActionId.decription=Retention Action ID -rma_recordsmanagement.property.rma_dispositionAction.title=Retention Action -rma_recordsmanagement.property.rma_dispositionAction.decription=Retention Action -rma_recordsmanagement.property.rma_dispositionAsOf.title=Retention Action -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retention Action -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Retention Events Eligible -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Retention Events Eligible -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retention Action Started At -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retention Action Started At -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retention Action Started By -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retention Action Started By -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retention Action Completed At -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retention Action Completed At -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retention Action Completed By -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retention Action Completed By -rma_recordsmanagement.association.rma_eventExecutions.title=Event executions -rma_recordsmanagement.association.rma_eventExecutions.decription=Event executions - -rma_recordsmanagement.type.rma_eventExecution.title=Event Execution -rma_recordsmanagement.type.rma_eventExecution.decription=Event Execution -rma_recordsmanagement.property.rma_eventExecutionName.title=Event Name -rma_recordsmanagement.property.rma_eventExecutionName.decription=Event Name -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Event automatic -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Event automatic -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Event complete -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Event complete -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Event completed by -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Event completed by -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Event completed at -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Event completed at - -rma_recordsmanagement.type.rma_hold.title=Hold -rma_recordsmanagement.type.rma_hold.decription=Hold -rma_recordsmanagement.property.rma_holdReason.title=Hold Reason -rma_recordsmanagement.property.rma_holdReason.decription=Hold Reason -rma_recordsmanagement.association.rma_frozenRecords.title=Held Records -rma_recordsmanagement.association.rma_frozenRecords.decription=Held Records - -rma_recordsmanagement.type.rma_transfer.title=Transfer -rma_recordsmanagement.type.rma_transfer.decription=Transfer -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transfer Accession Indicator -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transfer Accession Indicator -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transfer PDF Indicator -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transfer PDF Indicator -rma_recordsmanagement.property.rma_transferLocation.title=Transfer PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Transfer PDF -rma_recordsmanagement.association.rma_transferred.title=Transferred -rma_recordsmanagement.association.rma_transferred.decription=Transferred - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=File Plan Component -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=File Plan Component -rma_recordsmanagement.property.rma_rootNodeRef.title=Root node -rma_recordsmanagement.property.rma_rootNodeRef.decription=Root node - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Records Management Root -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Records Management Root -rma_recordsmanagement.association.rma_holds.title=Holds -rma_recordsmanagement.association.rma_holds.decription=Holds -rma_recordsmanagement.association.rma_transfers.title=Transfers -rma_recordsmanagement.association.rma_transfers.decription=Transfers - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Completed Record -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Completed Record -rma_recordsmanagement.property.rma_declaredAt.title=Date Completed -rma_recordsmanagement.property.rma_declaredAt.decription=Date Completed -rma_recordsmanagement.property.rma_declaredBy.title=Completed By -rma_recordsmanagement.property.rma_declaredBy.decription=Completed By - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Record component identifier -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Record component identifier -rma_recordsmanagement.property.rma_identifier.title=Record ID -rma_recordsmanagement.property.rma_identifier.decription=Unique record identifier -rma_recordsmanagement.property.rma_dbUniquenessId.title=Database uniqueness -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Database uniqueness - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Vital Record Definition -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Vital Record Definition - -rma_recordsmanagement.property.rma_reviewPeriod.title=Review Period -rma_recordsmanagement.property.rma_reviewPeriod.decription=Review Period -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Vital Record Indicator -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Vital Record Indicator - -rma_recordsmanagement.aspect.rma_record.title=Record -rma_recordsmanagement.aspect.rma_record.decription=Record -rma_recordsmanagement.property.rma_dateFiled.title=Date Filed -rma_recordsmanagement.property.rma_dateFiled.decription=Date Filed -rma_recordsmanagement.property.rma_origionalName=Original Name - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Record Metadata -rma_recordsmanagement.aspect.rma_recordMetaData.description=Marker aspect for record metadata - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Common Records Details -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadata common to all record types -rma_recordsmanagement.property.rma_location.title=Location -rma_recordsmanagement.property.rma_location.decription=Location - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Vital Record -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Vital Record -rma_recordsmanagement.property.rma_reviewAsOf.title=Next Review -rma_recordsmanagement.property.rma_reviewAsOf.decription=Next Review -rma_recordsmanagement.property.rma_notificationIssued.title=Indicates that a due for review notification has been issued for this record -rma_recordsmanagement.property.rma_notificationIssued.decription=Indicates that a due for review notification has been issued for this record - -rma_recordsmanagement.aspect.rma_scheduled.title=Scheduled -rma_recordsmanagement.aspect.rma_scheduled.decription=Scheduled -rma_recordsmanagement.association.rma_dispositionSchedule.title=Retention Schedule -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retention Schedule - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Retention Lifecycle -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Retention Lifecycle -rma_recordsmanagement.association.rma_nextDispositionAction.title=Next retention action -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Next retention action -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Retention Action History -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Retention Action History - -rma_recordsmanagement.aspect.rma_cutOff.title=Cut Off -rma_recordsmanagement.aspect.rma_cutOff.decription=Cut Off -rma_recordsmanagement.property.rma_cutOffDate.title=Cut Off Date -rma_recordsmanagement.property.rma_cutOffDate.decription=Cut Off Date - -rma_recordsmanagement.aspect.rma_transferred.title=Transferred -rma_recordsmanagement.aspect.rma_transferred.decription=Transferred - -rma_recordsmanagement.aspect.rma_ascended.title=Ascended -rma_recordsmanagement.aspect.rma_ascended.decription=Ascended - -rma_recordsmanagement.aspect.rma_frozen.title=On Hold -rma_recordsmanagement.aspect.rma_frozen.decription=On Hold -rma_recordsmanagement.property.rma_frozenAt.title=Held At -rma_recordsmanagement.property.rma_frozenAt.decription=Held At -rma_recordsmanagement.property.rma_frozenBy.title=Held By -rma_recordsmanagement.property.rma_frozenBy.decription=Held By - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Caveat Configuration Root -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Caveat Configuration Root -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat Configuration -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat Configuration - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Email Configuration Root -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Email Configuration Root -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Email Configuration -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Email Configuration - -rma_recordsmanagement.aspect.rma_recordSearch.title=Record Search -rma_recordsmanagement.aspect.rma_recordSearch.decription=Information to support Records Management search -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Has Retention Schedule -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indicates whether the item has an associated retention schedule -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Retention Action Name -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=The name of the next retention action -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retention Action of -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=The date at which the next retention action becomes eligible -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retention Period -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retention Period -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Retention Period Expression -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Retention Period Expression -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Retention Events Eligible -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Retention Events Eligible -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retention Events -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retention Events -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retention Authority -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retention Authority -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retention Instructions -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retention Instructions -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Hold Reason -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Hold Reason -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Vital Record Review Period -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Vital Record Review Period -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Review Period Expression -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Review Period Expression - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Versioned Record -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Versioned Record - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Unpublished Update -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Unpublished Update -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Unpublished Update -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indicates whether there is an unpublished update -rma_recordsmanagement.property.rma_updateTo.title=Update To -rma_recordsmanagement.property.rma_updateTo.description=Destination of the update -rma_recordsmanagement.property.rma_updatedProperties.title=Updated Properties -rma_recordsmanagement.property.rma_updatedProperties.description=The updated properties -rma_recordsmanagement.property.rma_publishInProgress.title=Publish In Progress -rma_recordsmanagement.property.rma_publishInProgress.description=Indicates whether a publish is currently in progress - -rma_recordsmanagement.aspect.dod_ghosted.title=Metadata Only Record -rma_recordsmanagement.aspect.dod_ghosted.description=Metadata only record - -listconstraint.rmc_tlList.title=Transfer Locations +rma_recordsmanagement.description=Records Management Content Model + +rma_recordsmanagement.type.rma_rmsite.title=Records Management Site +rma_recordsmanagement.type.rma_rmsite.description=Specialized Site for Records Management + +rma_recordsmanagement.type.rma_caveatConfig.title=Security Controls Configuration +rma_recordsmanagement.type.rma_caveatConfig.decription=Security Controls Configuration + +rma_recordsmanagement.type.rma_emailConfig.title=Email Configuration +rma_recordsmanagement.type.rma_emailConfig.decription=Email Configuration + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=Records Management Container +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Records Management Container + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Records Management Root Container +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Records Management Root Container + +rma_recordsmanagement.type.rma_dispositionSchedule.title=Retention Schedule +rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retention Schedule + +rma_recordsmanagement.property.rma_dispositionAuthority.title=Retention Authority +rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retention Authority + +rma_recordsmanagement.property.rma_dispositionInstructions.title=Retention Instructions +rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retention Instructions + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=Record Level Retention +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Record Level Retention + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retention Actions +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retention Actions + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Retention Action Definition +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Retention Action Definition +rma_recordsmanagement.property.rma_dispositionActionName.title=Retention Action Name +rma_recordsmanagement.property.rma_dispositionActionName.decription=Retention Action Name +rma_recordsmanagement.property.rma_dispositionDescription.title=Retention Description +rma_recordsmanagement.property.rma_dispositionDescription.decription=Retention Description +rma_recordsmanagement.property.rma_dispositionLocation.title=Retention Location +rma_recordsmanagement.property.rma_dispositionLocation.decription=Retention Location +rma_recordsmanagement.property.rma_dispositionPeriod.title=Retention Period +rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retention Period +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Retention Period Property +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Retention Period Property +rma_recordsmanagement.property.rma_dispositionEvent.title=Retention Event +rma_recordsmanagement.property.rma_dispositionEvent.decription=Retention Event +rma_recordsmanagement.property.rma_dispositionEventCombination.title=Retention Event Combination +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Retention Event Combination + +rma_recordsmanagement.type.rma_recordFolder.title=Record Folder +rma_recordsmanagement.type.rma_recordFolder.decription=Record Folder +rma_recordsmanagement.property.rma_isClosed.title=Record +rma_recordsmanagement.property.rma_isClosed.decription=Record + +rma_recordsmanagement.type.rma_recordCategory.title=Record Category +rma_recordsmanagement.type.rma_recordCategory.decription=Record Category + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=Non-Electronic Document +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Non-Electronic Document +rma_recordsmanagement.property.rma_physicalSize.title=Physical Size +rma_recordsmanagement.property.rma_physicalSize.decription=The size of the document measured in linear meters. +rma_recordsmanagement.property.rma_numberOfCopies.title=Number of Copies +rma_recordsmanagement.property.rma_numberOfCopies.description=The number of copies of the document. +rma_recordsmanagement.property.rma_storageLocation.title=Storage Location +rma_recordsmanagement.property.rma_storageLocation.decription=The physical storage location of the record. +rma_recordsmanagement.property.rma_shelf.title=Shelf +rma_recordsmanagement.property.rma_shelf.decription=The shelf the record is stored on. +rma_recordsmanagement.property.rma_box.title=Box +rma_recordsmanagement.property.rma_box.description=The box the record is stored in. +rma_recordsmanagement.property.rma_file.title=File +rma_recordsmanagement.property.rma_file.decription=The file the record is stored in. + +rma_recordsmanagement.type.rma_dispositionAction.title=Retention Action +rma_recordsmanagement.type.rma_dispositionAction.decription=Retention Action +rma_recordsmanagement.property.rma_dispositionActionId.title=Retention Action ID +rma_recordsmanagement.property.rma_dispositionActionId.decription=Retention Action ID +rma_recordsmanagement.property.rma_dispositionAction.title=Retention Action +rma_recordsmanagement.property.rma_dispositionAction.decription=Retention Action +rma_recordsmanagement.property.rma_dispositionAsOf.title=Retention Action +rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retention Action +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Retention Events Eligible +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Retention Events Eligible +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retention Action Started At +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retention Action Started At +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retention Action Started By +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retention Action Started By +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retention Action Completed At +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retention Action Completed At +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retention Action Completed By +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retention Action Completed By +rma_recordsmanagement.association.rma_eventExecutions.title=Event executions +rma_recordsmanagement.association.rma_eventExecutions.decription=Event executions + +rma_recordsmanagement.type.rma_eventExecution.title=Event Execution +rma_recordsmanagement.type.rma_eventExecution.decription=Event Execution +rma_recordsmanagement.property.rma_eventExecutionName.title=Event Name +rma_recordsmanagement.property.rma_eventExecutionName.decription=Event Name +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Event automatic +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Event automatic +rma_recordsmanagement.property.rma_eventExecutionComplete.title=Event complete +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Event complete +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Event completed by +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Event completed by +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Event completed at +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Event completed at + +rma_recordsmanagement.type.rma_hold.title=Hold +rma_recordsmanagement.type.rma_hold.decription=Hold +rma_recordsmanagement.property.rma_holdReason.title=Hold Reason +rma_recordsmanagement.property.rma_holdReason.decription=Hold Reason +rma_recordsmanagement.association.rma_frozenRecords.title=Held Records +rma_recordsmanagement.association.rma_frozenRecords.decription=Held Records + +rma_recordsmanagement.type.rma_transfer.title=Transfer +rma_recordsmanagement.type.rma_transfer.decription=Transfer +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transfer Accession Indicator +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transfer Accession Indicator +rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transfer PDF Indicator +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transfer PDF Indicator +rma_recordsmanagement.property.rma_transferLocation.title=Transfer PDF +rma_recordsmanagement.property.rma_transferLocation.decription=Transfer PDF +rma_recordsmanagement.association.rma_transferred.title=Transferred +rma_recordsmanagement.association.rma_transferred.decription=Transferred + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=File Plan Component +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=File Plan Component +rma_recordsmanagement.property.rma_rootNodeRef.title=Root node +rma_recordsmanagement.property.rma_rootNodeRef.decription=Root node + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Records Management Root +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Records Management Root +rma_recordsmanagement.association.rma_holds.title=Holds +rma_recordsmanagement.association.rma_holds.decription=Holds +rma_recordsmanagement.association.rma_transfers.title=Transfers +rma_recordsmanagement.association.rma_transfers.decription=Transfers + +rma_recordsmanagement.aspect.rma_declaredRecord.title=Completed Record +rma_recordsmanagement.aspect.rma_declaredRecord.decription=Completed Record +rma_recordsmanagement.property.rma_declaredAt.title=Date Completed +rma_recordsmanagement.property.rma_declaredAt.decription=Date Completed +rma_recordsmanagement.property.rma_declaredBy.title=Completed By +rma_recordsmanagement.property.rma_declaredBy.decription=Completed By + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Record component identifier +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Record component identifier +rma_recordsmanagement.property.rma_identifier.title=Record ID +rma_recordsmanagement.property.rma_identifier.decription=Unique record identifier +rma_recordsmanagement.property.rma_dbUniquenessId.title=Database uniqueness +rma_recordsmanagement.property.rma_dbUniquenessId.decription=Database uniqueness + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Vital Record Definition +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Vital Record Definition + +rma_recordsmanagement.property.rma_reviewPeriod.title=Review Period +rma_recordsmanagement.property.rma_reviewPeriod.decription=Review Period +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Vital Record Indicator +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Vital Record Indicator + +rma_recordsmanagement.aspect.rma_record.title=Record +rma_recordsmanagement.aspect.rma_record.decription=Record +rma_recordsmanagement.property.rma_dateFiled.title=Date Filed +rma_recordsmanagement.property.rma_dateFiled.decription=Date Filed +rma_recordsmanagement.property.rma_origionalName=Original Name + +rma_recordsmanagement.aspect.rma_recordMetaData.title=Record Metadata +rma_recordsmanagement.aspect.rma_recordMetaData.description=Marker aspect for record metadata + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Common Records Details +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadata common to all record types +rma_recordsmanagement.property.rma_location.title=Location +rma_recordsmanagement.property.rma_location.decription=Location + +rma_recordsmanagement.aspect.rma_vitalRecord.title=Vital Record +rma_recordsmanagement.aspect.rma_vitalRecord.decription=Vital Record +rma_recordsmanagement.property.rma_reviewAsOf.title=Next Review +rma_recordsmanagement.property.rma_reviewAsOf.decription=Next Review +rma_recordsmanagement.property.rma_notificationIssued.title=Indicates that a due for review notification has been issued for this record +rma_recordsmanagement.property.rma_notificationIssued.decription=Indicates that a due for review notification has been issued for this record + +rma_recordsmanagement.aspect.rma_scheduled.title=Scheduled +rma_recordsmanagement.aspect.rma_scheduled.decription=Scheduled +rma_recordsmanagement.association.rma_dispositionSchedule.title=Retention Schedule +rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retention Schedule + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Retention Lifecycle +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Retention Lifecycle +rma_recordsmanagement.association.rma_nextDispositionAction.title=Next retention action +rma_recordsmanagement.association.rma_nextDispositionAction.decription=Next retention action +rma_recordsmanagement.association.rma_dispositionActionHistory.title=Retention Action History +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Retention Action History + +rma_recordsmanagement.aspect.rma_cutOff.title=Cut Off +rma_recordsmanagement.aspect.rma_cutOff.decription=Cut Off +rma_recordsmanagement.property.rma_cutOffDate.title=Cut Off Date +rma_recordsmanagement.property.rma_cutOffDate.decription=Cut Off Date + +rma_recordsmanagement.aspect.rma_transferred.title=Transferred +rma_recordsmanagement.aspect.rma_transferred.decription=Transferred + +rma_recordsmanagement.aspect.rma_ascended.title=Ascended +rma_recordsmanagement.aspect.rma_ascended.decription=Ascended + +rma_recordsmanagement.aspect.rma_frozen.title=On Hold +rma_recordsmanagement.aspect.rma_frozen.decription=On Hold +rma_recordsmanagement.property.rma_frozenAt.title=Held At +rma_recordsmanagement.property.rma_frozenAt.decription=Held At +rma_recordsmanagement.property.rma_frozenBy.title=Held By +rma_recordsmanagement.property.rma_frozenBy.decription=Held By + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Caveat Configuration Root +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Caveat Configuration Root +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat Configuration +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat Configuration + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Email Configuration Root +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Email Configuration Root +rma_recordsmanagement.association.rma_emailConfigAssoc.title=Email Configuration +rma_recordsmanagement.association.rma_emailConfigAssoc.description=Email Configuration + +rma_recordsmanagement.aspect.rma_recordSearch.title=Record Search +rma_recordsmanagement.aspect.rma_recordSearch.decription=Information to support Records Management search +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Has Retention Schedule +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indicates whether the item has an associated retention schedule +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Retention Action Name +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=The name of the next retention action +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retention Action of +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=The date at which the next retention action becomes eligible +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retention Period +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retention Period +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Retention Period Expression +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Retention Period Expression +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Retention Events Eligible +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Retention Events Eligible +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retention Events +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retention Events +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retention Authority +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retention Authority +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retention Instructions +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retention Instructions +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Hold Reason +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Hold Reason +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Vital Record Review Period +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Vital Record Review Period +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Review Period Expression +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Review Period Expression + +rma_recordsmanagement.aspect.rma_versionedRecord.title=Versioned Record +rma_recordsmanagement.aspect.rma_versionedRecord.decription=Versioned Record + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Unpublished Update +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Unpublished Update +rma_recordsmanagement.property.rma_unpublishedUpdate.title=Unpublished Update +rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indicates whether there is an unpublished update +rma_recordsmanagement.property.rma_updateTo.title=Update To +rma_recordsmanagement.property.rma_updateTo.description=Destination of the update +rma_recordsmanagement.property.rma_updatedProperties.title=Updated Properties +rma_recordsmanagement.property.rma_updatedProperties.description=The updated properties +rma_recordsmanagement.property.rma_publishInProgress.title=Publish In Progress +rma_recordsmanagement.property.rma_publishInProgress.description=Indicates whether a publish is currently in progress + +rma_recordsmanagement.aspect.dod_ghosted.title=Metadata Only Record +rma_recordsmanagement.aspect.dod_ghosted.description=Metadata only record + +listconstraint.rmc_tlList.title=Transfer Locations listconstraint.rmc_smList.title=Supplemental Markings \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_de.properties index 20bc2ef65e..39715d9d45 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_de.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=Content Model f\u00fcr Records Management - -rma_recordsmanagement.type.rma_rmsite.title=Records Management Site -rma_recordsmanagement.type.rma_rmsite.description=Spezielle Site f\u00fcr Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Sicherheitskontrollen-Konfiguration -rma_recordsmanagement.type.rma_caveatConfig.decription=Sicherheitskontrollen-Konfiguration - -rma_recordsmanagement.type.rma_emailConfig.title=E-Mail-Konfiguration -rma_recordsmanagement.type.rma_emailConfig.decription=E-Mail-Konfiguration - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Records Management Container -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Records Management Container - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Records Management Root-Container -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Records Management Root-Container - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Aufbewahrungsplan -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Aufbewahrungsplan - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Aufbewahrungs-Authority -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Aufbewahrungs-Authority - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Aufbewahrungsanweisungen -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Aufbewahrungsanweisungen - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Aufbewahrung auf Record-Ebene -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Aufbewahrung auf Record-Ebene - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Aufbewahrungsaktionen -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Aufbewahrungsaktionen - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definition der Aufbewahrungsaktion -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definition der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionActionName.title=Name der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionActionName.decription=Name der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionDescription.title=Aufbewahrungsbeschreibung -rma_recordsmanagement.property.rma_dispositionDescription.decription=Aufbewahrungsbeschreibung -rma_recordsmanagement.property.rma_dispositionLocation.title=Aufbewahrungsort -rma_recordsmanagement.property.rma_dispositionLocation.decription=Aufbewahrungsort -rma_recordsmanagement.property.rma_dispositionPeriod.title=Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Eigenschaft des Aufbewahrungszeitraums -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Eigenschaft des Aufbewahrungszeitraums -rma_recordsmanagement.property.rma_dispositionEvent.title=Aufbewahrungsereignis -rma_recordsmanagement.property.rma_dispositionEvent.decription=Aufbewahrungsereignis -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Aufbewahrungsereigniskombination -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Aufbewahrungsereigniskombination - -rma_recordsmanagement.type.rma_recordFolder.title=Record-Ordner -rma_recordsmanagement.type.rma_recordFolder.decription=Record-Ordner -rma_recordsmanagement.property.rma_isClosed.title=Record -rma_recordsmanagement.property.rma_isClosed.decription=Record - -rma_recordsmanagement.type.rma_recordCategory.title=Record-Kategorie -rma_recordsmanagement.type.rma_recordCategory.decription=Record-Kategorie - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Nicht elektronisches Dokument -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Nicht elektronisches Dokument -rma_recordsmanagement.property.rma_physicalSize.title=Physikalische Gr\u00f6\u00dfe -rma_recordsmanagement.property.rma_physicalSize.decription=Die Gr\u00f6\u00dfe des Dokuments wird in laufenden Metern gemessen. -rma_recordsmanagement.property.rma_numberOfCopies.title=Anzahl der Kopien -rma_recordsmanagement.property.rma_numberOfCopies.description=Die Anzahl der Kopien des Dokuments. -rma_recordsmanagement.property.rma_storageLocation.title=Speicherort -rma_recordsmanagement.property.rma_storageLocation.decription=Der physische Speicherort des Record. -rma_recordsmanagement.property.rma_shelf.title=Regal -rma_recordsmanagement.property.rma_shelf.decription=Das Regal, in dem der Record abgelegt ist. -rma_recordsmanagement.property.rma_box.title=Box -rma_recordsmanagement.property.rma_box.description=Die Box, in der der Record abgelegt ist. -rma_recordsmanagement.property.rma_file.title=Datei -rma_recordsmanagement.property.rma_file.decription=Die Datei, in der der Record gespeichert ist. - -rma_recordsmanagement.type.rma_dispositionAction.title=Aufbewahrungsaktion -rma_recordsmanagement.type.rma_dispositionAction.decription=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionActionId.title=ID der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionAction.title=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionAction.decription=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionAsOf.title=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Aufbewahrungsaktion -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Erlaubte Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Erlaubte Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Aufbewahrungsaktion gestartet um -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Aufbewahrungsaktion gestartet um -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Aufbewahrungsaktion gestartet von -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Aufbewahrungsaktion gestartet von -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Aufbewahrungsaktion abgeschlossen um -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Aufbewahrungsaktion abgeschlossen um -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Aufbewahrungsaktion abgeschlossen von -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Aufbewahrungsaktion abgeschlossen von -rma_recordsmanagement.association.rma_eventExecutions.title=Ereignisausf\u00fchrungen -rma_recordsmanagement.association.rma_eventExecutions.decription=Ereignisausf\u00fchrungen - -rma_recordsmanagement.type.rma_eventExecution.title=Ereignisausf\u00fchrung -rma_recordsmanagement.type.rma_eventExecution.decription=Ereignisausf\u00fchrung -rma_recordsmanagement.property.rma_eventExecutionName.title=Ereignisname -rma_recordsmanagement.property.rma_eventExecutionName.decription=Ereignisname -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Automatisches Ereignis -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Automatisches Ereignis -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Abgeschlossenes Ereignis -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Abgeschlossenes Ereignis -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Ereignis abgeschlossen von -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Ereignis abgeschlossen von -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Ereignis abgeschlossen um -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Ereignis abgeschlossen um - -rma_recordsmanagement.type.rma_hold.title=Sperrbereich -rma_recordsmanagement.type.rma_hold.decription=Sperrbereich -rma_recordsmanagement.property.rma_holdReason.title=Sperrgrund -rma_recordsmanagement.property.rma_holdReason.decription=Sperrgrund -rma_recordsmanagement.association.rma_frozenRecords.title=Gesperrte Records -rma_recordsmanagement.association.rma_frozenRecords.decription=Gesperrte Records - -rma_recordsmanagement.type.rma_transfer.title=\u00dcbertragen -rma_recordsmanagement.type.rma_transfer.decription=\u00dcbertragen -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Anzeige bei \u00dcbertragung zur Aufnahme -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Anzeige bei \u00dcbertragung zur Aufnahme -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Anzeige bei PDF-\u00dcbertragung -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Anzeige bei PDF-\u00dcbertragung -rma_recordsmanagement.property.rma_transferLocation.title=PDF \u00fcbertragen -rma_recordsmanagement.property.rma_transferLocation.decription=PDF \u00fcbertragen -rma_recordsmanagement.association.rma_transferred.title=\u00dcbertragen -rma_recordsmanagement.association.rma_transferred.decription=\u00dcbertragen - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Ablageplan-Komponente -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Ablageplan-Komponente -rma_recordsmanagement.property.rma_rootNodeRef.title=Root-Knoten -rma_recordsmanagement.property.rma_rootNodeRef.decription=Root-Knoten - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Records Management Root -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Records Management Root -rma_recordsmanagement.association.rma_holds.title=Sperren -rma_recordsmanagement.association.rma_holds.decription=Sperren -rma_recordsmanagement.association.rma_transfers.title=\u00dcbertragungen -rma_recordsmanagement.association.rma_transfers.decription=\u00dcbertragungen - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Abgeschlossener Record -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Abgeschlossener Record -rma_recordsmanagement.property.rma_declaredAt.title=Abschlussdatum -rma_recordsmanagement.property.rma_declaredAt.decription=Abschlussdatum -rma_recordsmanagement.property.rma_declaredBy.title=Abgeschlossen von -rma_recordsmanagement.property.rma_declaredBy.decription=Abgeschlossen von - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=ID der Record-Komponente -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=ID der Record-Komponente -rma_recordsmanagement.property.rma_identifier.title=Record-ID -rma_recordsmanagement.property.rma_identifier.decription=Eindeutige Record-ID -rma_recordsmanagement.property.rma_dbUniquenessId.title=Eindeutigkeit der Datenbank -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Eindeutigkeit der Datenbank - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definition f\u00fcr besonders relevanten Record -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definition f\u00fcr besonders relevanten Record - -rma_recordsmanagement.property.rma_reviewPeriod.title=\u00dcberpr\u00fcfungszeitraum -rma_recordsmanagement.property.rma_reviewPeriod.decription=\u00dcberpr\u00fcfungszeitraum -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Kennzeichen f\u00fcr besonders relevante Records -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Kennzeichen f\u00fcr besonders relevante Records - -rma_recordsmanagement.aspect.rma_record.title=Record -rma_recordsmanagement.aspect.rma_record.decription=Record -rma_recordsmanagement.property.rma_dateFiled.title=Ablagedatum -rma_recordsmanagement.property.rma_dateFiled.decription=Ablagedatum -rma_recordsmanagement.property.rma_origionalName=Originalname - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Record-Metadaten -rma_recordsmanagement.aspect.rma_recordMetaData.description=Markeraspekt f\u00fcr Record-Metadaten - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Gemeinsame Record-Details -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Gemeinsame Metadaten aller Record-Typen -rma_recordsmanagement.property.rma_location.title=Ort -rma_recordsmanagement.property.rma_location.decription=Ort - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Besonders relevanter Record -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Besonders relevanter Record -rma_recordsmanagement.property.rma_reviewAsOf.title=N\u00e4chste \u00dcberpr\u00fcfung -rma_recordsmanagement.property.rma_reviewAsOf.decription=N\u00e4chste \u00dcberpr\u00fcfung -rma_recordsmanagement.property.rma_notificationIssued.title=Gibt an, dass f\u00fcr diesen Record eine Benachrichtigung aufgrund einer f\u00e4lligen \u00dcberpr\u00fcfung ausgegeben wurde. -rma_recordsmanagement.property.rma_notificationIssued.decription=Gibt an, dass f\u00fcr diesen Record eine Benachrichtigung aufgrund einer f\u00e4lligen \u00dcberpr\u00fcfung ausgegeben wurde. - -rma_recordsmanagement.aspect.rma_scheduled.title=Geplant -rma_recordsmanagement.aspect.rma_scheduled.decription=Geplant -rma_recordsmanagement.association.rma_dispositionSchedule.title=Aufbewahrungsplan -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Aufbewahrungsplan - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Aufbewahrungszyklus -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Aufbewahrungszyklus -rma_recordsmanagement.association.rma_nextDispositionAction.title=N\u00e4chste Aufbewahrungsaktion -rma_recordsmanagement.association.rma_nextDispositionAction.decription=N\u00e4chste Aufbewahrungsaktion -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Aufbewahrungsaktionsverlauf -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Aufbewahrungsaktionsverlauf - -rma_recordsmanagement.aspect.rma_cutOff.title=Trennen -rma_recordsmanagement.aspect.rma_cutOff.decription=Trennen -rma_recordsmanagement.property.rma_cutOffDate.title=Trenndatum -rma_recordsmanagement.property.rma_cutOffDate.decription=Trenndatum - -rma_recordsmanagement.aspect.rma_transferred.title=\u00dcbertragen -rma_recordsmanagement.aspect.rma_transferred.decription=\u00dcbertragen - -rma_recordsmanagement.aspect.rma_ascended.title=In Archiv aufgenommen -rma_recordsmanagement.aspect.rma_ascended.decription=In Archiv aufgenommen - -rma_recordsmanagement.aspect.rma_frozen.title=Gesperrt -rma_recordsmanagement.aspect.rma_frozen.decription=Gesperrt -rma_recordsmanagement.property.rma_frozenAt.title=Gehalten in -rma_recordsmanagement.property.rma_frozenAt.decription=Gehalten in -rma_recordsmanagement.property.rma_frozenBy.title=Gehalten von -rma_recordsmanagement.property.rma_frozenBy.decription=Gehalten von - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Root von Caveat-Konfiguration -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Root von Caveat-Konfiguration -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat-Konfiguration -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat-Konfiguration - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Root von E-Mail-Konfiguration -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Root von E-Mail-Konfiguration -rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-Mail-Konfiguration -rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-Mail-Konfiguration - -rma_recordsmanagement.aspect.rma_recordSearch.title=Record-Suche -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informationen zur Unterst\u00fctzung der Records Management Suche -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Mit Aufbewahrungsplan -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Gibt an, ob das Element \u00fcber einen zugeordneten Aufbewahrungsplan verf\u00fcgt -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Name der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Der Name der n\u00e4chsten Aufbewahrungsaktion -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Start der Aufbewahrungsaktion -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=Das Datum, ab dem die n\u00e4chste Aufbewahrungsaktion erlaubt ist -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Ausdruck f\u00fcr Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Ausdruck f\u00fcr Aufbewahrungszeitraum -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Erlaubte Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Erlaubte Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Aufbewahrungsereignisse -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Aufbewahrungs-Authority -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Aufbewahrungs-Authority -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Aufbewahrungsanweisungen -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Aufbewahrungsanweisungen -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Sperrgrund -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Sperrgrund -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u00dcberpr\u00fcfungszeitraum f\u00fcr besonders relevante Records -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u00dcberpr\u00fcfungszeitraum f\u00fcr besonders relevante Records -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Ausdruck f\u00fcr \u00dcberpr\u00fcfungszeitraum -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Ausdruck f\u00fcr \u00dcberpr\u00fcfungszeitraum - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Versionierter Record -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Versionierter Record - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Nicht ver\u00f6ffentlichte Aktualisierung -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Nicht ver\u00f6ffentlichte Aktualisierung -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Nicht ver\u00f6ffentlichte Aktualisierung -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Gibt an, ob eine nicht ver\u00f6ffentlichte Aktualisierung vorhanden ist. -rma_recordsmanagement.property.rma_updateTo.title=Aktualisieren auf -rma_recordsmanagement.property.rma_updateTo.description=Das Ziel der Aktualisierung. -rma_recordsmanagement.property.rma_updatedProperties.title=Aktualisierte Eigenschaften -rma_recordsmanagement.property.rma_updatedProperties.description=Die aktualisierten Eigenschaften. -rma_recordsmanagement.property.rma_publishInProgress.title=Laufende Ver\u00f6ffentlichung -rma_recordsmanagement.property.rma_publishInProgress.description=Gibt an, ob derzeit eine Ver\u00f6ffentlichung durchgef\u00fchrt wird. - -rma_recordsmanagement.aspect.dod_ghosted.title=Nur Metadaten enthaltender Record -rma_recordsmanagement.aspect.dod_ghosted.description=Nur Metadaten enthaltender Record - -listconstraint.rmc_tlList.title=Speicherorte \u00fcbertragen +rma_recordsmanagement.description=Content Model f\u00fcr Records Management + +rma_recordsmanagement.type.rma_rmsite.title=Records Management Site +rma_recordsmanagement.type.rma_rmsite.description=Spezielle Site f\u00fcr Records Management + +rma_recordsmanagement.type.rma_caveatConfig.title=Sicherheitskontrollen-Konfiguration +rma_recordsmanagement.type.rma_caveatConfig.decription=Sicherheitskontrollen-Konfiguration + +rma_recordsmanagement.type.rma_emailConfig.title=E-Mail-Konfiguration +rma_recordsmanagement.type.rma_emailConfig.decription=E-Mail-Konfiguration + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=Records Management Container +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Records Management Container + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Records Management Root-Container +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Records Management Root-Container + +rma_recordsmanagement.type.rma_dispositionSchedule.title=Aufbewahrungsplan +rma_recordsmanagement.type.rma_dispositionSchedule.decription=Aufbewahrungsplan + +rma_recordsmanagement.property.rma_dispositionAuthority.title=Aufbewahrungs-Authority +rma_recordsmanagement.property.rma_dispositionAuthority.decription=Aufbewahrungs-Authority + +rma_recordsmanagement.property.rma_dispositionInstructions.title=Aufbewahrungsanweisungen +rma_recordsmanagement.property.rma_dispositionInstructions.decription=Aufbewahrungsanweisungen + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=Aufbewahrung auf Record-Ebene +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Aufbewahrung auf Record-Ebene + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Aufbewahrungsaktionen +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Aufbewahrungsaktionen + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definition der Aufbewahrungsaktion +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definition der Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionActionName.title=Name der Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionActionName.decription=Name der Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionDescription.title=Aufbewahrungsbeschreibung +rma_recordsmanagement.property.rma_dispositionDescription.decription=Aufbewahrungsbeschreibung +rma_recordsmanagement.property.rma_dispositionLocation.title=Aufbewahrungsort +rma_recordsmanagement.property.rma_dispositionLocation.decription=Aufbewahrungsort +rma_recordsmanagement.property.rma_dispositionPeriod.title=Aufbewahrungszeitraum +rma_recordsmanagement.property.rma_dispositionPeriod.decription=Aufbewahrungszeitraum +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Eigenschaft des Aufbewahrungszeitraums +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Eigenschaft des Aufbewahrungszeitraums +rma_recordsmanagement.property.rma_dispositionEvent.title=Aufbewahrungsereignis +rma_recordsmanagement.property.rma_dispositionEvent.decription=Aufbewahrungsereignis +rma_recordsmanagement.property.rma_dispositionEventCombination.title=Aufbewahrungsereigniskombination +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Aufbewahrungsereigniskombination + +rma_recordsmanagement.type.rma_recordFolder.title=Record-Ordner +rma_recordsmanagement.type.rma_recordFolder.decription=Record-Ordner +rma_recordsmanagement.property.rma_isClosed.title=Record +rma_recordsmanagement.property.rma_isClosed.decription=Record + +rma_recordsmanagement.type.rma_recordCategory.title=Record-Kategorie +rma_recordsmanagement.type.rma_recordCategory.decription=Record-Kategorie + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=Nicht elektronisches Dokument +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Nicht elektronisches Dokument +rma_recordsmanagement.property.rma_physicalSize.title=Physikalische Gr\u00f6\u00dfe +rma_recordsmanagement.property.rma_physicalSize.decription=Die Gr\u00f6\u00dfe des Dokuments wird in laufenden Metern gemessen. +rma_recordsmanagement.property.rma_numberOfCopies.title=Anzahl der Kopien +rma_recordsmanagement.property.rma_numberOfCopies.description=Die Anzahl der Kopien des Dokuments. +rma_recordsmanagement.property.rma_storageLocation.title=Speicherort +rma_recordsmanagement.property.rma_storageLocation.decription=Der physische Speicherort des Record. +rma_recordsmanagement.property.rma_shelf.title=Regal +rma_recordsmanagement.property.rma_shelf.decription=Das Regal, in dem der Record abgelegt ist. +rma_recordsmanagement.property.rma_box.title=Box +rma_recordsmanagement.property.rma_box.description=Die Box, in der der Record abgelegt ist. +rma_recordsmanagement.property.rma_file.title=Datei +rma_recordsmanagement.property.rma_file.decription=Die Datei, in der der Record gespeichert ist. + +rma_recordsmanagement.type.rma_dispositionAction.title=Aufbewahrungsaktion +rma_recordsmanagement.type.rma_dispositionAction.decription=Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionActionId.title=ID der Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionActionId.decription=ID der Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionAction.title=Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionAction.decription=Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionAsOf.title=Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionAsOf.decription=Aufbewahrungsaktion +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Erlaubte Aufbewahrungsereignisse +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Erlaubte Aufbewahrungsereignisse +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Aufbewahrungsaktion gestartet um +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Aufbewahrungsaktion gestartet um +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Aufbewahrungsaktion gestartet von +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Aufbewahrungsaktion gestartet von +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Aufbewahrungsaktion abgeschlossen um +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Aufbewahrungsaktion abgeschlossen um +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Aufbewahrungsaktion abgeschlossen von +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Aufbewahrungsaktion abgeschlossen von +rma_recordsmanagement.association.rma_eventExecutions.title=Ereignisausf\u00fchrungen +rma_recordsmanagement.association.rma_eventExecutions.decription=Ereignisausf\u00fchrungen + +rma_recordsmanagement.type.rma_eventExecution.title=Ereignisausf\u00fchrung +rma_recordsmanagement.type.rma_eventExecution.decription=Ereignisausf\u00fchrung +rma_recordsmanagement.property.rma_eventExecutionName.title=Ereignisname +rma_recordsmanagement.property.rma_eventExecutionName.decription=Ereignisname +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Automatisches Ereignis +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Automatisches Ereignis +rma_recordsmanagement.property.rma_eventExecutionComplete.title=Abgeschlossenes Ereignis +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Abgeschlossenes Ereignis +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Ereignis abgeschlossen von +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Ereignis abgeschlossen von +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Ereignis abgeschlossen um +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Ereignis abgeschlossen um + +rma_recordsmanagement.type.rma_hold.title=Sperrbereich +rma_recordsmanagement.type.rma_hold.decription=Sperrbereich +rma_recordsmanagement.property.rma_holdReason.title=Sperrgrund +rma_recordsmanagement.property.rma_holdReason.decription=Sperrgrund +rma_recordsmanagement.association.rma_frozenRecords.title=Gesperrte Records +rma_recordsmanagement.association.rma_frozenRecords.decription=Gesperrte Records + +rma_recordsmanagement.type.rma_transfer.title=\u00dcbertragen +rma_recordsmanagement.type.rma_transfer.decription=\u00dcbertragen +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Anzeige bei \u00dcbertragung zur Aufnahme +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Anzeige bei \u00dcbertragung zur Aufnahme +rma_recordsmanagement.property.rma_transferPDFIndicator.title=Anzeige bei PDF-\u00dcbertragung +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Anzeige bei PDF-\u00dcbertragung +rma_recordsmanagement.property.rma_transferLocation.title=PDF \u00fcbertragen +rma_recordsmanagement.property.rma_transferLocation.decription=PDF \u00fcbertragen +rma_recordsmanagement.association.rma_transferred.title=\u00dcbertragen +rma_recordsmanagement.association.rma_transferred.decription=\u00dcbertragen + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=Ablageplan-Komponente +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Ablageplan-Komponente +rma_recordsmanagement.property.rma_rootNodeRef.title=Root-Knoten +rma_recordsmanagement.property.rma_rootNodeRef.decription=Root-Knoten + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Records Management Root +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Records Management Root +rma_recordsmanagement.association.rma_holds.title=Sperren +rma_recordsmanagement.association.rma_holds.decription=Sperren +rma_recordsmanagement.association.rma_transfers.title=\u00dcbertragungen +rma_recordsmanagement.association.rma_transfers.decription=\u00dcbertragungen + +rma_recordsmanagement.aspect.rma_declaredRecord.title=Abgeschlossener Record +rma_recordsmanagement.aspect.rma_declaredRecord.decription=Abgeschlossener Record +rma_recordsmanagement.property.rma_declaredAt.title=Abschlussdatum +rma_recordsmanagement.property.rma_declaredAt.decription=Abschlussdatum +rma_recordsmanagement.property.rma_declaredBy.title=Abgeschlossen von +rma_recordsmanagement.property.rma_declaredBy.decription=Abgeschlossen von + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=ID der Record-Komponente +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=ID der Record-Komponente +rma_recordsmanagement.property.rma_identifier.title=Record-ID +rma_recordsmanagement.property.rma_identifier.decription=Eindeutige Record-ID +rma_recordsmanagement.property.rma_dbUniquenessId.title=Eindeutigkeit der Datenbank +rma_recordsmanagement.property.rma_dbUniquenessId.decription=Eindeutigkeit der Datenbank + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definition f\u00fcr besonders relevanten Record +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definition f\u00fcr besonders relevanten Record + +rma_recordsmanagement.property.rma_reviewPeriod.title=\u00dcberpr\u00fcfungszeitraum +rma_recordsmanagement.property.rma_reviewPeriod.decription=\u00dcberpr\u00fcfungszeitraum +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Kennzeichen f\u00fcr besonders relevante Records +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Kennzeichen f\u00fcr besonders relevante Records + +rma_recordsmanagement.aspect.rma_record.title=Record +rma_recordsmanagement.aspect.rma_record.decription=Record +rma_recordsmanagement.property.rma_dateFiled.title=Ablagedatum +rma_recordsmanagement.property.rma_dateFiled.decription=Ablagedatum +rma_recordsmanagement.property.rma_origionalName=Originalname + +rma_recordsmanagement.aspect.rma_recordMetaData.title=Record-Metadaten +rma_recordsmanagement.aspect.rma_recordMetaData.description=Markeraspekt f\u00fcr Record-Metadaten + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Gemeinsame Record-Details +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Gemeinsame Metadaten aller Record-Typen +rma_recordsmanagement.property.rma_location.title=Ort +rma_recordsmanagement.property.rma_location.decription=Ort + +rma_recordsmanagement.aspect.rma_vitalRecord.title=Besonders relevanter Record +rma_recordsmanagement.aspect.rma_vitalRecord.decription=Besonders relevanter Record +rma_recordsmanagement.property.rma_reviewAsOf.title=N\u00e4chste \u00dcberpr\u00fcfung +rma_recordsmanagement.property.rma_reviewAsOf.decription=N\u00e4chste \u00dcberpr\u00fcfung +rma_recordsmanagement.property.rma_notificationIssued.title=Gibt an, dass f\u00fcr diesen Record eine Benachrichtigung aufgrund einer f\u00e4lligen \u00dcberpr\u00fcfung ausgegeben wurde. +rma_recordsmanagement.property.rma_notificationIssued.decription=Gibt an, dass f\u00fcr diesen Record eine Benachrichtigung aufgrund einer f\u00e4lligen \u00dcberpr\u00fcfung ausgegeben wurde. + +rma_recordsmanagement.aspect.rma_scheduled.title=Geplant +rma_recordsmanagement.aspect.rma_scheduled.decription=Geplant +rma_recordsmanagement.association.rma_dispositionSchedule.title=Aufbewahrungsplan +rma_recordsmanagement.association.rma_dispositionSchedule.decription=Aufbewahrungsplan + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Aufbewahrungszyklus +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Aufbewahrungszyklus +rma_recordsmanagement.association.rma_nextDispositionAction.title=N\u00e4chste Aufbewahrungsaktion +rma_recordsmanagement.association.rma_nextDispositionAction.decription=N\u00e4chste Aufbewahrungsaktion +rma_recordsmanagement.association.rma_dispositionActionHistory.title=Aufbewahrungsaktionsverlauf +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Aufbewahrungsaktionsverlauf + +rma_recordsmanagement.aspect.rma_cutOff.title=Trennen +rma_recordsmanagement.aspect.rma_cutOff.decription=Trennen +rma_recordsmanagement.property.rma_cutOffDate.title=Trenndatum +rma_recordsmanagement.property.rma_cutOffDate.decription=Trenndatum + +rma_recordsmanagement.aspect.rma_transferred.title=\u00dcbertragen +rma_recordsmanagement.aspect.rma_transferred.decription=\u00dcbertragen + +rma_recordsmanagement.aspect.rma_ascended.title=In Archiv aufgenommen +rma_recordsmanagement.aspect.rma_ascended.decription=In Archiv aufgenommen + +rma_recordsmanagement.aspect.rma_frozen.title=Gesperrt +rma_recordsmanagement.aspect.rma_frozen.decription=Gesperrt +rma_recordsmanagement.property.rma_frozenAt.title=Gehalten in +rma_recordsmanagement.property.rma_frozenAt.decription=Gehalten in +rma_recordsmanagement.property.rma_frozenBy.title=Gehalten von +rma_recordsmanagement.property.rma_frozenBy.decription=Gehalten von + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Root von Caveat-Konfiguration +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Root von Caveat-Konfiguration +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat-Konfiguration +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat-Konfiguration + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Root von E-Mail-Konfiguration +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Root von E-Mail-Konfiguration +rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-Mail-Konfiguration +rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-Mail-Konfiguration + +rma_recordsmanagement.aspect.rma_recordSearch.title=Record-Suche +rma_recordsmanagement.aspect.rma_recordSearch.decription=Informationen zur Unterst\u00fctzung der Records Management Suche +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Mit Aufbewahrungsplan +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Gibt an, ob das Element \u00fcber einen zugeordneten Aufbewahrungsplan verf\u00fcgt +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Name der Aufbewahrungsaktion +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Der Name der n\u00e4chsten Aufbewahrungsaktion +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Start der Aufbewahrungsaktion +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=Das Datum, ab dem die n\u00e4chste Aufbewahrungsaktion erlaubt ist +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Aufbewahrungszeitraum +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Aufbewahrungszeitraum +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Ausdruck f\u00fcr Aufbewahrungszeitraum +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Ausdruck f\u00fcr Aufbewahrungszeitraum +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Erlaubte Aufbewahrungsereignisse +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Erlaubte Aufbewahrungsereignisse +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Aufbewahrungsereignisse +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Aufbewahrungsereignisse +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Aufbewahrungs-Authority +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Aufbewahrungs-Authority +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Aufbewahrungsanweisungen +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Aufbewahrungsanweisungen +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Sperrgrund +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Sperrgrund +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u00dcberpr\u00fcfungszeitraum f\u00fcr besonders relevante Records +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u00dcberpr\u00fcfungszeitraum f\u00fcr besonders relevante Records +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Ausdruck f\u00fcr \u00dcberpr\u00fcfungszeitraum +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Ausdruck f\u00fcr \u00dcberpr\u00fcfungszeitraum + +rma_recordsmanagement.aspect.rma_versionedRecord.title=Versionierter Record +rma_recordsmanagement.aspect.rma_versionedRecord.decription=Versionierter Record + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Nicht ver\u00f6ffentlichte Aktualisierung +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Nicht ver\u00f6ffentlichte Aktualisierung +rma_recordsmanagement.property.rma_unpublishedUpdate.title=Nicht ver\u00f6ffentlichte Aktualisierung +rma_recordsmanagement.property.rma_unpublishedUpdate.description=Gibt an, ob eine nicht ver\u00f6ffentlichte Aktualisierung vorhanden ist. +rma_recordsmanagement.property.rma_updateTo.title=Aktualisieren auf +rma_recordsmanagement.property.rma_updateTo.description=Das Ziel der Aktualisierung. +rma_recordsmanagement.property.rma_updatedProperties.title=Aktualisierte Eigenschaften +rma_recordsmanagement.property.rma_updatedProperties.description=Die aktualisierten Eigenschaften. +rma_recordsmanagement.property.rma_publishInProgress.title=Laufende Ver\u00f6ffentlichung +rma_recordsmanagement.property.rma_publishInProgress.description=Gibt an, ob derzeit eine Ver\u00f6ffentlichung durchgef\u00fchrt wird. + +rma_recordsmanagement.aspect.dod_ghosted.title=Nur Metadaten enthaltender Record +rma_recordsmanagement.aspect.dod_ghosted.description=Nur Metadaten enthaltender Record + +listconstraint.rmc_tlList.title=Speicherorte \u00fcbertragen listconstraint.rmc_smList.title=Zus\u00e4tzliche Markierungen \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_es.properties index 2019560b0a..9c5696add9 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_es.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=Modelo de contenido de gesti\u00f3n de documentos de archivo - -rma_recordsmanagement.type.rma_rmsite.title=Sitio de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.type.rma_rmsite.description=Sitio especializado para gesti\u00f3n de documentos de archivo - -rma_recordsmanagement.type.rma_caveatConfig.title=Configuraci\u00f3n de los controles de seguridad -rma_recordsmanagement.type.rma_caveatConfig.decription=Configuraci\u00f3n de los controles de seguridad - -rma_recordsmanagement.type.rma_emailConfig.title=Configuraci\u00f3n de correo electr\u00f3nico -rma_recordsmanagement.type.rma_emailConfig.decription=Configuraci\u00f3n de correo electr\u00f3nico - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Contenedor de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Contenedor de gesti\u00f3n de documentos de archivo - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Contenedor ra\u00edz de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Contenedor ra\u00edz de gesti\u00f3n de documentos de archivo - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Planificaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Planificaci\u00f3n de retenci\u00f3n - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Autoridad de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autoridad de retenci\u00f3n - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Instrucciones de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instrucciones de retenci\u00f3n - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Retenci\u00f3n de nivel de documento de archivo -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Retenci\u00f3n de nivel de documento de archivo - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Acciones de retenci\u00f3n -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Acciones de retenci\u00f3n - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definici\u00f3n de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definici\u00f3n de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionActionName.title=Nombre de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionActionName.decription=Nombre de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionDescription.title=Descripci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionDescription.decription=Descripci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionLocation.title=Ubicaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionLocation.decription=Ubicaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionPeriod.title=Periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propiedad del periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propiedad del periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEvent.title=Evento de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinaci\u00f3n de evento de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinaci\u00f3n de evento de retenci\u00f3n - -rma_recordsmanagement.type.rma_recordFolder.title=Carpeta de documentos de archivo -rma_recordsmanagement.type.rma_recordFolder.decription=Carpeta de documentos de archivo -rma_recordsmanagement.property.rma_isClosed.title=Documento de archivo -rma_recordsmanagement.property.rma_isClosed.decription=Documento de archivo - -rma_recordsmanagement.type.rma_recordCategory.title=Categor\u00eda de documentos de archivo -rma_recordsmanagement.type.rma_recordCategory.decription=Categor\u00eda de documentos de archivo - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento no electr\u00f3nico -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento no electr\u00f3nico -rma_recordsmanagement.property.rma_physicalSize.title=Tama\u00f1o f\u00edsico -rma_recordsmanagement.property.rma_physicalSize.decription=El tama\u00f1o del documento en metros lineales. -rma_recordsmanagement.property.rma_numberOfCopies.title=N\u00famero de copias -rma_recordsmanagement.property.rma_numberOfCopies.description=El n\u00famero de copias del documento. -rma_recordsmanagement.property.rma_storageLocation.title=Ubicaci\u00f3n de almacenamiento -rma_recordsmanagement.property.rma_storageLocation.decription=La ubicaci\u00f3n f\u00edsica de almacenamiento del documento de archivo. -rma_recordsmanagement.property.rma_shelf.title=Estanter\u00eda -rma_recordsmanagement.property.rma_shelf.decription=La estanter\u00eda en la que est\u00e1 guardado el documento de archivo. -rma_recordsmanagement.property.rma_box.title=Caja -rma_recordsmanagement.property.rma_box.description=La caja en la que est\u00e1 guardado el documento de archivo. -rma_recordsmanagement.property.rma_file.title=Fichero -rma_recordsmanagement.property.rma_file.decription=El fichero en el que est\u00e1 guardado el documento de archivo. - -rma_recordsmanagement.type.rma_dispositionAction.title=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.type.rma_dispositionAction.decription=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionActionId.title=ID de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAction.title=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAction.decription=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAsOf.title=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventos de retenci\u00f3n elegibles -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventos de retenci\u00f3n elegibles -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Acci\u00f3n de retenci\u00f3n iniciada en -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Acci\u00f3n de retenci\u00f3n iniciada en -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Acci\u00f3n de retenci\u00f3n iniciada por -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Acci\u00f3n de retenci\u00f3n iniciada por -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Acci\u00f3n de retenci\u00f3n completada en -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Acci\u00f3n de retenci\u00f3n completada en -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Acci\u00f3n de retenci\u00f3n completada por -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Acci\u00f3n de retenci\u00f3n completada por -rma_recordsmanagement.association.rma_eventExecutions.title=Ejecuciones de evento -rma_recordsmanagement.association.rma_eventExecutions.decription=Ejecuciones de evento - -rma_recordsmanagement.type.rma_eventExecution.title=Ejecuci\u00f3n de evento -rma_recordsmanagement.type.rma_eventExecution.decription=Ejecuci\u00f3n de evento -rma_recordsmanagement.property.rma_eventExecutionName.title=Nombre de evento -rma_recordsmanagement.property.rma_eventExecutionName.decription=Nombre de evento -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento autom\u00e1tico -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento autom\u00e1tico -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento completo -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento completo -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento completado por -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento completado por -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento completado en -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento completado en - -rma_recordsmanagement.type.rma_hold.title=Bloqueo -rma_recordsmanagement.type.rma_hold.decription=Bloqueo -rma_recordsmanagement.property.rma_holdReason.title=Raz\u00f3n de bloqueo -rma_recordsmanagement.property.rma_holdReason.decription=Raz\u00f3n de bloqueo -rma_recordsmanagement.association.rma_frozenRecords.title=Documentos de archivo bloqueados -rma_recordsmanagement.association.rma_frozenRecords.decription=Documentos de archivo bloqueados - -rma_recordsmanagement.type.rma_transfer.title=Transferencia -rma_recordsmanagement.type.rma_transfer.decription=Transferencia -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicador de adhesi\u00f3n y transferencia -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicador de adhesi\u00f3n y transferencia -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicador de transferencia de PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicador de transferencia de PDF -rma_recordsmanagement.property.rma_transferLocation.title=Transferencia de PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Transferencia de PDF -rma_recordsmanagement.association.rma_transferred.title=Transferido -rma_recordsmanagement.association.rma_transferred.decription=Transferido - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente del plan de ficheros -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente del plan de ficheros -rma_recordsmanagement.property.rma_rootNodeRef.title=Nodo ra\u00edz -rma_recordsmanagement.property.rma_rootNodeRef.decription=Nodo ra\u00edz - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Ra\u00edz de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Ra\u00edz de gesti\u00f3n de documentos de archivo -rma_recordsmanagement.association.rma_holds.title=Bloqueos -rma_recordsmanagement.association.rma_holds.decription=Bloqueos -rma_recordsmanagement.association.rma_transfers.title=Transferencias -rma_recordsmanagement.association.rma_transfers.decription=Transferencias - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Documento de archivo completado -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Documento de archivo completado -rma_recordsmanagement.property.rma_declaredAt.title=Fecha de finalizaci\u00f3n -rma_recordsmanagement.property.rma_declaredAt.decription=Fecha de finalizaci\u00f3n -rma_recordsmanagement.property.rma_declaredBy.title=Completado por -rma_recordsmanagement.property.rma_declaredBy.decription=Completado por - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificador de componente de documento de archivo -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificador de componente de documento de archivo -rma_recordsmanagement.property.rma_identifier.title=ID de documento de archivo -rma_recordsmanagement.property.rma_identifier.decription=Identificador \u00fanico de documento de archivo -rma_recordsmanagement.property.rma_dbUniquenessId.title=Singularidad de la base de datos -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Singularidad de la base de datos - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definici\u00f3n de documento de archivo vital -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definici\u00f3n de documento de archivo vital - -rma_recordsmanagement.property.rma_reviewPeriod.title=Per\u00edodo de revisi\u00f3n -rma_recordsmanagement.property.rma_reviewPeriod.decription=Per\u00edodo de revisi\u00f3n -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicador de documento de archivo vital -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicador de documento de archivo vital - -rma_recordsmanagement.aspect.rma_record.title=Documento de archivo -rma_recordsmanagement.aspect.rma_record.decription=Documento de archivo -rma_recordsmanagement.property.rma_dateFiled.title=Fecha de archivado -rma_recordsmanagement.property.rma_dateFiled.decription=Fecha de archivado -rma_recordsmanagement.property.rma_origionalName=Nombre original - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadatos de documento de archivo -rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspecto de marcador para metadatos del documento de archivo - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Detalles de documento de archivo com\u00fan -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadatos comunes para todos los tipos de documento de archivo -rma_recordsmanagement.property.rma_location.title=Ubicaci\u00f3n -rma_recordsmanagement.property.rma_location.decription=Ubicaci\u00f3n - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Documento de archivo vital -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Documento de archivo vital -rma_recordsmanagement.property.rma_reviewAsOf.title=Pr\u00f3xima revisi\u00f3n -rma_recordsmanagement.property.rma_reviewAsOf.decription=Pr\u00f3xima revisi\u00f3n -rma_recordsmanagement.property.rma_notificationIssued.title=Indica que se ha emitido una notificaci\u00f3n de pendiente de revisi\u00f3n para este documento de archivo -rma_recordsmanagement.property.rma_notificationIssued.decription=Indica que se ha emitido una notificaci\u00f3n de pendiente de revisi\u00f3n para este documento de archivo - -rma_recordsmanagement.aspect.rma_scheduled.title=Planificado -rma_recordsmanagement.aspect.rma_scheduled.decription=Planificado -rma_recordsmanagement.association.rma_dispositionSchedule.title=Planificaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Planificaci\u00f3n de retenci\u00f3n - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo de vida de retenci\u00f3n -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo de vida de retenci\u00f3n -rma_recordsmanagement.association.rma_nextDispositionAction.title=Pr\u00f3xima acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Pr\u00f3xima acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historial de acciones de retenci\u00f3n -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historial de acciones de retenci\u00f3n - -rma_recordsmanagement.aspect.rma_cutOff.title=Interrumpir -rma_recordsmanagement.aspect.rma_cutOff.decription=Interrumpir -rma_recordsmanagement.property.rma_cutOffDate.title=Fecha de interrupci\u00f3n -rma_recordsmanagement.property.rma_cutOffDate.decription=Fecha de interrupci\u00f3n - -rma_recordsmanagement.aspect.rma_transferred.title=Transferido -rma_recordsmanagement.aspect.rma_transferred.decription=Transferido - -rma_recordsmanagement.aspect.rma_ascended.title=Ascendido -rma_recordsmanagement.aspect.rma_ascended.decription=Ascendido - -rma_recordsmanagement.aspect.rma_frozen.title=En espera -rma_recordsmanagement.aspect.rma_frozen.decription=En espera -rma_recordsmanagement.property.rma_frozenAt.title=Bloqueado en -rma_recordsmanagement.property.rma_frozenAt.decription=Bloqueado en -rma_recordsmanagement.property.rma_frozenBy.title=Bloqueado por -rma_recordsmanagement.property.rma_frozenBy.decription=Bloqueado por - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Ra\u00edz de configuraci\u00f3n de advertencia -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Ra\u00edz de configuraci\u00f3n de advertencia -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configuraci\u00f3n de advertencia -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configuraci\u00f3n de advertencia - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Ra\u00edz de configuraci\u00f3n de correo electr\u00f3nico -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Ra\u00edz de configuraci\u00f3n de correo electr\u00f3nico -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configuraci\u00f3n de correo electr\u00f3nico -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configuraci\u00f3n de correo electr\u00f3nico - -rma_recordsmanagement.aspect.rma_recordSearch.title=B\u00fasqueda de documentos de archivo -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informaci\u00f3n para b\u00fasqueda de Records Management -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Tiene planificaci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica si el elemento tiene planificaci\u00f3n de retenci\u00f3n asociada -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nombre de acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=El nombre de la pr\u00f3xima acci\u00f3n de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Acci\u00f3n de retenci\u00f3n de -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La fecha en la cual la pr\u00f3xima acci\u00f3n de retenci\u00f3n reunir\u00e1 los requisitos -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Expresi\u00f3n de periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Expresi\u00f3n de periodo de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventos de retenci\u00f3n elegibles -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventos de retenci\u00f3n elegibles -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventos de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventos de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autoridad de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autoridad de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instrucciones de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instrucciones de retenci\u00f3n -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Raz\u00f3n de bloqueo -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Raz\u00f3n de bloqueo -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Per\u00edodo de revisi\u00f3n de documento de archivo vital -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Per\u00edodo de revisi\u00f3n de documento de archivo vital -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Expresi\u00f3n de per\u00edodo de revisi\u00f3n -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Expresi\u00f3n de per\u00edodo de revisi\u00f3n - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Documento de archivo versionado -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Documento de archivo versionado - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Actualizaci\u00f3n sin publicar -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Actualizaci\u00f3n sin publicar -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Actualizaci\u00f3n sin publicar -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica si existe una actualizaci\u00f3n sin publicar -rma_recordsmanagement.property.rma_updateTo.title=Actualizar a -rma_recordsmanagement.property.rma_updateTo.description=Destino de la actualizaci\u00f3n -rma_recordsmanagement.property.rma_updatedProperties.title=Propiedades actualizadas -rma_recordsmanagement.property.rma_updatedProperties.description=Las propiedades actualizadas -rma_recordsmanagement.property.rma_publishInProgress.title=Publicaci\u00f3n en curso -rma_recordsmanagement.property.rma_publishInProgress.description=Indica si una publicaci\u00f3n se encuentra en curso - -rma_recordsmanagement.aspect.dod_ghosted.title=Documento de archivo solo de metadatos -rma_recordsmanagement.aspect.dod_ghosted.description=Documento de archivo solo de metadatos - -listconstraint.rmc_tlList.title=Ubicaciones de la transferencia +rma_recordsmanagement.description=Modelo de contenido de gesti\u00f3n de documentos de archivo + +rma_recordsmanagement.type.rma_rmsite.title=Sitio de gesti\u00f3n de documentos de archivo +rma_recordsmanagement.type.rma_rmsite.description=Sitio especializado para gesti\u00f3n de documentos de archivo + +rma_recordsmanagement.type.rma_caveatConfig.title=Configuraci\u00f3n de los controles de seguridad +rma_recordsmanagement.type.rma_caveatConfig.decription=Configuraci\u00f3n de los controles de seguridad + +rma_recordsmanagement.type.rma_emailConfig.title=Configuraci\u00f3n de correo electr\u00f3nico +rma_recordsmanagement.type.rma_emailConfig.decription=Configuraci\u00f3n de correo electr\u00f3nico + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=Contenedor de gesti\u00f3n de documentos de archivo +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Contenedor de gesti\u00f3n de documentos de archivo + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Contenedor ra\u00edz de gesti\u00f3n de documentos de archivo +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Contenedor ra\u00edz de gesti\u00f3n de documentos de archivo + +rma_recordsmanagement.type.rma_dispositionSchedule.title=Planificaci\u00f3n de retenci\u00f3n +rma_recordsmanagement.type.rma_dispositionSchedule.decription=Planificaci\u00f3n de retenci\u00f3n + +rma_recordsmanagement.property.rma_dispositionAuthority.title=Autoridad de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autoridad de retenci\u00f3n + +rma_recordsmanagement.property.rma_dispositionInstructions.title=Instrucciones de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instrucciones de retenci\u00f3n + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=Retenci\u00f3n de nivel de documento de archivo +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Retenci\u00f3n de nivel de documento de archivo + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Acciones de retenci\u00f3n +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Acciones de retenci\u00f3n + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definici\u00f3n de acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definici\u00f3n de acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionActionName.title=Nombre de acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionActionName.decription=Nombre de acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionDescription.title=Descripci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionDescription.decription=Descripci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionLocation.title=Ubicaci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionLocation.decription=Ubicaci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionPeriod.title=Periodo de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionPeriod.decription=Periodo de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propiedad del periodo de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propiedad del periodo de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionEvent.title=Evento de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinaci\u00f3n de evento de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinaci\u00f3n de evento de retenci\u00f3n + +rma_recordsmanagement.type.rma_recordFolder.title=Carpeta de documentos de archivo +rma_recordsmanagement.type.rma_recordFolder.decription=Carpeta de documentos de archivo +rma_recordsmanagement.property.rma_isClosed.title=Documento de archivo +rma_recordsmanagement.property.rma_isClosed.decription=Documento de archivo + +rma_recordsmanagement.type.rma_recordCategory.title=Categor\u00eda de documentos de archivo +rma_recordsmanagement.type.rma_recordCategory.decription=Categor\u00eda de documentos de archivo + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento no electr\u00f3nico +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento no electr\u00f3nico +rma_recordsmanagement.property.rma_physicalSize.title=Tama\u00f1o f\u00edsico +rma_recordsmanagement.property.rma_physicalSize.decription=El tama\u00f1o del documento en metros lineales. +rma_recordsmanagement.property.rma_numberOfCopies.title=N\u00famero de copias +rma_recordsmanagement.property.rma_numberOfCopies.description=El n\u00famero de copias del documento. +rma_recordsmanagement.property.rma_storageLocation.title=Ubicaci\u00f3n de almacenamiento +rma_recordsmanagement.property.rma_storageLocation.decription=La ubicaci\u00f3n f\u00edsica de almacenamiento del documento de archivo. +rma_recordsmanagement.property.rma_shelf.title=Estanter\u00eda +rma_recordsmanagement.property.rma_shelf.decription=La estanter\u00eda en la que est\u00e1 guardado el documento de archivo. +rma_recordsmanagement.property.rma_box.title=Caja +rma_recordsmanagement.property.rma_box.description=La caja en la que est\u00e1 guardado el documento de archivo. +rma_recordsmanagement.property.rma_file.title=Fichero +rma_recordsmanagement.property.rma_file.decription=El fichero en el que est\u00e1 guardado el documento de archivo. + +rma_recordsmanagement.type.rma_dispositionAction.title=Acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.type.rma_dispositionAction.decription=Acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionActionId.title=ID de acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionActionId.decription=ID de acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionAction.title=Acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionAction.decription=Acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionAsOf.title=Acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionAsOf.decription=Acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventos de retenci\u00f3n elegibles +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventos de retenci\u00f3n elegibles +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Acci\u00f3n de retenci\u00f3n iniciada en +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Acci\u00f3n de retenci\u00f3n iniciada en +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Acci\u00f3n de retenci\u00f3n iniciada por +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Acci\u00f3n de retenci\u00f3n iniciada por +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Acci\u00f3n de retenci\u00f3n completada en +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Acci\u00f3n de retenci\u00f3n completada en +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Acci\u00f3n de retenci\u00f3n completada por +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Acci\u00f3n de retenci\u00f3n completada por +rma_recordsmanagement.association.rma_eventExecutions.title=Ejecuciones de evento +rma_recordsmanagement.association.rma_eventExecutions.decription=Ejecuciones de evento + +rma_recordsmanagement.type.rma_eventExecution.title=Ejecuci\u00f3n de evento +rma_recordsmanagement.type.rma_eventExecution.decription=Ejecuci\u00f3n de evento +rma_recordsmanagement.property.rma_eventExecutionName.title=Nombre de evento +rma_recordsmanagement.property.rma_eventExecutionName.decription=Nombre de evento +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento autom\u00e1tico +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento autom\u00e1tico +rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento completo +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento completo +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento completado por +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento completado por +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento completado en +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento completado en + +rma_recordsmanagement.type.rma_hold.title=Bloqueo +rma_recordsmanagement.type.rma_hold.decription=Bloqueo +rma_recordsmanagement.property.rma_holdReason.title=Raz\u00f3n de bloqueo +rma_recordsmanagement.property.rma_holdReason.decription=Raz\u00f3n de bloqueo +rma_recordsmanagement.association.rma_frozenRecords.title=Documentos de archivo bloqueados +rma_recordsmanagement.association.rma_frozenRecords.decription=Documentos de archivo bloqueados + +rma_recordsmanagement.type.rma_transfer.title=Transferencia +rma_recordsmanagement.type.rma_transfer.decription=Transferencia +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicador de adhesi\u00f3n y transferencia +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicador de adhesi\u00f3n y transferencia +rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicador de transferencia de PDF +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicador de transferencia de PDF +rma_recordsmanagement.property.rma_transferLocation.title=Transferencia de PDF +rma_recordsmanagement.property.rma_transferLocation.decription=Transferencia de PDF +rma_recordsmanagement.association.rma_transferred.title=Transferido +rma_recordsmanagement.association.rma_transferred.decription=Transferido + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente del plan de ficheros +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente del plan de ficheros +rma_recordsmanagement.property.rma_rootNodeRef.title=Nodo ra\u00edz +rma_recordsmanagement.property.rma_rootNodeRef.decription=Nodo ra\u00edz + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Ra\u00edz de gesti\u00f3n de documentos de archivo +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Ra\u00edz de gesti\u00f3n de documentos de archivo +rma_recordsmanagement.association.rma_holds.title=Bloqueos +rma_recordsmanagement.association.rma_holds.decription=Bloqueos +rma_recordsmanagement.association.rma_transfers.title=Transferencias +rma_recordsmanagement.association.rma_transfers.decription=Transferencias + +rma_recordsmanagement.aspect.rma_declaredRecord.title=Documento de archivo completado +rma_recordsmanagement.aspect.rma_declaredRecord.decription=Documento de archivo completado +rma_recordsmanagement.property.rma_declaredAt.title=Fecha de finalizaci\u00f3n +rma_recordsmanagement.property.rma_declaredAt.decription=Fecha de finalizaci\u00f3n +rma_recordsmanagement.property.rma_declaredBy.title=Completado por +rma_recordsmanagement.property.rma_declaredBy.decription=Completado por + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificador de componente de documento de archivo +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificador de componente de documento de archivo +rma_recordsmanagement.property.rma_identifier.title=ID de documento de archivo +rma_recordsmanagement.property.rma_identifier.decription=Identificador \u00fanico de documento de archivo +rma_recordsmanagement.property.rma_dbUniquenessId.title=Singularidad de la base de datos +rma_recordsmanagement.property.rma_dbUniquenessId.decription=Singularidad de la base de datos + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definici\u00f3n de documento de archivo vital +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definici\u00f3n de documento de archivo vital + +rma_recordsmanagement.property.rma_reviewPeriod.title=Per\u00edodo de revisi\u00f3n +rma_recordsmanagement.property.rma_reviewPeriod.decription=Per\u00edodo de revisi\u00f3n +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicador de documento de archivo vital +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicador de documento de archivo vital + +rma_recordsmanagement.aspect.rma_record.title=Documento de archivo +rma_recordsmanagement.aspect.rma_record.decription=Documento de archivo +rma_recordsmanagement.property.rma_dateFiled.title=Fecha de archivado +rma_recordsmanagement.property.rma_dateFiled.decription=Fecha de archivado +rma_recordsmanagement.property.rma_origionalName=Nombre original + +rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadatos de documento de archivo +rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspecto de marcador para metadatos del documento de archivo + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Detalles de documento de archivo com\u00fan +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadatos comunes para todos los tipos de documento de archivo +rma_recordsmanagement.property.rma_location.title=Ubicaci\u00f3n +rma_recordsmanagement.property.rma_location.decription=Ubicaci\u00f3n + +rma_recordsmanagement.aspect.rma_vitalRecord.title=Documento de archivo vital +rma_recordsmanagement.aspect.rma_vitalRecord.decription=Documento de archivo vital +rma_recordsmanagement.property.rma_reviewAsOf.title=Pr\u00f3xima revisi\u00f3n +rma_recordsmanagement.property.rma_reviewAsOf.decription=Pr\u00f3xima revisi\u00f3n +rma_recordsmanagement.property.rma_notificationIssued.title=Indica que se ha emitido una notificaci\u00f3n de pendiente de revisi\u00f3n para este documento de archivo +rma_recordsmanagement.property.rma_notificationIssued.decription=Indica que se ha emitido una notificaci\u00f3n de pendiente de revisi\u00f3n para este documento de archivo + +rma_recordsmanagement.aspect.rma_scheduled.title=Planificado +rma_recordsmanagement.aspect.rma_scheduled.decription=Planificado +rma_recordsmanagement.association.rma_dispositionSchedule.title=Planificaci\u00f3n de retenci\u00f3n +rma_recordsmanagement.association.rma_dispositionSchedule.decription=Planificaci\u00f3n de retenci\u00f3n + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo de vida de retenci\u00f3n +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo de vida de retenci\u00f3n +rma_recordsmanagement.association.rma_nextDispositionAction.title=Pr\u00f3xima acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.association.rma_nextDispositionAction.decription=Pr\u00f3xima acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historial de acciones de retenci\u00f3n +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historial de acciones de retenci\u00f3n + +rma_recordsmanagement.aspect.rma_cutOff.title=Interrumpir +rma_recordsmanagement.aspect.rma_cutOff.decription=Interrumpir +rma_recordsmanagement.property.rma_cutOffDate.title=Fecha de interrupci\u00f3n +rma_recordsmanagement.property.rma_cutOffDate.decription=Fecha de interrupci\u00f3n + +rma_recordsmanagement.aspect.rma_transferred.title=Transferido +rma_recordsmanagement.aspect.rma_transferred.decription=Transferido + +rma_recordsmanagement.aspect.rma_ascended.title=Ascendido +rma_recordsmanagement.aspect.rma_ascended.decription=Ascendido + +rma_recordsmanagement.aspect.rma_frozen.title=En espera +rma_recordsmanagement.aspect.rma_frozen.decription=En espera +rma_recordsmanagement.property.rma_frozenAt.title=Bloqueado en +rma_recordsmanagement.property.rma_frozenAt.decription=Bloqueado en +rma_recordsmanagement.property.rma_frozenBy.title=Bloqueado por +rma_recordsmanagement.property.rma_frozenBy.decription=Bloqueado por + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Ra\u00edz de configuraci\u00f3n de advertencia +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Ra\u00edz de configuraci\u00f3n de advertencia +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configuraci\u00f3n de advertencia +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configuraci\u00f3n de advertencia + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Ra\u00edz de configuraci\u00f3n de correo electr\u00f3nico +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Ra\u00edz de configuraci\u00f3n de correo electr\u00f3nico +rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configuraci\u00f3n de correo electr\u00f3nico +rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configuraci\u00f3n de correo electr\u00f3nico + +rma_recordsmanagement.aspect.rma_recordSearch.title=B\u00fasqueda de documentos de archivo +rma_recordsmanagement.aspect.rma_recordSearch.decription=Informaci\u00f3n para b\u00fasqueda de Records Management +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Tiene planificaci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica si el elemento tiene planificaci\u00f3n de retenci\u00f3n asociada +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nombre de acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=El nombre de la pr\u00f3xima acci\u00f3n de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Acci\u00f3n de retenci\u00f3n de +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La fecha en la cual la pr\u00f3xima acci\u00f3n de retenci\u00f3n reunir\u00e1 los requisitos +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Periodo de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Periodo de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Expresi\u00f3n de periodo de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Expresi\u00f3n de periodo de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventos de retenci\u00f3n elegibles +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventos de retenci\u00f3n elegibles +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventos de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventos de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autoridad de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autoridad de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instrucciones de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instrucciones de retenci\u00f3n +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Raz\u00f3n de bloqueo +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Raz\u00f3n de bloqueo +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Per\u00edodo de revisi\u00f3n de documento de archivo vital +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Per\u00edodo de revisi\u00f3n de documento de archivo vital +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Expresi\u00f3n de per\u00edodo de revisi\u00f3n +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Expresi\u00f3n de per\u00edodo de revisi\u00f3n + +rma_recordsmanagement.aspect.rma_versionedRecord.title=Documento de archivo versionado +rma_recordsmanagement.aspect.rma_versionedRecord.decription=Documento de archivo versionado + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Actualizaci\u00f3n sin publicar +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Actualizaci\u00f3n sin publicar +rma_recordsmanagement.property.rma_unpublishedUpdate.title=Actualizaci\u00f3n sin publicar +rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica si existe una actualizaci\u00f3n sin publicar +rma_recordsmanagement.property.rma_updateTo.title=Actualizar a +rma_recordsmanagement.property.rma_updateTo.description=Destino de la actualizaci\u00f3n +rma_recordsmanagement.property.rma_updatedProperties.title=Propiedades actualizadas +rma_recordsmanagement.property.rma_updatedProperties.description=Las propiedades actualizadas +rma_recordsmanagement.property.rma_publishInProgress.title=Publicaci\u00f3n en curso +rma_recordsmanagement.property.rma_publishInProgress.description=Indica si una publicaci\u00f3n se encuentra en curso + +rma_recordsmanagement.aspect.dod_ghosted.title=Documento de archivo solo de metadatos +rma_recordsmanagement.aspect.dod_ghosted.description=Documento de archivo solo de metadatos + +listconstraint.rmc_tlList.title=Ubicaciones de la transferencia listconstraint.rmc_smList.title=Marcas complementarias \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_fr.properties index f02d180488..bc0e4c5526 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_fr.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=Mod\u00e8le de contenu de gestion des archives - -rma_recordsmanagement.type.rma_rmsite.title=Site de gestion des archives -rma_recordsmanagement.type.rma_rmsite.description=Site sp\u00e9cialis\u00e9 pour la gestion des archives - -rma_recordsmanagement.type.rma_caveatConfig.title=Configuration des contr\u00f4les de s\u00e9curit\u00e9 -rma_recordsmanagement.type.rma_caveatConfig.decription=Configuration des contr\u00f4les de s\u00e9curit\u00e9 - -rma_recordsmanagement.type.rma_emailConfig.title=Configuration du courriel -rma_recordsmanagement.type.rma_emailConfig.decription=Configuration du courriel - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Conteneur de gestion des archives -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Conteneur de gestion des archives - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Conteneur de la racine du site de gestion des archives -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Conteneur de la racine du site de gestion des archives - -rma_recordsmanagement.type.rma_dispositionSchedule.title=R\u00e8gle de r\u00e9tention -rma_recordsmanagement.type.rma_dispositionSchedule.decription=R\u00e8gle de r\u00e9tention - -rma_recordsmanagement.property.rma_dispositionAuthority.title=D\u00e9tenteur de la r\u00e9tention -rma_recordsmanagement.property.rma_dispositionAuthority.decription=D\u00e9tenteur de la r\u00e9tention - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Instructions de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instructions de r\u00e9tention - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=R\u00e9tention au niveau du document d'archives -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=R\u00e9tention au niveau du document d'archives - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Actions de r\u00e9tention -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Actions de r\u00e9tention - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=D\u00e9finition de l'action de r\u00e9tention -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=D\u00e9finition de l'action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionActionName.title=Nom de l'action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionActionName.decription=Nom de l'action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionDescription.title=Description de la r\u00e9tention -rma_recordsmanagement.property.rma_dispositionDescription.decription=Description de la r\u00e9tention -rma_recordsmanagement.property.rma_dispositionLocation.title=Emplacement de la r\u00e9tention -rma_recordsmanagement.property.rma_dispositionLocation.decription=Emplacement de la r\u00e9tention -rma_recordsmanagement.property.rma_dispositionPeriod.title=P\u00e9riode de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionPeriod.decription=P\u00e9riode de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propri\u00e9t\u00e9 de la p\u00e9riode de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propri\u00e9t\u00e9 de la p\u00e9riode de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionEvent.title=Ev\u00e9nement de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionEvent.decription=Ev\u00e9nement de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinaison d'\u00e9v\u00e9nements de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinaison d'\u00e9v\u00e9nements de r\u00e9tention - -rma_recordsmanagement.type.rma_recordFolder.title=Dossier d'archives -rma_recordsmanagement.type.rma_recordFolder.decription=Dossier d'archives -rma_recordsmanagement.property.rma_isClosed.title=Document d'archives -rma_recordsmanagement.property.rma_isClosed.decription=Document d'archives - -rma_recordsmanagement.type.rma_recordCategory.title=Cat\u00e9gorie de document d'archives -rma_recordsmanagement.type.rma_recordCategory.decription=Cat\u00e9gorie de document d'archives - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Document non \u00e9lectronique -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Document non \u00e9lectronique -rma_recordsmanagement.property.rma_physicalSize.title=Taille physique -rma_recordsmanagement.property.rma_physicalSize.decription=Taille du document mesur\u00e9e en m\u00e8tres lin\u00e9aires. -rma_recordsmanagement.property.rma_numberOfCopies.title=Nombre de copies -rma_recordsmanagement.property.rma_numberOfCopies.description=Nombre de copies du document. -rma_recordsmanagement.property.rma_storageLocation.title=Emplacement de stockage -rma_recordsmanagement.property.rma_storageLocation.decription=Emplacement de stockage physique du document d'archives. -rma_recordsmanagement.property.rma_shelf.title=Etag\u00e8re -rma_recordsmanagement.property.rma_shelf.decription=Etag\u00e8re sur laquelle le document d'archives est stock\u00e9. -rma_recordsmanagement.property.rma_box.title=Bo\u00eete -rma_recordsmanagement.property.rma_box.description=Bo\u00eete dans laquelle le document d'archives est stock\u00e9. -rma_recordsmanagement.property.rma_file.title=Fichier -rma_recordsmanagement.property.rma_file.decription=Fichier dans lequel le document d'archives est stock\u00e9. - -rma_recordsmanagement.type.rma_dispositionAction.title=Action de r\u00e9tention -rma_recordsmanagement.type.rma_dispositionAction.decription=Action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionActionId.title=Identifiant de l'action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionActionId.decription=Identifiant de l'action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionAction.title=Action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionAction.decription=Action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionAsOf.title=Action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Action de r\u00e9tention -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Ev\u00e9nements de r\u00e9tention \u00e9ligibles -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Ev\u00e9nements de r\u00e9tention \u00e9ligibles -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Action de r\u00e9tention d\u00e9marr\u00e9e \u00e0 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Action de r\u00e9tention d\u00e9marr\u00e9e \u00e0 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Action de r\u00e9tention d\u00e9marr\u00e9e par -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Action de r\u00e9tention d\u00e9marr\u00e9e par -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Action de r\u00e9tention termin\u00e9e \u00e0 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Action de r\u00e9tention termin\u00e9e \u00e0 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Action de r\u00e9tention termin\u00e9e par -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Action de r\u00e9tention termin\u00e9e par -rma_recordsmanagement.association.rma_eventExecutions.title=Ex\u00e9cutions de l'\u00e9v\u00e9nement -rma_recordsmanagement.association.rma_eventExecutions.decription=Ex\u00e9cutions de l'\u00e9v\u00e9nement - -rma_recordsmanagement.type.rma_eventExecution.title=Ex\u00e9cution de l'\u00e9v\u00e9nement -rma_recordsmanagement.type.rma_eventExecution.decription=Ex\u00e9cution de l'\u00e9v\u00e9nement -rma_recordsmanagement.property.rma_eventExecutionName.title=Nom d'\u00e9v\u00e9nement -rma_recordsmanagement.property.rma_eventExecutionName.decription=Nom d'\u00e9v\u00e9nement -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Ev\u00e9nement automatique -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Ev\u00e9nement automatique -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Ev\u00e9nement termin\u00e9 -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Ev\u00e9nement termin\u00e9 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Ev\u00e9nement termin\u00e9 par -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Ev\u00e9nement termin\u00e9 par -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Ev\u00e9nement termin\u00e9 \u00e0 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Ev\u00e9nement termin\u00e9 \u00e0 - -rma_recordsmanagement.type.rma_hold.title=Suspendre -rma_recordsmanagement.type.rma_hold.decription=Suspendre -rma_recordsmanagement.property.rma_holdReason.title=Motif de suspension -rma_recordsmanagement.property.rma_holdReason.decription=Motif de suspension -rma_recordsmanagement.association.rma_frozenRecords.title=Documents d'archives suspendus -rma_recordsmanagement.association.rma_frozenRecords.decription=Documents d'archives suspendus - -rma_recordsmanagement.type.rma_transfer.title=Transf\u00e9rer -rma_recordsmanagement.type.rma_transfer.decription=Transf\u00e9rer -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transf\u00e9rer l'indicateur de versement \u00e0 un autre organisme -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transf\u00e9rer l'indicateur de versement \u00e0 un autre organisme -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transf\u00e9rer l'indicateur PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transf\u00e9rer l'indicateur PDF -rma_recordsmanagement.property.rma_transferLocation.title=Transf\u00e9rer le PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Transf\u00e9rer le PDF -rma_recordsmanagement.association.rma_transferred.title=Transf\u00e9r\u00e9 -rma_recordsmanagement.association.rma_transferred.decription=Transf\u00e9r\u00e9 - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Composant du plan de classification -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Composant du plan de classification -rma_recordsmanagement.property.rma_rootNodeRef.title=N\u0153ud racine -rma_recordsmanagement.property.rma_rootNodeRef.decription=N\u0153ud racine - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Racine du site de gestion des archives -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Racine du site de gestion des archives -rma_recordsmanagement.association.rma_holds.title=Suspensions -rma_recordsmanagement.association.rma_holds.decription=Suspensions -rma_recordsmanagement.association.rma_transfers.title=Transferts -rma_recordsmanagement.association.rma_transfers.decription=Transferts - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Document d'archives complet -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Document d'archives complet -rma_recordsmanagement.property.rma_declaredAt.title=Date d'ach\u00e8vement -rma_recordsmanagement.property.rma_declaredAt.decription=Date d'ach\u00e8vement -rma_recordsmanagement.property.rma_declaredBy.title=Compl\u00e9t\u00e9 par -rma_recordsmanagement.property.rma_declaredBy.decription=Compl\u00e9t\u00e9 par - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identifiant de composant de document d'archives -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identifiant de composant de document d'archives -rma_recordsmanagement.property.rma_identifier.title=ID du document d'archives -rma_recordsmanagement.property.rma_identifier.decription=Identifiant unique de document d'archives -rma_recordsmanagement.property.rma_dbUniquenessId.title=Unicit\u00e9 de base de donn\u00e9es -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unicit\u00e9 de base de donn\u00e9es - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=D\u00e9finition du document d'archives essentiel -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=D\u00e9finition du document d'archives essentiel - -rma_recordsmanagement.property.rma_reviewPeriod.title=P\u00e9riode de r\u00e9vision -rma_recordsmanagement.property.rma_reviewPeriod.decription=P\u00e9riode de r\u00e9vision -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Identifiant de document d'archives essentiel -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Identifiant de document d'archives essentiel - -rma_recordsmanagement.aspect.rma_record.title=Document d'archives -rma_recordsmanagement.aspect.rma_record.decription=Document d'archives -rma_recordsmanagement.property.rma_dateFiled.title=Date de versement au site des archives -rma_recordsmanagement.property.rma_dateFiled.decription=Date de versement au site des archives -rma_recordsmanagement.property.rma_origionalName=Nom d'origine - -rma_recordsmanagement.aspect.rma_recordMetaData.title=M\u00e9tadonn\u00e9es de document d'archives -rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspect du marqueur de m\u00e9tadonn\u00e9es de document d'archives - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=D\u00e9tails des documents d'archives communs -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=M\u00e9tadonn\u00e9es communes \u00e0 tous les types de document d'archives -rma_recordsmanagement.property.rma_location.title=Emplacement -rma_recordsmanagement.property.rma_location.decription=Emplacement - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Document d'archives essentiel -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Document d'archives essentiel -rma_recordsmanagement.property.rma_reviewAsOf.title=V\u00e9rification suivante -rma_recordsmanagement.property.rma_reviewAsOf.decription=V\u00e9rification suivante -rma_recordsmanagement.property.rma_notificationIssued.title=Indique qu'une notification d'arriv\u00e9e \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification a \u00e9t\u00e9 \u00e9mise pour ce document d'archives -rma_recordsmanagement.property.rma_notificationIssued.decription=Indique qu'une notification d'arriv\u00e9e \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification a \u00e9t\u00e9 \u00e9mise pour ce document d'archives - -rma_recordsmanagement.aspect.rma_scheduled.title=Planifi\u00e9 -rma_recordsmanagement.aspect.rma_scheduled.decription=Planifi\u00e9 -rma_recordsmanagement.association.rma_dispositionSchedule.title=R\u00e8gle de r\u00e9tention -rma_recordsmanagement.association.rma_dispositionSchedule.decription=R\u00e8gle de r\u00e9tention - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Etapes du d\u00e9lai de r\u00e9tention -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Etapes du d\u00e9lai de r\u00e9tention -rma_recordsmanagement.association.rma_nextDispositionAction.title=Etape suivante du d\u00e9lai de r\u00e9tention -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Etape suivante du d\u00e9lai de r\u00e9tention -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historique des actions de r\u00e9tention -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historique des actions de r\u00e9tention - -rma_recordsmanagement.aspect.rma_cutOff.title=D\u00e9classer -rma_recordsmanagement.aspect.rma_cutOff.decription=D\u00e9classer -rma_recordsmanagement.property.rma_cutOffDate.title=Date de d\u00e9classement -rma_recordsmanagement.property.rma_cutOffDate.decription=Date de d\u00e9classement - -rma_recordsmanagement.aspect.rma_transferred.title=Transf\u00e9r\u00e9 -rma_recordsmanagement.aspect.rma_transferred.decription=Transf\u00e9r\u00e9 - -rma_recordsmanagement.aspect.rma_ascended.title=Mont\u00e9 -rma_recordsmanagement.aspect.rma_ascended.decription=Mont\u00e9 - -rma_recordsmanagement.aspect.rma_frozen.title=Suspendu -rma_recordsmanagement.aspect.rma_frozen.decription=Suspendu -rma_recordsmanagement.property.rma_frozenAt.title=Suspendu \u00e0 -rma_recordsmanagement.property.rma_frozenAt.decription=Suspendu \u00e0 -rma_recordsmanagement.property.rma_frozenBy.title=Suspendu par -rma_recordsmanagement.property.rma_frozenBy.decription=Suspendu par - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Racine de configuration des avertissements -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Racine de configuration des avertissements -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configuration des avertissements -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configuration des avertissements - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Racine de configuration d'e-mail -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Racine de configuration d'e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configuration du courriel -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configuration du courriel - -rma_recordsmanagement.aspect.rma_recordSearch.title=Recherche de document d'archives -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informations pour prendre en charge la recherche dans la gestion des archives -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=A une r\u00e8gle de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indique si une r\u00e8gle de r\u00e9tention est associ\u00e9e \u00e0 l'\u00e9l\u00e9ment -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nom de l'action de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Le nom de l'\u00e9tape suivante du d\u00e9lai de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Action de r\u00e9tention de -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La date \u00e0 laquelle l'\u00e9tape suivante du d\u00e9lai de r\u00e9tention devient \u00e9ligible -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=P\u00e9riode de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=P\u00e9riode de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Expression de la p\u00e9riode de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Expression de la p\u00e9riode de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Ev\u00e9nements de r\u00e9tention \u00e9ligibles -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Ev\u00e9nements de r\u00e9tention \u00e9ligibles -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Ev\u00e9nements de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Ev\u00e9nements de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=D\u00e9tenteur de la r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=D\u00e9tenteur de la r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instructions de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instructions de r\u00e9tention -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motif de suspension -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motif de suspension -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=P\u00e9riode de v\u00e9rification du document d'archives essentiel -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=P\u00e9riode de v\u00e9rification du document d'archives essentiel -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Expression de p\u00e9riode de r\u00e9vision -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Expression de p\u00e9riode de r\u00e9vision - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Document d'archives versionn\u00e9 -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Document d'archives versionn\u00e9 - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Mise \u00e0 jour non publi\u00e9e -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Mise \u00e0 jour non publi\u00e9e -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Mise \u00e0 jour non publi\u00e9e -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indique s'il existe une mise \u00e0 jour non publi\u00e9e -rma_recordsmanagement.property.rma_updateTo.title=Mettre \u00e0 jour vers -rma_recordsmanagement.property.rma_updateTo.description=Destination de la mise \u00e0 jour -rma_recordsmanagement.property.rma_updatedProperties.title=Propri\u00e9t\u00e9s mises \u00e0 jour -rma_recordsmanagement.property.rma_updatedProperties.description=Les propri\u00e9t\u00e9s mises \u00e0 jour -rma_recordsmanagement.property.rma_publishInProgress.title=Publication en cours -rma_recordsmanagement.property.rma_publishInProgress.description=Indique si une publication est en cours - -rma_recordsmanagement.aspect.dod_ghosted.title=M\u00e9tadonn\u00e9es d'archives seulement -rma_recordsmanagement.aspect.dod_ghosted.description=M\u00e9tadonn\u00e9es d'archives seulement - -listconstraint.rmc_tlList.title=Transf\u00e9rer les emplacements +rma_recordsmanagement.description=Mod\u00e8le de contenu de gestion des archives + +rma_recordsmanagement.type.rma_rmsite.title=Site de gestion des archives +rma_recordsmanagement.type.rma_rmsite.description=Site sp\u00e9cialis\u00e9 pour la gestion des archives + +rma_recordsmanagement.type.rma_caveatConfig.title=Configuration des contr\u00f4les de s\u00e9curit\u00e9 +rma_recordsmanagement.type.rma_caveatConfig.decription=Configuration des contr\u00f4les de s\u00e9curit\u00e9 + +rma_recordsmanagement.type.rma_emailConfig.title=Configuration du courriel +rma_recordsmanagement.type.rma_emailConfig.decription=Configuration du courriel + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=Conteneur de gestion des archives +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Conteneur de gestion des archives + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Conteneur de la racine du site de gestion des archives +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Conteneur de la racine du site de gestion des archives + +rma_recordsmanagement.type.rma_dispositionSchedule.title=R\u00e8gle de r\u00e9tention +rma_recordsmanagement.type.rma_dispositionSchedule.decription=R\u00e8gle de r\u00e9tention + +rma_recordsmanagement.property.rma_dispositionAuthority.title=D\u00e9tenteur de la r\u00e9tention +rma_recordsmanagement.property.rma_dispositionAuthority.decription=D\u00e9tenteur de la r\u00e9tention + +rma_recordsmanagement.property.rma_dispositionInstructions.title=Instructions de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instructions de r\u00e9tention + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=R\u00e9tention au niveau du document d'archives +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=R\u00e9tention au niveau du document d'archives + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Actions de r\u00e9tention +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Actions de r\u00e9tention + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=D\u00e9finition de l'action de r\u00e9tention +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=D\u00e9finition de l'action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionActionName.title=Nom de l'action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionActionName.decription=Nom de l'action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionDescription.title=Description de la r\u00e9tention +rma_recordsmanagement.property.rma_dispositionDescription.decription=Description de la r\u00e9tention +rma_recordsmanagement.property.rma_dispositionLocation.title=Emplacement de la r\u00e9tention +rma_recordsmanagement.property.rma_dispositionLocation.decription=Emplacement de la r\u00e9tention +rma_recordsmanagement.property.rma_dispositionPeriod.title=P\u00e9riode de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionPeriod.decription=P\u00e9riode de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propri\u00e9t\u00e9 de la p\u00e9riode de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propri\u00e9t\u00e9 de la p\u00e9riode de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionEvent.title=Ev\u00e9nement de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionEvent.decription=Ev\u00e9nement de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinaison d'\u00e9v\u00e9nements de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinaison d'\u00e9v\u00e9nements de r\u00e9tention + +rma_recordsmanagement.type.rma_recordFolder.title=Dossier d'archives +rma_recordsmanagement.type.rma_recordFolder.decription=Dossier d'archives +rma_recordsmanagement.property.rma_isClosed.title=Document d'archives +rma_recordsmanagement.property.rma_isClosed.decription=Document d'archives + +rma_recordsmanagement.type.rma_recordCategory.title=Cat\u00e9gorie de document d'archives +rma_recordsmanagement.type.rma_recordCategory.decription=Cat\u00e9gorie de document d'archives + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=Document non \u00e9lectronique +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Document non \u00e9lectronique +rma_recordsmanagement.property.rma_physicalSize.title=Taille physique +rma_recordsmanagement.property.rma_physicalSize.decription=Taille du document mesur\u00e9e en m\u00e8tres lin\u00e9aires. +rma_recordsmanagement.property.rma_numberOfCopies.title=Nombre de copies +rma_recordsmanagement.property.rma_numberOfCopies.description=Nombre de copies du document. +rma_recordsmanagement.property.rma_storageLocation.title=Emplacement de stockage +rma_recordsmanagement.property.rma_storageLocation.decription=Emplacement de stockage physique du document d'archives. +rma_recordsmanagement.property.rma_shelf.title=Etag\u00e8re +rma_recordsmanagement.property.rma_shelf.decription=Etag\u00e8re sur laquelle le document d'archives est stock\u00e9. +rma_recordsmanagement.property.rma_box.title=Bo\u00eete +rma_recordsmanagement.property.rma_box.description=Bo\u00eete dans laquelle le document d'archives est stock\u00e9. +rma_recordsmanagement.property.rma_file.title=Fichier +rma_recordsmanagement.property.rma_file.decription=Fichier dans lequel le document d'archives est stock\u00e9. + +rma_recordsmanagement.type.rma_dispositionAction.title=Action de r\u00e9tention +rma_recordsmanagement.type.rma_dispositionAction.decription=Action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionActionId.title=Identifiant de l'action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionActionId.decription=Identifiant de l'action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionAction.title=Action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionAction.decription=Action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionAsOf.title=Action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionAsOf.decription=Action de r\u00e9tention +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Ev\u00e9nements de r\u00e9tention \u00e9ligibles +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Ev\u00e9nements de r\u00e9tention \u00e9ligibles +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Action de r\u00e9tention d\u00e9marr\u00e9e \u00e0 +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Action de r\u00e9tention d\u00e9marr\u00e9e \u00e0 +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Action de r\u00e9tention d\u00e9marr\u00e9e par +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Action de r\u00e9tention d\u00e9marr\u00e9e par +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Action de r\u00e9tention termin\u00e9e \u00e0 +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Action de r\u00e9tention termin\u00e9e \u00e0 +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Action de r\u00e9tention termin\u00e9e par +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Action de r\u00e9tention termin\u00e9e par +rma_recordsmanagement.association.rma_eventExecutions.title=Ex\u00e9cutions de l'\u00e9v\u00e9nement +rma_recordsmanagement.association.rma_eventExecutions.decription=Ex\u00e9cutions de l'\u00e9v\u00e9nement + +rma_recordsmanagement.type.rma_eventExecution.title=Ex\u00e9cution de l'\u00e9v\u00e9nement +rma_recordsmanagement.type.rma_eventExecution.decription=Ex\u00e9cution de l'\u00e9v\u00e9nement +rma_recordsmanagement.property.rma_eventExecutionName.title=Nom d'\u00e9v\u00e9nement +rma_recordsmanagement.property.rma_eventExecutionName.decription=Nom d'\u00e9v\u00e9nement +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Ev\u00e9nement automatique +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Ev\u00e9nement automatique +rma_recordsmanagement.property.rma_eventExecutionComplete.title=Ev\u00e9nement termin\u00e9 +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Ev\u00e9nement termin\u00e9 +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Ev\u00e9nement termin\u00e9 par +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Ev\u00e9nement termin\u00e9 par +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Ev\u00e9nement termin\u00e9 \u00e0 +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Ev\u00e9nement termin\u00e9 \u00e0 + +rma_recordsmanagement.type.rma_hold.title=Suspendre +rma_recordsmanagement.type.rma_hold.decription=Suspendre +rma_recordsmanagement.property.rma_holdReason.title=Motif de suspension +rma_recordsmanagement.property.rma_holdReason.decription=Motif de suspension +rma_recordsmanagement.association.rma_frozenRecords.title=Documents d'archives suspendus +rma_recordsmanagement.association.rma_frozenRecords.decription=Documents d'archives suspendus + +rma_recordsmanagement.type.rma_transfer.title=Transf\u00e9rer +rma_recordsmanagement.type.rma_transfer.decription=Transf\u00e9rer +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transf\u00e9rer l'indicateur de versement \u00e0 un autre organisme +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transf\u00e9rer l'indicateur de versement \u00e0 un autre organisme +rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transf\u00e9rer l'indicateur PDF +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transf\u00e9rer l'indicateur PDF +rma_recordsmanagement.property.rma_transferLocation.title=Transf\u00e9rer le PDF +rma_recordsmanagement.property.rma_transferLocation.decription=Transf\u00e9rer le PDF +rma_recordsmanagement.association.rma_transferred.title=Transf\u00e9r\u00e9 +rma_recordsmanagement.association.rma_transferred.decription=Transf\u00e9r\u00e9 + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=Composant du plan de classification +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Composant du plan de classification +rma_recordsmanagement.property.rma_rootNodeRef.title=N\u0153ud racine +rma_recordsmanagement.property.rma_rootNodeRef.decription=N\u0153ud racine + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Racine du site de gestion des archives +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Racine du site de gestion des archives +rma_recordsmanagement.association.rma_holds.title=Suspensions +rma_recordsmanagement.association.rma_holds.decription=Suspensions +rma_recordsmanagement.association.rma_transfers.title=Transferts +rma_recordsmanagement.association.rma_transfers.decription=Transferts + +rma_recordsmanagement.aspect.rma_declaredRecord.title=Document d'archives complet +rma_recordsmanagement.aspect.rma_declaredRecord.decription=Document d'archives complet +rma_recordsmanagement.property.rma_declaredAt.title=Date d'ach\u00e8vement +rma_recordsmanagement.property.rma_declaredAt.decription=Date d'ach\u00e8vement +rma_recordsmanagement.property.rma_declaredBy.title=Compl\u00e9t\u00e9 par +rma_recordsmanagement.property.rma_declaredBy.decription=Compl\u00e9t\u00e9 par + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identifiant de composant de document d'archives +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identifiant de composant de document d'archives +rma_recordsmanagement.property.rma_identifier.title=ID du document d'archives +rma_recordsmanagement.property.rma_identifier.decription=Identifiant unique de document d'archives +rma_recordsmanagement.property.rma_dbUniquenessId.title=Unicit\u00e9 de base de donn\u00e9es +rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unicit\u00e9 de base de donn\u00e9es + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=D\u00e9finition du document d'archives essentiel +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=D\u00e9finition du document d'archives essentiel + +rma_recordsmanagement.property.rma_reviewPeriod.title=P\u00e9riode de r\u00e9vision +rma_recordsmanagement.property.rma_reviewPeriod.decription=P\u00e9riode de r\u00e9vision +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Identifiant de document d'archives essentiel +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Identifiant de document d'archives essentiel + +rma_recordsmanagement.aspect.rma_record.title=Document d'archives +rma_recordsmanagement.aspect.rma_record.decription=Document d'archives +rma_recordsmanagement.property.rma_dateFiled.title=Date de versement au site des archives +rma_recordsmanagement.property.rma_dateFiled.decription=Date de versement au site des archives +rma_recordsmanagement.property.rma_origionalName=Nom d'origine + +rma_recordsmanagement.aspect.rma_recordMetaData.title=M\u00e9tadonn\u00e9es de document d'archives +rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspect du marqueur de m\u00e9tadonn\u00e9es de document d'archives + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=D\u00e9tails des documents d'archives communs +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=M\u00e9tadonn\u00e9es communes \u00e0 tous les types de document d'archives +rma_recordsmanagement.property.rma_location.title=Emplacement +rma_recordsmanagement.property.rma_location.decription=Emplacement + +rma_recordsmanagement.aspect.rma_vitalRecord.title=Document d'archives essentiel +rma_recordsmanagement.aspect.rma_vitalRecord.decription=Document d'archives essentiel +rma_recordsmanagement.property.rma_reviewAsOf.title=V\u00e9rification suivante +rma_recordsmanagement.property.rma_reviewAsOf.decription=V\u00e9rification suivante +rma_recordsmanagement.property.rma_notificationIssued.title=Indique qu'une notification d'arriv\u00e9e \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification a \u00e9t\u00e9 \u00e9mise pour ce document d'archives +rma_recordsmanagement.property.rma_notificationIssued.decription=Indique qu'une notification d'arriv\u00e9e \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification a \u00e9t\u00e9 \u00e9mise pour ce document d'archives + +rma_recordsmanagement.aspect.rma_scheduled.title=Planifi\u00e9 +rma_recordsmanagement.aspect.rma_scheduled.decription=Planifi\u00e9 +rma_recordsmanagement.association.rma_dispositionSchedule.title=R\u00e8gle de r\u00e9tention +rma_recordsmanagement.association.rma_dispositionSchedule.decription=R\u00e8gle de r\u00e9tention + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Etapes du d\u00e9lai de r\u00e9tention +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Etapes du d\u00e9lai de r\u00e9tention +rma_recordsmanagement.association.rma_nextDispositionAction.title=Etape suivante du d\u00e9lai de r\u00e9tention +rma_recordsmanagement.association.rma_nextDispositionAction.decription=Etape suivante du d\u00e9lai de r\u00e9tention +rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historique des actions de r\u00e9tention +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historique des actions de r\u00e9tention + +rma_recordsmanagement.aspect.rma_cutOff.title=D\u00e9classer +rma_recordsmanagement.aspect.rma_cutOff.decription=D\u00e9classer +rma_recordsmanagement.property.rma_cutOffDate.title=Date de d\u00e9classement +rma_recordsmanagement.property.rma_cutOffDate.decription=Date de d\u00e9classement + +rma_recordsmanagement.aspect.rma_transferred.title=Transf\u00e9r\u00e9 +rma_recordsmanagement.aspect.rma_transferred.decription=Transf\u00e9r\u00e9 + +rma_recordsmanagement.aspect.rma_ascended.title=Mont\u00e9 +rma_recordsmanagement.aspect.rma_ascended.decription=Mont\u00e9 + +rma_recordsmanagement.aspect.rma_frozen.title=Suspendu +rma_recordsmanagement.aspect.rma_frozen.decription=Suspendu +rma_recordsmanagement.property.rma_frozenAt.title=Suspendu \u00e0 +rma_recordsmanagement.property.rma_frozenAt.decription=Suspendu \u00e0 +rma_recordsmanagement.property.rma_frozenBy.title=Suspendu par +rma_recordsmanagement.property.rma_frozenBy.decription=Suspendu par + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Racine de configuration des avertissements +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Racine de configuration des avertissements +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configuration des avertissements +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configuration des avertissements + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Racine de configuration d'e-mail +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Racine de configuration d'e-mail +rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configuration du courriel +rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configuration du courriel + +rma_recordsmanagement.aspect.rma_recordSearch.title=Recherche de document d'archives +rma_recordsmanagement.aspect.rma_recordSearch.decription=Informations pour prendre en charge la recherche dans la gestion des archives +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=A une r\u00e8gle de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indique si une r\u00e8gle de r\u00e9tention est associ\u00e9e \u00e0 l'\u00e9l\u00e9ment +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nom de l'action de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Le nom de l'\u00e9tape suivante du d\u00e9lai de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Action de r\u00e9tention de +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La date \u00e0 laquelle l'\u00e9tape suivante du d\u00e9lai de r\u00e9tention devient \u00e9ligible +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=P\u00e9riode de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=P\u00e9riode de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Expression de la p\u00e9riode de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Expression de la p\u00e9riode de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Ev\u00e9nements de r\u00e9tention \u00e9ligibles +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Ev\u00e9nements de r\u00e9tention \u00e9ligibles +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Ev\u00e9nements de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Ev\u00e9nements de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=D\u00e9tenteur de la r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=D\u00e9tenteur de la r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instructions de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instructions de r\u00e9tention +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motif de suspension +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motif de suspension +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=P\u00e9riode de v\u00e9rification du document d'archives essentiel +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=P\u00e9riode de v\u00e9rification du document d'archives essentiel +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Expression de p\u00e9riode de r\u00e9vision +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Expression de p\u00e9riode de r\u00e9vision + +rma_recordsmanagement.aspect.rma_versionedRecord.title=Document d'archives versionn\u00e9 +rma_recordsmanagement.aspect.rma_versionedRecord.decription=Document d'archives versionn\u00e9 + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Mise \u00e0 jour non publi\u00e9e +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Mise \u00e0 jour non publi\u00e9e +rma_recordsmanagement.property.rma_unpublishedUpdate.title=Mise \u00e0 jour non publi\u00e9e +rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indique s'il existe une mise \u00e0 jour non publi\u00e9e +rma_recordsmanagement.property.rma_updateTo.title=Mettre \u00e0 jour vers +rma_recordsmanagement.property.rma_updateTo.description=Destination de la mise \u00e0 jour +rma_recordsmanagement.property.rma_updatedProperties.title=Propri\u00e9t\u00e9s mises \u00e0 jour +rma_recordsmanagement.property.rma_updatedProperties.description=Les propri\u00e9t\u00e9s mises \u00e0 jour +rma_recordsmanagement.property.rma_publishInProgress.title=Publication en cours +rma_recordsmanagement.property.rma_publishInProgress.description=Indique si une publication est en cours + +rma_recordsmanagement.aspect.dod_ghosted.title=M\u00e9tadonn\u00e9es d'archives seulement +rma_recordsmanagement.aspect.dod_ghosted.description=M\u00e9tadonn\u00e9es d'archives seulement + +listconstraint.rmc_tlList.title=Transf\u00e9rer les emplacements listconstraint.rmc_smList.title=Marquages compl\u00e9mentaires \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_it.properties index dc6364b593..07bc88aa96 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_it.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=Modello di contenuto di Records Management - -rma_recordsmanagement.type.rma_rmsite.title=Sito di Records Management -rma_recordsmanagement.type.rma_rmsite.description=Sito specializzato di Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Configurazione controlli di sicurezza -rma_recordsmanagement.type.rma_caveatConfig.decription=Configurazione controlli di sicurezza - -rma_recordsmanagement.type.rma_emailConfig.title=Configurazione e-mail -rma_recordsmanagement.type.rma_emailConfig.decription=Configurazione e-mail - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Contenitore di Records Management -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Contenitore di Records Management - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Contenitore radice di Records Management -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Contenitore radice di Records Management - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Programma di conservazione -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Programma di conservazione - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Autorit\u00e0 di conservazione -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autorit\u00e0 di conservazione - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Istruzioni per la conservazione -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Istruzioni per la conservazione - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Conservazione livello record -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Conservazione livello record - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Azioni di conservazione -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Azioni di conservazione - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definizione azione di conservazione -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definizione azione di conservazione -rma_recordsmanagement.property.rma_dispositionActionName.title=Nome dell'azione di conservazione -rma_recordsmanagement.property.rma_dispositionActionName.decription=Nome dell'azione di conservazione -rma_recordsmanagement.property.rma_dispositionDescription.title=Descrizione conservazione -rma_recordsmanagement.property.rma_dispositionDescription.decription=Descrizione conservazione -rma_recordsmanagement.property.rma_dispositionLocation.title=Posizione di conservazione -rma_recordsmanagement.property.rma_dispositionLocation.decription=Posizione di conservazione -rma_recordsmanagement.property.rma_dispositionPeriod.title=Periodo di conservazione -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Periodo di conservazione -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propriet\u00e0 del periodo di conservazione -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propriet\u00e0 del periodo di conservazione -rma_recordsmanagement.property.rma_dispositionEvent.title=Evento di conservazione -rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento di conservazione -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinazione eventi di conservazione -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinazione eventi di conservazione - -rma_recordsmanagement.type.rma_recordFolder.title=Cartella di record -rma_recordsmanagement.type.rma_recordFolder.decription=Cartella di record -rma_recordsmanagement.property.rma_isClosed.title=Record -rma_recordsmanagement.property.rma_isClosed.decription=Record - -rma_recordsmanagement.type.rma_recordCategory.title=Categoria record -rma_recordsmanagement.type.rma_recordCategory.decription=Categoria record - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento non elettronico -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento non elettronico -rma_recordsmanagement.property.rma_physicalSize.title=Dimensioni fisiche -rma_recordsmanagement.property.rma_physicalSize.decription=Le dimensioni del documento misurate in metri lineari. -rma_recordsmanagement.property.rma_numberOfCopies.title=Numero di copie -rma_recordsmanagement.property.rma_numberOfCopies.description=Il numero di copie del documento. -rma_recordsmanagement.property.rma_storageLocation.title=Posizione di archiviazione -rma_recordsmanagement.property.rma_storageLocation.decription=La posizione fisica di archiviazione del record. -rma_recordsmanagement.property.rma_shelf.title=Ripiano -rma_recordsmanagement.property.rma_shelf.decription=Il ripiano nel quale \u00e8 conservato il record. -rma_recordsmanagement.property.rma_box.title=Casella -rma_recordsmanagement.property.rma_box.description=La casella dove \u00e8 conservato il record. -rma_recordsmanagement.property.rma_file.title=File -rma_recordsmanagement.property.rma_file.decription=Il file dove \u00e8 conservato il record. - -rma_recordsmanagement.type.rma_dispositionAction.title=Azione di conservazione -rma_recordsmanagement.type.rma_dispositionAction.decription=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionActionId.title=ID azione di conservazione -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID azione di conservazione -rma_recordsmanagement.property.rma_dispositionAction.title=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionAction.decription=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionAsOf.title=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Azione di conservazione -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventi di conservazione idonei -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventi di conservazione idonei -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Azione di conservazione iniziata alle ore -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Azione di conservazione iniziata alle ore -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Azione di conservazione iniziata da -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Azione di conservazione iniziata da -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Azione di conservazione completata alle ore -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Azione di conservazione completata alle ore -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Azione di conservazione completata da -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Azione di conservazione completata da -rma_recordsmanagement.association.rma_eventExecutions.title=Esecuzioni evento -rma_recordsmanagement.association.rma_eventExecutions.decription=Esecuzioni evento - -rma_recordsmanagement.type.rma_eventExecution.title=Esecuzione evento -rma_recordsmanagement.type.rma_eventExecution.decription=Esecuzione evento -rma_recordsmanagement.property.rma_eventExecutionName.title=Nome evento -rma_recordsmanagement.property.rma_eventExecutionName.decription=Nome evento -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento automatico -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento automatico -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento completato -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento completato -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento completato da -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento completato da -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento completato alle ore -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento completato alle ore - -rma_recordsmanagement.type.rma_hold.title=Sospensione -rma_recordsmanagement.type.rma_hold.decription=Sospensione -rma_recordsmanagement.property.rma_holdReason.title=Motivo sospensione -rma_recordsmanagement.property.rma_holdReason.decription=Motivo sospensione -rma_recordsmanagement.association.rma_frozenRecords.title=Record sospesi -rma_recordsmanagement.association.rma_frozenRecords.decription=Record sospesi - -rma_recordsmanagement.type.rma_transfer.title=Trasferisci -rma_recordsmanagement.type.rma_transfer.decription=Trasferisci -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicatore di trasferimento/trasferimento ad altri -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicatore di trasferimento/trasferimento ad altri -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicatore di trasferimento PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicatore di trasferimento PDF -rma_recordsmanagement.property.rma_transferLocation.title=Trasferisci PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Trasferisci PDF -rma_recordsmanagement.association.rma_transferred.title=Trasferito -rma_recordsmanagement.association.rma_transferred.decription=Trasferito - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente piano file -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente piano file -rma_recordsmanagement.property.rma_rootNodeRef.title=Nodo radice -rma_recordsmanagement.property.rma_rootNodeRef.decription=Nodo radice - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Radice di Records Management -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Radice di Records Management -rma_recordsmanagement.association.rma_holds.title=Sospensioni -rma_recordsmanagement.association.rma_holds.decription=Sospensioni -rma_recordsmanagement.association.rma_transfers.title=Trasferimenti -rma_recordsmanagement.association.rma_transfers.decription=Trasferimenti - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Record completato -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Record completato -rma_recordsmanagement.property.rma_declaredAt.title=Data completamento -rma_recordsmanagement.property.rma_declaredAt.decription=Data completamento -rma_recordsmanagement.property.rma_declaredBy.title=Completato da -rma_recordsmanagement.property.rma_declaredBy.decription=Completato da - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificatore componente record -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificatore componente record -rma_recordsmanagement.property.rma_identifier.title=ID Record -rma_recordsmanagement.property.rma_identifier.decription=Identificatore record univoco -rma_recordsmanagement.property.rma_dbUniquenessId.title=Unicit\u00e0 database -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unicit\u00e0 database - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definizione di record fondamentale -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definizione di record fondamentale - -rma_recordsmanagement.property.rma_reviewPeriod.title=Periodo di esame -rma_recordsmanagement.property.rma_reviewPeriod.decription=Periodo di esame -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicatore record fondamentale -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicatore record fondamentale - -rma_recordsmanagement.aspect.rma_record.title=Record -rma_recordsmanagement.aspect.rma_record.decription=Record -rma_recordsmanagement.property.rma_dateFiled.title=Data di archiviazione -rma_recordsmanagement.property.rma_dateFiled.decription=Data di archiviazione -rma_recordsmanagement.property.rma_origionalName=Nome originale - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadati del record -rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspetto indicatore per metadati di record - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Dettagli record comuni -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadati comuni a tutti i tipi di record -rma_recordsmanagement.property.rma_location.title=Posizione -rma_recordsmanagement.property.rma_location.decription=Posizione - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Record fondamentale -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Record fondamentale -rma_recordsmanagement.property.rma_reviewAsOf.title=Prossimo esame -rma_recordsmanagement.property.rma_reviewAsOf.decription=Prossimo esame -rma_recordsmanagement.property.rma_notificationIssued.title=Indica che \u00e8 stata rilasciata una notifica di esame per questo record -rma_recordsmanagement.property.rma_notificationIssued.decription=Indica che \u00e8 stata rilasciata una notifica di esame per questo record - -rma_recordsmanagement.aspect.rma_scheduled.title=Programmato -rma_recordsmanagement.aspect.rma_scheduled.decription=Programmato -rma_recordsmanagement.association.rma_dispositionSchedule.title=Programma di conservazione -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Programma di conservazione - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo di vita di conservazione -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo di vita di conservazione -rma_recordsmanagement.association.rma_nextDispositionAction.title=Prossima azione di conservazione -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Prossima azione di conservazione -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Cronologia azione di conservazione -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Cronologia azione di conservazione - -rma_recordsmanagement.aspect.rma_cutOff.title=Cut off -rma_recordsmanagement.aspect.rma_cutOff.decription=Cut off -rma_recordsmanagement.property.rma_cutOffDate.title=Data cut off -rma_recordsmanagement.property.rma_cutOffDate.decription=Data cut off - -rma_recordsmanagement.aspect.rma_transferred.title=Trasferito -rma_recordsmanagement.aspect.rma_transferred.decription=Trasferito - -rma_recordsmanagement.aspect.rma_ascended.title=Asceso -rma_recordsmanagement.aspect.rma_ascended.decription=Asceso - -rma_recordsmanagement.aspect.rma_frozen.title=Sospeso -rma_recordsmanagement.aspect.rma_frozen.decription=Sospeso -rma_recordsmanagement.property.rma_frozenAt.title=Sospeso presso -rma_recordsmanagement.property.rma_frozenAt.decription=Sospeso presso -rma_recordsmanagement.property.rma_frozenBy.title=Sospeso da -rma_recordsmanagement.property.rma_frozenBy.decription=Sospeso da - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Radice di configurazione avvertenza -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Radice di configurazione avvertenza -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configurazione avvertenza -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configurazione avvertenza - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Radice Config E-mail -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Radice Config E-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configurazione e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configurazione e-mail - -rma_recordsmanagement.aspect.rma_recordSearch.title=Ricerca record -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informazioni per supportare la ricerca di Records Management -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Con Programma di conservazione -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica se un programma di conservazione \u00e8 stato associato a un certo elemento -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nome dell'azione di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Il nome della prossima azione di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Azione di conservazione del -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La data in cui la prossima azione di conservazione diventa idonea -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Periodo di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Periodo di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Espressione del periodo di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Espressione del periodo di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventi di conservazione idonei -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventi di conservazione idonei -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventi di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventi di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autorit\u00e0 di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autorit\u00e0 di conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Istruzioni per la conservazione -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Istruzioni per la conservazione -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motivo sospensione -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motivo sospensione -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Periodo di esame record fondamentale -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Periodo di esame record fondamentale -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Espressione periodo di esame -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Espressione periodo di esame - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Record con versione -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Record con versione - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Aggiornamento non pubblicato -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Aggiornamento non pubblicato -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Aggiornamento non pubblicato -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica se \u00e8 presente un aggiornamento non pubblicato -rma_recordsmanagement.property.rma_updateTo.title=Aggiornamento a -rma_recordsmanagement.property.rma_updateTo.description=Destinazione dell'aggiornamento -rma_recordsmanagement.property.rma_updatedProperties.title=Propriet\u00e0 aggiornate -rma_recordsmanagement.property.rma_updatedProperties.description=Le propriet\u00e0 aggiornate -rma_recordsmanagement.property.rma_publishInProgress.title=Pubblicazione in corso -rma_recordsmanagement.property.rma_publishInProgress.description=Indica se \u00e8 in corso una pubblicazione - -rma_recordsmanagement.aspect.dod_ghosted.title=Record di soli metadati -rma_recordsmanagement.aspect.dod_ghosted.description=Record di soli metadati - -listconstraint.rmc_tlList.title=Posizioni di trasferimento +rma_recordsmanagement.description=Modello di contenuto di Records Management + +rma_recordsmanagement.type.rma_rmsite.title=Sito di Records Management +rma_recordsmanagement.type.rma_rmsite.description=Sito specializzato di Records Management + +rma_recordsmanagement.type.rma_caveatConfig.title=Configurazione controlli di sicurezza +rma_recordsmanagement.type.rma_caveatConfig.decription=Configurazione controlli di sicurezza + +rma_recordsmanagement.type.rma_emailConfig.title=Configurazione e-mail +rma_recordsmanagement.type.rma_emailConfig.decription=Configurazione e-mail + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=Contenitore di Records Management +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Contenitore di Records Management + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Contenitore radice di Records Management +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Contenitore radice di Records Management + +rma_recordsmanagement.type.rma_dispositionSchedule.title=Programma di conservazione +rma_recordsmanagement.type.rma_dispositionSchedule.decription=Programma di conservazione + +rma_recordsmanagement.property.rma_dispositionAuthority.title=Autorit\u00e0 di conservazione +rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autorit\u00e0 di conservazione + +rma_recordsmanagement.property.rma_dispositionInstructions.title=Istruzioni per la conservazione +rma_recordsmanagement.property.rma_dispositionInstructions.decription=Istruzioni per la conservazione + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=Conservazione livello record +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Conservazione livello record + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Azioni di conservazione +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Azioni di conservazione + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definizione azione di conservazione +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definizione azione di conservazione +rma_recordsmanagement.property.rma_dispositionActionName.title=Nome dell'azione di conservazione +rma_recordsmanagement.property.rma_dispositionActionName.decription=Nome dell'azione di conservazione +rma_recordsmanagement.property.rma_dispositionDescription.title=Descrizione conservazione +rma_recordsmanagement.property.rma_dispositionDescription.decription=Descrizione conservazione +rma_recordsmanagement.property.rma_dispositionLocation.title=Posizione di conservazione +rma_recordsmanagement.property.rma_dispositionLocation.decription=Posizione di conservazione +rma_recordsmanagement.property.rma_dispositionPeriod.title=Periodo di conservazione +rma_recordsmanagement.property.rma_dispositionPeriod.decription=Periodo di conservazione +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propriet\u00e0 del periodo di conservazione +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propriet\u00e0 del periodo di conservazione +rma_recordsmanagement.property.rma_dispositionEvent.title=Evento di conservazione +rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento di conservazione +rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinazione eventi di conservazione +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinazione eventi di conservazione + +rma_recordsmanagement.type.rma_recordFolder.title=Cartella di record +rma_recordsmanagement.type.rma_recordFolder.decription=Cartella di record +rma_recordsmanagement.property.rma_isClosed.title=Record +rma_recordsmanagement.property.rma_isClosed.decription=Record + +rma_recordsmanagement.type.rma_recordCategory.title=Categoria record +rma_recordsmanagement.type.rma_recordCategory.decription=Categoria record + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento non elettronico +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento non elettronico +rma_recordsmanagement.property.rma_physicalSize.title=Dimensioni fisiche +rma_recordsmanagement.property.rma_physicalSize.decription=Le dimensioni del documento misurate in metri lineari. +rma_recordsmanagement.property.rma_numberOfCopies.title=Numero di copie +rma_recordsmanagement.property.rma_numberOfCopies.description=Il numero di copie del documento. +rma_recordsmanagement.property.rma_storageLocation.title=Posizione di archiviazione +rma_recordsmanagement.property.rma_storageLocation.decription=La posizione fisica di archiviazione del record. +rma_recordsmanagement.property.rma_shelf.title=Ripiano +rma_recordsmanagement.property.rma_shelf.decription=Il ripiano nel quale \u00e8 conservato il record. +rma_recordsmanagement.property.rma_box.title=Casella +rma_recordsmanagement.property.rma_box.description=La casella dove \u00e8 conservato il record. +rma_recordsmanagement.property.rma_file.title=File +rma_recordsmanagement.property.rma_file.decription=Il file dove \u00e8 conservato il record. + +rma_recordsmanagement.type.rma_dispositionAction.title=Azione di conservazione +rma_recordsmanagement.type.rma_dispositionAction.decription=Azione di conservazione +rma_recordsmanagement.property.rma_dispositionActionId.title=ID azione di conservazione +rma_recordsmanagement.property.rma_dispositionActionId.decription=ID azione di conservazione +rma_recordsmanagement.property.rma_dispositionAction.title=Azione di conservazione +rma_recordsmanagement.property.rma_dispositionAction.decription=Azione di conservazione +rma_recordsmanagement.property.rma_dispositionAsOf.title=Azione di conservazione +rma_recordsmanagement.property.rma_dispositionAsOf.decription=Azione di conservazione +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventi di conservazione idonei +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventi di conservazione idonei +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Azione di conservazione iniziata alle ore +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Azione di conservazione iniziata alle ore +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Azione di conservazione iniziata da +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Azione di conservazione iniziata da +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Azione di conservazione completata alle ore +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Azione di conservazione completata alle ore +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Azione di conservazione completata da +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Azione di conservazione completata da +rma_recordsmanagement.association.rma_eventExecutions.title=Esecuzioni evento +rma_recordsmanagement.association.rma_eventExecutions.decription=Esecuzioni evento + +rma_recordsmanagement.type.rma_eventExecution.title=Esecuzione evento +rma_recordsmanagement.type.rma_eventExecution.decription=Esecuzione evento +rma_recordsmanagement.property.rma_eventExecutionName.title=Nome evento +rma_recordsmanagement.property.rma_eventExecutionName.decription=Nome evento +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento automatico +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento automatico +rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento completato +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento completato +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento completato da +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento completato da +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento completato alle ore +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento completato alle ore + +rma_recordsmanagement.type.rma_hold.title=Sospensione +rma_recordsmanagement.type.rma_hold.decription=Sospensione +rma_recordsmanagement.property.rma_holdReason.title=Motivo sospensione +rma_recordsmanagement.property.rma_holdReason.decription=Motivo sospensione +rma_recordsmanagement.association.rma_frozenRecords.title=Record sospesi +rma_recordsmanagement.association.rma_frozenRecords.decription=Record sospesi + +rma_recordsmanagement.type.rma_transfer.title=Trasferisci +rma_recordsmanagement.type.rma_transfer.decription=Trasferisci +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicatore di trasferimento/trasferimento ad altri +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicatore di trasferimento/trasferimento ad altri +rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicatore di trasferimento PDF +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicatore di trasferimento PDF +rma_recordsmanagement.property.rma_transferLocation.title=Trasferisci PDF +rma_recordsmanagement.property.rma_transferLocation.decription=Trasferisci PDF +rma_recordsmanagement.association.rma_transferred.title=Trasferito +rma_recordsmanagement.association.rma_transferred.decription=Trasferito + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente piano file +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente piano file +rma_recordsmanagement.property.rma_rootNodeRef.title=Nodo radice +rma_recordsmanagement.property.rma_rootNodeRef.decription=Nodo radice + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Radice di Records Management +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Radice di Records Management +rma_recordsmanagement.association.rma_holds.title=Sospensioni +rma_recordsmanagement.association.rma_holds.decription=Sospensioni +rma_recordsmanagement.association.rma_transfers.title=Trasferimenti +rma_recordsmanagement.association.rma_transfers.decription=Trasferimenti + +rma_recordsmanagement.aspect.rma_declaredRecord.title=Record completato +rma_recordsmanagement.aspect.rma_declaredRecord.decription=Record completato +rma_recordsmanagement.property.rma_declaredAt.title=Data completamento +rma_recordsmanagement.property.rma_declaredAt.decription=Data completamento +rma_recordsmanagement.property.rma_declaredBy.title=Completato da +rma_recordsmanagement.property.rma_declaredBy.decription=Completato da + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificatore componente record +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificatore componente record +rma_recordsmanagement.property.rma_identifier.title=ID Record +rma_recordsmanagement.property.rma_identifier.decription=Identificatore record univoco +rma_recordsmanagement.property.rma_dbUniquenessId.title=Unicit\u00e0 database +rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unicit\u00e0 database + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definizione di record fondamentale +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definizione di record fondamentale + +rma_recordsmanagement.property.rma_reviewPeriod.title=Periodo di esame +rma_recordsmanagement.property.rma_reviewPeriod.decription=Periodo di esame +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicatore record fondamentale +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicatore record fondamentale + +rma_recordsmanagement.aspect.rma_record.title=Record +rma_recordsmanagement.aspect.rma_record.decription=Record +rma_recordsmanagement.property.rma_dateFiled.title=Data di archiviazione +rma_recordsmanagement.property.rma_dateFiled.decription=Data di archiviazione +rma_recordsmanagement.property.rma_origionalName=Nome originale + +rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadati del record +rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspetto indicatore per metadati di record + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Dettagli record comuni +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadati comuni a tutti i tipi di record +rma_recordsmanagement.property.rma_location.title=Posizione +rma_recordsmanagement.property.rma_location.decription=Posizione + +rma_recordsmanagement.aspect.rma_vitalRecord.title=Record fondamentale +rma_recordsmanagement.aspect.rma_vitalRecord.decription=Record fondamentale +rma_recordsmanagement.property.rma_reviewAsOf.title=Prossimo esame +rma_recordsmanagement.property.rma_reviewAsOf.decription=Prossimo esame +rma_recordsmanagement.property.rma_notificationIssued.title=Indica che \u00e8 stata rilasciata una notifica di esame per questo record +rma_recordsmanagement.property.rma_notificationIssued.decription=Indica che \u00e8 stata rilasciata una notifica di esame per questo record + +rma_recordsmanagement.aspect.rma_scheduled.title=Programmato +rma_recordsmanagement.aspect.rma_scheduled.decription=Programmato +rma_recordsmanagement.association.rma_dispositionSchedule.title=Programma di conservazione +rma_recordsmanagement.association.rma_dispositionSchedule.decription=Programma di conservazione + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo di vita di conservazione +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo di vita di conservazione +rma_recordsmanagement.association.rma_nextDispositionAction.title=Prossima azione di conservazione +rma_recordsmanagement.association.rma_nextDispositionAction.decription=Prossima azione di conservazione +rma_recordsmanagement.association.rma_dispositionActionHistory.title=Cronologia azione di conservazione +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Cronologia azione di conservazione + +rma_recordsmanagement.aspect.rma_cutOff.title=Cut off +rma_recordsmanagement.aspect.rma_cutOff.decription=Cut off +rma_recordsmanagement.property.rma_cutOffDate.title=Data cut off +rma_recordsmanagement.property.rma_cutOffDate.decription=Data cut off + +rma_recordsmanagement.aspect.rma_transferred.title=Trasferito +rma_recordsmanagement.aspect.rma_transferred.decription=Trasferito + +rma_recordsmanagement.aspect.rma_ascended.title=Asceso +rma_recordsmanagement.aspect.rma_ascended.decription=Asceso + +rma_recordsmanagement.aspect.rma_frozen.title=Sospeso +rma_recordsmanagement.aspect.rma_frozen.decription=Sospeso +rma_recordsmanagement.property.rma_frozenAt.title=Sospeso presso +rma_recordsmanagement.property.rma_frozenAt.decription=Sospeso presso +rma_recordsmanagement.property.rma_frozenBy.title=Sospeso da +rma_recordsmanagement.property.rma_frozenBy.decription=Sospeso da + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Radice di configurazione avvertenza +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Radice di configurazione avvertenza +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configurazione avvertenza +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configurazione avvertenza + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Radice Config E-mail +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Radice Config E-mail +rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configurazione e-mail +rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configurazione e-mail + +rma_recordsmanagement.aspect.rma_recordSearch.title=Ricerca record +rma_recordsmanagement.aspect.rma_recordSearch.decription=Informazioni per supportare la ricerca di Records Management +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Con Programma di conservazione +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica se un programma di conservazione \u00e8 stato associato a un certo elemento +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nome dell'azione di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Il nome della prossima azione di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Azione di conservazione del +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=La data in cui la prossima azione di conservazione diventa idonea +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Periodo di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Periodo di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Espressione del periodo di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Espressione del periodo di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventi di conservazione idonei +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventi di conservazione idonei +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventi di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventi di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autorit\u00e0 di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autorit\u00e0 di conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Istruzioni per la conservazione +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Istruzioni per la conservazione +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motivo sospensione +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motivo sospensione +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Periodo di esame record fondamentale +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Periodo di esame record fondamentale +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Espressione periodo di esame +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Espressione periodo di esame + +rma_recordsmanagement.aspect.rma_versionedRecord.title=Record con versione +rma_recordsmanagement.aspect.rma_versionedRecord.decription=Record con versione + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Aggiornamento non pubblicato +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Aggiornamento non pubblicato +rma_recordsmanagement.property.rma_unpublishedUpdate.title=Aggiornamento non pubblicato +rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica se \u00e8 presente un aggiornamento non pubblicato +rma_recordsmanagement.property.rma_updateTo.title=Aggiornamento a +rma_recordsmanagement.property.rma_updateTo.description=Destinazione dell'aggiornamento +rma_recordsmanagement.property.rma_updatedProperties.title=Propriet\u00e0 aggiornate +rma_recordsmanagement.property.rma_updatedProperties.description=Le propriet\u00e0 aggiornate +rma_recordsmanagement.property.rma_publishInProgress.title=Pubblicazione in corso +rma_recordsmanagement.property.rma_publishInProgress.description=Indica se \u00e8 in corso una pubblicazione + +rma_recordsmanagement.aspect.dod_ghosted.title=Record di soli metadati +rma_recordsmanagement.aspect.dod_ghosted.description=Record di soli metadati + +listconstraint.rmc_tlList.title=Posizioni di trasferimento listconstraint.rmc_smList.title=Contrassegni supplementari \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ja.properties index 451ffcd1cf..f3040b4a23 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ja.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb - -rma_recordsmanagement.type.rma_rmsite.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b5\u30a4\u30c8 -rma_recordsmanagement.type.rma_rmsite.description=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u7528\u306e\u5c02\u9580\u30b5\u30a4\u30c8 - -rma_recordsmanagement.type.rma_caveatConfig.title=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u8a2d\u5b9a -rma_recordsmanagement.type.rma_caveatConfig.decription=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u8a2d\u5b9a - -rma_recordsmanagement.type.rma_emailConfig.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a -rma_recordsmanagement.type.rma_emailConfig.decription=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b3\u30f3\u30c6\u30ca\u30fc -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b3\u30f3\u30c6\u30ca\u30fc - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u30b3\u30f3\u30c6\u30ca\u30fc -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u30b3\u30f3\u30c6\u30ca\u30fc - -rma_recordsmanagement.type.rma_dispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb -rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb - -rma_recordsmanagement.property.rma_dispositionAuthority.title=\u4fdd\u7ba1\u6a29\u9650 -rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u4fdd\u7ba1\u6a29\u9650 - -rma_recordsmanagement.property.rma_dispositionInstructions.title=\u4fdd\u7ba1\u6307\u793a -rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u4fdd\u7ba1\u6307\u793a - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u30ec\u30b3\u30fc\u30c9\u30ec\u30d9\u30eb\u306e\u4fdd\u7ba1 -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u30ec\u30b3\u30fc\u30c9\u30ec\u30d9\u30eb\u306e\u4fdd\u7ba1 - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u4fdd\u7ba1\u51e6\u7406 - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9 -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9 -rma_recordsmanagement.property.rma_dispositionActionName.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d -rma_recordsmanagement.property.rma_dispositionActionName.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d -rma_recordsmanagement.property.rma_dispositionDescription.title=\u4fdd\u7ba1\u306e\u8aac\u660e -rma_recordsmanagement.property.rma_dispositionDescription.decription=\u4fdd\u7ba1\u306e\u8aac\u660e -rma_recordsmanagement.property.rma_dispositionLocation.title=\u4fdd\u7ba1\u5834\u6240 -rma_recordsmanagement.property.rma_dispositionLocation.decription=\u4fdd\u7ba1\u5834\u6240 -rma_recordsmanagement.property.rma_dispositionPeriod.title=\u4fdd\u7ba1\u671f\u9593 -rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u4fdd\u7ba1\u671f\u9593 -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u4fdd\u7ba1\u671f\u9593\u306e\u30d7\u30ed\u30d1\u30c6\u30a3 -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u4fdd\u7ba1\u671f\u9593\u306e\u30d7\u30ed\u30d1\u30c6\u30a3 -rma_recordsmanagement.property.rma_dispositionEvent.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_dispositionEvent.decription=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8\u306e\u7d44\u307f\u5408\u308f\u305b -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8\u306e\u7d44\u307f\u5408\u308f\u305b - -rma_recordsmanagement.type.rma_recordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rma_recordsmanagement.type.rma_recordFolder.decription=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rma_recordsmanagement.property.rma_isClosed.title=\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.property.rma_isClosed.decription=\u30ec\u30b3\u30fc\u30c9 - -rma_recordsmanagement.type.rma_recordCategory.title=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea -rma_recordsmanagement.type.rma_recordCategory.decription=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u975e\u96fb\u5b50\u6587\u66f8 -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u975e\u96fb\u5b50\u6587\u66f8 -rma_recordsmanagement.property.rma_physicalSize.title=\u7269\u7406\u7684\u306a\u30b5\u30a4\u30ba -rma_recordsmanagement.property.rma_physicalSize.decription=\u6587\u66f8\u306e\u30b5\u30a4\u30ba\u306f\u30ea\u30cb\u30a2\u30e1\u30fc\u30bf\u30fc\u3067\u8a08\u6e2c\u3055\u308c\u307e\u3059\u3002 -rma_recordsmanagement.property.rma_numberOfCopies.title=\u30b3\u30d4\u30fc\u6570 -rma_recordsmanagement.property.rma_numberOfCopies.description=\u6587\u66f8\u306e\u30b3\u30d4\u30fc\u6570\u3002 -rma_recordsmanagement.property.rma_storageLocation.title=\u4fdd\u7ba1\u5834\u6240 -rma_recordsmanagement.property.rma_storageLocation.decription=\u30ec\u30b3\u30fc\u30c9\u306e\u7269\u7406\u7684\u306a\u4fdd\u7ba1\u5834\u6240\u3002 -rma_recordsmanagement.property.rma_shelf.title=\u68da -rma_recordsmanagement.property.rma_shelf.decription=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u68da\u3002 -rma_recordsmanagement.property.rma_box.title=\u7bb1 -rma_recordsmanagement.property.rma_box.description=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u7bb1\u3002 -rma_recordsmanagement.property.rma_file.title=\u30d5\u30a1\u30a4\u30eb -rma_recordsmanagement.property.rma_file.decription=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u30d5\u30a1\u30a4\u30eb\u3002 - -rma_recordsmanagement.type.rma_dispositionAction.title=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.type.rma_dispositionAction.decription=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionActionId.title=\u4fdd\u7ba1\u51e6\u7406 ID -rma_recordsmanagement.property.rma_dispositionActionId.decription=\u4fdd\u7ba1\u51e6\u7406 ID -rma_recordsmanagement.property.rma_dispositionAction.title=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionAction.decription=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionAsOf.title=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u65e5\u6642 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u65e5\u6642 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u8005 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u8005 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u65e5\u6642 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u65e5\u6642 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u8005 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u8005 -rma_recordsmanagement.association.rma_eventExecutions.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c -rma_recordsmanagement.association.rma_eventExecutions.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c - -rma_recordsmanagement.type.rma_eventExecution.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c -rma_recordsmanagement.type.rma_eventExecution.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c -rma_recordsmanagement.property.rma_eventExecutionName.title=\u30a4\u30d9\u30f3\u30c8\u540d -rma_recordsmanagement.property.rma_eventExecutionName.decription=\u30a4\u30d9\u30f3\u30c8\u540d -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u30a4\u30d9\u30f3\u30c8\u306e\u81ea\u52d5\u5316 -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u81ea\u52d5\u5316 -rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u30a4\u30d9\u30f3\u30c8\u5b8c\u4e86 -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u30a4\u30d9\u30f3\u30c8\u5b8c\u4e86 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u8005 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u8005 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u65e5\u6642 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u65e5\u6642 - -rma_recordsmanagement.type.rma_hold.title=\u30db\u30fc\u30eb\u30c9 -rma_recordsmanagement.type.rma_hold.decription=\u30db\u30fc\u30eb\u30c9 -rma_recordsmanagement.property.rma_holdReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -rma_recordsmanagement.property.rma_holdReason.decription=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -rma_recordsmanagement.association.rma_frozenRecords.title=\u30db\u30fc\u30eb\u30c9\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.association.rma_frozenRecords.decription=\u30db\u30fc\u30eb\u30c9\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9 - -rma_recordsmanagement.type.rma_transfer.title=\u8ee2\u9001 -rma_recordsmanagement.type.rma_transfer.decription=\u8ee2\u9001 -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u8ee2\u9001\u53d7\u8afe\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u8ee2\u9001\u53d7\u8afe\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_transferPDFIndicator.title=PDF\u306e\u8ee2\u9001\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=PDF\u306e\u8ee2\u9001\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_transferLocation.title=PDF\u306e\u8ee2\u9001 -rma_recordsmanagement.property.rma_transferLocation.decription=PDF\u306e\u8ee2\u9001 -rma_recordsmanagement.association.rma_transferred.title=\u8ee2\u9001\u6e08\u307f -rma_recordsmanagement.association.rma_transferred.decription=\u8ee2\u9001\u6e08\u307f - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 -rma_recordsmanagement.property.rma_rootNodeRef.title=\u30eb\u30fc\u30c8\u30ce\u30fc\u30c9 -rma_recordsmanagement.property.rma_rootNodeRef.decription=\u30eb\u30fc\u30c8\u30ce\u30fc\u30c9 - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8 -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8 -rma_recordsmanagement.association.rma_holds.title=\u30db\u30fc\u30eb\u30c9 -rma_recordsmanagement.association.rma_holds.decription=\u30db\u30fc\u30eb\u30c9 -rma_recordsmanagement.association.rma_transfers.title=\u8ee2\u9001 -rma_recordsmanagement.association.rma_transfers.decription=\u8ee2\u9001 - -rma_recordsmanagement.aspect.rma_declaredRecord.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.property.rma_declaredAt.title=\u5b8c\u4e86\u65e5 -rma_recordsmanagement.property.rma_declaredAt.decription=\u5b8c\u4e86\u65e5 -rma_recordsmanagement.property.rma_declaredBy.title=\u5b8c\u4e86\u8005 -rma_recordsmanagement.property.rma_declaredBy.decription=\u5b8c\u4e86\u8005 - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u30ec\u30b3\u30fc\u30c9\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 ID -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u30ec\u30b3\u30fc\u30c9\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 ID -rma_recordsmanagement.property.rma_identifier.title=\u30ec\u30b3\u30fc\u30c9 ID -rma_recordsmanagement.property.rma_identifier.decription=\u4e00\u610f\u306e\u30ec\u30b3\u30fc\u30c9 ID -rma_recordsmanagement.property.rma_dbUniquenessId.title=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e00\u610f\u6027 -rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e00\u610f\u6027 - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9 -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9 - -rma_recordsmanagement.property.rma_reviewPeriod.title=\u30ec\u30d3\u30e5\u30fc\u671f\u9593 -rma_recordsmanagement.property.rma_reviewPeriod.decription=\u30ec\u30d3\u30e5\u30fc\u671f\u9593 -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc - -rma_recordsmanagement.aspect.rma_record.title=\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.rma_record.decription=\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.property.rma_dateFiled.title=\u6574\u7406\u4fdd\u7ba1\u65e5 -rma_recordsmanagement.property.rma_dateFiled.decription=\u6574\u7406\u4fdd\u7ba1\u65e5 -rma_recordsmanagement.property.rma_origionalName=\u5143\u306e\u540d\u524d - -rma_recordsmanagement.aspect.rma_recordMetaData.title=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf -rma_recordsmanagement.aspect.rma_recordMetaData.description=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30fc\u30ab\u30fc\u30a2\u30b9\u30da\u30af\u30c8 - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u5171\u901a\u3059\u308b\u30ec\u30b3\u30fc\u30c9\u60c5\u5831 -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306b\u5171\u901a\u3059\u308b\u30e1\u30bf\u30c7\u30fc\u30bf -rma_recordsmanagement.property.rma_location.title=\u5834\u6240 -rma_recordsmanagement.property.rma_location.decription=\u5834\u6240 - -rma_recordsmanagement.aspect.rma_vitalRecord.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.property.rma_reviewAsOf.title=\u6b21\u56de\u306e\u30ec\u30d3\u30e5\u30fc -rma_recordsmanagement.property.rma_reviewAsOf.decription=\u6b21\u56de\u306e\u30ec\u30d3\u30e5\u30fc -rma_recordsmanagement.property.rma_notificationIssued.title=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u304c\u901a\u77e5\u3055\u308c\u305f\u3053\u3068\u3092\u793a\u3057\u307e\u3059 -rma_recordsmanagement.property.rma_notificationIssued.decription=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u304c\u901a\u77e5\u3055\u308c\u305f\u3053\u3068\u3092\u793a\u3057\u307e\u3059 - -rma_recordsmanagement.aspect.rma_scheduled.title=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f -rma_recordsmanagement.aspect.rma_scheduled.decription=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f -rma_recordsmanagement.association.rma_dispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb -rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb -rma_recordsmanagement.association.rma_nextDispositionAction.title=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406 -rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5c65\u6b74 -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5c65\u6b74 - -rma_recordsmanagement.aspect.rma_cutOff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -rma_recordsmanagement.aspect.rma_cutOff.decription=\u30ab\u30c3\u30c8\u30aa\u30d5 -rma_recordsmanagement.property.rma_cutOffDate.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u65e5 -rma_recordsmanagement.property.rma_cutOffDate.decription=\u30ab\u30c3\u30c8\u30aa\u30d5\u65e5 - -rma_recordsmanagement.aspect.rma_transferred.title=\u8ee2\u9001\u6e08\u307f -rma_recordsmanagement.aspect.rma_transferred.decription=\u8ee2\u9001\u6e08\u307f - -rma_recordsmanagement.aspect.rma_ascended.title=\u6607\u9806\u3067\u4e26\u3079\u66ff\u3048\u6e08\u307f -rma_recordsmanagement.aspect.rma_ascended.decription=\u6607\u9806\u3067\u4e26\u3079\u66ff\u3048\u6e08\u307f - -rma_recordsmanagement.aspect.rma_frozen.title=\u30db\u30fc\u30eb\u30c9\u4e2d -rma_recordsmanagement.aspect.rma_frozen.decription=\u30db\u30fc\u30eb\u30c9\u4e2d -rma_recordsmanagement.property.rma_frozenAt.title=\u30db\u30fc\u30eb\u30c9\u65e5\u6642 -rma_recordsmanagement.property.rma_frozenAt.decription=\u30db\u30fc\u30eb\u30c9\u65e5\u6642 -rma_recordsmanagement.property.rma_frozenBy.title=\u30db\u30fc\u30eb\u30c9\u5b9f\u884c\u8005 -rma_recordsmanagement.property.rma_frozenBy.decription=\u30db\u30fc\u30eb\u30c9\u5b9f\u884c\u8005 - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u8b66\u544a\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u8b66\u544a\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u8b66\u544a\u306e\u8a2d\u5b9a -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u8b66\u544a\u306e\u8a2d\u5b9a - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 -rma_recordsmanagement.association.rma_emailConfigAssoc.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a -rma_recordsmanagement.association.rma_emailConfigAssoc.description=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a - -rma_recordsmanagement.aspect.rma_recordSearch.title=\u30ec\u30b3\u30fc\u30c9\u306e\u691c\u7d22 -rma_recordsmanagement.aspect.rma_recordSearch.decription=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u3067\u306e\u691c\u7d22\u306b\u95a2\u3059\u308b\u60c5\u5831 -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3042\u308a -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u30a2\u30a4\u30c6\u30e0\u306b\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u304c\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059\u3002 -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u53ef\u80fd\u65e5 -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406\u304c\u5b9f\u884c\u53ef\u80fd\u306b\u306a\u308b\u65e5 -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u4fdd\u7ba1\u671f\u9593 -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u4fdd\u7ba1\u671f\u9593 -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u4fdd\u7ba1\u671f\u9593\u306e\u8a08\u7b97\u5f0f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u4fdd\u7ba1\u671f\u9593\u306e\u8a08\u7b97\u5f0f -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u4fdd\u7ba1\u6a29\u9650 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u4fdd\u7ba1\u6a29\u9650 -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u4fdd\u7ba1\u6307\u793a -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u4fdd\u7ba1\u6307\u793a -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u671f\u9593 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u671f\u9593 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u30ec\u30d3\u30e5\u30fc\u671f\u9593\u306e\u8a08\u7b97\u5f0f -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u30ec\u30d3\u30e5\u30fc\u671f\u9593\u306e\u8a08\u7b97\u5f0f - -rma_recordsmanagement.aspect.rma_versionedRecord.title=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9 - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 -rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 -rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059 -rma_recordsmanagement.property.rma_updateTo.title=\u66f4\u65b0\u5148 -rma_recordsmanagement.property.rma_updateTo.description=\u66f4\u65b0\u306e\u9069\u7528\u5148 -rma_recordsmanagement.property.rma_updatedProperties.title=\u66f4\u65b0\u6e08\u307f\u30d7\u30ed\u30d1\u30c6\u30a3 -rma_recordsmanagement.property.rma_updatedProperties.description=\u66f4\u65b0\u6e08\u307f\u30d7\u30ed\u30d1\u30c6\u30a3 -rma_recordsmanagement.property.rma_publishInProgress.title=\u516c\u958b\u4e2d -rma_recordsmanagement.property.rma_publishInProgress.description=\u73fe\u5728\u516c\u958b\u4e2d\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059 - -rma_recordsmanagement.aspect.dod_ghosted.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u307f\u306e\u30ec\u30b3\u30fc\u30c9 -rma_recordsmanagement.aspect.dod_ghosted.description=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u307f\u306e\u30ec\u30b3\u30fc\u30c9 - -listconstraint.rmc_tlList.title=\u8ee2\u9001\u5834\u6240 +rma_recordsmanagement.description=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb + +rma_recordsmanagement.type.rma_rmsite.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b5\u30a4\u30c8 +rma_recordsmanagement.type.rma_rmsite.description=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u7528\u306e\u5c02\u9580\u30b5\u30a4\u30c8 + +rma_recordsmanagement.type.rma_caveatConfig.title=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u8a2d\u5b9a +rma_recordsmanagement.type.rma_caveatConfig.decription=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u8a2d\u5b9a + +rma_recordsmanagement.type.rma_emailConfig.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a +rma_recordsmanagement.type.rma_emailConfig.decription=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b3\u30f3\u30c6\u30ca\u30fc +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b3\u30f3\u30c6\u30ca\u30fc + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u30b3\u30f3\u30c6\u30ca\u30fc +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u30b3\u30f3\u30c6\u30ca\u30fc + +rma_recordsmanagement.type.rma_dispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb +rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb + +rma_recordsmanagement.property.rma_dispositionAuthority.title=\u4fdd\u7ba1\u6a29\u9650 +rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u4fdd\u7ba1\u6a29\u9650 + +rma_recordsmanagement.property.rma_dispositionInstructions.title=\u4fdd\u7ba1\u6307\u793a +rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u4fdd\u7ba1\u6307\u793a + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u30ec\u30b3\u30fc\u30c9\u30ec\u30d9\u30eb\u306e\u4fdd\u7ba1 +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u30ec\u30b3\u30fc\u30c9\u30ec\u30d9\u30eb\u306e\u4fdd\u7ba1 + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u4fdd\u7ba1\u51e6\u7406 + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9 +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9a\u7fa9 +rma_recordsmanagement.property.rma_dispositionActionName.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d +rma_recordsmanagement.property.rma_dispositionActionName.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d +rma_recordsmanagement.property.rma_dispositionDescription.title=\u4fdd\u7ba1\u306e\u8aac\u660e +rma_recordsmanagement.property.rma_dispositionDescription.decription=\u4fdd\u7ba1\u306e\u8aac\u660e +rma_recordsmanagement.property.rma_dispositionLocation.title=\u4fdd\u7ba1\u5834\u6240 +rma_recordsmanagement.property.rma_dispositionLocation.decription=\u4fdd\u7ba1\u5834\u6240 +rma_recordsmanagement.property.rma_dispositionPeriod.title=\u4fdd\u7ba1\u671f\u9593 +rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u4fdd\u7ba1\u671f\u9593 +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u4fdd\u7ba1\u671f\u9593\u306e\u30d7\u30ed\u30d1\u30c6\u30a3 +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u4fdd\u7ba1\u671f\u9593\u306e\u30d7\u30ed\u30d1\u30c6\u30a3 +rma_recordsmanagement.property.rma_dispositionEvent.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 +rma_recordsmanagement.property.rma_dispositionEvent.decription=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 +rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8\u306e\u7d44\u307f\u5408\u308f\u305b +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8\u306e\u7d44\u307f\u5408\u308f\u305b + +rma_recordsmanagement.type.rma_recordFolder.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +rma_recordsmanagement.type.rma_recordFolder.decription=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +rma_recordsmanagement.property.rma_isClosed.title=\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.property.rma_isClosed.decription=\u30ec\u30b3\u30fc\u30c9 + +rma_recordsmanagement.type.rma_recordCategory.title=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea +rma_recordsmanagement.type.rma_recordCategory.decription=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u975e\u96fb\u5b50\u6587\u66f8 +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u975e\u96fb\u5b50\u6587\u66f8 +rma_recordsmanagement.property.rma_physicalSize.title=\u7269\u7406\u7684\u306a\u30b5\u30a4\u30ba +rma_recordsmanagement.property.rma_physicalSize.decription=\u6587\u66f8\u306e\u30b5\u30a4\u30ba\u306f\u30ea\u30cb\u30a2\u30e1\u30fc\u30bf\u30fc\u3067\u8a08\u6e2c\u3055\u308c\u307e\u3059\u3002 +rma_recordsmanagement.property.rma_numberOfCopies.title=\u30b3\u30d4\u30fc\u6570 +rma_recordsmanagement.property.rma_numberOfCopies.description=\u6587\u66f8\u306e\u30b3\u30d4\u30fc\u6570\u3002 +rma_recordsmanagement.property.rma_storageLocation.title=\u4fdd\u7ba1\u5834\u6240 +rma_recordsmanagement.property.rma_storageLocation.decription=\u30ec\u30b3\u30fc\u30c9\u306e\u7269\u7406\u7684\u306a\u4fdd\u7ba1\u5834\u6240\u3002 +rma_recordsmanagement.property.rma_shelf.title=\u68da +rma_recordsmanagement.property.rma_shelf.decription=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u68da\u3002 +rma_recordsmanagement.property.rma_box.title=\u7bb1 +rma_recordsmanagement.property.rma_box.description=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u7bb1\u3002 +rma_recordsmanagement.property.rma_file.title=\u30d5\u30a1\u30a4\u30eb +rma_recordsmanagement.property.rma_file.decription=\u30ec\u30b3\u30fc\u30c9\u3092\u4fdd\u7ba1\u3057\u3066\u304a\u304f\u30d5\u30a1\u30a4\u30eb\u3002 + +rma_recordsmanagement.type.rma_dispositionAction.title=\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.type.rma_dispositionAction.decription=\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.property.rma_dispositionActionId.title=\u4fdd\u7ba1\u51e6\u7406 ID +rma_recordsmanagement.property.rma_dispositionActionId.decription=\u4fdd\u7ba1\u51e6\u7406 ID +rma_recordsmanagement.property.rma_dispositionAction.title=\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.property.rma_dispositionAction.decription=\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.property.rma_dispositionAsOf.title=\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u65e5\u6642 +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u65e5\u6642 +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u8005 +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u958b\u59cb\u8005 +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u65e5\u6642 +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u65e5\u6642 +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u8005 +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b8c\u4e86\u8005 +rma_recordsmanagement.association.rma_eventExecutions.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c +rma_recordsmanagement.association.rma_eventExecutions.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c + +rma_recordsmanagement.type.rma_eventExecution.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c +rma_recordsmanagement.type.rma_eventExecution.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b9f\u884c +rma_recordsmanagement.property.rma_eventExecutionName.title=\u30a4\u30d9\u30f3\u30c8\u540d +rma_recordsmanagement.property.rma_eventExecutionName.decription=\u30a4\u30d9\u30f3\u30c8\u540d +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u30a4\u30d9\u30f3\u30c8\u306e\u81ea\u52d5\u5316 +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u81ea\u52d5\u5316 +rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u30a4\u30d9\u30f3\u30c8\u5b8c\u4e86 +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u30a4\u30d9\u30f3\u30c8\u5b8c\u4e86 +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u8005 +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u8005 +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u65e5\u6642 +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u30a4\u30d9\u30f3\u30c8\u306e\u5b8c\u4e86\u65e5\u6642 + +rma_recordsmanagement.type.rma_hold.title=\u30db\u30fc\u30eb\u30c9 +rma_recordsmanagement.type.rma_hold.decription=\u30db\u30fc\u30eb\u30c9 +rma_recordsmanagement.property.rma_holdReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531 +rma_recordsmanagement.property.rma_holdReason.decription=\u30db\u30fc\u30eb\u30c9\u7406\u7531 +rma_recordsmanagement.association.rma_frozenRecords.title=\u30db\u30fc\u30eb\u30c9\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.association.rma_frozenRecords.decription=\u30db\u30fc\u30eb\u30c9\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9 + +rma_recordsmanagement.type.rma_transfer.title=\u8ee2\u9001 +rma_recordsmanagement.type.rma_transfer.decription=\u8ee2\u9001 +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u8ee2\u9001\u53d7\u8afe\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u8ee2\u9001\u53d7\u8afe\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc +rma_recordsmanagement.property.rma_transferPDFIndicator.title=PDF\u306e\u8ee2\u9001\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=PDF\u306e\u8ee2\u9001\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc +rma_recordsmanagement.property.rma_transferLocation.title=PDF\u306e\u8ee2\u9001 +rma_recordsmanagement.property.rma_transferLocation.decription=PDF\u306e\u8ee2\u9001 +rma_recordsmanagement.association.rma_transferred.title=\u8ee2\u9001\u6e08\u307f +rma_recordsmanagement.association.rma_transferred.decription=\u8ee2\u9001\u6e08\u307f + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u6574\u7406\u4fdd\u7ba1\u30d7\u30e9\u30f3\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 +rma_recordsmanagement.property.rma_rootNodeRef.title=\u30eb\u30fc\u30c8\u30ce\u30fc\u30c9 +rma_recordsmanagement.property.rma_rootNodeRef.decription=\u30eb\u30fc\u30c8\u30ce\u30fc\u30c9 + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8 +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8 +rma_recordsmanagement.association.rma_holds.title=\u30db\u30fc\u30eb\u30c9 +rma_recordsmanagement.association.rma_holds.decription=\u30db\u30fc\u30eb\u30c9 +rma_recordsmanagement.association.rma_transfers.title=\u8ee2\u9001 +rma_recordsmanagement.association.rma_transfers.decription=\u8ee2\u9001 + +rma_recordsmanagement.aspect.rma_declaredRecord.title=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u5b8c\u4e86\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.property.rma_declaredAt.title=\u5b8c\u4e86\u65e5 +rma_recordsmanagement.property.rma_declaredAt.decription=\u5b8c\u4e86\u65e5 +rma_recordsmanagement.property.rma_declaredBy.title=\u5b8c\u4e86\u8005 +rma_recordsmanagement.property.rma_declaredBy.decription=\u5b8c\u4e86\u8005 + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u30ec\u30b3\u30fc\u30c9\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 ID +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u30ec\u30b3\u30fc\u30c9\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 ID +rma_recordsmanagement.property.rma_identifier.title=\u30ec\u30b3\u30fc\u30c9 ID +rma_recordsmanagement.property.rma_identifier.decription=\u4e00\u610f\u306e\u30ec\u30b3\u30fc\u30c9 ID +rma_recordsmanagement.property.rma_dbUniquenessId.title=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e00\u610f\u6027 +rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e00\u610f\u6027 + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9 +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9 + +rma_recordsmanagement.property.rma_reviewPeriod.title=\u30ec\u30d3\u30e5\u30fc\u671f\u9593 +rma_recordsmanagement.property.rma_reviewPeriod.decription=\u30ec\u30d3\u30e5\u30fc\u671f\u9593 +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc + +rma_recordsmanagement.aspect.rma_record.title=\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.aspect.rma_record.decription=\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.property.rma_dateFiled.title=\u6574\u7406\u4fdd\u7ba1\u65e5 +rma_recordsmanagement.property.rma_dateFiled.decription=\u6574\u7406\u4fdd\u7ba1\u65e5 +rma_recordsmanagement.property.rma_origionalName=\u5143\u306e\u540d\u524d + +rma_recordsmanagement.aspect.rma_recordMetaData.title=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf +rma_recordsmanagement.aspect.rma_recordMetaData.description=\u30ec\u30b3\u30fc\u30c9\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30de\u30fc\u30ab\u30fc\u30a2\u30b9\u30da\u30af\u30c8 + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u5171\u901a\u3059\u308b\u30ec\u30b3\u30fc\u30c9\u60c5\u5831 +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u30bf\u30a4\u30d7\u306b\u5171\u901a\u3059\u308b\u30e1\u30bf\u30c7\u30fc\u30bf +rma_recordsmanagement.property.rma_location.title=\u5834\u6240 +rma_recordsmanagement.property.rma_location.decription=\u5834\u6240 + +rma_recordsmanagement.aspect.rma_vitalRecord.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.property.rma_reviewAsOf.title=\u6b21\u56de\u306e\u30ec\u30d3\u30e5\u30fc +rma_recordsmanagement.property.rma_reviewAsOf.decription=\u6b21\u56de\u306e\u30ec\u30d3\u30e5\u30fc +rma_recordsmanagement.property.rma_notificationIssued.title=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u304c\u901a\u77e5\u3055\u308c\u305f\u3053\u3068\u3092\u793a\u3057\u307e\u3059 +rma_recordsmanagement.property.rma_notificationIssued.decription=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u304c\u901a\u77e5\u3055\u308c\u305f\u3053\u3068\u3092\u793a\u3057\u307e\u3059 + +rma_recordsmanagement.aspect.rma_scheduled.title=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f +rma_recordsmanagement.aspect.rma_scheduled.decription=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f +rma_recordsmanagement.association.rma_dispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb +rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u4fdd\u7ba1\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb +rma_recordsmanagement.association.rma_nextDispositionAction.title=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406 +rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5c65\u6b74 +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u4fdd\u7ba1\u51e6\u7406\u306e\u5c65\u6b74 + +rma_recordsmanagement.aspect.rma_cutOff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 +rma_recordsmanagement.aspect.rma_cutOff.decription=\u30ab\u30c3\u30c8\u30aa\u30d5 +rma_recordsmanagement.property.rma_cutOffDate.title=\u30ab\u30c3\u30c8\u30aa\u30d5\u65e5 +rma_recordsmanagement.property.rma_cutOffDate.decription=\u30ab\u30c3\u30c8\u30aa\u30d5\u65e5 + +rma_recordsmanagement.aspect.rma_transferred.title=\u8ee2\u9001\u6e08\u307f +rma_recordsmanagement.aspect.rma_transferred.decription=\u8ee2\u9001\u6e08\u307f + +rma_recordsmanagement.aspect.rma_ascended.title=\u6607\u9806\u3067\u4e26\u3079\u66ff\u3048\u6e08\u307f +rma_recordsmanagement.aspect.rma_ascended.decription=\u6607\u9806\u3067\u4e26\u3079\u66ff\u3048\u6e08\u307f + +rma_recordsmanagement.aspect.rma_frozen.title=\u30db\u30fc\u30eb\u30c9\u4e2d +rma_recordsmanagement.aspect.rma_frozen.decription=\u30db\u30fc\u30eb\u30c9\u4e2d +rma_recordsmanagement.property.rma_frozenAt.title=\u30db\u30fc\u30eb\u30c9\u65e5\u6642 +rma_recordsmanagement.property.rma_frozenAt.decription=\u30db\u30fc\u30eb\u30c9\u65e5\u6642 +rma_recordsmanagement.property.rma_frozenBy.title=\u30db\u30fc\u30eb\u30c9\u5b9f\u884c\u8005 +rma_recordsmanagement.property.rma_frozenBy.decription=\u30db\u30fc\u30eb\u30c9\u5b9f\u884c\u8005 + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u8b66\u544a\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u8b66\u544a\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u8b66\u544a\u306e\u8a2d\u5b9a +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u8b66\u544a\u306e\u8a2d\u5b9a + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a\u30eb\u30fc\u30c8 +rma_recordsmanagement.association.rma_emailConfigAssoc.title=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a +rma_recordsmanagement.association.rma_emailConfigAssoc.description=E \u30e1\u30fc\u30eb\u306e\u8a2d\u5b9a + +rma_recordsmanagement.aspect.rma_recordSearch.title=\u30ec\u30b3\u30fc\u30c9\u306e\u691c\u7d22 +rma_recordsmanagement.aspect.rma_recordSearch.decription=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u3067\u306e\u691c\u7d22\u306b\u95a2\u3059\u308b\u60c5\u5831 +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3042\u308a +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u30a2\u30a4\u30c6\u30e0\u306b\u4fdd\u7ba1\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u304c\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059\u3002 +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406\u306e\u540d\u524d +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u4fdd\u7ba1\u51e6\u7406\u306e\u5b9f\u884c\u53ef\u80fd\u65e5 +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u6b21\u56de\u306e\u4fdd\u7ba1\u51e6\u7406\u304c\u5b9f\u884c\u53ef\u80fd\u306b\u306a\u308b\u65e5 +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u4fdd\u7ba1\u671f\u9593 +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u4fdd\u7ba1\u671f\u9593 +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u4fdd\u7ba1\u671f\u9593\u306e\u8a08\u7b97\u5f0f +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u4fdd\u7ba1\u671f\u9593\u306e\u8a08\u7b97\u5f0f +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u5b9f\u884c\u53ef\u80fd\u306a\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u4fdd\u7ba1\u30a4\u30d9\u30f3\u30c8 +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u4fdd\u7ba1\u6a29\u9650 +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u4fdd\u7ba1\u6a29\u9650 +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u4fdd\u7ba1\u6307\u793a +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u4fdd\u7ba1\u6307\u793a +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u30db\u30fc\u30eb\u30c9\u7406\u7531 +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u30db\u30fc\u30eb\u30c9\u7406\u7531 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u671f\u9593 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u671f\u9593 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u30ec\u30d3\u30e5\u30fc\u671f\u9593\u306e\u8a08\u7b97\u5f0f +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u30ec\u30d3\u30e5\u30fc\u671f\u9593\u306e\u8a08\u7b97\u5f0f + +rma_recordsmanagement.aspect.rma_versionedRecord.title=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9 + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 +rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831 +rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u975e\u516c\u958b\u306e\u66f4\u65b0\u60c5\u5831\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059 +rma_recordsmanagement.property.rma_updateTo.title=\u66f4\u65b0\u5148 +rma_recordsmanagement.property.rma_updateTo.description=\u66f4\u65b0\u306e\u9069\u7528\u5148 +rma_recordsmanagement.property.rma_updatedProperties.title=\u66f4\u65b0\u6e08\u307f\u30d7\u30ed\u30d1\u30c6\u30a3 +rma_recordsmanagement.property.rma_updatedProperties.description=\u66f4\u65b0\u6e08\u307f\u30d7\u30ed\u30d1\u30c6\u30a3 +rma_recordsmanagement.property.rma_publishInProgress.title=\u516c\u958b\u4e2d +rma_recordsmanagement.property.rma_publishInProgress.description=\u73fe\u5728\u516c\u958b\u4e2d\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u793a\u3057\u307e\u3059 + +rma_recordsmanagement.aspect.dod_ghosted.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u307f\u306e\u30ec\u30b3\u30fc\u30c9 +rma_recordsmanagement.aspect.dod_ghosted.description=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u307f\u306e\u30ec\u30b3\u30fc\u30c9 + +listconstraint.rmc_tlList.title=\u8ee2\u9001\u5834\u6240 listconstraint.rmc_smList.title=\u88dc\u8db3\u30de\u30fc\u30ad\u30f3\u30b0 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties index 189eb574e1..549efbf075 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=Oppf\u00f8ringsh\u00e5ndtering av innholdsmodell - -rma_recordsmanagement.type.rma_rmsite.title=Sted til oppf\u00f8ringsh\u00e5ndtering -rma_recordsmanagement.type.rma_rmsite.description=Spesialisert omr\u00e5de til oppf\u00f8ringsh\u00e5ndtering - -rma_recordsmanagement.type.rma_caveatConfig.title=Konfigurasjon av sikkerhetskontroller -rma_recordsmanagement.type.rma_caveatConfig.decription=Konfigurasjon av sikkerhetskontroller - -rma_recordsmanagement.type.rma_emailConfig.title=E-postkonfigurasjon -rma_recordsmanagement.type.rma_emailConfig.decription=E-postkonfigurasjon - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Oppf\u00f8ringsh\u00e5ndteringsbeholder -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Oppf\u00f8ringsh\u00e5ndteringsbeholder - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Filplanbeholder -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Filplanbeholder - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Retensjonsplan -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retensjonsplan - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Retensjonsrett -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retensjonsrett - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Retensjonsinstruksjoner -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retensjonsinstruksjoner - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Oppf\u00f8ringsniv\u00e5 ved retensjon -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Oppf\u00f8ringsniv\u00e5 ved retensjon - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retensjonshandlinger -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retensjonshandlinger - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definisjon av retensjonshandling -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definisjon av retensjonshandling -rma_recordsmanagement.property.rma_dispositionActionName.title=Navn p\u00e5 retensjonshandling -rma_recordsmanagement.property.rma_dispositionActionName.decription=Navn p\u00e5 retensjonshandling -rma_recordsmanagement.property.rma_dispositionDescription.title=Retensjonsbeskrivelse -rma_recordsmanagement.property.rma_dispositionDescription.decription=Retensjonsbeskrivelse -rma_recordsmanagement.property.rma_dispositionLocation.title=Retensjonssted -rma_recordsmanagement.property.rma_dispositionLocation.decription=Retensjonssted -rma_recordsmanagement.property.rma_dispositionPeriod.title=Retensjonsperiode -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retensjonsperiode -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Egenskap ved retensjonsperiode -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Egenskap ved retensjonsperiode -rma_recordsmanagement.property.rma_dispositionEvent.title=Retensjonshendelse -rma_recordsmanagement.property.rma_dispositionEvent.decription=Retensjonshendelse -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Kombinert retensjonshendelse -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Kombinert retensjonshendelse - -rma_recordsmanagement.type.rma_recordFolder.title=Oppf\u00f8ringsmappe -rma_recordsmanagement.type.rma_recordFolder.decription=Oppf\u00f8ringsmappe -rma_recordsmanagement.property.rma_isClosed.title=Oppf\u00f8ring -rma_recordsmanagement.property.rma_isClosed.decription=Oppf\u00f8ring - -rma_recordsmanagement.type.rma_recordCategory.title=Oppf\u00f8ringskategori -rma_recordsmanagement.type.rma_recordCategory.decription=Oppf\u00f8ringskategori - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Ikke-elektronisk dokument -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Ikke-elektronisk dokument -rma_recordsmanagement.property.rma_physicalSize.title=Fysisk st\u00f8rrelse -rma_recordsmanagement.property.rma_physicalSize.decription=St\u00f8rrelsen p\u00e5 dokumentet m\u00e5lt i line\u00e6re meter. -rma_recordsmanagement.property.rma_numberOfCopies.title=Antall kopier -rma_recordsmanagement.property.rma_numberOfCopies.description=Antall kopier av dokumentet. -rma_recordsmanagement.property.rma_storageLocation.title=Lagringssted -rma_recordsmanagement.property.rma_storageLocation.decription=Det fysiske lagringsstedet til oppf\u00f8ringen. -rma_recordsmanagement.property.rma_shelf.title=Hylle -rma_recordsmanagement.property.rma_shelf.decription=Hyllen som oppf\u00f8ringen oppbevares p\u00e5. -rma_recordsmanagement.property.rma_box.title=Eske -rma_recordsmanagement.property.rma_box.description=Esken som oppf\u00f8ringen oppbevares i. -rma_recordsmanagement.property.rma_file.title=Fil -rma_recordsmanagement.property.rma_file.decription=Filen som oppf\u00f8ringen oppbevares i. - -rma_recordsmanagement.type.rma_dispositionAction.title=Retensjonshandling -rma_recordsmanagement.type.rma_dispositionAction.decription=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionActionId.title=Retensjonshandling-ID -rma_recordsmanagement.property.rma_dispositionActionId.decription=Retensjonshandling-ID -rma_recordsmanagement.property.rma_dispositionAction.title=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionAction.decription=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionAsOf.title=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retensjonshandling -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Kvalifiserte retensjonshendelser -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Kvalifiserte retensjonshendelser -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retensjonshandling som starter p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retensjonshandling som starter p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retensjonshandling som startes av -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retensjonshandling som startes av -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retensjonshandling som fullf\u00f8res p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retensjonshandling som fullf\u00f8res p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retensjonshandling som fullf\u00f8res av -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retensjonshandling som fullf\u00f8res av -rma_recordsmanagement.association.rma_eventExecutions.title=Utf\u00f8rte hendelser -rma_recordsmanagement.association.rma_eventExecutions.decription=Utf\u00f8rte hendelser - -rma_recordsmanagement.type.rma_eventExecution.title=Utf\u00f8relse av hendelse -rma_recordsmanagement.type.rma_eventExecution.decription=Utf\u00f8relse av hendelse -rma_recordsmanagement.property.rma_eventExecutionName.title=Hendelsenavn -rma_recordsmanagement.property.rma_eventExecutionName.decription=Hendelsenavn -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Automatisk hendelse -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Automatisk hendelse -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Fullf\u00f8rt hendelse -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Fullf\u00f8rt hendelse -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Hendelse fullf\u00f8rt av -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Hendelse fullf\u00f8rt av -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Hendelse fullf\u00f8rt den -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Hendelse fullf\u00f8rt den - -rma_recordsmanagement.type.rma_hold.title=Hold -rma_recordsmanagement.type.rma_hold.decription=Hold -rma_recordsmanagement.property.rma_holdReason.title=Grunn til holdet -rma_recordsmanagement.property.rma_holdReason.decription=Grunn til holdet -rma_recordsmanagement.association.rma_frozenRecords.title=Oppf\u00f8ringer p\u00e5 hold -rma_recordsmanagement.association.rma_frozenRecords.decription=Oppf\u00f8ringer p\u00e5 hold - -rma_recordsmanagement.type.rma_transfer.title=Overf\u00f8r -rma_recordsmanagement.type.rma_transfer.decription=Overf\u00f8r -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Overf\u00f8r tilgangsindikator -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Overf\u00f8r tilgangsindikator -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Overf\u00f8r PDF-indikator -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Overf\u00f8r PDF-indikator -rma_recordsmanagement.property.rma_transferLocation.title=Overf\u00f8r PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Overf\u00f8r PDF -rma_recordsmanagement.association.rma_transferred.title=Overf\u00f8rt -rma_recordsmanagement.association.rma_transferred.decription=Overf\u00f8rt - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Filplandel -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Filplandel -rma_recordsmanagement.property.rma_rootNodeRef.title=Rotnode -rma_recordsmanagement.property.rma_rootNodeRef.decription=Rotnode - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Filplan -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Filplan -rma_recordsmanagement.association.rma_holds.title=Hold -rma_recordsmanagement.association.rma_holds.decription=Hold -rma_recordsmanagement.association.rma_transfers.title=Overf\u00f8ringer -rma_recordsmanagement.association.rma_transfers.decription=Overf\u00f8ringer - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Fullf\u00f8rt oppf\u00f8ring -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Fullf\u00f8rt oppf\u00f8ring -rma_recordsmanagement.property.rma_declaredAt.title=Dato fullf\u00f8rt -rma_recordsmanagement.property.rma_declaredAt.decription=Dato fullf\u00f8rt -rma_recordsmanagement.property.rma_declaredBy.title=Fullf\u00f8rt av -rma_recordsmanagement.property.rma_declaredBy.decription=Fullf\u00f8rt av - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Del-ID til oppf\u00f8ring -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Del-ID til oppf\u00f8ring -rma_recordsmanagement.property.rma_identifier.title=Oppf\u00f8rings-ID -rma_recordsmanagement.property.rma_identifier.decription=Unik oppf\u00f8rings-ID -rma_recordsmanagement.property.rma_dbUniquenessId.title=Unikt ved database -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unikt ved database - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Sv\u00e6rt viktig oppf\u00f8ringsdefinisjon -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Sv\u00e6rt viktig oppf\u00f8ringsdefinisjon - -rma_recordsmanagement.property.rma_reviewPeriod.title=Gjennomgangsperiode -rma_recordsmanagement.property.rma_reviewPeriod.decription=Gjennomgangsperiode -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Sv\u00e6rt viktig oppf\u00f8ringsindikator -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Sv\u00e6rt viktig oppf\u00f8ringsindikator - -rma_recordsmanagement.aspect.rma_record.title=Oppf\u00f8ring -rma_recordsmanagement.aspect.rma_record.decription=Oppf\u00f8ring -rma_recordsmanagement.property.rma_dateFiled.title=Dato registrert -rma_recordsmanagement.property.rma_dateFiled.decription=Dato registrert -rma_recordsmanagement.property.rma_origionalName=Opprinnelig navn - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Oppf\u00f8ringsmetadata -rma_recordsmanagement.aspect.rma_recordMetaData.description=Mark\u00f8raspekt for oppf\u00f8ringsmetadata - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Felles oppf\u00f8ringsinformasjon -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Felles metadata for alle oppf\u00f8ringstyper -rma_recordsmanagement.property.rma_location.title=Sted -rma_recordsmanagement.property.rma_location.decription=Sted - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Sv\u00e6rt viktig oppf\u00f8ring -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Sv\u00e6rt viktig oppf\u00f8ring -rma_recordsmanagement.property.rma_reviewAsOf.title=Neste gjennomgang -rma_recordsmanagement.property.rma_reviewAsOf.decription=Neste gjennomgang -rma_recordsmanagement.property.rma_notificationIssued.title=Indikerer at en melding om at denne oppf\u00f8ringen skal gjennomg\u00e5s, er blitt utstedt -rma_recordsmanagement.property.rma_notificationIssued.decription=Indikerer at en melding om at denne oppf\u00f8ringen skal gjennomg\u00e5s, er blitt utstedt - -rma_recordsmanagement.aspect.rma_scheduled.title=Planlagt -rma_recordsmanagement.aspect.rma_scheduled.decription=Planlagt -rma_recordsmanagement.association.rma_dispositionSchedule.title=Retensjonsplan -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retensjonsplan - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Livssyklus ved retensjon -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Livssyklus ved retensjon -rma_recordsmanagement.association.rma_nextDispositionAction.title=Neste retensjonshandling -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Neste retensjonshandling -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historikk ved retensjonshandling -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historikk ved retensjonshandling - -rma_recordsmanagement.aspect.rma_cutOff.title=Cut off -rma_recordsmanagement.aspect.rma_cutOff.decription=Cut off -rma_recordsmanagement.property.rma_cutOffDate.title=Cut off-dato -rma_recordsmanagement.property.rma_cutOffDate.decription=Cut off-dato - -rma_recordsmanagement.aspect.rma_transferred.title=Overf\u00f8rt -rma_recordsmanagement.aspect.rma_transferred.decription=Overf\u00f8rt - -rma_recordsmanagement.aspect.rma_ascended.title=Stigende -rma_recordsmanagement.aspect.rma_ascended.decription=Stigende - -rma_recordsmanagement.aspect.rma_frozen.title=P\u00e5 hold -rma_recordsmanagement.aspect.rma_frozen.decription=P\u00e5 hold -rma_recordsmanagement.property.rma_frozenAt.title=Holdes ved -rma_recordsmanagement.property.rma_frozenAt.decription=Holdes ved -rma_recordsmanagement.property.rma_frozenBy.title=Holdes av -rma_recordsmanagement.property.rma_frozenBy.decription=Holdes av - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Varselskonfigurasjonsrot -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Varselskonfigurasjonsrot -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Varselskonfigurasjon -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Varselskonfigurasjon - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Roten ved e-postkonfigurasjon -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Roten ved e-postkonfigurasjon -rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-postkonfigurasjon -rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-postkonfigurasjon - -rma_recordsmanagement.aspect.rma_recordSearch.title=Oppf\u00f8ringss\u00f8k -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informasjon som st\u00f8tter s\u00f8k i oppf\u00f8ringsh\u00e5ndtering -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Har retensjonsplan -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indikerer om elementet er forbundet med retensjonsplanen -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Navn p\u00e5 retensjonshandling -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Navnet p\u00e5 neste retensjonshandling -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retensjonshandling av -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=Datoen n\u00e5r neste retensjonshandling blir kvalifisert -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retensjonsperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retensjonsperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Uttrykk ved retensjonsperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Uttrykk ved retensjonsperiode -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Kvalifiserte retensjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Kvalifiserte retensjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retensjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retensjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retensjonsrett -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retensjonsrett -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retensjonsinstruksjoner -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retensjonsinstruksjoner -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Grunn til holdet -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Grunn til holdet -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Gjennomgangsperiode til den sv\u00e6rt viktige oppf\u00f8ringen -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Gjennomgangsperiode til den sv\u00e6rt viktige oppf\u00f8ringen -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Uttrykk av gjennomgangsperioden -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Uttrykk av gjennomgangsperioden - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Oppf\u00f8ring med versjon -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Oppf\u00f8ring med versjon - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Upublisert oppdatering -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Upublisert oppdatering -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Upublisert oppdatering -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indikerer om det finnes en upublisert oppdatering -rma_recordsmanagement.property.rma_updateTo.title=Oppdater til -rma_recordsmanagement.property.rma_updateTo.description=M\u00e5let til oppdateringen -rma_recordsmanagement.property.rma_updatedProperties.title=Oppdaterte egenskaper -rma_recordsmanagement.property.rma_updatedProperties.description=De oppdaterte egenskapene -rma_recordsmanagement.property.rma_publishInProgress.title=Publisering p\u00e5g\u00e5r -rma_recordsmanagement.property.rma_publishInProgress.description=Indikerer om en publisering p\u00e5g\u00e5r for tiden - -rma_recordsmanagement.aspect.dod_ghosted.title=Oppf\u00f8ring kun med metadata -rma_recordsmanagement.aspect.dod_ghosted.description=Oppf\u00f8ring kun med metadata - -listconstraint.rmc_tlList.title=Overf\u00f8ringssteder +rma_recordsmanagement.description=Oppf\u00f8ringsh\u00e5ndtering av innholdsmodell + +rma_recordsmanagement.type.rma_rmsite.title=Sted til oppf\u00f8ringsh\u00e5ndtering +rma_recordsmanagement.type.rma_rmsite.description=Spesialisert omr\u00e5de til oppf\u00f8ringsh\u00e5ndtering + +rma_recordsmanagement.type.rma_caveatConfig.title=Konfigurasjon av sikkerhetskontroller +rma_recordsmanagement.type.rma_caveatConfig.decription=Konfigurasjon av sikkerhetskontroller + +rma_recordsmanagement.type.rma_emailConfig.title=E-postkonfigurasjon +rma_recordsmanagement.type.rma_emailConfig.decription=E-postkonfigurasjon + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=Oppf\u00f8ringsh\u00e5ndteringsbeholder +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Oppf\u00f8ringsh\u00e5ndteringsbeholder + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Filplanbeholder +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Filplanbeholder + +rma_recordsmanagement.type.rma_dispositionSchedule.title=Retensjonsplan +rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retensjonsplan + +rma_recordsmanagement.property.rma_dispositionAuthority.title=Retensjonsrett +rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retensjonsrett + +rma_recordsmanagement.property.rma_dispositionInstructions.title=Retensjonsinstruksjoner +rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retensjonsinstruksjoner + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=Oppf\u00f8ringsniv\u00e5 ved retensjon +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Oppf\u00f8ringsniv\u00e5 ved retensjon + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retensjonshandlinger +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retensjonshandlinger + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definisjon av retensjonshandling +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definisjon av retensjonshandling +rma_recordsmanagement.property.rma_dispositionActionName.title=Navn p\u00e5 retensjonshandling +rma_recordsmanagement.property.rma_dispositionActionName.decription=Navn p\u00e5 retensjonshandling +rma_recordsmanagement.property.rma_dispositionDescription.title=Retensjonsbeskrivelse +rma_recordsmanagement.property.rma_dispositionDescription.decription=Retensjonsbeskrivelse +rma_recordsmanagement.property.rma_dispositionLocation.title=Retensjonssted +rma_recordsmanagement.property.rma_dispositionLocation.decription=Retensjonssted +rma_recordsmanagement.property.rma_dispositionPeriod.title=Retensjonsperiode +rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retensjonsperiode +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Egenskap ved retensjonsperiode +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Egenskap ved retensjonsperiode +rma_recordsmanagement.property.rma_dispositionEvent.title=Retensjonshendelse +rma_recordsmanagement.property.rma_dispositionEvent.decription=Retensjonshendelse +rma_recordsmanagement.property.rma_dispositionEventCombination.title=Kombinert retensjonshendelse +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Kombinert retensjonshendelse + +rma_recordsmanagement.type.rma_recordFolder.title=Oppf\u00f8ringsmappe +rma_recordsmanagement.type.rma_recordFolder.decription=Oppf\u00f8ringsmappe +rma_recordsmanagement.property.rma_isClosed.title=Oppf\u00f8ring +rma_recordsmanagement.property.rma_isClosed.decription=Oppf\u00f8ring + +rma_recordsmanagement.type.rma_recordCategory.title=Oppf\u00f8ringskategori +rma_recordsmanagement.type.rma_recordCategory.decription=Oppf\u00f8ringskategori + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=Ikke-elektronisk dokument +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Ikke-elektronisk dokument +rma_recordsmanagement.property.rma_physicalSize.title=Fysisk st\u00f8rrelse +rma_recordsmanagement.property.rma_physicalSize.decription=St\u00f8rrelsen p\u00e5 dokumentet m\u00e5lt i line\u00e6re meter. +rma_recordsmanagement.property.rma_numberOfCopies.title=Antall kopier +rma_recordsmanagement.property.rma_numberOfCopies.description=Antall kopier av dokumentet. +rma_recordsmanagement.property.rma_storageLocation.title=Lagringssted +rma_recordsmanagement.property.rma_storageLocation.decription=Det fysiske lagringsstedet til oppf\u00f8ringen. +rma_recordsmanagement.property.rma_shelf.title=Hylle +rma_recordsmanagement.property.rma_shelf.decription=Hyllen som oppf\u00f8ringen oppbevares p\u00e5. +rma_recordsmanagement.property.rma_box.title=Eske +rma_recordsmanagement.property.rma_box.description=Esken som oppf\u00f8ringen oppbevares i. +rma_recordsmanagement.property.rma_file.title=Fil +rma_recordsmanagement.property.rma_file.decription=Filen som oppf\u00f8ringen oppbevares i. + +rma_recordsmanagement.type.rma_dispositionAction.title=Retensjonshandling +rma_recordsmanagement.type.rma_dispositionAction.decription=Retensjonshandling +rma_recordsmanagement.property.rma_dispositionActionId.title=Retensjonshandling-ID +rma_recordsmanagement.property.rma_dispositionActionId.decription=Retensjonshandling-ID +rma_recordsmanagement.property.rma_dispositionAction.title=Retensjonshandling +rma_recordsmanagement.property.rma_dispositionAction.decription=Retensjonshandling +rma_recordsmanagement.property.rma_dispositionAsOf.title=Retensjonshandling +rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retensjonshandling +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Kvalifiserte retensjonshendelser +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Kvalifiserte retensjonshendelser +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retensjonshandling som starter p\u00e5 +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retensjonshandling som starter p\u00e5 +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retensjonshandling som startes av +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retensjonshandling som startes av +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retensjonshandling som fullf\u00f8res p\u00e5 +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retensjonshandling som fullf\u00f8res p\u00e5 +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retensjonshandling som fullf\u00f8res av +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retensjonshandling som fullf\u00f8res av +rma_recordsmanagement.association.rma_eventExecutions.title=Utf\u00f8rte hendelser +rma_recordsmanagement.association.rma_eventExecutions.decription=Utf\u00f8rte hendelser + +rma_recordsmanagement.type.rma_eventExecution.title=Utf\u00f8relse av hendelse +rma_recordsmanagement.type.rma_eventExecution.decription=Utf\u00f8relse av hendelse +rma_recordsmanagement.property.rma_eventExecutionName.title=Hendelsenavn +rma_recordsmanagement.property.rma_eventExecutionName.decription=Hendelsenavn +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Automatisk hendelse +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Automatisk hendelse +rma_recordsmanagement.property.rma_eventExecutionComplete.title=Fullf\u00f8rt hendelse +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Fullf\u00f8rt hendelse +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Hendelse fullf\u00f8rt av +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Hendelse fullf\u00f8rt av +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Hendelse fullf\u00f8rt den +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Hendelse fullf\u00f8rt den + +rma_recordsmanagement.type.rma_hold.title=Hold +rma_recordsmanagement.type.rma_hold.decription=Hold +rma_recordsmanagement.property.rma_holdReason.title=Grunn til holdet +rma_recordsmanagement.property.rma_holdReason.decription=Grunn til holdet +rma_recordsmanagement.association.rma_frozenRecords.title=Oppf\u00f8ringer p\u00e5 hold +rma_recordsmanagement.association.rma_frozenRecords.decription=Oppf\u00f8ringer p\u00e5 hold + +rma_recordsmanagement.type.rma_transfer.title=Overf\u00f8r +rma_recordsmanagement.type.rma_transfer.decription=Overf\u00f8r +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Overf\u00f8r tilgangsindikator +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Overf\u00f8r tilgangsindikator +rma_recordsmanagement.property.rma_transferPDFIndicator.title=Overf\u00f8r PDF-indikator +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Overf\u00f8r PDF-indikator +rma_recordsmanagement.property.rma_transferLocation.title=Overf\u00f8r PDF +rma_recordsmanagement.property.rma_transferLocation.decription=Overf\u00f8r PDF +rma_recordsmanagement.association.rma_transferred.title=Overf\u00f8rt +rma_recordsmanagement.association.rma_transferred.decription=Overf\u00f8rt + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=Filplandel +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Filplandel +rma_recordsmanagement.property.rma_rootNodeRef.title=Rotnode +rma_recordsmanagement.property.rma_rootNodeRef.decription=Rotnode + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Filplan +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Filplan +rma_recordsmanagement.association.rma_holds.title=Hold +rma_recordsmanagement.association.rma_holds.decription=Hold +rma_recordsmanagement.association.rma_transfers.title=Overf\u00f8ringer +rma_recordsmanagement.association.rma_transfers.decription=Overf\u00f8ringer + +rma_recordsmanagement.aspect.rma_declaredRecord.title=Fullf\u00f8rt oppf\u00f8ring +rma_recordsmanagement.aspect.rma_declaredRecord.decription=Fullf\u00f8rt oppf\u00f8ring +rma_recordsmanagement.property.rma_declaredAt.title=Dato fullf\u00f8rt +rma_recordsmanagement.property.rma_declaredAt.decription=Dato fullf\u00f8rt +rma_recordsmanagement.property.rma_declaredBy.title=Fullf\u00f8rt av +rma_recordsmanagement.property.rma_declaredBy.decription=Fullf\u00f8rt av + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Del-ID til oppf\u00f8ring +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Del-ID til oppf\u00f8ring +rma_recordsmanagement.property.rma_identifier.title=Oppf\u00f8rings-ID +rma_recordsmanagement.property.rma_identifier.decription=Unik oppf\u00f8rings-ID +rma_recordsmanagement.property.rma_dbUniquenessId.title=Unikt ved database +rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unikt ved database + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Sv\u00e6rt viktig oppf\u00f8ringsdefinisjon +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Sv\u00e6rt viktig oppf\u00f8ringsdefinisjon + +rma_recordsmanagement.property.rma_reviewPeriod.title=Gjennomgangsperiode +rma_recordsmanagement.property.rma_reviewPeriod.decription=Gjennomgangsperiode +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Sv\u00e6rt viktig oppf\u00f8ringsindikator +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Sv\u00e6rt viktig oppf\u00f8ringsindikator + +rma_recordsmanagement.aspect.rma_record.title=Oppf\u00f8ring +rma_recordsmanagement.aspect.rma_record.decription=Oppf\u00f8ring +rma_recordsmanagement.property.rma_dateFiled.title=Dato registrert +rma_recordsmanagement.property.rma_dateFiled.decription=Dato registrert +rma_recordsmanagement.property.rma_origionalName=Opprinnelig navn + +rma_recordsmanagement.aspect.rma_recordMetaData.title=Oppf\u00f8ringsmetadata +rma_recordsmanagement.aspect.rma_recordMetaData.description=Mark\u00f8raspekt for oppf\u00f8ringsmetadata + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Felles oppf\u00f8ringsinformasjon +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Felles metadata for alle oppf\u00f8ringstyper +rma_recordsmanagement.property.rma_location.title=Sted +rma_recordsmanagement.property.rma_location.decription=Sted + +rma_recordsmanagement.aspect.rma_vitalRecord.title=Sv\u00e6rt viktig oppf\u00f8ring +rma_recordsmanagement.aspect.rma_vitalRecord.decription=Sv\u00e6rt viktig oppf\u00f8ring +rma_recordsmanagement.property.rma_reviewAsOf.title=Neste gjennomgang +rma_recordsmanagement.property.rma_reviewAsOf.decription=Neste gjennomgang +rma_recordsmanagement.property.rma_notificationIssued.title=Indikerer at en melding om at denne oppf\u00f8ringen skal gjennomg\u00e5s, er blitt utstedt +rma_recordsmanagement.property.rma_notificationIssued.decription=Indikerer at en melding om at denne oppf\u00f8ringen skal gjennomg\u00e5s, er blitt utstedt + +rma_recordsmanagement.aspect.rma_scheduled.title=Planlagt +rma_recordsmanagement.aspect.rma_scheduled.decription=Planlagt +rma_recordsmanagement.association.rma_dispositionSchedule.title=Retensjonsplan +rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retensjonsplan + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Livssyklus ved retensjon +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Livssyklus ved retensjon +rma_recordsmanagement.association.rma_nextDispositionAction.title=Neste retensjonshandling +rma_recordsmanagement.association.rma_nextDispositionAction.decription=Neste retensjonshandling +rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historikk ved retensjonshandling +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historikk ved retensjonshandling + +rma_recordsmanagement.aspect.rma_cutOff.title=Cut off +rma_recordsmanagement.aspect.rma_cutOff.decription=Cut off +rma_recordsmanagement.property.rma_cutOffDate.title=Cut off-dato +rma_recordsmanagement.property.rma_cutOffDate.decription=Cut off-dato + +rma_recordsmanagement.aspect.rma_transferred.title=Overf\u00f8rt +rma_recordsmanagement.aspect.rma_transferred.decription=Overf\u00f8rt + +rma_recordsmanagement.aspect.rma_ascended.title=Stigende +rma_recordsmanagement.aspect.rma_ascended.decription=Stigende + +rma_recordsmanagement.aspect.rma_frozen.title=P\u00e5 hold +rma_recordsmanagement.aspect.rma_frozen.decription=P\u00e5 hold +rma_recordsmanagement.property.rma_frozenAt.title=Holdes ved +rma_recordsmanagement.property.rma_frozenAt.decription=Holdes ved +rma_recordsmanagement.property.rma_frozenBy.title=Holdes av +rma_recordsmanagement.property.rma_frozenBy.decription=Holdes av + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Varselskonfigurasjonsrot +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Varselskonfigurasjonsrot +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Varselskonfigurasjon +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Varselskonfigurasjon + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Roten ved e-postkonfigurasjon +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Roten ved e-postkonfigurasjon +rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-postkonfigurasjon +rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-postkonfigurasjon + +rma_recordsmanagement.aspect.rma_recordSearch.title=Oppf\u00f8ringss\u00f8k +rma_recordsmanagement.aspect.rma_recordSearch.decription=Informasjon som st\u00f8tter s\u00f8k i oppf\u00f8ringsh\u00e5ndtering +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Har retensjonsplan +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indikerer om elementet er forbundet med retensjonsplanen +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Navn p\u00e5 retensjonshandling +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Navnet p\u00e5 neste retensjonshandling +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retensjonshandling av +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=Datoen n\u00e5r neste retensjonshandling blir kvalifisert +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retensjonsperiode +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retensjonsperiode +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Uttrykk ved retensjonsperiode +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Uttrykk ved retensjonsperiode +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Kvalifiserte retensjonshendelser +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Kvalifiserte retensjonshendelser +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retensjonshendelser +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retensjonshendelser +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retensjonsrett +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retensjonsrett +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retensjonsinstruksjoner +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retensjonsinstruksjoner +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Grunn til holdet +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Grunn til holdet +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Gjennomgangsperiode til den sv\u00e6rt viktige oppf\u00f8ringen +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Gjennomgangsperiode til den sv\u00e6rt viktige oppf\u00f8ringen +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Uttrykk av gjennomgangsperioden +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Uttrykk av gjennomgangsperioden + +rma_recordsmanagement.aspect.rma_versionedRecord.title=Oppf\u00f8ring med versjon +rma_recordsmanagement.aspect.rma_versionedRecord.decription=Oppf\u00f8ring med versjon + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Upublisert oppdatering +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Upublisert oppdatering +rma_recordsmanagement.property.rma_unpublishedUpdate.title=Upublisert oppdatering +rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indikerer om det finnes en upublisert oppdatering +rma_recordsmanagement.property.rma_updateTo.title=Oppdater til +rma_recordsmanagement.property.rma_updateTo.description=M\u00e5let til oppdateringen +rma_recordsmanagement.property.rma_updatedProperties.title=Oppdaterte egenskaper +rma_recordsmanagement.property.rma_updatedProperties.description=De oppdaterte egenskapene +rma_recordsmanagement.property.rma_publishInProgress.title=Publisering p\u00e5g\u00e5r +rma_recordsmanagement.property.rma_publishInProgress.description=Indikerer om en publisering p\u00e5g\u00e5r for tiden + +rma_recordsmanagement.aspect.dod_ghosted.title=Oppf\u00f8ring kun med metadata +rma_recordsmanagement.aspect.dod_ghosted.description=Oppf\u00f8ring kun med metadata + +listconstraint.rmc_tlList.title=Overf\u00f8ringssteder listconstraint.rmc_smList.title=Tilleggsmarkeringer \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nl.properties index 9758923a65..14f033afe4 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nl.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=Contentmodel Records Management - -rma_recordsmanagement.type.rma_rmsite.title=Site Records Management -rma_recordsmanagement.type.rma_rmsite.description=Gespecialiseerde site voor Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Configuratie beveiligingsfuncties -rma_recordsmanagement.type.rma_caveatConfig.decription=Configuratie beveiligingsfuncties - -rma_recordsmanagement.type.rma_emailConfig.title=E-mailconfiguratie -rma_recordsmanagement.type.rma_emailConfig.decription=E-mailconfiguratie - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Container Records Management -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Container Records Management - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Oorsprongcontainer Records Management -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Oorsprongcontainer Records Management - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Retentieschema -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retentieschema - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Retentieautoriteit -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retentieautoriteit - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Retentie-instructies -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retentie-instructies - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Retentie op recordniveau -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Retentie op recordniveau - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retentieacties -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retentieacties - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definitie retentieactie -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definitie retentieactie -rma_recordsmanagement.property.rma_dispositionActionName.title=Naam retentieactie -rma_recordsmanagement.property.rma_dispositionActionName.decription=Naam retentieactie -rma_recordsmanagement.property.rma_dispositionDescription.title=Retentiebeschrijving -rma_recordsmanagement.property.rma_dispositionDescription.decription=Retentiebeschrijving -rma_recordsmanagement.property.rma_dispositionLocation.title=Retentielocatie -rma_recordsmanagement.property.rma_dispositionLocation.decription=Retentielocatie -rma_recordsmanagement.property.rma_dispositionPeriod.title=Retentieperiode -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retentieperiode -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Eigenschap retentieperiode -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Eigenschap retentieperiode -rma_recordsmanagement.property.rma_dispositionEvent.title=Retentiegebeurtenis -rma_recordsmanagement.property.rma_dispositionEvent.decription=Retentiegebeurtenis -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinatie retentiegebeurtenis -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinatie retentiegebeurtenis - -rma_recordsmanagement.type.rma_recordFolder.title=Archiefmap -rma_recordsmanagement.type.rma_recordFolder.decription=Archiefmap -rma_recordsmanagement.property.rma_isClosed.title=Record -rma_recordsmanagement.property.rma_isClosed.decription=Record - -rma_recordsmanagement.type.rma_recordCategory.title=Recordcategorie -rma_recordsmanagement.type.rma_recordCategory.decription=Recordcategorie - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Niet-elektronisch document -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Niet-elektronisch document -rma_recordsmanagement.property.rma_physicalSize.title=Fysieke grootte -rma_recordsmanagement.property.rma_physicalSize.decription=De grootte van het document gemeten in lineaire meters. -rma_recordsmanagement.property.rma_numberOfCopies.title=Aantal exemplaren -rma_recordsmanagement.property.rma_numberOfCopies.description=Het aantal exemplaren van het document. -rma_recordsmanagement.property.rma_storageLocation.title=Opslaglocatie -rma_recordsmanagement.property.rma_storageLocation.decription=De fysieke opslaglocatie van de record. -rma_recordsmanagement.property.rma_shelf.title=Plank -rma_recordsmanagement.property.rma_shelf.decription=De plank waarop de record wordt bewaard. -rma_recordsmanagement.property.rma_box.title=Doos -rma_recordsmanagement.property.rma_box.description=De doos waarin de record wordt bewaard. -rma_recordsmanagement.property.rma_file.title=Archiveren -rma_recordsmanagement.property.rma_file.decription=Het archief waarin de record wordt bewaard. - -rma_recordsmanagement.type.rma_dispositionAction.title=Retentieactie -rma_recordsmanagement.type.rma_dispositionAction.decription=Retentieactie -rma_recordsmanagement.property.rma_dispositionActionId.title=Id retentieactie -rma_recordsmanagement.property.rma_dispositionActionId.decription=Id retentieactie -rma_recordsmanagement.property.rma_dispositionAction.title=Retentieactie -rma_recordsmanagement.property.rma_dispositionAction.decription=Retentieactie -rma_recordsmanagement.property.rma_dispositionAsOf.title=Retentieactie -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retentieactie -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=In aanmerking komende retentiegebeurtenissen -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=In aanmerking komende retentiegebeurtenissen -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retentieactie gestart op -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retentieactie gestart op -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retentieactie gestart door -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retentieactie gestart door -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retentieactie afgerond op -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retentieactie afgerond op -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retentieactie afgerond door -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retentieactie afgerond door -rma_recordsmanagement.association.rma_eventExecutions.title=Gebeurtenisuitvoeringen -rma_recordsmanagement.association.rma_eventExecutions.decription=Gebeurtenisuitvoeringen - -rma_recordsmanagement.type.rma_eventExecution.title=Gebeurtenisuitvoering -rma_recordsmanagement.type.rma_eventExecution.decription=Gebeurtenisuitvoering -rma_recordsmanagement.property.rma_eventExecutionName.title=Gebeurtenisnaam -rma_recordsmanagement.property.rma_eventExecutionName.decription=Gebeurtenisnaam -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Gebeurtenis automatisch -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Gebeurtenis automatisch -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Gebeurtenis afgerond -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Gebeurtenis afgerond -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Gebeurtenis afgerond door -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Gebeurtenis afgerond door -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Gebeurtenis afgerond op -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Gebeurtenis afgerond op - -rma_recordsmanagement.type.rma_hold.title=Wachtstand -rma_recordsmanagement.type.rma_hold.decription=Wachtstand -rma_recordsmanagement.property.rma_holdReason.title=Reden van wachtstand -rma_recordsmanagement.property.rma_holdReason.decription=Reden van wachtstand -rma_recordsmanagement.association.rma_frozenRecords.title=Records in wachtstand -rma_recordsmanagement.association.rma_frozenRecords.decription=Records in wachtstand - -rma_recordsmanagement.type.rma_transfer.title=Overzetten -rma_recordsmanagement.type.rma_transfer.decription=Overzetten -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicator voor overzettingsoverdracht -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicator voor overzettingsoverdracht -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicator PDF overzetten -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicator PDF overzetten -rma_recordsmanagement.property.rma_transferLocation.title=PDF overzetten -rma_recordsmanagement.property.rma_transferLocation.decription=PDF overzetten -rma_recordsmanagement.association.rma_transferred.title=Overgezet -rma_recordsmanagement.association.rma_transferred.decription=Overgezet - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Onderdeel ordeningsplan -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Onderdeel ordeningsplan -rma_recordsmanagement.property.rma_rootNodeRef.title=Oorsprongnode -rma_recordsmanagement.property.rma_rootNodeRef.decription=Oorsprongnode - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Oorsprong Records Management -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Oorsprong Records Management -rma_recordsmanagement.association.rma_holds.title=Wachtstanden -rma_recordsmanagement.association.rma_holds.decription=Wachtstanden -rma_recordsmanagement.association.rma_transfers.title=Overzettingen -rma_recordsmanagement.association.rma_transfers.decription=Overzettingen - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Afgeronde record -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Afgeronde record -rma_recordsmanagement.property.rma_declaredAt.title=Datum afgerond -rma_recordsmanagement.property.rma_declaredAt.decription=Datum afgerond -rma_recordsmanagement.property.rma_declaredBy.title=Afgerond door -rma_recordsmanagement.property.rma_declaredBy.decription=Afgerond door - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificatie recordonderdeel -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificatie recordonderdeel -rma_recordsmanagement.property.rma_identifier.title=Record-id -rma_recordsmanagement.property.rma_identifier.decription=Unieke identificatie record -rma_recordsmanagement.property.rma_dbUniquenessId.title=Uniekheid database -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Uniekheid database - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definitie vitale record -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definitie vitale record - -rma_recordsmanagement.property.rma_reviewPeriod.title=Revisieperiode -rma_recordsmanagement.property.rma_reviewPeriod.decription=Revisieperiode -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicator vitale record -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicator vitale record - -rma_recordsmanagement.aspect.rma_record.title=Record -rma_recordsmanagement.aspect.rma_record.decription=Record -rma_recordsmanagement.property.rma_dateFiled.title=Datum gearchiveerd -rma_recordsmanagement.property.rma_dateFiled.decription=Datum gearchiveerd -rma_recordsmanagement.property.rma_origionalName=Oorspronkelijke naam - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Metagegevens van record -rma_recordsmanagement.aspect.rma_recordMetaData.description=Markeraspect voor metagegevens van record - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Algemene recordgegevens -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Algemene metagegevens voor alle recordtypes -rma_recordsmanagement.property.rma_location.title=Locatie -rma_recordsmanagement.property.rma_location.decription=Locatie - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Vitale record -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Vitale record -rma_recordsmanagement.property.rma_reviewAsOf.title=Volgende revisie -rma_recordsmanagement.property.rma_reviewAsOf.decription=Volgende revisie -rma_recordsmanagement.property.rma_notificationIssued.title=Geeft aan dat er een revisie-gereedmelding is afgegeven voor deze record -rma_recordsmanagement.property.rma_notificationIssued.decription=Geeft aan dat er een revisie-gereedmelding is afgegeven voor deze record - -rma_recordsmanagement.aspect.rma_scheduled.title=Gepland -rma_recordsmanagement.aspect.rma_scheduled.decription=Gepland -rma_recordsmanagement.association.rma_dispositionSchedule.title=Retentieschema -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retentieschema - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Retentiecyclus -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Retentiecyclus -rma_recordsmanagement.association.rma_nextDispositionAction.title=Volgende retentieactie -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Volgende retentieactie -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Geschiedenis retentieactie -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Geschiedenis retentieactie - -rma_recordsmanagement.aspect.rma_cutOff.title=Afsluiten -rma_recordsmanagement.aspect.rma_cutOff.decription=Afsluiten -rma_recordsmanagement.property.rma_cutOffDate.title=Datum voor afsluiten -rma_recordsmanagement.property.rma_cutOffDate.decription=Datum voor afsluiten - -rma_recordsmanagement.aspect.rma_transferred.title=Overgezet -rma_recordsmanagement.aspect.rma_transferred.decription=Overgezet - -rma_recordsmanagement.aspect.rma_ascended.title=Opgelopen -rma_recordsmanagement.aspect.rma_ascended.decription=Opgelopen - -rma_recordsmanagement.aspect.rma_frozen.title=In wachtstand -rma_recordsmanagement.aspect.rma_frozen.decription=In wachtstand -rma_recordsmanagement.property.rma_frozenAt.title=In wachtstand in -rma_recordsmanagement.property.rma_frozenAt.decription=In wachtstand in -rma_recordsmanagement.property.rma_frozenBy.title=In wachtstand door -rma_recordsmanagement.property.rma_frozenBy.decription=In wachtstand door - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Oorsprong Caveat-configuratie -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Oorsprong Caveat-configuratie -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat-configuratie -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat-configuratie - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Oorsprong e-mailconfiguratie -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Oorsprong e-mailconfiguratie -rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-mailconfiguratie -rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-mailconfiguratie - -rma_recordsmanagement.aspect.rma_recordSearch.title=Record zoeken -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informatie ter ondersteuning van Records Management-zoekopdracht -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Heeft retentieschema -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Geeft aan of er een retentieschema aan het onderdeel is gekoppeld -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Naam retentieactie -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=De naam van de volgende retentieactie -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retentieactie van -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=De datum waarop de volgende retentieactie in aanmerking komt -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retentieperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retentieperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Uitdrukking retentieperiode -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Uitdrukking retentieperiode -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=In aanmerking komende retentiegebeurtenissen -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=In aanmerking komende retentiegebeurtenissen -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retentiegebeurtenissen -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retentiegebeurtenissen -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retentieautoriteit -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retentieautoriteit -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retentie-instructies -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retentie-instructies -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Reden van wachtstand -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Reden van wachtstand -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Revisieperiode vitale record -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Revisieperiode vitale record -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Uitdrukking van revisieperiode -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Uitdrukking van revisieperiode - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Record met versiebeheer -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Record met versiebeheer - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Ongepubliceerde update -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Ongepubliceerde update -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Ongepubliceerde update -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Geeft aan of er een ongepubliceerde update is -rma_recordsmanagement.property.rma_updateTo.title=Bijwerken naar -rma_recordsmanagement.property.rma_updateTo.description=Bestemming van de update -rma_recordsmanagement.property.rma_updatedProperties.title=Bijgewerkte eigenschappen -rma_recordsmanagement.property.rma_updatedProperties.description=De bijgewerkte eigenschappen -rma_recordsmanagement.property.rma_publishInProgress.title=Publicatie bezig -rma_recordsmanagement.property.rma_publishInProgress.description=Geeft aan of er momenteel een publicatie wordt uitgevoerd - -rma_recordsmanagement.aspect.dod_ghosted.title=Record met alleen metagegevens -rma_recordsmanagement.aspect.dod_ghosted.description=Record met alleen metagegevens - -listconstraint.rmc_tlList.title=Overzetlocaties +rma_recordsmanagement.description=Contentmodel Records Management + +rma_recordsmanagement.type.rma_rmsite.title=Site Records Management +rma_recordsmanagement.type.rma_rmsite.description=Gespecialiseerde site voor Records Management + +rma_recordsmanagement.type.rma_caveatConfig.title=Configuratie beveiligingsfuncties +rma_recordsmanagement.type.rma_caveatConfig.decription=Configuratie beveiligingsfuncties + +rma_recordsmanagement.type.rma_emailConfig.title=E-mailconfiguratie +rma_recordsmanagement.type.rma_emailConfig.decription=E-mailconfiguratie + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=Container Records Management +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Container Records Management + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Oorsprongcontainer Records Management +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Oorsprongcontainer Records Management + +rma_recordsmanagement.type.rma_dispositionSchedule.title=Retentieschema +rma_recordsmanagement.type.rma_dispositionSchedule.decription=Retentieschema + +rma_recordsmanagement.property.rma_dispositionAuthority.title=Retentieautoriteit +rma_recordsmanagement.property.rma_dispositionAuthority.decription=Retentieautoriteit + +rma_recordsmanagement.property.rma_dispositionInstructions.title=Retentie-instructies +rma_recordsmanagement.property.rma_dispositionInstructions.decription=Retentie-instructies + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=Retentie op recordniveau +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Retentie op recordniveau + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Retentieacties +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Retentieacties + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definitie retentieactie +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definitie retentieactie +rma_recordsmanagement.property.rma_dispositionActionName.title=Naam retentieactie +rma_recordsmanagement.property.rma_dispositionActionName.decription=Naam retentieactie +rma_recordsmanagement.property.rma_dispositionDescription.title=Retentiebeschrijving +rma_recordsmanagement.property.rma_dispositionDescription.decription=Retentiebeschrijving +rma_recordsmanagement.property.rma_dispositionLocation.title=Retentielocatie +rma_recordsmanagement.property.rma_dispositionLocation.decription=Retentielocatie +rma_recordsmanagement.property.rma_dispositionPeriod.title=Retentieperiode +rma_recordsmanagement.property.rma_dispositionPeriod.decription=Retentieperiode +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Eigenschap retentieperiode +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Eigenschap retentieperiode +rma_recordsmanagement.property.rma_dispositionEvent.title=Retentiegebeurtenis +rma_recordsmanagement.property.rma_dispositionEvent.decription=Retentiegebeurtenis +rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combinatie retentiegebeurtenis +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combinatie retentiegebeurtenis + +rma_recordsmanagement.type.rma_recordFolder.title=Archiefmap +rma_recordsmanagement.type.rma_recordFolder.decription=Archiefmap +rma_recordsmanagement.property.rma_isClosed.title=Record +rma_recordsmanagement.property.rma_isClosed.decription=Record + +rma_recordsmanagement.type.rma_recordCategory.title=Recordcategorie +rma_recordsmanagement.type.rma_recordCategory.decription=Recordcategorie + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=Niet-elektronisch document +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Niet-elektronisch document +rma_recordsmanagement.property.rma_physicalSize.title=Fysieke grootte +rma_recordsmanagement.property.rma_physicalSize.decription=De grootte van het document gemeten in lineaire meters. +rma_recordsmanagement.property.rma_numberOfCopies.title=Aantal exemplaren +rma_recordsmanagement.property.rma_numberOfCopies.description=Het aantal exemplaren van het document. +rma_recordsmanagement.property.rma_storageLocation.title=Opslaglocatie +rma_recordsmanagement.property.rma_storageLocation.decription=De fysieke opslaglocatie van de record. +rma_recordsmanagement.property.rma_shelf.title=Plank +rma_recordsmanagement.property.rma_shelf.decription=De plank waarop de record wordt bewaard. +rma_recordsmanagement.property.rma_box.title=Doos +rma_recordsmanagement.property.rma_box.description=De doos waarin de record wordt bewaard. +rma_recordsmanagement.property.rma_file.title=Archiveren +rma_recordsmanagement.property.rma_file.decription=Het archief waarin de record wordt bewaard. + +rma_recordsmanagement.type.rma_dispositionAction.title=Retentieactie +rma_recordsmanagement.type.rma_dispositionAction.decription=Retentieactie +rma_recordsmanagement.property.rma_dispositionActionId.title=Id retentieactie +rma_recordsmanagement.property.rma_dispositionActionId.decription=Id retentieactie +rma_recordsmanagement.property.rma_dispositionAction.title=Retentieactie +rma_recordsmanagement.property.rma_dispositionAction.decription=Retentieactie +rma_recordsmanagement.property.rma_dispositionAsOf.title=Retentieactie +rma_recordsmanagement.property.rma_dispositionAsOf.decription=Retentieactie +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=In aanmerking komende retentiegebeurtenissen +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=In aanmerking komende retentiegebeurtenissen +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Retentieactie gestart op +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Retentieactie gestart op +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Retentieactie gestart door +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Retentieactie gestart door +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Retentieactie afgerond op +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Retentieactie afgerond op +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Retentieactie afgerond door +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Retentieactie afgerond door +rma_recordsmanagement.association.rma_eventExecutions.title=Gebeurtenisuitvoeringen +rma_recordsmanagement.association.rma_eventExecutions.decription=Gebeurtenisuitvoeringen + +rma_recordsmanagement.type.rma_eventExecution.title=Gebeurtenisuitvoering +rma_recordsmanagement.type.rma_eventExecution.decription=Gebeurtenisuitvoering +rma_recordsmanagement.property.rma_eventExecutionName.title=Gebeurtenisnaam +rma_recordsmanagement.property.rma_eventExecutionName.decription=Gebeurtenisnaam +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Gebeurtenis automatisch +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Gebeurtenis automatisch +rma_recordsmanagement.property.rma_eventExecutionComplete.title=Gebeurtenis afgerond +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Gebeurtenis afgerond +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Gebeurtenis afgerond door +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Gebeurtenis afgerond door +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Gebeurtenis afgerond op +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Gebeurtenis afgerond op + +rma_recordsmanagement.type.rma_hold.title=Wachtstand +rma_recordsmanagement.type.rma_hold.decription=Wachtstand +rma_recordsmanagement.property.rma_holdReason.title=Reden van wachtstand +rma_recordsmanagement.property.rma_holdReason.decription=Reden van wachtstand +rma_recordsmanagement.association.rma_frozenRecords.title=Records in wachtstand +rma_recordsmanagement.association.rma_frozenRecords.decription=Records in wachtstand + +rma_recordsmanagement.type.rma_transfer.title=Overzetten +rma_recordsmanagement.type.rma_transfer.decription=Overzetten +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Indicator voor overzettingsoverdracht +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Indicator voor overzettingsoverdracht +rma_recordsmanagement.property.rma_transferPDFIndicator.title=Indicator PDF overzetten +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Indicator PDF overzetten +rma_recordsmanagement.property.rma_transferLocation.title=PDF overzetten +rma_recordsmanagement.property.rma_transferLocation.decription=PDF overzetten +rma_recordsmanagement.association.rma_transferred.title=Overgezet +rma_recordsmanagement.association.rma_transferred.decription=Overgezet + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=Onderdeel ordeningsplan +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Onderdeel ordeningsplan +rma_recordsmanagement.property.rma_rootNodeRef.title=Oorsprongnode +rma_recordsmanagement.property.rma_rootNodeRef.decription=Oorsprongnode + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Oorsprong Records Management +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Oorsprong Records Management +rma_recordsmanagement.association.rma_holds.title=Wachtstanden +rma_recordsmanagement.association.rma_holds.decription=Wachtstanden +rma_recordsmanagement.association.rma_transfers.title=Overzettingen +rma_recordsmanagement.association.rma_transfers.decription=Overzettingen + +rma_recordsmanagement.aspect.rma_declaredRecord.title=Afgeronde record +rma_recordsmanagement.aspect.rma_declaredRecord.decription=Afgeronde record +rma_recordsmanagement.property.rma_declaredAt.title=Datum afgerond +rma_recordsmanagement.property.rma_declaredAt.decription=Datum afgerond +rma_recordsmanagement.property.rma_declaredBy.title=Afgerond door +rma_recordsmanagement.property.rma_declaredBy.decription=Afgerond door + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificatie recordonderdeel +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificatie recordonderdeel +rma_recordsmanagement.property.rma_identifier.title=Record-id +rma_recordsmanagement.property.rma_identifier.decription=Unieke identificatie record +rma_recordsmanagement.property.rma_dbUniquenessId.title=Uniekheid database +rma_recordsmanagement.property.rma_dbUniquenessId.decription=Uniekheid database + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Definitie vitale record +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Definitie vitale record + +rma_recordsmanagement.property.rma_reviewPeriod.title=Revisieperiode +rma_recordsmanagement.property.rma_reviewPeriod.decription=Revisieperiode +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicator vitale record +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicator vitale record + +rma_recordsmanagement.aspect.rma_record.title=Record +rma_recordsmanagement.aspect.rma_record.decription=Record +rma_recordsmanagement.property.rma_dateFiled.title=Datum gearchiveerd +rma_recordsmanagement.property.rma_dateFiled.decription=Datum gearchiveerd +rma_recordsmanagement.property.rma_origionalName=Oorspronkelijke naam + +rma_recordsmanagement.aspect.rma_recordMetaData.title=Metagegevens van record +rma_recordsmanagement.aspect.rma_recordMetaData.description=Markeraspect voor metagegevens van record + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Algemene recordgegevens +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Algemene metagegevens voor alle recordtypes +rma_recordsmanagement.property.rma_location.title=Locatie +rma_recordsmanagement.property.rma_location.decription=Locatie + +rma_recordsmanagement.aspect.rma_vitalRecord.title=Vitale record +rma_recordsmanagement.aspect.rma_vitalRecord.decription=Vitale record +rma_recordsmanagement.property.rma_reviewAsOf.title=Volgende revisie +rma_recordsmanagement.property.rma_reviewAsOf.decription=Volgende revisie +rma_recordsmanagement.property.rma_notificationIssued.title=Geeft aan dat er een revisie-gereedmelding is afgegeven voor deze record +rma_recordsmanagement.property.rma_notificationIssued.decription=Geeft aan dat er een revisie-gereedmelding is afgegeven voor deze record + +rma_recordsmanagement.aspect.rma_scheduled.title=Gepland +rma_recordsmanagement.aspect.rma_scheduled.decription=Gepland +rma_recordsmanagement.association.rma_dispositionSchedule.title=Retentieschema +rma_recordsmanagement.association.rma_dispositionSchedule.decription=Retentieschema + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Retentiecyclus +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Retentiecyclus +rma_recordsmanagement.association.rma_nextDispositionAction.title=Volgende retentieactie +rma_recordsmanagement.association.rma_nextDispositionAction.decription=Volgende retentieactie +rma_recordsmanagement.association.rma_dispositionActionHistory.title=Geschiedenis retentieactie +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Geschiedenis retentieactie + +rma_recordsmanagement.aspect.rma_cutOff.title=Afsluiten +rma_recordsmanagement.aspect.rma_cutOff.decription=Afsluiten +rma_recordsmanagement.property.rma_cutOffDate.title=Datum voor afsluiten +rma_recordsmanagement.property.rma_cutOffDate.decription=Datum voor afsluiten + +rma_recordsmanagement.aspect.rma_transferred.title=Overgezet +rma_recordsmanagement.aspect.rma_transferred.decription=Overgezet + +rma_recordsmanagement.aspect.rma_ascended.title=Opgelopen +rma_recordsmanagement.aspect.rma_ascended.decription=Opgelopen + +rma_recordsmanagement.aspect.rma_frozen.title=In wachtstand +rma_recordsmanagement.aspect.rma_frozen.decription=In wachtstand +rma_recordsmanagement.property.rma_frozenAt.title=In wachtstand in +rma_recordsmanagement.property.rma_frozenAt.decription=In wachtstand in +rma_recordsmanagement.property.rma_frozenBy.title=In wachtstand door +rma_recordsmanagement.property.rma_frozenBy.decription=In wachtstand door + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Oorsprong Caveat-configuratie +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Oorsprong Caveat-configuratie +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Caveat-configuratie +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Caveat-configuratie + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Oorsprong e-mailconfiguratie +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Oorsprong e-mailconfiguratie +rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-mailconfiguratie +rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-mailconfiguratie + +rma_recordsmanagement.aspect.rma_recordSearch.title=Record zoeken +rma_recordsmanagement.aspect.rma_recordSearch.decription=Informatie ter ondersteuning van Records Management-zoekopdracht +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Heeft retentieschema +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Geeft aan of er een retentieschema aan het onderdeel is gekoppeld +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Naam retentieactie +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=De naam van de volgende retentieactie +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Retentieactie van +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=De datum waarop de volgende retentieactie in aanmerking komt +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Retentieperiode +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Retentieperiode +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Uitdrukking retentieperiode +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Uitdrukking retentieperiode +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=In aanmerking komende retentiegebeurtenissen +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=In aanmerking komende retentiegebeurtenissen +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Retentiegebeurtenissen +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Retentiegebeurtenissen +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Retentieautoriteit +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Retentieautoriteit +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Retentie-instructies +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Retentie-instructies +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Reden van wachtstand +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Reden van wachtstand +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Revisieperiode vitale record +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Revisieperiode vitale record +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Uitdrukking van revisieperiode +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Uitdrukking van revisieperiode + +rma_recordsmanagement.aspect.rma_versionedRecord.title=Record met versiebeheer +rma_recordsmanagement.aspect.rma_versionedRecord.decription=Record met versiebeheer + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Ongepubliceerde update +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Ongepubliceerde update +rma_recordsmanagement.property.rma_unpublishedUpdate.title=Ongepubliceerde update +rma_recordsmanagement.property.rma_unpublishedUpdate.description=Geeft aan of er een ongepubliceerde update is +rma_recordsmanagement.property.rma_updateTo.title=Bijwerken naar +rma_recordsmanagement.property.rma_updateTo.description=Bestemming van de update +rma_recordsmanagement.property.rma_updatedProperties.title=Bijgewerkte eigenschappen +rma_recordsmanagement.property.rma_updatedProperties.description=De bijgewerkte eigenschappen +rma_recordsmanagement.property.rma_publishInProgress.title=Publicatie bezig +rma_recordsmanagement.property.rma_publishInProgress.description=Geeft aan of er momenteel een publicatie wordt uitgevoerd + +rma_recordsmanagement.aspect.dod_ghosted.title=Record met alleen metagegevens +rma_recordsmanagement.aspect.dod_ghosted.description=Record met alleen metagegevens + +listconstraint.rmc_tlList.title=Overzetlocaties listconstraint.rmc_smList.title=Aanvullende markeringen \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_pt_BR.properties index c136cf2d15..3fa7d3f7d5 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_pt_BR.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=Modelo do conte\u00fado do Records Management - -rma_recordsmanagement.type.rma_rmsite.title=Site do Records Management -rma_recordsmanagement.type.rma_rmsite.description=Site especializado do Records Management - -rma_recordsmanagement.type.rma_caveatConfig.title=Configura\u00e7\u00e3o de controles de seguran\u00e7a -rma_recordsmanagement.type.rma_caveatConfig.decription=Configura\u00e7\u00e3o de controles de seguran\u00e7a - -rma_recordsmanagement.type.rma_emailConfig.title=Configura\u00e7\u00e3o de e-mail -rma_recordsmanagement.type.rma_emailConfig.decription=Configura\u00e7\u00e3o de e-mail - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Cont\u00eainer do Records Management -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Cont\u00eainer do Records Management - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Cont\u00eainer da raiz do Records Management -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Cont\u00eainer da raiz do Records Management - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Programa\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Programa\u00e7\u00e3o de reten\u00e7\u00e3o - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Autoridade de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autoridade de reten\u00e7\u00e3o - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Instru\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instru\u00e7\u00f5es de reten\u00e7\u00e3o - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Reten\u00e7\u00e3o de n\u00edvel de documento arquiv\u00edstico -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Reten\u00e7\u00e3o de n\u00edvel de documento arquiv\u00edstico - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=A\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=A\u00e7\u00f5es de reten\u00e7\u00e3o - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionActionName.title=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionActionName.decription=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionDescription.title=Descri\u00e7\u00e3o da reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionDescription.decription=Descri\u00e7\u00e3o da reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionLocation.title=Localiza\u00e7\u00e3o da reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionLocation.decription=Localiza\u00e7\u00e3o da reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionPeriod.title=Per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propriedade do per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propriedade do per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEvent.title=Evento de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combina\u00e7\u00e3o de eventos de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combina\u00e7\u00e3o de eventos de reten\u00e7\u00e3o - -rma_recordsmanagement.type.rma_recordFolder.title=Pasta de documento arquiv\u00edstico -rma_recordsmanagement.type.rma_recordFolder.decription=Pasta de documento arquiv\u00edstico -rma_recordsmanagement.property.rma_isClosed.title=Documento arquiv\u00edstico -rma_recordsmanagement.property.rma_isClosed.decription=Documento arquiv\u00edstico - -rma_recordsmanagement.type.rma_recordCategory.title=Categoria de documento arquiv\u00edstico -rma_recordsmanagement.type.rma_recordCategory.decription=Categoria de documento arquiv\u00edstico - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento n\u00e3o eletr\u00f4nico -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento n\u00e3o eletr\u00f4nico -rma_recordsmanagement.property.rma_physicalSize.title=Tamanho f\u00edsico -rma_recordsmanagement.property.rma_physicalSize.decription=O tamanho do documento medido em metros lineares. -rma_recordsmanagement.property.rma_numberOfCopies.title=N\u00famero de c\u00f3pias -rma_recordsmanagement.property.rma_numberOfCopies.description=O n\u00famero de c\u00f3pias do documento. -rma_recordsmanagement.property.rma_storageLocation.title=Local de armazenamento -rma_recordsmanagement.property.rma_storageLocation.decription=O local f\u00edsico de armazenamento do documento arquiv\u00edstico. -rma_recordsmanagement.property.rma_shelf.title=Prateleira -rma_recordsmanagement.property.rma_shelf.decription=A prateleira em que o documento arquiv\u00edstico est\u00e1 armazenado. -rma_recordsmanagement.property.rma_box.title=Caixa -rma_recordsmanagement.property.rma_box.description=A caixa em que o documento arquiv\u00edstico est\u00e1 armazenado. -rma_recordsmanagement.property.rma_file.title=Arquivo -rma_recordsmanagement.property.rma_file.decription=O arquivo em que o documento arquiv\u00edstico est\u00e1 armazenado. - -rma_recordsmanagement.type.rma_dispositionAction.title=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.type.rma_dispositionAction.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionActionId.title=ID da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAction.title=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAction.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAsOf.title=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionAsOf.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventos de reten\u00e7\u00e3o qualificados -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventos de reten\u00e7\u00e3o qualificados -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada em -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada em -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada por -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada por -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda em -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda em -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda por -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda por -rma_recordsmanagement.association.rma_eventExecutions.title=Execu\u00e7\u00f5es de eventos -rma_recordsmanagement.association.rma_eventExecutions.decription=Execu\u00e7\u00f5es de eventos - -rma_recordsmanagement.type.rma_eventExecution.title=Execu\u00e7\u00e3o do evento -rma_recordsmanagement.type.rma_eventExecution.decription=Execu\u00e7\u00e3o do evento -rma_recordsmanagement.property.rma_eventExecutionName.title=Nome do evento -rma_recordsmanagement.property.rma_eventExecutionName.decription=Nome do evento -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento autom\u00e1tico -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento autom\u00e1tico -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento conclu\u00eddo -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento conclu\u00eddo -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento conclu\u00eddo por -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento conclu\u00eddo por -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento conclu\u00eddo em -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento conclu\u00eddo em - -rma_recordsmanagement.type.rma_hold.title=Manter -rma_recordsmanagement.type.rma_hold.decription=Manter -rma_recordsmanagement.property.rma_holdReason.title=Motivo para manter -rma_recordsmanagement.property.rma_holdReason.decription=Motivo para manter -rma_recordsmanagement.association.rma_frozenRecords.title=Documentos arquiv\u00edsticos mantidos -rma_recordsmanagement.association.rma_frozenRecords.decription=Documentos arquiv\u00edsticos mantidos - -rma_recordsmanagement.type.rma_transfer.title=Transferir -rma_recordsmanagement.type.rma_transfer.decription=Transferir -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transferir indicador de ades\u00e3o -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transferir indicador de ades\u00e3o -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transferir indicador do PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transferir indicador do PDF -rma_recordsmanagement.property.rma_transferLocation.title=Transferir PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Transferir PDF -rma_recordsmanagement.association.rma_transferred.title=Transferido -rma_recordsmanagement.association.rma_transferred.decription=Transferido - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente do plano de arquivo -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente do plano de arquivo -rma_recordsmanagement.property.rma_rootNodeRef.title=N\u00f3 raiz -rma_recordsmanagement.property.rma_rootNodeRef.decription=N\u00f3 raiz - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Raiz do Records Management -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Raiz do Records Management -rma_recordsmanagement.association.rma_holds.title=Esperas -rma_recordsmanagement.association.rma_holds.decription=Esperas -rma_recordsmanagement.association.rma_transfers.title=Transfer\u00eancias -rma_recordsmanagement.association.rma_transfers.decription=Transfer\u00eancias - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Documento arquiv\u00edstico conclu\u00eddo -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Documento arquiv\u00edstico conclu\u00eddo -rma_recordsmanagement.property.rma_declaredAt.title=Data de conclus\u00e3o -rma_recordsmanagement.property.rma_declaredAt.decription=Data de conclus\u00e3o -rma_recordsmanagement.property.rma_declaredBy.title=Conclu\u00eddo por -rma_recordsmanagement.property.rma_declaredBy.decription=Conclu\u00eddo por - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificador do componente do documento arquiv\u00edstico -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificador do componente do documento arquiv\u00edstico -rma_recordsmanagement.property.rma_identifier.title=ID do documento arquiv\u00edstico -rma_recordsmanagement.property.rma_identifier.decription=Identificador de documento arquiv\u00edstico exclusivo -rma_recordsmanagement.property.rma_dbUniquenessId.title=Exclusividade do banco de dados -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Exclusividade do banco de dados - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Defini\u00e7\u00e3o do documento arquiv\u00edstico vital -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Defini\u00e7\u00e3o do documento arquiv\u00edstico vital - -rma_recordsmanagement.property.rma_reviewPeriod.title=Per\u00edodo de revis\u00e3o -rma_recordsmanagement.property.rma_reviewPeriod.decription=Per\u00edodo de revis\u00e3o -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicador de documento arquiv\u00edstico vital -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicador de documento arquiv\u00edstico vital - -rma_recordsmanagement.aspect.rma_record.title=Documento arquiv\u00edstico -rma_recordsmanagement.aspect.rma_record.decription=Documento arquiv\u00edstico -rma_recordsmanagement.property.rma_dateFiled.title=Data de arquivamento -rma_recordsmanagement.property.rma_dateFiled.decription=Data de arquivamento -rma_recordsmanagement.property.rma_origionalName=Nome original - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadados do documento arquiv\u00edstico -rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspecto do marcador de metadados do documento arquiv\u00edstico - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Detalhes comuns dos documentos arquiv\u00edsticos -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadados comuns de todos os tipos de documentos arquiv\u00edsticos -rma_recordsmanagement.property.rma_location.title=Localiza\u00e7\u00e3o -rma_recordsmanagement.property.rma_location.decription=Localiza\u00e7\u00e3o - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Documento arquiv\u00edstico vital -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Documento arquiv\u00edstico vital -rma_recordsmanagement.property.rma_reviewAsOf.title=Pr\u00f3xima revis\u00e3o -rma_recordsmanagement.property.rma_reviewAsOf.decription=Pr\u00f3xima revis\u00e3o -rma_recordsmanagement.property.rma_notificationIssued.title=Indica que foi emitida uma notifica\u00e7\u00e3o de prazo para revis\u00e3o para este documento arquiv\u00edstico -rma_recordsmanagement.property.rma_notificationIssued.decription=Indica que foi emitida uma notifica\u00e7\u00e3o de prazo para revis\u00e3o para este documento arquiv\u00edstico - -rma_recordsmanagement.aspect.rma_scheduled.title=Programado -rma_recordsmanagement.aspect.rma_scheduled.decription=Programado -rma_recordsmanagement.association.rma_dispositionSchedule.title=Programa\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Programa\u00e7\u00e3o de reten\u00e7\u00e3o - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo de vida de reten\u00e7\u00e3o -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo de vida de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_nextDispositionAction.title=Pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Hist\u00f3rico de a\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Hist\u00f3rico de a\u00e7\u00f5es de reten\u00e7\u00e3o - -rma_recordsmanagement.aspect.rma_cutOff.title=Cortar -rma_recordsmanagement.aspect.rma_cutOff.decription=Cortar -rma_recordsmanagement.property.rma_cutOffDate.title=Data do corte -rma_recordsmanagement.property.rma_cutOffDate.decription=Data do corte - -rma_recordsmanagement.aspect.rma_transferred.title=Transferido -rma_recordsmanagement.aspect.rma_transferred.decription=Transferido - -rma_recordsmanagement.aspect.rma_ascended.title=Elevado -rma_recordsmanagement.aspect.rma_ascended.decription=Elevado - -rma_recordsmanagement.aspect.rma_frozen.title=Em espera -rma_recordsmanagement.aspect.rma_frozen.decription=Em espera -rma_recordsmanagement.property.rma_frozenAt.title=Mantido em -rma_recordsmanagement.property.rma_frozenAt.decription=Mantido em -rma_recordsmanagement.property.rma_frozenBy.title=Mantido por -rma_recordsmanagement.property.rma_frozenBy.decription=Mantido por - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Raiz da Configura\u00e7\u00e3o Caveat -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Raiz da Configura\u00e7\u00e3o Caveat -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configura\u00e7\u00e3o Caveat -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configura\u00e7\u00e3o Caveat - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Raiz da configura\u00e7\u00e3o de e-mail -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Raiz da configura\u00e7\u00e3o de e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configura\u00e7\u00e3o de e-mail -rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configura\u00e7\u00e3o de e-mail - -rma_recordsmanagement.aspect.rma_recordSearch.title=Pesquisa de documentos arquiv\u00edsticos -rma_recordsmanagement.aspect.rma_recordSearch.decription=Informa\u00e7\u00f5es para suportar a pesquisa do Records Management -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Tem programa\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica se o item tem uma programa\u00e7\u00e3o de reten\u00e7\u00e3o associada -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=O nome da pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=A\u00e7\u00e3o de reten\u00e7\u00e3o de -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=A data em que a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o torna-se qualificada -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Express\u00e3o do per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Express\u00e3o do per\u00edodo de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventos de reten\u00e7\u00e3o qualificados -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventos de reten\u00e7\u00e3o qualificados -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventos de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventos de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autoridade de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autoridade de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instru\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instru\u00e7\u00f5es de reten\u00e7\u00e3o -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motivo para manter -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motivo para manter -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Per\u00edodo de revis\u00e3o do documento arquiv\u00edstico vital -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Per\u00edodo de revis\u00e3o do documento arquiv\u00edstico vital -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Express\u00e3o do per\u00edodo de revis\u00e3o -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Express\u00e3o do per\u00edodo de revis\u00e3o - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Documento arquiv\u00edstico com vers\u00e3o -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Documento arquiv\u00edstico com vers\u00e3o - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Atualiza\u00e7\u00e3o n\u00e3o publicada -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Atualiza\u00e7\u00e3o n\u00e3o publicada -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Atualiza\u00e7\u00e3o n\u00e3o publicada -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica se h\u00e1 uma atualiza\u00e7\u00e3o n\u00e3o publicada -rma_recordsmanagement.property.rma_updateTo.title=Atualizar para -rma_recordsmanagement.property.rma_updateTo.description=Destino da atualiza\u00e7\u00e3o -rma_recordsmanagement.property.rma_updatedProperties.title=Propriedades atualizadas -rma_recordsmanagement.property.rma_updatedProperties.description=As propriedades atualizadas -rma_recordsmanagement.property.rma_publishInProgress.title=Publica\u00e7\u00e3o em andamento -rma_recordsmanagement.property.rma_publishInProgress.description=Indica se uma publica\u00e7\u00e3o est\u00e1 em andamento atualmente - -rma_recordsmanagement.aspect.dod_ghosted.title=Documento arquiv\u00edstico somente de metadados -rma_recordsmanagement.aspect.dod_ghosted.description=Documento arquiv\u00edstico somente de metadados - -listconstraint.rmc_tlList.title=Locais de transfer\u00eancia +rma_recordsmanagement.description=Modelo do conte\u00fado do Records Management + +rma_recordsmanagement.type.rma_rmsite.title=Site do Records Management +rma_recordsmanagement.type.rma_rmsite.description=Site especializado do Records Management + +rma_recordsmanagement.type.rma_caveatConfig.title=Configura\u00e7\u00e3o de controles de seguran\u00e7a +rma_recordsmanagement.type.rma_caveatConfig.decription=Configura\u00e7\u00e3o de controles de seguran\u00e7a + +rma_recordsmanagement.type.rma_emailConfig.title=Configura\u00e7\u00e3o de e-mail +rma_recordsmanagement.type.rma_emailConfig.decription=Configura\u00e7\u00e3o de e-mail + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=Cont\u00eainer do Records Management +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Cont\u00eainer do Records Management + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Cont\u00eainer da raiz do Records Management +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Cont\u00eainer da raiz do Records Management + +rma_recordsmanagement.type.rma_dispositionSchedule.title=Programa\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.type.rma_dispositionSchedule.decription=Programa\u00e7\u00e3o de reten\u00e7\u00e3o + +rma_recordsmanagement.property.rma_dispositionAuthority.title=Autoridade de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionAuthority.decription=Autoridade de reten\u00e7\u00e3o + +rma_recordsmanagement.property.rma_dispositionInstructions.title=Instru\u00e7\u00f5es de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionInstructions.decription=Instru\u00e7\u00f5es de reten\u00e7\u00e3o + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=Reten\u00e7\u00e3o de n\u00edvel de documento arquiv\u00edstico +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Reten\u00e7\u00e3o de n\u00edvel de documento arquiv\u00edstico + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=A\u00e7\u00f5es de reten\u00e7\u00e3o +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=A\u00e7\u00f5es de reten\u00e7\u00e3o + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Defini\u00e7\u00e3o da a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionActionName.title=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionActionName.decription=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionDescription.title=Descri\u00e7\u00e3o da reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionDescription.decription=Descri\u00e7\u00e3o da reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionLocation.title=Localiza\u00e7\u00e3o da reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionLocation.decription=Localiza\u00e7\u00e3o da reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionPeriod.title=Per\u00edodo de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionPeriod.decription=Per\u00edodo de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Propriedade do per\u00edodo de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Propriedade do per\u00edodo de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionEvent.title=Evento de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionEvent.decription=Evento de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionEventCombination.title=Combina\u00e7\u00e3o de eventos de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Combina\u00e7\u00e3o de eventos de reten\u00e7\u00e3o + +rma_recordsmanagement.type.rma_recordFolder.title=Pasta de documento arquiv\u00edstico +rma_recordsmanagement.type.rma_recordFolder.decription=Pasta de documento arquiv\u00edstico +rma_recordsmanagement.property.rma_isClosed.title=Documento arquiv\u00edstico +rma_recordsmanagement.property.rma_isClosed.decription=Documento arquiv\u00edstico + +rma_recordsmanagement.type.rma_recordCategory.title=Categoria de documento arquiv\u00edstico +rma_recordsmanagement.type.rma_recordCategory.decription=Categoria de documento arquiv\u00edstico + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=Documento n\u00e3o eletr\u00f4nico +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Documento n\u00e3o eletr\u00f4nico +rma_recordsmanagement.property.rma_physicalSize.title=Tamanho f\u00edsico +rma_recordsmanagement.property.rma_physicalSize.decription=O tamanho do documento medido em metros lineares. +rma_recordsmanagement.property.rma_numberOfCopies.title=N\u00famero de c\u00f3pias +rma_recordsmanagement.property.rma_numberOfCopies.description=O n\u00famero de c\u00f3pias do documento. +rma_recordsmanagement.property.rma_storageLocation.title=Local de armazenamento +rma_recordsmanagement.property.rma_storageLocation.decription=O local f\u00edsico de armazenamento do documento arquiv\u00edstico. +rma_recordsmanagement.property.rma_shelf.title=Prateleira +rma_recordsmanagement.property.rma_shelf.decription=A prateleira em que o documento arquiv\u00edstico est\u00e1 armazenado. +rma_recordsmanagement.property.rma_box.title=Caixa +rma_recordsmanagement.property.rma_box.description=A caixa em que o documento arquiv\u00edstico est\u00e1 armazenado. +rma_recordsmanagement.property.rma_file.title=Arquivo +rma_recordsmanagement.property.rma_file.decription=O arquivo em que o documento arquiv\u00edstico est\u00e1 armazenado. + +rma_recordsmanagement.type.rma_dispositionAction.title=A\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.type.rma_dispositionAction.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionActionId.title=ID da a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionActionId.decription=ID da a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionAction.title=A\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionAction.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionAsOf.title=A\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionAsOf.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Eventos de reten\u00e7\u00e3o qualificados +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Eventos de reten\u00e7\u00e3o qualificados +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada em +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada em +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada por +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o iniciada por +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda em +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda em +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda por +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=A\u00e7\u00e3o de reten\u00e7\u00e3o conclu\u00edda por +rma_recordsmanagement.association.rma_eventExecutions.title=Execu\u00e7\u00f5es de eventos +rma_recordsmanagement.association.rma_eventExecutions.decription=Execu\u00e7\u00f5es de eventos + +rma_recordsmanagement.type.rma_eventExecution.title=Execu\u00e7\u00e3o do evento +rma_recordsmanagement.type.rma_eventExecution.decription=Execu\u00e7\u00e3o do evento +rma_recordsmanagement.property.rma_eventExecutionName.title=Nome do evento +rma_recordsmanagement.property.rma_eventExecutionName.decription=Nome do evento +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Evento autom\u00e1tico +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Evento autom\u00e1tico +rma_recordsmanagement.property.rma_eventExecutionComplete.title=Evento conclu\u00eddo +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Evento conclu\u00eddo +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Evento conclu\u00eddo por +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Evento conclu\u00eddo por +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Evento conclu\u00eddo em +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Evento conclu\u00eddo em + +rma_recordsmanagement.type.rma_hold.title=Manter +rma_recordsmanagement.type.rma_hold.decription=Manter +rma_recordsmanagement.property.rma_holdReason.title=Motivo para manter +rma_recordsmanagement.property.rma_holdReason.decription=Motivo para manter +rma_recordsmanagement.association.rma_frozenRecords.title=Documentos arquiv\u00edsticos mantidos +rma_recordsmanagement.association.rma_frozenRecords.decription=Documentos arquiv\u00edsticos mantidos + +rma_recordsmanagement.type.rma_transfer.title=Transferir +rma_recordsmanagement.type.rma_transfer.decription=Transferir +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Transferir indicador de ades\u00e3o +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Transferir indicador de ades\u00e3o +rma_recordsmanagement.property.rma_transferPDFIndicator.title=Transferir indicador do PDF +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Transferir indicador do PDF +rma_recordsmanagement.property.rma_transferLocation.title=Transferir PDF +rma_recordsmanagement.property.rma_transferLocation.decription=Transferir PDF +rma_recordsmanagement.association.rma_transferred.title=Transferido +rma_recordsmanagement.association.rma_transferred.decription=Transferido + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente do plano de arquivo +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente do plano de arquivo +rma_recordsmanagement.property.rma_rootNodeRef.title=N\u00f3 raiz +rma_recordsmanagement.property.rma_rootNodeRef.decription=N\u00f3 raiz + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Raiz do Records Management +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Raiz do Records Management +rma_recordsmanagement.association.rma_holds.title=Esperas +rma_recordsmanagement.association.rma_holds.decription=Esperas +rma_recordsmanagement.association.rma_transfers.title=Transfer\u00eancias +rma_recordsmanagement.association.rma_transfers.decription=Transfer\u00eancias + +rma_recordsmanagement.aspect.rma_declaredRecord.title=Documento arquiv\u00edstico conclu\u00eddo +rma_recordsmanagement.aspect.rma_declaredRecord.decription=Documento arquiv\u00edstico conclu\u00eddo +rma_recordsmanagement.property.rma_declaredAt.title=Data de conclus\u00e3o +rma_recordsmanagement.property.rma_declaredAt.decription=Data de conclus\u00e3o +rma_recordsmanagement.property.rma_declaredBy.title=Conclu\u00eddo por +rma_recordsmanagement.property.rma_declaredBy.decription=Conclu\u00eddo por + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Identificador do componente do documento arquiv\u00edstico +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Identificador do componente do documento arquiv\u00edstico +rma_recordsmanagement.property.rma_identifier.title=ID do documento arquiv\u00edstico +rma_recordsmanagement.property.rma_identifier.decription=Identificador de documento arquiv\u00edstico exclusivo +rma_recordsmanagement.property.rma_dbUniquenessId.title=Exclusividade do banco de dados +rma_recordsmanagement.property.rma_dbUniquenessId.decription=Exclusividade do banco de dados + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Defini\u00e7\u00e3o do documento arquiv\u00edstico vital +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Defini\u00e7\u00e3o do documento arquiv\u00edstico vital + +rma_recordsmanagement.property.rma_reviewPeriod.title=Per\u00edodo de revis\u00e3o +rma_recordsmanagement.property.rma_reviewPeriod.decription=Per\u00edodo de revis\u00e3o +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Indicador de documento arquiv\u00edstico vital +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Indicador de documento arquiv\u00edstico vital + +rma_recordsmanagement.aspect.rma_record.title=Documento arquiv\u00edstico +rma_recordsmanagement.aspect.rma_record.decription=Documento arquiv\u00edstico +rma_recordsmanagement.property.rma_dateFiled.title=Data de arquivamento +rma_recordsmanagement.property.rma_dateFiled.decription=Data de arquivamento +rma_recordsmanagement.property.rma_origionalName=Nome original + +rma_recordsmanagement.aspect.rma_recordMetaData.title=Metadados do documento arquiv\u00edstico +rma_recordsmanagement.aspect.rma_recordMetaData.description=Aspecto do marcador de metadados do documento arquiv\u00edstico + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Detalhes comuns dos documentos arquiv\u00edsticos +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadados comuns de todos os tipos de documentos arquiv\u00edsticos +rma_recordsmanagement.property.rma_location.title=Localiza\u00e7\u00e3o +rma_recordsmanagement.property.rma_location.decription=Localiza\u00e7\u00e3o + +rma_recordsmanagement.aspect.rma_vitalRecord.title=Documento arquiv\u00edstico vital +rma_recordsmanagement.aspect.rma_vitalRecord.decription=Documento arquiv\u00edstico vital +rma_recordsmanagement.property.rma_reviewAsOf.title=Pr\u00f3xima revis\u00e3o +rma_recordsmanagement.property.rma_reviewAsOf.decription=Pr\u00f3xima revis\u00e3o +rma_recordsmanagement.property.rma_notificationIssued.title=Indica que foi emitida uma notifica\u00e7\u00e3o de prazo para revis\u00e3o para este documento arquiv\u00edstico +rma_recordsmanagement.property.rma_notificationIssued.decription=Indica que foi emitida uma notifica\u00e7\u00e3o de prazo para revis\u00e3o para este documento arquiv\u00edstico + +rma_recordsmanagement.aspect.rma_scheduled.title=Programado +rma_recordsmanagement.aspect.rma_scheduled.decription=Programado +rma_recordsmanagement.association.rma_dispositionSchedule.title=Programa\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.association.rma_dispositionSchedule.decription=Programa\u00e7\u00e3o de reten\u00e7\u00e3o + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Ciclo de vida de reten\u00e7\u00e3o +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Ciclo de vida de reten\u00e7\u00e3o +rma_recordsmanagement.association.rma_nextDispositionAction.title=Pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.association.rma_nextDispositionAction.decription=Pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.association.rma_dispositionActionHistory.title=Hist\u00f3rico de a\u00e7\u00f5es de reten\u00e7\u00e3o +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Hist\u00f3rico de a\u00e7\u00f5es de reten\u00e7\u00e3o + +rma_recordsmanagement.aspect.rma_cutOff.title=Cortar +rma_recordsmanagement.aspect.rma_cutOff.decription=Cortar +rma_recordsmanagement.property.rma_cutOffDate.title=Data do corte +rma_recordsmanagement.property.rma_cutOffDate.decription=Data do corte + +rma_recordsmanagement.aspect.rma_transferred.title=Transferido +rma_recordsmanagement.aspect.rma_transferred.decription=Transferido + +rma_recordsmanagement.aspect.rma_ascended.title=Elevado +rma_recordsmanagement.aspect.rma_ascended.decription=Elevado + +rma_recordsmanagement.aspect.rma_frozen.title=Em espera +rma_recordsmanagement.aspect.rma_frozen.decription=Em espera +rma_recordsmanagement.property.rma_frozenAt.title=Mantido em +rma_recordsmanagement.property.rma_frozenAt.decription=Mantido em +rma_recordsmanagement.property.rma_frozenBy.title=Mantido por +rma_recordsmanagement.property.rma_frozenBy.decription=Mantido por + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Raiz da Configura\u00e7\u00e3o Caveat +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Raiz da Configura\u00e7\u00e3o Caveat +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Configura\u00e7\u00e3o Caveat +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Configura\u00e7\u00e3o Caveat + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=Raiz da configura\u00e7\u00e3o de e-mail +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=Raiz da configura\u00e7\u00e3o de e-mail +rma_recordsmanagement.association.rma_emailConfigAssoc.title=Configura\u00e7\u00e3o de e-mail +rma_recordsmanagement.association.rma_emailConfigAssoc.description=Configura\u00e7\u00e3o de e-mail + +rma_recordsmanagement.aspect.rma_recordSearch.title=Pesquisa de documentos arquiv\u00edsticos +rma_recordsmanagement.aspect.rma_recordSearch.decription=Informa\u00e7\u00f5es para suportar a pesquisa do Records Management +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Tem programa\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indica se o item tem uma programa\u00e7\u00e3o de reten\u00e7\u00e3o associada +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Nome da a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=O nome da pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=A\u00e7\u00e3o de reten\u00e7\u00e3o de +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=A data em que a pr\u00f3xima a\u00e7\u00e3o de reten\u00e7\u00e3o torna-se qualificada +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Per\u00edodo de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Per\u00edodo de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Express\u00e3o do per\u00edodo de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Express\u00e3o do per\u00edodo de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Eventos de reten\u00e7\u00e3o qualificados +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Eventos de reten\u00e7\u00e3o qualificados +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Eventos de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Eventos de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Autoridade de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Autoridade de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Instru\u00e7\u00f5es de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Instru\u00e7\u00f5es de reten\u00e7\u00e3o +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Motivo para manter +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Motivo para manter +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Per\u00edodo de revis\u00e3o do documento arquiv\u00edstico vital +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Per\u00edodo de revis\u00e3o do documento arquiv\u00edstico vital +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Express\u00e3o do per\u00edodo de revis\u00e3o +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Express\u00e3o do per\u00edodo de revis\u00e3o + +rma_recordsmanagement.aspect.rma_versionedRecord.title=Documento arquiv\u00edstico com vers\u00e3o +rma_recordsmanagement.aspect.rma_versionedRecord.decription=Documento arquiv\u00edstico com vers\u00e3o + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Atualiza\u00e7\u00e3o n\u00e3o publicada +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Atualiza\u00e7\u00e3o n\u00e3o publicada +rma_recordsmanagement.property.rma_unpublishedUpdate.title=Atualiza\u00e7\u00e3o n\u00e3o publicada +rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indica se h\u00e1 uma atualiza\u00e7\u00e3o n\u00e3o publicada +rma_recordsmanagement.property.rma_updateTo.title=Atualizar para +rma_recordsmanagement.property.rma_updateTo.description=Destino da atualiza\u00e7\u00e3o +rma_recordsmanagement.property.rma_updatedProperties.title=Propriedades atualizadas +rma_recordsmanagement.property.rma_updatedProperties.description=As propriedades atualizadas +rma_recordsmanagement.property.rma_publishInProgress.title=Publica\u00e7\u00e3o em andamento +rma_recordsmanagement.property.rma_publishInProgress.description=Indica se uma publica\u00e7\u00e3o est\u00e1 em andamento atualmente + +rma_recordsmanagement.aspect.dod_ghosted.title=Documento arquiv\u00edstico somente de metadados +rma_recordsmanagement.aspect.dod_ghosted.description=Documento arquiv\u00edstico somente de metadados + +listconstraint.rmc_tlList.title=Locais de transfer\u00eancia listconstraint.rmc_smList.title=Marca\u00e7\u00f5es complementares \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties index 857dd01a66..74059a3629 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rma_recordsmanagement.type.rma_rmsite.title=\u0421\u0430\u0439\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.type.rma_rmsite.description=\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rma_recordsmanagement.type.rma_caveatConfig.title=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e -rma_recordsmanagement.type.rma_caveatConfig.decription=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e - -rma_recordsmanagement.type.rma_emailConfig.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b -rma_recordsmanagement.type.rma_emailConfig.decription=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rma_recordsmanagement.type.rma_dispositionSchedule.title=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f - -rma_recordsmanagement.property.rma_dispositionAuthority.title=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 - -rma_recordsmanagement.property.rma_dispositionInstructions.title=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionName.title=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionName.decription=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionDescription.title=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionDescription.decription=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionLocation.title=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionLocation.decription=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEvent.title=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEvent.decription=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f - -rma_recordsmanagement.type.rma_recordFolder.title=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.type.rma_recordFolder.decription=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.property.rma_isClosed.title=\u0417\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.property.rma_isClosed.decription=\u0417\u0430\u043f\u0438\u0441\u044c - -rma_recordsmanagement.type.rma_recordCategory.title=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.type.rma_recordCategory.decription=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u041d\u0435\u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u041d\u0435\u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 -rma_recordsmanagement.property.rma_physicalSize.title=\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 -rma_recordsmanagement.property.rma_physicalSize.decription=\u0420\u0430\u0437\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0438\u0441\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0432 \u043c\u0435\u0442\u0440\u0430\u0445. -rma_recordsmanagement.property.rma_numberOfCopies.title=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043f\u0438\u0439 -rma_recordsmanagement.property.rma_numberOfCopies.description=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043f\u0438\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. -rma_recordsmanagement.property.rma_storageLocation.title=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_storageLocation.decription=\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438. -rma_recordsmanagement.property.rma_shelf.title=\u041f\u043e\u043b\u043a\u0430 -rma_recordsmanagement.property.rma_shelf.decription=\u041f\u043e\u043b\u043a\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. -rma_recordsmanagement.property.rma_box.title=\u042f\u0449\u0438\u043a -rma_recordsmanagement.property.rma_box.description=\u042f\u0449\u0438\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. -rma_recordsmanagement.property.rma_file.title=\u0424\u0430\u0439\u043b -rma_recordsmanagement.property.rma_file.decription=\u0424\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. - -rma_recordsmanagement.type.rma_dispositionAction.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.type.rma_dispositionAction.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionId.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionId.decription=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionAction.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionAction.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionAsOf.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0432 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0432 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u041a\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u041a\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0432 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0432 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u041a\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u041a\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_eventExecutions.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.association.rma_eventExecutions.decription=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f - -rma_recordsmanagement.type.rma_eventExecution.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.type.rma_eventExecution.decription=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.property.rma_eventExecutionName.title=\u0418\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.property.rma_eventExecutionName.decription=\u0418\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u0410\u0432\u0442\u043e\u043c\u0430\u0442. \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u0410\u0432\u0442\u043e\u043c\u0430\u0442. \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f - -rma_recordsmanagement.type.rma_hold.title=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 -rma_recordsmanagement.type.rma_hold.decription=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 -rma_recordsmanagement.property.rma_holdReason.title=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -rma_recordsmanagement.property.rma_holdReason.decription=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -rma_recordsmanagement.association.rma_frozenRecords.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.association.rma_frozenRecords.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.type.rma_transfer.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c -rma_recordsmanagement.type.rma_transfer.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 -rma_recordsmanagement.property.rma_transferPDFIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 PDF -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 PDF -rma_recordsmanagement.property.rma_transferLocation.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c PDF -rma_recordsmanagement.property.rma_transferLocation.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c PDF -rma_recordsmanagement.association.rma_transferred.title=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e -rma_recordsmanagement.association.rma_transferred.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0410\u0440\u0445\u0438\u0432 -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0410\u0440\u0445\u0438\u0432 -rma_recordsmanagement.property.rma_rootNodeRef.title=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 -rma_recordsmanagement.property.rma_rootNodeRef.decription=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.association.rma_holds.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.association.rma_holds.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.association.rma_transfers.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -rma_recordsmanagement.association.rma_transfers.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 - -rma_recordsmanagement.aspect.rma_declaredRecord.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.property.rma_declaredAt.title=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_declaredAt.decription=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_declaredBy.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c -rma_recordsmanagement.property.rma_declaredBy.decription=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_identifier.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_identifier.decription=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_dbUniquenessId.title=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 -rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.property.rma_reviewPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 -rma_recordsmanagement.property.rma_reviewPeriod.decription=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.aspect.rma_record.title=\u0417\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.aspect.rma_record.decription=\u0417\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.property.rma_dateFiled.title=\u0414\u0430\u0442\u0430 \u0432\u0432\u043e\u0434\u0430 -rma_recordsmanagement.property.rma_dateFiled.decription=\u0414\u0430\u0442\u0430 \u0432\u0432\u043e\u0434\u0430 -rma_recordsmanagement.property.rma_origionalName=\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f - -rma_recordsmanagement.aspect.rma_recordMetaData.title=\u041c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.aspect.rma_recordMetaData.description=\u0410\u0441\u043f\u0435\u043a\u0442 \u043f\u043e\u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u041e\u0431\u0449\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rma_recordsmanagement.property.rma_location.title=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_location.decription=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 - -rma_recordsmanagement.aspect.rma_vitalRecord.title=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c -rma_recordsmanagement.property.rma_reviewAsOf.title=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 -rma_recordsmanagement.property.rma_reviewAsOf.decription=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 -rma_recordsmanagement.property.rma_notificationIssued.title=\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 -rma_recordsmanagement.property.rma_notificationIssued.decription=\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 - -rma_recordsmanagement.aspect.rma_scheduled.title=\u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e -rma_recordsmanagement.aspect.rma_scheduled.decription=\u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e -rma_recordsmanagement.association.rma_dispositionSchedule.title=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.association.rma_nextDispositionAction.title=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e - -rma_recordsmanagement.aspect.rma_cutOff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -rma_recordsmanagement.aspect.rma_cutOff.decription=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -rma_recordsmanagement.property.rma_cutOffDate.title=\u0414\u0430\u0442\u0430 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f -rma_recordsmanagement.property.rma_cutOffDate.decription=\u0414\u0430\u0442\u0430 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f - -rma_recordsmanagement.aspect.rma_transferred.title=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e -rma_recordsmanagement.aspect.rma_transferred.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e - -rma_recordsmanagement.aspect.rma_ascended.title=\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043e \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e -rma_recordsmanagement.aspect.rma_ascended.decription=\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043e \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e - -rma_recordsmanagement.aspect.rma_frozen.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 -rma_recordsmanagement.aspect.rma_frozen.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 -rma_recordsmanagement.property.rma_frozenAt.title=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 -rma_recordsmanagement.property.rma_frozenAt.decription=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 -rma_recordsmanagement.property.rma_frozenBy.title=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c -rma_recordsmanagement.property.rma_frozenBy.decription=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b -rma_recordsmanagement.association.rma_emailConfigAssoc.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b -rma_recordsmanagement.association.rma_emailConfigAssoc.description=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b - -rma_recordsmanagement.aspect.rma_recordSearch.title=\u041f\u043e\u0438\u0441\u043a \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.aspect.rma_recordSearch.decription=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u0415\u0441\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043b\u0438 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u0418\u043c\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u0414\u0430\u0442\u0430, \u043f\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 - -rma_recordsmanagement.aspect.rma_versionedRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 -rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 -rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_updateTo.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e -rma_recordsmanagement.property.rma_updateTo.description=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f -rma_recordsmanagement.property.rma_updatedProperties.title=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 -rma_recordsmanagement.property.rma_updatedProperties.description=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 -rma_recordsmanagement.property.rma_publishInProgress.title=\u0418\u0434\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 -rma_recordsmanagement.property.rma_publishInProgress.description=\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 - -rma_recordsmanagement.aspect.dod_ghosted.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 -rma_recordsmanagement.aspect.dod_ghosted.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 - -listconstraint.rmc_tlList.title=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 +rma_recordsmanagement.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 + +rma_recordsmanagement.type.rma_rmsite.title=\u0421\u0430\u0439\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rma_recordsmanagement.type.rma_rmsite.description=\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 + +rma_recordsmanagement.type.rma_caveatConfig.title=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e +rma_recordsmanagement.type.rma_caveatConfig.decription=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e + +rma_recordsmanagement.type.rma_emailConfig.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b +rma_recordsmanagement.type.rma_emailConfig.decription=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 + +rma_recordsmanagement.type.rma_dispositionSchedule.title=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f + +rma_recordsmanagement.property.rma_dispositionAuthority.title=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 +rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 + +rma_recordsmanagement.property.rma_dispositionInstructions.title=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionActionName.title=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionActionName.decription=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionDescription.title=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionDescription.decription=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionLocation.title=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionLocation.decription=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionEvent.title=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionEvent.decription=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f + +rma_recordsmanagement.type.rma_recordFolder.title=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +rma_recordsmanagement.type.rma_recordFolder.decription=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +rma_recordsmanagement.property.rma_isClosed.title=\u0417\u0430\u043f\u0438\u0441\u044c +rma_recordsmanagement.property.rma_isClosed.decription=\u0417\u0430\u043f\u0438\u0441\u044c + +rma_recordsmanagement.type.rma_recordCategory.title=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +rma_recordsmanagement.type.rma_recordCategory.decription=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u041d\u0435\u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u041d\u0435\u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 +rma_recordsmanagement.property.rma_physicalSize.title=\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 +rma_recordsmanagement.property.rma_physicalSize.decription=\u0420\u0430\u0437\u043c\u0435\u0440 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u0438\u0441\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0432 \u043c\u0435\u0442\u0440\u0430\u0445. +rma_recordsmanagement.property.rma_numberOfCopies.title=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043f\u0438\u0439 +rma_recordsmanagement.property.rma_numberOfCopies.description=\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u043f\u0438\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. +rma_recordsmanagement.property.rma_storageLocation.title=\u041c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_storageLocation.decription=\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438. +rma_recordsmanagement.property.rma_shelf.title=\u041f\u043e\u043b\u043a\u0430 +rma_recordsmanagement.property.rma_shelf.decription=\u041f\u043e\u043b\u043a\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. +rma_recordsmanagement.property.rma_box.title=\u042f\u0449\u0438\u043a +rma_recordsmanagement.property.rma_box.description=\u042f\u0449\u0438\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. +rma_recordsmanagement.property.rma_file.title=\u0424\u0430\u0439\u043b +rma_recordsmanagement.property.rma_file.decription=\u0424\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c. + +rma_recordsmanagement.type.rma_dispositionAction.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.type.rma_dispositionAction.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionActionId.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionActionId.decription=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionAction.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionAction.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionAsOf.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0432 +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0432 +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u041a\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u041a\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0432 +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0432 +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u041a\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u041a\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.association.rma_eventExecutions.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f +rma_recordsmanagement.association.rma_eventExecutions.decription=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f + +rma_recordsmanagement.type.rma_eventExecution.title=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f +rma_recordsmanagement.type.rma_eventExecution.decription=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f +rma_recordsmanagement.property.rma_eventExecutionName.title=\u0418\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f +rma_recordsmanagement.property.rma_eventExecutionName.decription=\u0418\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u0410\u0432\u0442\u043e\u043c\u0430\u0442. \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u0410\u0432\u0442\u043e\u043c\u0430\u0442. \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0432\u0448\u0438\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f + +rma_recordsmanagement.type.rma_hold.title=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 +rma_recordsmanagement.type.rma_hold.decription=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 +rma_recordsmanagement.property.rma_holdReason.title=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +rma_recordsmanagement.property.rma_holdReason.decription=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +rma_recordsmanagement.association.rma_frozenRecords.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.association.rma_frozenRecords.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 + +rma_recordsmanagement.type.rma_transfer.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c +rma_recordsmanagement.type.rma_transfer.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 +rma_recordsmanagement.property.rma_transferPDFIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 PDF +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 PDF +rma_recordsmanagement.property.rma_transferLocation.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c PDF +rma_recordsmanagement.property.rma_transferLocation.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c PDF +rma_recordsmanagement.association.rma_transferred.title=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e +rma_recordsmanagement.association.rma_transferred.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0410\u0440\u0445\u0438\u0432 +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0410\u0440\u0445\u0438\u0432 +rma_recordsmanagement.property.rma_rootNodeRef.title=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 +rma_recordsmanagement.property.rma_rootNodeRef.decription=\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rma_recordsmanagement.association.rma_holds.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.association.rma_holds.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.association.rma_transfers.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 +rma_recordsmanagement.association.rma_transfers.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 + +rma_recordsmanagement.aspect.rma_declaredRecord.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c +rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c +rma_recordsmanagement.property.rma_declaredAt.title=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_declaredAt.decription=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_declaredBy.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c +rma_recordsmanagement.property.rma_declaredBy.decription=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.property.rma_identifier.title=\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.property.rma_identifier.decription=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.property.rma_dbUniquenessId.title=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 +rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 + +rma_recordsmanagement.property.rma_reviewPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 +rma_recordsmanagement.property.rma_reviewPeriod.decription=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u0418\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 + +rma_recordsmanagement.aspect.rma_record.title=\u0417\u0430\u043f\u0438\u0441\u044c +rma_recordsmanagement.aspect.rma_record.decription=\u0417\u0430\u043f\u0438\u0441\u044c +rma_recordsmanagement.property.rma_dateFiled.title=\u0414\u0430\u0442\u0430 \u0432\u0432\u043e\u0434\u0430 +rma_recordsmanagement.property.rma_dateFiled.decription=\u0414\u0430\u0442\u0430 \u0432\u0432\u043e\u0434\u0430 +rma_recordsmanagement.property.rma_origionalName=\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f + +rma_recordsmanagement.aspect.rma_recordMetaData.title=\u041c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.aspect.rma_recordMetaData.description=\u0410\u0441\u043f\u0435\u043a\u0442 \u043f\u043e\u043c\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u041e\u0431\u0449\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +rma_recordsmanagement.property.rma_location.title=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 +rma_recordsmanagement.property.rma_location.decription=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 + +rma_recordsmanagement.aspect.rma_vitalRecord.title=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c +rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c +rma_recordsmanagement.property.rma_reviewAsOf.title=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 +rma_recordsmanagement.property.rma_reviewAsOf.decription=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 +rma_recordsmanagement.property.rma_notificationIssued.title=\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 +rma_recordsmanagement.property.rma_notificationIssued.decription=\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 + +rma_recordsmanagement.aspect.rma_scheduled.title=\u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e +rma_recordsmanagement.aspect.rma_scheduled.decription=\u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e +rma_recordsmanagement.association.rma_dispositionSchedule.title=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u0413\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.association.rma_nextDispositionAction.title=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u0416\u0443\u0440\u043d\u0430\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e + +rma_recordsmanagement.aspect.rma_cutOff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c +rma_recordsmanagement.aspect.rma_cutOff.decription=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c +rma_recordsmanagement.property.rma_cutOffDate.title=\u0414\u0430\u0442\u0430 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f +rma_recordsmanagement.property.rma_cutOffDate.decription=\u0414\u0430\u0442\u0430 \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f + +rma_recordsmanagement.aspect.rma_transferred.title=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e +rma_recordsmanagement.aspect.rma_transferred.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043e + +rma_recordsmanagement.aspect.rma_ascended.title=\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043e \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e +rma_recordsmanagement.aspect.rma_ascended.decription=\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043e \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e + +rma_recordsmanagement.aspect.rma_frozen.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 +rma_recordsmanagement.aspect.rma_frozen.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 +rma_recordsmanagement.property.rma_frozenAt.title=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 +rma_recordsmanagement.property.rma_frozenAt.decription=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 +rma_recordsmanagement.property.rma_frozenBy.title=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c +rma_recordsmanagement.property.rma_frozenBy.decription=\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b +rma_recordsmanagement.association.rma_emailConfigAssoc.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b +rma_recordsmanagement.association.rma_emailConfigAssoc.description=\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b + +rma_recordsmanagement.aspect.rma_recordSearch.title=\u041f\u043e\u0438\u0441\u043a \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.aspect.rma_recordSearch.decription=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u0415\u0441\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043b\u0438 \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u0418\u043c\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u0418\u043c\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u0414\u0430\u0442\u0430, \u043f\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u041f\u0435\u0440\u0438\u043e\u0434 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u041f\u0435\u0440\u0438\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 + +rma_recordsmanagement.aspect.rma_versionedRecord.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 +rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 +rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u041d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 +rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_updateTo.title=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e +rma_recordsmanagement.property.rma_updateTo.description=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f +rma_recordsmanagement.property.rma_updatedProperties.title=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 +rma_recordsmanagement.property.rma_updatedProperties.description=\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 +rma_recordsmanagement.property.rma_publishInProgress.title=\u0418\u0434\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 +rma_recordsmanagement.property.rma_publishInProgress.description=\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 + +rma_recordsmanagement.aspect.dod_ghosted.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 +rma_recordsmanagement.aspect.dod_ghosted.description=\u0417\u0430\u043f\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 + +listconstraint.rmc_tlList.title=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 listconstraint.rmc_smList.title=\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_zh_CN.properties index 61da28be01..bdcaf496f4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/records-model_zh_CN.properties @@ -1,265 +1,265 @@ -rma_recordsmanagement.description=\u8bb0\u5f55\u7ba1\u7406\u5185\u5bb9\u6a21\u578b - -rma_recordsmanagement.type.rma_rmsite.title=\u8bb0\u5f55\u7ba1\u7406\u7ad9\u70b9 -rma_recordsmanagement.type.rma_rmsite.description=\u8bb0\u5f55\u7ba1\u7406\u4e13\u7528\u7ad9\u70b9 - -rma_recordsmanagement.type.rma_caveatConfig.title=\u5b89\u5168\u63a7\u4ef6\u914d\u7f6e -rma_recordsmanagement.type.rma_caveatConfig.decription=\u5b89\u5168\u63a7\u4ef6\u914d\u7f6e - -rma_recordsmanagement.type.rma_emailConfig.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e -rma_recordsmanagement.type.rma_emailConfig.decription=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u8bb0\u5f55\u7ba1\u7406\u5bb9\u5668 -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u8bb0\u5f55\u7ba1\u7406\u5bb9\u5668 - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u8bb0\u5f55\u7ba1\u7406\u6839\u5bb9\u5668 -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u8bb0\u5f55\u7ba1\u7406\u6839\u5bb9\u5668 - -rma_recordsmanagement.type.rma_dispositionSchedule.title=\u4fdd\u7559\u8ba1\u5212 -rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u4fdd\u7559\u8ba1\u5212 - -rma_recordsmanagement.property.rma_dispositionAuthority.title=\u4fdd\u7559\u6388\u6743 -rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u4fdd\u7559\u6388\u6743 - -rma_recordsmanagement.property.rma_dispositionInstructions.title=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u4fdd\u7559\u8bf4\u660e - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u8bb0\u5f55\u7ea7\u522b\u4fdd\u7559 -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u8bb0\u5f55\u7ea7\u522b\u4fdd\u7559 - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u4fdd\u7559\u64cd\u4f5c - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49 -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49 -rma_recordsmanagement.property.rma_dispositionActionName.title=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 -rma_recordsmanagement.property.rma_dispositionActionName.decription=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 -rma_recordsmanagement.property.rma_dispositionDescription.title=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_dispositionDescription.decription=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_dispositionLocation.title=\u4fdd\u7559\u4f4d\u7f6e -rma_recordsmanagement.property.rma_dispositionLocation.decription=\u4fdd\u7559\u4f4d\u7f6e -rma_recordsmanagement.property.rma_dispositionPeriod.title=\u4fdd\u7559\u5468\u671f -rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u4fdd\u7559\u5468\u671f -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u4fdd\u7559\u5468\u671f\u5c5e\u6027 -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u4fdd\u7559\u5468\u671f\u5c5e\u6027 -rma_recordsmanagement.property.rma_dispositionEvent.title=\u4fdd\u7559\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_dispositionEvent.decription=\u4fdd\u7559\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u4fdd\u7559\u4e8b\u4ef6\u7ec4\u5408 -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u4fdd\u7559\u4e8b\u4ef6\u7ec4\u5408 - -rma_recordsmanagement.type.rma_recordFolder.title=\u8bb0\u5f55\u6587\u4ef6\u5939 -rma_recordsmanagement.type.rma_recordFolder.decription=\u8bb0\u5f55\u6587\u4ef6\u5939 -rma_recordsmanagement.property.rma_isClosed.title=\u8bb0\u5f55 -rma_recordsmanagement.property.rma_isClosed.decription=\u8bb0\u5f55 - -rma_recordsmanagement.type.rma_recordCategory.title=\u8bb0\u5f55\u7c7b\u522b -rma_recordsmanagement.type.rma_recordCategory.decription=\u8bb0\u5f55\u7c7b\u522b - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u975e\u7535\u5b50\u6587\u6863 -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u975e\u7535\u5b50\u6587\u6863 -rma_recordsmanagement.property.rma_physicalSize.title=\u7269\u7406\u5c3a\u5bf8 -rma_recordsmanagement.property.rma_physicalSize.decription=\u7ebf\u6027\u4eea\u8868\u6d4b\u91cf\u7684\u6587\u6863\u5c3a\u5bf8\u3002 -rma_recordsmanagement.property.rma_numberOfCopies.title=\u526f\u672c\u6570\u76ee -rma_recordsmanagement.property.rma_numberOfCopies.description=\u6587\u6863\u526f\u672c\u6570\u76ee\u3002 -rma_recordsmanagement.property.rma_storageLocation.title=\u5b58\u50a8\u4f4d\u7f6e -rma_recordsmanagement.property.rma_storageLocation.decription=\u8bb0\u5f55\u7684\u7269\u7406\u5b58\u50a8\u4f4d\u7f6e\u3002 -rma_recordsmanagement.property.rma_shelf.title=\u6258\u67b6 -rma_recordsmanagement.property.rma_shelf.decription=\u5b58\u50a8\u8bb0\u5f55\u7684\u673a\u67b6\u3002 -rma_recordsmanagement.property.rma_box.title=\u7bb1 -rma_recordsmanagement.property.rma_box.description=\u5b58\u50a8\u8bb0\u5f55\u7684\u7bb1\u3002 -rma_recordsmanagement.property.rma_file.title=\u6587\u4ef6 -rma_recordsmanagement.property.rma_file.decription=\u5b58\u50a8\u8bb0\u5f55\u7684\u6587\u4ef6\u3002 - -rma_recordsmanagement.type.rma_dispositionAction.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.type.rma_dispositionAction.decription=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionActionId.title=\u4fdd\u7559\u64cd\u4f5c ID -rma_recordsmanagement.property.rma_dispositionActionId.decription=\u4fdd\u7559\u64cd\u4f5c ID -rma_recordsmanagement.property.rma_dispositionAction.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionAction.decription=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionAsOf.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u65f6\u95f4 -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u65f6\u95f4 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u8005 -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u8005 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u65f6\u95f4 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u65f6\u95f4 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u8005 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u8005 -rma_recordsmanagement.association.rma_eventExecutions.title=\u4e8b\u4ef6\u6267\u884c -rma_recordsmanagement.association.rma_eventExecutions.decription=\u4e8b\u4ef6\u6267\u884c - -rma_recordsmanagement.type.rma_eventExecution.title=\u4e8b\u4ef6\u6267\u884c -rma_recordsmanagement.type.rma_eventExecution.decription=\u4e8b\u4ef6\u6267\u884c -rma_recordsmanagement.property.rma_eventExecutionName.title=\u4e8b\u4ef6\u540d\u79f0 -rma_recordsmanagement.property.rma_eventExecutionName.decription=\u4e8b\u4ef6\u540d\u79f0 -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u81ea\u52a8\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u81ea\u52a8\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u4e8b\u4ef6\u5b8c\u6210 -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u4e8b\u4ef6\u5b8c\u6210 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u4e8b\u4ef6\u5b8c\u6210\u8005 -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u4e8b\u4ef6\u5b8c\u6210\u8005 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u4e8b\u4ef6\u5b8c\u6210\u65f6\u95f4 -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u4e8b\u4ef6\u5b8c\u6210\u65f6\u95f4 - -rma_recordsmanagement.type.rma_hold.title=\u4fdd\u5b58 -rma_recordsmanagement.type.rma_hold.decription=\u4fdd\u5b58 -rma_recordsmanagement.property.rma_holdReason.title=\u4fdd\u5b58\u539f\u56e0 -rma_recordsmanagement.property.rma_holdReason.decription=\u4fdd\u5b58\u539f\u56e0 -rma_recordsmanagement.association.rma_frozenRecords.title=\u4fdd\u5b58\u8bb0\u5f55 -rma_recordsmanagement.association.rma_frozenRecords.decription=\u4fdd\u5b58\u8bb0\u5f55 - -rma_recordsmanagement.type.rma_transfer.title=\u79fb\u4ea4 -rma_recordsmanagement.type.rma_transfer.decription=\u79fb\u4ea4 -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u79fb\u4ea4\u5165\u7ba1\u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u79fb\u4ea4\u5165\u7ba1\u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_transferPDFIndicator.title=\u79fb\u4ea4 PDF \u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=\u79fb\u4ea4 PDF \u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_transferLocation.title=\u79fb\u4ea4 PDF -rma_recordsmanagement.property.rma_transferLocation.decription=\u79fb\u4ea4 PDF -rma_recordsmanagement.association.rma_transferred.title=\u5df2\u79fb\u4ea4 -rma_recordsmanagement.association.rma_transferred.decription=\u5df2\u79fb\u4ea4 - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6 -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6 -rma_recordsmanagement.property.rma_rootNodeRef.title=\u6839\u8282\u70b9 -rma_recordsmanagement.property.rma_rootNodeRef.decription=\u6839\u8282\u70b9 - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u8bb0\u5f55\u7ba1\u7406\u6839 -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u8bb0\u5f55\u7ba1\u7406\u6839 -rma_recordsmanagement.association.rma_holds.title=\u4fdd\u5b58 -rma_recordsmanagement.association.rma_holds.decription=\u4fdd\u5b58 -rma_recordsmanagement.association.rma_transfers.title=\u79fb\u4ea4 -rma_recordsmanagement.association.rma_transfers.decription=\u79fb\u4ea4 - -rma_recordsmanagement.aspect.rma_declaredRecord.title=\u5b8c\u6210\u7684\u8bb0\u5f55 -rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u5b8c\u6210\u7684\u8bb0\u5f55 -rma_recordsmanagement.property.rma_declaredAt.title=\u5b8c\u6210\u65e5\u671f -rma_recordsmanagement.property.rma_declaredAt.decription=\u5b8c\u6210\u65e5\u671f -rma_recordsmanagement.property.rma_declaredBy.title=\u5b8c\u6210\u8005 -rma_recordsmanagement.property.rma_declaredBy.decription=\u5b8c\u6210\u8005 - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u8bb0\u5f55\u7ec4\u4ef6\u6807\u8bc6\u7b26 -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u8bb0\u5f55\u7ec4\u4ef6\u6807\u8bc6\u7b26 -rma_recordsmanagement.property.rma_identifier.title=\u8bb0\u5f55 ID -rma_recordsmanagement.property.rma_identifier.decription=\u552f\u4e00\u8bb0\u5f55\u6807\u8bc6\u7b26 -rma_recordsmanagement.property.rma_dbUniquenessId.title=\u6570\u636e\u5e93\u552f\u4e00\u6027 -rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u6570\u636e\u5e93\u552f\u4e00\u6027 - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 - -rma_recordsmanagement.property.rma_reviewPeriod.title=\u5ba1\u67e5\u671f\u95f4 -rma_recordsmanagement.property.rma_reviewPeriod.decription=\u5ba1\u67e5\u671f\u95f4 -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u6838\u5fc3\u8bb0\u5f55\u6307\u793a\u7b26 -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u6838\u5fc3\u8bb0\u5f55\u6307\u793a\u7b26 - -rma_recordsmanagement.aspect.rma_record.title=\u8bb0\u5f55 -rma_recordsmanagement.aspect.rma_record.decription=\u8bb0\u5f55 -rma_recordsmanagement.property.rma_dateFiled.title=\u7acb\u5377\u65e5\u671f -rma_recordsmanagement.property.rma_dateFiled.decription=\u7acb\u5377\u65e5\u671f -rma_recordsmanagement.property.rma_origionalName=\u539f\u59cb\u540d\u79f0 - -rma_recordsmanagement.aspect.rma_recordMetaData.title=\u8bb0\u5f55\u5143\u6570\u636e -rma_recordsmanagement.aspect.rma_recordMetaData.description=\u8bb0\u5f55\u5143\u6570\u636e\u7684\u6807\u8bb0\u5207\u9762 - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u5e38\u89c1\u8bb0\u5f55\u8be6\u7ec6\u4fe1\u606f -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u6240\u6709\u8bb0\u5f55\u7c7b\u578b\u901a\u7528\u7684\u5143\u6570\u636e -rma_recordsmanagement.property.rma_location.title=\u4f4d\u7f6e -rma_recordsmanagement.property.rma_location.decription=\u4f4d\u7f6e - -rma_recordsmanagement.aspect.rma_vitalRecord.title=\u6838\u5fc3\u8bb0\u5f55 -rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u6838\u5fc3\u8bb0\u5f55 -rma_recordsmanagement.property.rma_reviewAsOf.title=\u4e0b\u4e2a\u5ba1\u67e5 -rma_recordsmanagement.property.rma_reviewAsOf.decription=\u4e0b\u4e2a\u5ba1\u67e5 -rma_recordsmanagement.property.rma_notificationIssued.title=\u6307\u793a\u5df2\u7ecf\u4e3a\u8be5\u8bb0\u5f55\u53d1\u51fa\u5ba1\u67e5\u5230\u671f\u901a\u77e5 -rma_recordsmanagement.property.rma_notificationIssued.decription=\u6307\u793a\u5df2\u7ecf\u4e3a\u8be5\u8bb0\u5f55\u53d1\u51fa\u5ba1\u67e5\u5230\u671f\u901a\u77e5 - -rma_recordsmanagement.aspect.rma_scheduled.title=\u5df2\u8ba1\u5212 -rma_recordsmanagement.aspect.rma_scheduled.decription=\u5df2\u8ba1\u5212 -rma_recordsmanagement.association.rma_dispositionSchedule.title=\u4fdd\u7559\u8ba1\u5212 -rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u4fdd\u7559\u8ba1\u5212 - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u4fdd\u7559\u751f\u547d\u5468\u671f -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u4fdd\u7559\u751f\u547d\u5468\u671f -rma_recordsmanagement.association.rma_nextDispositionAction.title=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u4fdd\u7559\u64cd\u4f5c\u5386\u53f2\u8bb0\u5f55 -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u4fdd\u7559\u64cd\u4f5c\u5386\u53f2\u8bb0\u5f55 - -rma_recordsmanagement.aspect.rma_cutOff.title=\u4e2d\u65ad -rma_recordsmanagement.aspect.rma_cutOff.decription=\u4e2d\u65ad -rma_recordsmanagement.property.rma_cutOffDate.title=\u4e2d\u65ad\u65e5\u671f -rma_recordsmanagement.property.rma_cutOffDate.decription=\u4e2d\u65ad\u65e5\u671f - -rma_recordsmanagement.aspect.rma_transferred.title=\u5df2\u79fb\u4ea4 -rma_recordsmanagement.aspect.rma_transferred.decription=\u5df2\u79fb\u4ea4 - -rma_recordsmanagement.aspect.rma_ascended.title=\u5df2\u4e0a\u5347 -rma_recordsmanagement.aspect.rma_ascended.decription=\u5df2\u4e0a\u5347 - -rma_recordsmanagement.aspect.rma_frozen.title=\u4fdd\u5b58\u4e2d -rma_recordsmanagement.aspect.rma_frozen.decription=\u4fdd\u5b58\u4e2d -rma_recordsmanagement.property.rma_frozenAt.title=\u4fdd\u5b58\u4e8e -rma_recordsmanagement.property.rma_frozenAt.decription=\u4fdd\u5b58\u4e8e -rma_recordsmanagement.property.rma_frozenBy.title=\u4fdd\u5b58\u8005 -rma_recordsmanagement.property.rma_frozenBy.decription=\u4fdd\u5b58\u8005 - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u8b66\u544a\u914d\u7f6e\u6839 -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u8b66\u544a\u914d\u7f6e\u6839 -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u8b66\u544a\u914d\u7f6e -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u8b66\u544a\u914d\u7f6e - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e\u6839 -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e\u6839 -rma_recordsmanagement.association.rma_emailConfigAssoc.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e -rma_recordsmanagement.association.rma_emailConfigAssoc.description=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e - -rma_recordsmanagement.aspect.rma_recordSearch.title=\u8bb0\u5f55\u641c\u7d22 -rma_recordsmanagement.aspect.rma_recordSearch.decription=\u652f\u6301\u8bb0\u5f55\u7ba1\u7406\u641c\u7d22\u7684\u4fe1\u606f -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u6709\u4fdd\u7559\u8ba1\u5212 -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u6307\u793a\u9879\u76ee\u662f\u5426\u6709\u5173\u8054\u7684\u4fdd\u7559\u8ba1\u5212 -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u7684\u540d\u79f0 -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u4fdd\u7559\u64cd\u4f5c -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u5408\u6cd5\u7684\u65e5\u671f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u4fdd\u7559\u5468\u671f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u4fdd\u7559\u5468\u671f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u4fdd\u7559\u5468\u671f\u8868\u8fbe\u5f0f -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u4fdd\u7559\u5468\u671f\u8868\u8fbe\u5f0f -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u4fdd\u7559\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u4fdd\u7559\u4e8b\u4ef6 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u4fdd\u7559\u6388\u6743 -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u4fdd\u7559\u6388\u6743 -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u4fdd\u7559\u8bf4\u660e -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u4fdd\u5b58\u539f\u56e0 -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u4fdd\u5b58\u539f\u56e0 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u6838\u5fc3\u8bb0\u5f55\u5ba1\u67e5\u671f\u95f4 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u6838\u5fc3\u8bb0\u5f55\u5ba1\u67e5\u671f\u95f4 -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u5ba1\u67e5\u671f\u95f4\u8868\u8fbe\u5f0f -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u5ba1\u67e5\u671f\u95f4\u8868\u8fbe\u5f0f - -rma_recordsmanagement.aspect.rma_versionedRecord.title=\u7248\u672c\u5316\u8bb0\u5f55 -rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u7248\u672c\u5316\u8bb0\u5f55 - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u672a\u53d1\u5e03\u66f4\u65b0 -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u672a\u53d1\u5e03\u66f4\u65b0 -rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u672a\u53d1\u5e03\u66f4\u65b0 -rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u6307\u793a\u662f\u5426\u6709\u672a\u53d1\u5e03\u66f4\u65b0 -rma_recordsmanagement.property.rma_updateTo.title=\u66f4\u65b0\u81f3 -rma_recordsmanagement.property.rma_updateTo.description=\u66f4\u65b0\u76ee\u6807 -rma_recordsmanagement.property.rma_updatedProperties.title=\u66f4\u65b0\u7684\u5c5e\u6027 -rma_recordsmanagement.property.rma_updatedProperties.description=\u66f4\u65b0\u7684\u5c5e\u6027 -rma_recordsmanagement.property.rma_publishInProgress.title=\u53d1\u5e03\u8fdb\u884c\u4e2d -rma_recordsmanagement.property.rma_publishInProgress.description=\u6307\u793a\u53d1\u5e03\u5f53\u524d\u662f\u5426\u5728\u8fdb\u884c\u4e2d - -rma_recordsmanagement.aspect.dod_ghosted.title=\u4ec5\u5143\u6570\u636e\u8bb0\u5f55 -rma_recordsmanagement.aspect.dod_ghosted.description=\u4ec5\u5143\u6570\u636e\u8bb0\u5f55 - -listconstraint.rmc_tlList.title=\u79fb\u4ea4\u4f4d\u7f6e +rma_recordsmanagement.description=\u8bb0\u5f55\u7ba1\u7406\u5185\u5bb9\u6a21\u578b + +rma_recordsmanagement.type.rma_rmsite.title=\u8bb0\u5f55\u7ba1\u7406\u7ad9\u70b9 +rma_recordsmanagement.type.rma_rmsite.description=\u8bb0\u5f55\u7ba1\u7406\u4e13\u7528\u7ad9\u70b9 + +rma_recordsmanagement.type.rma_caveatConfig.title=\u5b89\u5168\u63a7\u4ef6\u914d\u7f6e +rma_recordsmanagement.type.rma_caveatConfig.decription=\u5b89\u5168\u63a7\u4ef6\u914d\u7f6e + +rma_recordsmanagement.type.rma_emailConfig.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e +rma_recordsmanagement.type.rma_emailConfig.decription=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e + +rma_recordsmanagement.type.rma_recordsManagementContainer.title=\u8bb0\u5f55\u7ba1\u7406\u5bb9\u5668 +rma_recordsmanagement.type.rma_recordsManagementContainer.decription=\u8bb0\u5f55\u7ba1\u7406\u5bb9\u5668 + +rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=\u8bb0\u5f55\u7ba1\u7406\u6839\u5bb9\u5668 +rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=\u8bb0\u5f55\u7ba1\u7406\u6839\u5bb9\u5668 + +rma_recordsmanagement.type.rma_dispositionSchedule.title=\u4fdd\u7559\u8ba1\u5212 +rma_recordsmanagement.type.rma_dispositionSchedule.decription=\u4fdd\u7559\u8ba1\u5212 + +rma_recordsmanagement.property.rma_dispositionAuthority.title=\u4fdd\u7559\u6388\u6743 +rma_recordsmanagement.property.rma_dispositionAuthority.decription=\u4fdd\u7559\u6388\u6743 + +rma_recordsmanagement.property.rma_dispositionInstructions.title=\u4fdd\u7559\u8bf4\u660e +rma_recordsmanagement.property.rma_dispositionInstructions.decription=\u4fdd\u7559\u8bf4\u660e + +rma_recordsmanagement.property.rma_recordLevelDisposition.title=\u8bb0\u5f55\u7ea7\u522b\u4fdd\u7559 +rma_recordsmanagement.property.rma_recordLevelDisposition.decription=\u8bb0\u5f55\u7ea7\u522b\u4fdd\u7559 + +rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=\u4fdd\u7559\u64cd\u4f5c + +rma_recordsmanagement.type.rma_dispositionActionDefinition.title=\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49 +rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=\u4fdd\u7559\u64cd\u4f5c\u5b9a\u4e49 +rma_recordsmanagement.property.rma_dispositionActionName.title=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 +rma_recordsmanagement.property.rma_dispositionActionName.decription=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 +rma_recordsmanagement.property.rma_dispositionDescription.title=\u4fdd\u7559\u8bf4\u660e +rma_recordsmanagement.property.rma_dispositionDescription.decription=\u4fdd\u7559\u8bf4\u660e +rma_recordsmanagement.property.rma_dispositionLocation.title=\u4fdd\u7559\u4f4d\u7f6e +rma_recordsmanagement.property.rma_dispositionLocation.decription=\u4fdd\u7559\u4f4d\u7f6e +rma_recordsmanagement.property.rma_dispositionPeriod.title=\u4fdd\u7559\u5468\u671f +rma_recordsmanagement.property.rma_dispositionPeriod.decription=\u4fdd\u7559\u5468\u671f +rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=\u4fdd\u7559\u5468\u671f\u5c5e\u6027 +rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=\u4fdd\u7559\u5468\u671f\u5c5e\u6027 +rma_recordsmanagement.property.rma_dispositionEvent.title=\u4fdd\u7559\u4e8b\u4ef6 +rma_recordsmanagement.property.rma_dispositionEvent.decription=\u4fdd\u7559\u4e8b\u4ef6 +rma_recordsmanagement.property.rma_dispositionEventCombination.title=\u4fdd\u7559\u4e8b\u4ef6\u7ec4\u5408 +rma_recordsmanagement.property.rma_dispositionEventCombination.decription=\u4fdd\u7559\u4e8b\u4ef6\u7ec4\u5408 + +rma_recordsmanagement.type.rma_recordFolder.title=\u8bb0\u5f55\u6587\u4ef6\u5939 +rma_recordsmanagement.type.rma_recordFolder.decription=\u8bb0\u5f55\u6587\u4ef6\u5939 +rma_recordsmanagement.property.rma_isClosed.title=\u8bb0\u5f55 +rma_recordsmanagement.property.rma_isClosed.decription=\u8bb0\u5f55 + +rma_recordsmanagement.type.rma_recordCategory.title=\u8bb0\u5f55\u7c7b\u522b +rma_recordsmanagement.type.rma_recordCategory.decription=\u8bb0\u5f55\u7c7b\u522b + +rma_recordsmanagement.type.rma_nonElectronicDocument.title=\u975e\u7535\u5b50\u6587\u6863 +rma_recordsmanagement.type.rma_nonElectronicDocument.decription=\u975e\u7535\u5b50\u6587\u6863 +rma_recordsmanagement.property.rma_physicalSize.title=\u7269\u7406\u5c3a\u5bf8 +rma_recordsmanagement.property.rma_physicalSize.decription=\u7ebf\u6027\u4eea\u8868\u6d4b\u91cf\u7684\u6587\u6863\u5c3a\u5bf8\u3002 +rma_recordsmanagement.property.rma_numberOfCopies.title=\u526f\u672c\u6570\u76ee +rma_recordsmanagement.property.rma_numberOfCopies.description=\u6587\u6863\u526f\u672c\u6570\u76ee\u3002 +rma_recordsmanagement.property.rma_storageLocation.title=\u5b58\u50a8\u4f4d\u7f6e +rma_recordsmanagement.property.rma_storageLocation.decription=\u8bb0\u5f55\u7684\u7269\u7406\u5b58\u50a8\u4f4d\u7f6e\u3002 +rma_recordsmanagement.property.rma_shelf.title=\u6258\u67b6 +rma_recordsmanagement.property.rma_shelf.decription=\u5b58\u50a8\u8bb0\u5f55\u7684\u673a\u67b6\u3002 +rma_recordsmanagement.property.rma_box.title=\u7bb1 +rma_recordsmanagement.property.rma_box.description=\u5b58\u50a8\u8bb0\u5f55\u7684\u7bb1\u3002 +rma_recordsmanagement.property.rma_file.title=\u6587\u4ef6 +rma_recordsmanagement.property.rma_file.decription=\u5b58\u50a8\u8bb0\u5f55\u7684\u6587\u4ef6\u3002 + +rma_recordsmanagement.type.rma_dispositionAction.title=\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.type.rma_dispositionAction.decription=\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.property.rma_dispositionActionId.title=\u4fdd\u7559\u64cd\u4f5c ID +rma_recordsmanagement.property.rma_dispositionActionId.decription=\u4fdd\u7559\u64cd\u4f5c ID +rma_recordsmanagement.property.rma_dispositionAction.title=\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.property.rma_dispositionAction.decription=\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.property.rma_dispositionAsOf.title=\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.property.rma_dispositionAsOf.decription=\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.property.rma_dispositionEventsEligible.title=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 +rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 +rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u65f6\u95f4 +rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u65f6\u95f4 +rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u8005 +rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=\u4fdd\u7559\u64cd\u4f5c\u542f\u52a8\u8005 +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u65f6\u95f4 +rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u65f6\u95f4 +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u8005 +rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=\u4fdd\u7559\u64cd\u4f5c\u5b8c\u6210\u8005 +rma_recordsmanagement.association.rma_eventExecutions.title=\u4e8b\u4ef6\u6267\u884c +rma_recordsmanagement.association.rma_eventExecutions.decription=\u4e8b\u4ef6\u6267\u884c + +rma_recordsmanagement.type.rma_eventExecution.title=\u4e8b\u4ef6\u6267\u884c +rma_recordsmanagement.type.rma_eventExecution.decription=\u4e8b\u4ef6\u6267\u884c +rma_recordsmanagement.property.rma_eventExecutionName.title=\u4e8b\u4ef6\u540d\u79f0 +rma_recordsmanagement.property.rma_eventExecutionName.decription=\u4e8b\u4ef6\u540d\u79f0 +rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=\u81ea\u52a8\u4e8b\u4ef6 +rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=\u81ea\u52a8\u4e8b\u4ef6 +rma_recordsmanagement.property.rma_eventExecutionComplete.title=\u4e8b\u4ef6\u5b8c\u6210 +rma_recordsmanagement.property.rma_eventExecutionComplete.decription=\u4e8b\u4ef6\u5b8c\u6210 +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=\u4e8b\u4ef6\u5b8c\u6210\u8005 +rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u4e8b\u4ef6\u5b8c\u6210\u8005 +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u4e8b\u4ef6\u5b8c\u6210\u65f6\u95f4 +rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u4e8b\u4ef6\u5b8c\u6210\u65f6\u95f4 + +rma_recordsmanagement.type.rma_hold.title=\u4fdd\u5b58 +rma_recordsmanagement.type.rma_hold.decription=\u4fdd\u5b58 +rma_recordsmanagement.property.rma_holdReason.title=\u4fdd\u5b58\u539f\u56e0 +rma_recordsmanagement.property.rma_holdReason.decription=\u4fdd\u5b58\u539f\u56e0 +rma_recordsmanagement.association.rma_frozenRecords.title=\u4fdd\u5b58\u8bb0\u5f55 +rma_recordsmanagement.association.rma_frozenRecords.decription=\u4fdd\u5b58\u8bb0\u5f55 + +rma_recordsmanagement.type.rma_transfer.title=\u79fb\u4ea4 +rma_recordsmanagement.type.rma_transfer.decription=\u79fb\u4ea4 +rma_recordsmanagement.property.rma_transferAccessionIndicator.title=\u79fb\u4ea4\u5165\u7ba1\u6307\u793a\u7b26 +rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=\u79fb\u4ea4\u5165\u7ba1\u6307\u793a\u7b26 +rma_recordsmanagement.property.rma_transferPDFIndicator.title=\u79fb\u4ea4 PDF \u6307\u793a\u7b26 +rma_recordsmanagement.property.rma_transferPDFIndicator.decription=\u79fb\u4ea4 PDF \u6307\u793a\u7b26 +rma_recordsmanagement.property.rma_transferLocation.title=\u79fb\u4ea4 PDF +rma_recordsmanagement.property.rma_transferLocation.decription=\u79fb\u4ea4 PDF +rma_recordsmanagement.association.rma_transferred.title=\u5df2\u79fb\u4ea4 +rma_recordsmanagement.association.rma_transferred.decription=\u5df2\u79fb\u4ea4 + +rma_recordsmanagement.aspect.rma_filePlanComponent.title=\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6 +rma_recordsmanagement.aspect.rma_filePlanComponent.decription=\u5f52\u7c7b\u65b9\u6848\u7ec4\u4ef6 +rma_recordsmanagement.property.rma_rootNodeRef.title=\u6839\u8282\u70b9 +rma_recordsmanagement.property.rma_rootNodeRef.decription=\u6839\u8282\u70b9 + +rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u8bb0\u5f55\u7ba1\u7406\u6839 +rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u8bb0\u5f55\u7ba1\u7406\u6839 +rma_recordsmanagement.association.rma_holds.title=\u4fdd\u5b58 +rma_recordsmanagement.association.rma_holds.decription=\u4fdd\u5b58 +rma_recordsmanagement.association.rma_transfers.title=\u79fb\u4ea4 +rma_recordsmanagement.association.rma_transfers.decription=\u79fb\u4ea4 + +rma_recordsmanagement.aspect.rma_declaredRecord.title=\u5b8c\u6210\u7684\u8bb0\u5f55 +rma_recordsmanagement.aspect.rma_declaredRecord.decription=\u5b8c\u6210\u7684\u8bb0\u5f55 +rma_recordsmanagement.property.rma_declaredAt.title=\u5b8c\u6210\u65e5\u671f +rma_recordsmanagement.property.rma_declaredAt.decription=\u5b8c\u6210\u65e5\u671f +rma_recordsmanagement.property.rma_declaredBy.title=\u5b8c\u6210\u8005 +rma_recordsmanagement.property.rma_declaredBy.decription=\u5b8c\u6210\u8005 + +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=\u8bb0\u5f55\u7ec4\u4ef6\u6807\u8bc6\u7b26 +rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=\u8bb0\u5f55\u7ec4\u4ef6\u6807\u8bc6\u7b26 +rma_recordsmanagement.property.rma_identifier.title=\u8bb0\u5f55 ID +rma_recordsmanagement.property.rma_identifier.decription=\u552f\u4e00\u8bb0\u5f55\u6807\u8bc6\u7b26 +rma_recordsmanagement.property.rma_dbUniquenessId.title=\u6570\u636e\u5e93\u552f\u4e00\u6027 +rma_recordsmanagement.property.rma_dbUniquenessId.decription=\u6570\u636e\u5e93\u552f\u4e00\u6027 + +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 +rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49 + +rma_recordsmanagement.property.rma_reviewPeriod.title=\u5ba1\u67e5\u671f\u95f4 +rma_recordsmanagement.property.rma_reviewPeriod.decription=\u5ba1\u67e5\u671f\u95f4 +rma_recordsmanagement.property.rma_vitalRecordIndicator.title=\u6838\u5fc3\u8bb0\u5f55\u6307\u793a\u7b26 +rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=\u6838\u5fc3\u8bb0\u5f55\u6307\u793a\u7b26 + +rma_recordsmanagement.aspect.rma_record.title=\u8bb0\u5f55 +rma_recordsmanagement.aspect.rma_record.decription=\u8bb0\u5f55 +rma_recordsmanagement.property.rma_dateFiled.title=\u7acb\u5377\u65e5\u671f +rma_recordsmanagement.property.rma_dateFiled.decription=\u7acb\u5377\u65e5\u671f +rma_recordsmanagement.property.rma_origionalName=\u539f\u59cb\u540d\u79f0 + +rma_recordsmanagement.aspect.rma_recordMetaData.title=\u8bb0\u5f55\u5143\u6570\u636e +rma_recordsmanagement.aspect.rma_recordMetaData.description=\u8bb0\u5f55\u5143\u6570\u636e\u7684\u6807\u8bb0\u5207\u9762 + +rma_recordsmanagement.aspect.rma_commonRecordDetails.title=\u5e38\u89c1\u8bb0\u5f55\u8be6\u7ec6\u4fe1\u606f +rma_recordsmanagement.aspect.rma_commonRecordDetails.description=\u6240\u6709\u8bb0\u5f55\u7c7b\u578b\u901a\u7528\u7684\u5143\u6570\u636e +rma_recordsmanagement.property.rma_location.title=\u4f4d\u7f6e +rma_recordsmanagement.property.rma_location.decription=\u4f4d\u7f6e + +rma_recordsmanagement.aspect.rma_vitalRecord.title=\u6838\u5fc3\u8bb0\u5f55 +rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u6838\u5fc3\u8bb0\u5f55 +rma_recordsmanagement.property.rma_reviewAsOf.title=\u4e0b\u4e2a\u5ba1\u67e5 +rma_recordsmanagement.property.rma_reviewAsOf.decription=\u4e0b\u4e2a\u5ba1\u67e5 +rma_recordsmanagement.property.rma_notificationIssued.title=\u6307\u793a\u5df2\u7ecf\u4e3a\u8be5\u8bb0\u5f55\u53d1\u51fa\u5ba1\u67e5\u5230\u671f\u901a\u77e5 +rma_recordsmanagement.property.rma_notificationIssued.decription=\u6307\u793a\u5df2\u7ecf\u4e3a\u8be5\u8bb0\u5f55\u53d1\u51fa\u5ba1\u67e5\u5230\u671f\u901a\u77e5 + +rma_recordsmanagement.aspect.rma_scheduled.title=\u5df2\u8ba1\u5212 +rma_recordsmanagement.aspect.rma_scheduled.decription=\u5df2\u8ba1\u5212 +rma_recordsmanagement.association.rma_dispositionSchedule.title=\u4fdd\u7559\u8ba1\u5212 +rma_recordsmanagement.association.rma_dispositionSchedule.decription=\u4fdd\u7559\u8ba1\u5212 + +rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=\u4fdd\u7559\u751f\u547d\u5468\u671f +rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=\u4fdd\u7559\u751f\u547d\u5468\u671f +rma_recordsmanagement.association.rma_nextDispositionAction.title=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.association.rma_nextDispositionAction.decription=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.association.rma_dispositionActionHistory.title=\u4fdd\u7559\u64cd\u4f5c\u5386\u53f2\u8bb0\u5f55 +rma_recordsmanagement.association.rma_dispositionActionHistory.decription=\u4fdd\u7559\u64cd\u4f5c\u5386\u53f2\u8bb0\u5f55 + +rma_recordsmanagement.aspect.rma_cutOff.title=\u4e2d\u65ad +rma_recordsmanagement.aspect.rma_cutOff.decription=\u4e2d\u65ad +rma_recordsmanagement.property.rma_cutOffDate.title=\u4e2d\u65ad\u65e5\u671f +rma_recordsmanagement.property.rma_cutOffDate.decription=\u4e2d\u65ad\u65e5\u671f + +rma_recordsmanagement.aspect.rma_transferred.title=\u5df2\u79fb\u4ea4 +rma_recordsmanagement.aspect.rma_transferred.decription=\u5df2\u79fb\u4ea4 + +rma_recordsmanagement.aspect.rma_ascended.title=\u5df2\u4e0a\u5347 +rma_recordsmanagement.aspect.rma_ascended.decription=\u5df2\u4e0a\u5347 + +rma_recordsmanagement.aspect.rma_frozen.title=\u4fdd\u5b58\u4e2d +rma_recordsmanagement.aspect.rma_frozen.decription=\u4fdd\u5b58\u4e2d +rma_recordsmanagement.property.rma_frozenAt.title=\u4fdd\u5b58\u4e8e +rma_recordsmanagement.property.rma_frozenAt.decription=\u4fdd\u5b58\u4e8e +rma_recordsmanagement.property.rma_frozenBy.title=\u4fdd\u5b58\u8005 +rma_recordsmanagement.property.rma_frozenBy.decription=\u4fdd\u5b58\u8005 + +rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=\u8b66\u544a\u914d\u7f6e\u6839 +rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=\u8b66\u544a\u914d\u7f6e\u6839 +rma_recordsmanagement.association.rma_caveatConfigAssoc.title=\u8b66\u544a\u914d\u7f6e +rma_recordsmanagement.association.rma_caveatConfigAssoc.description=\u8b66\u544a\u914d\u7f6e + +rma_recordsmanagement.aspect.rma_emailConfigRoot.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e\u6839 +rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e\u6839 +rma_recordsmanagement.association.rma_emailConfigAssoc.title=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e +rma_recordsmanagement.association.rma_emailConfigAssoc.description=\u7535\u5b50\u90ae\u4ef6\u914d\u7f6e + +rma_recordsmanagement.aspect.rma_recordSearch.title=\u8bb0\u5f55\u641c\u7d22 +rma_recordsmanagement.aspect.rma_recordSearch.decription=\u652f\u6301\u8bb0\u5f55\u7ba1\u7406\u641c\u7d22\u7684\u4fe1\u606f +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=\u6709\u4fdd\u7559\u8ba1\u5212 +rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=\u6307\u793a\u9879\u76ee\u662f\u5426\u6709\u5173\u8054\u7684\u4fdd\u7559\u8ba1\u5212 +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=\u4fdd\u7559\u64cd\u4f5c\u540d\u79f0 +rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u7684\u540d\u79f0 +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=\u4fdd\u7559\u64cd\u4f5c +rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=\u4e0b\u4e00\u4e2a\u4fdd\u7559\u64cd\u4f5c\u5408\u6cd5\u7684\u65e5\u671f +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=\u4fdd\u7559\u5468\u671f +rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=\u4fdd\u7559\u5468\u671f +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=\u4fdd\u7559\u5468\u671f\u8868\u8fbe\u5f0f +rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=\u4fdd\u7559\u5468\u671f\u8868\u8fbe\u5f0f +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 +rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=\u7b26\u5408\u4fdd\u7559\u4e8b\u4ef6\u6761\u4ef6 +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=\u4fdd\u7559\u4e8b\u4ef6 +rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=\u4fdd\u7559\u4e8b\u4ef6 +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=\u4fdd\u7559\u6388\u6743 +rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=\u4fdd\u7559\u6388\u6743 +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=\u4fdd\u7559\u8bf4\u660e +rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=\u4fdd\u7559\u8bf4\u660e +rma_recordsmanagement.property.rma_recordSearchHoldReason.title=\u4fdd\u5b58\u539f\u56e0 +rma_recordsmanagement.property.rma_recordSearchHoldReason.description=\u4fdd\u5b58\u539f\u56e0 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=\u6838\u5fc3\u8bb0\u5f55\u5ba1\u67e5\u671f\u95f4 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=\u6838\u5fc3\u8bb0\u5f55\u5ba1\u67e5\u671f\u95f4 +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=\u5ba1\u67e5\u671f\u95f4\u8868\u8fbe\u5f0f +rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=\u5ba1\u67e5\u671f\u95f4\u8868\u8fbe\u5f0f + +rma_recordsmanagement.aspect.rma_versionedRecord.title=\u7248\u672c\u5316\u8bb0\u5f55 +rma_recordsmanagement.aspect.rma_versionedRecord.decription=\u7248\u672c\u5316\u8bb0\u5f55 + +rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=\u672a\u53d1\u5e03\u66f4\u65b0 +rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=\u672a\u53d1\u5e03\u66f4\u65b0 +rma_recordsmanagement.property.rma_unpublishedUpdate.title=\u672a\u53d1\u5e03\u66f4\u65b0 +rma_recordsmanagement.property.rma_unpublishedUpdate.description=\u6307\u793a\u662f\u5426\u6709\u672a\u53d1\u5e03\u66f4\u65b0 +rma_recordsmanagement.property.rma_updateTo.title=\u66f4\u65b0\u81f3 +rma_recordsmanagement.property.rma_updateTo.description=\u66f4\u65b0\u76ee\u6807 +rma_recordsmanagement.property.rma_updatedProperties.title=\u66f4\u65b0\u7684\u5c5e\u6027 +rma_recordsmanagement.property.rma_updatedProperties.description=\u66f4\u65b0\u7684\u5c5e\u6027 +rma_recordsmanagement.property.rma_publishInProgress.title=\u53d1\u5e03\u8fdb\u884c\u4e2d +rma_recordsmanagement.property.rma_publishInProgress.description=\u6307\u793a\u53d1\u5e03\u5f53\u524d\u662f\u5426\u5728\u8fdb\u884c\u4e2d + +rma_recordsmanagement.aspect.dod_ghosted.title=\u4ec5\u5143\u6570\u636e\u8bb0\u5f55 +rma_recordsmanagement.aspect.dod_ghosted.description=\u4ec5\u5143\u6570\u636e\u8bb0\u5f55 + +listconstraint.rmc_tlList.title=\u79fb\u4ea4\u4f4d\u7f6e listconstraint.rmc_smList.title=\u8865\u5145\u6807\u8bb0 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model.properties index 2bb762da70..4491007116 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=Records Management Report Content Model - -rmr_recordsmanagementreport.type.rmr_report.title=Report -rmr_recordsmanagementreport.type.rmr_report.description=Records Management report. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Transfer Report -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management transfer report. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Destruction Report -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management destruction report. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Hold Report +rmr_recordsmanagementreport.description=Records Management Report Content Model + +rmr_recordsmanagementreport.type.rmr_report.title=Report +rmr_recordsmanagementreport.type.rmr_report.description=Records Management report. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Transfer Report +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management transfer report. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Destruction Report +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management destruction report. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=Hold Report rmr_recordsmanagementreport.type.rmr_holdReport.description=Records Management hold report. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_de.properties index 08a676b63d..61b0d6ccae 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_de.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=Content Model f\u00fcr Records Management Bericht - -rmr_recordsmanagementreport.type.rmr_report.title=Bericht -rmr_recordsmanagementreport.type.rmr_report.description=Records Management Bericht. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u00dcbertragungsbericht -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management \u00dcbertragungsbericht. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Vernichtungsprotokoll -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management Vernichtungsprotokoll. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Sperrbericht +rmr_recordsmanagementreport.description=Content Model f\u00fcr Records Management Bericht + +rmr_recordsmanagementreport.type.rmr_report.title=Bericht +rmr_recordsmanagementreport.type.rmr_report.description=Records Management Bericht. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u00dcbertragungsbericht +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management \u00dcbertragungsbericht. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Vernichtungsprotokoll +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management Vernichtungsprotokoll. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=Sperrbericht rmr_recordsmanagementreport.type.rmr_holdReport.description=Records Management Sperrbericht. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_es.properties index 5188163ed0..c3afb84a6d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_es.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=Modelo de contenido de informe de gesti\u00f3n de documentos de archivo - -rmr_recordsmanagementreport.type.rmr_report.title=Informe -rmr_recordsmanagementreport.type.rmr_report.description=Informe de Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Informe de transferencia -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Informe de transferencia de Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Informe de destrucci\u00f3n -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Informe de destrucci\u00f3n de Records Management. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Informe de bloqueo +rmr_recordsmanagementreport.description=Modelo de contenido de informe de gesti\u00f3n de documentos de archivo + +rmr_recordsmanagementreport.type.rmr_report.title=Informe +rmr_recordsmanagementreport.type.rmr_report.description=Informe de Records Management. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Informe de transferencia +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Informe de transferencia de Records Management. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Informe de destrucci\u00f3n +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Informe de destrucci\u00f3n de Records Management. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=Informe de bloqueo rmr_recordsmanagementreport.type.rmr_holdReport.description=Informe de bloqueo de Records Management. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_fr.properties index 48b8fd2f7b..0757d6e734 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_fr.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=Mod\u00e8le de contenu de rapport de gestion des archives - -rmr_recordsmanagementreport.type.rmr_report.title=Rapport -rmr_recordsmanagementreport.type.rmr_report.description=Rapport de gestion des archives - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapport de transfert -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapport de transfert de gestion des archives. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapport de destruction -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapport de destruction de gestion des archives. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Rapport de suspension +rmr_recordsmanagementreport.description=Mod\u00e8le de contenu de rapport de gestion des archives + +rmr_recordsmanagementreport.type.rmr_report.title=Rapport +rmr_recordsmanagementreport.type.rmr_report.description=Rapport de gestion des archives + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapport de transfert +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapport de transfert de gestion des archives. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapport de destruction +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapport de destruction de gestion des archives. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=Rapport de suspension rmr_recordsmanagementreport.type.rmr_holdReport.description=Rapport de suspension de gestion des archives. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_it.properties index 4d9809a39d..3fe3c3c354 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_it.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=Modello di contenuto per rapporti di Records Management - -rmr_recordsmanagementreport.type.rmr_report.title=Rapporto -rmr_recordsmanagementreport.type.rmr_report.description=Rapporto Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapporto di trasferimento -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapporto di trasferimento Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapporto di eliminazione definitiva -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapporto di eliminazione definitiva Records Management. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Rapporto di sospensione +rmr_recordsmanagementreport.description=Modello di contenuto per rapporti di Records Management + +rmr_recordsmanagementreport.type.rmr_report.title=Rapporto +rmr_recordsmanagementreport.type.rmr_report.description=Rapporto Records Management. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapporto di trasferimento +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapporto di trasferimento Records Management. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Rapporto di eliminazione definitiva +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Rapporto di eliminazione definitiva Records Management. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=Rapporto di sospensione rmr_recordsmanagementreport.type.rmr_holdReport.description=Rapporto di sospensione Records Management. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ja.properties index 1ca4879cc1..5850f9ea80 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ja.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u30ec\u30dd\u30fc\u30c8\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb - -rmr_recordsmanagementreport.type.rmr_report.title=\u30ec\u30dd\u30fc\u30c8 -rmr_recordsmanagementreport.type.rmr_report.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u30ec\u30dd\u30fc\u30c8\u3002 - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8 -rmr_recordsmanagementreport.type.rmr_destructionReport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8\u3002 - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8 -rmr_recordsmanagementreport.type.rmr_destructionReport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u3002 - -rmr_recordsmanagementreport.type.rmr_holdReport.title=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8 +rmr_recordsmanagementreport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u30ec\u30dd\u30fc\u30c8\u30b3\u30f3\u30c6\u30f3\u30c4\u30e2\u30c7\u30eb + +rmr_recordsmanagementreport.type.rmr_report.title=\u30ec\u30dd\u30fc\u30c8 +rmr_recordsmanagementreport.type.rmr_report.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u30ec\u30dd\u30fc\u30c8\u3002 + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8 +rmr_recordsmanagementreport.type.rmr_destructionReport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8\u3002 + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8 +rmr_recordsmanagementreport.type.rmr_destructionReport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u3002 + +rmr_recordsmanagementreport.type.rmr_holdReport.title=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8 rmr_recordsmanagementreport.type.rmr_holdReport.description=[\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406] \u306e\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties index 4fa9d9a18c..e7c579259f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=Oppf\u00f8ringsh\u00e5ndtering til innholdsmodellen - -rmr_recordsmanagementreport.type.rmr_report.title=Rapport -rmr_recordsmanagementreport.type.rmr_report.description=Oppf\u00f8ringsh\u00e5ndteringsrapport. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Overf\u00f8ringsrapport -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Oppf\u00f8ringsh\u00e5ndteringsrapport med overf\u00f8ringer. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Destruksjonsrapport -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Oppf\u00f8ringsh\u00e5ndteringsrapport med destruksjoner. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Holdrapport +rmr_recordsmanagementreport.description=Oppf\u00f8ringsh\u00e5ndtering til innholdsmodellen + +rmr_recordsmanagementreport.type.rmr_report.title=Rapport +rmr_recordsmanagementreport.type.rmr_report.description=Oppf\u00f8ringsh\u00e5ndteringsrapport. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Overf\u00f8ringsrapport +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Oppf\u00f8ringsh\u00e5ndteringsrapport med overf\u00f8ringer. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Destruksjonsrapport +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Oppf\u00f8ringsh\u00e5ndteringsrapport med destruksjoner. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=Holdrapport rmr_recordsmanagementreport.type.rmr_holdReport.description=Oppf\u00f8ringsh\u00e5ndteringsrapport med hold. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nl.properties index 7b693a464f..5eca5de2dc 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nl.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=Contentmodel Records Management-rapport - -rmr_recordsmanagementreport.type.rmr_report.title=Rapport -rmr_recordsmanagementreport.type.rmr_report.description=Records Management-rapport. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Overzetrapport -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management-overzetrapport. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Vernietigingsrapport -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management-vernietigingsrapport. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Wachtstandrapport +rmr_recordsmanagementreport.description=Contentmodel Records Management-rapport + +rmr_recordsmanagementreport.type.rmr_report.title=Rapport +rmr_recordsmanagementreport.type.rmr_report.description=Records Management-rapport. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Overzetrapport +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management-overzetrapport. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Vernietigingsrapport +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Records Management-vernietigingsrapport. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=Wachtstandrapport rmr_recordsmanagementreport.type.rmr_holdReport.description=Records Management-wachtstandrapport \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_pt_BR.properties index 386801ca24..6305d20799 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_pt_BR.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=Modelo do conte\u00fado do relat\u00f3rio do Records Management - -rmr_recordsmanagementreport.type.rmr_report.title=Relat\u00f3rio -rmr_recordsmanagementreport.type.rmr_report.description=Relat\u00f3rios do Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Relat\u00f3rio de transfer\u00eancia -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Relat\u00f3rio de transfer\u00eancia do Records Management. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Relat\u00f3rio de destrui\u00e7\u00e3o do Records Management. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Relat\u00f3rio de espera +rmr_recordsmanagementreport.description=Modelo do conte\u00fado do relat\u00f3rio do Records Management + +rmr_recordsmanagementreport.type.rmr_report.title=Relat\u00f3rio +rmr_recordsmanagementreport.type.rmr_report.description=Relat\u00f3rios do Records Management. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Relat\u00f3rio de transfer\u00eancia +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Relat\u00f3rio de transfer\u00eancia do Records Management. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o +rmr_recordsmanagementreport.type.rmr_destructionReport.description=Relat\u00f3rio de destrui\u00e7\u00e3o do Records Management. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=Relat\u00f3rio de espera rmr_recordsmanagementreport.type.rmr_holdReport.description=Relat\u00f3rio de espera do Records Management. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties index b4417bd85a..e695d6fb7e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043e\u0442\u0447\u0435\u0442\u0430 \u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -rmr_recordsmanagementreport.type.rmr_report.title=\u041e\u0442\u0447\u0435\u0442 -rmr_recordsmanagementreport.type.rmr_report.description=\u041e\u0442\u0447\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 -rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 -rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 +rmr_recordsmanagementreport.description=\u041c\u043e\u0434\u0435\u043b\u044c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043e\u0442\u0447\u0435\u0442\u0430 \u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 + +rmr_recordsmanagementreport.type.rmr_report.title=\u041e\u0442\u0447\u0435\u0442 +rmr_recordsmanagementreport.type.rmr_report.description=\u041e\u0442\u0447\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 +rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 +rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. + +rmr_recordsmanagementreport.type.rmr_holdReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 rmr_recordsmanagementreport.type.rmr_holdReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_zh_CN.properties index 5316a9e599..5e241bfe3a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/report-model_zh_CN.properties @@ -1,13 +1,13 @@ -rmr_recordsmanagementreport.description=\u8bb0\u5f55\u7ba1\u7406\u62a5\u544a\u5185\u5bb9\u6a21\u578b - -rmr_recordsmanagementreport.type.rmr_report.title=\u62a5\u544a -rmr_recordsmanagementreport.type.rmr_report.description=\u8bb0\u5f55\u7ba1\u7406\u62a5\u544a\u3002 - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u79fb\u4ea4\u62a5\u544a -rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u8bb0\u5f55\u7ba1\u7406\u79fb\u4ea4\u62a5\u544a\u3002 - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u9500\u6bc1\u62a5\u544a -rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u8bb0\u5f55\u7ba1\u7406\u9500\u6bc1\u62a5\u544a\u3002 - -rmr_recordsmanagementreport.type.rmr_holdReport.title=\u4fdd\u5b58\u62a5\u544a +rmr_recordsmanagementreport.description=\u8bb0\u5f55\u7ba1\u7406\u62a5\u544a\u5185\u5bb9\u6a21\u578b + +rmr_recordsmanagementreport.type.rmr_report.title=\u62a5\u544a +rmr_recordsmanagementreport.type.rmr_report.description=\u8bb0\u5f55\u7ba1\u7406\u62a5\u544a\u3002 + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u79fb\u4ea4\u62a5\u544a +rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u8bb0\u5f55\u7ba1\u7406\u79fb\u4ea4\u62a5\u544a\u3002 + +rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u9500\u6bc1\u62a5\u544a +rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u8bb0\u5f55\u7ba1\u7406\u9500\u6bc1\u62a5\u544a\u3002 + +rmr_recordsmanagementreport.type.rmr_holdReport.title=\u4fdd\u5b58\u62a5\u544a rmr_recordsmanagementreport.type.rmr_holdReport.description=\u8bb0\u5f55\u7ba1\u7406\u4fdd\u5b58\u62a5\u544a\u3002 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions.properties index f26c15c0fa..34f97a8c2c 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=Cut Off -cutoff.description=Cut Off -retain.title=Retain -retain.description=Retain -destroy.title=Destroy -destroy.description=Destroy - +# Retention Actions +cutoff.title=Cut Off +cutoff.description=Cut Off +retain.title=Retain +retain.description=Retain +destroy.title=Destroy +destroy.description=Destroy + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_de.properties index 6c5dc7dbb5..b3f4e0ea58 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_de.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=Trennen -cutoff.description=Trennen -retain.title=Aufbewahren -retain.description=Aufbewahren -destroy.title=Vernichten -destroy.description=Vernichten - +# Retention Actions +cutoff.title=Trennen +cutoff.description=Trennen +retain.title=Aufbewahren +retain.description=Aufbewahren +destroy.title=Vernichten +destroy.description=Vernichten + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_es.properties index 9926210341..5864fa03f3 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_es.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=Interrumpir -cutoff.description=Interrumpir -retain.title=Retener -retain.description=Retener -destroy.title=Destruir -destroy.description=Destruir - +# Retention Actions +cutoff.title=Interrumpir +cutoff.description=Interrumpir +retain.title=Retener +retain.description=Retener +destroy.title=Destruir +destroy.description=Destruir + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_fr.properties index 9e7a3e0e5f..b86b687a3a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_fr.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=D\u00e9classer -cutoff.description=D\u00e9classer -retain.title=Retenir -retain.description=Retenir -destroy.title=D\u00e9truire -destroy.description=D\u00e9truire - +# Retention Actions +cutoff.title=D\u00e9classer +cutoff.description=D\u00e9classer +retain.title=Retenir +retain.description=Retenir +destroy.title=D\u00e9truire +destroy.description=D\u00e9truire + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_it.properties index 2f89ddfd51..ff17b5bab8 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_it.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=Cut off -cutoff.description=Cut off -retain.title=Conserva -retain.description=Conserva -destroy.title=Elimina definitivamente -destroy.description=Elimina definitivamente - +# Retention Actions +cutoff.title=Cut off +cutoff.description=Cut off +retain.title=Conserva +retain.description=Conserva +destroy.title=Elimina definitivamente +destroy.description=Elimina definitivamente + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ja.properties index b089273f09..70b4db447d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ja.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 -cutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5 -retain.title=\u4fdd\u7ba1 -retain.description=\u4fdd\u7ba1 -destroy.title=\u7834\u68c4 -destroy.description=\u7834\u68c4 - +# Retention Actions +cutoff.title=\u30ab\u30c3\u30c8\u30aa\u30d5 +cutoff.description=\u30ab\u30c3\u30c8\u30aa\u30d5 +retain.title=\u4fdd\u7ba1 +retain.description=\u4fdd\u7ba1 +destroy.title=\u7834\u68c4 +destroy.description=\u7834\u68c4 + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties index 7ffb94561d..51d817a8ca 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=Cut off -cutoff.description=Cut off -retain.title=Behold -retain.description=Behold -destroy.title=Destruer -destroy.description=Destruer - +# Retention Actions +cutoff.title=Cut off +cutoff.description=Cut off +retain.title=Behold +retain.description=Behold +destroy.title=Destruer +destroy.description=Destruer + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nl.properties index 42235c182d..77644e5178 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nl.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=Afsluiten -cutoff.description=Afsluiten -retain.title=Behouden -retain.description=Behouden -destroy.title=Vernietigen -destroy.description=Vernietigen - +# Retention Actions +cutoff.title=Afsluiten +cutoff.description=Afsluiten +retain.title=Behouden +retain.description=Behouden +destroy.title=Vernietigen +destroy.description=Vernietigen + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_pt_BR.properties index 065235577f..59b77b8f87 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_pt_BR.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=Cortar -cutoff.description=Cortar -retain.title=Manter -retain.description=Manter -destroy.title=Destruir -destroy.description=Destruir - +# Retention Actions +cutoff.title=Cortar +cutoff.description=Cortar +retain.title=Manter +retain.description=Manter +destroy.title=Destruir +destroy.description=Destruir + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ru.properties index 0572749ee6..2e084377df 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_ru.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -cutoff.description=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c -retain.title=\u0425\u0440\u0430\u043d\u0438\u0442\u044c -retain.description=\u0425\u0440\u0430\u043d\u0438\u0442\u044c -destroy.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c -destroy.description=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c - +# Retention Actions +cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c +cutoff.description=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c +retain.title=\u0425\u0440\u0430\u043d\u0438\u0442\u044c +retain.description=\u0425\u0440\u0430\u043d\u0438\u0442\u044c +destroy.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c +destroy.description=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_zh_CN.properties index 9ab89514c1..f87c7d5c18 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_zh_CN.properties @@ -1,8 +1,8 @@ -# Retention Actions -cutoff.title=\u4e2d\u65ad -cutoff.description=\u4e2d\u65ad -retain.title=\u4fdd\u7559 -retain.description=\u4fdd\u7559 -destroy.title=\u9500\u6bc1 -destroy.description=\u9500\u6bc1 - +# Retention Actions +cutoff.title=\u4e2d\u65ad +cutoff.description=\u4e2d\u65ad +retain.title=\u4fdd\u7559 +retain.description=\u4fdd\u7559 +destroy.title=\u9500\u6bc1 +destroy.description=\u9500\u6bc1 + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties index 970902e42d..ea0094fc86 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=Simple Event -rmeventservice.rmEventType.obsolete=Obsoleted Event -rmeventservice.rmEventType.superseded=Superseded Event -rmeventservice.rmEventType.crossReferencedRecordTransfered=Cross-Referenced Record Transferred -rmeventservice.rmEventType.versioned=Versioned Event - -# Default events -rmevent.case_closed=Case Closed -rmevent.abolished=Abolished -rmevent.re_designated=Redesignated -rmevent.no_longer_needed=No Longer Needed -rmevent.superseded=Superseded -rmevent.versioned=Versioned -rmevent.study_complete=Study Complete -rmevent.training_complete=Training Complete -rmevent.related_record_trasfered_inactive_storage=Related Record Transferred to Inactive Storage -rmevent.obsolete=Obsolete -rmevent.all_allowances_granted_are_terminated=All Allowances Granted are Terminated -rmevent.WGI_action_complete=WGI Action Complete -rmevent.separation=Separation +# Event Types +rmeventservice.rmEventType.simple=Simple Event +rmeventservice.rmEventType.obsolete=Obsoleted Event +rmeventservice.rmEventType.superseded=Superseded Event +rmeventservice.rmEventType.crossReferencedRecordTransfered=Cross-Referenced Record Transferred +rmeventservice.rmEventType.versioned=Versioned Event + +# Default events +rmevent.case_closed=Case Closed +rmevent.abolished=Abolished +rmevent.re_designated=Redesignated +rmevent.no_longer_needed=No Longer Needed +rmevent.superseded=Superseded +rmevent.versioned=Versioned +rmevent.study_complete=Study Complete +rmevent.training_complete=Training Complete +rmevent.related_record_trasfered_inactive_storage=Related Record Transferred to Inactive Storage +rmevent.obsolete=Obsolete +rmevent.all_allowances_granted_are_terminated=All Allowances Granted are Terminated +rmevent.WGI_action_complete=WGI Action Complete +rmevent.separation=Separation rmevent.case_complete=Case Complete \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties index 1678403242..3b4f3490dd 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=Einfaches Ereignis -rmeventservice.rmEventType.obsolete=Ereignis mit veraltetem Record -rmeventservice.rmEventType.superseded=Ereignis mit abgel\u00f6stem Record -rmeventservice.rmEventType.crossReferencedRecordTransfered=Record mit Querverweis \u00fcbertragen -rmeventservice.rmEventType.versioned=Versioniertes Ereignis - -# Default events -rmevent.case_closed=Fall geschlossen -rmevent.abolished=Aufgehoben -rmevent.re_designated=Neu zugewiesen -rmevent.no_longer_needed=Nicht mehr ben\u00f6tigt -rmevent.superseded=Abgel\u00f6st -rmevent.versioned=Versioniert -rmevent.study_complete=Untersuchung abgeschlossen -rmevent.training_complete=Training abgeschlossen -rmevent.related_record_trasfered_inactive_storage=Zugeh\u00f6riger Record an inaktiven Speicherort \u00fcbertragen -rmevent.obsolete=Veraltet -rmevent.all_allowances_granted_are_terminated=Alle einger\u00e4umten Berechtigungen sind beendet. -rmevent.WGI_action_complete=WGI-Aktion abschlie\u00dfen -rmevent.separation=Trennung +# Event Types +rmeventservice.rmEventType.simple=Einfaches Ereignis +rmeventservice.rmEventType.obsolete=Ereignis mit veraltetem Record +rmeventservice.rmEventType.superseded=Ereignis mit abgel\u00f6stem Record +rmeventservice.rmEventType.crossReferencedRecordTransfered=Record mit Querverweis \u00fcbertragen +rmeventservice.rmEventType.versioned=Versioniertes Ereignis + +# Default events +rmevent.case_closed=Fall geschlossen +rmevent.abolished=Aufgehoben +rmevent.re_designated=Neu zugewiesen +rmevent.no_longer_needed=Nicht mehr ben\u00f6tigt +rmevent.superseded=Abgel\u00f6st +rmevent.versioned=Versioniert +rmevent.study_complete=Untersuchung abgeschlossen +rmevent.training_complete=Training abgeschlossen +rmevent.related_record_trasfered_inactive_storage=Zugeh\u00f6riger Record an inaktiven Speicherort \u00fcbertragen +rmevent.obsolete=Veraltet +rmevent.all_allowances_granted_are_terminated=Alle einger\u00e4umten Berechtigungen sind beendet. +rmevent.WGI_action_complete=WGI-Aktion abschlie\u00dfen +rmevent.separation=Trennung rmevent.case_complete=Fall abgeschlossen \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties index f712f35a5c..e16251ccf9 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=Evento simple -rmeventservice.rmEventType.obsolete=Evento obsoleto -rmeventservice.rmEventType.superseded=Evento reemplazado -rmeventservice.rmEventType.crossReferencedRecordTransfered=Documento de archivo con referencia cruzada transferido -rmeventservice.rmEventType.versioned=Evento versionado - -# Default events -rmevent.case_closed=Caso cerrado -rmevent.abolished=Abolido -rmevent.re_designated=Redise\u00f1ado -rmevent.no_longer_needed=Ya no se necesita -rmevent.superseded=Reemplazado -rmevent.versioned=Versionado -rmevent.study_complete=Estudio completo -rmevent.training_complete=Formaci\u00f3n completo -rmevent.related_record_trasfered_inactive_storage=Documento de archivo relacionado transferido a almacenamiento inactivo -rmevent.obsolete=Obsoleto -rmevent.all_allowances_granted_are_terminated=Todas las provisiones otorgadas han terminado -rmevent.WGI_action_complete=Acci\u00f3n WGI completa -rmevent.separation=Separaci\u00f3n +# Event Types +rmeventservice.rmEventType.simple=Evento simple +rmeventservice.rmEventType.obsolete=Evento obsoleto +rmeventservice.rmEventType.superseded=Evento reemplazado +rmeventservice.rmEventType.crossReferencedRecordTransfered=Documento de archivo con referencia cruzada transferido +rmeventservice.rmEventType.versioned=Evento versionado + +# Default events +rmevent.case_closed=Caso cerrado +rmevent.abolished=Abolido +rmevent.re_designated=Redise\u00f1ado +rmevent.no_longer_needed=Ya no se necesita +rmevent.superseded=Reemplazado +rmevent.versioned=Versionado +rmevent.study_complete=Estudio completo +rmevent.training_complete=Formaci\u00f3n completo +rmevent.related_record_trasfered_inactive_storage=Documento de archivo relacionado transferido a almacenamiento inactivo +rmevent.obsolete=Obsoleto +rmevent.all_allowances_granted_are_terminated=Todas las provisiones otorgadas han terminado +rmevent.WGI_action_complete=Acci\u00f3n WGI completa +rmevent.separation=Separaci\u00f3n rmevent.case_complete=Caso completo \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties index a18d97bb55..332a8dfb6a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=Ev\u00e9nement simple -rmeventservice.rmEventType.obsolete=Ev\u00e9nement obsol\u00e8te -rmeventservice.rmEventType.superseded=Ev\u00e9nement remplac\u00e9 -rmeventservice.rmEventType.crossReferencedRecordTransfered=Document d'archives avec r\u00e9f\u00e9rence crois\u00e9e transf\u00e9r\u00e9 -rmeventservice.rmEventType.versioned=Ev\u00e9nement versionn\u00e9 - -# Default events -rmevent.case_closed=Cas clos -rmevent.abolished=Aboli -rmevent.re_designated=Renomm\u00e9 -rmevent.no_longer_needed=Plus n\u00e9cessaire -rmevent.superseded=Remplac\u00e9 -rmevent.versioned=Versionn\u00e9 -rmevent.study_complete=Etude termin\u00e9e -rmevent.training_complete=Formation termin\u00e9e -rmevent.related_record_trasfered_inactive_storage=Document d'archives li\u00e9 transf\u00e9r\u00e9 au stockage inactif -rmevent.obsolete=Obsol\u00e8te -rmevent.all_allowances_granted_are_terminated=Toutes les autorisations accord\u00e9es sont termin\u00e9es -rmevent.WGI_action_complete=Action WGI termin\u00e9e -rmevent.separation=S\u00e9paration +# Event Types +rmeventservice.rmEventType.simple=Ev\u00e9nement simple +rmeventservice.rmEventType.obsolete=Ev\u00e9nement obsol\u00e8te +rmeventservice.rmEventType.superseded=Ev\u00e9nement remplac\u00e9 +rmeventservice.rmEventType.crossReferencedRecordTransfered=Document d'archives avec r\u00e9f\u00e9rence crois\u00e9e transf\u00e9r\u00e9 +rmeventservice.rmEventType.versioned=Ev\u00e9nement versionn\u00e9 + +# Default events +rmevent.case_closed=Cas clos +rmevent.abolished=Aboli +rmevent.re_designated=Renomm\u00e9 +rmevent.no_longer_needed=Plus n\u00e9cessaire +rmevent.superseded=Remplac\u00e9 +rmevent.versioned=Versionn\u00e9 +rmevent.study_complete=Etude termin\u00e9e +rmevent.training_complete=Formation termin\u00e9e +rmevent.related_record_trasfered_inactive_storage=Document d'archives li\u00e9 transf\u00e9r\u00e9 au stockage inactif +rmevent.obsolete=Obsol\u00e8te +rmevent.all_allowances_granted_are_terminated=Toutes les autorisations accord\u00e9es sont termin\u00e9es +rmevent.WGI_action_complete=Action WGI termin\u00e9e +rmevent.separation=S\u00e9paration rmevent.case_complete=Cas termin\u00e9 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties index 11fc965165..606bd6cb2d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=Evento semplice -rmeventservice.rmEventType.obsolete=Evento obsoleto -rmeventservice.rmEventType.superseded=Evento sostituito -rmeventservice.rmEventType.crossReferencedRecordTransfered=Record con rif. incrociati trasferito -rmeventservice.rmEventType.versioned=Evento con versione - -# Default events -rmevent.case_closed=Caso chiuso -rmevent.abolished=Abolito -rmevent.re_designated=Riprogettato -rmevent.no_longer_needed=Non pi\u00f9 necessario -rmevent.superseded=Sostituito -rmevent.versioned=Con versione -rmevent.study_complete=Studio completato -rmevent.training_complete=Training Completato -rmevent.related_record_trasfered_inactive_storage=Record correlato trasferito a Archiviazione inattiva -rmevent.obsolete=Obsoleto -rmevent.all_allowances_granted_are_terminated=Tutte le concessioni sono state terminate -rmevent.WGI_action_complete=Azione WGI completata -rmevent.separation=Separazione +# Event Types +rmeventservice.rmEventType.simple=Evento semplice +rmeventservice.rmEventType.obsolete=Evento obsoleto +rmeventservice.rmEventType.superseded=Evento sostituito +rmeventservice.rmEventType.crossReferencedRecordTransfered=Record con rif. incrociati trasferito +rmeventservice.rmEventType.versioned=Evento con versione + +# Default events +rmevent.case_closed=Caso chiuso +rmevent.abolished=Abolito +rmevent.re_designated=Riprogettato +rmevent.no_longer_needed=Non pi\u00f9 necessario +rmevent.superseded=Sostituito +rmevent.versioned=Con versione +rmevent.study_complete=Studio completato +rmevent.training_complete=Training Completato +rmevent.related_record_trasfered_inactive_storage=Record correlato trasferito a Archiviazione inattiva +rmevent.obsolete=Obsoleto +rmevent.all_allowances_granted_are_terminated=Tutte le concessioni sono state terminate +rmevent.WGI_action_complete=Azione WGI completata +rmevent.separation=Separazione rmevent.case_complete=Caso completato \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties index 55e7a5fd32..00b71722b5 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=\u7c21\u6613\u30a4\u30d9\u30f3\u30c8 -rmeventservice.rmEventType.obsolete=\u5ec3\u6b62\u30a4\u30d9\u30f3\u30c8 -rmeventservice.rmEventType.superseded=\u5dee\u3057\u66ff\u3048\u30a4\u30d9\u30f3\u30c8 -rmeventservice.rmEventType.crossReferencedRecordTransfered=\u76f8\u4e92\u53c2\u7167\u30ec\u30b3\u30fc\u30c9\u306e\u8ee2\u9001 -rmeventservice.rmEventType.versioned=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30a4\u30d9\u30f3\u30c8 - -# Default events -rmevent.case_closed=\u30b1\u30fc\u30b9\u7d42\u4e86 -rmevent.abolished=\u5ec3\u6b62 -rmevent.re_designated=\u518d\u6307\u5b9a -rmevent.no_longer_needed=\u4eca\u5f8c\u4e0d\u8981 -rmevent.superseded=\u5dee\u3057\u66ff\u3048 -rmevent.versioned=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406 -rmevent.study_complete=\u5b66\u7fd2\u5b8c\u4e86 -rmevent.training_complete=\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u5b8c\u4e86 -rmevent.related_record_trasfered_inactive_storage=\u95a2\u9023\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u8ee2\u9001 -rmevent.obsolete=\u5ec3\u6b62 -rmevent.all_allowances_granted_are_terminated=\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u51e6\u7406\u304c\u7d42\u4e86 -rmevent.WGI_action_complete=WGI \u51e6\u7406\u5b8c\u4e86 -rmevent.separation=\u5206\u96e2 +# Event Types +rmeventservice.rmEventType.simple=\u7c21\u6613\u30a4\u30d9\u30f3\u30c8 +rmeventservice.rmEventType.obsolete=\u5ec3\u6b62\u30a4\u30d9\u30f3\u30c8 +rmeventservice.rmEventType.superseded=\u5dee\u3057\u66ff\u3048\u30a4\u30d9\u30f3\u30c8 +rmeventservice.rmEventType.crossReferencedRecordTransfered=\u76f8\u4e92\u53c2\u7167\u30ec\u30b3\u30fc\u30c9\u306e\u8ee2\u9001 +rmeventservice.rmEventType.versioned=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u30a4\u30d9\u30f3\u30c8 + +# Default events +rmevent.case_closed=\u30b1\u30fc\u30b9\u7d42\u4e86 +rmevent.abolished=\u5ec3\u6b62 +rmevent.re_designated=\u518d\u6307\u5b9a +rmevent.no_longer_needed=\u4eca\u5f8c\u4e0d\u8981 +rmevent.superseded=\u5dee\u3057\u66ff\u3048 +rmevent.versioned=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406 +rmevent.study_complete=\u5b66\u7fd2\u5b8c\u4e86 +rmevent.training_complete=\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u5b8c\u4e86 +rmevent.related_record_trasfered_inactive_storage=\u95a2\u9023\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u8ee2\u9001 +rmevent.obsolete=\u5ec3\u6b62 +rmevent.all_allowances_granted_are_terminated=\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u51e6\u7406\u304c\u7d42\u4e86 +rmevent.WGI_action_complete=WGI \u51e6\u7406\u5b8c\u4e86 +rmevent.separation=\u5206\u96e2 rmevent.case_complete=\u30b1\u30fc\u30b9\u5b8c\u4e86 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties index 48374749cf..3191fd332b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=Enkel hendelse -rmeventservice.rmEventType.obsolete=Utg\u00e5tt hendelse -rmeventservice.rmEventType.superseded=Erstattet hendelse -rmeventservice.rmEventType.crossReferencedRecordTransfered=Oppf\u00f8ring med krysshenvisninger er overf\u00f8rt -rmeventservice.rmEventType.versioned=Oppf\u00f8ring med hendelse - -# Default events -rmevent.case_closed=Sak avslutt -rmevent.abolished=Avskaffet -rmevent.re_designated=Angitt p\u00e5 nytt -rmevent.no_longer_needed=Ikke lenger n\u00f8dvendig -rmevent.superseded=Erstattet -rmevent.versioned=Med versjon -rmevent.study_complete=Studie fullf\u00f8rt -rmevent.training_complete=Oppl\u00e6ring fullf\u00f8rt -rmevent.related_record_trasfered_inactive_storage=Relatert oppf\u00f8ring overf\u00f8rt til inaktiv lagring -rmevent.obsolete=Utg\u00e5tt -rmevent.all_allowances_granted_are_terminated=Alle tillatelser som er gitt, er avsluttet -rmevent.WGI_action_complete=WGI-handling fullf\u00f8rt -rmevent.separation=Separasjon +# Event Types +rmeventservice.rmEventType.simple=Enkel hendelse +rmeventservice.rmEventType.obsolete=Utg\u00e5tt hendelse +rmeventservice.rmEventType.superseded=Erstattet hendelse +rmeventservice.rmEventType.crossReferencedRecordTransfered=Oppf\u00f8ring med krysshenvisninger er overf\u00f8rt +rmeventservice.rmEventType.versioned=Oppf\u00f8ring med hendelse + +# Default events +rmevent.case_closed=Sak avslutt +rmevent.abolished=Avskaffet +rmevent.re_designated=Angitt p\u00e5 nytt +rmevent.no_longer_needed=Ikke lenger n\u00f8dvendig +rmevent.superseded=Erstattet +rmevent.versioned=Med versjon +rmevent.study_complete=Studie fullf\u00f8rt +rmevent.training_complete=Oppl\u00e6ring fullf\u00f8rt +rmevent.related_record_trasfered_inactive_storage=Relatert oppf\u00f8ring overf\u00f8rt til inaktiv lagring +rmevent.obsolete=Utg\u00e5tt +rmevent.all_allowances_granted_are_terminated=Alle tillatelser som er gitt, er avsluttet +rmevent.WGI_action_complete=WGI-handling fullf\u00f8rt +rmevent.separation=Separasjon rmevent.case_complete=Sak fullf\u00f8rt \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties index 6f5894c01d..6d3aefb5e0 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=Eenvoudige gebeurtenis -rmeventservice.rmEventType.obsolete=Verouderde gebeurtenis -rmeventservice.rmEventType.superseded=Vervangen gebeurtenis -rmeventservice.rmEventType.crossReferencedRecordTransfered=Record met kruisverwijzing overgezet -rmeventservice.rmEventType.versioned=Gebeurtenis met versiebeheer - -# Default events -rmevent.case_closed=Geval gesloten -rmevent.abolished=Vervallen -rmevent.re_designated=Opnieuw aangewezen -rmevent.no_longer_needed=Niet langer nodig -rmevent.superseded=Vervangen -rmevent.versioned=Met versiebeheer -rmevent.study_complete=Onderzoek afgerond -rmevent.training_complete=Training afgerond -rmevent.related_record_trasfered_inactive_storage=Gerelateerde record overgezet naar inactieve opslag -rmevent.obsolete=Verouderd -rmevent.all_allowances_granted_are_terminated=Alle toegekende rechten zijn be\u00ebindigd -rmevent.WGI_action_complete=WGI-actie afgerond -rmevent.separation=Scheiding +# Event Types +rmeventservice.rmEventType.simple=Eenvoudige gebeurtenis +rmeventservice.rmEventType.obsolete=Verouderde gebeurtenis +rmeventservice.rmEventType.superseded=Vervangen gebeurtenis +rmeventservice.rmEventType.crossReferencedRecordTransfered=Record met kruisverwijzing overgezet +rmeventservice.rmEventType.versioned=Gebeurtenis met versiebeheer + +# Default events +rmevent.case_closed=Geval gesloten +rmevent.abolished=Vervallen +rmevent.re_designated=Opnieuw aangewezen +rmevent.no_longer_needed=Niet langer nodig +rmevent.superseded=Vervangen +rmevent.versioned=Met versiebeheer +rmevent.study_complete=Onderzoek afgerond +rmevent.training_complete=Training afgerond +rmevent.related_record_trasfered_inactive_storage=Gerelateerde record overgezet naar inactieve opslag +rmevent.obsolete=Verouderd +rmevent.all_allowances_granted_are_terminated=Alle toegekende rechten zijn be\u00ebindigd +rmevent.WGI_action_complete=WGI-actie afgerond +rmevent.separation=Scheiding rmevent.case_complete=Geval afgerond \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties index 6c41bac492..2945e4edde 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=Evento simples -rmeventservice.rmEventType.obsolete=Evento obsoleto -rmeventservice.rmEventType.superseded=Evento substitu\u00eddo -rmeventservice.rmEventType.crossReferencedRecordTransfered=Documento arquiv\u00edstico com refer\u00eancia cruzada transferido -rmeventservice.rmEventType.versioned=Evento em vers\u00e3o - -# Default events -rmevent.case_closed=Caso fechado -rmevent.abolished=Abolido -rmevent.re_designated=Redesignado -rmevent.no_longer_needed=N\u00e3o mais necess\u00e1rio -rmevent.superseded=Substitu\u00eddo -rmevent.versioned=Em vers\u00e3o -rmevent.study_complete=Estudo conclu\u00eddo -rmevent.training_complete=Treinamento conclu\u00eddo -rmevent.related_record_trasfered_inactive_storage=Documento arquiv\u00edstico relacionado transferido para armazenamento inativo -rmevent.obsolete=Obsoleto -rmevent.all_allowances_granted_are_terminated=Todas as bonifica\u00e7\u00f5es concedidas s\u00e3o rescindidas -rmevent.WGI_action_complete=A\u00e7\u00e3o de WGI conclu\u00edda -rmevent.separation=Separa\u00e7\u00e3o +# Event Types +rmeventservice.rmEventType.simple=Evento simples +rmeventservice.rmEventType.obsolete=Evento obsoleto +rmeventservice.rmEventType.superseded=Evento substitu\u00eddo +rmeventservice.rmEventType.crossReferencedRecordTransfered=Documento arquiv\u00edstico com refer\u00eancia cruzada transferido +rmeventservice.rmEventType.versioned=Evento em vers\u00e3o + +# Default events +rmevent.case_closed=Caso fechado +rmevent.abolished=Abolido +rmevent.re_designated=Redesignado +rmevent.no_longer_needed=N\u00e3o mais necess\u00e1rio +rmevent.superseded=Substitu\u00eddo +rmevent.versioned=Em vers\u00e3o +rmevent.study_complete=Estudo conclu\u00eddo +rmevent.training_complete=Treinamento conclu\u00eddo +rmevent.related_record_trasfered_inactive_storage=Documento arquiv\u00edstico relacionado transferido para armazenamento inativo +rmevent.obsolete=Obsoleto +rmevent.all_allowances_granted_are_terminated=Todas as bonifica\u00e7\u00f5es concedidas s\u00e3o rescindidas +rmevent.WGI_action_complete=A\u00e7\u00e3o de WGI conclu\u00edda +rmevent.separation=Separa\u00e7\u00e3o rmevent.case_complete=Caso conclu\u00eddo \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties index 14fca49876..de4281e217 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rmeventservice.rmEventType.obsolete=\u0423\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rmeventservice.rmEventType.superseded=\u0417\u0430\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 -rmeventservice.rmEventType.crossReferencedRecordTransfered=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043f\u0435\u0440\u0435\u043a\u0440\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 -rmeventservice.rmEventType.versioned=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 - -# Default events -rmevent.case_closed=\u0421\u043b\u0443\u0447\u0430\u0439 \u0437\u0430\u043a\u0440\u044b\u0442 -rmevent.abolished=\u041e\u0442\u043c\u0435\u043d\u0435\u043d\u043e -rmevent.re_designated=\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043e -rmevent.no_longer_needed=\u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f -rmevent.superseded=\u0417\u0430\u043c\u0435\u043d\u0435\u043d\u043e -rmevent.versioned=\u0421 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 -rmevent.study_complete=\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e -rmevent.training_complete=\u041a\u0443\u0440\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d -rmevent.related_record_trasfered_inactive_storage=\u0421\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0432 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 -rmevent.obsolete=\u0423\u0441\u0442\u0430\u0440\u0435\u043b\u043e -rmevent.all_allowances_granted_are_terminated=\u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u0432\u043e\u0442\u044b \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u044b -rmevent.WGI_action_complete=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 WGI \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e -rmevent.separation=\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 +# Event Types +rmeventservice.rmEventType.simple=\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +rmeventservice.rmEventType.obsolete=\u0423\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +rmeventservice.rmEventType.superseded=\u0417\u0430\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 +rmeventservice.rmEventType.crossReferencedRecordTransfered=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043f\u0435\u0440\u0435\u043a\u0440\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 +rmeventservice.rmEventType.versioned=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 + +# Default events +rmevent.case_closed=\u0421\u043b\u0443\u0447\u0430\u0439 \u0437\u0430\u043a\u0440\u044b\u0442 +rmevent.abolished=\u041e\u0442\u043c\u0435\u043d\u0435\u043d\u043e +rmevent.re_designated=\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043e +rmevent.no_longer_needed=\u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f +rmevent.superseded=\u0417\u0430\u043c\u0435\u043d\u0435\u043d\u043e +rmevent.versioned=\u0421 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 +rmevent.study_complete=\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e +rmevent.training_complete=\u041a\u0443\u0440\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d +rmevent.related_record_trasfered_inactive_storage=\u0421\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0432 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 +rmevent.obsolete=\u0423\u0441\u0442\u0430\u0440\u0435\u043b\u043e +rmevent.all_allowances_granted_are_terminated=\u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u0432\u043e\u0442\u044b \u043e\u0442\u043c\u0435\u043d\u0435\u043d\u044b +rmevent.WGI_action_complete=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 WGI \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e +rmevent.separation=\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 rmevent.case_complete=\u0421\u043b\u0443\u0447\u0430\u0439 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties index 54cebe098e..8bfcff9dff 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties @@ -1,22 +1,22 @@ -# Event Types -rmeventservice.rmEventType.simple=\u7b80\u5355\u4e8b\u4ef6 -rmeventservice.rmEventType.obsolete=\u8fc7\u65f6\u7684\u4e8b\u4ef6 -rmeventservice.rmEventType.superseded=\u88ab\u53d6\u4ee3\u7684\u4e8b\u4ef6 -rmeventservice.rmEventType.crossReferencedRecordTransfered=\u5df2\u79fb\u4ea4\u4ea4\u53c9\u53c2\u8003\u8bb0\u5f55 -rmeventservice.rmEventType.versioned=\u7248\u672c\u5316\u4e8b\u4ef6 - -# Default events -rmevent.case_closed=\u6848\u4f8b\u5df2\u7ed3 -rmevent.abolished=\u5df2\u5e9f\u9664 -rmevent.re_designated=\u5df2\u91cd\u65b0\u6307\u5b9a -rmevent.no_longer_needed=\u4e0d\u518d\u9700\u8981 -rmevent.superseded=\u5df2\u88ab\u53d6\u4ee3 -rmevent.versioned=\u7248\u672c\u5316 -rmevent.study_complete=\u5b66\u4e60\u5b8c\u6210 -rmevent.training_complete=\u57f9\u8bad\u5b8c\u6210 -rmevent.related_record_trasfered_inactive_storage=\u76f8\u5173\u8bb0\u5f55\u5df2\u79fb\u4ea4\u81f3\u4e0d\u6d3b\u52a8\u7684\u5b58\u50a8 -rmevent.obsolete=\u8fc7\u65f6 -rmevent.all_allowances_granted_are_terminated=\u6240\u6709\u6388\u4e88\u7684\u9650\u989d\u5df2\u7ec8\u6b62 -rmevent.WGI_action_complete=WGI \u64cd\u4f5c\u5b8c\u6210 -rmevent.separation=\u5206\u79bb +# Event Types +rmeventservice.rmEventType.simple=\u7b80\u5355\u4e8b\u4ef6 +rmeventservice.rmEventType.obsolete=\u8fc7\u65f6\u7684\u4e8b\u4ef6 +rmeventservice.rmEventType.superseded=\u88ab\u53d6\u4ee3\u7684\u4e8b\u4ef6 +rmeventservice.rmEventType.crossReferencedRecordTransfered=\u5df2\u79fb\u4ea4\u4ea4\u53c9\u53c2\u8003\u8bb0\u5f55 +rmeventservice.rmEventType.versioned=\u7248\u672c\u5316\u4e8b\u4ef6 + +# Default events +rmevent.case_closed=\u6848\u4f8b\u5df2\u7ed3 +rmevent.abolished=\u5df2\u5e9f\u9664 +rmevent.re_designated=\u5df2\u91cd\u65b0\u6307\u5b9a +rmevent.no_longer_needed=\u4e0d\u518d\u9700\u8981 +rmevent.superseded=\u5df2\u88ab\u53d6\u4ee3 +rmevent.versioned=\u7248\u672c\u5316 +rmevent.study_complete=\u5b66\u4e60\u5b8c\u6210 +rmevent.training_complete=\u57f9\u8bad\u5b8c\u6210 +rmevent.related_record_trasfered_inactive_storage=\u76f8\u5173\u8bb0\u5f55\u5df2\u79fb\u4ea4\u81f3\u4e0d\u6d3b\u52a8\u7684\u5b58\u50a8 +rmevent.obsolete=\u8fc7\u65f6 +rmevent.all_allowances_granted_are_terminated=\u6240\u6709\u6388\u4e88\u7684\u9650\u989d\u5df2\u7ec8\u6b62 +rmevent.WGI_action_complete=WGI \u64cd\u4f5c\u5b8c\u6210 +rmevent.separation=\u5206\u79bb rmevent.case_complete=\u6848\u4f8b\u5b8c\u6210 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system.properties index f0d113973a..727ce24344 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system.properties @@ -1,25 +1,25 @@ -rm.hold.name=Hold - -## Default roles -rm.role.extendedReaders=In-Place Readers -rm.role.extendedWriters=In-Place Writers -rm.role.user=Records Management User -rm.role.powerUser=Records Management Power User -rm.role.securityOfficer=Records Management Security Officer -rm.role.recordsManager=Records Management Manager -rm.role.administrator=Records Management Administrator -rm.role.all=All Records Management Roles - -## Default searches -rm.savedsearch.vitalRecordsName=Vital Records due for Review -rm.savedsearch.vitalRecordsDesc=All records currently due for review. -rm.savedsearch.incompleteRecordsName=Incomplete Records -rm.savedsearch.incompleteRecordsDesc=All incomplete records. -rm.savedsearch.cutoffRecordsName=Records and Record Folders Eligible for Cut Off -rm.savedsearch.cutoffRecordsDesc=All records and record folders currently eligible for cut off. -rm.savedsearch.transferRecordsName=Records and Record Folders Eligible for Transfer -rm.savedsearch.transferRecordsDesc=All record folders and records currently eligible for transfer. -rm.savedsearch.destructionRecordsName=Records and Record Folders Eligible for Destruction -rm.savedsearch.destructionRecordsDesc=All records currently eligible for destruction. -rm.savedsearch.frozenRecordsName= Records and Record Folders On Hold +rm.hold.name=Hold + +## Default roles +rm.role.extendedReaders=In-Place Readers +rm.role.extendedWriters=In-Place Writers +rm.role.user=Records Management User +rm.role.powerUser=Records Management Power User +rm.role.securityOfficer=Records Management Security Officer +rm.role.recordsManager=Records Management Manager +rm.role.administrator=Records Management Administrator +rm.role.all=All Records Management Roles + +## Default searches +rm.savedsearch.vitalRecordsName=Vital Records due for Review +rm.savedsearch.vitalRecordsDesc=All records currently due for review. +rm.savedsearch.incompleteRecordsName=Incomplete Records +rm.savedsearch.incompleteRecordsDesc=All incomplete records. +rm.savedsearch.cutoffRecordsName=Records and Record Folders Eligible for Cut Off +rm.savedsearch.cutoffRecordsDesc=All records and record folders currently eligible for cut off. +rm.savedsearch.transferRecordsName=Records and Record Folders Eligible for Transfer +rm.savedsearch.transferRecordsDesc=All record folders and records currently eligible for transfer. +rm.savedsearch.destructionRecordsName=Records and Record Folders Eligible for Destruction +rm.savedsearch.destructionRecordsDesc=All records currently eligible for destruction. +rm.savedsearch.frozenRecordsName= Records and Record Folders On Hold rm.savedsearch.frozenRecordsDesc=All records and record folders currently on hold. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_de.properties index 6aff9b3622..4034f191a1 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_de.properties @@ -1,25 +1,25 @@ -rm.hold.name=Sperrbereich - -## Default roles -rm.role.extendedReaders=An Originalposition lesen -rm.role.extendedWriters=An Originalposition schreiben -rm.role.user=Records Management Benutzer -rm.role.powerUser=Records Management Profibenutzer -rm.role.securityOfficer=Records Management Sicherheitsbeauftragter -rm.role.recordsManager=Records Management Manager -rm.role.administrator=Records Management Administrator -rm.role.all=Alle Records Management Rollen - -## Default searches -rm.savedsearch.vitalRecordsName=Besonders relevante Records mit f\u00e4lliger \u00dcberpr\u00fcfung -rm.savedsearch.vitalRecordsDesc=Alle aktuell zum \u00dcberpr\u00fcfen f\u00e4lligen Records. -rm.savedsearch.incompleteRecordsName=Nicht abgeschlossene Records -rm.savedsearch.incompleteRecordsDesc=Alle nicht abgeschlossenen Records. -rm.savedsearch.cutoffRecordsName=Zur Trennung geeignete Records und Record-Ordner -rm.savedsearch.cutoffRecordsDesc=Alle derzeit zur Trennung geeigneten Records und Record-Ordner. -rm.savedsearch.transferRecordsName=Zur \u00dcbertragung geeignete Records und Record-Ordner -rm.savedsearch.transferRecordsDesc=Alle aktuell zur \u00dcbertragung geeigneten Records und Record-Ordner. -rm.savedsearch.destructionRecordsName=Zur Vernichtung geeignete Records und Record-Ordner -rm.savedsearch.destructionRecordsDesc=Alle aktuell zur Vernichtung geeigneten Records. -rm.savedsearch.frozenRecordsName= Gesperrte Records und Record-Ordner +rm.hold.name=Sperrbereich + +## Default roles +rm.role.extendedReaders=An Originalposition lesen +rm.role.extendedWriters=An Originalposition schreiben +rm.role.user=Records Management Benutzer +rm.role.powerUser=Records Management Profibenutzer +rm.role.securityOfficer=Records Management Sicherheitsbeauftragter +rm.role.recordsManager=Records Management Manager +rm.role.administrator=Records Management Administrator +rm.role.all=Alle Records Management Rollen + +## Default searches +rm.savedsearch.vitalRecordsName=Besonders relevante Records mit f\u00e4lliger \u00dcberpr\u00fcfung +rm.savedsearch.vitalRecordsDesc=Alle aktuell zum \u00dcberpr\u00fcfen f\u00e4lligen Records. +rm.savedsearch.incompleteRecordsName=Nicht abgeschlossene Records +rm.savedsearch.incompleteRecordsDesc=Alle nicht abgeschlossenen Records. +rm.savedsearch.cutoffRecordsName=Zur Trennung geeignete Records und Record-Ordner +rm.savedsearch.cutoffRecordsDesc=Alle derzeit zur Trennung geeigneten Records und Record-Ordner. +rm.savedsearch.transferRecordsName=Zur \u00dcbertragung geeignete Records und Record-Ordner +rm.savedsearch.transferRecordsDesc=Alle aktuell zur \u00dcbertragung geeigneten Records und Record-Ordner. +rm.savedsearch.destructionRecordsName=Zur Vernichtung geeignete Records und Record-Ordner +rm.savedsearch.destructionRecordsDesc=Alle aktuell zur Vernichtung geeigneten Records. +rm.savedsearch.frozenRecordsName= Gesperrte Records und Record-Ordner rm.savedsearch.frozenRecordsDesc=Alle derzeit gesperrten Records und Record-Ordner. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_es.properties index 781745ce0e..c6a97a80f8 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_es.properties @@ -1,25 +1,25 @@ -rm.hold.name=Bloqueo - -## Default roles -rm.role.extendedReaders=Lectores in situ -rm.role.extendedWriters=Escritores in situ -rm.role.user=Usuario de gesti\u00f3n de documentos de archivo -rm.role.powerUser=Usuario de potencia de gesti\u00f3n de documentos de archivo -rm.role.securityOfficer=Encargado de seguridad de gesti\u00f3n de documentos de archivo -rm.role.recordsManager=Gestor de gesti\u00f3n de documentos de archivo -rm.role.administrator=Jefe de gesti\u00f3n de documentos de archivo -rm.role.all=Todos los roles de gesti\u00f3n de documentos de archivo - -## Default searches -rm.savedsearch.vitalRecordsName=Documentos de archivo vitales pendientes de revisi\u00f3n -rm.savedsearch.vitalRecordsDesc=Todos los documentos de archivo pendientes de revisi\u00f3n. -rm.savedsearch.incompleteRecordsName=Documentos de archivo incompletos -rm.savedsearch.incompleteRecordsDesc=Todos los documentos de archivo incompletos. -rm.savedsearch.cutoffRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden interrumpir -rm.savedsearch.cutoffRecordsDesc=Todos los documentos de archivos y carpetas de documentos de archivos que se pueden interrumpir actualmente. -rm.savedsearch.transferRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden transferir -rm.savedsearch.transferRecordsDesc=Actualmente, todos los documentos y carpetas de documentos de archivo se pueden transferir. -rm.savedsearch.destructionRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden destruir -rm.savedsearch.destructionRecordsDesc=Actualmente, todos los documentos de archivo se pueden destruir. -rm.savedsearch.frozenRecordsName= Documentos de archivo y carpetas de documentos de archivo en espera +rm.hold.name=Bloqueo + +## Default roles +rm.role.extendedReaders=Lectores in situ +rm.role.extendedWriters=Escritores in situ +rm.role.user=Usuario de gesti\u00f3n de documentos de archivo +rm.role.powerUser=Usuario de potencia de gesti\u00f3n de documentos de archivo +rm.role.securityOfficer=Encargado de seguridad de gesti\u00f3n de documentos de archivo +rm.role.recordsManager=Gestor de gesti\u00f3n de documentos de archivo +rm.role.administrator=Jefe de gesti\u00f3n de documentos de archivo +rm.role.all=Todos los roles de gesti\u00f3n de documentos de archivo + +## Default searches +rm.savedsearch.vitalRecordsName=Documentos de archivo vitales pendientes de revisi\u00f3n +rm.savedsearch.vitalRecordsDesc=Todos los documentos de archivo pendientes de revisi\u00f3n. +rm.savedsearch.incompleteRecordsName=Documentos de archivo incompletos +rm.savedsearch.incompleteRecordsDesc=Todos los documentos de archivo incompletos. +rm.savedsearch.cutoffRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden interrumpir +rm.savedsearch.cutoffRecordsDesc=Todos los documentos de archivos y carpetas de documentos de archivos que se pueden interrumpir actualmente. +rm.savedsearch.transferRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden transferir +rm.savedsearch.transferRecordsDesc=Actualmente, todos los documentos y carpetas de documentos de archivo se pueden transferir. +rm.savedsearch.destructionRecordsName=Documentos de archivo y carpetas de documentos de archivo que se pueden destruir +rm.savedsearch.destructionRecordsDesc=Actualmente, todos los documentos de archivo se pueden destruir. +rm.savedsearch.frozenRecordsName= Documentos de archivo y carpetas de documentos de archivo en espera rm.savedsearch.frozenRecordsDesc=Todos los documentos de archivo y carpetas de documentos de archivo est\u00e1n en espera. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_fr.properties index 9a1562e6ef..d4e764d993 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_fr.properties @@ -1,25 +1,25 @@ -rm.hold.name=Suspendre - -## Default roles -rm.role.extendedReaders=Lecteurs sur place -rm.role.extendedWriters=R\u00e9dacteurs sur place -rm.role.user=Utilisateur de la gestion des archives -rm.role.powerUser=Utilisateur principal de la gestion des archives -rm.role.securityOfficer=Agent de s\u00e9curit\u00e9 de la gestion des archives -rm.role.recordsManager=Responsable de la gestion des archives -rm.role.administrator=Administrateur de la gestion des archives -rm.role.all=Tous les r\u00f4les de la gestion des archives - -## Default searches -rm.savedsearch.vitalRecordsName=Documents d'archives essentiels arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification -rm.savedsearch.vitalRecordsDesc=Tous les documents d'archives arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification. -rm.savedsearch.incompleteRecordsName=Documents d'archives incomplets -rm.savedsearch.incompleteRecordsDesc=Tous les documents d'archives incomplets. -rm.savedsearch.cutoffRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour un d\u00e9classement -rm.savedsearch.cutoffRecordsDesc=Tous les documents d'archives et dossiers d'archives actuellement \u00e9ligibles pour un d\u00e9classement. -rm.savedsearch.transferRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour un transfert -rm.savedsearch.transferRecordsDesc=Tous les documents d'archives et dossiers d'archives actuellement \u00e9ligibles pour un transfert. -rm.savedsearch.destructionRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour une destruction -rm.savedsearch.destructionRecordsDesc=Tous les documents d'archives actuellement \u00e9ligibles pour destruction. -rm.savedsearch.frozenRecordsName= Documents d'archives et dossiers d'archives suspendus +rm.hold.name=Suspendre + +## Default roles +rm.role.extendedReaders=Lecteurs sur place +rm.role.extendedWriters=R\u00e9dacteurs sur place +rm.role.user=Utilisateur de la gestion des archives +rm.role.powerUser=Utilisateur principal de la gestion des archives +rm.role.securityOfficer=Agent de s\u00e9curit\u00e9 de la gestion des archives +rm.role.recordsManager=Responsable de la gestion des archives +rm.role.administrator=Administrateur de la gestion des archives +rm.role.all=Tous les r\u00f4les de la gestion des archives + +## Default searches +rm.savedsearch.vitalRecordsName=Documents d'archives essentiels arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification +rm.savedsearch.vitalRecordsDesc=Tous les documents d'archives arriv\u00e9s \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification. +rm.savedsearch.incompleteRecordsName=Documents d'archives incomplets +rm.savedsearch.incompleteRecordsDesc=Tous les documents d'archives incomplets. +rm.savedsearch.cutoffRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour un d\u00e9classement +rm.savedsearch.cutoffRecordsDesc=Tous les documents d'archives et dossiers d'archives actuellement \u00e9ligibles pour un d\u00e9classement. +rm.savedsearch.transferRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour un transfert +rm.savedsearch.transferRecordsDesc=Tous les documents d'archives et dossiers d'archives actuellement \u00e9ligibles pour un transfert. +rm.savedsearch.destructionRecordsName=Documents d'archives et dossiers d'archives \u00e9ligibles pour une destruction +rm.savedsearch.destructionRecordsDesc=Tous les documents d'archives actuellement \u00e9ligibles pour destruction. +rm.savedsearch.frozenRecordsName= Documents d'archives et dossiers d'archives suspendus rm.savedsearch.frozenRecordsDesc=Tous les documents d'archives et dossiers d'archives actuellement suspendus. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_it.properties index 90fedf3fcd..325d50264e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_it.properties @@ -1,25 +1,25 @@ -rm.hold.name=Sospensione - -## Default roles -rm.role.extendedReaders=Utenti con permessi di lettura -rm.role.extendedWriters=Utenti con permessi di scrittura -rm.role.user=Utente di Records Management -rm.role.powerUser=Power user di Records Management -rm.role.securityOfficer=Responsabile della sicurezza di Records Management -rm.role.recordsManager=Manager di Records Management -rm.role.administrator=Amministratore di Records Management -rm.role.all=Tutti i ruoli di Records Management - -## Default searches -rm.savedsearch.vitalRecordsName=Record fondamentali da esaminare -rm.savedsearch.vitalRecordsDesc=Tutti i record attualmente da esaminare. -rm.savedsearch.incompleteRecordsName=Record incompleti -rm.savedsearch.incompleteRecordsDesc=Tutti i record incompleti. -rm.savedsearch.cutoffRecordsName=Record e cartelle di record idonei per il cut off -rm.savedsearch.cutoffRecordsDesc=Tutti i record e le cartelle di record attualmente idonei per il cut off. -rm.savedsearch.transferRecordsName=Record e cartelle di record idonei per il trasferimento -rm.savedsearch.transferRecordsDesc=Tutti i record e le cartelle di record idonei per il trasferimento. -rm.savedsearch.destructionRecordsName=Record e cartelle di record idonei per l'eliminazione definitiva -rm.savedsearch.destructionRecordsDesc=Tutti i record attuali idonei per l'eliminazione definitiva. -rm.savedsearch.frozenRecordsName= Record e cartelle di record in sospeso +rm.hold.name=Sospensione + +## Default roles +rm.role.extendedReaders=Utenti con permessi di lettura +rm.role.extendedWriters=Utenti con permessi di scrittura +rm.role.user=Utente di Records Management +rm.role.powerUser=Power user di Records Management +rm.role.securityOfficer=Responsabile della sicurezza di Records Management +rm.role.recordsManager=Manager di Records Management +rm.role.administrator=Amministratore di Records Management +rm.role.all=Tutti i ruoli di Records Management + +## Default searches +rm.savedsearch.vitalRecordsName=Record fondamentali da esaminare +rm.savedsearch.vitalRecordsDesc=Tutti i record attualmente da esaminare. +rm.savedsearch.incompleteRecordsName=Record incompleti +rm.savedsearch.incompleteRecordsDesc=Tutti i record incompleti. +rm.savedsearch.cutoffRecordsName=Record e cartelle di record idonei per il cut off +rm.savedsearch.cutoffRecordsDesc=Tutti i record e le cartelle di record attualmente idonei per il cut off. +rm.savedsearch.transferRecordsName=Record e cartelle di record idonei per il trasferimento +rm.savedsearch.transferRecordsDesc=Tutti i record e le cartelle di record idonei per il trasferimento. +rm.savedsearch.destructionRecordsName=Record e cartelle di record idonei per l'eliminazione definitiva +rm.savedsearch.destructionRecordsDesc=Tutti i record attuali idonei per l'eliminazione definitiva. +rm.savedsearch.frozenRecordsName= Record e cartelle di record in sospeso rm.savedsearch.frozenRecordsDesc=Tutti i record e le cartelle di record attuali in sospeso. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ja.properties index 404f1fee48..5fba29c388 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ja.properties @@ -1,25 +1,25 @@ -rm.hold.name=\u30db\u30fc\u30eb\u30c9 - -## Default roles -rm.role.extendedReaders=\u7d44\u307f\u8fbc\u307f\u8aad\u8005 -rm.role.extendedWriters=\u7d44\u307f\u8fbc\u307f\u8457\u8005 -rm.role.user=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30e6\u30fc\u30b6\u30fc -rm.role.powerUser=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30d1\u30ef\u30fc\u30e6\u30fc\u30b6\u30fc -rm.role.securityOfficer=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f79\u54e1 -rm.role.recordsManager=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30de\u30cd\u30fc\u30b8\u30e3\u30fc -rm.role.administrator=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u7ba1\u7406\u8005 -rm.role.all=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u3059\u3079\u3066\u306e\u5f79\u5272 - -## Default searches -rm.savedsearch.vitalRecordsName=\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u306e\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 -rm.savedsearch.vitalRecordsDesc=\u73fe\u5728\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u306e\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3002 -rm.savedsearch.incompleteRecordsName=\u672a\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9 -rm.savedsearch.incompleteRecordsDesc=\u3059\u3079\u3066\u306e\u672a\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9\u3002 -rm.savedsearch.cutoffRecordsName=\u30ab\u30c3\u30c8\u30aa\u30d5\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rm.savedsearch.cutoffRecordsDesc=\u73fe\u5728\u30ab\u30c3\u30c8\u30aa\u30d5\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3068\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3002 -rm.savedsearch.transferRecordsName=\u8ee2\u9001\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rm.savedsearch.transferRecordsDesc=\u73fe\u5728\u8ee2\u9001\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3068\u30ec\u30b3\u30fc\u30c9\u3002 -rm.savedsearch.destructionRecordsName=\u5ec3\u68c4\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u3068\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -rm.savedsearch.destructionRecordsDesc=\u73fe\u5728\u5ec3\u68c4\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3002 -rm.savedsearch.frozenRecordsName= \u30db\u30fc\u30eb\u30c9\u4e2d\u306e\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +rm.hold.name=\u30db\u30fc\u30eb\u30c9 + +## Default roles +rm.role.extendedReaders=\u7d44\u307f\u8fbc\u307f\u8aad\u8005 +rm.role.extendedWriters=\u7d44\u307f\u8fbc\u307f\u8457\u8005 +rm.role.user=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30e6\u30fc\u30b6\u30fc +rm.role.powerUser=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30d1\u30ef\u30fc\u30e6\u30fc\u30b6\u30fc +rm.role.securityOfficer=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5f79\u54e1 +rm.role.recordsManager=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u30de\u30cd\u30fc\u30b8\u30e3\u30fc +rm.role.administrator=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u7ba1\u7406\u8005 +rm.role.all=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u306e\u3059\u3079\u3066\u306e\u5f79\u5272 + +## Default searches +rm.savedsearch.vitalRecordsName=\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u306e\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9 +rm.savedsearch.vitalRecordsDesc=\u73fe\u5728\u30ec\u30d3\u30e5\u30fc\u4e88\u5b9a\u306e\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3002 +rm.savedsearch.incompleteRecordsName=\u672a\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9 +rm.savedsearch.incompleteRecordsDesc=\u3059\u3079\u3066\u306e\u672a\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9\u3002 +rm.savedsearch.cutoffRecordsName=\u30ab\u30c3\u30c8\u30aa\u30d5\u5bfe\u8c61\u306e\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +rm.savedsearch.cutoffRecordsDesc=\u73fe\u5728\u30ab\u30c3\u30c8\u30aa\u30d5\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3068\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3002 +rm.savedsearch.transferRecordsName=\u8ee2\u9001\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +rm.savedsearch.transferRecordsDesc=\u73fe\u5728\u8ee2\u9001\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3068\u30ec\u30b3\u30fc\u30c9\u3002 +rm.savedsearch.destructionRecordsName=\u5ec3\u68c4\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u30ec\u30b3\u30fc\u30c9\u3068\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +rm.savedsearch.destructionRecordsDesc=\u73fe\u5728\u5ec3\u68c4\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3002 +rm.savedsearch.frozenRecordsName= \u30db\u30fc\u30eb\u30c9\u4e2d\u306e\u30ec\u30b3\u30fc\u30c9\u304a\u3088\u3073\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 rm.savedsearch.frozenRecordsDesc=\u73fe\u5728\u30db\u30fc\u30eb\u30c9\u4e2d\u306e\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3068\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3002 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties index 77513a4c7d..c8a520fa20 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties @@ -1,25 +1,25 @@ -rm.hold.name=Hold - -## Default roles -rm.role.extendedReaders=P\u00e5 plass lesere -rm.role.extendedWriters=P\u00e5 plass skribenter -rm.role.user=Bruker av oppf\u00f8ringsh\u00e5ndtering -rm.role.powerUser=Priviligert bruker av oppf\u00f8ringsh\u00e5ndtering -rm.role.securityOfficer=Sikkerhetsansvarlig ved oppf\u00f8ringsh\u00e5ndtering -rm.role.recordsManager=Ansvarlig ved oppf\u00f8ringsh\u00e5ndtering -rm.role.administrator=Administrator ved oppf\u00f8ringsh\u00e5ndtering -rm.role.all=Alle oppf\u00f8ringsh\u00e5ndteringsrollene - -## Default searches -rm.savedsearch.vitalRecordsName=Sv\u00e6rt viktige oppf\u00f8ringer som skal gjennomg\u00e5s -rm.savedsearch.vitalRecordsDesc=Alle oppf\u00f8ringer som n\u00e5 skal gjennomg\u00e5s. -rm.savedsearch.incompleteRecordsName=Ufullstendige oppf\u00f8ringer -rm.savedsearch.incompleteRecordsDesc=Alle ufullstendige oppf\u00f8ringer. -rm.savedsearch.cutoffRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til cut off -rm.savedsearch.cutoffRecordsDesc=Alle oppf\u00f8ringer og oppf\u00f8ringsmapper som for tiden er kvalifisert til cut off. -rm.savedsearch.transferRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til overf\u00f8ring -rm.savedsearch.transferRecordsDesc=Alle oppf\u00f8ringmapper og oppf\u00f8ringer som for tiden er kvalifisert til overf\u00f8ring. -rm.savedsearch.destructionRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til destruksjon -rm.savedsearch.destructionRecordsDesc=Alle oppf\u00f8ringer som for tiden er kvalifisert til destruksjon. -rm.savedsearch.frozenRecordsName= Oppf\u00f8ringer og oppf\u00f8ringsmapper p\u00e5 hold +rm.hold.name=Hold + +## Default roles +rm.role.extendedReaders=P\u00e5 plass lesere +rm.role.extendedWriters=P\u00e5 plass skribenter +rm.role.user=Bruker av oppf\u00f8ringsh\u00e5ndtering +rm.role.powerUser=Priviligert bruker av oppf\u00f8ringsh\u00e5ndtering +rm.role.securityOfficer=Sikkerhetsansvarlig ved oppf\u00f8ringsh\u00e5ndtering +rm.role.recordsManager=Ansvarlig ved oppf\u00f8ringsh\u00e5ndtering +rm.role.administrator=Administrator ved oppf\u00f8ringsh\u00e5ndtering +rm.role.all=Alle oppf\u00f8ringsh\u00e5ndteringsrollene + +## Default searches +rm.savedsearch.vitalRecordsName=Sv\u00e6rt viktige oppf\u00f8ringer som skal gjennomg\u00e5s +rm.savedsearch.vitalRecordsDesc=Alle oppf\u00f8ringer som n\u00e5 skal gjennomg\u00e5s. +rm.savedsearch.incompleteRecordsName=Ufullstendige oppf\u00f8ringer +rm.savedsearch.incompleteRecordsDesc=Alle ufullstendige oppf\u00f8ringer. +rm.savedsearch.cutoffRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til cut off +rm.savedsearch.cutoffRecordsDesc=Alle oppf\u00f8ringer og oppf\u00f8ringsmapper som for tiden er kvalifisert til cut off. +rm.savedsearch.transferRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til overf\u00f8ring +rm.savedsearch.transferRecordsDesc=Alle oppf\u00f8ringmapper og oppf\u00f8ringer som for tiden er kvalifisert til overf\u00f8ring. +rm.savedsearch.destructionRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til destruksjon +rm.savedsearch.destructionRecordsDesc=Alle oppf\u00f8ringer som for tiden er kvalifisert til destruksjon. +rm.savedsearch.frozenRecordsName= Oppf\u00f8ringer og oppf\u00f8ringsmapper p\u00e5 hold rm.savedsearch.frozenRecordsDesc=Alle oppf\u00f8ringer og oppf\u00f8ringsmapper for tiden p\u00e5 hold. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nl.properties index ad2b9cbe63..fe711fe845 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nl.properties @@ -1,25 +1,25 @@ -rm.hold.name=Wachtstand - -## Default roles -rm.role.extendedReaders=Ge\u00efntegreerde lezers -rm.role.extendedWriters=Ge\u00efntegreerde schrijvers -rm.role.user=Gebruiker Record Management -rm.role.powerUser=Hoofdgebruiker Record Management -rm.role.securityOfficer=Beveiligingsmedewerker Record Management -rm.role.recordsManager=Manager Record Management -rm.role.administrator=Beheerder Record Management -rm.role.all=Alle rollen voor Record Management - -## Default searches -rm.savedsearch.vitalRecordsName=Vitale records gereed voor revisie -rm.savedsearch.vitalRecordsDesc=Alle records die momenteel gereed zijn voor revisie. -rm.savedsearch.incompleteRecordsName=Niet-afgeronde records -rm.savedsearch.incompleteRecordsDesc=Alle niet-afgeronde records. -rm.savedsearch.cutoffRecordsName=Records en archiefmappen die in aanmerking komen voor afsluiten -rm.savedsearch.cutoffRecordsDesc=Alle records en archiefmappen die momenteel in aanmerking komen voor afsluiten -rm.savedsearch.transferRecordsName=Records en archiefmappen die in aanmerking komen voor overzetten -rm.savedsearch.transferRecordsDesc=Alle records en archiefmappen die momenteel in aanmerking komen voor overzetten. -rm.savedsearch.destructionRecordsName=Records en archiefmappen die in aanmerking komen voor vernietiging -rm.savedsearch.destructionRecordsDesc=Alle records die momenteel in aanmerking komen voor vernietiging. -rm.savedsearch.frozenRecordsName= Records en archiefmappen die in wachtstand zijn +rm.hold.name=Wachtstand + +## Default roles +rm.role.extendedReaders=Ge\u00efntegreerde lezers +rm.role.extendedWriters=Ge\u00efntegreerde schrijvers +rm.role.user=Gebruiker Record Management +rm.role.powerUser=Hoofdgebruiker Record Management +rm.role.securityOfficer=Beveiligingsmedewerker Record Management +rm.role.recordsManager=Manager Record Management +rm.role.administrator=Beheerder Record Management +rm.role.all=Alle rollen voor Record Management + +## Default searches +rm.savedsearch.vitalRecordsName=Vitale records gereed voor revisie +rm.savedsearch.vitalRecordsDesc=Alle records die momenteel gereed zijn voor revisie. +rm.savedsearch.incompleteRecordsName=Niet-afgeronde records +rm.savedsearch.incompleteRecordsDesc=Alle niet-afgeronde records. +rm.savedsearch.cutoffRecordsName=Records en archiefmappen die in aanmerking komen voor afsluiten +rm.savedsearch.cutoffRecordsDesc=Alle records en archiefmappen die momenteel in aanmerking komen voor afsluiten +rm.savedsearch.transferRecordsName=Records en archiefmappen die in aanmerking komen voor overzetten +rm.savedsearch.transferRecordsDesc=Alle records en archiefmappen die momenteel in aanmerking komen voor overzetten. +rm.savedsearch.destructionRecordsName=Records en archiefmappen die in aanmerking komen voor vernietiging +rm.savedsearch.destructionRecordsDesc=Alle records die momenteel in aanmerking komen voor vernietiging. +rm.savedsearch.frozenRecordsName= Records en archiefmappen die in wachtstand zijn rm.savedsearch.frozenRecordsDesc=Alle records en archiefmappen die momenteel in wachtstand zijn. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_pt_BR.properties index fc74cca443..5e05519d92 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_pt_BR.properties @@ -1,25 +1,25 @@ -rm.hold.name=Manter - -## Default roles -rm.role.extendedReaders=Leitores no local -rm.role.extendedWriters=Gravadores no local -rm.role.user=Usu\u00e1rio do Records Management -rm.role.powerUser=Usu\u00e1rio avan\u00e7ado do Records Management -rm.role.securityOfficer=Diretor de seguran\u00e7a do Records Management -rm.role.recordsManager=Gerente do Records Management -rm.role.administrator=Administrador do Records Management -rm.role.all=Todas as fun\u00e7\u00f5es do Records Management - -## Default searches -rm.savedsearch.vitalRecordsName=Documentos arquiv\u00edsticos vitais em prazo para revis\u00e3o -rm.savedsearch.vitalRecordsDesc=Todos os documentos arquiv\u00edsticos atualmente no prazo para revis\u00e3o. -rm.savedsearch.incompleteRecordsName=Documentos arquiv\u00edsticos incompletos -rm.savedsearch.incompleteRecordsDesc=Todos os documentos arquiv\u00edsticos incompletos. -rm.savedsearch.cutoffRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para corte -rm.savedsearch.cutoffRecordsDesc=Todos os documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para corte. -rm.savedsearch.transferRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para transfer\u00eancia -rm.savedsearch.transferRecordsDesc=Todos os documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para transfer\u00eancia. -rm.savedsearch.destructionRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para destrui\u00e7\u00e3o -rm.savedsearch.destructionRecordsDesc=Todos os documentos arquiv\u00edsticos atualmente qualificados para destrui\u00e7\u00e3o. -rm.savedsearch.frozenRecordsName= Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos em espera +rm.hold.name=Manter + +## Default roles +rm.role.extendedReaders=Leitores no local +rm.role.extendedWriters=Gravadores no local +rm.role.user=Usu\u00e1rio do Records Management +rm.role.powerUser=Usu\u00e1rio avan\u00e7ado do Records Management +rm.role.securityOfficer=Diretor de seguran\u00e7a do Records Management +rm.role.recordsManager=Gerente do Records Management +rm.role.administrator=Administrador do Records Management +rm.role.all=Todas as fun\u00e7\u00f5es do Records Management + +## Default searches +rm.savedsearch.vitalRecordsName=Documentos arquiv\u00edsticos vitais em prazo para revis\u00e3o +rm.savedsearch.vitalRecordsDesc=Todos os documentos arquiv\u00edsticos atualmente no prazo para revis\u00e3o. +rm.savedsearch.incompleteRecordsName=Documentos arquiv\u00edsticos incompletos +rm.savedsearch.incompleteRecordsDesc=Todos os documentos arquiv\u00edsticos incompletos. +rm.savedsearch.cutoffRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para corte +rm.savedsearch.cutoffRecordsDesc=Todos os documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para corte. +rm.savedsearch.transferRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para transfer\u00eancia +rm.savedsearch.transferRecordsDesc=Todos os documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para transfer\u00eancia. +rm.savedsearch.destructionRecordsName=Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos qualificados para destrui\u00e7\u00e3o +rm.savedsearch.destructionRecordsDesc=Todos os documentos arquiv\u00edsticos atualmente qualificados para destrui\u00e7\u00e3o. +rm.savedsearch.frozenRecordsName= Documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos em espera rm.savedsearch.frozenRecordsDesc=Todos os documentos arquiv\u00edsticos e pastas de documentos arquiv\u00edsticos atualmente em espera. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties index 1484e776ba..85d0f7e858 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties @@ -1,25 +1,25 @@ -rm.hold.name=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 - -## Default roles -rm.role.extendedReaders=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 -rm.role.extendedWriters=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0433\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u0438\u0441\u0438 -rm.role.user=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.powerUser=\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.securityOfficer=\u0421\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a \u0441\u043b\u0443\u0436\u0431\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.recordsManager=\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.administrator=\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rm.role.all=\u0412\u0441\u0435 \u0440\u043e\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 - -## Default searches -rm.savedsearch.vitalRecordsName=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 -rm.savedsearch.vitalRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. -rm.savedsearch.incompleteRecordsName=\u041d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rm.savedsearch.incompleteRecordsDesc=\u0412\u0441\u0435 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.savedsearch.cutoffRecordsName=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f -rm.savedsearch.cutoffRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. -rm.savedsearch.transferRecordsName=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -rm.savedsearch.transferRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. -rm.savedsearch.destructionRecordsName=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f -rm.savedsearch.destructionRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. -rm.savedsearch.frozenRecordsName= \u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +rm.hold.name=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 + +## Default roles +rm.role.extendedReaders=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 +rm.role.extendedWriters=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0433\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u0438\u0441\u0438 +rm.role.user=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rm.role.powerUser=\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rm.role.securityOfficer=\u0421\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a \u0441\u043b\u0443\u0436\u0431\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rm.role.recordsManager=\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rm.role.administrator=\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 +rm.role.all=\u0412\u0441\u0435 \u0440\u043e\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 + +## Default searches +rm.savedsearch.vitalRecordsName=\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 +rm.savedsearch.vitalRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. +rm.savedsearch.incompleteRecordsName=\u041d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rm.savedsearch.incompleteRecordsDesc=\u0412\u0441\u0435 \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. +rm.savedsearch.cutoffRecordsName=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f +rm.savedsearch.cutoffRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u0440\u0435\u0437\u0430\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. +rm.savedsearch.transferRecordsName=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 +rm.savedsearch.transferRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. +rm.savedsearch.destructionRecordsName=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f +rm.savedsearch.destructionRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. +rm.savedsearch.frozenRecordsName= \u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 rm.savedsearch.frozenRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_zh_CN.properties index 8c6f68b7ab..fbd441193a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_zh_CN.properties @@ -1,25 +1,25 @@ -rm.hold.name=\u4fdd\u5b58 - -## Default roles -rm.role.extendedReaders=\u5c31\u5730\u8bfb\u8005 -rm.role.extendedWriters=\u5c31\u5730\u4f5c\u8005 -rm.role.user=\u8bb0\u5f55\u7ba1\u7406\u7528\u6237 -rm.role.powerUser=\u8bb0\u5f55\u7ba1\u7406\u9ad8\u7ea7\u7528\u6237 -rm.role.securityOfficer=\u8bb0\u5f55\u7ba1\u7406\u5b89\u5168\u5b98\u5458 -rm.role.recordsManager=\u8bb0\u5f55\u7ba1\u7406\u7684\u7ba1\u7406\u4eba\u5458 -rm.role.administrator=\u8bb0\u5f55\u7ba1\u7406\u7684\u7ba1\u7406\u5458 -rm.role.all=\u6240\u6709\u8bb0\u5f55\u7ba1\u7406\u89d2\u8272 - -## Default searches -rm.savedsearch.vitalRecordsName=\u6838\u5fc3\u8bb0\u5f55\u7684\u5ba1\u67e5\u5230\u671f -rm.savedsearch.vitalRecordsDesc=\u6240\u6709\u8bb0\u5f55\u7684\u5ba1\u67e5\u5f53\u524d\u5df2\u5230\u671f\u3002 -rm.savedsearch.incompleteRecordsName=\u4e0d\u5b8c\u6574\u7684\u8bb0\u5f55 -rm.savedsearch.incompleteRecordsDesc=\u6240\u6709\u4e0d\u5b8c\u6574\u7684\u8bb0\u5f55\u3002 -rm.savedsearch.cutoffRecordsName=\u53ef\u4e2d\u65ad\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 -rm.savedsearch.cutoffRecordsDesc=\u5f53\u524d\u53ef\u4e2d\u65ad\u7684\u6240\u6709\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 -rm.savedsearch.transferRecordsName=\u53ef\u79fb\u4ea4\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 -rm.savedsearch.transferRecordsDesc=\u5f53\u524d\u53ef\u79fb\u4ea4\u7684\u6240\u6709\u8bb0\u5f55\u6587\u4ef6\u5939\u548c\u8bb0\u5f55\u3002 -rm.savedsearch.destructionRecordsName=\u53ef\u9500\u6bc1\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 -rm.savedsearch.destructionRecordsDesc=\u5f53\u524d\u53ef\u9500\u6bc1\u7684\u6240\u6709\u8bb0\u5f55\u3002 -rm.savedsearch.frozenRecordsName= \u4fdd\u5b58\u4e2d\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 +rm.hold.name=\u4fdd\u5b58 + +## Default roles +rm.role.extendedReaders=\u5c31\u5730\u8bfb\u8005 +rm.role.extendedWriters=\u5c31\u5730\u4f5c\u8005 +rm.role.user=\u8bb0\u5f55\u7ba1\u7406\u7528\u6237 +rm.role.powerUser=\u8bb0\u5f55\u7ba1\u7406\u9ad8\u7ea7\u7528\u6237 +rm.role.securityOfficer=\u8bb0\u5f55\u7ba1\u7406\u5b89\u5168\u5b98\u5458 +rm.role.recordsManager=\u8bb0\u5f55\u7ba1\u7406\u7684\u7ba1\u7406\u4eba\u5458 +rm.role.administrator=\u8bb0\u5f55\u7ba1\u7406\u7684\u7ba1\u7406\u5458 +rm.role.all=\u6240\u6709\u8bb0\u5f55\u7ba1\u7406\u89d2\u8272 + +## Default searches +rm.savedsearch.vitalRecordsName=\u6838\u5fc3\u8bb0\u5f55\u7684\u5ba1\u67e5\u5230\u671f +rm.savedsearch.vitalRecordsDesc=\u6240\u6709\u8bb0\u5f55\u7684\u5ba1\u67e5\u5f53\u524d\u5df2\u5230\u671f\u3002 +rm.savedsearch.incompleteRecordsName=\u4e0d\u5b8c\u6574\u7684\u8bb0\u5f55 +rm.savedsearch.incompleteRecordsDesc=\u6240\u6709\u4e0d\u5b8c\u6574\u7684\u8bb0\u5f55\u3002 +rm.savedsearch.cutoffRecordsName=\u53ef\u4e2d\u65ad\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 +rm.savedsearch.cutoffRecordsDesc=\u5f53\u524d\u53ef\u4e2d\u65ad\u7684\u6240\u6709\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 +rm.savedsearch.transferRecordsName=\u53ef\u79fb\u4ea4\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 +rm.savedsearch.transferRecordsDesc=\u5f53\u524d\u53ef\u79fb\u4ea4\u7684\u6240\u6709\u8bb0\u5f55\u6587\u4ef6\u5939\u548c\u8bb0\u5f55\u3002 +rm.savedsearch.destructionRecordsName=\u53ef\u9500\u6bc1\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 +rm.savedsearch.destructionRecordsDesc=\u5f53\u524d\u53ef\u9500\u6bc1\u7684\u6240\u6709\u8bb0\u5f55\u3002 +rm.savedsearch.frozenRecordsName= \u4fdd\u5b58\u4e2d\u7684\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939 rm.savedsearch.frozenRecordsDesc=\u5f53\u524d\u4fdd\u5b58\u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u548c\u8bb0\u5f55\u6587\u4ef6\u5939\u3002 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template.properties index b3b73bbed9..98b96881a9 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=Accession Report -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=declared by -file.report.declared.on=on -file.report.destroyed=Destroyed -file.report.destroyed.records=Destroyed Records -file.report.destruction.report=Destruction Report -file.report.disposition.authority=Retention Authority -file.report.disposition.instructions=Retention Instructions -file.report.nara=NARA -file.report.transfer.date=Transfer Date -file.report.transfer.location=Transfer Location -file.report.transfer.report=Transfer Report -file.report.transferred.items=Transferred Items -file.report.performed.by=Performed By -file.report.record=Record -file.report.record.folder=Record Folder -file.report.unique.folder.identifier=Unique Folder ID -file.report.unique.record.identifier=Unique Record ID -file.report.hold.report=Hold Report -file.report.hold.name=Hold Name -file.report.hold.description=Hold Description -file.report.hold.reason=Hold Reason -file.report.hold.held=Held -file.report.createdby=Created By +# File Report Template +file.report.acession.report=Accession Report +file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.declared.by=declared by +file.report.declared.on=on +file.report.destroyed=Destroyed +file.report.destroyed.records=Destroyed Records +file.report.destruction.report=Destruction Report +file.report.disposition.authority=Retention Authority +file.report.disposition.instructions=Retention Instructions +file.report.nara=NARA +file.report.transfer.date=Transfer Date +file.report.transfer.location=Transfer Location +file.report.transfer.report=Transfer Report +file.report.transferred.items=Transferred Items +file.report.performed.by=Performed By +file.report.record=Record +file.report.record.folder=Record Folder +file.report.unique.folder.identifier=Unique Folder ID +file.report.unique.record.identifier=Unique Record ID +file.report.hold.report=Hold Report +file.report.hold.name=Hold Name +file.report.hold.description=Hold Description +file.report.hold.reason=Hold Reason +file.report.hold.held=Held +file.report.createdby=Created By file.report.createdon=Created On \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_de.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_de.properties index c91207a4f8..1afc21f513 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_de.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=Bericht zur Aufnahme -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=deklariert von -file.report.declared.on=am -file.report.destroyed=Vernichtet -file.report.destroyed.records=Vernichtete Records -file.report.destruction.report=Vernichtungsprotokoll -file.report.disposition.authority=Aufbewahrungs-Authority -file.report.disposition.instructions=Aufbewahrungsanweisungen -file.report.nara=NARA -file.report.transfer.date=\u00dcbertragungsdatum -file.report.transfer.location=\u00dcbertragungsort -file.report.transfer.report=\u00dcbertragungsbericht -file.report.transferred.items=\u00dcbertragene Elemente -file.report.performed.by=Durchgef\u00fchrt von -file.report.record=Record -file.report.record.folder=Record-Ordner -file.report.unique.folder.identifier=Eindeutige Ordner-ID -file.report.unique.record.identifier=Eindeutige Record-ID -file.report.hold.report=Sperrbericht -file.report.hold.name=Sperrname -file.report.hold.description=Sperrbeschreibung -file.report.hold.reason=Sperrgrund -file.report.hold.held=Gesperrt -file.report.createdby=Erstellt von +# File Report Template +file.report.acession.report=Bericht zur Aufnahme +file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.declared.by=deklariert von +file.report.declared.on=am +file.report.destroyed=Vernichtet +file.report.destroyed.records=Vernichtete Records +file.report.destruction.report=Vernichtungsprotokoll +file.report.disposition.authority=Aufbewahrungs-Authority +file.report.disposition.instructions=Aufbewahrungsanweisungen +file.report.nara=NARA +file.report.transfer.date=\u00dcbertragungsdatum +file.report.transfer.location=\u00dcbertragungsort +file.report.transfer.report=\u00dcbertragungsbericht +file.report.transferred.items=\u00dcbertragene Elemente +file.report.performed.by=Durchgef\u00fchrt von +file.report.record=Record +file.report.record.folder=Record-Ordner +file.report.unique.folder.identifier=Eindeutige Ordner-ID +file.report.unique.record.identifier=Eindeutige Record-ID +file.report.hold.report=Sperrbericht +file.report.hold.name=Sperrname +file.report.hold.description=Sperrbeschreibung +file.report.hold.reason=Sperrgrund +file.report.hold.held=Gesperrt +file.report.createdby=Erstellt von file.report.createdon=Erstellt am \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_es.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_es.properties index 287a23a0f3..7138821ae2 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_es.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=Informe de adhesi\u00f3n -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=declarado por -file.report.declared.on=en -file.report.destroyed=Destruido -file.report.destroyed.records=Documentos de archivo destruidos -file.report.destruction.report=Informe de destrucci\u00f3n -file.report.disposition.authority=Autoridad de retenci\u00f3n -file.report.disposition.instructions=Instrucciones de retenci\u00f3n -file.report.nara=NARA -file.report.transfer.date=Fecha de transferencia -file.report.transfer.location=Ubicaci\u00f3n de transferencia -file.report.transfer.report=Informe de transferencia -file.report.transferred.items=Elementos transferidos -file.report.performed.by=Realizado por -file.report.record=Documento de archivo -file.report.record.folder=Carpeta de documentos de archivo -file.report.unique.folder.identifier=ID de carpeta \u00fanico -file.report.unique.record.identifier=ID de documento de archivo \u00fanico -file.report.hold.report=Informe de bloqueo -file.report.hold.name=Nombre de bloqueo -file.report.hold.description=Descripci\u00f3n de bloqueo -file.report.hold.reason=Raz\u00f3n de bloqueo -file.report.hold.held=Bloqueado -file.report.createdby=Creado por +# File Report Template +file.report.acession.report=Informe de adhesi\u00f3n +file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.declared.by=declarado por +file.report.declared.on=en +file.report.destroyed=Destruido +file.report.destroyed.records=Documentos de archivo destruidos +file.report.destruction.report=Informe de destrucci\u00f3n +file.report.disposition.authority=Autoridad de retenci\u00f3n +file.report.disposition.instructions=Instrucciones de retenci\u00f3n +file.report.nara=NARA +file.report.transfer.date=Fecha de transferencia +file.report.transfer.location=Ubicaci\u00f3n de transferencia +file.report.transfer.report=Informe de transferencia +file.report.transferred.items=Elementos transferidos +file.report.performed.by=Realizado por +file.report.record=Documento de archivo +file.report.record.folder=Carpeta de documentos de archivo +file.report.unique.folder.identifier=ID de carpeta \u00fanico +file.report.unique.record.identifier=ID de documento de archivo \u00fanico +file.report.hold.report=Informe de bloqueo +file.report.hold.name=Nombre de bloqueo +file.report.hold.description=Descripci\u00f3n de bloqueo +file.report.hold.reason=Raz\u00f3n de bloqueo +file.report.hold.held=Bloqueado +file.report.createdby=Creado por file.report.createdon=Creado \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties index a7af9641db..85ffa94898 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=Rapport sur le versement \u00e0 un autre organisme -file.report.date.format=EEE MMM jj HH:mm:ss zzz yyyy -file.report.declared.by=d\u00e9clar\u00e9 par -file.report.declared.on=le -file.report.destroyed=D\u00e9truit -file.report.destroyed.records=Documents d'archives d\u00e9truits -file.report.destruction.report=Rapport de destruction -file.report.disposition.authority=D\u00e9tenteur de la r\u00e9tention -file.report.disposition.instructions=Instructions de r\u00e9tention -file.report.nara=NARA -file.report.transfer.date=Date de transfert -file.report.transfer.location=Emplacement de transfert -file.report.transfer.report=Rapport de transfert -file.report.transferred.items=El\u00e9ments transf\u00e9r\u00e9s -file.report.performed.by=Effectu\u00e9 par -file.report.record=Document d'archives -file.report.record.folder=Dossier d'archives -file.report.unique.folder.identifier=ID unique de dossier -file.report.unique.record.identifier=ID unique de document d'archives -file.report.hold.report=Rapport de suspension -file.report.hold.name=Nom de la suspension -file.report.hold.description=Description de la suspension -file.report.hold.reason=Motif de suspension -file.report.hold.held=Suspendu -file.report.createdby=Cr\u00e9\u00e9 par +# File Report Template +file.report.acession.report=Rapport sur le versement \u00e0 un autre organisme +file.report.date.format=EEE MMM jj HH:mm:ss zzz yyyy +file.report.declared.by=d\u00e9clar\u00e9 par +file.report.declared.on=le +file.report.destroyed=D\u00e9truit +file.report.destroyed.records=Documents d'archives d\u00e9truits +file.report.destruction.report=Rapport de destruction +file.report.disposition.authority=D\u00e9tenteur de la r\u00e9tention +file.report.disposition.instructions=Instructions de r\u00e9tention +file.report.nara=NARA +file.report.transfer.date=Date de transfert +file.report.transfer.location=Emplacement de transfert +file.report.transfer.report=Rapport de transfert +file.report.transferred.items=El\u00e9ments transf\u00e9r\u00e9s +file.report.performed.by=Effectu\u00e9 par +file.report.record=Document d'archives +file.report.record.folder=Dossier d'archives +file.report.unique.folder.identifier=ID unique de dossier +file.report.unique.record.identifier=ID unique de document d'archives +file.report.hold.report=Rapport de suspension +file.report.hold.name=Nom de la suspension +file.report.hold.description=Description de la suspension +file.report.hold.reason=Motif de suspension +file.report.hold.held=Suspendu +file.report.createdby=Cr\u00e9\u00e9 par file.report.createdon=Cr\u00e9\u00e9 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_it.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_it.properties index 03fab7987e..465188d1aa 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_it.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=Rapporto di trasferimento ad altri -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=dichiarato da -file.report.declared.on=in data -file.report.destroyed=Eliminato definitivamente -file.report.destroyed.records=Record eliminati definitivamente -file.report.destruction.report=Rapporto di eliminazione definitiva -file.report.disposition.authority=Autorit\u00e0 di conservazione -file.report.disposition.instructions=Istruzioni per la conservazione -file.report.nara=NARA (USA) -file.report.transfer.date=Data di trasferimento -file.report.transfer.location=Posizione di trasferimento -file.report.transfer.report=Rapporto di trasferimento -file.report.transferred.items=Elementi trasferiti -file.report.performed.by=Eseguito da -file.report.record=Record -file.report.record.folder=Cartella di record -file.report.unique.folder.identifier=ID univoco cartella -file.report.unique.record.identifier=ID univoco record -file.report.hold.report=Rapporto di sospensione -file.report.hold.name=Nome sospensione -file.report.hold.description=Descrizione sospensione -file.report.hold.reason=Motivo sospensione -file.report.hold.held=Sospeso -file.report.createdby=Creato da +# File Report Template +file.report.acession.report=Rapporto di trasferimento ad altri +file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.declared.by=dichiarato da +file.report.declared.on=in data +file.report.destroyed=Eliminato definitivamente +file.report.destroyed.records=Record eliminati definitivamente +file.report.destruction.report=Rapporto di eliminazione definitiva +file.report.disposition.authority=Autorit\u00e0 di conservazione +file.report.disposition.instructions=Istruzioni per la conservazione +file.report.nara=NARA (USA) +file.report.transfer.date=Data di trasferimento +file.report.transfer.location=Posizione di trasferimento +file.report.transfer.report=Rapporto di trasferimento +file.report.transferred.items=Elementi trasferiti +file.report.performed.by=Eseguito da +file.report.record=Record +file.report.record.folder=Cartella di record +file.report.unique.folder.identifier=ID univoco cartella +file.report.unique.record.identifier=ID univoco record +file.report.hold.report=Rapporto di sospensione +file.report.hold.name=Nome sospensione +file.report.hold.description=Descrizione sospensione +file.report.hold.reason=Motivo sospensione +file.report.hold.held=Sospeso +file.report.createdby=Creato da file.report.createdon=Creato il \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ja.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ja.properties index fe63ba4b1d..ddf22acd3a 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ja.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=\u53d7\u8afe\u30ec\u30dd\u30fc\u30c8 -file.report.date.format=EEE\u5e74MMM\u6708dd\u65e5\u3001HH:mm:ss zzz yyyy -file.report.declared.by=\u5ba3\u8a00\u8005 -file.report.declared.on=\u5ba3\u8a00\u65e5 -file.report.destroyed=\u7834\u68c4\u6e08\u307f -file.report.destroyed.records=\u7834\u68c4\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 -file.report.destruction.report=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8 -file.report.disposition.authority=\u4fdd\u7ba1\u6a29\u9650 -file.report.disposition.instructions=\u4fdd\u7ba1\u6307\u793a -file.report.nara=NARA -file.report.transfer.date=\u8ee2\u9001\u65e5 -file.report.transfer.location=\u8ee2\u9001\u5834\u6240 -file.report.transfer.report=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8 -file.report.transferred.items=\u8ee2\u9001\u6e08\u307f\u30a2\u30a4\u30c6\u30e0 -file.report.performed.by=\u5b9f\u884c\u8005 -file.report.record=\u30ec\u30b3\u30fc\u30c9 -file.report.record.folder=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 -file.report.unique.folder.identifier=\u4e00\u610f\u306e\u30d5\u30a9\u30eb\u30c0 ID -file.report.unique.record.identifier=\u4e00\u610f\u306e\u30ec\u30b3\u30fc\u30c9 ID -file.report.hold.report=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8 -file.report.hold.name=\u30db\u30fc\u30eb\u30c9\u540d -file.report.hold.description=\u30db\u30fc\u30eb\u30c9\u8aac\u660e -file.report.hold.reason=\u30db\u30fc\u30eb\u30c9\u7406\u7531 -file.report.hold.held=\u30db\u30fc\u30eb\u30c9\u6e08\u307f -file.report.createdby=\u4f5c\u6210\u8005 +# File Report Template +file.report.acession.report=\u53d7\u8afe\u30ec\u30dd\u30fc\u30c8 +file.report.date.format=EEE\u5e74MMM\u6708dd\u65e5\u3001HH:mm:ss zzz yyyy +file.report.declared.by=\u5ba3\u8a00\u8005 +file.report.declared.on=\u5ba3\u8a00\u65e5 +file.report.destroyed=\u7834\u68c4\u6e08\u307f +file.report.destroyed.records=\u7834\u68c4\u6e08\u307f\u30ec\u30b3\u30fc\u30c9 +file.report.destruction.report=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8 +file.report.disposition.authority=\u4fdd\u7ba1\u6a29\u9650 +file.report.disposition.instructions=\u4fdd\u7ba1\u6307\u793a +file.report.nara=NARA +file.report.transfer.date=\u8ee2\u9001\u65e5 +file.report.transfer.location=\u8ee2\u9001\u5834\u6240 +file.report.transfer.report=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8 +file.report.transferred.items=\u8ee2\u9001\u6e08\u307f\u30a2\u30a4\u30c6\u30e0 +file.report.performed.by=\u5b9f\u884c\u8005 +file.report.record=\u30ec\u30b3\u30fc\u30c9 +file.report.record.folder=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0 +file.report.unique.folder.identifier=\u4e00\u610f\u306e\u30d5\u30a9\u30eb\u30c0 ID +file.report.unique.record.identifier=\u4e00\u610f\u306e\u30ec\u30b3\u30fc\u30c9 ID +file.report.hold.report=\u30db\u30fc\u30eb\u30c9\u30ec\u30dd\u30fc\u30c8 +file.report.hold.name=\u30db\u30fc\u30eb\u30c9\u540d +file.report.hold.description=\u30db\u30fc\u30eb\u30c9\u8aac\u660e +file.report.hold.reason=\u30db\u30fc\u30eb\u30c9\u7406\u7531 +file.report.hold.held=\u30db\u30fc\u30eb\u30c9\u6e08\u307f +file.report.createdby=\u4f5c\u6210\u8005 file.report.createdon=\u4f5c\u6210\u65e5 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties index c26d519f43..693a6d7ae7 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=Tilgangsrapport -file.report.date.format=EEE MMM dd TT:mm:ss zzz \u00e5\u00e5\u00e5\u00e5 -file.report.declared.by=erkl\u00e6rt av -file.report.declared.on=p\u00e5 -file.report.destroyed=Destruert -file.report.destroyed.records=Destruerte oppf\u00f8ringer -file.report.destruction.report=Destruksjonsrapport -file.report.disposition.authority=Retensjonsrett -file.report.disposition.instructions=Retensjonsinstruksjoner -file.report.nara=NARA -file.report.transfer.date=Overf\u00f8ringsdato -file.report.transfer.location=Overf\u00f8ringssted -file.report.transfer.report=Overf\u00f8ringsrapport -file.report.transferred.items=Overf\u00f8rte elementer -file.report.performed.by=Utf\u00f8rt av -file.report.record=Oppf\u00f8ring -file.report.record.folder=Oppf\u00f8ringsmappe -file.report.unique.folder.identifier=Unik mappe-ID -file.report.unique.record.identifier=Unik oppf\u00f8rings-ID -file.report.hold.report=Holdrapport -file.report.hold.name=Holdnavn -file.report.hold.description=Holdbeskrivelse -file.report.hold.reason=Grunn til holdet -file.report.hold.held=Hold -file.report.createdby=Opprettet av +# File Report Template +file.report.acession.report=Tilgangsrapport +file.report.date.format=EEE MMM dd TT:mm:ss zzz \u00e5\u00e5\u00e5\u00e5 +file.report.declared.by=erkl\u00e6rt av +file.report.declared.on=p\u00e5 +file.report.destroyed=Destruert +file.report.destroyed.records=Destruerte oppf\u00f8ringer +file.report.destruction.report=Destruksjonsrapport +file.report.disposition.authority=Retensjonsrett +file.report.disposition.instructions=Retensjonsinstruksjoner +file.report.nara=NARA +file.report.transfer.date=Overf\u00f8ringsdato +file.report.transfer.location=Overf\u00f8ringssted +file.report.transfer.report=Overf\u00f8ringsrapport +file.report.transferred.items=Overf\u00f8rte elementer +file.report.performed.by=Utf\u00f8rt av +file.report.record=Oppf\u00f8ring +file.report.record.folder=Oppf\u00f8ringsmappe +file.report.unique.folder.identifier=Unik mappe-ID +file.report.unique.record.identifier=Unik oppf\u00f8rings-ID +file.report.hold.report=Holdrapport +file.report.hold.name=Holdnavn +file.report.hold.description=Holdbeskrivelse +file.report.hold.reason=Grunn til holdet +file.report.hold.held=Hold +file.report.createdby=Opprettet av file.report.createdon=Opprettet den \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties index 1c8dcaf353..4fb5e8c011 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=Overdrachtsrapport -file.report.date.format=EEE MMM dd UU:mm:ss zzz jjjj -file.report.declared.by=gedeclareerd door -file.report.declared.on=op -file.report.destroyed=Vernietigd -file.report.destroyed.records=Vernietigde records -file.report.destruction.report=Vernietigingsrapport -file.report.disposition.authority=Retentieautoriteit -file.report.disposition.instructions=Retentie-instructies -file.report.nara=Nationaal Archief -file.report.transfer.date=Overzetdatum -file.report.transfer.location=Overzetlocatie -file.report.transfer.report=Overzetrapport -file.report.transferred.items=Overgezette objecten -file.report.performed.by=Uitgevoerd door -file.report.record=Record -file.report.record.folder=Archiefmap -file.report.unique.folder.identifier=Unieke id archiefmap -file.report.unique.record.identifier=Unieke id record -file.report.hold.report=Rapport wachtstand -file.report.hold.name=Naam wachtstand -file.report.hold.description=Beschrijving wachtstand -file.report.hold.reason=Reden van wachtstand -file.report.hold.held=In wachtstand -file.report.createdby=Gemaakt door +# File Report Template +file.report.acession.report=Overdrachtsrapport +file.report.date.format=EEE MMM dd UU:mm:ss zzz jjjj +file.report.declared.by=gedeclareerd door +file.report.declared.on=op +file.report.destroyed=Vernietigd +file.report.destroyed.records=Vernietigde records +file.report.destruction.report=Vernietigingsrapport +file.report.disposition.authority=Retentieautoriteit +file.report.disposition.instructions=Retentie-instructies +file.report.nara=Nationaal Archief +file.report.transfer.date=Overzetdatum +file.report.transfer.location=Overzetlocatie +file.report.transfer.report=Overzetrapport +file.report.transferred.items=Overgezette objecten +file.report.performed.by=Uitgevoerd door +file.report.record=Record +file.report.record.folder=Archiefmap +file.report.unique.folder.identifier=Unieke id archiefmap +file.report.unique.record.identifier=Unieke id record +file.report.hold.report=Rapport wachtstand +file.report.hold.name=Naam wachtstand +file.report.hold.description=Beschrijving wachtstand +file.report.hold.reason=Reden van wachtstand +file.report.hold.held=In wachtstand +file.report.createdby=Gemaakt door file.report.createdon=Gemaakt op \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties index e3592ebe7d..915768e1dc 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=Relat\u00f3rio de ades\u00e3o -file.report.date.format=EEE MMM dd HH:mm:ss zzz aaaa -file.report.declared.by=declarado por -file.report.declared.on=em -file.report.destroyed=Destru\u00eddos -file.report.destroyed.records=Documentos arquiv\u00edsticos destru\u00eddos -file.report.destruction.report=Relat\u00f3rio de destrui\u00e7\u00e3o -file.report.disposition.authority=Autoridade de reten\u00e7\u00e3o -file.report.disposition.instructions=Instru\u00e7\u00f5es de reten\u00e7\u00e3o -file.report.nara=NARA -file.report.transfer.date=Data de transfer\u00eancia -file.report.transfer.location=Local de transfer\u00eancia -file.report.transfer.report=Relat\u00f3rio de transfer\u00eancia -file.report.transferred.items=Itens transferidos -file.report.performed.by=Executado por -file.report.record=Documento arquiv\u00edstico -file.report.record.folder=Pasta de documento arquiv\u00edstico -file.report.unique.folder.identifier=ID exclusivo da pasta -file.report.unique.record.identifier=ID exclusivo do documento arquiv\u00edstico -file.report.hold.report=Relat\u00f3rio de espera -file.report.hold.name=Nome da espera -file.report.hold.description=Descri\u00e7\u00e3o da espera -file.report.hold.reason=Motivo para manter -file.report.hold.held=Mantido -file.report.createdby=Criado por +# File Report Template +file.report.acession.report=Relat\u00f3rio de ades\u00e3o +file.report.date.format=EEE MMM dd HH:mm:ss zzz aaaa +file.report.declared.by=declarado por +file.report.declared.on=em +file.report.destroyed=Destru\u00eddos +file.report.destroyed.records=Documentos arquiv\u00edsticos destru\u00eddos +file.report.destruction.report=Relat\u00f3rio de destrui\u00e7\u00e3o +file.report.disposition.authority=Autoridade de reten\u00e7\u00e3o +file.report.disposition.instructions=Instru\u00e7\u00f5es de reten\u00e7\u00e3o +file.report.nara=NARA +file.report.transfer.date=Data de transfer\u00eancia +file.report.transfer.location=Local de transfer\u00eancia +file.report.transfer.report=Relat\u00f3rio de transfer\u00eancia +file.report.transferred.items=Itens transferidos +file.report.performed.by=Executado por +file.report.record=Documento arquiv\u00edstico +file.report.record.folder=Pasta de documento arquiv\u00edstico +file.report.unique.folder.identifier=ID exclusivo da pasta +file.report.unique.record.identifier=ID exclusivo do documento arquiv\u00edstico +file.report.hold.report=Relat\u00f3rio de espera +file.report.hold.name=Nome da espera +file.report.hold.description=Descri\u00e7\u00e3o da espera +file.report.hold.reason=Motivo para manter +file.report.hold.held=Mantido +file.report.createdby=Criado por file.report.createdon=Criado em \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties index 70e225667f..075b08d85e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0435 -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e -file.report.declared.on=\u043d\u0430 -file.report.destroyed=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043e -file.report.destroyed.records=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -file.report.destruction.report=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 -file.report.disposition.authority=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 -file.report.disposition.instructions=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e -file.report.nara=NARA -file.report.transfer.date=\u0414\u0430\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -file.report.transfer.location=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 -file.report.transfer.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 -file.report.transferred.items=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b -file.report.performed.by=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e -file.report.record=\u0417\u0430\u043f\u0438\u0441\u044c -file.report.record.folder=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -file.report.unique.folder.identifier=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0430\u043f\u043a\u0438 -file.report.unique.record.identifier=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 -file.report.hold.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 -file.report.hold.name=\u0418\u043c\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -file.report.hold.description=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -file.report.hold.reason=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -file.report.hold.held=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e -file.report.createdby=\u0421\u043e\u0437\u0434\u0430\u043b +# File Report Template +file.report.acession.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0435 +file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.declared.by=\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e +file.report.declared.on=\u043d\u0430 +file.report.destroyed=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043e +file.report.destroyed.records=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +file.report.destruction.report=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 +file.report.disposition.authority=\u041f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u044f \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 +file.report.disposition.instructions=\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e +file.report.nara=NARA +file.report.transfer.date=\u0414\u0430\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 +file.report.transfer.location=\u041c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 +file.report.transfer.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 +file.report.transferred.items=\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b +file.report.performed.by=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e +file.report.record=\u0417\u0430\u043f\u0438\u0441\u044c +file.report.record.folder=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 +file.report.unique.folder.identifier=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0430\u043f\u043a\u0438 +file.report.unique.record.identifier=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 +file.report.hold.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 +file.report.hold.name=\u0418\u043c\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +file.report.hold.description=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +file.report.hold.reason=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 +file.report.hold.held=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e +file.report.createdby=\u0421\u043e\u0437\u0434\u0430\u043b file.report.createdon=\u0421\u043e\u0437\u0434\u0430\u043d\u043e \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_zh_CN.properties index b394fe8d26..42526a169b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/template_zh_CN.properties @@ -1,27 +1,27 @@ -# File Report Template -file.report.acession.report=\u5165\u7ba1\u62a5\u544a -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=\u58f0\u660e\u8005 -file.report.declared.on=\u5f00 -file.report.destroyed=\u5df2\u9500\u6bc1 -file.report.destroyed.records=\u5df2\u9500\u6bc1\u8bb0\u5f55 -file.report.destruction.report=\u9500\u6bc1\u62a5\u544a -file.report.disposition.authority=\u4fdd\u7559\u6388\u6743 -file.report.disposition.instructions=\u4fdd\u7559\u8bf4\u660e -file.report.nara=NARA -file.report.transfer.date=\u79fb\u4ea4\u65e5\u671f -file.report.transfer.location=\u79fb\u4ea4\u4f4d\u7f6e -file.report.transfer.report=\u79fb\u4ea4\u62a5\u544a -file.report.transferred.items=\u79fb\u4ea4\u7684\u9879 -file.report.performed.by=\u6267\u884c\u8005 -file.report.record=\u8bb0\u5f55 -file.report.record.folder=\u8bb0\u5f55\u6587\u4ef6\u5939 -file.report.unique.folder.identifier=\u552f\u4e00\u6587\u4ef6\u5939 ID -file.report.unique.record.identifier=\u552f\u4e00\u8bb0\u5f55 ID -file.report.hold.report=\u4fdd\u5b58\u62a5\u544a -file.report.hold.name=\u4fdd\u5b58\u540d\u79f0 -file.report.hold.description=\u4fdd\u5b58\u8bf4\u660e -file.report.hold.reason=\u4fdd\u5b58\u539f\u56e0 -file.report.hold.held=\u4fdd\u5b58 -file.report.createdby=\u521b\u5efa\u8005 +# File Report Template +file.report.acession.report=\u5165\u7ba1\u62a5\u544a +file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.declared.by=\u58f0\u660e\u8005 +file.report.declared.on=\u5f00 +file.report.destroyed=\u5df2\u9500\u6bc1 +file.report.destroyed.records=\u5df2\u9500\u6bc1\u8bb0\u5f55 +file.report.destruction.report=\u9500\u6bc1\u62a5\u544a +file.report.disposition.authority=\u4fdd\u7559\u6388\u6743 +file.report.disposition.instructions=\u4fdd\u7559\u8bf4\u660e +file.report.nara=NARA +file.report.transfer.date=\u79fb\u4ea4\u65e5\u671f +file.report.transfer.location=\u79fb\u4ea4\u4f4d\u7f6e +file.report.transfer.report=\u79fb\u4ea4\u62a5\u544a +file.report.transferred.items=\u79fb\u4ea4\u7684\u9879 +file.report.performed.by=\u6267\u884c\u8005 +file.report.record=\u8bb0\u5f55 +file.report.record.folder=\u8bb0\u5f55\u6587\u4ef6\u5939 +file.report.unique.folder.identifier=\u552f\u4e00\u6587\u4ef6\u5939 ID +file.report.unique.record.identifier=\u552f\u4e00\u8bb0\u5f55 ID +file.report.hold.report=\u4fdd\u5b58\u62a5\u544a +file.report.hold.name=\u4fdd\u5b58\u540d\u79f0 +file.report.hold.description=\u4fdd\u5b58\u8bf4\u660e +file.report.hold.reason=\u4fdd\u5b58\u539f\u56e0 +file.report.hold.held=\u4fdd\u5b58 +file.report.createdby=\u521b\u5efa\u8005 file.report.createdon=\u521b\u5efa\u65f6\u95f4 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml index a4587c061f..d194cb8743 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml @@ -1,129 +1,129 @@ - - - - - - - - - - - Recordable Version Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - Recordable Version Policy List - - - NONE - MAJOR_ONLY - ALL - - - false - - - - - - - - - - - - - File Plan - d:noderef - - - - - Recordable Version Policy - d:text - NONE - - - - - - - - - - - - - - - - - Record Node Reference - d:noderef - - - - - Frozen Owner - d:text - - - - - Destroyed - d:boolean - false> - - - - - - - - - - - - d:noderef - - - - - d:text - - - - d:text - - - - - - + + + + + + + + + + + Recordable Version Model + Roy Wetherall + 1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + Recordable Version Policy List + + + NONE + MAJOR_ONLY + ALL + + + false + + + + + + + + + + + + + File Plan + d:noderef + + + + + Recordable Version Policy + d:text + NONE + + + + + + + + + + + + + + + + + Record Node Reference + d:noderef + + + + + Frozen Owner + d:text + + + + + Destroyed + d:boolean + false> + + + + + + + + + + + + d:noderef + + + + + d:text + + + + d:text + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml index 27ca16ccef..ff24431ddc 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsModel.xml @@ -1,1229 +1,1229 @@ - - - - - - - - - Records Management Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - - RM Site - st:site - false - - - - - Caveat Config - cm:content - false - - - - Email Config - cm:content - - rma:filePlanComponent - - - - - - - - Records Management Container - cm:folder - false - - - cm:titled - rma:recordComponentIdentifier - rma:filePlanComponent - - - - - - - Record Category - rma:recordsManagementContainer - - - rma:vitalRecordDefinition - - - - - - - File Plan - rma:recordsManagementContainer - - - rma:recordsManagementRoot - - - - - - Unfiled Record Container - rma:recordsManagementContainer - - - - Unfiled Record Folder - rma:recordsManagementContainer - - - - Hold Container - rma:recordsManagementContainer - - rma:countable - - - - - Transfer Container - rma:recordsManagementContainer - - rma:countable - - - - - - - Disposition Schedule - cm:cmobject - - - - - Disposition Authority - d:text - true - - true - false - false - - - - - Disposition Instructions - d:text - true - - - - Record Level Disposition - d:boolean - true - false - - - - - - - - Disposition Actions - - false - false - - - rma:dispositionActionDefinition - false - true - - - - - - - rma:filePlanComponent - - - - - - Disposition Action Definition - cm:cmobject - - - - - Disposition Action Name - d:text - true - - - - Disposition Description - d:text - false - - - - Disposition Location - d:text - false - - true - false - false - - - - - Disposition Period - d:period - false - none|0 - - - - Disposition Period Property - d:text - false - - true - false - false - - - - - Disposition Event - d:text - true - - true - false - false - - - - - Disposition Event Combination - d:text - true - or - - true - false - false - - - - - - rma:filePlanComponent - - - - - - Record Folder - cm:folder - false - - - - - - - - Record Folder Closed - Indicates whether the folder is closed - d:boolean - true - true - false - - - - - - cm:titled - rma:recordComponentIdentifier - rma:commonRecordDetails - rma:filePlanComponent - rma:heldChildren - - - - - - - Non-Electronic Document - cm:content - false - - - - Document Physical Size - d:int - false - - true - false - false - - - - - Number Of Copies - d:int - false - 1 - - true - false - false - - - - - Storage Location - d:text - false - - true - false - false - - - - - Shelf - d:text - false - - true - false - false - - - - - Box - d:text - false - - true - false - false - - - - - File - d:text - false - - true - false - false - - - - - - rma:filePlanComponent - - - - - Disposition Action - cm:cmobject - - - Disposition Action Id - d:text - true - - true - false - false - - - - Disposition Action - d:text - true - - true - false - false - - - - Disposition Action Date - d:date - false - - - Disposition Events Eligible - d:boolean - false - - - Disposition Action Started At - d:date - false - - - Disposition Action Started By - d:text - false - - true - false - false - - - - Disposition Action Completed At - d:date - false - - - Disposition Action Copmleted By - d:text - false - - true - false - false - - - - - - - - - Event executions - - false - false - - - rma:eventExecution - false - true - - - - - - - rma:filePlanComponent - - - - - - - Event Execution - Execution details of an event - cm:cmobject - - - - - Event Name - d:text - true - - true - false - false - - - - Event automatic - d:boolean - true - - - Event complete - d:boolean - true - false - - - Event completed by - d:text - false - - true - false - false - - - - Event completed at - d:date - false - - - - - - rma:filePlanComponent - - - - - - Hold - rma:recordsManagementContainer - false - - - - - Hold Reason - d:text - true - - - - - - - Frozen Records - - false - true - - - rma:filePlanComponent - false - true - - - - - - - - - Transfer - cm:folder - false - - - - - Transfer Accession Indicator - d:boolean - true - true - - - - Transfer PDF Indicator - Indicates that transfer includes PDF - d:boolean - true - false - - - - Transfer PDF Indicator - Transfer Location - d:text - - - - - - - - Transferred - - false - false - - - rma:dispositionLifecycle - false - true - - - - - - - cm:titled - rma:filePlanComponent - - - - - - - - - - - - File Plan Component - false - - - Root node reference - d:noderef - true - - - - - - - Records Management Root - - - - - Holds - - false - false - - - rma:hold - false - true - - - - - - Transfers - - false - false - - - rma:transfer - false - true - - - - - - - - Declared Record - - - Date Declared - d:date - - - Declared By - d:text - - true - false - false - - - - - rma:filePlanComponent - - - - - Record component identifier - - - Record Component Identifier - d:text - true - - true - false - false - - - - Database uniqueness id - d:text - true - false - - - - rma:filePlanComponent - - - - - Vital Record Definition - - - Review Period - d:period - none|0 - - - Vital Record Indicator - d:boolean - false - - - - rma:filePlanComponent - - - - - - - Record - - false - - - - - - - - Date Filed - d:date - - - - Original Name - d:text - true - - - - - - - - d:date - false - - - d:text - false - - true - false - false - - - - d:text - false - - true - false - false - - - - d:text - false - - true - false - false - - - - d:text - false - - true - false - false - - - - d:date - false - - - d:text - false - - true - false - false - - - - d:text - false - - true - false - false - - - - - - - cm:titled - rma:recordComponentIdentifier - rma:commonRecordDetails - rma:filePlanComponent - - - - - - - - - - - - - - Location - d:text - false - - true - false - false - - - - - - rma:filePlanComponent - - - - - - - - - d:any - true - - - d:any - true - - - - - - - - Vital Record - - - Next Review Date - d:date - false - - - Indicates whether a notification that this record is due for review has been issued - d:boolean - true - false - false - - - - rma:filePlanComponent - - - - - Scheduled - - - - Disposition Schedule - - false - false - - - rma:dispositionSchedule - false - false - - - - - - rma:filePlanComponent - - - - - Disposition Lifecycle - - - - Next disposition action - - false - false - - - rma:dispositionAction - false - false - - - - - - Disposition Action History - - false - false - - - rma:dispositionAction - false - true - - - - - - rma:filePlanComponent - - - - - - Cut Off - - - Cut Off Date - d:date - true - - - - - - Uncut Off - - - - - Transferring - - - - - Transferred - - - - - Ascended - - - - Frozen - - - Frozen At Date - d:date - true - - - Frozen By - d:text - true - - true - false - false - - - - - - - Caveat Config Root - - - - true - false - - - rma:caveatConfig - false - false - - false - - - - - - Email Config Root - - - - true - false - - - rma:emailConfig - false - false - - false - - - - - - - - Record Search - - - d:boolean - true - - - d:text - true - - true - false - false - - - - d:date - true - - - d:text - true - - true - false - false - - - - d:text - true - - true - false - false - - - - d:boolean - true - - - d:text - true - true - - true - false - false - - - - d:text - true - - true - false - false - - - - d:text - true - - - - d:text - true - - - d:text - true - - true - false - false - - - - d:text - true - - true - false - false - - - - - - - Versioned Record - - - - Unpublished Update - - - d:boolean - true - true - - - d:text - - - d:any - - - d:boolean - true - false - - - - - - - Ghosted Record - false - - - - - Loaded Data Set Id - - - List of the loaded Data Set Ids - d:text - true - - - - - - - The originating details of a record - - - d:text - true - - - d:date - true - - - d:noderef - true - - - - - - - The rejection details of a record - - - d:text - true - - - d:date - true - - - d:text - true - - - - - - - - Held children - - - d:int - true - true - 0 - - - - - - - Countable aspect - - - d:int - true - true - 0 - - - - - - + + + + + + + + + Records Management Model + Roy Wetherall + 1.0 + + + + + + + + + + + + + + + + + + + + + + + RM Site + st:site + false + + + + + Caveat Config + cm:content + false + + + + Email Config + cm:content + + rma:filePlanComponent + + + + + + + + Records Management Container + cm:folder + false + + + cm:titled + rma:recordComponentIdentifier + rma:filePlanComponent + + + + + + + Record Category + rma:recordsManagementContainer + + + rma:vitalRecordDefinition + + + + + + + File Plan + rma:recordsManagementContainer + + + rma:recordsManagementRoot + + + + + + Unfiled Record Container + rma:recordsManagementContainer + + + + Unfiled Record Folder + rma:recordsManagementContainer + + + + Hold Container + rma:recordsManagementContainer + + rma:countable + + + + + Transfer Container + rma:recordsManagementContainer + + rma:countable + + + + + + + Disposition Schedule + cm:cmobject + + + + + Disposition Authority + d:text + true + + true + false + false + + + + + Disposition Instructions + d:text + true + + + + Record Level Disposition + d:boolean + true + false + + + + + + + + Disposition Actions + + false + false + + + rma:dispositionActionDefinition + false + true + + + + + + + rma:filePlanComponent + + + + + + Disposition Action Definition + cm:cmobject + + + + + Disposition Action Name + d:text + true + + + + Disposition Description + d:text + false + + + + Disposition Location + d:text + false + + true + false + false + + + + + Disposition Period + d:period + false + none|0 + + + + Disposition Period Property + d:text + false + + true + false + false + + + + + Disposition Event + d:text + true + + true + false + false + + + + + Disposition Event Combination + d:text + true + or + + true + false + false + + + + + + rma:filePlanComponent + + + + + + Record Folder + cm:folder + false + + + + + + + + Record Folder Closed + Indicates whether the folder is closed + d:boolean + true + true + false + + + + + + cm:titled + rma:recordComponentIdentifier + rma:commonRecordDetails + rma:filePlanComponent + rma:heldChildren + + + + + + + Non-Electronic Document + cm:content + false + + + + Document Physical Size + d:int + false + + true + false + false + + + + + Number Of Copies + d:int + false + 1 + + true + false + false + + + + + Storage Location + d:text + false + + true + false + false + + + + + Shelf + d:text + false + + true + false + false + + + + + Box + d:text + false + + true + false + false + + + + + File + d:text + false + + true + false + false + + + + + + rma:filePlanComponent + + + + + Disposition Action + cm:cmobject + + + Disposition Action Id + d:text + true + + true + false + false + + + + Disposition Action + d:text + true + + true + false + false + + + + Disposition Action Date + d:date + false + + + Disposition Events Eligible + d:boolean + false + + + Disposition Action Started At + d:date + false + + + Disposition Action Started By + d:text + false + + true + false + false + + + + Disposition Action Completed At + d:date + false + + + Disposition Action Copmleted By + d:text + false + + true + false + false + + + + + + + + + Event executions + + false + false + + + rma:eventExecution + false + true + + + + + + + rma:filePlanComponent + + + + + + + Event Execution + Execution details of an event + cm:cmobject + + + + + Event Name + d:text + true + + true + false + false + + + + Event automatic + d:boolean + true + + + Event complete + d:boolean + true + false + + + Event completed by + d:text + false + + true + false + false + + + + Event completed at + d:date + false + + + + + + rma:filePlanComponent + + + + + + Hold + rma:recordsManagementContainer + false + + + + + Hold Reason + d:text + true + + + + + + + Frozen Records + + false + true + + + rma:filePlanComponent + false + true + + + + + + + + + Transfer + cm:folder + false + + + + + Transfer Accession Indicator + d:boolean + true + true + + + + Transfer PDF Indicator + Indicates that transfer includes PDF + d:boolean + true + false + + + + Transfer PDF Indicator + Transfer Location + d:text + + + + + + + + Transferred + + false + false + + + rma:dispositionLifecycle + false + true + + + + + + + cm:titled + rma:filePlanComponent + + + + + + + + + + + + File Plan Component + false + + + Root node reference + d:noderef + true + + + + + + + Records Management Root + + + + + Holds + + false + false + + + rma:hold + false + true + + + + + + Transfers + + false + false + + + rma:transfer + false + true + + + + + + + + Declared Record + + + Date Declared + d:date + + + Declared By + d:text + + true + false + false + + + + + rma:filePlanComponent + + + + + Record component identifier + + + Record Component Identifier + d:text + true + + true + false + false + + + + Database uniqueness id + d:text + true + false + + + + rma:filePlanComponent + + + + + Vital Record Definition + + + Review Period + d:period + none|0 + + + Vital Record Indicator + d:boolean + false + + + + rma:filePlanComponent + + + + + + + Record + + false + + + + + + + + Date Filed + d:date + + + + Original Name + d:text + true + + + + + + + + d:date + false + + + d:text + false + + true + false + false + + + + d:text + false + + true + false + false + + + + d:text + false + + true + false + false + + + + d:text + false + + true + false + false + + + + d:date + false + + + d:text + false + + true + false + false + + + + d:text + false + + true + false + false + + + + + + + cm:titled + rma:recordComponentIdentifier + rma:commonRecordDetails + rma:filePlanComponent + + + + + + + + + + + + + + Location + d:text + false + + true + false + false + + + + + + rma:filePlanComponent + + + + + + + + + d:any + true + + + d:any + true + + + + + + + + Vital Record + + + Next Review Date + d:date + false + + + Indicates whether a notification that this record is due for review has been issued + d:boolean + true + false + false + + + + rma:filePlanComponent + + + + + Scheduled + + + + Disposition Schedule + + false + false + + + rma:dispositionSchedule + false + false + + + + + + rma:filePlanComponent + + + + + Disposition Lifecycle + + + + Next disposition action + + false + false + + + rma:dispositionAction + false + false + + + + + + Disposition Action History + + false + false + + + rma:dispositionAction + false + true + + + + + + rma:filePlanComponent + + + + + + Cut Off + + + Cut Off Date + d:date + true + + + + + + Uncut Off + + + + + Transferring + + + + + Transferred + + + + + Ascended + + + + Frozen + + + Frozen At Date + d:date + true + + + Frozen By + d:text + true + + true + false + false + + + + + + + Caveat Config Root + + + + true + false + + + rma:caveatConfig + false + false + + false + + + + + + Email Config Root + + + + true + false + + + rma:emailConfig + false + false + + false + + + + + + + + Record Search + + + d:boolean + true + + + d:text + true + + true + false + false + + + + d:date + true + + + d:text + true + + true + false + false + + + + d:text + true + + true + false + false + + + + d:boolean + true + + + d:text + true + true + + true + false + false + + + + d:text + true + + true + false + false + + + + d:text + true + + + + d:text + true + + + d:text + true + + true + false + false + + + + d:text + true + + true + false + false + + + + + + + Versioned Record + + + + Unpublished Update + + + d:boolean + true + true + + + d:text + + + d:any + + + d:boolean + true + false + + + + + + + Ghosted Record + false + + + + + Loaded Data Set Id + + + List of the loaded Data Set Ids + d:text + true + + + + + + + The originating details of a record + + + d:text + true + + + d:date + true + + + d:noderef + true + + + + + + + The rejection details of a record + + + d:text + true + + + d:date + true + + + d:text + true + + + + + + + + Held children + + + d:int + true + true + 0 + + + + + + + Countable aspect + + + d:int + true + true + 0 + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml index 59017fcf50..d545517f44 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml @@ -1,497 +1,497 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/reportModel.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/reportModel.xml index a69c725725..d2d67043a6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/reportModel.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/reportModel.xml @@ -1,51 +1,51 @@ - - - - - - - - - Records Management Report Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - - Report - cm:content - - - Destruction Report - rmr:report - - - Transfer Report - rmr:report - - - Hold Report - rmr:report - - - + + + + + + + + + Records Management Report Model + Roy Wetherall + 1.0 + + + + + + + + + + + + + + + + + + + + + + + Report + cm:content + + + Destruction Report + rmr:report + + + Transfer Report + rmr:report + + + Hold Report + rmr:report + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml index 648d308704..d97f736648 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml @@ -1,162 +1,162 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module-context.xml index a5b3d722b5..0cd60808d3 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module-context.xml @@ -1,261 +1,261 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /${spaces.company_home.childname}/${spaces.dictionary.childname} - alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml - - - - - - - - - - - - - - - - alfresco.module.org_alfresco_module_rm.messages.notification-service - alfresco.module.org_alfresco_module_rm.messages.admin-service - alfresco.module.org_alfresco_module_rm.messages.records-management-service - alfresco.module.org_alfresco_module_rm.messages.action-service - alfresco.module.org_alfresco_module_rm.messages.audit-service - alfresco.module.org_alfresco_module_rm.messages.rm-events - alfresco.module.org_alfresco_module_rm.messages.capability-service - alfresco.module.org_alfresco_module_rm.messages.dataset-service - alfresco.module.org_alfresco_module_rm.messages.rm-system - alfresco.module.org_alfresco_module_rm.messages.template - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rmService - - - - - - - - - - - - - - - - - - - - - - caveatConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EEE, d MMM yyyy HH:mm:ss Z - EEE, d MMM yy HH:mm:ss Z - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /${spaces.company_home.childname}/${spaces.dictionary.childname} + alfresco/module/org_alfresco_module_rm/bootstrap/RMDataDictionaryBootstrap.xml + + + + + + + + + + + + + + + + alfresco.module.org_alfresco_module_rm.messages.notification-service + alfresco.module.org_alfresco_module_rm.messages.admin-service + alfresco.module.org_alfresco_module_rm.messages.records-management-service + alfresco.module.org_alfresco_module_rm.messages.action-service + alfresco.module.org_alfresco_module_rm.messages.audit-service + alfresco.module.org_alfresco_module_rm.messages.rm-events + alfresco.module.org_alfresco_module_rm.messages.capability-service + alfresco.module.org_alfresco_module_rm.messages.dataset-service + alfresco.module.org_alfresco_module_rm.messages.rm-system + alfresco.module.org_alfresco_module_rm.messages.template + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rmService + + + + + + + + + + + + + + + + + + + + + + caveatConfig + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EEE, d MMM yyyy HH:mm:ss Z + EEE, d MMM yy HH:mm:ss Z + + + + + + + + + + + + + + + + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties index 0d8ed72b10..011b9d2820 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/module.properties @@ -1,11 +1,11 @@ -# Alfresco Records Management Module -module.id=org_alfresco_module_rm - -# 23/02/2012 - Renamed -module.aliases=org_alfresco_module_dod5015 - -module.title=Records Management -module.description=Alfresco Record Management Extension -module.version=${rm.module.version} - +# Alfresco Records Management Module +module.id=org_alfresco_module_rm + +# 23/02/2012 - Renamed +module.aliases=org_alfresco_module_dod5015 + +module.title=Records Management +module.description=Alfresco Record Management Extension +module.version=${rm.module.version} + module.repo.version.min=${rm.module.repo.version.min} \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml index 684289caa3..7ca1fc7bab 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml @@ -1,51 +1,51 @@ - - - - - - - - - - classpath*:alfresco/module/org_alfresco_module_rm/version.properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + classpath*:alfresco/module/org_alfresco_module_rm/version.properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml index 863cc68bac..985a809082 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml @@ -1,66 +1,66 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml index 3652efbb00..aa0a740c59 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml @@ -1,107 +1,107 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml index ebe66b66e7..039ab39125 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml @@ -1,106 +1,106 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${rm.ghosting.enabled} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${rm.ghosting.enabled} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml index ac52237135..1600a1b836 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml @@ -1,37 +1,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml index a67ec59f6b..e3e843041e 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml @@ -1,18 +1,18 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMap.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMap.xml index 3b050f6164..e3f1c1a89d 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMap.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMap.xml @@ -1,23 +1,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml index bc08a1ec1b..8144e44bf6 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml @@ -1,13 +1,13 @@ - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml index 69f8fb517c..59f1687234 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml @@ -1,24 +1,24 @@ - - - - - - - - classpath:alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml - - - - - - - - - - - - - + + + + + + + + classpath:alfresco/module/org_alfresco_module_rm/query/rm-common-SqlMapConfig.xml + + + + + + + + + + + + + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml index 6042135cda..04257725c1 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml @@ -1,1158 +1,1158 @@ - - - - - - - - - - alfresco.module.org_alfresco_module_rm.messages.rm-actions - - - - - - - - - RECORD_CATEGORY - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - js - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction - org.alfresco.repo.action.executer.ActionExecuter - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.Destroy - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - ${rm.ghosting.enabled} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ReOpenFolders - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CloseFolders - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CycleVitalRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM.Declare.0 - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.UndeclareRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.PlanningReviewCycles - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ManuallyChangeDispositionDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeAllTransfers - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeNominatedTransfers - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CreateModifyDestroyFileplanMetadata - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.RejectRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.FileUnfiledRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.rmCopy - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.rmMove - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.LinkToRecords - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DeleteLinks - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${spaces.store} - - - /${spaces.company_home.childname} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DeleteHold - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ExtendRetentionPeriodOrFreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.Unfreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ViewUpdateReasonsForFreeze - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - - - + + + + + + + + + + alfresco.module.org_alfresco_module_rm.messages.rm-actions + + + + + + + + + RECORD_CATEGORY + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + js + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction + org.alfresco.repo.action.executer.ActionExecuter + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ApproveRecordsScheduledForCutoff + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.Destroy + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + ${rm.ghosting.enabled} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ReOpenFolders + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CloseFolders + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CycleVitalRecords + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM.Declare.0 + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.UndeclareRecords + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.PlanningReviewCycles + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ManuallyChangeDispositionDates + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AddModifyEventDates + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeAllTransfers + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.AuthorizeNominatedTransfers + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.CreateModifyDestroyFileplanMetadata + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.RejectRecords + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.FileUnfiledRecords + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.rmCopy + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.rmMove + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.LinkToRecords + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DeleteLinks + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${spaces.store} + + + /${spaces.company_home.childname} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DeleteHold + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ExtendRetentionPeriodOrFreeze + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.Unfreeze + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.ViewUpdateReasonsForFreeze + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW + org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml index 6f3d2bf7c9..61c53f3c6b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml @@ -1,95 +1,95 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml index 97d7422e3a..b2491bc092 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-capabilities-context.xml @@ -1,156 +1,156 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml index 7a855c5149..cc663d4f93 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml @@ -1,136 +1,136 @@ - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.RecordsManagementService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.RecordsManagementService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml index b83ba6243b..6577e35e1f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-disposition-properties-context.xml @@ -1,40 +1,40 @@ - - - - - - - - - - - - - - - - - - cutoff - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + cutoff + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-id-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-id-context.xml index e31aa1708f..7db5343e41 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-id-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-id-context.xml @@ -1,47 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-job-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-job-context.xml index fb5701337d..607fd1d9ec 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-job-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-job-context.xml @@ -1,154 +1,154 @@ - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJob - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 0/15 * * * ? - - - - - - - - org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJob - - - - - - - - - - - - - - - - - - - - - cutoff - retain - - - - - - - - - - - - - - - - - - - - - - ${rm.dispositionlifecycletrigger.cronexpression} - - - - - - org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJob - - - - - - - - - - - - - - - - - - - - 0/30 * * * * ? - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJob + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 0/15 * * * ? + + + + + + + + org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJob + + + + + + + + + + + + + + + + + + + + + cutoff + retain + + + + + + + + + + + + + + + + + + + + + + ${rm.dispositionlifecycletrigger.cronexpression} + + + + + + org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJob + + + + + + + + + + + + + + + + + + + + 0/30 * * * * ? + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml index b0360da5ed..7eb9c17eda 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml @@ -1,205 +1,205 @@ - - - - - - - - - - - - - alfresco/module/org_alfresco_module_rm/model/recordsModel.xml - - - - - alfresco/module/org_alfresco_module_rm/messages/records-model - - - - - - /app:company_home/app:dictionary/cm:records_management - - - path - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + alfresco/module/org_alfresco_module_rm/model/recordsModel.xml + + + + + alfresco/module/org_alfresco_module_rm/messages/records-model + + + + + + /app:company_home/app:dictionary/cm:records_management + + + path + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml index 13f2102dbe..8b773b3c9b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml @@ -1,176 +1,176 @@ - - - - - - - - - - - - - - - - - - - - - alfresco/model/permissionDefinitions.xml - - - alfresco/model/permissionSchema.dtd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {http://www.alfresco.org/model/recordsmanagement/1.0}filePlanComponent - - - - - - - - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${system.acl.maxPermissionCheckTimeMillis} - - - ${system.acl.maxPermissionChecks} - - - - {http://www.alfresco.org/model/recordsmanagement/1.0}filePlanComponent - - - - - - - ${system.acl.maxPermissionCheckTimeMillis} - - - ${system.acl.maxPermissionChecks} - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + alfresco/model/permissionDefinitions.xml + + + alfresco/model/permissionSchema.dtd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {http://www.alfresco.org/model/recordsmanagement/1.0}filePlanComponent + + + + + + + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${system.acl.maxPermissionCheckTimeMillis} + + + ${system.acl.maxPermissionChecks} + + + + {http://www.alfresco.org/model/recordsmanagement/1.0}filePlanComponent + + + + + + + ${system.acl.maxPermissionCheckTimeMillis} + + + ${system.acl.maxPermissionChecks} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-report-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-report-context.xml index 835c39182c..5df936757b 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-report-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-report-context.xml @@ -1,106 +1,106 @@ - - - - - - - - - - - alfresco/module/org_alfresco_module_rm/model/reportModel.xml - - - - - alfresco/module/org_alfresco_module_rm/messages/report-model - - - - - - - - - - alfresco.module.org_alfresco_module_rm.messages.report-service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rma:transfer - - - - - - - - - rma:hold - - - - + + + + + + + + + + + alfresco/module/org_alfresco_module_rm/model/reportModel.xml + + + + + alfresco/module/org_alfresco_module_rm/messages/report-model + + + + + + + + + + alfresco.module.org_alfresco_module_rm.messages.report-service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rma:transfer + + + + + + + + + rma:hold + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml index 5b25686727..0ed6c73149 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml @@ -1,1649 +1,1649 @@ - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService - - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.transfer.TransferService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rma:recordCategory - rma:recordFolder - rma:record - rma:nonElectronicDocument - - - - - - - org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cm:lastThumbnailModification - cm:autoVersion - cm:autoVersionOnUpdateProps - cm:initialVersion - - - - - - - org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.record.RecordService - - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService - - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Thread-Index - messageFrom - messageTo - messageCc - messageSubject - messageSent - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService - - - - customEmailMappingService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.caveatConfigTransactionalCache - - - - - - - - - - {http://www.alfresco.org/model/recordsmanagement/1.0}recordComponentIdentifier - - - - - - - - {http://www.alfresco.org/model/rmcustom/1.0}rmcustom - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService - - - - caveatConfigService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.hold.HoldService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService + + + + + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.transfer.TransferService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rma:recordCategory + rma:recordFolder + rma:record + rma:nonElectronicDocument + + + + + + + org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cm:lastThumbnailModification + cm:autoVersion + cm:autoVersionOnUpdateProps + cm:initialVersion + + + + + + + org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.record.RecordService + + + + + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService + + + + + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Thread-Index + messageFrom + messageTo + messageCc + messageSubject + messageSent + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService + + + + customEmailMappingService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.caveatConfigTransactionalCache + + + + + + + + + + {http://www.alfresco.org/model/recordsmanagement/1.0}recordComponentIdentifier + + + + + + + + {http://www.alfresco.org/model/rmcustom/1.0}rmcustom + + + + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService + + + + caveatConfigService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.hold.HoldService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml index a33e9d5673..3d8ea5c7e4 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml @@ -1,927 +1,927 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - RECORD_FOLDER - - - - - - - - - RECORD - - - - - - - - - RECORD_FOLDER - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - - RECORD_CATEGORY - RECORD_FOLDER - RECORD - UNFILED_RECORD_FOLDER - HOLD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - RECORD_CATEGORY - RECORD_FOLDER - RECORD - UNFILED_RECORD_FOLDER - HOLD - - - - - - - - - - FILE_PLAN - RECORD - RECORD_CATEGORY - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - HOLD_CONTAINER - HOLD - TRANSFER - TRANSFER_CONTAINER - - - - - - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - RECORD_FOLDER - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - TRANSFER - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - - - - - - - - - - - - - TRANSFER - - - - - - - - - - TRANSFER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - RECORD - - - - - - - - - - RECORD - - - - - - - - - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - - - RECORD - - - - - - - - - - - RECORD_CATEGORY - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - HOLD_CONTAINER - - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - HOLD - - - - - - - - - - HOLD - - - - - - - - - - HOLD - - - - - - - - - - RECORD - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + RECORD_FOLDER + + + + + + + + + RECORD + + + + + + + + + RECORD_FOLDER + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + + RECORD_CATEGORY + RECORD_FOLDER + RECORD + UNFILED_RECORD_FOLDER + HOLD + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + RECORD_CATEGORY + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + RECORD_CATEGORY + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD_FOLDER + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + RECORD_CATEGORY + RECORD_FOLDER + RECORD + UNFILED_RECORD_FOLDER + HOLD + + + + + + + + + + FILE_PLAN + RECORD + RECORD_CATEGORY + RECORD_FOLDER + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + HOLD_CONTAINER + HOLD + TRANSFER + TRANSFER_CONTAINER + + + + + + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + RECORD_FOLDER + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + TRANSFER + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + FILE_PLAN + RECORD_CATEGORY + + + + + + + + + + RECORD_CATEGORY + + + + + + + + + + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + + FILE_PLAN + RECORD_CATEGORY + RECORD_FOLDER + + + + + + + + + + + FILE_PLAN + RECORD_CATEGORY + RECORD_FOLDER + + + + + + + + + + + + + TRANSFER + + + + + + + + + + TRANSFER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + RECORD + + + + + + + + + + RECORD + + + + + + + + + + + FILE_PLAN + RECORD_CATEGORY + RECORD_FOLDER + UNFILED_RECORD_CONTAINER + UNFILED_RECORD_FOLDER + + + + + + + + + RECORD + + + + + + + + + + + RECORD_CATEGORY + + + + + + + + + RECORD + RECORD_FOLDER + + + + + + + + + + HOLD_CONTAINER + + + + + + + + + + RECORD + RECORD_FOLDER + + + + + + + + + + RECORD + RECORD_FOLDER + + + + + + + + + + HOLD + + + + + + + + + + HOLD + + + + + + + + + + HOLD + + + + + + + + + + RECORD + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml index d9de79a796..1f755ca57f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml @@ -1,92 +1,92 @@ - - - - - - - - - - alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml index 728ac66fc5..fedd555546 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml @@ -1,666 +1,666 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${rm.autocompletesuggestion.minfragmentsize} - - - ${rm.autocompletesuggestion.maxsuggestions.path} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${rm.autocompletesuggestion.minfragmentsize} + + + ${rm.autocompletesuggestion.maxsuggestions.path} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml index 6f843caa09..5b6dab5093 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-workflow-context.xml @@ -1,27 +1,27 @@ - - - - - - - - - activiti - alfresco/workflow/requestInfo.bpmn20.xml - text/xml - false - - - - - - alfresco/workflow/rmWorkflowModel.xml - - - - - alfresco/workflow/rm-workflow-messages - - - + + + + + + + + + activiti + alfresco/workflow/requestInfo.bpmn20.xml + text/xml + false + + + + + + alfresco/workflow/rmWorkflowModel.xml + + + + + alfresco/workflow/rm-workflow-messages + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json index 6b8ebd547a..5771b8d991 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json @@ -1,225 +1,225 @@ -[ - { - "name" : "ExtendedReaders", - "displayLabel" : "rm.role.extendedReaders", - "isAdmin" : false, - "capabilities" : - [ - "ViewRecords" - ] - }, - { - "name" : "ExtendedWriters", - "displayLabel" : "rm.role.extendedWriters", - "isAdmin" : false, - "capabilities" : - [ - "ViewRecords", - "EditNonRecordMetadata" - ] - }, - { - "name" : "User", - "displayLabel" : "rm.role.user", - "isAdmin" : false, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords" - ] - }, - { - "name" : "PowerUser", - "displayLabel" : "rm.role.powerUser", - "isAdmin" : false, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords", - "CreateRecords", - "CreateModifyDestroyFolders", - "EditRecordMetadata", - "EditNonRecordMetadata", - "AddModifyEventDates", - "CloseFolders", - "DeclareRecordsInClosedFolders", - "ReOpenFolders", - "CycleVitalRecords", - "PlanningReviewCycles", - "RequestRecordInformation", - "FileUnfiledRecords", - "RejectRecords", - "LinkToRecords" - ] - }, - { - "name" : "SecurityOfficer", - "displayLabel" : "rm.role.securityOfficer", - "isAdmin" : false, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords", - "CreateRecords", - "CreateModifyDestroyFolders", - "EditRecordMetadata", - "EditNonRecordMetadata", - "AddModifyEventDates", - "CloseFolders", - "DeclareRecordsInClosedFolders", - "ReOpenFolders", - "CycleVitalRecords", - "PlanningReviewCycles", - "RequestRecordInformation", - "FileUnfiledRecords", - "RejectRecords", - "LinkToRecords", - "ManageAccessControls" - ] - }, - { - "name" : "RecordsManager", - "displayLabel" : "rm.role.recordsManager", - "isAdmin" : false, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords", - "CreateRecords", - "CreateModifyDestroyFolders", - "EditRecordMetadata", - "EditNonRecordMetadata", - "AddModifyEventDates", - "CloseFolders", - "DeclareRecordsInClosedFolders", - "ReOpenFolders", - "CycleVitalRecords", - "PlanningReviewCycles", - "UpdateTriggerDates", - "CreateModifyDestroyEvents", - "ManageAccessRights", - "MoveRecords", - "ChangeOrDeleteReferences", - "DeleteLinks", - "EditDeclaredRecordMetadata", - "ManuallyChangeDispositionDates", - "ApproveRecordsScheduledForCutoff", - "CreateModifyRecordsInCutoffFolders", - "ExtendRetentionPeriodOrFreeze", - "ViewUpdateReasonsForFreeze", - "DestroyRecordsScheduledForDestruction", - "UpdateVitalRecordCycleInformation", - "UndeclareRecords", - "DeclareAuditAsRecord", - "DeleteAudit", - "AuthorizeNominatedTransfers", - "EditSelectionLists", - "AuthorizeAllTransfers", - "CreateModifyDestroyFileplanMetadata", - "CreateAndAssociateSelectionLists", - "AttachRulesToMetadataProperties", - "CreateModifyDestroyFileplanTypes", - "CreateModifyDestroyRecordTypes", - "MakeOptionalParametersMandatory", - "MapEmailMetadata", - "DeleteRecords", - "TriggerAnEvent", - "CreateModifyDestroyRoles", - "PasswordControl", - "EnableDisableAuditByTypes", - "SelectAuditMetadata", - "DisplayRightsReport", - "AccessAudit", - "ExportAudit", - "CreateModifyDestroyReferenceTypes", - "RequestRecordInformation", - "FileDestructionReport", - "FileUnfiledRecords", - "RejectRecords", - "LinkToRecords", - "FileTransferReport", - "CreateHold", - "AddToHold", - "RemoveFromHold", - "FileHoldReport", - "DeleteHold", - "EndRetention", - "EditHold", - "ManageAccessControls" - - ] - }, - { - "name" : "Administrator", - "displayLabel" : "rm.role.administrator", - "isAdmin" : true, - "capabilities" : - [ - "DeclareRecords", - "ViewRecords", - "CreateRecords", - "CreateModifyDestroyFolders", - "EditRecordMetadata", - "EditNonRecordMetadata", - "AddModifyEventDates", - "CloseFolders", - "DeclareRecordsInClosedFolders", - "ReOpenFolders", - "CycleVitalRecords", - "PlanningReviewCycles", - "UpdateTriggerDates", - "CreateModifyDestroyEvents", - "ManageAccessRights", - "MoveRecords", - "ChangeOrDeleteReferences", - "DeleteLinks", - "EditDeclaredRecordMetadata", - "ManuallyChangeDispositionDates", - "ApproveRecordsScheduledForCutoff", - "CreateModifyRecordsInCutoffFolders", - "ExtendRetentionPeriodOrFreeze", - "ViewUpdateReasonsForFreeze", - "DestroyRecordsScheduledForDestruction", - "UpdateVitalRecordCycleInformation", - "UndeclareRecords", - "DeclareAuditAsRecord", - "DeleteAudit", - "AuthorizeNominatedTransfers", - "EditSelectionLists", - "AuthorizeAllTransfers", - "CreateModifyDestroyFileplanMetadata", - "CreateAndAssociateSelectionLists", - "AttachRulesToMetadataProperties", - "CreateModifyDestroyFileplanTypes", - "CreateModifyDestroyRecordTypes", - "MakeOptionalParametersMandatory", - "MapEmailMetadata", - "DeleteRecords", - "TriggerAnEvent", - "CreateModifyDestroyRoles", - "CreateModifyDestroyUsersAndGroups", - "PasswordControl", - "EnableDisableAuditByTypes", - "SelectAuditMetadata", - "DisplayRightsReport", - "AccessAudit", - "ExportAudit", - "CreateModifyDestroyReferenceTypes", - "ManageAccessControls", - "ManageRules", - "RequestRecordInformation", - "FileDestructionReport", - "FileUnfiledRecords", - "RejectRecords", - "LinkToRecords", - "FileTransferReport", - "CreateHold", - "AddToHold", - "RemoveFromHold", - "FileHoldReport", - "DeleteHold", - "EditHold", - "EndRetention" - ] - } +[ + { + "name" : "ExtendedReaders", + "displayLabel" : "rm.role.extendedReaders", + "isAdmin" : false, + "capabilities" : + [ + "ViewRecords" + ] + }, + { + "name" : "ExtendedWriters", + "displayLabel" : "rm.role.extendedWriters", + "isAdmin" : false, + "capabilities" : + [ + "ViewRecords", + "EditNonRecordMetadata" + ] + }, + { + "name" : "User", + "displayLabel" : "rm.role.user", + "isAdmin" : false, + "capabilities" : + [ + "DeclareRecords", + "ViewRecords" + ] + }, + { + "name" : "PowerUser", + "displayLabel" : "rm.role.powerUser", + "isAdmin" : false, + "capabilities" : + [ + "DeclareRecords", + "ViewRecords", + "CreateRecords", + "CreateModifyDestroyFolders", + "EditRecordMetadata", + "EditNonRecordMetadata", + "AddModifyEventDates", + "CloseFolders", + "DeclareRecordsInClosedFolders", + "ReOpenFolders", + "CycleVitalRecords", + "PlanningReviewCycles", + "RequestRecordInformation", + "FileUnfiledRecords", + "RejectRecords", + "LinkToRecords" + ] + }, + { + "name" : "SecurityOfficer", + "displayLabel" : "rm.role.securityOfficer", + "isAdmin" : false, + "capabilities" : + [ + "DeclareRecords", + "ViewRecords", + "CreateRecords", + "CreateModifyDestroyFolders", + "EditRecordMetadata", + "EditNonRecordMetadata", + "AddModifyEventDates", + "CloseFolders", + "DeclareRecordsInClosedFolders", + "ReOpenFolders", + "CycleVitalRecords", + "PlanningReviewCycles", + "RequestRecordInformation", + "FileUnfiledRecords", + "RejectRecords", + "LinkToRecords", + "ManageAccessControls" + ] + }, + { + "name" : "RecordsManager", + "displayLabel" : "rm.role.recordsManager", + "isAdmin" : false, + "capabilities" : + [ + "DeclareRecords", + "ViewRecords", + "CreateRecords", + "CreateModifyDestroyFolders", + "EditRecordMetadata", + "EditNonRecordMetadata", + "AddModifyEventDates", + "CloseFolders", + "DeclareRecordsInClosedFolders", + "ReOpenFolders", + "CycleVitalRecords", + "PlanningReviewCycles", + "UpdateTriggerDates", + "CreateModifyDestroyEvents", + "ManageAccessRights", + "MoveRecords", + "ChangeOrDeleteReferences", + "DeleteLinks", + "EditDeclaredRecordMetadata", + "ManuallyChangeDispositionDates", + "ApproveRecordsScheduledForCutoff", + "CreateModifyRecordsInCutoffFolders", + "ExtendRetentionPeriodOrFreeze", + "ViewUpdateReasonsForFreeze", + "DestroyRecordsScheduledForDestruction", + "UpdateVitalRecordCycleInformation", + "UndeclareRecords", + "DeclareAuditAsRecord", + "DeleteAudit", + "AuthorizeNominatedTransfers", + "EditSelectionLists", + "AuthorizeAllTransfers", + "CreateModifyDestroyFileplanMetadata", + "CreateAndAssociateSelectionLists", + "AttachRulesToMetadataProperties", + "CreateModifyDestroyFileplanTypes", + "CreateModifyDestroyRecordTypes", + "MakeOptionalParametersMandatory", + "MapEmailMetadata", + "DeleteRecords", + "TriggerAnEvent", + "CreateModifyDestroyRoles", + "PasswordControl", + "EnableDisableAuditByTypes", + "SelectAuditMetadata", + "DisplayRightsReport", + "AccessAudit", + "ExportAudit", + "CreateModifyDestroyReferenceTypes", + "RequestRecordInformation", + "FileDestructionReport", + "FileUnfiledRecords", + "RejectRecords", + "LinkToRecords", + "FileTransferReport", + "CreateHold", + "AddToHold", + "RemoveFromHold", + "FileHoldReport", + "DeleteHold", + "EndRetention", + "EditHold", + "ManageAccessControls" + + ] + }, + { + "name" : "Administrator", + "displayLabel" : "rm.role.administrator", + "isAdmin" : true, + "capabilities" : + [ + "DeclareRecords", + "ViewRecords", + "CreateRecords", + "CreateModifyDestroyFolders", + "EditRecordMetadata", + "EditNonRecordMetadata", + "AddModifyEventDates", + "CloseFolders", + "DeclareRecordsInClosedFolders", + "ReOpenFolders", + "CycleVitalRecords", + "PlanningReviewCycles", + "UpdateTriggerDates", + "CreateModifyDestroyEvents", + "ManageAccessRights", + "MoveRecords", + "ChangeOrDeleteReferences", + "DeleteLinks", + "EditDeclaredRecordMetadata", + "ManuallyChangeDispositionDates", + "ApproveRecordsScheduledForCutoff", + "CreateModifyRecordsInCutoffFolders", + "ExtendRetentionPeriodOrFreeze", + "ViewUpdateReasonsForFreeze", + "DestroyRecordsScheduledForDestruction", + "UpdateVitalRecordCycleInformation", + "UndeclareRecords", + "DeclareAuditAsRecord", + "DeleteAudit", + "AuthorizeNominatedTransfers", + "EditSelectionLists", + "AuthorizeAllTransfers", + "CreateModifyDestroyFileplanMetadata", + "CreateAndAssociateSelectionLists", + "AttachRulesToMetadataProperties", + "CreateModifyDestroyFileplanTypes", + "CreateModifyDestroyRecordTypes", + "MakeOptionalParametersMandatory", + "MapEmailMetadata", + "DeleteRecords", + "TriggerAnEvent", + "CreateModifyDestroyRoles", + "CreateModifyDestroyUsersAndGroups", + "PasswordControl", + "EnableDisableAuditByTypes", + "SelectAuditMetadata", + "DisplayRightsReport", + "AccessAudit", + "ExportAudit", + "CreateModifyDestroyReferenceTypes", + "ManageAccessControls", + "ManageRules", + "RequestRecordInformation", + "FileDestructionReport", + "FileUnfiledRecords", + "RejectRecords", + "LinkToRecords", + "FileTransferReport", + "CreateHold", + "AddToHold", + "RemoveFromHold", + "FileHoldReport", + "DeleteHold", + "EditHold", + "EndRetention" + ] + } ] \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml index 6931347171..1d500571ab 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security-context.xml @@ -1,20 +1,20 @@ - - - - - - - - - classpath*:alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties - - classpath*:alfresco/extension/rm-method-security.properties - - - - - - - - + + + + + + + + + classpath*:alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties + + classpath*:alfresco/extension/rm-method-security.properties + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties index 385b0d397e..350505fa84 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties @@ -1,228 +1,228 @@ -## -# RM Method security for Alfresco code services -# -# Note: add alfresco/extension/rm-method-security.properties to extend -## - -## Node Service - -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStores=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createStore=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.exists=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeStatus=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAllRootNodes=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getRootNode=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createNode=RM.Create.0.3 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.moveNode=RM.Move.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setChildAssociationIndex=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getType=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setType=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addAspect=RM.Update.0.1.2 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeAspect=RM.Update.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.hasAspect=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAspects=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.deleteNode=RM.Delete.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addChild=RM.Create.0.1.2 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeChild=RM.Delete.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeChildAssociation=RM.Delete.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getProperties=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getProperty=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setProperties=RM.UpdateProperties.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addProperties=RM.UpdateProperties.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setProperty=RM.UpdateProperties.0.1.2 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeProperty=RM.UpdateProperties.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getParentAssocs=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getParentAssocs=RM.Read.0.1.2 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocs=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildByName=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildrenByName=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPrimaryParent=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createAssociation=RM.Assoc.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeAssociation=Assoc.0.1 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getTargetAssocs=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getSourceAssocs=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAssoc=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPath=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPaths=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.restoreNode=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeRef=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsByPropertyValue=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.countChildAssocs=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeAclId=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.*=RM_DENY - -## File Folder Service - -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.list=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listFiles=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listFolders=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listDeepFolders=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getLocalizedSibling=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.search=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.searchSimple=RM.Read.0,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.rename=RM.Update.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.move=RM.Move.0.1 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.moveFrom=RM.Move.0.2 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.copy=RM.Read.0,RM.Create.1.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.create=RM.Create.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.delete=RM.Delete.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getNamePath=RM.Read.1 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getNameOnlyPath=RM.Read.1 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.resolveNamePath=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getFileInfo=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getReader=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getWriter=RM.WriteContent.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.exists=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getType=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.isHidden=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.setHidden=RM.Update.0 -rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.*=RM_DENY - -## Content Service - -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getStoreTotalSpace=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getStoreFreeSpace=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getRawReader=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getReader=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getWriter=RM.WriteContent.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.isTransformable=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getTransformer=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getMaxSourceSizeBytes=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getImageTransformer=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.transform=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getTempWriter=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.*=RM_DENY - -## Search Service - -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.query=RM_QUERY,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.selectNodes=RM_QUERY,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.selectProperties=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.contains=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.like=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.*=RM_DENY - -## Category Service - -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getChildren=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getCategories=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getClassifications=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getRootCategories=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getClassificationAspects=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createClassification=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createRootCategory=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createCategory=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.deleteClassification=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.deleteCategory=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getTopCategories=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.*=RM_DENY - -## Lock Service - -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.lock=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.unlock=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLockStatus=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLockType=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.checkForLock=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLocks=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.*=RM_DENY - -## Multilingual Content Service - -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslationContainer=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslations=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslationForLocale=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getMissingTranslations=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getPivotTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.isTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.makeTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.unmakeTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.addTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.addEmptyTranslation=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.copyTranslationContainer=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.moveTranslationContainer=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.deleteTranslationContainer=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.*=RM_DENY - -## Edition Service - -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.createEdition=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getEditions=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getVersionedTranslations=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getVersionedMetadatas=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.*=RM_DENY - -## Check Out Check In Service - -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.checkout=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.checkin=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.cancelCheckout=RM_ABSTAIN -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.getWorkingCopy=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.getCheckedOut=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.isWorkingCopy=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.isCheckedOut=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.*=RM_DENY - -## Permission Service - -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getOwnerAuthority=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllAuthorities=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllPermission=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getPermissions=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllSetPermissions=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getSettablePermissions=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.hasPermission=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.deletePermissions=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.deletePermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.setPermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.setInheritParentPermissions=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getInheritParentPermissions=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.clearPermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights -rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.*=RM_DENY - -## Site service - -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.cleanSitePermissions=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.createContainer=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.createSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.deleteSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.findSites=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getContainer=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getMembersRole=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getMembersRoleInfo=ACL_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSite=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteGroup=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoleGroup=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoles=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoot=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasContainer=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasCreateSitePermissions=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.isMember=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembers=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembersInfo=ACL_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listSites=RM_ALLOW,AFTER_RM.FilterNode -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.removeMembership=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.setMembership=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.updateSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembersPaged=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listContainers=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.countAuthoritiesWithRole=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.resolveSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasSite=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listSitesPaged=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteShortName=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.canAddMember=RM_ALLOW -rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.*=RM_ALLOW - -## Form Service - -rm.methodsecurity.org.alfresco.repo.forms.FormService.getForm=RM_ALLOW -rm.methodsecurity.org.alfresco.repo.forms.FormService.saveForm=RM_ALLOW -rm.methodsecurity.org.alfresco.repo.forms.FormService.*=RM_DENY - -## Ownable Service - -rm.methodsecurity.org.alfresco.service.cmr.security.OwnableService.getOwner=RM.Read.0 +## +# RM Method security for Alfresco code services +# +# Note: add alfresco/extension/rm-method-security.properties to extend +## + +## Node Service + +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStores=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createStore=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.exists=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeStatus=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAllRootNodes=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getRootNode=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createNode=RM.Create.0.3 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.moveNode=RM.Move.0.1 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setChildAssociationIndex=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getType=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setType=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addAspect=RM.Update.0.1.2 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeAspect=RM.Update.0.1 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.hasAspect=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAspects=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.deleteNode=RM.Delete.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addChild=RM.Create.0.1.2 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeChild=RM.Delete.0.1 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeChildAssociation=RM.Delete.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getProperties=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getProperty=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setProperties=RM.UpdateProperties.0.1 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.addProperties=RM.UpdateProperties.0.1 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.setProperty=RM.UpdateProperties.0.1.2 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeProperty=RM.UpdateProperties.0.1 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getParentAssocs=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getParentAssocs=RM.Read.0.1.2 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocs=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildByName=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildrenByName=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPrimaryParent=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.createAssociation=RM.Assoc.0.1 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.removeAssociation=Assoc.0.1 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getTargetAssocs=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getSourceAssocs=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getAssoc=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPath=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getPaths=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getStoreArchiveNode=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.restoreNode=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsWithoutParentAssocsOfType=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeRef=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsByPropertyValue=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.countChildAssocs=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeAclId=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.*=RM_DENY + +## File Folder Service + +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.list=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listFiles=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listFolders=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.listDeepFolders=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getLocalizedSibling=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.search=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.searchSimple=RM.Read.0,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.rename=RM.Update.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.move=RM.Move.0.1 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.moveFrom=RM.Move.0.2 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.copy=RM.Read.0,RM.Create.1.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.create=RM.Create.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.delete=RM.Delete.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getNamePath=RM.Read.1 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getNameOnlyPath=RM.Read.1 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.resolveNamePath=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getFileInfo=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getReader=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getWriter=RM.WriteContent.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.exists=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.getType=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.isHidden=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.setHidden=RM.Update.0 +rm.methodsecurity.org.alfresco.service.cmr.model.FileFolderService.*=RM_DENY + +## Content Service + +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getStoreTotalSpace=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getStoreFreeSpace=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getRawReader=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getReader=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getWriter=RM.WriteContent.0 +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.isTransformable=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getTransformer=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getMaxSourceSizeBytes=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getImageTransformer=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.transform=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.getTempWriter=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.repository.ContentService.*=RM_DENY + +## Search Service + +rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.query=RM_QUERY,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.selectNodes=RM_QUERY,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.selectProperties=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.contains=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.like=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.search.SearchService.*=RM_DENY + +## Category Service + +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getChildren=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getCategories=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getClassifications=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getRootCategories=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getClassificationAspects=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createClassification=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createRootCategory=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.createCategory=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.deleteClassification=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.deleteCategory=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.getTopCategories=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.search.CategoryService.*=RM_DENY + +## Lock Service + +rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.lock=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.unlock=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLockStatus=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLockType=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.checkForLock=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.getLocks=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.lock.LockService.*=RM_DENY + +## Multilingual Content Service + +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslationContainer=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslations=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getTranslationForLocale=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getMissingTranslations=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.getPivotTranslation=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.isTranslation=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.makeTranslation=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.unmakeTranslation=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.addTranslation=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.addEmptyTranslation=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.copyTranslationContainer=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.moveTranslationContainer=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.deleteTranslationContainer=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.MultilingualContentService.*=RM_DENY + +## Edition Service + +rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.createEdition=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getEditions=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getVersionedTranslations=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.getVersionedMetadatas=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.ml.EditionService.*=RM_DENY + +## Check Out Check In Service + +rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.checkout=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.checkin=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.cancelCheckout=RM_ABSTAIN +rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.getWorkingCopy=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.getCheckedOut=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.isWorkingCopy=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.isCheckedOut=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.coci.CheckOutCheckInService.*=RM_DENY + +## Permission Service + +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getOwnerAuthority=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllAuthorities=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllPermission=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getPermissions=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getAllSetPermissions=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getSettablePermissions=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.hasPermission=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.deletePermissions=RM_CAP.0.rma:filePlanComponent.ManageAccessRights +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.deletePermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.setPermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.setInheritParentPermissions=RM_CAP.0.rma:filePlanComponent.ManageAccessRights +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.getInheritParentPermissions=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.clearPermission=RM_CAP.0.rma:filePlanComponent.ManageAccessRights +rm.methodsecurity.org.alfresco.service.cmr.security.PermissionService.*=RM_DENY + +## Site service + +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.cleanSitePermissions=RM.Read.0 +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.createContainer=RM_ALLOW,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.createSite=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.deleteSite=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.findSites=RM_ALLOW,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getContainer=RM_ALLOW,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getMembersRole=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getMembersRoleInfo=ACL_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSite=RM_ALLOW,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteGroup=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoleGroup=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoles=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteRoot=RM_ALLOW,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasContainer=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasCreateSitePermissions=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.isMember=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembers=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembersInfo=ACL_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listSites=RM_ALLOW,AFTER_RM.FilterNode +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.removeMembership=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.setMembership=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.updateSite=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listMembersPaged=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listContainers=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.countAuthoritiesWithRole=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.resolveSite=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.hasSite=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.listSitesPaged=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.getSiteShortName=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.canAddMember=RM_ALLOW +rm.methodsecurity.org.alfresco.service.cmr.site.SiteService.*=RM_ALLOW + +## Form Service + +rm.methodsecurity.org.alfresco.repo.forms.FormService.getForm=RM_ALLOW +rm.methodsecurity.org.alfresco.repo.forms.FormService.saveForm=RM_ALLOW +rm.methodsecurity.org.alfresco.repo.forms.FormService.*=RM_DENY + +## Ownable Service + +rm.methodsecurity.org.alfresco.service.cmr.security.OwnableService.getOwner=RM.Read.0 rm.methodsecurity.org.alfresco.service.cmr.security.OwnableService.*=RM_DENY \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-policy-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-policy-context.xml index 83cc7a7417..5c7f4551ed 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-policy-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/security/rm-policy-context.xml @@ -1,47 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.desc.xml index 7de7c37fd8..fbcd9b30e8 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.desc.xml @@ -1,8 +1,8 @@ - - Get RM/DM related class definitions - Gets the RM/DM related collection of class definitions - parameters classfilter, namespaceprefix and name. - /api/rm/classes?cf={classFilter?}&nsp={namespacePrefix?}&n={name?} - argument - user - required + + Get RM/DM related class definitions + Gets the RM/DM related collection of class definitions - parameters classfilter, namespaceprefix and name. + /api/rm/classes?cf={classFilter?}&nsp={namespacePrefix?}&n={name?} + argument + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.json.ftl index 52ee498c52..e65d984017 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-classes.get.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#include "classes.get.json.ftl"> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#include "classes.get.json.ftl"> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.desc.xml index bc8ade2096..83fa618a06 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.desc.xml @@ -1,9 +1,9 @@ - - Get RM/DM property definitions - Gets the collection of RM/DM property definitions. - /api/rm/classes/{classname}/properties?nsp={namespacePrefix?}&n={name?} - /api/rm/properties?nsp={namespacePrefix?}&n={name?} - argument - user - required + + Get RM/DM property definitions + Gets the collection of RM/DM property definitions. + /api/rm/classes/{classname}/properties?nsp={namespacePrefix?}&n={name?} + /api/rm/properties?nsp={namespacePrefix?}&n={name?} + argument + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.json.ftl index 2429ed6e3e..f3c05bf870 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/dictionary/rm-properties.get.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#include "properties.get.json.ftl"> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#include "properties.get.json.ftl"> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.desc.xml index 6bd7f8162d..14851a41bc 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.desc.xml @@ -1,12 +1,12 @@ - - Remove a group or a user from a role - - - /api/rm/roles/{roleId}/authorities/{authorityName} - /api/rm/{store_type}/{store_id}/{id}/roles/{roleId}/authorities/{authorityName} - argument - user - required + + Remove a group or a user from a role + + + /api/rm/roles/{roleId}/authorities/{authorityName} + /api/rm/{store_type}/{store_id}/{id}/roles/{roleId}/authorities/{authorityName} + argument + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.json.ftl index 05d341e16b..b7ba61347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.delete.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.desc.xml index 75ee4da9dc..d5a0810210 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.desc.xml @@ -1,12 +1,12 @@ - - Add a group or a user to a role - - - /api/rm/roles/{roleId}/authorities/{authorityName} - /api/rm/{store_type}/{store_id}/{id}/roles/{roleId}/authorities/{authorityName} - argument - user - required + + Add a group or a user to a role + + + /api/rm/roles/{roleId}/authorities/{authorityName} + /api/rm/{store_type}/{store_id}/{id}/roles/{roleId}/authorities/{authorityName} + argument + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.json.ftl index 05d341e16b..b7ba61347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/roles/rm-authorities.post.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.desc.xml index 8627529e25..64948ba800 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.desc.xml @@ -1,8 +1,8 @@ - - Get action condition definition collection for RM - Gets a collection of the available action condition definitions in RM. - /api/rm/rm-actionconditiondefinitions - argument - user - required + + Get action condition definition collection for RM + Gets a collection of the available action condition definitions in RM. + /api/rm/rm-actionconditiondefinitions + argument + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.json.ftl index e057813650..55832747b4 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actionconditiondefinitions.get.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#include "actionconditiondefinitions.get.json.ftl"> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#include "actionconditiondefinitions.get.json.ftl"> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml index f55b3246e8..b51593347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.desc.xml @@ -1,8 +1,8 @@ - - Get action definition collection for RM - Gets a collection of the available action definitions in RM. - /api/rm/rm-actiondefinitions - argument - user - required + + Get action definition collection for RM + Gets a collection of the available action definitions in RM. + /api/rm/rm-actiondefinitions + argument + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl index 3a2df7db16..9a92112fb7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/rule/rm-actiondefinitions.get.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#include "actiondefinitions.get.json.ftl"> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#include "actiondefinitions.get.json.ftl"> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.desc.xml index b77167b3c0..8665f19ad7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.desc.xml @@ -1,8 +1,8 @@ - - Get substitution suggestions for RM - Gets a collection of substitution suggestions for a text fragment for RM. - /api/rm/rm-substitutionsuggestions?fragment={fragment}&path={path?} - argument - user - required + + Get substitution suggestions for RM + Gets a collection of substitution suggestions for a text fragment for RM. + /api/rm/rm-substitutionsuggestions?fragment={fragment}&path={path?} + argument + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.json.ftl index be41e5ed12..a655c6cb05 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/substitutionsuggestions/rm-substitutionsuggestions.get.json.ftl @@ -1,34 +1,34 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "substitutions": - [ - <#list substitutions as substitution> - "${substitution}"<#if substitution_has_next>, - - ] -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "substitutions": + [ + <#list substitutions as substitution> + "${substitution}"<#if substitution_has_next>, + + ] +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml index 2c7c93f48d..54d1a8bf5d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml @@ -1,8 +1,8 @@ - - Node Version Info - Node Version Info including some RM related information - /api/rm/rm-version - - user - required - + + Node Version Info + Node Version Info including some RM related information + /api/rm/rm-version + + user + required + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js index 3fd03ced0f..2db4735270 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js @@ -1,151 +1,151 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -var PeopleCache = {}; - -/** - * Gets / caches a person object - * @method getPerson - * @param username {string} User name - */ -function getPerson(username) -{ - if (typeof PeopleCache[username] == "undefined") - { - var person = people.getPerson(username); - if (person == null) - { - if (username == "System" || username.match("^System@") == "System@") - { - // special case for the System users - person = - { - properties: - { - userName: "System", - firstName: "System", - lastName: "User" - }, - assocs: {} - }; - } - else - { - // missing person - may have been deleted from the database - person = - { - properties: - { - userName: username, - firstName: "", - lastName: "" - }, - assocs: {} - }; - } - } - PeopleCache[username] = - { - userName: person.properties.userName, - firstName: person.properties.firstName, - lastName: person.properties.lastName, - displayName: (person.properties.firstName + " " + person.properties.lastName).replace(/^\s+|\s+$/g, "") - }; - } - return PeopleCache[username]; -} - -function main() -{ - var json = "", - versions = []; - - // allow for content to be loaded from id - if (args["nodeRef"] != null) - { - var nodeRef = args["nodeRef"], - node = search.findNode(nodeRef), - versionHistory, version, p, recordNodeRef, isRecordedVersionDestroyed; - - if (node != null) - { - var versionHistory = node.versionHistory; - if (versionHistory != null) - { - for (i = 0; i < versionHistory.length; i++) - { - version = versionHistory[i]; - p = getPerson(version.creator); - - recordNodeRef = version.getVersionProperty("recordNodeRef"); - isRecordedVersionDestroyed = version.getVersionProperty("RecordedVersionDestroyed"); - - versions[versions.length] = - { - nodeRef: version.node.nodeRef.toString(), - name: (isRecordedVersionDestroyed == true) ? "" : version.node.name, - label: version.label, - description: version.description, - createdDate: version.createdDate, - creator: - { - userName: p.userName, - firstName: p.firstName, - lastName: p.lastName - }, - recordNodeRef: recordNodeRef ? recordNodeRef.toString() : "", - isRecordedVersionDestroyed: isRecordedVersionDestroyed - }; - } - } - else - { - p = getPerson(node.properties.creator); - versions[0] = - { - nodeRef: node.nodeRef.toString(), - name: node.name, - label: "1.0", - description: "", - createdDate: node.properties.created, - creator: - { - userName: p.userName, - firstName: p.firstName, - lastName: p.lastName - }, - recordNodeRef: "", - isRecordedVersionDestroyed: false - }; - } - } - } - - // store node onto model - model.versions = versions; -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +var PeopleCache = {}; + +/** + * Gets / caches a person object + * @method getPerson + * @param username {string} User name + */ +function getPerson(username) +{ + if (typeof PeopleCache[username] == "undefined") + { + var person = people.getPerson(username); + if (person == null) + { + if (username == "System" || username.match("^System@") == "System@") + { + // special case for the System users + person = + { + properties: + { + userName: "System", + firstName: "System", + lastName: "User" + }, + assocs: {} + }; + } + else + { + // missing person - may have been deleted from the database + person = + { + properties: + { + userName: username, + firstName: "", + lastName: "" + }, + assocs: {} + }; + } + } + PeopleCache[username] = + { + userName: person.properties.userName, + firstName: person.properties.firstName, + lastName: person.properties.lastName, + displayName: (person.properties.firstName + " " + person.properties.lastName).replace(/^\s+|\s+$/g, "") + }; + } + return PeopleCache[username]; +} + +function main() +{ + var json = "", + versions = []; + + // allow for content to be loaded from id + if (args["nodeRef"] != null) + { + var nodeRef = args["nodeRef"], + node = search.findNode(nodeRef), + versionHistory, version, p, recordNodeRef, isRecordedVersionDestroyed; + + if (node != null) + { + var versionHistory = node.versionHistory; + if (versionHistory != null) + { + for (i = 0; i < versionHistory.length; i++) + { + version = versionHistory[i]; + p = getPerson(version.creator); + + recordNodeRef = version.getVersionProperty("recordNodeRef"); + isRecordedVersionDestroyed = version.getVersionProperty("RecordedVersionDestroyed"); + + versions[versions.length] = + { + nodeRef: version.node.nodeRef.toString(), + name: (isRecordedVersionDestroyed == true) ? "" : version.node.name, + label: version.label, + description: version.description, + createdDate: version.createdDate, + creator: + { + userName: p.userName, + firstName: p.firstName, + lastName: p.lastName + }, + recordNodeRef: recordNodeRef ? recordNodeRef.toString() : "", + isRecordedVersionDestroyed: isRecordedVersionDestroyed + }; + } + } + else + { + p = getPerson(node.properties.creator); + versions[0] = + { + nodeRef: node.nodeRef.toString(), + name: node.name, + label: "1.0", + description: "", + createdDate: node.properties.created, + creator: + { + userName: p.userName, + firstName: p.firstName, + lastName: p.lastName + }, + recordNodeRef: "", + isRecordedVersionDestroyed: false + }; + } + } + } + + // store node onto model + model.versions = versions; +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl index 838218470c..d9ce4759c7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl @@ -1,48 +1,48 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -[ -<#list versions as v> - { - "nodeRef": "${v.nodeRef}", - "name": "${v.name}", - "label": "${v.label}", - "description": "${v.description}", - "createdDate": "${v.createdDate?string("dd MMM yyyy HH:mm:ss 'GMT'Z '('zzz')'")}", - "createdDateISO": "${xmldate(v.createdDate)}", - "creator": - { - "userName": "${v.creator.userName}", - "firstName": "${v.creator.firstName!""}", - "lastName": "${v.creator.lastName!""}" - }, - "recordNodeRef": "${v.recordNodeRef}", - "isRecordedVersionDestroyed": ${v.isRecordedVersionDestroyed?c} - }<#if (v_has_next)>, - -] - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +[ +<#list versions as v> + { + "nodeRef": "${v.nodeRef}", + "name": "${v.name}", + "label": "${v.label}", + "description": "${v.description}", + "createdDate": "${v.createdDate?string("dd MMM yyyy HH:mm:ss 'GMT'Z '('zzz')'")}", + "createdDateISO": "${xmldate(v.createdDate)}", + "creator": + { + "userName": "${v.creator.userName}", + "firstName": "${v.creator.firstName!""}", + "lastName": "${v.creator.lastName!""}" + }, + "recordNodeRef": "${v.recordNodeRef}", + "isRecordedVersionDestroyed": ${v.isRecordedVersionDestroyed?c} + }<#if (v_has_next)>, + +] + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.desc.xml index 40af72f2cb..50fd1191b0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.desc.xml @@ -1,15 +1,15 @@ - - Delete email property map - - DELETE /api/rma/admin/emailmap/{from}/{to} deletes the specified mapping - Returns data in the same format as the get method - ]]> - - /api/rma/admin/emailmap/{from}/{to} - argument - user - required - internal + + Delete email property map + + DELETE /api/rma/admin/emailmap/{from}/{to} deletes the specified mapping + Returns data in the same format as the get method + ]]> + + /api/rma/admin/emailmap/{from}/{to} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.json.ftl index 4bb3c2e86d..a1e3105863 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.delete.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "emailmap.lib.ftl" as emailmapLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "emailmap.lib.ftl" as emailmapLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.desc.xml index 1a8bd1a92e..1aeeb1fdc6 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.desc.xml @@ -1,29 +1,29 @@ - - Get the custom email property map - - fields are specified with "from" and "to". -
- Example data. -
-      "mappings":
-      [
-         {"from" : "messageTo", "to" : "imap:messageTo" } ,
-         {"from" : "Thread-Index", "to" : "imap:threadIndex" } ,
-         {"from" : "messageFrom", "to" : "imap:messageFrom" } ,
-         {"from" : "messageSubject", "to" : "cm:title" } ,
-         {"from" : "messageSubject", "to" : "imap:messageSubject" } ,
-         {"from" : "messageSubject", "to" : "cm:description" } ,
-         {"from" : "messageCc", "to" : "imap:messageCc" } ,
-         {"from" : "Message-ID", "to" : "imap:messageId" }
-      ]
-   
- ]]> -
- /api/rma/admin/emailmap - argument - user - required - internal + + Get the custom email property map + + fields are specified with "from" and "to". +
+ Example data. +
+      "mappings":
+      [
+         {"from" : "messageTo", "to" : "imap:messageTo" } ,
+         {"from" : "Thread-Index", "to" : "imap:threadIndex" } ,
+         {"from" : "messageFrom", "to" : "imap:messageFrom" } ,
+         {"from" : "messageSubject", "to" : "cm:title" } ,
+         {"from" : "messageSubject", "to" : "imap:messageSubject" } ,
+         {"from" : "messageSubject", "to" : "cm:description" } ,
+         {"from" : "messageCc", "to" : "imap:messageCc" } ,
+         {"from" : "Message-ID", "to" : "imap:messageId" }
+      ]
+   
+ ]]> +
+ /api/rma/admin/emailmap + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.json.ftl index 4bb3c2e86d..a1e3105863 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.get.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "emailmap.lib.ftl" as emailmapLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "emailmap.lib.ftl" as emailmapLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.lib.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.lib.ftl index de23cb993a..78cdd7bf0d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.lib.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.lib.ftl @@ -1,40 +1,40 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#-- renders an email map object --> - -<#macro emailmapJSON emailmap> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "mappings": - [ - <#list emailmap as mapping> - {"from": "${mapping.from}", "to": "${mapping.to}" }<#if mapping_has_next>, - - ] - } - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#-- renders an email map object --> + +<#macro emailmapJSON emailmap> +<#escape x as jsonUtils.encodeJSONString(x)> + { + "mappings": + [ + <#list emailmap as mapping> + {"from": "${mapping.from}", "to": "${mapping.to}" }<#if mapping_has_next>, + + ] + } + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.desc.xml index cb9073d997..1b4ade6fb7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.desc.xml @@ -1,20 +1,20 @@ - - Add email property map - - Data is specified in JSON format as a JSONObject -
-   {"to":"rmc:Wibble", "from":"whatever"}
-   
-
- POST /api/rma/admin/emailmap adds the specified mapping - Returns data in the same format as the get method - ]]> -
- /api/rma/admin/emailmap - argument - user - required - internal + + Add email property map + + Data is specified in JSON format as a JSONObject +
+   {"to":"rmc:Wibble", "from":"whatever"}
+   
+
+ POST /api/rma/admin/emailmap adds the specified mapping + Returns data in the same format as the get method + ]]> +
+ /api/rma/admin/emailmap + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.json.ftl index 4bb3c2e86d..a1e3105863 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmap.post.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "emailmap.lib.ftl" as emailmapLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "emailmap.lib.ftl" as emailmapLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": <@emailmapLib.emailmapJSON emailmap=emailmap /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.desc.xml index 888c5f5fb7..84a2019ff9 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.desc.xml @@ -1,9 +1,9 @@ - - RM Email Mapping Keys - Gets the list of email mapping keys - /api/rma/admin/emailmapkeys - argument - user - required - internal + + RM Email Mapping Keys + Gets the list of email mapping keys + /api/rma/admin/emailmapkeys + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.json.ftl index 490d7bf449..5408f69ce6 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/emailmapkeys.get.json.ftl @@ -1,39 +1,39 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data" : - { - "emailmapkeys": - [ - <#list emailmapkeys as emailmapkey> - '${emailmapkey}'<#if emailmapkey_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data" : + { + "emailmapkeys": + [ + <#list emailmapkeys as emailmapkey> + '${emailmapkey}'<#if emailmapkey_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js index 7361637485..99041736c0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint-utils.js @@ -1,44 +1,44 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -function existsTitle(caveatConfig, title) -{ - var constraints = caveatConfig.allConstraints; - - // Check for existing constraint... - var alreadyExists = false; - for (var i = 0; i < constraints.length; i++) - { - var currTitle = constraints[i].title; - if (currTitle + "" == title) - { - alreadyExists = true; - break; - } - } - - return alreadyExists; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +function existsTitle(caveatConfig, title) +{ + var constraints = caveatConfig.allConstraints; + + // Check for existing constraint... + var alreadyExists = false; + for (var i = 0; i < constraints.length; i++) + { + var currTitle = constraints[i].title; + if (currTitle + "" == title) + { + alreadyExists = true; + break; + } + } + + return alreadyExists; +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.desc.xml index 0dd4d5018f..0cbf8f2f2d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.desc.xml @@ -1,13 +1,13 @@ - - Delete an RM Constraint list - - - - /api/rma/admin/rmconstraints/{listName} - argument - user - required - internal + + Delete an RM Constraint list + + + + /api/rma/admin/rmconstraints/{listName} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.js index 2c35d1d80b..df072636d2 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.js @@ -1,53 +1,53 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Delete the rm constraint list - */ -function main() -{ - // Get the shortname - var shortName = url.extension; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - caveatConfig.deleteConstraintList(shortName); - - // Pass the constraint name to the template - model.constraintName = shortName; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Delete the rm constraint list + */ +function main() +{ + // Get the shortname + var shortName = url.extension; + + // Get the constraint + var constraint = caveatConfig.getConstraint(shortName); + + if (constraint != null) + { + caveatConfig.deleteConstraintList(shortName); + + // Pass the constraint name to the template + model.constraintName = shortName; + } + else + { + // Return 404 + status.setCode(404, "Constraint List " + shortName + " does not exist"); + return; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.json.ftl index a4cf6bf36b..5344f2efb7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.delete.json.ftl @@ -1,31 +1,31 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": { } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": { } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.desc.xml index db15d75311..6caa0bdcae 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.desc.xml @@ -1,22 +1,22 @@ - - Get a RM Constraint method - - - Constraint object -
-
constraintName
the name of the constraint. The underscore character is used instead of the colon
-
constraintTitle
the title of the constraint (human readable)
-
caseSensitive
Are the values case sensitive
-
allowedValues
array of allowed values, this is the complete unrestricted list of all values
-
- ]]> -
- /api/rma/admin/rmconstraints/{listName} - argument - user - required - internal + + Get a RM Constraint method + + + Constraint object +
+
constraintName
the name of the constraint. The underscore character is used instead of the colon
+
constraintTitle
the title of the constraint (human readable)
+
caseSensitive
Are the values case sensitive
+
allowedValues
array of allowed values, this is the complete unrestricted list of all values
+
+ ]]> +
+ /api/rma/admin/rmconstraints/{listName} + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.js index a2965611e0..7bd7150a2d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.js @@ -1,51 +1,51 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Get the detail of the rm constraint - */ -function main() -{ - // Get the shortname - var shortName = url.extension; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - // Pass the constraint detail to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Get the detail of the rm constraint + */ +function main() +{ + // Get the shortname + var shortName = url.extension; + + // Get the constraint + var constraint = caveatConfig.getConstraint(shortName); + + if (constraint != null) + { + // Pass the constraint detail to the template + model.constraint = constraint; + } + else + { + // Return 404 + status.setCode(404, "Constraint List " + shortName + " does not exist"); + return; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.json.ftl index f4e0e0a005..033d37e259 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.get.json.ftl @@ -1,34 +1,34 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintJSON constraint=constraint /> - -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmconstraint.lib.ftl" as rmconstraintLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": <@rmconstraintLib.constraintJSON constraint=constraint /> + +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.lib.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.lib.ftl index 08e8af0c72..72156113fc 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.lib.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.lib.ftl @@ -1,87 +1,87 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#-- renders an rm constraint object --> - -<#macro constraintSummaryJSON constraint> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", - "constraintName" : "${constraint.name}", - "constraintTitle" : "${msg(constraint.title)}" - } - - - -<#macro constraintJSON constraint> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", - "constraintName" : "${constraint.name}", - "caseSensitive" : "${constraint.caseSensitive?string("true", "false")}", - "constraintTitle" : "${constraint.title}", - "allowedValues" : [ <#list constraint.allowedValues as allowedValue> "${allowedValue}" <#if allowedValue_has_next>, ] - } - - - -<#macro constraintWithValuesJSON constraint> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", - "constraintName" : "${constraint.name}", - "caseSensitive" : "${constraint.caseSensitive?string("true", "false")}", - "constraintTitle" : "${msg(constraint.title)}", - "values" : [ - <#list constraint.values as value> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", - "valueName":"${value.valueName}", - "valueTitle":"${value.valueTitle}", - "authorities" : [ <#list value.authorities as authority> { "authorityName" : "${authority.authorityName}", "authorityTitle" : "${authority.authorityTitle}"} <#if authority_has_next>,] - }<#if value_has_next>, - - ] - } - - - -<#macro constraintWithValueJSON constraint value> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", - "constraintName" : "${constraint.name}", - "constraintTitle" : "${constraint.title}", - "value" : - { - "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", - "valueName":"${value.valueName}", - "valueTitle":"${value.valueTitle}", - "authorities" : [ <#list value.authorities as authority> { "authorityName" : "${authority.authorityName}", "authorityTitle" : "${authority.authorityTitle}"} <#if authority_has_next>,] - } - } - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#-- renders an rm constraint object --> + +<#macro constraintSummaryJSON constraint> +<#escape x as jsonUtils.encodeJSONString(x)> + { + "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", + "constraintName" : "${constraint.name}", + "constraintTitle" : "${msg(constraint.title)}" + } + + + +<#macro constraintJSON constraint> +<#escape x as jsonUtils.encodeJSONString(x)> + { + "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", + "constraintName" : "${constraint.name}", + "caseSensitive" : "${constraint.caseSensitive?string("true", "false")}", + "constraintTitle" : "${constraint.title}", + "allowedValues" : [ <#list constraint.allowedValues as allowedValue> "${allowedValue}" <#if allowedValue_has_next>, ] + } + + + +<#macro constraintWithValuesJSON constraint> +<#escape x as jsonUtils.encodeJSONString(x)> + { + "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name}", + "constraintName" : "${constraint.name}", + "caseSensitive" : "${constraint.caseSensitive?string("true", "false")}", + "constraintTitle" : "${msg(constraint.title)}", + "values" : [ + <#list constraint.values as value> + { + "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", + "valueName":"${value.valueName}", + "valueTitle":"${value.valueTitle}", + "authorities" : [ <#list value.authorities as authority> { "authorityName" : "${authority.authorityName}", "authorityTitle" : "${authority.authorityTitle}"} <#if authority_has_next>,] + }<#if value_has_next>, + + ] + } + + + +<#macro constraintWithValueJSON constraint value> +<#escape x as jsonUtils.encodeJSONString(x)> + { + "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", + "constraintName" : "${constraint.name}", + "constraintTitle" : "${constraint.title}", + "value" : + { + "url" : "${url.serviceContext + "/api/rma/admin/rmconstraints/" + constraint.name + "/values/" + value.valueName}", + "valueName":"${value.valueName}", + "valueTitle":"${value.valueTitle}", + "authorities" : [ <#list value.authorities as authority> { "authorityName" : "${authority.authorityName}", "authorityTitle" : "${authority.authorityTitle}"} <#if authority_has_next>,] + } + } + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.desc.xml index b7e4533b8f..fef70b6ff0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.desc.xml @@ -1,19 +1,19 @@ - - Update an RM Constraint List - - The following properties may be updatedConstraint object -
-
-
constraintTitle
Optional, the title of the constraint (human readable)
-
allowedValues
Optional, array of allowed values, the complete list must be specified
-
- ]]> -
- /api/rma/admin/rmconstraints/{listName} - argument - user - required - internal + + Update an RM Constraint List + + The following properties may be updatedConstraint object +
+
+
constraintTitle
Optional, the title of the constraint (human readable)
+
allowedValues
Optional, array of allowed values, the complete list must be specified
+
+ ]]> +
+ /api/rma/admin/rmconstraints/{listName} + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.ftl index 6cf659f470..6035b94167 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.ftl @@ -1,37 +1,37 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if !errorMessage??> - "data": <@rmconstraintLib.constraintJSON constraint=constraint /> - <#else> - "message" : "${msg(errorMessage, title)}" - -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmconstraint.lib.ftl" as rmconstraintLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + <#if !errorMessage??> + "data": <@rmconstraintLib.constraintJSON constraint=constraint /> + <#else> + "message" : "${msg(errorMessage, title)}" + +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js index 4a36474f9d..ada28a5d0c 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put.json.js @@ -1,87 +1,87 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -/** - * Update an rm constraint - */ -function main() -{ - // Get the shortname - var shortName = url.extension; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - var allowedValues, - title = null; - - if (json.has("constraintTitle")) - { - title = json.get("constraintTitle"); - if (existsTitle(caveatConfig, title)) - { - status.code = 400; - model.errorMessage = "rm.admin.list-already-exists"; - model.title = title; - return; - } - constraint.updateTitle(title); - } - - if (json.has("allowedValues")) - { - values = json.getJSONArray("allowedValues"); - - var i = 0; - allowedValues = new Array(); - - if (values != null) - { - for (var x = 0; x < values.length(); x++) - { - allowedValues[i++] = values.get(x); - } - } - constraint.updateAllowedValues(allowedValues); - } - - // Pass the constraint detail to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +/** + * Update an rm constraint + */ +function main() +{ + // Get the shortname + var shortName = url.extension; + + // Get the constraint + var constraint = caveatConfig.getConstraint(shortName); + + if (constraint != null) + { + var allowedValues, + title = null; + + if (json.has("constraintTitle")) + { + title = json.get("constraintTitle"); + if (existsTitle(caveatConfig, title)) + { + status.code = 400; + model.errorMessage = "rm.admin.list-already-exists"; + model.title = title; + return; + } + constraint.updateTitle(title); + } + + if (json.has("allowedValues")) + { + values = json.getJSONArray("allowedValues"); + + var i = 0; + allowedValues = new Array(); + + if (values != null) + { + for (var x = 0; x < values.length(); x++) + { + allowedValues[i++] = values.get(x); + } + } + constraint.updateAllowedValues(allowedValues); + } + + // Pass the constraint detail to the template + model.constraint = constraint; + } + else + { + // Return 404 + status.setCode(404, "Constraint List " + shortName + " does not exist"); + return; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.desc.xml index e8dff744df..edc8be638e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.desc.xml @@ -1,18 +1,18 @@ - - Get the names of all RM Constraint Lists - -
-
constraintTitle
Human readable title for the custom constraint list
-
constraintName
the name of the constraint list, prefixed
-
url
-
- ]]> -
- /api/rma/admin/rmconstraints?withEmptyLists={withEmptyLists?} - argument - user - required - internal + + Get the names of all RM Constraint Lists + +
+
constraintTitle
Human readable title for the custom constraint list
+
constraintName
the name of the constraint list, prefixed
+
url
+
+ ]]> +
+ /api/rma/admin/rmconstraints?withEmptyLists={withEmptyLists?} + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.js index 3ec6c9acd9..c85eeedce1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.js @@ -1,45 +1,45 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * List the names of the rm constraints - */ -function main() -{ - var wel = true; - var withEmptyLists = args["withEmptyLists"]; - // Pass the information to the template - if (withEmptyLists != null && withEmptyLists === 'false') - { - model.constraints = caveatConfig.constraintsWithoutEmptyList; - } - else - { - model.constraints = caveatConfig.allConstraints; - } -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * List the names of the rm constraints + */ +function main() +{ + var wel = true; + var withEmptyLists = args["withEmptyLists"]; + // Pass the information to the template + if (withEmptyLists != null && withEmptyLists === 'false') + { + model.constraints = caveatConfig.constraintsWithoutEmptyList; + } + else + { + model.constraints = caveatConfig.allConstraints; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.json.ftl index d8b09a12dd..2796ff6860 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.get.json.ftl @@ -1,39 +1,39 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - [ - <#list constraints as constraint> - <@rmconstraintLib.constraintSummaryJSON constraint=constraint /> - <#if constraint_has_next>, - - ] -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmconstraint.lib.ftl" as rmconstraintLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + [ + <#list constraints as constraint> + <@rmconstraintLib.constraintSummaryJSON constraint=constraint /> + <#if constraint_has_next>, + + ] +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.desc.xml index 3d0036b1d4..8e6dec15b4 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.desc.xml @@ -1,20 +1,20 @@ - - Create a new RM Constraint List - - The following properties may be specified -
-
-
constraintName
Optional the name of the constraint. If not specified then one will be generated.
-
constraintTitle
The title of the constraint (human readable)
-
allowedValues
array of allowed values, the complete list must be specified
-
- ]]> -
- /api/rma/admin/rmconstraints - argument - user - required - internal + + Create a new RM Constraint List + + The following properties may be specified +
+
+
constraintName
Optional the name of the constraint. If not specified then one will be generated.
+
constraintTitle
The title of the constraint (human readable)
+
allowedValues
array of allowed values, the complete list must be specified
+
+ ]]> +
+ /api/rma/admin/rmconstraints + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl index cacdf777ef..d485fdac5d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.ftl @@ -1,37 +1,37 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if !errorMessage??> - "data": <@rmconstraintLib.constraintJSON constraint=constraint /> - <#else> - "message" : "${msg(errorMessage, title)}" - -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmconstraint.lib.ftl" as rmconstraintLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + <#if !errorMessage??> + "data": <@rmconstraintLib.constraintJSON constraint=constraint /> + <#else> + "message" : "${msg(errorMessage, title)}" + +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js index 8d719a1549..a3de186202 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post.json.js @@ -1,81 +1,81 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -/** - * Create a new RM Constraint List - */ -function main() -{ - // Parse the passed in details - var title = null, - name = null, - allowedValues = {}; - - if (json.has("constraintName")) - { - name = json.get("constraintName"); - } - - if (json.has("constraintTitle")) - { - title = json.get("constraintTitle"); - } - else - { - title = name; - } - - if (existsTitle(caveatConfig, title)) - { - status.code = 400; - model.errorMessage = "rm.admin.list-already-exists"; - model.title = title; - return; - } - - if (json.has("allowedValues")) - { - values = json.getJSONArray("allowedValues"); - - var i = 0; - allowedValues = new Array(); - - if (values != null) - { - for (var x = 0; x < values.length(); x++) - { - allowedValues[i++] = values.get(x); - } - } - } - - model.constraint = caveatConfig.createConstraint(name, title, allowedValues); -} - -main(); + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +/** + * Create a new RM Constraint List + */ +function main() +{ + // Parse the passed in details + var title = null, + name = null, + allowedValues = {}; + + if (json.has("constraintName")) + { + name = json.get("constraintName"); + } + + if (json.has("constraintTitle")) + { + title = json.get("constraintTitle"); + } + else + { + title = name; + } + + if (existsTitle(caveatConfig, title)) + { + status.code = 400; + model.errorMessage = "rm.admin.list-already-exists"; + model.title = title; + return; + } + + if (json.has("allowedValues")) + { + values = json.getJSONArray("allowedValues"); + + var i = 0; + allowedValues = new Array(); + + if (values != null) + { + for (var x = 0; x < values.length(); x++) + { + allowedValues[i++] = values.get(x); + } + } + } + + model.constraint = caveatConfig.createConstraint(name, title, allowedValues); +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.desc.xml index e9f2517b1c..fc447a85d1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.desc.xml @@ -1,63 +1,63 @@ - - Get an RM Constraint - - - The list name is qualified with an underscore between prefix and name to be compatible with Java Script and URLs -
- e.g. rma_listName rather than rma:listName -
- Constraint object -
-
constraintName
the name of the constraint. The underscore character is used instead of the colon
-
caseSensitive
is the constraint case sensitive
-
constraintTitle
the display name of the constraint
-
allowedValues
array of the allowed values, this is the complete unrestricted list of all values
-
values
array of constraint values
-
- Constraint values object -
-
valueName
the full name of the value
-
valueTitle
the display name of the value
-
authorities
array of constraint authorities
-
- Example JSON data -
-   {
-      "data":
-      {
-         "url" : "\/alfresco\/service\/api\/rma\/admin\/rmconstraints\/rma_smList",
-         "constraintName" : "rma_smList",
-         "caseSensitive" :  "true",
-         "constraintTitle" : "Display title for rma:smList",
-         "allowedValues" : [ "Alpha" ,  "Beta" ,  "Gamma" ],
-         "values" :
-         [
-            {
-               "valueName":"NOCON",
-               "valueTitle":"NOCON",
-               "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} ]
-            },
-            {
-               "valueName":"NOFORN",
-               "valueTitle":"NOFORN",
-               "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} , { "authorityName" : "fbloggs", "authorityTitle" : "fbloggs"} , { "authorityName" : "jdoe", "authorityTitle" : "jdoe"} ]
-            },
-            {
-               "valueName":"FGI",
-               "valueTitle":"FGI",
-               "authorities" : [  { "authorityName" : "fbloggs", "authorityTitle" : "fbloggs"} , { "authorityName" : "jdoe", "authorityTitle" : "jdoe"} ]
-            }
-         ]
-      }
-   }
-   
- ]]> -
- /api/rma/admin/rmconstraints/{listName}/values - argument - user - required - internal + + Get an RM Constraint + + + The list name is qualified with an underscore between prefix and name to be compatible with Java Script and URLs +
+ e.g. rma_listName rather than rma:listName +
+ Constraint object +
+
constraintName
the name of the constraint. The underscore character is used instead of the colon
+
caseSensitive
is the constraint case sensitive
+
constraintTitle
the display name of the constraint
+
allowedValues
array of the allowed values, this is the complete unrestricted list of all values
+
values
array of constraint values
+
+ Constraint values object +
+
valueName
the full name of the value
+
valueTitle
the display name of the value
+
authorities
array of constraint authorities
+
+ Example JSON data +
+   {
+      "data":
+      {
+         "url" : "\/alfresco\/service\/api\/rma\/admin\/rmconstraints\/rma_smList",
+         "constraintName" : "rma_smList",
+         "caseSensitive" :  "true",
+         "constraintTitle" : "Display title for rma:smList",
+         "allowedValues" : [ "Alpha" ,  "Beta" ,  "Gamma" ],
+         "values" :
+         [
+            {
+               "valueName":"NOCON",
+               "valueTitle":"NOCON",
+               "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} ]
+            },
+            {
+               "valueName":"NOFORN",
+               "valueTitle":"NOFORN",
+               "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} , { "authorityName" : "fbloggs", "authorityTitle" : "fbloggs"} , { "authorityName" : "jdoe", "authorityTitle" : "jdoe"} ]
+            },
+            {
+               "valueName":"FGI",
+               "valueTitle":"FGI",
+               "authorities" : [  { "authorityName" : "fbloggs", "authorityTitle" : "fbloggs"} , { "authorityName" : "jdoe", "authorityTitle" : "jdoe"} ]
+            }
+         ]
+      }
+   }
+   
+ ]]> +
+ /api/rma/admin/rmconstraints/{listName}/values + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.js index 8136c7095f..1a70c002eb 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.js @@ -1,51 +1,51 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Get the detail of the rm constraint - */ -function main() -{ - var urlElements = url.extension.split("/"); - var shortName = urlElements[0]; - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - // Pass the constraint detail to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Get the detail of the rm constraint + */ +function main() +{ + var urlElements = url.extension.split("/"); + var shortName = urlElements[0]; + + // Get the constraint + var constraint = caveatConfig.getConstraint(shortName); + + if (constraint != null) + { + // Pass the constraint detail to the template + model.constraint = constraint; + } + else + { + // Return 404 + status.setCode(404, "Constraint List " + shortName + " does not exist"); + return; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.json.ftl index 62679683db..195602da55 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.get.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.desc.xml index d6c4af865f..86b6d17ed6 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.desc.xml @@ -1,28 +1,28 @@ - - Updates values in an an RM Constraint List - - If the authority is missing from the list then the value is deleted. -
- If an authority does not exist in a list then the authority is added. -
- Only the authorities for the specified values are updated. -
- If a value is missing it will not be affected. -
- JSON Parameter format: -
- "values" : [ ValueName, [ authorityName1, authorityName2 ]] -
- The input format for values is different to the output format. -
- Data Return format. - ]]> -
- /api/rma/admin/rmconstraints/{listName}/values - argument - user - required - internal + + Updates values in an an RM Constraint List + + If the authority is missing from the list then the value is deleted. +
+ If an authority does not exist in a list then the authority is added. +
+ Only the authorities for the specified values are updated. +
+ If a value is missing it will not be affected. +
+ JSON Parameter format: +
+ "values" : [ ValueName, [ authorityName1, authorityName2 ]] +
+ The input format for values is different to the output format. +
+ Data Return format. + ]]> +
+ /api/rma/admin/rmconstraints/{listName}/values + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.ftl index 70064bc5e7..b5fc4f5eb0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.js index 6b105b1317..956270f842 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraint.post.json.js @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Update the details of a value in an rm constraint - */ -function main() -{ - var urlElements = url.extension.split("/"); - var shortName = urlElements[0]; - - var values = null; - - if (json.has("values")) - { - values = json.getJSONArray("values"); - } - - if (values == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "Values missing"); - return; - } - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - constraint.updateValues(values); - model.constraint = caveatConfig.getConstraint(shortName); - model.constraintName = shortName; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Update the details of a value in an rm constraint + */ +function main() +{ + var urlElements = url.extension.split("/"); + var shortName = urlElements[0]; + + var values = null; + + if (json.has("values")) + { + values = json.getJSONArray("values"); + } + + if (values == null) + { + status.setCode(status.STATUS_BAD_REQUEST, "Values missing"); + return; + } + + // Get the constraint + var constraint = caveatConfig.getConstraint(shortName); + + if (constraint != null) + { + constraint.updateValues(values); + model.constraint = caveatConfig.getConstraint(shortName); + model.constraintName = shortName; + } + else + { + // Return 404 + status.setCode(404, "Constraint List " + shortName + " does not exist"); + return; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.desc.xml index 74b3f1330e..dfbe501e22 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.desc.xml @@ -1,11 +1,11 @@ - - Delete a value from an RM Constraint List - - - /api/rma/admin/rmconstraints/{listName}/{valueName} - argument - user - required - internal + + Delete a value from an RM Constraint List + + + /api/rma/admin/rmconstraints/{listName}/{valueName} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.js index a1b928af4e..96d662b695 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.js @@ -1,67 +1,67 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Delete the rm constraint list - */ -function main() -{ - var urlElements = url.extension.split("/"); - var shortName = urlElements[0]; - var authorityName = urlElements[1]; - - if (shortName == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "shortName missing"); - return; - } - if (valueName == null) - { - status.setCode(status.STATUS_BAD_REQUEST, "value missing"); - return; - } - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - caveatConfig.deleteRMConstraintListValue(shortName, valueName); - - var constraint = caveatConfig.getConstraint(shortName); - - // Pass the constraint name to the template - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Delete the rm constraint list + */ +function main() +{ + var urlElements = url.extension.split("/"); + var shortName = urlElements[0]; + var authorityName = urlElements[1]; + + if (shortName == null) + { + status.setCode(status.STATUS_BAD_REQUEST, "shortName missing"); + return; + } + if (valueName == null) + { + status.setCode(status.STATUS_BAD_REQUEST, "value missing"); + return; + } + + // Get the constraint + var constraint = caveatConfig.getConstraint(shortName); + + if (constraint != null) + { + caveatConfig.deleteRMConstraintListValue(shortName, valueName); + + var constraint = caveatConfig.getConstraint(shortName); + + // Pass the constraint name to the template + model.constraint = constraint; + } + else + { + // Return 404 + status.setCode(404, "Constraint List " + shortName + " does not exist"); + return; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.json.ftl index 70064bc5e7..b5fc4f5eb0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.delete.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": <@rmconstraintLib.constraintWithValuesJSON constraint=constraint /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.desc.xml index 482c2ebf21..c53b819e90 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.desc.xml @@ -1,47 +1,47 @@ - - Get an RM Constraint Value - - - The list name is qualified with an underscore between prefix and name to be compatible with Java Script and URLs -
- e.g. rma_listName rather than rma:listName -
- Constraint object -
-
constraintName
the name of the constraint. The underscore character is used instead of the colon
-
constraintTitle
the display name of the constraint
-
value
constraint values
-
- Constraint values object -
-
valueName
the full name of the value
-
valueTitle
the display name of the value
-
authorities
array of constraint authorities
-
- Example JSON data: -
-   {
-      "data":
-      {
-         "url" : "\/alfresco\/service\/api\/rma\/admin\/rmconstraints\/rma_smList/values/NOCON",
-         "constraintName" : "rma_smList",
-         "constraintTitle" : "Display title for rma:smList",
-         "value" :
-         {
-           "valueName":"NOCON", 
-           "valueTitle":"NOCON",
-           "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} ]
-         }
-      }
-   }
-   
- ]]> -
- /api/rma/admin/rmconstraints/{listName}/values/{valueName} - argument - user - required - internal + + Get an RM Constraint Value + + + The list name is qualified with an underscore between prefix and name to be compatible with Java Script and URLs +
+ e.g. rma_listName rather than rma:listName +
+ Constraint object +
+
constraintName
the name of the constraint. The underscore character is used instead of the colon
+
constraintTitle
the display name of the constraint
+
value
constraint values
+
+ Constraint values object +
+
valueName
the full name of the value
+
valueTitle
the display name of the value
+
authorities
array of constraint authorities
+
+ Example JSON data: +
+   {
+      "data":
+      {
+         "url" : "\/alfresco\/service\/api\/rma\/admin\/rmconstraints\/rma_smList/values/NOCON",
+         "constraintName" : "rma_smList",
+         "constraintTitle" : "Display title for rma:smList",
+         "value" :
+         {
+           "valueName":"NOCON", 
+           "valueTitle":"NOCON",
+           "authorities" : [  { "authorityName" : "jrogers", "authorityTitle" : "jrogers"} ]
+         }
+      }
+   }
+   
+ ]]> +
+ /api/rma/admin/rmconstraints/{listName}/values/{valueName} + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.js index 5ca3c936f7..c689d7f971 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.js @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Get the detail of the rm constraint - */ -function main() -{ - var urlElements = url.extension.split("/"); - var shortName = decodeURIComponent(urlElements[0]); - var valueName = decodeURIComponent(urlElements[2]) - - // Get the constraint - var constraint = caveatConfig.getConstraint(shortName); - - if (constraint != null) - { - // Pass the constraint detail to the template - var value = constraint.getValue(valueName); - - if(value == null) - { - // Return 404 - status.setCode(404, "Constraint List: " + shortName + " value: " + valueName + "does not exist"); - return; - } - - model.value = value; - model.constraint = constraint; - } - else - { - // Return 404 - status.setCode(404, "Constraint List " + shortName + " does not exist"); - return; - } -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Get the detail of the rm constraint + */ +function main() +{ + var urlElements = url.extension.split("/"); + var shortName = decodeURIComponent(urlElements[0]); + var valueName = decodeURIComponent(urlElements[2]) + + // Get the constraint + var constraint = caveatConfig.getConstraint(shortName); + + if (constraint != null) + { + // Pass the constraint detail to the template + var value = constraint.getValue(valueName); + + if(value == null) + { + // Return 404 + status.setCode(404, "Constraint List: " + shortName + " value: " + valueName + "does not exist"); + return; + } + + model.value = value; + model.constraint = constraint; + } + else + { + // Return 404 + status.setCode(404, "Constraint List " + shortName + " does not exist"); + return; + } +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.json.ftl index 240cf716ac..2ef038113c 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/values/rmconstraintvalue.get.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": <@rmconstraintLib.constraintWithValueJSON constraint=constraint value=value/> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "../rmconstraint.lib.ftl" as rmconstraintLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": <@rmconstraintLib.constraintWithValueJSON constraint=constraint value=value/> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.desc.xml index 0c4801c54a..f0f74a4e42 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.desc.xml @@ -1,14 +1,14 @@ - - Deletes a records management event - - - - /api/rma/admin/rmevents/{eventname} - argument - user - required - internal + + Deletes a records management event + + + + /api/rma/admin/rmevents/{eventname} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.json.ftl index 05d341e16b..b7ba61347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.delete.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.desc.xml index e7e1294a75..4667b1a3ef 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.desc.xml @@ -1,14 +1,14 @@ - - Get an records management event - - - - /api/rma/admin/rmevents/{eventname} - argument - user - required - internal + + Get an records management event + + + + /api/rma/admin/rmevents/{eventname} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.json.ftl index 09f6464217..b8dde07c41 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.get.json.ftl @@ -1,34 +1,34 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmEventLib.eventJSON event=event /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmevent.lib.ftl" as rmEventLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + <@rmEventLib.eventJSON event=event /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.lib.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.lib.ftl index 94a052ad41..7bf3c7f59f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.lib.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.lib.ftl @@ -1,38 +1,38 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#-- renders an rm event object --> - -<#macro eventJSON event> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "eventName": "${event.name}", - "eventDisplayLabel": "${event.displayLabel}", - "eventType":"${event.type}" -} - - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#-- renders an rm event object --> + +<#macro eventJSON event> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "eventName": "${event.name}", + "eventDisplayLabel": "${event.displayLabel}", + "eventType":"${event.type}" +} + + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.desc.xml index 3457e2ee65..20fa57cfea 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.desc.xml @@ -1,14 +1,14 @@ - - Update a records management event - - - - /api/rma/admin/rmevents/{eventname} - argument - user - required - internal + + Update a records management event + + + + /api/rma/admin/rmevents/{eventname} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.json.ftl index 09f6464217..b8dde07c41 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevent.put.json.ftl @@ -1,34 +1,34 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmEventLib.eventJSON event=event /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmevent.lib.ftl" as rmEventLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + <@rmEventLib.eventJSON event=event /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.desc.xml index ca2c548783..b80139a92d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.desc.xml @@ -1,14 +1,14 @@ - - Get list of records management events - - - - /api/rma/admin/rmevents - argument - user - required - internal + + Get list of records management events + + + + /api/rma/admin/rmevents + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.json.ftl index d1021af97a..ae670f664b 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.get.json.ftl @@ -1,39 +1,39 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - <#list events as event> - "${event.name}": - <@rmEventLib.eventJSON event=event /><#if event_has_next>, - - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmevent.lib.ftl" as rmEventLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + <#list events as event> + "${event.name}": + <@rmEventLib.eventJSON event=event /><#if event_has_next>, + + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.desc.xml index ed0a8207d5..c7970590a4 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.desc.xml @@ -1,14 +1,14 @@ - - Create a new records managment event - - - - /api/rma/admin/rmevents - argument - user - required - internal + + Create a new records managment event + + + + /api/rma/admin/rmevents + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.json.ftl index 481c7144e0..e37c59aa45 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmevents.post.json.ftl @@ -1,35 +1,35 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmEventLib.eventJSON event=event /> - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmevent.lib.ftl" as rmEventLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + <@rmEventLib.eventJSON event=event /> + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.desc.xml index d14aecb466..6d28dd8489 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.desc.xml @@ -1,14 +1,14 @@ - - Gets the records management event types - - - - /api/rma/admin/rmeventtypes - argument - user - required - internal + + Gets the records management event types + + + + /api/rma/admin/rmeventtypes + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl index 6ce382924e..f4983a0f39 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl @@ -1,42 +1,42 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmevent.lib.ftl" as rmEventLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - <#list eventtypes as eventtype> - "${eventtype.name}": - { - "eventTypeName" : "${eventtype.name}", - "eventTypeDisplayLabel" : "<#if eventtype.displayLabel??>${eventtype.displayLabel}<#else>" - }<#if eventtype_has_next>, - - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmevent.lib.ftl" as rmEventLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + <#list eventtypes as eventtype> + "${eventtype.name}": + { + "eventTypeName" : "${eventtype.name}", + "eventTypeDisplayLabel" : "<#if eventtype.displayLabel??>${eventtype.displayLabel}<#else>" + }<#if eventtype_has_next>, + + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.desc.xml index 1cd7262836..2977395daa 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.desc.xml @@ -1,16 +1,16 @@ - - Deletes a records management role - - - - /api/rma/admin/rmroles/{rolename} - /api/rma/admin/{siteid}/rmroles/{rolename} - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} - argument - user - required - internal + + Deletes a records management role + + + + /api/rma/admin/rmroles/{rolename} + /api/rma/admin/{siteid}/rmroles/{rolename} + /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.json.ftl index 05d341e16b..b7ba61347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.delete.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.desc.xml index 75a9fa715c..5035c87ac1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.desc.xml @@ -1,16 +1,16 @@ - - Get an records management role - - - - /api/rma/admin/rmroles/{rolename} - /api/rma/admin/{siteid}/rmroles/{rolename} - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} - argument - user - required - internal + + Get an records management role + + + + /api/rma/admin/rmroles/{rolename} + /api/rma/admin/{siteid}/rmroles/{rolename} + /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.json.ftl index c17b7dcb17..51a9a9ad55 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.get.json.ftl @@ -1,34 +1,34 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmrole.lib.ftl" as rmRoleLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmRoleLib.roleJSON role=role /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmrole.lib.ftl" as rmRoleLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + <@rmRoleLib.roleJSON role=role /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.lib.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.lib.ftl index b375da09f2..ce1ac5397b 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.lib.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.lib.ftl @@ -1,65 +1,65 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#-- renders an rm role object --> -<#macro roleJSON role> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "name": "${role.name}", - "displayLabel": "${role.displayLabel}", - "capabilities": - { - <#list role.capabilities as capability> - "${capability.name}": "${capability.title}" <#if capability_has_next>, - - } - <#if role.showAuths> - , - "assignedUsers" : - [ - <#list role.assignedUsers as user> - { - "name" : "${user.name}", - "displayLabel" : "${user.displayLabel}" - }<#if user_has_next>, - - ], - "assignedGroups" : - [ - <#list role.assignedGroups as group> - { - "name" : "${group.name}", - "displayLabel" : "${group.displayLabel}" - }<#if group_has_next>, - - ] - <#if role.groupShortName??> - ,"groupShortName": "${role.groupShortName}" - - -} - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#-- renders an rm role object --> +<#macro roleJSON role> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "name": "${role.name}", + "displayLabel": "${role.displayLabel}", + "capabilities": + { + <#list role.capabilities as capability> + "${capability.name}": "${capability.title}" <#if capability_has_next>, + + } + <#if role.showAuths> + , + "assignedUsers" : + [ + <#list role.assignedUsers as user> + { + "name" : "${user.name}", + "displayLabel" : "${user.displayLabel}" + }<#if user_has_next>, + + ], + "assignedGroups" : + [ + <#list role.assignedGroups as group> + { + "name" : "${group.name}", + "displayLabel" : "${group.displayLabel}" + }<#if group_has_next>, + + ] + <#if role.groupShortName??> + ,"groupShortName": "${role.groupShortName}" + + +} + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.desc.xml index 093b5e49c9..c939ad16a0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.desc.xml @@ -1,16 +1,16 @@ - - Update a records management role - - - - /api/rma/admin/rmroles/{rolename} - /api/rma/admin/{siteid}/rmroles/{rolename} - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} - argument - user - required - internal + + Update a records management role + + + + /api/rma/admin/rmroles/{rolename} + /api/rma/admin/{siteid}/rmroles/{rolename} + /api/rma/admin/{store_type}/{store_id}/{id}/rmroles/{rolename} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.json.ftl index c17b7dcb17..51a9a9ad55 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmrole.put.json.ftl @@ -1,34 +1,34 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmrole.lib.ftl" as rmRoleLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmRoleLib.roleJSON role=role /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmrole.lib.ftl" as rmRoleLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + <@rmRoleLib.roleJSON role=role /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.desc.xml index aa9c48a015..d2a382d9aa 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.desc.xml @@ -1,22 +1,22 @@ - - Get list of records management roles and their details, for a file plan. - - - - /api/rma/admin/rmroles?user={user?}&auths={auths?}&is={is?} - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles?user={user?}&auths={auths?}&is={is?} - /api/rma/admin/{siteid}/rmroles?user={user?}&auths={auths?}&is={is?} - argument - user - required - internal + + Get list of records management roles and their details, for a file plan. + + + + /api/rma/admin/rmroles?user={user?}&auths={auths?}&is={is?} + /api/rma/admin/{store_type}/{store_id}/{id}/rmroles?user={user?}&auths={auths?}&is={is?} + /api/rma/admin/{siteid}/rmroles?user={user?}&auths={auths?}&is={is?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.json.ftl index 445bf8a8fa..8f5fe6dc83 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.get.json.ftl @@ -1,39 +1,39 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmrole.lib.ftl" as rmRoleLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - <#list roles as role> - "${role.name}": - <@rmRoleLib.roleJSON role=role /><#if role_has_next>, - - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmrole.lib.ftl" as rmRoleLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + <#list roles as role> + "${role.name}": + <@rmRoleLib.roleJSON role=role /><#if role_has_next>, + + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.desc.xml index 9486b8337b..8b472e934e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.desc.xml @@ -1,16 +1,16 @@ - - Create a new records managment role - - - - /api/rma/admin/rmroles - /api/rma/admin/{siteid}/rmroles - /api/rma/admin/{store_type}/{store_id}/{id}/rmroles - argument - user - required - internal + + Create a new records managment role + + + + /api/rma/admin/rmroles + /api/rma/admin/{siteid}/rmroles + /api/rma/admin/{store_type}/{store_id}/{id}/rmroles + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.json.ftl index c17b7dcb17..51a9a9ad55 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmrole/rmroles.post.json.ftl @@ -1,34 +1,34 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmrole.lib.ftl" as rmRoleLib/> - -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - <@rmRoleLib.roleJSON role=role /> -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmrole.lib.ftl" as rmRoleLib/> + +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + <@rmRoleLib.roleJSON role=role /> +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.desc.xml index bcc2921b4e..d1ca358cdd 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.desc.xml @@ -1,15 +1,15 @@ - - Applies fixes to the content model for DoD certification. - - Please note that this script will be removed after the certification process is complete. - ]]> - /api/rma/applydodcertmodelfixes - argument - admin - required - internal + + Applies fixes to the content model for DoD certification. + + Please note that this script will be removed after the certification process is complete. + ]]> + /api/rma/applydodcertmodelfixes + argument + admin + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.json.ftl index 26931a21fe..fb4137fbd1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applydodcertmodelfixes.get.json.ftl @@ -1,31 +1,31 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "success": ${success?string} +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.desc.xml index 9dada0f840..b468a7889e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.desc.xml @@ -1,9 +1,9 @@ - - Applies fix for MOB-1573. - Fixes the RM custom model by changing the multiplicity on custom references to many-to-many. - /api/rma/applyfixmob1573 - argument - admin - required - internal + + Applies fix for MOB-1573. + Fixes the RM custom model by changing the multiplicity on custom references to many-to-many. + /api/rma/applyfixmob1573 + argument + admin + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.json.ftl index 26931a21fe..fb4137fbd1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/applyfixmob1573.get.json.ftl @@ -1,31 +1,31 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "success": ${success?string} +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.desc.xml index 14c6f8d6c6..fb55a391ee 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.desc.xml @@ -1,9 +1,9 @@ - - Load the RM DOD bootstrap data. - WebScript to import and fix up the RM DOD bootstrap data. - /api/rma/bootstraptestdata?site={site?}&import={import?} - argument - admin - required - deprecated + + Load the RM DOD bootstrap data. + WebScript to import and fix up the RM DOD bootstrap data. + /api/rma/bootstraptestdata?site={site?}&import={import?} + argument + admin + required + deprecated \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.json.ftl index 26931a21fe..fb4137fbd1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/bootstraptestdata.get.json.ftl @@ -1,31 +1,31 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "success": ${success?string} +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.desc.xml index 51cb5a1f98..e8b2400d4d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.desc.xml @@ -1,10 +1,10 @@ - - Records Management Capabilities - Get the list of capabilities available to the current user on the given node. - /api/node/{store_type}/{store_id}/{id}/capabilities?includeAll={includeAll?} - /api/capabilities?includeAll={includeAll?}&grouped={grouped?} - argument - user - required - internal + + Records Management Capabilities + Get the list of capabilities available to the current user on the given node. + /api/node/{store_type}/{store_id}/{id}/capabilities?includeAll={includeAll?} + /api/capabilities?includeAll={includeAll?}&grouped={grouped?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.json.ftl index 3630f78333..8a20fcc994 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/capability/capabilities.get.json.ftl @@ -1,59 +1,59 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "data": - { - <#if groupedCapabilities??> - "groupedCapabilities": - [ - <#list groupedCapabilities?keys?sort as groupedCapabilityKey> - { - "${groupedCapabilityKey}": - { - <#assign groupedCapability = groupedCapabilities[groupedCapabilityKey]> - groupTitle: "${groupedCapability.groupTitle}", - capabilities: - { - <#assign capabilities = groupedCapability.capabilities> - <#list capabilities?keys?sort as capabilityKey> - "${capabilityKey}": "${capabilities[capabilityKey]}"<#if capabilityKey_has_next>, - - } - } - }<#if groupedCapabilityKey_has_next>, - - ] - <#else> - "capabilities": - [ - <#list capabilities as capability> - "${capability}"<#if capability_has_next>, - - ] - - } -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "data": + { + <#if groupedCapabilities??> + "groupedCapabilities": + [ + <#list groupedCapabilities?keys?sort as groupedCapabilityKey> + { + "${groupedCapabilityKey}": + { + <#assign groupedCapability = groupedCapabilities[groupedCapabilityKey]> + groupTitle: "${groupedCapability.groupTitle}", + capabilities: + { + <#assign capabilities = groupedCapability.capabilities> + <#list capabilities?keys?sort as capabilityKey> + "${capabilityKey}": "${capabilities[capabilityKey]}"<#if capabilityKey_has_next>, + + } + } + }<#if groupedCapabilityKey_has_next>, + + ] + <#else> + "capabilities": + [ + <#list capabilities as capability> + "${capability}"<#if capability_has_next>, + + ] + + } +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.desc.xml index 3c51ebf518..384249493f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.desc.xml @@ -1,12 +1,12 @@ - - Records Management Customisable Types and Aspects - - - /api/rma/admin/customisable - - user - required - internal + + Records Management Customisable Types and Aspects + + + /api/rma/admin/customisable + + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.json.ftl index 41eb6aceb2..641a3b01f0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customisable.get.json.ftl @@ -1,40 +1,40 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - [ - <#list items as item> - { - "name" : "${item.name}", - "isAspect" : ${item.isAspect?string}, - "title" : "${item.title}" - }<#if item_has_next>, - - ] -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + [ + <#list items as item> + { + "name" : "${item.name}", + "isAspect" : ${item.isAspect?string}, + "title" : "${item.title}" + }<#if item_has_next>, + + ] +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.desc.xml index 90aa0b9af9..24e24f2c0e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.desc.xml @@ -1,18 +1,18 @@ - - Attempts to remove specified Custom Property Definitions from the custom model - - It should be noted that it may not be possible to honour this request in all cases.
- In cases where instances of the specified property are already present in the system,
- the request will not succeed. In cases where there are no instances of the specified
- property in the system, the request will attempted.
-
- The propId is that returned by custompropertydefinitions.get. - ]]> -
- /api/rma/admin/custompropertydefinitions/{propId} - argument - user - required - internal -
+ + Attempts to remove specified Custom Property Definitions from the custom model + + It should be noted that it may not be possible to honour this request in all cases.
+ In cases where instances of the specified property are already present in the system,
+ the request will not succeed. In cases where there are no instances of the specified
+ property in the system, the request will attempted.
+
+ The propId is that returned by custompropertydefinitions.get. + ]]> +
+ /api/rma/admin/custompropertydefinitions/{propId} + argument + user + required + internal +
diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.json.ftl index 488dc580e9..000bc7088c 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.delete.json.ftl @@ -1,34 +1,34 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "customProperty": "${propertyqname}" - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "customProperty": "${propertyqname}" + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.desc.xml index 19935f62e5..9d5af56a68 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.desc.xml @@ -1,29 +1,29 @@ - - Add a Custom Property Definition to the custom model - -
- The URL query parameter 'element' defines which RM type will be able to have the property added.
- It should be a the customisable types short qname type (eg rma:recordCategory)
-
- The JSON parameter 'propId' is optional. If a value is provided it must only contain characters
- which are legal within URLs and within QNames.
- It is also the responsibility of the calling code to ensure the propId is unique across all custom properties.
- If a value is not provided, one will be generated.
-
- The body of the post should be in the form, e.g.
- {
-    "label": "sample Custom Property",
-    "dataType": "d:boolean",
-    "mandatory": false
, -    "constraintRef": "rmc:constraintName",
-    "propId": "myPropId"
- }
- ]]> -
- /api/rma/admin/custompropertydefinitions?element={element} - argument - user - required - internal -
+ + Add a Custom Property Definition to the custom model + +
+ The URL query parameter 'element' defines which RM type will be able to have the property added.
+ It should be a the customisable types short qname type (eg rma:recordCategory)
+
+ The JSON parameter 'propId' is optional. If a value is provided it must only contain characters
+ which are legal within URLs and within QNames.
+ It is also the responsibility of the calling code to ensure the propId is unique across all custom properties.
+ If a value is not provided, one will be generated.
+
+ The body of the post should be in the form, e.g.
+ {
+    "label": "sample Custom Property",
+    "dataType": "d:boolean",
+    "mandatory": false
, +    "constraintRef": "rmc:constraintName",
+    "propId": "myPropId"
+ }
+ ]]> +
+ /api/rma/admin/custompropertydefinitions?element={element} + argument + user + required + internal +
diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.json.ftl index f5d2b89832..04a6284055 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.post.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "propId": "${propId!""}", - "url": "${url!""}", - "message": "${errorMessage!""}" -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "propId": "${propId!""}", + "url": "${url!""}", + "message": "${errorMessage!""}" +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.desc.xml index e5485bb79b..f4dcf82e60 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.desc.xml @@ -1,25 +1,25 @@ - - Updates a Custom Property Definition. - -
- There is currently support only for updating the label and/or for updating the constraint.
- The body of the PUT should be in the form, e.g.
- {
-    "label": "updated label value",
-    "constraintRef": "rmc:constraintName",
- }
- In the above example JSON, a constraintRef with QName "rmc:constraintName" will be added to the
- property definition if one does not exist. If there already is a constraint, it will be replaced.
- It is also possible to remove all constraints from the property definition by passing null:
- {
-    "constraintRef": null,
- }
- ]]> -
- /api/rma/admin/custompropertydefinitions/{propId} - argument - user - required - internal -
+ + Updates a Custom Property Definition. + +
+ There is currently support only for updating the label and/or for updating the constraint.
+ The body of the PUT should be in the form, e.g.
+ {
+    "label": "updated label value",
+    "constraintRef": "rmc:constraintName",
+ }
+ In the above example JSON, a constraintRef with QName "rmc:constraintName" will be added to the
+ property definition if one does not exist. If there already is a constraint, it will be replaced.
+ It is also possible to remove all constraints from the property definition by passing null:
+ {
+    "constraintRef": null,
+ }
+ ]]> +
+ /api/rma/admin/custompropertydefinitions/{propId} + argument + user + required + internal +
diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.json.ftl index 8aea698225..9289822c14 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinition.put.json.ftl @@ -1,33 +1,33 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "propId": "${propId!""}", - "url": "${url!""}", - "message": "${errorMessage!""}" -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "propId": "${propId!""}", + "url": "${url!""}", + "message": "${errorMessage!""}" +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.desc.xml index 157a5631f8..bd6b7b218c 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.desc.xml @@ -1,14 +1,14 @@ - - Records Management Custom Model Property Definitions - - If a propId is specified within the URL, only that specific property definition is returned.
- ]]> -
- /api/rma/admin/custompropertydefinitions?element={element} - /api/rma/admin/custompropertydefinitions/{propId} - - user - required - internal + + Records Management Custom Model Property Definitions + + If a propId is specified within the URL, only that specific property definition is returned.
+ ]]> +
+ /api/rma/admin/custompropertydefinitions?element={element} + /api/rma/admin/custompropertydefinitions/{propId} + + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.json.ftl index 74c51c9855..01712b698e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/custompropdefinitions.get.json.ftl @@ -1,69 +1,69 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "customProperties": - { - <#list customProps as prop> - "${prop.name.toPrefixString()}": - { - "dataType": "<#if prop.dataType??>${prop.dataType.name.toPrefixString()}", - "label": "${prop.title!""}", - "description": "${prop.description!""}", - "mandatory": ${prop.mandatory?string}, - "multiValued": ${prop.multiValued?string}, - "defaultValue": "${prop.defaultValue!""}", - "protected": ${prop.protected?string}, - "propId": "${prop.name.localName}", - "constraintRefs": - [ - <#list prop.constraints as con> - { - "name": "${con.constraint.shortName!""}", - "title": "${msg(con.constraint.title)!""}", - "type": "${con.constraint.type!""}", - "parameters": - { - <#-- Basic implementation. Only providing 2 hardcoded parameters. --> - <#assign lov = con.constraint.parameters["allowedValues"]> - "caseSensitive": ${con.constraint.parameters["caseSensitive"]?string}, - "listOfValues" : - [ - <#list lov as val>"${val}"<#if val_has_next>, - ] - } - }<#if con_has_next>, - - ] - }<#if prop_has_next>, - - } - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "customProperties": + { + <#list customProps as prop> + "${prop.name.toPrefixString()}": + { + "dataType": "<#if prop.dataType??>${prop.dataType.name.toPrefixString()}", + "label": "${prop.title!""}", + "description": "${prop.description!""}", + "mandatory": ${prop.mandatory?string}, + "multiValued": ${prop.multiValued?string}, + "defaultValue": "${prop.defaultValue!""}", + "protected": ${prop.protected?string}, + "propId": "${prop.name.localName}", + "constraintRefs": + [ + <#list prop.constraints as con> + { + "name": "${con.constraint.shortName!""}", + "title": "${msg(con.constraint.title)!""}", + "type": "${con.constraint.type!""}", + "parameters": + { + <#-- Basic implementation. Only providing 2 hardcoded parameters. --> + <#assign lov = con.constraint.parameters["allowedValues"]> + "caseSensitive": ${con.constraint.parameters["caseSensitive"]?string}, + "listOfValues" : + [ + <#list lov as val>"${val}"<#if val_has_next>, + ] + } + }<#if con_has_next>, + + ] + }<#if prop_has_next>, + + } + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.desc.xml index 464533568d..62916a0b4f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.desc.xml @@ -1,14 +1,14 @@ - - Removes specified Custom Reference Instance from between the specified nodes - - The nodeRef encoded within the URL path is the 'fromNode' in the relationship.
- The nodeRef encoded within the query string is the 'toNode' in the relationship.
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/customreferences/{refId}?st={toStoreType}&si={toStoreId}&id={toId} - argument - user - required - internal -
+ + Removes specified Custom Reference Instance from between the specified nodes + + The nodeRef encoded within the URL path is the 'fromNode' in the relationship.
+ The nodeRef encoded within the query string is the 'toNode' in the relationship.
+ ]]> +
+ /api/node/{store_type}/{store_id}/{id}/customreferences/{refId}?st={toStoreType}&si={toStoreId}&id={toId} + argument + user + required + internal +
diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.json.ftl index 94adbdc381..78abb7f172 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.delete.json.ftl @@ -1,29 +1,29 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "success": ${success?string} -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "success": ${success?string} +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.desc.xml index ed54822d03..660c6f63c7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.desc.xml @@ -1,18 +1,18 @@ - - Add a Custom Reference instance to the specified record node - -
- The body of the post should be in the form, e.g.
- {
-    "toNode" : "workspace://SpacesStore/12345678-abcd-1234-abcd-1234567890ab",
-    "refId" : the refId as returned by customrefdefinitions.get
- }
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/customreferences - argument - user - required - internal + + Add a Custom Reference instance to the specified record node + +
+ The body of the post should be in the form, e.g.
+ {
+    "toNode" : "workspace://SpacesStore/12345678-abcd-1234-abcd-1234567890ab",
+    "refId" : the refId as returned by customrefdefinitions.get
+ }
+ ]]> +
+ /api/node/{store_type}/{store_id}/{id}/customreferences + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.json.ftl index 84b7403b56..7e84ce88d7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customref.post.json.ftl @@ -1,31 +1,31 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "success": ${success?string} +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.desc.xml index 776e645b72..d5a793f9ef 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.desc.xml @@ -1,22 +1,22 @@ - - Add a Custom Reference Definition to the custom model - -
- The body of the post should be in the form, e.g.
- {
-    "referenceType" : ""parentchild" OR "bidirectional",
-    "label" : "bar"
-    "source" : "foo",
-    "target" : "bar"
- }
- For parentchild references, source and target must be provided. For bidirectional references, - a label is required.
- ]]> -
- /api/rma/admin/customreferencedefinitions - argument - user - required - internal -
+ + Add a Custom Reference Definition to the custom model + +
+ The body of the post should be in the form, e.g.
+ {
+    "referenceType" : ""parentchild" OR "bidirectional",
+    "label" : "bar"
+    "source" : "foo",
+    "target" : "bar"
+ }
+ For parentchild references, source and target must be provided. For bidirectional references, + a label is required.
+ ]]> +
+ /api/rma/admin/customreferencedefinitions + argument + user + required + internal +
diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.json.ftl index 196006c47c..ba17ef4769 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.post.json.ftl @@ -1,36 +1,36 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string}, - "data" : { - "referenceType": "${referenceType?string}", - "refId": "${refId?string}", - "url": "${url?string}" - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "success": ${success?string}, + "data" : { + "referenceType": "${referenceType?string}", + "refId": "${refId?string}", + "url": "${url?string}" + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.desc.xml index 6137f8229c..45cf4a2301 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.desc.xml @@ -1,25 +1,25 @@ - - Updates a Custom Reference Definition. - -
- There is currently support only for updating the label, source or target fields.
-
- The body of the PUT should be in the form, e.g.
- {
-    "label": "updated label value",
- }
- OR - {
-    "source": "updated source value",
-    "target": "updated target value",
- }
- for bidirectional and parentchild references respectively.
- ]]> -
- /api/rma/admin/customreferencedefinitions/{refId} - argument - user - required - internal -
+ + Updates a Custom Reference Definition. + +
+ There is currently support only for updating the label, source or target fields.
+
+ The body of the PUT should be in the form, e.g.
+ {
+    "label": "updated label value",
+ }
+ OR + {
+    "source": "updated source value",
+    "target": "updated target value",
+ }
+ for bidirectional and parentchild references respectively.
+ ]]> +
+ /api/rma/admin/customreferencedefinitions/{refId} + argument + user + required + internal +
diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.json.ftl index dc6d1154c9..0921e0d440 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinition.put.json.ftl @@ -1,32 +1,32 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "refId": "${refId}", - "url": "${url}" -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "refId": "${refId}", + "url": "${url}" +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.desc.xml index ffb6fc256d..b474afd1ee 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.desc.xml @@ -1,15 +1,15 @@ - - Records Management Custom Model Reference Definitions - - If a refId is specified, then only the reference definition corresponding to that
- id will be returned.
- ]]> -
- /api/rma/admin/customreferencedefinitions - /api/rma/admin/customreferencedefinitions/{refId} - - user - required - internal + + Records Management Custom Model Reference Definitions + + If a refId is specified, then only the reference definition corresponding to that
+ id will be returned.
+ ]]> +
+ /api/rma/admin/customreferencedefinitions + /api/rma/admin/customreferencedefinitions/{refId} + + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.json.ftl index 9d72e4553f..8ff6e2df70 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefdefinitions.get.json.ftl @@ -1,42 +1,42 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "customReferences": - [ - <#list customRefs as ref> - { - <#assign keys = ref?keys> - <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, - }<#if ref_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "customReferences": + [ + <#list customRefs as ref> + { + <#assign keys = ref?keys> + <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, + }<#if ref_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.desc.xml index 45ae35c570..ff5c9a054b 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.desc.xml @@ -1,45 +1,45 @@ - - Records Management Custom Reference Instances - - The response will have the form:
- {
- "data":
-   {
-   "nodeName": "samplename",
-   "nodeTitle": "sample title",
-   "customReferencesFrom":
-     [
-       {
-       "refId": "09876543-wxyz-0987-wxyz-098765432109",
-       "referenceType": "bidirectional",
-       "label": "BiDi",
-       "targetRef": "workspace://SpacesStore/zyxwvuts-4321-zyxw-4321-zyxwvutsrqpo",
-       "sourceRef": "workspace://SpacesStore/a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1"
-       }
-     ]
-   "customReferencesTo":
-     [
-       {
-       "childRef": "workspace://SpacesStore/12345678-abcd-1234-abcd-123456789012",
-       "refId": "versions",
-       "source": "VersionedBy",
-       "referenceType": "parentchild",
-       "target": "Versions",
-       "parentRef": "workspace://SpacesStore/abcdefgh-1234-abcd-1234-abcdefghijkl"
-       }
-     ]
-   }
- }
- The "customReferencesFrom" field gives the references that are from this node i.e. from the node
- to which the GET was issued. Conversely, the "customReferencesTo" field gives the references that
- are to this node.
- For parent/child reference types, the reference goes from the parent to the child.
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/customreferences - - user - required - internal + + Records Management Custom Reference Instances + + The response will have the form:
+ {
+ "data":
+   {
+   "nodeName": "samplename",
+   "nodeTitle": "sample title",
+   "customReferencesFrom":
+     [
+       {
+       "refId": "09876543-wxyz-0987-wxyz-098765432109",
+       "referenceType": "bidirectional",
+       "label": "BiDi",
+       "targetRef": "workspace://SpacesStore/zyxwvuts-4321-zyxw-4321-zyxwvutsrqpo",
+       "sourceRef": "workspace://SpacesStore/a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1"
+       }
+     ]
+   "customReferencesTo":
+     [
+       {
+       "childRef": "workspace://SpacesStore/12345678-abcd-1234-abcd-123456789012",
+       "refId": "versions",
+       "source": "VersionedBy",
+       "referenceType": "parentchild",
+       "target": "Versions",
+       "parentRef": "workspace://SpacesStore/abcdefgh-1234-abcd-1234-abcdefghijkl"
+       }
+     ]
+   }
+ }
+ The "customReferencesFrom" field gives the references that are from this node i.e. from the node
+ to which the GET was issued. Conversely, the "customReferencesTo" field gives the references that
+ are to this node.
+ For parent/child reference types, the reference goes from the parent to the child.
+ ]]> +
+ /api/node/{store_type}/{store_id}/{id}/customreferences + + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.json.ftl index 03e81ec527..8bc8a877db 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/customrefs.get.json.ftl @@ -1,53 +1,53 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "nodeName": "${nodeName!""}", - "nodeTitle": "${nodeTitle!""}", - "customReferencesFrom": - [ - <#list customRefsFrom as ref> - { - <#assign keys = ref?keys> - <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, - }<#if ref_has_next>, - - ], - "customReferencesTo": - [ - <#list customRefsTo as ref> - { - <#assign keys = ref?keys> - <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, - }<#if ref_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "nodeName": "${nodeName!""}", + "nodeTitle": "${nodeTitle!""}", + "customReferencesFrom": + [ + <#list customRefsFrom as ref> + { + <#assign keys = ref?keys> + <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, + }<#if ref_has_next>, + + ], + "customReferencesTo": + [ + <#list customRefsTo as ref> + { + <#assign keys = ref?keys> + <#list keys as key>"${key}": "${ref[key]}"<#if key_has_next>, + }<#if ref_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.desc.xml index ea9d1afe00..a3ec79d5b2 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.desc.xml @@ -1,9 +1,9 @@ - - Import data set into a file plan - WebScript to import a given data set into a given file plan - /api/rma/datasets/{dataSetId}?site={site} - argument - user - required - internal + + Import data set into a file plan + WebScript to import a given data set into a given file plan + /api/rma/datasets/{dataSetId}?site={site} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.json.ftl index 209ebf530c..d79030218f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dataset.post.json.ftl @@ -1,32 +1,32 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string}, - "message": "${message}" -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "success": ${success?string}, + "message": "${message}" +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.desc.xml index abe2ffaa1f..e82285d044 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.desc.xml @@ -1,9 +1,9 @@ - - Get data sets - WebScript to get the list of available RM test data - /api/rma/datasets?site={site?}&unloadedonly={unloadedonly?} - argument - user - required - internal + + Get data sets + WebScript to get the list of available RM test data + /api/rma/datasets?site={site?}&unloadedonly={unloadedonly?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.json.ftl index feacfdee29..9c48b48ac1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/datasets.get.json.ftl @@ -1,41 +1,41 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "data": - { - "datasets": - [ - <#list datasets as item> - { - "label": "${item.label}", - "id": "${item.id}", - "isLoaded": "${item.isLoaded}" - }<#if item_has_next>, - - ] - } -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "data": + { + "datasets": + [ + <#list datasets as item> + { + "label": "${item.label}", + "id": "${item.id}", + "isLoaded": "${item.isLoaded}" + }<#if item_has_next>, + + ] + } +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.desc.xml index cd9df1aa22..eb7d36286d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.desc.xml @@ -1,9 +1,9 @@ - - Delete Disposition Action Definition - Deletes a disposition action definition from the collection. - /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions/{action_def_id} - argument - user - required - internal + + Delete Disposition Action Definition + Deletes a disposition action definition from the collection. + /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions/{action_def_id} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.json.ftl index 1c26cf6894..670a74f164 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.delete.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#include "dispositionschedule.get.json.ftl"> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#include "dispositionschedule.get.json.ftl"> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.lib.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.lib.ftl index a402f03ac7..b81c1ee8f3 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.lib.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.lib.ftl @@ -1,44 +1,44 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#macro actionJSON action> -<#escape x as jsonUtils.encodeJSONString(x)> - { - "id": "${action.id}", - "url": "${action.url}", - "index": ${action.index}, - "name": "${action.name}", - "label": "${action.label}", - <#if (action.name == "destroy") && action.ghostOnDestroy??>"ghostOnDestroy": "${action.ghostOnDestroy}", - <#if action.description??>"description": "${action.description}", - <#if action.period??>"period": "${action.period}", - <#if action.periodProperty??>"periodProperty": "${action.periodProperty}", - <#if action.location??>"location": "${action.location}", - <#if action.events??>"events": [<#list action.events as event>"${event}"<#if event_has_next>,], - "eligibleOnFirstCompleteEvent": ${action.eligibleOnFirstCompleteEvent?string} - } - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#macro actionJSON action> +<#escape x as jsonUtils.encodeJSONString(x)> + { + "id": "${action.id}", + "url": "${action.url}", + "index": ${action.index}, + "name": "${action.name}", + "label": "${action.label}", + <#if (action.name == "destroy") && action.ghostOnDestroy??>"ghostOnDestroy": "${action.ghostOnDestroy}", + <#if action.description??>"description": "${action.description}", + <#if action.period??>"period": "${action.period}", + <#if action.periodProperty??>"periodProperty": "${action.periodProperty}", + <#if action.location??>"location": "${action.location}", + <#if action.events??>"events": [<#list action.events as event>"${event}"<#if event_has_next>,], + "eligibleOnFirstCompleteEvent": ${action.eligibleOnFirstCompleteEvent?string} + } + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.desc.xml index 66692a049a..7801f86edc 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.desc.xml @@ -1,21 +1,21 @@ - - Update Disposition Action Definition - - {
-    "name" : Name of action,
-    "description" : Description of the action definition,
-    "period" : The period of time,
-    "periodProperty" : Model property the period is relative to,
-    "eligibleOnFirstCompleteEvent" : Whether all events have to occur,
-    "events" : [List of event names]
- }
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions/{action_def_id} - argument - user - required - internal + + Update Disposition Action Definition + + {
+    "name" : Name of action,
+    "description" : Description of the action definition,
+    "period" : The period of time,
+    "periodProperty" : Model property the period is relative to,
+    "eligibleOnFirstCompleteEvent" : Whether all events have to occur,
+    "events" : [List of event names]
+ }
+ ]]> +
+ /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions/{action_def_id} + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.json.ftl index 935d2e471f..eee92d6b48 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinition.put.json.ftl @@ -1,31 +1,31 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> -{ - "data": - <@actionDefLib.actionJSON action=action/> -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> +{ + "data": + <@actionDefLib.actionJSON action=action/> +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.desc.xml index a2e5880649..11d132b4c0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.desc.xml @@ -1,21 +1,21 @@ - - Add Disposition Action Definition - - {
-    "name" : Name of action,
-    "description" : Description of the action definition,
-    "period" : The period of time,
-    "periodProperty" : Model property the period is relative to,
-    "eligibleOnFirstCompleteEvent" : Whether all events have to occur,
-    "events" : [List of event names]
- }
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions - argument - user - required - internal + + Add Disposition Action Definition + + {
+    "name" : Name of action,
+    "description" : Description of the action definition,
+    "period" : The period of time,
+    "periodProperty" : Model property the period is relative to,
+    "eligibleOnFirstCompleteEvent" : Whether all events have to occur,
+    "events" : [List of event names]
+ }
+ ]]> +
+ /api/node/{store_type}/{store_id}/{id}/dispositionschedule/dispositionactiondefinitions + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.json.ftl index 935d2e471f..eee92d6b48 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionactiondefinitions.post.json.ftl @@ -1,31 +1,31 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> -{ - "data": - <@actionDefLib.actionJSON action=action/> -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> +{ + "data": + <@actionDefLib.actionJSON action=action/> +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.desc.xml index f80ee5b24b..2736331dae 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.desc.xml @@ -1,9 +1,9 @@ - - Get Dispositon Lifecycle - Returns Disposition Lifecycle data - /api/node/{store_type}/{store_id}/{id}/nextdispositionaction - argument - user - required - internal + + Get Dispositon Lifecycle + Returns Disposition Lifecycle data + /api/node/{store_type}/{store_id}/{id}/nextdispositionaction + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.json.ftl index 9c291a33d6..01365adcd8 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionlifecycle.get.json.ftl @@ -1,66 +1,66 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - <#if nextaction.notFound?? && nextaction.notFound> - "notFound": ${nextaction.notFound?string}, - "message": "${nextaction.message}" - <#else> - "url": "${nextaction.url}", - "name": "${nextaction.name}", - "label": "${nextaction.label}", - "eventsEligible": ${nextaction.eventsEligible?string}, - <#if nextaction.asOf??>"asOf": "${nextaction.asOf}", - <#if nextaction.startedAt??>"startedAt": "${nextaction.startedAt}", - <#if nextaction.startedBy??>"startedBy": "${nextaction.startedBy}", - <#if nextaction.startedByFirstName??>"startedByFirstName": "${nextaction.startedByFirstName}", - <#if nextaction.startedByLastName??>"startedByLastName": "${nextaction.startedByLastName}", - <#if nextaction.completedAt??>"completedAt": "${nextaction.completedAt}", - <#if nextaction.completedBy??>"completedBy": "${nextaction.completedBy}", - <#if nextaction.completedByFirstName??>"completedByFirstName": "${nextaction.completedByFirstName}", - <#if nextaction.completedByLastName??>"completedByLastName": "${nextaction.completedByLastName}", - "events": - [ - <#list nextaction.events as event> - { - "name": "${event.name}", - "label": "${event.label}", - "complete": ${event.complete?string}, - <#if event.completedAt??>"completedAt": "${event.completedAt}", - <#if event.completedBy??>"completedBy": "${event.completedBy}", - <#if event.completedByFirstName??>"completedByFirstName": "${event.completedByFirstName}", - <#if event.completedByLastName??>"completedByLastName": "${event.completedByLastName}", - "automatic": ${event.automatic?string} - }<#if event_has_next>, - - ] - - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + <#if nextaction.notFound?? && nextaction.notFound> + "notFound": ${nextaction.notFound?string}, + "message": "${nextaction.message}" + <#else> + "url": "${nextaction.url}", + "name": "${nextaction.name}", + "label": "${nextaction.label}", + "eventsEligible": ${nextaction.eventsEligible?string}, + <#if nextaction.asOf??>"asOf": "${nextaction.asOf}", + <#if nextaction.startedAt??>"startedAt": "${nextaction.startedAt}", + <#if nextaction.startedBy??>"startedBy": "${nextaction.startedBy}", + <#if nextaction.startedByFirstName??>"startedByFirstName": "${nextaction.startedByFirstName}", + <#if nextaction.startedByLastName??>"startedByLastName": "${nextaction.startedByLastName}", + <#if nextaction.completedAt??>"completedAt": "${nextaction.completedAt}", + <#if nextaction.completedBy??>"completedBy": "${nextaction.completedBy}", + <#if nextaction.completedByFirstName??>"completedByFirstName": "${nextaction.completedByFirstName}", + <#if nextaction.completedByLastName??>"completedByLastName": "${nextaction.completedByLastName}", + "events": + [ + <#list nextaction.events as event> + { + "name": "${event.name}", + "label": "${event.label}", + "complete": ${event.complete?string}, + <#if event.completedAt??>"completedAt": "${event.completedAt}", + <#if event.completedBy??>"completedBy": "${event.completedBy}", + <#if event.completedByFirstName??>"completedByFirstName": "${event.completedByFirstName}", + <#if event.completedByLastName??>"completedByLastName": "${event.completedByLastName}", + "automatic": ${event.automatic?string} + }<#if event_has_next>, + + ] + + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml index c1c99e8dce..f268f3d88f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.desc.xml @@ -1,9 +1,9 @@ - - Disposition Properties - Returns a list of the disposition properties based on the context provided. - /api/rma/dispositionproperties?recordlevel={recordlevel}&dispositionaction={dispositionaction} - argument - user - required - internal + + Disposition Properties + Returns a list of the disposition properties based on the context provided. + /api/rma/dispositionproperties?recordlevel={recordlevel}&dispositionaction={dispositionaction} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl index ad48c925ed..962d4157c4 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionproperties.get.json.ftl @@ -1,40 +1,40 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "data" : - { - "properties": - [ - <#list properties as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - } -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "data" : + { + "properties": + [ + <#list properties as item> + { + "label": "${item.label}", + "value": "${item.value}" + }<#if item_has_next>, + + ] + } +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.desc.xml index cc21bc2ec4..3ea48069e5 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.desc.xml @@ -1,9 +1,9 @@ - - Get Dispositon Schedule - Returns Disposition Schedule - /api/node/{store_type}/{store_id}/{id}/dispositionschedule?inherited={inherited?} - argument - user - required - internal + + Get Dispositon Schedule + Returns Disposition Schedule + /api/node/{store_type}/{store_id}/{id}/dispositionschedule?inherited={inherited?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.json.ftl index c73f5dd294..d23638de3a 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dispositionschedule.get.json.ftl @@ -1,55 +1,55 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> - -<@scheduleJSON schedule=schedule/> - -<#macro scheduleJSON schedule> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "url": "${schedule.url}", - "nodeRef": "${schedule.nodeRef}", - <#if schedule.authority??>"authority": "${schedule.authority}", - <#if schedule.instructions??>"instructions": "${schedule.instructions}", - "unpublishedUpdates" : ${schedule.unpublishedUpdates?string}, - "publishInProgress" : ${schedule.publishInProgress?string}, - "recordLevelDisposition": ${schedule.recordLevelDisposition?string}, - "canStepsBeRemoved": ${schedule.canStepsBeRemoved?string}, - "actionsUrl": "${schedule.actionsUrl}", - "actions": - [ - <#list schedule.actions as action> - <@actionDefLib.actionJSON action=action/> - <#if action_has_next>, - - ] - } -} - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "dispositionactiondefinition.lib.ftl" as actionDefLib/> + +<@scheduleJSON schedule=schedule/> + +<#macro scheduleJSON schedule> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "url": "${schedule.url}", + "nodeRef": "${schedule.nodeRef}", + <#if schedule.authority??>"authority": "${schedule.authority}", + <#if schedule.instructions??>"instructions": "${schedule.instructions}", + "unpublishedUpdates" : ${schedule.unpublishedUpdates?string}, + "publishInProgress" : ${schedule.publishInProgress?string}, + "recordLevelDisposition": ${schedule.recordLevelDisposition?string}, + "canStepsBeRemoved": ${schedule.canStepsBeRemoved?string}, + "actionsUrl": "${schedule.actionsUrl}", + "actions": + [ + <#list schedule.actions as action> + <@actionDefLib.actionJSON action=action/> + <#if action_has_next>, + + ] + } +} + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.desc.xml index 44aab054dc..bb5f689ba8 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.desc.xml @@ -1,12 +1,12 @@ - - Records Management DOD 5015 Custom Types - - ]]> - - /api/rma/admin/dodcustomtypes - - user - required - internal + + Records Management DOD 5015 Custom Types + + ]]> + + /api/rma/admin/dodcustomtypes + + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.json.ftl index 721d092cf2..bea8499e38 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/dodcustomtypes.get.json.ftl @@ -1,42 +1,42 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "dodCustomTypes": - [ - <#list dodCustomTypes as aspDef> - { - "name": "${aspDef.name.prefixString}", - "title": "${aspDef.title!""}" - }<#if aspDef_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "dodCustomTypes": + [ + <#list dodCustomTypes as aspDef> + { + "name": "${aspDef.name.prefixString}", + "title": "${aspDef.title!""}" + }<#if aspDef_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.desc.xml index a9f50f435c..4599afcb45 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.desc.xml @@ -1,16 +1,16 @@ - - Records Management Export - - The body of the post should be in the form
- {
-    "nodeRefs" : array of nodeRefs to export
- }
- ]]> -
- /api/rma/admin/export - argument - user - required - internal + + Records Management Export + + The body of the post should be in the form
+ {
+    "nodeRefs" : array of nodeRefs to export
+ }
+ ]]> +
+ /api/rma/admin/export + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.html.status.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.html.status.ftl index e38cd96fbf..37ea3fd216 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.html.status.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/export.post.html.status.ftl @@ -1,45 +1,45 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> - - - Export failure - - -<#if (args.failureCallbackFunction?exists)> - - - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> + + + Export failure + + +<#if (args.failureCallbackFunction?exists)> + + + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.desc.xml index f4ad55aeda..4f99e04187 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.desc.xml @@ -1,13 +1,13 @@ - - Get Fileplan Report - Returns STATUS_OK (200) - ]]> - - /api/node/{store_type}/{store_id}/{id}/fileplanreport - - user - required - draft_public_api + + Get Fileplan Report + Returns STATUS_OK (200) + ]]> + + /api/node/{store_type}/{store_id}/{id}/fileplanreport + + user + required + draft_public_api \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.js index 0f30240c8d..eca8a8ef33 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.js @@ -1,222 +1,222 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Main entry point for this webscript. - * Builds a nodeRef from the url and creates a records series, category and/or folder - * template model depending on what nodeRef that has been given. - * - * @method main - */ -function main() -{ - // Get the node from the URL - var pathSegments = url.match.split("/"); - var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/")); - var node = search.findNode(pathSegments[2], reference); - - // 404 if the node is not found - if (node == null) - { - status.setCode(status.STATUS_NOT_FOUND, "The node could not be found"); - return; - } - - // Get rid of the model URL to enable support for both older DOD5015 and new recordsmanagement model namespaces - var nodeType = node.type.split("}")[1]; - - // Get the record series, categories and/or folders - if(nodeType == "filePlan") - { - var recordSeries = [], - seriesNodes = node.children, - seriesNode; - for (var rsi = 0, rsl = seriesNodes.length; rsi < rsl; rsi++) - { - var seriesNode = seriesNodes[rsi]; - if(seriesNode.type.split("}")[1] == "recordSeries") - { - recordSeries.push(getRecordSeries(seriesNode)); - } - } - recordSeries.sort(sortByName); - model.recordSeries = recordSeries; - } - else if(nodeType == "recordSeries") - { - var recordSeries = []; - recordSeries.push(getRecordSeries(node)); - model.recordSeries = recordSeries; - } - else if(nodeType == "recordCategory") - { - var recordCategories = []; - recordCategories.push(getRecordCategory(node, "/" + node.parent.name + "/")); - model.recordCategories = recordCategories; - } - else if(nodeType == "recordFolder") - { - var recordFolders = []; - var recordCategory = node.parent; - recordFolders.push(getRecordFolder(node, "" + recordCategory.parent.name + "/" + recordCategory.name + "/")); - model.recordFolders = recordFolders; - } else - { - // Throw an error if we don't recognise the node type - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Unrecognised node type: " + node.type) - return; - } -} - -/** - * Sort helper function for objects with names - * - * @method sortByName - * @param obj1 - * @param obj2 - */ -function sortByName(obj1, obj2) -{ - return (obj1.name > obj2.name) ? 1 : (obj1.name < obj2.name) ? -1 : 0; -} - -/** - * Takes a ScriptNode and builds a Record Series template model from it - * - * @method getRecordSeries - * @param seriesNode {ScriptNode} A ScriptNode of type "rma:recordSeries" - */ -function getRecordSeries(seriesNode) -{ - // Create Record Series object - var recordSerie = { - parentPath: "/", - name: seriesNode.name, - identifier: seriesNode.properties["rma:identifier"], - description: seriesNode.properties["description"] - }; - - // Find all Record Categories - var recordCategories = [], - categoryNodes = seriesNode.children, - categoryNode; - for (var rci = 0, rcl = categoryNodes.length; rci < rcl; rci++) - { - categoryNode = categoryNodes[rci]; - if(categoryNode.type == "{http://www.alfresco.org/model/dod5015/1.0}recordCategory") - { - // Create and add Record Category object - recordCategories.push(getRecordCategory(categoryNode, "/" + seriesNode.name + "/")); - } - } - recordCategories.sort(sortByName); - recordSerie.recordCategories = recordCategories; - - // Return Record Series - return recordSerie; -} - -/** - * Takes a ScriptNode and builds a Record Category template model from it - * - * @method getRecordCategory - * @param categoryNode {ScriptNode} A ScriptNode of type "rma:recordCategory" - * @param parentPath {string} The file path starting from the top of the fileplan - */ -function getRecordCategory(categoryNode, parentPath) -{ - // Create Record Category object - var recordCategory = { - parentPath: parentPath, - name: categoryNode.name, - identifier: categoryNode.properties["rma:identifier"], - vitalRecordIndicator: categoryNode.properties["vitalRecordIndicator"], - dispositionAuthority: categoryNode.properties["dispositionAuthority"], - recordFolders: [], - dispositionActions: [] - }; - - // Find all Record Folders & Disposition information - var recordFolders = [], - dispositionActions = [], - categoryChildren = categoryNode.children, - categoryChild, - dispScheduleChildren, - dispScheduleChild; - for (var cci = 0, ccil = categoryChildren.length; cci < ccil; cci++) - { - categoryChild = categoryChildren[cci] - if (categoryChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}recordFolder") - { - // Create and add Record Folder object - recordFolders.push(getRecordFolder(categoryChild, parentPath + categoryNode.name + "/")); - } - else if (categoryChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionSchedule") - { - // Get Disposition authority - recordCategory.dispositionAuthority = categoryChild.properties["rma:dispositionAuthority"]; - dispScheduleChildren = categoryChild.children; - for (var dsi = 0, dsil = dispScheduleChildren.length; dsi < dsil; dsi++) - { - dispScheduleChild = dispScheduleChildren[dsi]; - if (dispScheduleChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionActionDefinition") - { - // Add Disposition Action description - dispositionActions.push({ - dispositionDescription: dispScheduleChild.properties["rma:dispositionDescription"] - }); - } - } - } - } - - // Add Record Category to the list - recordFolders.sort(sortByName); - recordCategory.recordFolders = recordFolders; - recordCategory.dispositionActions = dispositionActions; - return recordCategory; -} - -/** - * Takes a ScriptNode and builds a Record Category template model from it - * - * @method getRecordFolder - * @param recordFolder {ScriptNode} A ScriptNode of type "rma:recordrecordFolder" - * @param parentPath {string} The file path starting from the top of the fileplan - */ -function getRecordFolder(recordFolder, parentPath) -{ - return { - parentPath: parentPath, - name: recordFolder.name, - identifier: recordFolder.properties["rma:identifier"], - vitalRecordIndicator: recordFolder.properties["vitalRecordIndicator"] - }; -} - -// Start webscript -main(); - +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Main entry point for this webscript. + * Builds a nodeRef from the url and creates a records series, category and/or folder + * template model depending on what nodeRef that has been given. + * + * @method main + */ +function main() +{ + // Get the node from the URL + var pathSegments = url.match.split("/"); + var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/")); + var node = search.findNode(pathSegments[2], reference); + + // 404 if the node is not found + if (node == null) + { + status.setCode(status.STATUS_NOT_FOUND, "The node could not be found"); + return; + } + + // Get rid of the model URL to enable support for both older DOD5015 and new recordsmanagement model namespaces + var nodeType = node.type.split("}")[1]; + + // Get the record series, categories and/or folders + if(nodeType == "filePlan") + { + var recordSeries = [], + seriesNodes = node.children, + seriesNode; + for (var rsi = 0, rsl = seriesNodes.length; rsi < rsl; rsi++) + { + var seriesNode = seriesNodes[rsi]; + if(seriesNode.type.split("}")[1] == "recordSeries") + { + recordSeries.push(getRecordSeries(seriesNode)); + } + } + recordSeries.sort(sortByName); + model.recordSeries = recordSeries; + } + else if(nodeType == "recordSeries") + { + var recordSeries = []; + recordSeries.push(getRecordSeries(node)); + model.recordSeries = recordSeries; + } + else if(nodeType == "recordCategory") + { + var recordCategories = []; + recordCategories.push(getRecordCategory(node, "/" + node.parent.name + "/")); + model.recordCategories = recordCategories; + } + else if(nodeType == "recordFolder") + { + var recordFolders = []; + var recordCategory = node.parent; + recordFolders.push(getRecordFolder(node, "" + recordCategory.parent.name + "/" + recordCategory.name + "/")); + model.recordFolders = recordFolders; + } else + { + // Throw an error if we don't recognise the node type + status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Unrecognised node type: " + node.type) + return; + } +} + +/** + * Sort helper function for objects with names + * + * @method sortByName + * @param obj1 + * @param obj2 + */ +function sortByName(obj1, obj2) +{ + return (obj1.name > obj2.name) ? 1 : (obj1.name < obj2.name) ? -1 : 0; +} + +/** + * Takes a ScriptNode and builds a Record Series template model from it + * + * @method getRecordSeries + * @param seriesNode {ScriptNode} A ScriptNode of type "rma:recordSeries" + */ +function getRecordSeries(seriesNode) +{ + // Create Record Series object + var recordSerie = { + parentPath: "/", + name: seriesNode.name, + identifier: seriesNode.properties["rma:identifier"], + description: seriesNode.properties["description"] + }; + + // Find all Record Categories + var recordCategories = [], + categoryNodes = seriesNode.children, + categoryNode; + for (var rci = 0, rcl = categoryNodes.length; rci < rcl; rci++) + { + categoryNode = categoryNodes[rci]; + if(categoryNode.type == "{http://www.alfresco.org/model/dod5015/1.0}recordCategory") + { + // Create and add Record Category object + recordCategories.push(getRecordCategory(categoryNode, "/" + seriesNode.name + "/")); + } + } + recordCategories.sort(sortByName); + recordSerie.recordCategories = recordCategories; + + // Return Record Series + return recordSerie; +} + +/** + * Takes a ScriptNode and builds a Record Category template model from it + * + * @method getRecordCategory + * @param categoryNode {ScriptNode} A ScriptNode of type "rma:recordCategory" + * @param parentPath {string} The file path starting from the top of the fileplan + */ +function getRecordCategory(categoryNode, parentPath) +{ + // Create Record Category object + var recordCategory = { + parentPath: parentPath, + name: categoryNode.name, + identifier: categoryNode.properties["rma:identifier"], + vitalRecordIndicator: categoryNode.properties["vitalRecordIndicator"], + dispositionAuthority: categoryNode.properties["dispositionAuthority"], + recordFolders: [], + dispositionActions: [] + }; + + // Find all Record Folders & Disposition information + var recordFolders = [], + dispositionActions = [], + categoryChildren = categoryNode.children, + categoryChild, + dispScheduleChildren, + dispScheduleChild; + for (var cci = 0, ccil = categoryChildren.length; cci < ccil; cci++) + { + categoryChild = categoryChildren[cci] + if (categoryChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}recordFolder") + { + // Create and add Record Folder object + recordFolders.push(getRecordFolder(categoryChild, parentPath + categoryNode.name + "/")); + } + else if (categoryChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionSchedule") + { + // Get Disposition authority + recordCategory.dispositionAuthority = categoryChild.properties["rma:dispositionAuthority"]; + dispScheduleChildren = categoryChild.children; + for (var dsi = 0, dsil = dispScheduleChildren.length; dsi < dsil; dsi++) + { + dispScheduleChild = dispScheduleChildren[dsi]; + if (dispScheduleChild.type == "{http://www.alfresco.org/model/recordsmanagement/1.0}dispositionActionDefinition") + { + // Add Disposition Action description + dispositionActions.push({ + dispositionDescription: dispScheduleChild.properties["rma:dispositionDescription"] + }); + } + } + } + } + + // Add Record Category to the list + recordFolders.sort(sortByName); + recordCategory.recordFolders = recordFolders; + recordCategory.dispositionActions = dispositionActions; + return recordCategory; +} + +/** + * Takes a ScriptNode and builds a Record Category template model from it + * + * @method getRecordFolder + * @param recordFolder {ScriptNode} A ScriptNode of type "rma:recordrecordFolder" + * @param parentPath {string} The file path starting from the top of the fileplan + */ +function getRecordFolder(recordFolder, parentPath) +{ + return { + parentPath: parentPath, + name: recordFolder.name, + identifier: recordFolder.properties["rma:identifier"], + vitalRecordIndicator: recordFolder.properties["vitalRecordIndicator"] + }; +} + +// Start webscript +main(); + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.json.ftl index 12de067cc2..8a9c610664 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.get.json.ftl @@ -1,45 +1,45 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "fileplanreport.lib.ftl" as reportLib/> -<#macro dateFormat date>${date?string("dd MMM yyyy HH:mm:ss 'GMT'Z '('zzz')'")} -<#escape x as jsonUtils.encodeJSONString(x)> -{ - data: - { - "firstName": <#if person.properties.firstName??>"${person.properties.firstName}"<#else>null, - "lastName": <#if person.properties.lastName??>"${person.properties.lastName}"<#else>null, - <#if (recordSeries??)> - "recordSeries": <@reportLib.recordSeriesJSON recordSeries=recordSeries/>, - <#elseif (recordCategories??)> - "recordCategories": <@reportLib.recordCategoriesJSON recordCategories=recordCategories/>, - <#elseif (recordFolders??)> - "recordFolders": <@reportLib.recordFoldersJSON recordFolders=recordFolders/>, - - "printDate": "<@dateFormat date=date/>" - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "fileplanreport.lib.ftl" as reportLib/> +<#macro dateFormat date>${date?string("dd MMM yyyy HH:mm:ss 'GMT'Z '('zzz')'")} +<#escape x as jsonUtils.encodeJSONString(x)> +{ + data: + { + "firstName": <#if person.properties.firstName??>"${person.properties.firstName}"<#else>null, + "lastName": <#if person.properties.lastName??>"${person.properties.lastName}"<#else>null, + <#if (recordSeries??)> + "recordSeries": <@reportLib.recordSeriesJSON recordSeries=recordSeries/>, + <#elseif (recordCategories??)> + "recordCategories": <@reportLib.recordCategoriesJSON recordCategories=recordCategories/>, + <#elseif (recordFolders??)> + "recordFolders": <@reportLib.recordFoldersJSON recordFolders=recordFolders/>, + + "printDate": "<@dateFormat date=date/>" + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.lib.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.lib.ftl index 1345f068cf..f5d8a4976f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.lib.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/fileplanreport.lib.ftl @@ -1,72 +1,72 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#macro recordSeriesJSON recordSeries> -<#escape x as jsonUtils.encodeJSONString(x)> - [<#list recordSeries as recordSerie> - { - "parentPath": "${recordSerie.parentPath}", - "name": "${recordSerie.name}", - "identifier": "${recordSerie.identifier}", - "description": "${recordSerie.description}", - "recordCategories": <@recordCategoriesJSON recordCategories=recordSerie.recordCategories/> - }<#if (recordSerie_has_next)>, - ] - - - -<#macro recordCategoriesJSON recordCategories> -<#escape x as jsonUtils.encodeJSONString(x)> - [<#list recordCategories as recordCategory> - { - "parentPath": "${recordCategory.parentPath}", - "name": "${recordCategory.name}", - "identifier": "${recordCategory.identifier}", - <#if (recordCategory.vitalRecordIndicator??)>"vitalRecordIndicator": ${recordCategory.vitalRecordIndicator?string}, - <#if (recordCategory.dispositionAuthority??)>"dispositionAuthority": "${recordCategory.dispositionAuthority}", - "recordFolders": <@recordFoldersJSON recordFolders=recordCategory.recordFolders/>, - "dispositionActions": [<#list recordCategory.dispositionActions as dispositionAction> - { - "dispositionDescription": "${dispositionAction.dispositionDescription!""}" - }<#if (dispositionAction_has_next)>, - ] - }<#if (recordCategory_has_next)>, - ] - - - -<#macro recordFoldersJSON recordFolders> -<#escape x as jsonUtils.encodeJSONString(x)> - [<#list recordFolders as recordFolder> - { - "parentPath": "${recordFolder.parentPath}", - "name": "${recordFolder.name}", - "identifier": "${recordFolder.identifier}", - <#if (recordFolder.vitalRecordIndicator??)>"vitalRecordIndicator": "${recordFolder.vitalRecordIndicator?string}" - }<#if (recordFolder_has_next)>, - ] - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#macro recordSeriesJSON recordSeries> +<#escape x as jsonUtils.encodeJSONString(x)> + [<#list recordSeries as recordSerie> + { + "parentPath": "${recordSerie.parentPath}", + "name": "${recordSerie.name}", + "identifier": "${recordSerie.identifier}", + "description": "${recordSerie.description}", + "recordCategories": <@recordCategoriesJSON recordCategories=recordSerie.recordCategories/> + }<#if (recordSerie_has_next)>, + ] + + + +<#macro recordCategoriesJSON recordCategories> +<#escape x as jsonUtils.encodeJSONString(x)> + [<#list recordCategories as recordCategory> + { + "parentPath": "${recordCategory.parentPath}", + "name": "${recordCategory.name}", + "identifier": "${recordCategory.identifier}", + <#if (recordCategory.vitalRecordIndicator??)>"vitalRecordIndicator": ${recordCategory.vitalRecordIndicator?string}, + <#if (recordCategory.dispositionAuthority??)>"dispositionAuthority": "${recordCategory.dispositionAuthority}", + "recordFolders": <@recordFoldersJSON recordFolders=recordCategory.recordFolders/>, + "dispositionActions": [<#list recordCategory.dispositionActions as dispositionAction> + { + "dispositionDescription": "${dispositionAction.dispositionDescription!""}" + }<#if (dispositionAction_has_next)>, + ] + }<#if (recordCategory_has_next)>, + ] + + + +<#macro recordFoldersJSON recordFolders> +<#escape x as jsonUtils.encodeJSONString(x)> + [<#list recordFolders as recordFolder> + { + "parentPath": "${recordFolder.parentPath}", + "name": "${recordFolder.name}", + "identifier": "${recordFolder.identifier}", + <#if (recordFolder.vitalRecordIndicator??)>"vitalRecordIndicator": "${recordFolder.vitalRecordIndicator?string}" + }<#if (recordFolder_has_next)>, + ] + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml index 10b936385b..c58f296207 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.desc.xml @@ -1,17 +1,17 @@ - - Adds item(s) to the hold(s) - - The body of the post should be in the form
- {
-    "nodeRefs" : array of nodeRefs for item(s) (record(s) / record folder(s)),
-    "holds" : array of nodeRefs for the hold(s)
- }
- ]]> -
- /api/rma/holds - argument - user - required - internal + + Adds item(s) to the hold(s) + + The body of the post should be in the form
+ {
+    "nodeRefs" : array of nodeRefs for item(s) (record(s) / record folder(s)),
+    "holds" : array of nodeRefs for the hold(s)
+ }
+ ]]> +
+ /api/rma/holds + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.json.ftl index 05d341e16b..b7ba61347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.post.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml index 6f18a336fc..13edad40eb 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.desc.xml @@ -1,17 +1,17 @@ - - Removes item(s) from the hold(s) - - The body of the put should be in the form
- {
-    "nodeRefs" : array of nodeRefs for the item(s) (record(s) / record folder(s)),
-    "holds" : array of nodeRefs for the hold(s)
- }
- ]]> -
- /api/rma/holds - argument - user - required - internal + + Removes item(s) from the hold(s) + + The body of the put should be in the form
+ {
+    "nodeRefs" : array of nodeRefs for the item(s) (record(s) / record folder(s)),
+    "holds" : array of nodeRefs for the hold(s)
+ }
+ ]]> +
+ /api/rma/holds + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.json.ftl index 05d341e16b..b7ba61347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/hold.put.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.desc.xml index 4f3dcbf566..5a20fceff7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.desc.xml @@ -1,20 +1,20 @@ - - Gets the list of the hold(s) - - - /api/rma/{store_type}/{store_id}/{id}/holds?itemNodeRef={itemNodeRef?}&includedInHold={includedInHold?}&fileOnly={fileOnly?} - /api/rma/holds?itemNodeRef={itemNodeRef?} - argument - user - required - internal + + Gets the list of the hold(s) + + + /api/rma/{store_type}/{store_id}/{id}/holds?itemNodeRef={itemNodeRef?}&includedInHold={includedInHold?}&fileOnly={fileOnly?} + /api/rma/holds?itemNodeRef={itemNodeRef?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl index 5249a4c798..79992ccfaf 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/holds.get.json.ftl @@ -1,42 +1,42 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "holds": - [ - <#list holds as hold> - { - "name": "${hold.name}", - "nodeRef": "${hold.nodeRef}" - }<#if hold_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "holds": + [ + <#list holds as hold> + { + "name": "${hold.name}", + "nodeRef": "${hold.nodeRef}" + }<#if hold_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.desc.xml index bb2c537379..6930926ff7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.desc.xml @@ -1,17 +1,17 @@ - - Records Management Import - - The body of the post should be multipart/form-data and contain the following fields.
-
    -
  • destination: array of nodeRefs to export
  • -
  • archive: array of nodeRefs to export
  • -
- ]]> -
- /api/rma/admin/import - - user - required - internal + + Records Management Import + + The body of the post should be multipart/form-data and contain the following fields.
+
    +
  • destination: array of nodeRefs to export
  • +
  • archive: array of nodeRefs to export
  • +
+ ]]> +
+ /api/rma/admin/import + + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.html.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.html.ftl index c44c1127f0..11c898ff7e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.html.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.html.ftl @@ -1,40 +1,40 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> - - - Upload success - - -<#if (args.successCallback?exists)> - - - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> + + + Upload success + + +<#if (args.successCallback?exists)> + + + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.json.ftl index 84b7403b56..7e84ce88d7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/import.post.json.ftl @@ -1,31 +1,31 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "success": ${success?string} -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "success": ${success?string} +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.desc.xml index 9b216d0058..16eb309e1f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.desc.xml @@ -1,9 +1,9 @@ - - List Of Values - Returns lists of items used by the Records Management service - /api/rma/admin/listofvalues - argument - user - required - internal + + List Of Values + Returns lists of items used by the Records Management service + /api/rma/admin/listofvalues + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.json.ftl index b5dc00d2b2..6b6afc1dc6 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.get.json.ftl @@ -1,28 +1,28 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "listofvalues.lib.ftl" as listsLib/> -<@listsLib.listsJSON lists=lists/> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "listofvalues.lib.ftl" as listsLib/> +<@listsLib.listsJSON lists=lists/> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.lib.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.lib.ftl index 7cc90b64de..7612298345 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.lib.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/listofvalues.lib.ftl @@ -1,101 +1,101 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#macro listsJSON lists> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "dispositionActions": - { - "url": "${lists.dispositionActions.url}", - "items": - [ - <#list lists.dispositionActions.items as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - }, - "events": - { - "url": "${lists.events.url}", - "items": - [ - <#list lists.events.items as item> - { - "label": "${item.label}", - "value": "${item.value}", - "automatic": ${item.automatic?string} - }<#if item_has_next>, - - ] - }, - "periodTypes": - { - "url": "${lists.periodTypes.url}", - "items": - [ - <#list lists.periodTypes.items as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - }, - "periodProperties": - { - "url": "${lists.periodProperties.url}", - "items": - [ - <#list lists.periodProperties.items as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - }, - "auditEvents": - { - "url": "${lists.auditEvents.url}", - "items": - [ - <#list lists.auditEvents.items as item> - { - "label": "${item.label}", - "value": "${item.value}" - }<#if item_has_next>, - - ] - } - } -} - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#macro listsJSON lists> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "dispositionActions": + { + "url": "${lists.dispositionActions.url}", + "items": + [ + <#list lists.dispositionActions.items as item> + { + "label": "${item.label}", + "value": "${item.value}" + }<#if item_has_next>, + + ] + }, + "events": + { + "url": "${lists.events.url}", + "items": + [ + <#list lists.events.items as item> + { + "label": "${item.label}", + "value": "${item.value}", + "automatic": ${item.automatic?string} + }<#if item_has_next>, + + ] + }, + "periodTypes": + { + "url": "${lists.periodTypes.url}", + "items": + [ + <#list lists.periodTypes.items as item> + { + "label": "${item.label}", + "value": "${item.value}" + }<#if item_has_next>, + + ] + }, + "periodProperties": + { + "url": "${lists.periodProperties.url}", + "items": + [ + <#list lists.periodProperties.items as item> + { + "label": "${item.label}", + "value": "${item.value}" + }<#if item_has_next>, + + ] + }, + "auditEvents": + { + "url": "${lists.auditEvents.url}", + "items": + [ + <#list lists.auditEvents.items as item> + { + "label": "${item.label}", + "value": "${item.value}" + }<#if item_has_next>, + + ] + } + } +} + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.desc.xml index e505fbc91a..ca9f61b006 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.desc.xml @@ -1,12 +1,12 @@ - - Record Metadata Aspects - - - /api/rma/recordmetadataaspects?noderef={?nodeRef} - - user - required - internal + + Record Metadata Aspects + + + /api/rma/recordmetadataaspects?noderef={?nodeRef} + + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.json.ftl index 3130d20dbf..9bab288bbd 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/recordmetadataaspects.get.json.ftl @@ -1,43 +1,43 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "recordMetaDataAspects": - [ - <#list aspects as aspect> - { - "id" : "${aspect.id}", - "value" : "${aspect.value}" - } - <#if aspect_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "recordMetaDataAspects": + [ + <#list aspects as aspect> + { + "id" : "${aspect.id}", + "value" : "${aspect.value}" + } + <#if aspect_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml index 40b778c42e..2b16d435ac 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml @@ -1,8 +1,8 @@ - - Delete records management relationship - Deletes the specified relationship. - /api/node/{store_type}/{store_id}/{id}/targetnode/{target_store_type}/{target_store_id}/{target_id}/uniqueName/{uniqueName} - - user - required + + Delete records management relationship + Deletes the specified relationship. + /api/node/{store_type}/{store_id}/{id}/targetnode/{target_store_type}/{target_store_id}/{target_id}/uniqueName/{uniqueName} + + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl index 516215782b..37caf4c02d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl @@ -1,29 +1,29 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "success": ${success?string} -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "success": ${success?string} +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml index 6147dfe711..4d34693449 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml @@ -1,8 +1,8 @@ - - Records Management Relationship Labels - Gets the list of existing relationship labels. - /api/rma/admin/relationshiplabels - - user - required + + Records Management Relationship Labels + Gets the list of existing relationship labels. + /api/rma/admin/relationshiplabels + + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl index ef96d85d3e..c2f0797e4c 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl @@ -1,42 +1,42 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "relationshipLabels": - [ - <#list relationshipLabels as relationshipLabel> - { - "label": "${relationshipLabel.label}", - "uniqueName": "${relationshipLabel.uniqueName}" - }<#if relationshipLabel_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "relationshipLabels": + [ + <#list relationshipLabels as relationshipLabel> + { + "label": "${relationshipLabel.label}", + "uniqueName": "${relationshipLabel.uniqueName}" + }<#if relationshipLabel_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml index a31c20131d..ea306912b1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml @@ -1,8 +1,8 @@ - - Records Management Relationships - Gets the list of existing relationships on the specified node. - /api/node/{store_type}/{store_id}/{id}/relationships - - user - required + + Records Management Relationships + Gets the list of existing relationships on the specified node. + /api/node/{store_type}/{store_id}/{id}/relationships + + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl index 3b8dea0098..ae7db1e0cb 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl @@ -1,41 +1,41 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "items": - [ - <#list relationships as relationship> - { - "node": <#noescape>${relationship} - }<#if relationship_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "items": + [ + <#list relationships as relationship> + { + "node": <#noescape>${relationship} + }<#if relationship_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.desc.xml index f09d5691cc..7f4a7f1dd6 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.desc.xml @@ -1,19 +1,19 @@ - - Records Management Action Execution - - The body of the post should be in the form
- {
-    "nodeRef" : nodeRef for target Record,
-    "nodeRefs" : array of nodeRef for target Records (either this or "nodeRef" should be present),
-    "name" : actionName,
-    "params" : {actionParameters}
- }
- ]]> -
- /api/rma/actions/ExecutionQueue - - user - required - internal + + Records Management Action Execution + + The body of the post should be in the form
+ {
+    "nodeRef" : nodeRef for target Record,
+    "nodeRefs" : array of nodeRef for target Records (either this or "nodeRef" should be present),
+    "name" : actionName,
+    "params" : {actionParameters}
+ }
+ ]]> +
+ /api/rma/actions/ExecutionQueue + + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.json.ftl index 6a2f1238a5..5fc74ae802 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmaction.post.json.ftl @@ -1,40 +1,40 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "message" : "${message}" -<#if result?exists> - ,"result" : "${result?string}" - -<#if results?exists> - ,"results" : - { - <#list results?keys as prop> - "${prop}" : "${results[prop]}"<#if prop_has_next>, - - } - -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "message" : "${message}" +<#if result?exists> + ,"result" : "${result?string}" + +<#if results?exists> + ,"results" : + { + <#list results?keys as prop> + "${prop}" : "${results[prop]}"<#if prop_has_next>, + + } + +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.desc.xml index 8cf91b17a0..699de3dcde 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.desc.xml @@ -1,9 +1,9 @@ - - Clears Records Management Audit Log - Clears the Records Management audit log - /api/rma/admin/rmauditlog - argument - user - required - internal + + Clears Records Management Audit Log + Clears the Records Management audit log + /api/rma/admin/rmauditlog + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.json.ftl index 88cf9b85d8..819b192128 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.delete.json.ftl @@ -1,28 +1,28 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmauditlog.lib.ftl" as auditLib/> -<@auditLib.auditStatusJSON auditstatus=auditstatus/> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmauditlog.lib.ftl" as auditLib/> +<@auditLib.auditStatusJSON auditstatus=auditstatus/> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.get.desc.xml index 0f76ff2953..3553d5b79f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.get.desc.xml @@ -1,22 +1,22 @@ - - Records Management Audit Log - The following parameters can also be passed: -
    -
  • size: Maximum number of log entries to return
  • -
  • user: Only return log entries by the specified user
  • -
  • event: Only return log entries matching this event
  • -
  • from: Only return log entries after the specified date, date should be in yyyy-MM-dd format
  • -
  • to: Only return log entries before the specified date, date should be in yyyy-MM-dd format
  • -
  • export: Set this to 'true' to force the browser to display the Save As dialog
  • -
- ]]> -
- /api/rma/admin/rmauditlog - /api/node/{store_type}/{store_id}/{id}/rmauditlog - argument - user - required - internal + + Records Management Audit Log + The following parameters can also be passed: +
    +
  • size: Maximum number of log entries to return
  • +
  • user: Only return log entries by the specified user
  • +
  • event: Only return log entries matching this event
  • +
  • from: Only return log entries after the specified date, date should be in yyyy-MM-dd format
  • +
  • to: Only return log entries before the specified date, date should be in yyyy-MM-dd format
  • +
  • export: Set this to 'true' to force the browser to display the Save As dialog
  • +
+ ]]> +
+ /api/rma/admin/rmauditlog + /api/node/{store_type}/{store_id}/{id}/rmauditlog + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.lib.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.lib.ftl index 14cdb81c60..b8fd0e9b78 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.lib.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.lib.ftl @@ -1,38 +1,38 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#macro auditStatusJSON auditstatus> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "enabled": ${auditstatus.enabled?string}, - "started": "${auditstatus.started}", - "stopped": "${auditstatus.stopped}" - } -} - - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#macro auditStatusJSON auditstatus> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "enabled": ${auditstatus.enabled?string}, + "started": "${auditstatus.started}", + "stopped": "${auditstatus.stopped}" + } +} + + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.post.desc.xml index d0ddd80ac3..0e70b5a335 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.post.desc.xml @@ -1,23 +1,23 @@ - - Files a Records Management audit log as a record - - A JSON structure is expected as follows:
- {
-    "destination" : NodeRef of record folder to file the audit log in
-    "size" : Maximum number of log entries to return
-    "user" : Only return log entries by the specified user
-    "event" : Only return log entries matching this event
-    "from" : Only return log entries after the specified date, date should be in yyyy-MM-dd format
-    "to" : Only return log entries before the specified date, date should be in yyyy-MM-dd format
- }
- ]]> -
- /api/rma/admin/rmauditlog - /api/node/{store_type}/{store_id}/{id}/rmauditlog - argument - user - required - internal + + Files a Records Management audit log as a record + + A JSON structure is expected as follows:
+ {
+    "destination" : NodeRef of record folder to file the audit log in
+    "size" : Maximum number of log entries to return
+    "user" : Only return log entries by the specified user
+    "event" : Only return log entries matching this event
+    "from" : Only return log entries after the specified date, date should be in yyyy-MM-dd format
+    "to" : Only return log entries before the specified date, date should be in yyyy-MM-dd format
+ }
+ ]]> +
+ /api/rma/admin/rmauditlog + /api/node/{store_type}/{store_id}/{id}/rmauditlog + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.desc.xml index e13de43b34..de86e27b70 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.desc.xml @@ -1,16 +1,16 @@ - - Start or Stop Records Management Audit Log - The body of the put should be in the form
- {
-    "enabled" : true|false
- }
- ]]> -
- /api/rma/admin/rmauditlog - argument - user - required - internal + + Start or Stop Records Management Audit Log + The body of the put should be in the form
+ {
+    "enabled" : true|false
+ }
+ ]]> +
+ /api/rma/admin/rmauditlog + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.json.ftl index 88cf9b85d8..819b192128 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlog.put.json.ftl @@ -1,28 +1,28 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "rmauditlog.lib.ftl" as auditLib/> -<@auditLib.auditStatusJSON auditstatus=auditstatus/> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "rmauditlog.lib.ftl" as auditLib/> +<@auditLib.auditStatusJSON auditstatus=auditstatus/> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.desc.xml index 3d32335110..f3d37989ce 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.desc.xml @@ -1,12 +1,12 @@ - - Records Management Audit Log Status - - - /api/rma/admin/rmauditlog/status - argument - user - required - internal + + Records Management Audit Log Status + + + /api/rma/admin/rmauditlog/status + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.json.ftl index 7f0e0baf2f..52d1370641 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmauditlogstatus.get.json.ftl @@ -1,32 +1,32 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "data" : - { - "enabled" : ${enabled?string} - } -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "data" : + { + "enabled" : ${enabled?string} + } +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.desc.xml index 445dc99bf0..5e2e094870 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.desc.xml @@ -1,14 +1,14 @@ - - Get the allowed values for the authenticated user for an rm list constraint. - - listName is the qualified name of the list with the ":" replaced by "_" eg rmc_smList - ]]> - - /api/rma/rmconstraints/{listName} - argument - user - required - internal + + Get the allowed values for the authenticated user for an rm list constraint. + + listName is the qualified name of the list with the ":" replaced by "_" eg rmc_smList + ]]> + + /api/rma/rmconstraints/{listName} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.json.ftl index b7ebf6383c..17806b8e08 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmconstraints.get.json.ftl @@ -1,41 +1,41 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": { - "constraintName": "${constraintName}", - "allowedValuesForCurrentUser" : [ - <#list allowedValuesForCurrentUser as item> - { - "label": "${item}", - "value": "${item}" - }<#if item_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": { + "constraintName": "${constraintName}", + "allowedValuesForCurrentUser" : [ + <#list allowedValuesForCurrentUser as item> + { + "label": "${item}", + "value": "${item}" + }<#if item_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.desc.xml index e96bac280c..cfd7423f82 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.desc.xml @@ -1,36 +1,36 @@ - - Apply Records Management Permissions to a node - -
- The body of the post json should be of the form: -
-   {
-      "permissions":
-      [
-         {
-            "id": "Filing",
-            "authority": "GROUP_Administrator"
-         },
-         {
-            "id": "ReadRecords",
-            "authority": "userxyz"
-            "remove": true
-         },
-         ...
-      ]
-   }
-   
- Existing permissions will be updated by the supplied permission set, - where 'id' and 'authority' are mandatory values.
- If the optional 'remove' flag is set then the permission will be removed. - Note that it is only valid to set the following RM related permissions: - 'Filing', 'ReadRecords' and 'FileRecords'. - ]]> -
- /api/node/{store_type}/{store_id}/{id}/rmpermissions - argument - user - required - internal + + Apply Records Management Permissions to a node + +
+ The body of the post json should be of the form: +
+   {
+      "permissions":
+      [
+         {
+            "id": "Filing",
+            "authority": "GROUP_Administrator"
+         },
+         {
+            "id": "ReadRecords",
+            "authority": "userxyz"
+            "remove": true
+         },
+         ...
+      ]
+   }
+   
+ Existing permissions will be updated by the supplied permission set, + where 'id' and 'authority' are mandatory values.
+ If the optional 'remove' flag is set then the permission will be removed. + Note that it is only valid to set the following RM related permissions: + 'Filing', 'ReadRecords' and 'FileRecords'. + ]]> +
+ /api/node/{store_type}/{store_id}/{id}/rmpermissions + argument + user + required + internal
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.ftl index 05d341e16b..b7ba61347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.js index 83e4a80396..d345fb13b8 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/rmpermissions.post.json.js @@ -1,83 +1,83 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Entry point for rmpermissions POST data webscript. - * Applies supplied RM permissions to an RM node. - * - * @method main - */ -function main() -{ - // Get the node from the URL - var pathSegments = url.match.split("/"); - var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/")); - var node = search.findNode(pathSegments[2], reference); - - // 404 if the node is not found - if (node == null) - { - status.setCode(status.STATUS_NOT_FOUND, "The node could not be found"); - return; - } - - if (json.has("permissions") == false) - { - status.setCode(status.STATUS_BAD_REQUEST, "Permissions value missing from request."); - } - - if (json.has("isInherited")) - { - node.setInheritsPermissions(json.getBoolean("isInherited")); - } - - var permissions = json.getJSONArray("permissions"); - for (var i=0; i. + * #L% + */ +/** + * Entry point for rmpermissions POST data webscript. + * Applies supplied RM permissions to an RM node. + * + * @method main + */ +function main() +{ + // Get the node from the URL + var pathSegments = url.match.split("/"); + var reference = [ url.templateArgs.store_type, url.templateArgs.store_id ].concat(url.templateArgs.id.split("/")); + var node = search.findNode(pathSegments[2], reference); + + // 404 if the node is not found + if (node == null) + { + status.setCode(status.STATUS_NOT_FOUND, "The node could not be found"); + return; + } + + if (json.has("permissions") == false) + { + status.setCode(status.STATUS_BAD_REQUEST, "Permissions value missing from request."); + } + + if (json.has("isInherited")) + { + node.setInheritsPermissions(json.getBoolean("isInherited")); + } + + var permissions = json.getJSONArray("permissions"); + for (var i=0; i - Records Management Transfer - Streams an Alfresco Content Pacakge (ACP) file containing the contents of a transfer - /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id} - argument - user - required - deprecated + + Records Management Transfer + Streams an Alfresco Content Pacakge (ACP) file containing the contents of a transfer + /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id} + argument + user + required + deprecated \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.get.desc.xml index 8a82f9637b..a450507a86 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.get.desc.xml @@ -1,9 +1,9 @@ - - Records Management Transfer Report - Returns a transfer report to the caller in JSON format - /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id}/report - argument - user - required - deprecated + + Records Management Transfer Report + Returns a transfer report to the caller in JSON format + /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id}/report + argument + user + required + deprecated \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.post.desc.xml index 882842220a..26a514a0aa 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/transferreport.post.desc.xml @@ -1,16 +1,16 @@ - - Files a Records Management Transfer Report - A JSON structure is expected as follows:
- {
-    "destination" : NodeRef of record folder to file the transfer report in
- }
- ]]> -
- /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id}/report - argument - user - required - deprecated + + Files a Records Management Transfer Report + A JSON structure is expected as follows:
+ {
+    "destination" : NodeRef of record folder to file the transfer report in
+ }
+ ]]> +
+ /api/node/{store_type}/{store_id}/{id}/transfers/{transfer_id}/report + argument + user + required + deprecated
\ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.desc.xml index d0151a4915..5026a37097 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.desc.xml @@ -1,9 +1,9 @@ - - Records Management User Rights Report - Returns a user rights report showing users, roles and groups to the caller in JSON format - /api/rma/admin/userrightsreport - argument - user - required - internal + + Records Management User Rights Report + Returns a user rights report showing users, roles and groups to the caller in JSON format + /api/rma/admin/userrightsreport + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.json.ftl index af8467f50e..5925ebed3d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/rma/userrightsreport.get.json.ftl @@ -1,72 +1,72 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "users": - { - <#list report.users?keys as user> - "${user}": - { - "userName": "${report.users[user].userName!""}", - "firstName": "${report.users[user].firstName!""}", - "lastName": "${report.users[user].lastName!""}", - "roles": [<#list report.users[user].roles as role>"${role}"<#if role_has_next>,], - "groups": [<#list report.users[user].groups as group>"${group}"<#if group_has_next>,] - } - <#if user_has_next>, - - }, - "roles": - { - <#list report.roles?keys as role> - "${role}": - { - "name": "${report.roles[role].name!""}", - "label": "${report.roles[role].displayLabel!""}", - "users": [<#list report.roles[role].users as user>"${user}"<#if user_has_next>,], - "capabilities": [<#list report.roles[role].capabilities as capability>"${capability}"<#if capability_has_next>,] - } - <#if role_has_next>, - - }, - "groups": - { - <#list report.groups?keys as group> - "${group}": - { - "name": "${report.groups[group].name!""}", - "label": "${report.groups[group].displayLabel!""}", - "users": [<#list report.groups[group].users as user>"${user}"<#if user_has_next>,] - } - <#if group_has_next>, - - } - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "users": + { + <#list report.users?keys as user> + "${user}": + { + "userName": "${report.users[user].userName!""}", + "firstName": "${report.users[user].firstName!""}", + "lastName": "${report.users[user].lastName!""}", + "roles": [<#list report.users[user].roles as role>"${role}"<#if role_has_next>,], + "groups": [<#list report.users[user].groups as group>"${group}"<#if group_has_next>,] + } + <#if user_has_next>, + + }, + "roles": + { + <#list report.roles?keys as role> + "${role}": + { + "name": "${report.roles[role].name!""}", + "label": "${report.roles[role].displayLabel!""}", + "users": [<#list report.roles[role].users as user>"${user}"<#if user_has_next>,], + "capabilities": [<#list report.roles[role].capabilities as capability>"${capability}"<#if capability_has_next>,] + } + <#if role_has_next>, + + }, + "groups": + { + <#list report.groups?keys as group> + "${group}": + { + "name": "${report.groups[group].name!""}", + "label": "${report.groups[group].displayLabel!""}", + "users": [<#list report.groups[group].users as user>"${user}"<#if user_has_next>,] + } + <#if group_has_next>, + + } + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.desc.xml index 499a98d38b..8b8441f74d 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.desc.xml @@ -1,12 +1,12 @@ - - doclist-v2 - Document List v2 Component - records management doclist data webscript - /slingshot/doclib2/rm/doclist/{type}/site/{site}/{container}/{path} - /slingshot/doclib2/rm/doclist/{type}/site/{site}/{container} - /slingshot/doclib2/rm/doclist/{type}/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib2/rm/doclist/{type}/node/{store_type}/{store_id}/{id} - argument - user - required - internal + + doclist-v2 + Document List v2 Component - records management doclist data webscript + /slingshot/doclib2/rm/doclist/{type}/site/{site}/{container}/{path} + /slingshot/doclib2/rm/doclist/{type}/site/{site}/{container} + /slingshot/doclib2/rm/doclist/{type}/node/{store_type}/{store_id}/{id}/{path} + /slingshot/doclib2/rm/doclist/{type}/node/{store_type}/{store_id}/{id} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js index caa95bf320..4c9bb08a4a 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.js @@ -1,38 +1,38 @@ - - - - - - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -/** - * Document List Component: doclist - */ -model.doclist = rm_doclist_main(); + + + + + + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +/** + * Document List Component: doclist + */ +model.doclist = rm_doclist_main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.json.ftl index eed4256465..1ce01f8773 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.get.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#include "doclist.get.json.ftl"> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#include "doclist.get.json.ftl"> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js index bfee9735a1..a6ef5dee4b 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-doclist.lib.js @@ -1,374 +1,374 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -const REQUEST_MAX = 1000; - -/** - * Method that performs the actual loading of the nodes. - * - * Note! - * Will optimize performance by using ScriptNode.childFileFolders for directory listings - * In other words when the "path" filter is used. - * - * @method doclist_getAllNodes - * @param parsedArgs {Object} - * @param filterParams {Object} - * @param query {String} - * @param totalItemCount {int} - * @return {object} Returns the node and corresponding pagination metadata - * { - * allNodes: {Array} - * totalRecords: {int} - * requestTotalCountMax: {int} - * paged: {boolean} - * query: {String} - * } - */ -function doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount) -{ - var filter = args.filter, - totalRecords = 0, - requestTotalCountMax = 0, - paged = false, - allNodes = []; - if ((filter || "path") == "path" || - query == "" && - ((filter || "unfiledRecords") == "unfiledRecords" || - (filter || "holds") == "holds" || - (filter || "transfers") == "transfers")) - { - // TODO also add DB filter by "node" (in addition to "path") - var parentNode = parsedArgs.pathNode; - if (parentNode !== null) - { - var skip = -1, - max = -1; - - if (args.size != null) - { - max = args.size; - - if (args.pos > 0) - { - skip = (args.pos - 1) * max; - } - } - - var sortField = (args.sortField == null ? "cm:name" : args.sortField), - sortAsc = (((args.sortAsc == null) || (args.sortAsc == "true")) ? true : false); - - // Get paged set - requestTotalCountMax = skip + REQUEST_MAX; - var pagedResult = parentNode.childFileFolders( - true, true, filterParams.ignoreTypes.concat(filterParams.ignoreAspects), - skip, max, requestTotalCountMax, sortField, sortAsc, ""); - - allNodes = pagedResult.page; - totalRecords = pagedResult.totalResultCountUpper; - paged = true; - } - } - else - { - // Query the nodes - passing in sort and result limit parameters - if (query !== "") - { - allNodes = search.query( - { - query: query, - language: filterParams.language, - page: - { - maxItems: totalItemCount - }, - sort: filterParams.sort, - templates: filterParams.templates, - namespace: (filterParams.namespace ? filterParams.namespace : null), - onerror: "no-results" - }); - - totalRecords = allNodes.length; - } - } - return { - allNodes: allNodes, - totalRecords: totalRecords, - requestTotalCountMax: requestTotalCountMax, - paged: paged, - query: query - }; -} - -/** - * Main entry point: Create collection of documents and folders in the given space - * - * @method rm_doclist_main - */ -function rm_doclist_main() -{ - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - var filter = args.filter, - items = []; - - // Try to find a filter query based on the passed-in arguments - var allNodes = [], - totalRecords = 0, - requestTotalCountMax = 0, - paged = false, - favourites = Common.getFavourites(), - filterParams = Filters.getFilterParams(filter, parsedArgs, - { - favourites: favourites - }), - query = filterParams.query, - allSites = (parsedArgs.nodeRef == "alfresco://sites/home"); - - if (logger.isLoggingEnabled()) - logger.log("rm-doclist.lib.js - NodeRef: " + parsedArgs.nodeRef + " Query: " + query); - - var totalItemCount = filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : -1; - // For all sites documentLibrary query we pull in all available results and post filter - if (totalItemCount === 0) totalItemCount = -1; - else if (allSites) totalItemCount = (totalItemCount > 0 ? totalItemCount * 10 : 500); - - - var allNodesResult = doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount); - allNodes = allNodesResult.allNodes; - totalRecords = allNodesResult.totalRecords; - requestTotalCountMax = allNodesResult.requestTotalCountMax; - paged = allNodesResult.paged; - query = allNodesResult.query; - - - if (logger.isLoggingEnabled()) - logger.log("rm-doclist.lib.js - query results: " + allNodes.length); - // Generate the qname path match regex required for all sites 'documentLibrary' results match - var pathRegex; - if (allSites) - { - // escape the forward slash characters in the qname path - // TODO: replace with java.lang.String regex match for performance - var pathMatch = new String(parsedArgs.rootNode.qnamePath).replace(/\//g, '\\/') + "\\/.*\\/cm:documentLibrary\\/.*"; - pathRegex = new RegExp(pathMatch, "gi"); - if (logger.isLoggingEnabled()) - logger.log("rm-doclist.lib.js - will match results using regex: " + pathMatch); - } - - // Ensure folders and folderlinks appear at the top of the list - var folderNodes = [], - documentNodes = []; - - for each (node in allNodes) - { - if (totalItemCount !== 0) - { - try - { - if (!allSites || node.qnamePath.match(pathRegex)) - { - totalItemCount--; - if (node.isContainer || node.isLinkToContainer) - { - folderNodes.push(node); - } - else - { - documentNodes.push(node); - } - } - } - catch (e) - { - // Possibly an old indexed node - ignore it - } - } else break; - } - - // Node type counts - var folderNodesCount = folderNodes.length, - documentNodesCount = documentNodes.length, - nodes; - - if (parsedArgs.type === "documents") - { - nodes = documentNodes; - totalRecords -= folderNodesCount; - } - else - { - // TODO: Sorting with folders at end -- swap order of concat() - nodes = folderNodes.concat(documentNodes); - } - - if (logger.isLoggingEnabled()) - logger.log("rm-doclist.lib.js - totalRecords: " + totalRecords); - - // Pagination - var pageSize = args.size || nodes.length, - pagePos = args.pos || "1", - startIndex = (pagePos - 1) * pageSize; - - if (!paged) - { - // Trim the nodes array down to the page size - nodes = nodes.slice(startIndex, pagePos * pageSize); - } - - // Common or variable parent container? - var parent = null; - - if (!filterParams.variablePath) - { - var node = parsedArgs.pathNode; - // Display the toolbar actions for the child containers within unfiled records container and holds correctly - if (filterParams.filter === "containerFilter" && args.filterData !== null) - { - node = search.findNode(args.filterData); - } - // Parent node permissions (and Site role if applicable) - parent = Evaluator.run(node, true); - } - - var thumbnail = null, - locationNode, - item; - - // Loop through and evaluate each node in this result set - for each (node in nodes) - { - // we have to check if we have read permission on the node parent as an error will be thrown if we try to - // get the evaluated properties for a linked record whose parent we do not have read permissions for - var parentReadable = (node.parent != null && node.parent.isContainer && node.parent.hasPermission("ReadRecords")); - if (!parentReadable) continue; - - // Get evaluated properties. - item = Evaluator.run(node); - if (item !== null) - { - item.isFavourite = (favourites[item.node.nodeRef] === true); - item.likes = Common.getLikes(node); - - // Does this collection of nodes have potentially differering paths? - if (filterParams.variablePath || item.isLink || filterParams.filter === "containerFilter") - { - locationNode = item.isLink ? item.linkedNode : item.node; - // Ensure we have Read permissions on the destination on the link object - if (!locationNode.hasPermission("ReadRecords")) continue; - location = Common.getLocation(locationNode, parsedArgs.libraryRoot); - // Parent node - if (parentReadable) - { - item.parent = Evaluator.run(node.parent, true); - } - } - else - { - location = - { - site: parsedArgs.location.site, - siteTitle: parsedArgs.location.siteTitle, - sitePreset: parsedArgs.location.sitePreset, - container: parsedArgs.location.container, - containerType: parsedArgs.location.containerType, - path: parsedArgs.location.path, - file: node.name - }; - } - - // Resolved location - item.location = location; - - items.push(item); - } - else - { - --totalRecords; - } - } - - // Array Remove - By John Resig (MIT Licensed) - var fnArrayRemove = function fnArrayRemove(array, from, to) - { - var rest = array.slice((to || from) + 1 || array.length); - array.length = from < 0 ? array.length + from : from; - return array.push.apply(array, rest); - }; - - /** - * De-duplicate orignals for any existing working copies. - * This can't be done in evaluator.lib.js as it has no knowledge of the current filter or UI operation. - * Note: This may result in pages containing less than the configured amount of items (50 by default). - */ - for each (item in items) - { - if (item.workingCopy && item.workingCopy.isWorkingCopy) - { - var workingCopySource = String(item.workingCopy.sourceNodeRef); - for (var i = 0, ii = items.length; i < ii; i++) - { - if (String(items[i].node.nodeRef) == workingCopySource) - { - fnArrayRemove(items, i); - --totalRecords; - break; - } - } - } - } - - var paging = - { - totalRecords: totalRecords, - startIndex: startIndex - }; - - if (paged && (totalRecords == requestTotalCountMax)) - { - paging.totalRecordsUpper = requestTotalCountMax; - } - - return ( - { - luceneQuery: query, - paging: paging, - container: parsedArgs.rootNode, - parent: parent, - onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"), - itemCount: - { - folders: folderNodesCount, - documents: documentNodesCount - }, - items: items, - customJSON: slingshotDocLib.getJSON() - }); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +const REQUEST_MAX = 1000; + +/** + * Method that performs the actual loading of the nodes. + * + * Note! + * Will optimize performance by using ScriptNode.childFileFolders for directory listings + * In other words when the "path" filter is used. + * + * @method doclist_getAllNodes + * @param parsedArgs {Object} + * @param filterParams {Object} + * @param query {String} + * @param totalItemCount {int} + * @return {object} Returns the node and corresponding pagination metadata + * { + * allNodes: {Array} + * totalRecords: {int} + * requestTotalCountMax: {int} + * paged: {boolean} + * query: {String} + * } + */ +function doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount) +{ + var filter = args.filter, + totalRecords = 0, + requestTotalCountMax = 0, + paged = false, + allNodes = []; + if ((filter || "path") == "path" || + query == "" && + ((filter || "unfiledRecords") == "unfiledRecords" || + (filter || "holds") == "holds" || + (filter || "transfers") == "transfers")) + { + // TODO also add DB filter by "node" (in addition to "path") + var parentNode = parsedArgs.pathNode; + if (parentNode !== null) + { + var skip = -1, + max = -1; + + if (args.size != null) + { + max = args.size; + + if (args.pos > 0) + { + skip = (args.pos - 1) * max; + } + } + + var sortField = (args.sortField == null ? "cm:name" : args.sortField), + sortAsc = (((args.sortAsc == null) || (args.sortAsc == "true")) ? true : false); + + // Get paged set + requestTotalCountMax = skip + REQUEST_MAX; + var pagedResult = parentNode.childFileFolders( + true, true, filterParams.ignoreTypes.concat(filterParams.ignoreAspects), + skip, max, requestTotalCountMax, sortField, sortAsc, ""); + + allNodes = pagedResult.page; + totalRecords = pagedResult.totalResultCountUpper; + paged = true; + } + } + else + { + // Query the nodes - passing in sort and result limit parameters + if (query !== "") + { + allNodes = search.query( + { + query: query, + language: filterParams.language, + page: + { + maxItems: totalItemCount + }, + sort: filterParams.sort, + templates: filterParams.templates, + namespace: (filterParams.namespace ? filterParams.namespace : null), + onerror: "no-results" + }); + + totalRecords = allNodes.length; + } + } + return { + allNodes: allNodes, + totalRecords: totalRecords, + requestTotalCountMax: requestTotalCountMax, + paged: paged, + query: query + }; +} + +/** + * Main entry point: Create collection of documents and folders in the given space + * + * @method rm_doclist_main + */ +function rm_doclist_main() +{ + // Use helper function to get the arguments + var parsedArgs = ParseArgs.getParsedArgs(); + if (parsedArgs === null) + { + return; + } + + var filter = args.filter, + items = []; + + // Try to find a filter query based on the passed-in arguments + var allNodes = [], + totalRecords = 0, + requestTotalCountMax = 0, + paged = false, + favourites = Common.getFavourites(), + filterParams = Filters.getFilterParams(filter, parsedArgs, + { + favourites: favourites + }), + query = filterParams.query, + allSites = (parsedArgs.nodeRef == "alfresco://sites/home"); + + if (logger.isLoggingEnabled()) + logger.log("rm-doclist.lib.js - NodeRef: " + parsedArgs.nodeRef + " Query: " + query); + + var totalItemCount = filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : -1; + // For all sites documentLibrary query we pull in all available results and post filter + if (totalItemCount === 0) totalItemCount = -1; + else if (allSites) totalItemCount = (totalItemCount > 0 ? totalItemCount * 10 : 500); + + + var allNodesResult = doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount); + allNodes = allNodesResult.allNodes; + totalRecords = allNodesResult.totalRecords; + requestTotalCountMax = allNodesResult.requestTotalCountMax; + paged = allNodesResult.paged; + query = allNodesResult.query; + + + if (logger.isLoggingEnabled()) + logger.log("rm-doclist.lib.js - query results: " + allNodes.length); + // Generate the qname path match regex required for all sites 'documentLibrary' results match + var pathRegex; + if (allSites) + { + // escape the forward slash characters in the qname path + // TODO: replace with java.lang.String regex match for performance + var pathMatch = new String(parsedArgs.rootNode.qnamePath).replace(/\//g, '\\/') + "\\/.*\\/cm:documentLibrary\\/.*"; + pathRegex = new RegExp(pathMatch, "gi"); + if (logger.isLoggingEnabled()) + logger.log("rm-doclist.lib.js - will match results using regex: " + pathMatch); + } + + // Ensure folders and folderlinks appear at the top of the list + var folderNodes = [], + documentNodes = []; + + for each (node in allNodes) + { + if (totalItemCount !== 0) + { + try + { + if (!allSites || node.qnamePath.match(pathRegex)) + { + totalItemCount--; + if (node.isContainer || node.isLinkToContainer) + { + folderNodes.push(node); + } + else + { + documentNodes.push(node); + } + } + } + catch (e) + { + // Possibly an old indexed node - ignore it + } + } else break; + } + + // Node type counts + var folderNodesCount = folderNodes.length, + documentNodesCount = documentNodes.length, + nodes; + + if (parsedArgs.type === "documents") + { + nodes = documentNodes; + totalRecords -= folderNodesCount; + } + else + { + // TODO: Sorting with folders at end -- swap order of concat() + nodes = folderNodes.concat(documentNodes); + } + + if (logger.isLoggingEnabled()) + logger.log("rm-doclist.lib.js - totalRecords: " + totalRecords); + + // Pagination + var pageSize = args.size || nodes.length, + pagePos = args.pos || "1", + startIndex = (pagePos - 1) * pageSize; + + if (!paged) + { + // Trim the nodes array down to the page size + nodes = nodes.slice(startIndex, pagePos * pageSize); + } + + // Common or variable parent container? + var parent = null; + + if (!filterParams.variablePath) + { + var node = parsedArgs.pathNode; + // Display the toolbar actions for the child containers within unfiled records container and holds correctly + if (filterParams.filter === "containerFilter" && args.filterData !== null) + { + node = search.findNode(args.filterData); + } + // Parent node permissions (and Site role if applicable) + parent = Evaluator.run(node, true); + } + + var thumbnail = null, + locationNode, + item; + + // Loop through and evaluate each node in this result set + for each (node in nodes) + { + // we have to check if we have read permission on the node parent as an error will be thrown if we try to + // get the evaluated properties for a linked record whose parent we do not have read permissions for + var parentReadable = (node.parent != null && node.parent.isContainer && node.parent.hasPermission("ReadRecords")); + if (!parentReadable) continue; + + // Get evaluated properties. + item = Evaluator.run(node); + if (item !== null) + { + item.isFavourite = (favourites[item.node.nodeRef] === true); + item.likes = Common.getLikes(node); + + // Does this collection of nodes have potentially differering paths? + if (filterParams.variablePath || item.isLink || filterParams.filter === "containerFilter") + { + locationNode = item.isLink ? item.linkedNode : item.node; + // Ensure we have Read permissions on the destination on the link object + if (!locationNode.hasPermission("ReadRecords")) continue; + location = Common.getLocation(locationNode, parsedArgs.libraryRoot); + // Parent node + if (parentReadable) + { + item.parent = Evaluator.run(node.parent, true); + } + } + else + { + location = + { + site: parsedArgs.location.site, + siteTitle: parsedArgs.location.siteTitle, + sitePreset: parsedArgs.location.sitePreset, + container: parsedArgs.location.container, + containerType: parsedArgs.location.containerType, + path: parsedArgs.location.path, + file: node.name + }; + } + + // Resolved location + item.location = location; + + items.push(item); + } + else + { + --totalRecords; + } + } + + // Array Remove - By John Resig (MIT Licensed) + var fnArrayRemove = function fnArrayRemove(array, from, to) + { + var rest = array.slice((to || from) + 1 || array.length); + array.length = from < 0 ? array.length + from : from; + return array.push.apply(array, rest); + }; + + /** + * De-duplicate orignals for any existing working copies. + * This can't be done in evaluator.lib.js as it has no knowledge of the current filter or UI operation. + * Note: This may result in pages containing less than the configured amount of items (50 by default). + */ + for each (item in items) + { + if (item.workingCopy && item.workingCopy.isWorkingCopy) + { + var workingCopySource = String(item.workingCopy.sourceNodeRef); + for (var i = 0, ii = items.length; i < ii; i++) + { + if (String(items[i].node.nodeRef) == workingCopySource) + { + fnArrayRemove(items, i); + --totalRecords; + break; + } + } + } + } + + var paging = + { + totalRecords: totalRecords, + startIndex: startIndex + }; + + if (paged && (totalRecords == requestTotalCountMax)) + { + paging.totalRecordsUpper = requestTotalCountMax; + } + + return ( + { + luceneQuery: query, + paging: paging, + container: parsedArgs.rootNode, + parent: parent, + onlineEditing: utils.moduleInstalled("org.alfresco.module.vti"), + itemCount: + { + folders: folderNodesCount, + documents: documentNodesCount + }, + items: items, + customJSON: slingshotDocLib.getJSON() + }); +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js index c855ce4517..87ecc1b9e0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js @@ -1,222 +1,222 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** -* Query templates for custom search -*/ -Filters.QUERY_TEMPLATES = -[ - { field: "keywords", template: "%(cm:name cm:title cm:description TEXT)" }, - { field: "name", template: "%(cm:name)" }, - { field: "title", template: "%(cm:title)" }, - { field: "description", template: "%(cm:description)" }, - { field: "creator", template: "%(cm:creator)" }, - { field: "created", template: "%(cm:created)" }, - { field: "modifier", template: "%(cm:modifier)" }, - { field: "modified", template: "%(cm:modified)" }, - { field: "author", template: "%(cm:author)" }, - { field: "markings", template: "%(rmc:supplementalMarkingList)" }, - { field: "dispositionEvents", template: "%(rma:recordSearchDispositionEvents)" }, - { field: "dispositionActionName", template: "%(rma:recordSearchDispositionActionName)" }, - { field: "dispositionActionAsOf", template: "%(rma:recordSearchDispositionActionAsOf)" }, - { field: "dispositionEventsEligible", template: "%(rma:recordSearchDispositionEventsEligible)" }, - { field: "dispositionPeriod", template: "%(rma:recordSearchDispositionPeriod)" }, - { field: "hasDispositionSchedule", template: "%(rma:recordSearchHasDispositionSchedule)" }, - { field: "dispositionInstructions", template: "%(rma:recordSearchDispositionInstructions)" }, - { field: "dispositionAuthority", template: "%(rma:recordSearchDispositionAuthority)" }, - { field: "vitalRecordReviewPeriod", template: "%(rma:recordSearchVitalRecordReviewPeriod)" } -]; - -Filters.IGNORED_TYPES = -[ - /* Defaults */ - "cm:systemfolder", - "fm:forums", - "fm:forum", - "fm:topic", - "fm:post", - /* Records Management */ - "rma:dispositionSchedule", - "rma:dispositionActionDefinition", - "rma:dispositionAction", - "rma:holdContainer", - "rma:transferContainer", - "rma:unfiledRecordContainer" -]; - -/** - * Create filter parameters based on input parameters - * - * @method getFilterParams - * @param filter {string} Required filter - * @param parsedArgs {object} Parsed arguments object literal - * @param optional {object} Optional arguments depending on filter type - * @return {object} Object literal containing parameters to be used in Lucene search - */ -Filters.getFilterParams = function RecordsManagementFilter_getFilterParams(filter, parsedArgs, optional) -{ - var filterParams = - { - query: "+PATH:\"" + parsedArgs.pathNode.qnamePath + "/*\"", - limitResults: null, - sort: [ - { - column: "@cm:name", - ascending: true - }], - language: "lucene", - templates: null, - variablePath: true, - ignoreTypes: Filters.IGNORED_TYPES - }; - - optional = optional || {}; - - // Sorting parameters specified? - var sortAscending = args.sortAsc, - sortField = args.sortField; - - if (sortAscending == "false") - { - filterParams.sort[0].ascending = false; - } - if (sortField !== null) - { - filterParams.sort[0].column = (sortField.indexOf(":") != -1 ? "@" : "") + sortField; - } - - // Max returned results specified? - var argMax = args.max; - if ((argMax !== null) && !isNaN(argMax)) - { - filterParams.limitResults = argMax; - } - - // Create query based on passed-in arguments - var filterData = args.filterData, - filterQuery = ""; - - // Common types and aspects to filter from the UI - var filterQueryDefaults = ' -TYPE:"' + Filters.IGNORED_TYPES.join('" -TYPE:"') + '"'; - - // Create query based on passed-in arguments - switch (String(filter)) - { - case "all": - filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\""; - filterQuery += " -TYPE:\"{http://www.alfresco.org/model/content/1.0}folder\""; - filterParams.query = filterQuery + filterQueryDefaults; - break; - - case "node": - parsedArgs.pathNode = parsedArgs.rootNode.parent; - filterParams.variablePath = false; - filterParams.query = "+ID:\"" + parsedArgs.rootNode.nodeRef + "\""; - break; - - case "savedsearch": - var searchNode = parsedArgs.location.siteNode.getContainer("Saved Searches"); - if (searchNode != null) - { - var ssNode = searchNode.childByNamePath(String(filterData)); - - if (ssNode != null) - { - var ssJson = eval('try{(' + ssNode.content + ')}catch(e){}'); - filterQuery = ssJson.query; - // Wrap the query so that only valid items within the filePlan are returned - filterParams.query = 'PATH:"' + parsedArgs.rootNode.qnamePath + '//*" AND (' + filterQuery + ')'; - filterParams.templates = Filters.QUERY_TEMPLATES; - filterParams.language = "fts-alfresco"; - filterParams.namespace = "http://www.alfresco.org/model/recordsmanagement/1.0"; - // gather up the sort by fields - // they are encoded as "property/dir" i.e. "cm:name/asc" - if (ssJson.sort && ssJson.sort.length !== 0) - { - var sortPairs = ssJson.sort.split(","); - var sort = []; - for (var i=0, j; i. + * #L% + */ +/** +* Query templates for custom search +*/ +Filters.QUERY_TEMPLATES = +[ + { field: "keywords", template: "%(cm:name cm:title cm:description TEXT)" }, + { field: "name", template: "%(cm:name)" }, + { field: "title", template: "%(cm:title)" }, + { field: "description", template: "%(cm:description)" }, + { field: "creator", template: "%(cm:creator)" }, + { field: "created", template: "%(cm:created)" }, + { field: "modifier", template: "%(cm:modifier)" }, + { field: "modified", template: "%(cm:modified)" }, + { field: "author", template: "%(cm:author)" }, + { field: "markings", template: "%(rmc:supplementalMarkingList)" }, + { field: "dispositionEvents", template: "%(rma:recordSearchDispositionEvents)" }, + { field: "dispositionActionName", template: "%(rma:recordSearchDispositionActionName)" }, + { field: "dispositionActionAsOf", template: "%(rma:recordSearchDispositionActionAsOf)" }, + { field: "dispositionEventsEligible", template: "%(rma:recordSearchDispositionEventsEligible)" }, + { field: "dispositionPeriod", template: "%(rma:recordSearchDispositionPeriod)" }, + { field: "hasDispositionSchedule", template: "%(rma:recordSearchHasDispositionSchedule)" }, + { field: "dispositionInstructions", template: "%(rma:recordSearchDispositionInstructions)" }, + { field: "dispositionAuthority", template: "%(rma:recordSearchDispositionAuthority)" }, + { field: "vitalRecordReviewPeriod", template: "%(rma:recordSearchVitalRecordReviewPeriod)" } +]; + +Filters.IGNORED_TYPES = +[ + /* Defaults */ + "cm:systemfolder", + "fm:forums", + "fm:forum", + "fm:topic", + "fm:post", + /* Records Management */ + "rma:dispositionSchedule", + "rma:dispositionActionDefinition", + "rma:dispositionAction", + "rma:holdContainer", + "rma:transferContainer", + "rma:unfiledRecordContainer" +]; + +/** + * Create filter parameters based on input parameters + * + * @method getFilterParams + * @param filter {string} Required filter + * @param parsedArgs {object} Parsed arguments object literal + * @param optional {object} Optional arguments depending on filter type + * @return {object} Object literal containing parameters to be used in Lucene search + */ +Filters.getFilterParams = function RecordsManagementFilter_getFilterParams(filter, parsedArgs, optional) +{ + var filterParams = + { + query: "+PATH:\"" + parsedArgs.pathNode.qnamePath + "/*\"", + limitResults: null, + sort: [ + { + column: "@cm:name", + ascending: true + }], + language: "lucene", + templates: null, + variablePath: true, + ignoreTypes: Filters.IGNORED_TYPES + }; + + optional = optional || {}; + + // Sorting parameters specified? + var sortAscending = args.sortAsc, + sortField = args.sortField; + + if (sortAscending == "false") + { + filterParams.sort[0].ascending = false; + } + if (sortField !== null) + { + filterParams.sort[0].column = (sortField.indexOf(":") != -1 ? "@" : "") + sortField; + } + + // Max returned results specified? + var argMax = args.max; + if ((argMax !== null) && !isNaN(argMax)) + { + filterParams.limitResults = argMax; + } + + // Create query based on passed-in arguments + var filterData = args.filterData, + filterQuery = ""; + + // Common types and aspects to filter from the UI + var filterQueryDefaults = ' -TYPE:"' + Filters.IGNORED_TYPES.join('" -TYPE:"') + '"'; + + // Create query based on passed-in arguments + switch (String(filter)) + { + case "all": + filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\""; + filterQuery += " -TYPE:\"{http://www.alfresco.org/model/content/1.0}folder\""; + filterParams.query = filterQuery + filterQueryDefaults; + break; + + case "node": + parsedArgs.pathNode = parsedArgs.rootNode.parent; + filterParams.variablePath = false; + filterParams.query = "+ID:\"" + parsedArgs.rootNode.nodeRef + "\""; + break; + + case "savedsearch": + var searchNode = parsedArgs.location.siteNode.getContainer("Saved Searches"); + if (searchNode != null) + { + var ssNode = searchNode.childByNamePath(String(filterData)); + + if (ssNode != null) + { + var ssJson = eval('try{(' + ssNode.content + ')}catch(e){}'); + filterQuery = ssJson.query; + // Wrap the query so that only valid items within the filePlan are returned + filterParams.query = 'PATH:"' + parsedArgs.rootNode.qnamePath + '//*" AND (' + filterQuery + ')'; + filterParams.templates = Filters.QUERY_TEMPLATES; + filterParams.language = "fts-alfresco"; + filterParams.namespace = "http://www.alfresco.org/model/recordsmanagement/1.0"; + // gather up the sort by fields + // they are encoded as "property/dir" i.e. "cm:name/asc" + if (ssJson.sort && ssJson.sort.length !== 0) + { + var sortPairs = ssJson.sort.split(","); + var sort = []; + for (var i=0, j; i - node-v2 - Document List v2 Component - node data webscript - /slingshot/doclib2/rm/node/{store_type}/{store_id}/{id} - argument - user - required - internal + + node-v2 + Document List v2 Component - node data webscript + /slingshot/doclib2/rm/node/{store_type}/{store_id}/{id} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.js index 22e582225e..fe088af14f 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.js @@ -1,28 +1,28 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.json.ftl index 7c6f00f583..70ba586a02 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-node.get.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#include "node.get.json.ftl"> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#include "node.get.json.ftl"> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js index da741cdae1..e8b87f6d46 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js @@ -1,187 +1,187 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -/** - * Get and parse arguments - * - * @method getParsedArgs - * @return {array|null} Array containing the validated input parameters - */ -ParseArgs.getParsedArgs = function RecordsManagementFilter_getParsedArgs(containerType) -{ - var type = url.templateArgs.type, - libraryRoot = args.libraryRoot, - rootNode = null, - pathNode = null, - nodeRef = null, - path = "", - location = null; - - // Is this library rooted from a non-site nodeRef? - if (libraryRoot !== null) - { - libraryRoot = ParseArgs.resolveNode(libraryRoot); - } - - - if (url.templateArgs.store_type !== null) - { - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id; - - nodeRef = storeType + "://" + storeId + "/" + id; - rootNode = libraryRoot || ParseArgs.resolveNode(nodeRef); - if (rootNode == null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - // Special case: make sure filter picks up correct mode - if (type == null && args.filter == null) - { - args.filter = "node"; - } - } - else - { - /** - * Site and container input - */ - var siteId = url.templateArgs.site, - containerId = url.templateArgs.container, - siteNode = siteService.getSite(siteId); - - if (siteNode === null) - { - status.setCode(status.STATUS_GONE, "Site not found: '" + siteId + "'"); - return null; - } - - rootNode = siteNode.getContainer(containerId); - if (rootNode === null) - { - rootNode = siteNode.createContainer(containerId, containerType || "cm:folder"); - if (rootNode === null) - { - status.setCode(status.STATUS_GONE, "Document Library container '" + containerId + "' not found in '" + siteId + "'. (No permission?)"); - return null; - } - - rootNode.properties["cm:description"] = "Document Library"; - - /** - * MOB-593: Add email alias on documentLibrary container creation - * - rootNode.addAspect("emailserver:aliasable"); - var emailAlias = siteId; - if (containerId != "documentLibrary") - { - emailAlias += "-" + containerId; - } - rootNode.properties["emailserver:alias"] = emailAlias; - */ - rootNode.save(); - } - } - - if (args.filter == "unfiledRecords") - { - var container = rootNode.childrenByXPath("rma:Unfiled_x0020_Records"); - if (container.length > 0) - { - pathNode = container[0]; - } - } - else if (args.filter == "holds") - { - var container = rootNode.childrenByXPath("rma:Holds"); - if (container.length > 0) - { - pathNode = container[0]; - } - } - else if (args.filter == "transfers") - { - var container = rootNode.childrenByXPath("rma:Transfers"); - if (container.length > 0) - { - pathNode = container[0]; - } - } - else - { - // Path input? - path = url.templateArgs.path || ""; - pathNode = path.length > 0 ? rootNode.childByNamePath(path) : (pathNode || rootNode); - } - - if (pathNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Path not found: '" + path + "'"); - return null; - } - - // Parent location parameter adjustment - location = Common.getLocation(pathNode, libraryRoot); - if (location === null) - { - status.setCode(status.STATUS_GONE, "Location is 'null'. (No permission?)"); - return null; - } - if (path !== "") - { - location.path = ParseArgs.combinePaths(location.path, location.file); - } - if (args.filter !== "node" && !pathNode.isContainer) - { - location.file = ""; - } - - var objRet = - { - rootNode: rootNode, - pathNode: pathNode, - libraryRoot: libraryRoot, - location: location, - path: path, - nodeRef: nodeRef, - type: type - }; - - // Multiple input files in the JSON body? - var files = ParseArgs.getMultipleInputValues("nodeRefs"); - if (typeof files != "string") - { - objRet.files = files; - } - - return objRet; -}; +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +/** + * Get and parse arguments + * + * @method getParsedArgs + * @return {array|null} Array containing the validated input parameters + */ +ParseArgs.getParsedArgs = function RecordsManagementFilter_getParsedArgs(containerType) +{ + var type = url.templateArgs.type, + libraryRoot = args.libraryRoot, + rootNode = null, + pathNode = null, + nodeRef = null, + path = "", + location = null; + + // Is this library rooted from a non-site nodeRef? + if (libraryRoot !== null) + { + libraryRoot = ParseArgs.resolveNode(libraryRoot); + } + + + if (url.templateArgs.store_type !== null) + { + /** + * nodeRef input: store_type, store_id and id + */ + var storeType = url.templateArgs.store_type, + storeId = url.templateArgs.store_id, + id = url.templateArgs.id; + + nodeRef = storeType + "://" + storeId + "/" + id; + rootNode = libraryRoot || ParseArgs.resolveNode(nodeRef); + if (rootNode == null) + { + status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); + return null; + } + + // Special case: make sure filter picks up correct mode + if (type == null && args.filter == null) + { + args.filter = "node"; + } + } + else + { + /** + * Site and container input + */ + var siteId = url.templateArgs.site, + containerId = url.templateArgs.container, + siteNode = siteService.getSite(siteId); + + if (siteNode === null) + { + status.setCode(status.STATUS_GONE, "Site not found: '" + siteId + "'"); + return null; + } + + rootNode = siteNode.getContainer(containerId); + if (rootNode === null) + { + rootNode = siteNode.createContainer(containerId, containerType || "cm:folder"); + if (rootNode === null) + { + status.setCode(status.STATUS_GONE, "Document Library container '" + containerId + "' not found in '" + siteId + "'. (No permission?)"); + return null; + } + + rootNode.properties["cm:description"] = "Document Library"; + + /** + * MOB-593: Add email alias on documentLibrary container creation + * + rootNode.addAspect("emailserver:aliasable"); + var emailAlias = siteId; + if (containerId != "documentLibrary") + { + emailAlias += "-" + containerId; + } + rootNode.properties["emailserver:alias"] = emailAlias; + */ + rootNode.save(); + } + } + + if (args.filter == "unfiledRecords") + { + var container = rootNode.childrenByXPath("rma:Unfiled_x0020_Records"); + if (container.length > 0) + { + pathNode = container[0]; + } + } + else if (args.filter == "holds") + { + var container = rootNode.childrenByXPath("rma:Holds"); + if (container.length > 0) + { + pathNode = container[0]; + } + } + else if (args.filter == "transfers") + { + var container = rootNode.childrenByXPath("rma:Transfers"); + if (container.length > 0) + { + pathNode = container[0]; + } + } + else + { + // Path input? + path = url.templateArgs.path || ""; + pathNode = path.length > 0 ? rootNode.childByNamePath(path) : (pathNode || rootNode); + } + + if (pathNode === null) + { + status.setCode(status.STATUS_NOT_FOUND, "Path not found: '" + path + "'"); + return null; + } + + // Parent location parameter adjustment + location = Common.getLocation(pathNode, libraryRoot); + if (location === null) + { + status.setCode(status.STATUS_GONE, "Location is 'null'. (No permission?)"); + return null; + } + if (path !== "") + { + location.path = ParseArgs.combinePaths(location.path, location.file); + } + if (args.filter !== "node" && !pathNode.isContainer) + { + location.file = ""; + } + + var objRet = + { + rootNode: rootNode, + pathNode: pathNode, + libraryRoot: libraryRoot, + location: location, + path: path, + nodeRef: nodeRef, + type: type + }; + + // Multiple input files in the JSON body? + var files = ParseArgs.getMultipleInputValues("nodeRefs"); + if (typeof files != "string") + { + objRet.files = files; + } + + return objRet; +}; diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml index e61684260a..b6004fb1e4 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml @@ -1,9 +1,9 @@ - - Gets Recorded Version Config - Gets Recorded Version Config Data - /slingshot/doclib/action/recorded-version-config/node/{store_type}/{store_id}/{id} - argument - user - required - internal + + Gets Recorded Version Config + Gets Recorded Version Config Data + /slingshot/doclib/action/recorded-version-config/node/{store_type}/{store_id}/{id} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl index 560b531e33..1ddfc475df 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl @@ -1,42 +1,42 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "recordableVersions": - [ - <#list recordableVersions as recordableVersion> - { - "policy": "${recordableVersion.policy}", - "selected": "${recordableVersion.selected?string("true", "false")}" - }<#if recordableVersion_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { + "recordableVersions": + [ + <#list recordableVersions as recordableVersion> + { + "policy": "${recordableVersion.policy}", + "selected": "${recordableVersion.selected?string("true", "false")}" + }<#if recordableVersion_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml index d40c295377..3d9e11e440 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml @@ -1,9 +1,9 @@ - - Sets Recorded Version Config - Sets Recorded Version Config Data - /slingshot/doclib/action/recorded-version-config/node/{store_type}/{store_id}/{id} - argument - user - required - internal + + Sets Recorded Version Config + Sets Recorded Version Config Data + /slingshot/doclib/action/recorded-version-config/node/{store_type}/{store_id}/{id} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl index 05d341e16b..b7ba61347e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.desc.xml index 6d5244aadb..4e7e14fb4e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.desc.xml @@ -1,13 +1,13 @@ - - 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 - + + 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-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl index 96ae629f53..b8a237f1a7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.ftl @@ -1,28 +1,28 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "action.lib.ftl" as actionLib /> +<@actionLib.resultsJSON results=results /> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js index 6ec268eb92..b83d20f915 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js @@ -1,134 +1,134 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -/** - * 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."; - } - if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) - { - result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; - results.push(result); - continue; - } - 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(); + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +/** + * 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."; + } + if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) + { + result.name = fileNode.name; + result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + results.push(result); + continue; + } + 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-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml index c5652b7dfd..06fa861c15 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.desc.xml @@ -1,12 +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 - + + 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-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl index 96ae629f53..b8a237f1a7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.ftl @@ -1,28 +1,28 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "action.lib.ftl" as actionLib /> +<@actionLib.resultsJSON results=results /> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js index a077246e1a..a52e075a96 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js @@ -1,109 +1,109 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -/** - * 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; - } - if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) - { - result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; - results.push(result); - continue; - } - 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(); + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +/** + * 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; + } + if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) + { + result.name = fileNode.name; + result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + results.push(result); + continue; + } + 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-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml index 29db2bca5b..07390aa024 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.desc.xml @@ -1,12 +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 - + + 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-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl index 96ae629f53..b8a237f1a7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.ftl @@ -1,28 +1,28 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#import "action.lib.ftl" as actionLib /> -<@actionLib.resultsJSON results=results /> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#import "action.lib.ftl" as actionLib /> +<@actionLib.resultsJSON results=results /> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js index 8cb978f5a8..ab829967a1 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js @@ -1,128 +1,128 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -/** - * 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; - } - if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) - { - result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; - results.push(result); - continue; - } - 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(); + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +/** + * 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; + } + if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) + { + result.name = fileNode.name; + result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + results.push(result); + continue; + } + 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-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.desc.xml index 09fe2a5cff..c7d8a558de 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.desc.xml @@ -1,9 +1,9 @@ - - permissions - Document List Component - permissions data webscript - /slingshot/doclib/rm/permissions/{store_type}/{store_id}/{id} - argument - user - required - internal + + permissions + Document List Component - permissions data webscript + /slingshot/doclib/rm/permissions/{store_type}/{store_id}/{id} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js index b6c592c2c0..adf2bc080e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.js @@ -1,69 +1,69 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -function getRmPermissions() -{ - /** - * nodeRef input: store_type, store_id and id - */ - var storeType = url.templateArgs.store_type, - storeId = url.templateArgs.store_id, - id = url.templateArgs.id, - nodeRef = storeType + "://" + storeId + "/" + id, - node = ParseArgs.resolveNode(nodeRef); - - if (node == null) - { - node = search.findNode(nodeRef); - if (node === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - } - - var permissionData = model.data, - settable = node.getSettablePermissions(), - canReadInherited = true; - - if (node.parent.hasPermission("ReadRecords")) - { - permissionData["inherited"] = parsePermissions(node.parent.getPermissions(), settable); - } - else - { - canReadInherited = false; - } - - permissionData["canReadInherited"] = canReadInherited; - - model.data = permissionData; -} - -getRmPermissions(); + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +function getRmPermissions() +{ + /** + * nodeRef input: store_type, store_id and id + */ + var storeType = url.templateArgs.store_type, + storeId = url.templateArgs.store_id, + id = url.templateArgs.id, + nodeRef = storeType + "://" + storeId + "/" + id, + node = ParseArgs.resolveNode(nodeRef); + + if (node == null) + { + node = search.findNode(nodeRef); + if (node === null) + { + status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); + return null; + } + } + + var permissionData = model.data, + settable = node.getSettablePermissions(), + canReadInherited = true; + + if (node.parent.hasPermission("ReadRecords")) + { + permissionData["inherited"] = parsePermissions(node.parent.getPermissions(), settable); + } + else + { + canReadInherited = false; + } + + permissionData["canReadInherited"] = canReadInherited; + + model.data = permissionData; +} + +getRmPermissions(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.json.ftl index bb3da1522a..fa0d7335f5 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-permissions.get.json.ftl @@ -1,27 +1,27 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#include "permissions.get.json.ftl"> +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#include "permissions.get.json.ftl"> diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.desc.xml index 3098b18027..3b23c5431b 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.desc.xml @@ -1,9 +1,9 @@ - - doclist - Document List Component - rm saved searches data webscript - /slingshot/doclib/rm/savedsearches/site/{site}?p={public?} - argument - user - required - internal + + doclist + Document List Component - rm saved searches data webscript + /slingshot/doclib/rm/savedsearches/site/{site}?p={public?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.js index 482f443300..1cf12545f7 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.js @@ -1,80 +1,80 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -function main() -{ - var savedSearches = [], - siteId = url.templateArgs.site, - siteNode = siteService.getSite(siteId), - bPublic = args.p; - - if (siteNode === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Site not found: '" + siteId + "'"); - return null; - } - - var searchNode = siteNode.getContainer("Saved Searches"); - if (searchNode != null) - { - var kids, ssNode; - - if (bPublic == null || bPublic == "true") - { - // public searches are in the root of the folder - kids = searchNode.children; - } - else - { - // user specific searches are in a sub-folder of username - var userNode = searchNode.childByNamePath(person.properties.userName); - if (userNode != null) - { - kids = userNode.children; - } - } - - if (kids) - { - for (var i = 0, ii = kids.length; i < ii; i++) - { - ssNode = kids[i]; - if (ssNode.isDocument) - { - savedSearches.push( - { - name: ssNode.name, - description: ssNode.properties.description - }); - } - } - } - } - - model.savedSearches = savedSearches; -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +function main() +{ + var savedSearches = [], + siteId = url.templateArgs.site, + siteNode = siteService.getSite(siteId), + bPublic = args.p; + + if (siteNode === null) + { + status.setCode(status.STATUS_NOT_FOUND, "Site not found: '" + siteId + "'"); + return null; + } + + var searchNode = siteNode.getContainer("Saved Searches"); + if (searchNode != null) + { + var kids, ssNode; + + if (bPublic == null || bPublic == "true") + { + // public searches are in the root of the folder + kids = searchNode.children; + } + else + { + // user specific searches are in a sub-folder of username + var userNode = searchNode.childByNamePath(person.properties.userName); + if (userNode != null) + { + kids = userNode.children; + } + } + + if (kids) + { + for (var i = 0, ii = kids.length; i < ii; i++) + { + ssNode = kids[i]; + if (ssNode.isDocument) + { + savedSearches.push( + { + name: ssNode.name, + description: ssNode.properties.description + }); + } + } + } + } + + model.savedSearches = savedSearches; +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.json.ftl index 5197ac35ea..127b284004 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-savedsearches.get.json.ftl @@ -1,39 +1,39 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list savedSearches as s> - { - "name": "${s.name}", - "description": "${s.description!""}" - }<#if s_has_next>, - - ] -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "items": + [ + <#list savedSearches as s> + { + "name": "${s.name}", + "description": "${s.description!""}" + }<#if s_has_next>, + + ] +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.desc.xml index a6a6adcdd0..03c9efc138 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.desc.xml @@ -1,9 +1,9 @@ - - doclist-transfer - Document List Component - rm transfer query data webscript - /slingshot/doclib/rm/transfer/node/{store_type}/{store_id}/{id} - argument - user - required - internal + + doclist-transfer + Document List Component - rm transfer query data webscript + /slingshot/doclib/rm/transfer/node/{store_type}/{store_id}/{id} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.js index 3ab085b91c..85430b2bf8 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.js @@ -1,47 +1,47 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -function main() -{ - var nodeRef = url.templateArgs.store_type + "://" + url.templateArgs.store_id + "/" + url.templateArgs.id, - transfer = search.findNode(nodeRef); - - if (transfer === null) - { - status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); - return null; - } - - if (String(transfer.typeShort) != "rma:transfer") - { - status.setCode(status.STATUS_BAD_REQUEST, "nodeRef: '" + nodeRef + "' is not of type 'rma:transfer'"); - return null; - } - - model.transfer = transfer; -} - -main(); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +function main() +{ + var nodeRef = url.templateArgs.store_type + "://" + url.templateArgs.store_id + "/" + url.templateArgs.id, + transfer = search.findNode(nodeRef); + + if (transfer === null) + { + status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'"); + return null; + } + + if (String(transfer.typeShort) != "rma:transfer") + { + status.setCode(status.STATUS_BAD_REQUEST, "nodeRef: '" + nodeRef + "' is not of type 'rma:transfer'"); + return null; + } + + model.transfer = transfer; +} + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.json.ftl index c75c0f2c24..661d4b0701 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-transfer.get.json.ftl @@ -1,39 +1,39 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if transfer??> - "transfer": - { - "nodeRef": "${transfer.nodeRef}", - "name": "${transfer.name}", - "rma:transferAccessionIndicator": ${(transfer.properties["rma:transferAccessionIndicator"]!false)?string}, - "rma:transferPDFIndicator": ${(transfer.properties["rma:transferPDFIndicator"]!false)?string} - } - -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + <#if transfer??> + "transfer": + { + "nodeRef": "${transfer.nodeRef}", + "name": "${transfer.name}", + "rma:transferAccessionIndicator": ${(transfer.properties["rma:transferAccessionIndicator"]!false)?string}, + "rma:transferPDFIndicator": ${(transfer.properties["rma:transferPDFIndicator"]!false)?string} + } + +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.desc.xml index b31e995e28..e7345e5692 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.desc.xml @@ -1,12 +1,12 @@ - - treenode - Document List Component - rm treenode data webscript - /slingshot/doclib/rm/treenode/site/{site}/{container}/{path} - /slingshot/doclib/rm/treenode/site/{site}/{container} - /slingshot/doclib/rm/treenode/node/{store_type}/{store_id}/{id}/{path} - /slingshot/doclib/rm/treenode/node/{store_type}/{store_id}/{id} - argument - user - required - internal + + treenode + Document List Component - rm treenode data webscript + /slingshot/doclib/rm/treenode/site/{site}/{container}/{path} + /slingshot/doclib/rm/treenode/site/{site}/{container} + /slingshot/doclib/rm/treenode/node/{store_type}/{store_id}/{id}/{path} + /slingshot/doclib/rm/treenode/node/{store_type}/{store_id}/{id} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js index c5ba78efc3..bb5e4a32d2 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.js @@ -1,163 +1,163 @@ - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -/** - * Document List Component: treenode - */ -model.treenode = getTreenode(); - -/* Create collection of folders in the given space */ -function getTreenode() -{ - try - { - var items = new Array(), - hasSubfolders = true, - ignoredTypes = - { - "{http://www.alfresco.org/model/forum/1.0}forum": true, - "{http://www.alfresco.org/model/forum/1.0}topic": true, - "{http://www.alfresco.org/model/content/1.0}systemfolder": true, - "{http://www.alfresco.org/model/recordsmanagement/1.0}unfiledRecordContainer":true - }, - skipPermissionCheck = args["perms"] == "false", - evalChildFolders = false, - item, rmNode, capabilities, cap; - - // Use helper function to get the arguments - var parsedArgs = ParseArgs.getParsedArgs(); - if (parsedArgs === null) - { - return; - } - - // Quick version if "skipPermissionCheck" flag set - if (skipPermissionCheck) - { - for each (item in parsedArgs.pathNode.children) - { - if (itemIsAllowed(item) && !(item.type in ignoredTypes)) - { - if (evalChildFolders) - { - hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; - } - - items.push( - { - node: item, - hasSubfolders: hasSubfolders - }); - } - } - } - else - { - for each (item in parsedArgs.pathNode.children) - { - if (itemIsAllowed(item) && !(item.type in ignoredTypes)) - { - //capabilities = {}; - rmNode = rmService.getRecordsManagementNode(item); - - //for each (cap in rmNode.capabilitiesSet("Create")) - //{ - // capabilities[cap.name] = true; - //} - - // - - hasCreateCapability = rmNode.hasCapability("Create"); - - if (evalChildFolders) - { - hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; - } - - items.push( - { - node: item, - hasSubfolders: hasSubfolders, - permissions: - { - create: hasCreateCapability - } - }); - } - } - } - - items.sort(sortByName); - - return ( - { - parent: parsedArgs.pathNode, - resultsTrimmed: false, - items: items - }); - } - catch(e) - { - status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); - return; - } -} - - -/* Sort the results by case-insensitive name */ -function sortByName(a, b) -{ - return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1); -} - -/* Filter allowed types, etc. */ -function itemIsAllowed(item) -{ - // Must be a subtype of cm:folder - if (!item.isSubType("cm:folder")) - { - return false; - } - - var typeShort = String(item.typeShort); - - // Don't show Hold and Transfer top-level containers - if (typeShort == "rma:holdContainer" || typeShort == "rma:transferContainer" || typeShort == "rma:unfiledRecordContainer") - { - return false; - } - - // Must be a "dod:" or "rma:" namespaced type - if (typeShort.indexOf("dod:") !== 0 && typeShort.indexOf("rma") !== 0) - { - return false; - } - - return true; -} + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +/** + * Document List Component: treenode + */ +model.treenode = getTreenode(); + +/* Create collection of folders in the given space */ +function getTreenode() +{ + try + { + var items = new Array(), + hasSubfolders = true, + ignoredTypes = + { + "{http://www.alfresco.org/model/forum/1.0}forum": true, + "{http://www.alfresco.org/model/forum/1.0}topic": true, + "{http://www.alfresco.org/model/content/1.0}systemfolder": true, + "{http://www.alfresco.org/model/recordsmanagement/1.0}unfiledRecordContainer":true + }, + skipPermissionCheck = args["perms"] == "false", + evalChildFolders = false, + item, rmNode, capabilities, cap; + + // Use helper function to get the arguments + var parsedArgs = ParseArgs.getParsedArgs(); + if (parsedArgs === null) + { + return; + } + + // Quick version if "skipPermissionCheck" flag set + if (skipPermissionCheck) + { + for each (item in parsedArgs.pathNode.children) + { + if (itemIsAllowed(item) && !(item.type in ignoredTypes)) + { + if (evalChildFolders) + { + hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; + } + + items.push( + { + node: item, + hasSubfolders: hasSubfolders + }); + } + } + } + else + { + for each (item in parsedArgs.pathNode.children) + { + if (itemIsAllowed(item) && !(item.type in ignoredTypes)) + { + //capabilities = {}; + rmNode = rmService.getRecordsManagementNode(item); + + //for each (cap in rmNode.capabilitiesSet("Create")) + //{ + // capabilities[cap.name] = true; + //} + + // + + hasCreateCapability = rmNode.hasCapability("Create"); + + if (evalChildFolders) + { + hasSubfolders = item.childFileFolders(false, true, "fm:forum").length > 0; + } + + items.push( + { + node: item, + hasSubfolders: hasSubfolders, + permissions: + { + create: hasCreateCapability + } + }); + } + } + } + + items.sort(sortByName); + + return ( + { + parent: parsedArgs.pathNode, + resultsTrimmed: false, + items: items + }); + } + catch(e) + { + status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, e.toString()); + return; + } +} + + +/* Sort the results by case-insensitive name */ +function sortByName(a, b) +{ + return (b.node.name.toLowerCase() > a.node.name.toLowerCase() ? -1 : 1); +} + +/* Filter allowed types, etc. */ +function itemIsAllowed(item) +{ + // Must be a subtype of cm:folder + if (!item.isSubType("cm:folder")) + { + return false; + } + + var typeShort = String(item.typeShort); + + // Don't show Hold and Transfer top-level containers + if (typeShort == "rma:holdContainer" || typeShort == "rma:transferContainer" || typeShort == "rma:unfiledRecordContainer") + { + return false; + } + + // Must be a "dod:" or "rma:" namespaced type + if (typeShort.indexOf("dod:") !== 0 && typeShort.indexOf("rma") !== 0) + { + return false; + } + + return true; +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.json.ftl index ccefa6d75d..073818addf 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/rm-treenode.get.json.ftl @@ -1,65 +1,65 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#assign p = treenode.parent> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "totalResults": ${treenode.items?size?c}, - "resultsTrimmed": ${treenode.resultsTrimmed?string}, - "parent": - { - "nodeRef": "${p.nodeRef}", - "userAccess": - { - "create": ${p.hasPermission("CreateChildren")?string}, - "edit": ${p.hasPermission("Write")?string}, - "delete": ${p.hasPermission("Delete")?string} - } - }, - "items": - [ - <#list treenode.items as item> - <#assign t = item.node> - { - <#if item.permissions??> - "userAccess": - { - <#list item.permissions?keys as perm> - <#if item.permissions[perm]?is_boolean> - "${perm?string}": ${item.permissions[perm]?string}<#if perm_has_next>, - - - }, - - "nodeRef": "${t.nodeRef}", - "name": "${t.name}", - "description": "${(t.properties.description!"")}", - "hasChildren": ${item.hasSubfolders?string} - }<#if item_has_next>, - - ] -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#assign p = treenode.parent> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "totalResults": ${treenode.items?size?c}, + "resultsTrimmed": ${treenode.resultsTrimmed?string}, + "parent": + { + "nodeRef": "${p.nodeRef}", + "userAccess": + { + "create": ${p.hasPermission("CreateChildren")?string}, + "edit": ${p.hasPermission("Write")?string}, + "delete": ${p.hasPermission("Delete")?string} + } + }, + "items": + [ + <#list treenode.items as item> + <#assign t = item.node> + { + <#if item.permissions??> + "userAccess": + { + <#list item.permissions?keys as perm> + <#if item.permissions[perm]?is_boolean> + "${perm?string}": ${item.permissions[perm]?string}<#if perm_has_next>, + + + }, + + "nodeRef": "${t.nodeRef}", + "name": "${t.name}", + "description": "${(t.properties.description!"")}", + "hasChildren": ${item.hasSubfolders?string} + }<#if item_has_next>, + + ] +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.desc.xml index 6a453de08a..878c391608 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.desc.xml @@ -1,8 +1,8 @@ - - RM node metadata retrieval service - Used by the extended RM forms service to retrieve RM node metadata. - /api/rmmetadata?noderef={noderef?}&type={type?}&extended={extended?} - - user - required + + RM node metadata retrieval service + Used by the extended RM forms service to retrieve RM node metadata. + /api/rmmetadata?noderef={noderef?}&type={type?}&extended={extended?} + + user + required \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.json.ftl index ef1e088dc0..ce56bb5731 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/forms/metadata.get.json.ftl @@ -1,42 +1,42 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "kind" : "${kind}" - <#if extended> - , - "aspects": - [ - <#list aspects as aspect> - { - "name": "${aspect.name}", - "prefixedName": "${aspect.prefixedName}" - } - <#if aspect_has_next>, - - ] - -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "kind" : "${kind}" + <#if extended> + , + "aspects": + [ + <#list aspects as aspect> + { + "name": "${aspect.name}", + "prefixedName": "${aspect.prefixedName}" + } + <#if aspect_has_next>, + + ] + +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.desc.xml index 624373ee3b..7cec801193 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.desc.xml @@ -1,9 +1,9 @@ - - RM Faceted Search - RM Faceted Search Component Data Webscript - /slingshot/rmsearch/faceted/rmsearch?term={term?}&tag={tag?}&site={site?}&container={container?}&sort={sort?}&query={query?}&repo={repo?} - argument - user - required - internal + + RM Faceted Search + RM Faceted Search Component Data Webscript + /slingshot/rmsearch/faceted/rmsearch?term={term?}&tag={tag?}&site={site?}&container={container?}&sort={sort?}&query={query?}&repo={repo?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js index 620e89fd89..cf0b1edde8 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.js @@ -1,53 +1,53 @@ - - - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -function main() { - var params = - { - siteId: args.site, - containerId: args.container, - repo: (args.repo !== null) ? (args.repo == "true") : false, - term: args.term, - tag: args.tag, - query: args.query, - rootNode: args.rootNode, - sort: args.sort, - maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, - pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE, - startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0, - facetFields: args.facetFields, - filters: args.filters, - spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false - }; - - model.data = getSearchResults(params); -}; - -main(); + + + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +function main() { + var params = + { + siteId: args.site, + containerId: args.container, + repo: (args.repo !== null) ? (args.repo == "true") : false, + term: args.term, + tag: args.tag, + query: args.query, + rootNode: args.rootNode, + sort: args.sort, + maxResults: (args.maxResults !== null) ? parseInt(args.maxResults, 10) : DEFAULT_MAX_RESULTS, + pageSize: (args.pageSize !== null) ? parseInt(args.pageSize, 10) : DEFAULT_PAGE_SIZE, + startIndex: (args.startIndex !== null) ? parseInt(args.startIndex, 10) : 0, + facetFields: args.facetFields, + filters: args.filters, + spell: (args.spellcheck !== null) ? (args.spellcheck == "true") : false + }; + + model.data = getSearchResults(params); +}; + +main(); diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.json.ftl index 15ea60621e..54bf33f655 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.get.json.ftl @@ -1,115 +1,115 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#--Copied from Share's search.get.json.ftl with RM specific additions noted below:--> -<#escape x as jsonUtils.encodeJSONString(x)> -{ -"totalRecords": ${data.paging.totalRecords?c}, -"totalRecordsUpper": ${data.paging.totalRecordsUpper?c}, -"startIndex": ${data.paging.startIndex?c}, -"numberFound": ${(data.paging.numberFound!-1)?c}, -"facets": -{ - <#if data.facets??><#list data.facets?keys as field> - "${field}": - [ - <#assign facets=data.facets[field]><#list facets as f> - { - "label": "${f.facetLabel}", - "value": "${f.facetValue}", - "hits": ${f.hits?c}, - "index": ${f.facetLabelIndex?c} - }<#if f_has_next>, - - ]<#if field_has_next>, - -}, -"items": -[ - <#list data.items as item> - { - "nodeRef": "${item.nodeRef}", - "type": "${item.type}", - "name": "${item.name!''}", - "displayName": "${item.displayName!''}", - <#if item.title??> - "title": "${item.title}", - - "description": "${item.description!''}", - "modifiedOn": "${xmldate(item.modifiedOn)}", - "modifiedByUser": "${item.modifiedByUser}", - "modifiedBy": "${item.modifiedBy}", - "fromDate": "${xmldate(item.fromDate)}", - "size": ${item.size?c}, - "mimetype": "${item.mimetype!''}", - <#if item.site??> - "site": - { - "shortName": "${item.site.shortName}", - "title": "${item.site.title}" - }, - "container": "${item.container}", - - <#if item.path??> - "path": "${item.path}", - - "lastThumbnailModification": - [ - <#if item.lastThumbnailModification??> - <#list item.lastThumbnailModification as lastThumbnailMod> - "${lastThumbnailMod}" - <#if lastThumbnailMod_has_next>, - - - ], - "tags": [<#list item.tags as tag>"${tag}"<#if tag_has_next>,] - <#--Add in full node details, if they exist--> - <#if item.nodeJSON??> - ,"node": <#noescape>${item.nodeJSON} - - }<#if item_has_next>, - -], -"spellcheck": -{ - <#if data.spellcheck?? && data.spellcheck.spellCheckExist> - "searchRequest": "${data.spellcheck.originalSearchTerm}", - <#if data.spellcheck.searchedFor> - <#list data.spellcheck.results as collationQueryStr> - "searchedFor": "${collationQueryStr?string}" - <#break> - - <#else> - "searchSuggestions": [ - <#list data.spellcheck.results as suggestion> - "${suggestion?string}"<#if suggestion_has_next>, - - ] - - -} -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#--Copied from Share's search.get.json.ftl with RM specific additions noted below:--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ +"totalRecords": ${data.paging.totalRecords?c}, +"totalRecordsUpper": ${data.paging.totalRecordsUpper?c}, +"startIndex": ${data.paging.startIndex?c}, +"numberFound": ${(data.paging.numberFound!-1)?c}, +"facets": +{ + <#if data.facets??><#list data.facets?keys as field> + "${field}": + [ + <#assign facets=data.facets[field]><#list facets as f> + { + "label": "${f.facetLabel}", + "value": "${f.facetValue}", + "hits": ${f.hits?c}, + "index": ${f.facetLabelIndex?c} + }<#if f_has_next>, + + ]<#if field_has_next>, + +}, +"items": +[ + <#list data.items as item> + { + "nodeRef": "${item.nodeRef}", + "type": "${item.type}", + "name": "${item.name!''}", + "displayName": "${item.displayName!''}", + <#if item.title??> + "title": "${item.title}", + + "description": "${item.description!''}", + "modifiedOn": "${xmldate(item.modifiedOn)}", + "modifiedByUser": "${item.modifiedByUser}", + "modifiedBy": "${item.modifiedBy}", + "fromDate": "${xmldate(item.fromDate)}", + "size": ${item.size?c}, + "mimetype": "${item.mimetype!''}", + <#if item.site??> + "site": + { + "shortName": "${item.site.shortName}", + "title": "${item.site.title}" + }, + "container": "${item.container}", + + <#if item.path??> + "path": "${item.path}", + + "lastThumbnailModification": + [ + <#if item.lastThumbnailModification??> + <#list item.lastThumbnailModification as lastThumbnailMod> + "${lastThumbnailMod}" + <#if lastThumbnailMod_has_next>, + + + ], + "tags": [<#list item.tags as tag>"${tag}"<#if tag_has_next>,] + <#--Add in full node details, if they exist--> + <#if item.nodeJSON??> + ,"node": <#noescape>${item.nodeJSON} + + }<#if item_has_next>, + +], +"spellcheck": +{ + <#if data.spellcheck?? && data.spellcheck.spellCheckExist> + "searchRequest": "${data.spellcheck.originalSearchTerm}", + <#if data.spellcheck.searchedFor> + <#list data.spellcheck.results as collationQueryStr> + "searchedFor": "${collationQueryStr?string}" + <#break> + + <#else> + "searchSuggestions": [ + <#list data.spellcheck.results as suggestion> + "${suggestion?string}"<#if suggestion_has_next>, + + ] + + +} +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js index 35ffb2bb0f..9cb01a588e 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/faceted/rmsearch.lib.js @@ -1,51 +1,51 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ -// RM Search Lib. - -// Wrap the original document item method with our own one that appends RM specific properties. -// Additional properties will also need rendering in rmsearch.get.json.ftl. -var getOriginalDocumentItem = getDocumentItem, - getOriginalRepositoryItem = getRepositoryItem; -getDocumentItem = function(siteId, containerId, pathParts, node, populate){ - // Get original Document item. - var item = getOriginalDocumentItem(siteId, containerId, pathParts, node, populate); - - item.nodeJSON = appUtils.toJSON(node, true); - - return item; -}; - -getRepositoryItem = function(folderPath, node, populate){ - // Get Original Repo item - var item = getOriginalRepositoryItem(folderPath, node, populate); - - if (item.type === "document") { - item.nodeJSON = appUtils.toJSON(node, true); - } - - return item; -}; +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ +// RM Search Lib. + +// Wrap the original document item method with our own one that appends RM specific properties. +// Additional properties will also need rendering in rmsearch.get.json.ftl. +var getOriginalDocumentItem = getDocumentItem, + getOriginalRepositoryItem = getRepositoryItem; +getDocumentItem = function(siteId, containerId, pathParts, node, populate){ + // Get original Document item. + var item = getOriginalDocumentItem(siteId, containerId, pathParts, node, populate); + + item.nodeJSON = appUtils.toJSON(node, true); + + return item; +}; + +getRepositoryItem = function(folderPath, node, populate){ + // Get Original Repo item + var item = getOriginalRepositoryItem(folderPath, node, populate); + + if (item.type === "document") { + item.nodeJSON = appUtils.toJSON(node, true); + } + + return item; +}; diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.desc.xml index ea338656dc..d5cb481437 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.desc.xml @@ -1,9 +1,9 @@ - - rmsavedsearches - RM Saved Searches - /slingshot/rmsavedsearches/site/{site}/{name} - argument - user - required - internal + + rmsavedsearches + RM Saved Searches + /slingshot/rmsavedsearches/site/{site}/{name} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.json.ftl index 9006378dcc..fbde0663f8 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.delete.json.ftl @@ -1,29 +1,29 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "success": ${success?string} -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "success": ${success?string} +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.desc.xml index f7824c206b..7a030401e0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.desc.xml @@ -1,9 +1,9 @@ - - rmsavedsearches - RM Saved Searches - /slingshot/rmsavedsearches/site/{site}?p={public?} - argument - user - required - internal + + rmsavedsearches + RM Saved Searches + /slingshot/rmsavedsearches/site/{site}?p={public?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.json.ftl index 7d07332a36..7de94c4da3 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.get.json.ftl @@ -1,42 +1,42 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "items": - [ - <#list savedSearches as s> - { - "name": "${s.name}", - "description": "${s.description!""}", - "query": "${s.query}", - "params": "${s.params}", - "sort": "${s.sort}" - }<#if s_has_next>, - - ] -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "items": + [ + <#list savedSearches as s> + { + "name": "${s.name}", + "description": "${s.description!""}", + "query": "${s.query}", + "params": "${s.params}", + "sort": "${s.sort}" + }<#if s_has_next>, + + ] +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.desc.xml index dd07b5143c..f48520e4cd 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.desc.xml @@ -1,9 +1,9 @@ - - rmsavedsearches - RM Saved Searches - /slingshot/rmsavedsearches/site/{site} - argument - user - required - internal + + rmsavedsearches + RM Saved Searches + /slingshot/rmsavedsearches/site/{site} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.json.ftl index 9006378dcc..fbde0663f8 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsavedsearches.post.json.ftl @@ -1,29 +1,29 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -{ - "success": ${success?string} -} +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +{ + "success": ${success?string} +} diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.desc.xml index c97310a712..e001ab570b 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.desc.xml @@ -1,9 +1,9 @@ - - rmsearch - Record Search Component Data Webscript - /slingshot/rmsearch/{site}?query={query?}&sortby={sortby?}&filters={filters?}&maxitems={maxitems?} - argument - user - required - internal + + rmsearch + Record Search Component Data Webscript + /slingshot/rmsearch/{site}?query={query?}&sortby={sortby?}&filters={filters?}&maxitems={maxitems?} + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.json.ftl index d00288ca63..c8ad869415 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearch.get.json.ftl @@ -1,74 +1,74 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - <#if !errorMessage??> - "items": - [ - <#list items as item> - { - "nodeRef": "${item.nodeRef}", - "type": "${item.type}", - "name": "${item.name}", - "title": "${item.title!''}", - "description": "${item.description!''}", - "modifiedOn": "${xmldate(item.modifiedOn)}", - "modifiedByUser": "${item.modifiedByUser}", - "modifiedBy": "${item.modifiedBy}", - "createdOn": "${xmldate(item.createdOn)}", - "createdByUser": "${item.createdByUser}", - "createdBy": "${item.createdBy}", - "author": "${item.author!''}", - "size": ${item.size?c}, - <#if item.browseUrl??>"browseUrl": "${item.browseUrl}", - "parentFolder": "${item.parentFolder!""}", - "properties": - { - <#assign first=true> - <#list item.properties?keys as k> - <#if item.properties[k]??> - <#if !first>,<#else><#assign first=false>"${k}": - <#assign prop = item.properties[k]> - <#if prop?is_date>"${xmldate(prop)}" - <#elseif prop?is_boolean>${prop?string("true", "false")} - <#elseif prop?is_enumerable>[<#list prop as p>"${p}"<#if p_has_next>, ] - <#elseif prop?is_number>${prop?c} - <#elseif prop?is_string>"${prop}" - <#elseif prop?is_hash_ex>[<#list prop?values as p>"${p}"<#if p_has_next>, ] - <#else>"${prop}" - - - - } - }<#if item_has_next>, - - ] - <#else> - "errorMessage": "${errorMessage}" - -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + <#if !errorMessage??> + "items": + [ + <#list items as item> + { + "nodeRef": "${item.nodeRef}", + "type": "${item.type}", + "name": "${item.name}", + "title": "${item.title!''}", + "description": "${item.description!''}", + "modifiedOn": "${xmldate(item.modifiedOn)}", + "modifiedByUser": "${item.modifiedByUser}", + "modifiedBy": "${item.modifiedBy}", + "createdOn": "${xmldate(item.createdOn)}", + "createdByUser": "${item.createdByUser}", + "createdBy": "${item.createdBy}", + "author": "${item.author!''}", + "size": ${item.size?c}, + <#if item.browseUrl??>"browseUrl": "${item.browseUrl}", + "parentFolder": "${item.parentFolder!""}", + "properties": + { + <#assign first=true> + <#list item.properties?keys as k> + <#if item.properties[k]??> + <#if !first>,<#else><#assign first=false>"${k}": + <#assign prop = item.properties[k]> + <#if prop?is_date>"${xmldate(prop)}" + <#elseif prop?is_boolean>${prop?string("true", "false")} + <#elseif prop?is_enumerable>[<#list prop as p>"${p}"<#if p_has_next>, ] + <#elseif prop?is_number>${prop?c} + <#elseif prop?is_string>"${prop}" + <#elseif prop?is_hash_ex>[<#list prop?values as p>"${p}"<#if p_has_next>, ] + <#else>"${prop}" + + + + } + }<#if item_has_next>, + + ] + <#else> + "errorMessage": "${errorMessage}" + +} + diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.desc.xml b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.desc.xml index 18105dc400..27f2ff01ac 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.desc.xml +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.desc.xml @@ -1,9 +1,9 @@ - - rmsearchproperties - RM Search Properties - /slingshot/rmsearchproperties - argument - user - required - internal + + rmsearchproperties + RM Search Properties + /slingshot/rmsearchproperties + argument + user + required + internal \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.json.ftl b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.json.ftl index ce44357b93..7c7ff4e1b0 100644 --- a/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.json.ftl +++ b/rm-community/rm-community-repo/config/alfresco/templates/webscripts/org/alfresco/slingshot/rmsearch/rmsearchproperties.get.json.ftl @@ -1,53 +1,53 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data" : - { - "groups" : - [ - <#list groups as group> - { - "id" : "${group.id}", - "label" : "${group.label}", - "properties" : - [ - <#list group.properties as property> - { - "prefix" : "${property.prefix}", - "name" : "${property.shortName}", - "label" : "${property.label}", - "type" : "${property.type}" - }<#if property_has_next>, - - ] - }<#if group_has_next>, - - ] - } -} - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#escape x as jsonUtils.encodeJSONString(x)> +{ + "data" : + { + "groups" : + [ + <#list groups as group> + { + "id" : "${group.id}", + "label" : "${group.label}", + "properties" : + [ + <#list group.properties as property> + { + "prefix" : "${property.prefix}", + "name" : "${property.shortName}", + "label" : "${property.label}", + "type" : "${property.type}" + }<#if property_has_next>, + + ] + }<#if group_has_next>, + + ] + } +} + diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/requestInfo.bpmn20.xml b/rm-community/rm-community-repo/config/alfresco/workflow/requestInfo.bpmn20.xml index 9731a15c90..3959a8f7ae 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/requestInfo.bpmn20.xml +++ b/rm-community/rm-community-repo/config/alfresco/workflow/requestInfo.bpmn20.xml @@ -1,102 +1,102 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages.properties index 4f8a890799..84187d7633 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=Information requested for the record -activitiReviewPooled.workflow.info.provided=Information provided for the record -activitiReviewPooled.workflow.email.subject=Information provided for the record -activitiReviewPooled.workflow.email.body1=The user -activitiReviewPooled.workflow.email.body2=has provided the information required for the record. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Workflow Task -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Workflow Task -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Requested Information -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Requested Information -rmwf_workflowmodel.property.rmwf_message.title=Message -rmwf_workflowmodel.property.rmwf_message.decription=Message - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Request Information Task -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Request Information Task -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Assignees -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Assignees - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Request Information Task -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Request Information Task - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Request Information Task +activitiReviewPooled.workflow.info.requested=Information requested for the record +activitiReviewPooled.workflow.info.provided=Information provided for the record +activitiReviewPooled.workflow.email.subject=Information provided for the record +activitiReviewPooled.workflow.email.body1=The user +activitiReviewPooled.workflow.email.body2=has provided the information required for the record. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=Workflow Task +rmwf_workflowmodel.type.rmwf_workflowTask.decription=Workflow Task +rmwf_workflowmodel.property.rmwf_requestedInformation.title=Requested Information +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Requested Information +rmwf_workflowmodel.property.rmwf_message.title=Message +rmwf_workflowmodel.property.rmwf_message.decription=Message + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Request Information Task +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Request Information Task +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Assignees +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Assignees + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Request Information Task +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Request Information Task + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Request Information Task rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Request Information Task \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_de.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_de.properties index ef75f7bc82..432bdd708c 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_de.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_de.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=Informationen f\u00fcr Record angefordert -activitiReviewPooled.workflow.info.provided=Informationen f\u00fcr Record bereitgestellt -activitiReviewPooled.workflow.email.subject=Informationen f\u00fcr Record bereitgestellt -activitiReviewPooled.workflow.email.body1=Der Benutzer -activitiReviewPooled.workflow.email.body2=hat die f\u00fcr den Record erforderlichen Informationen bereitgestellt. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Aufgabe im Workflow -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Aufgabe im Workflow -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Angeforderte Informationen -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Angeforderte Informationen -rmwf_workflowmodel.property.rmwf_message.title=Nachricht -rmwf_workflowmodel.property.rmwf_message.decription=Nachricht - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Aufgabe 'Informationen anfordern' -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Aufgabe 'Informationen anfordern' -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Bevollm\u00e4chtigte -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Bevollm\u00e4chtigte - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Aufgabe 'Informationen anfordern' -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Aufgabe 'Informationen anfordern' - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Aufgabe 'Informationen anfordern' +activitiReviewPooled.workflow.info.requested=Informationen f\u00fcr Record angefordert +activitiReviewPooled.workflow.info.provided=Informationen f\u00fcr Record bereitgestellt +activitiReviewPooled.workflow.email.subject=Informationen f\u00fcr Record bereitgestellt +activitiReviewPooled.workflow.email.body1=Der Benutzer +activitiReviewPooled.workflow.email.body2=hat die f\u00fcr den Record erforderlichen Informationen bereitgestellt. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=Aufgabe im Workflow +rmwf_workflowmodel.type.rmwf_workflowTask.decription=Aufgabe im Workflow +rmwf_workflowmodel.property.rmwf_requestedInformation.title=Angeforderte Informationen +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Angeforderte Informationen +rmwf_workflowmodel.property.rmwf_message.title=Nachricht +rmwf_workflowmodel.property.rmwf_message.decription=Nachricht + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Aufgabe 'Informationen anfordern' +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Aufgabe 'Informationen anfordern' +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Bevollm\u00e4chtigte +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Bevollm\u00e4chtigte + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Aufgabe 'Informationen anfordern' +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Aufgabe 'Informationen anfordern' + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Aufgabe 'Informationen anfordern' rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Aufgabe 'Informationen anfordern' \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_es.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_es.properties index 9be2617ad4..e6c63ef0f0 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_es.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_es.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=Informaci\u00f3n solicitada para el documento de archivo -activitiReviewPooled.workflow.info.provided=Informaci\u00f3n proporcionada para el documento de archivo -activitiReviewPooled.workflow.email.subject=Informaci\u00f3n proporcionada para el documento de archivo -activitiReviewPooled.workflow.email.body1=El usuario -activitiReviewPooled.workflow.email.body2=ha proporcionado la informaci\u00f3n requerida para el documento de archivo. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Tarea de flujo de trabajo -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Tarea de flujo de trabajo -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informaci\u00f3n solicitada -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informaci\u00f3n solicitada -rmwf_workflowmodel.property.rmwf_message.title=Mensaje -rmwf_workflowmodel.property.rmwf_message.decription=Mensaje - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Tarea de solicitud de informaci\u00f3n -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Tarea de solicitud de informaci\u00f3n -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Usuarios a asignar la tarea -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Usuarios a asignar la tarea - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Tarea de solicitud de informaci\u00f3n -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Tarea de solicitud de informaci\u00f3n - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Tarea de solicitud de informaci\u00f3n +activitiReviewPooled.workflow.info.requested=Informaci\u00f3n solicitada para el documento de archivo +activitiReviewPooled.workflow.info.provided=Informaci\u00f3n proporcionada para el documento de archivo +activitiReviewPooled.workflow.email.subject=Informaci\u00f3n proporcionada para el documento de archivo +activitiReviewPooled.workflow.email.body1=El usuario +activitiReviewPooled.workflow.email.body2=ha proporcionado la informaci\u00f3n requerida para el documento de archivo. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=Tarea de flujo de trabajo +rmwf_workflowmodel.type.rmwf_workflowTask.decription=Tarea de flujo de trabajo +rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informaci\u00f3n solicitada +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informaci\u00f3n solicitada +rmwf_workflowmodel.property.rmwf_message.title=Mensaje +rmwf_workflowmodel.property.rmwf_message.decription=Mensaje + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Tarea de solicitud de informaci\u00f3n +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Tarea de solicitud de informaci\u00f3n +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Usuarios a asignar la tarea +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Usuarios a asignar la tarea + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Tarea de solicitud de informaci\u00f3n +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Tarea de solicitud de informaci\u00f3n + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Tarea de solicitud de informaci\u00f3n rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Tarea de solicitud de informaci\u00f3n \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_fr.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_fr.properties index c6e505982b..af53402c90 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_fr.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_fr.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=Demande d'informations pour le document d'archives -activitiReviewPooled.workflow.info.provided=Informations fournies pour le document d'archives -activitiReviewPooled.workflow.email.subject=Informations fournies pour le document d'archives -activitiReviewPooled.workflow.email.body1=L'utilisateur -activitiReviewPooled.workflow.email.body2=a fourni les informations requises pour le document d'archives. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=T\u00e2che du workflow -rmwf_workflowmodel.type.rmwf_workflowTask.decription=T\u00e2che du workflow -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informations demand\u00e9es -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informations demand\u00e9es -rmwf_workflowmodel.property.rmwf_message.title=Message -rmwf_workflowmodel.property.rmwf_message.decription=Message - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=T\u00e2che de demande d'informations -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=T\u00e2che de demande d'informations -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Acteurs -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Acteurs - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=T\u00e2che de demande d'informations -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=T\u00e2che de demande d'informations - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=T\u00e2che de demande d'informations +activitiReviewPooled.workflow.info.requested=Demande d'informations pour le document d'archives +activitiReviewPooled.workflow.info.provided=Informations fournies pour le document d'archives +activitiReviewPooled.workflow.email.subject=Informations fournies pour le document d'archives +activitiReviewPooled.workflow.email.body1=L'utilisateur +activitiReviewPooled.workflow.email.body2=a fourni les informations requises pour le document d'archives. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=T\u00e2che du workflow +rmwf_workflowmodel.type.rmwf_workflowTask.decription=T\u00e2che du workflow +rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informations demand\u00e9es +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informations demand\u00e9es +rmwf_workflowmodel.property.rmwf_message.title=Message +rmwf_workflowmodel.property.rmwf_message.decription=Message + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=T\u00e2che de demande d'informations +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=T\u00e2che de demande d'informations +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Acteurs +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Acteurs + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=T\u00e2che de demande d'informations +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=T\u00e2che de demande d'informations + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=T\u00e2che de demande d'informations rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=T\u00e2che de demande d'informations \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_it.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_it.properties index 159d8c24b9..a73244009a 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_it.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_it.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=Informazioni richieste per il record -activitiReviewPooled.workflow.info.provided=Informazioni fornite per il record -activitiReviewPooled.workflow.email.subject=Informazioni fornite per il record -activitiReviewPooled.workflow.email.body1=L'utente -activitiReviewPooled.workflow.email.body2=ha fornito le informazioni richieste per il record. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Attivit\u00e0 del flusso di lavoro -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Attivit\u00e0 del flusso di lavoro -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informazioni richieste -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informazioni richieste -rmwf_workflowmodel.property.rmwf_message.title=Messaggio -rmwf_workflowmodel.property.rmwf_message.decription=Messaggio - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Attivit\u00e0 di richiesta informazioni -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Attivit\u00e0 di richiesta informazioni -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Assegnatari -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Assegnatari - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Attivit\u00e0 di richiesta informazioni -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Attivit\u00e0 di richiesta informazioni - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Attivit\u00e0 di richiesta informazioni +activitiReviewPooled.workflow.info.requested=Informazioni richieste per il record +activitiReviewPooled.workflow.info.provided=Informazioni fornite per il record +activitiReviewPooled.workflow.email.subject=Informazioni fornite per il record +activitiReviewPooled.workflow.email.body1=L'utente +activitiReviewPooled.workflow.email.body2=ha fornito le informazioni richieste per il record. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=Attivit\u00e0 del flusso di lavoro +rmwf_workflowmodel.type.rmwf_workflowTask.decription=Attivit\u00e0 del flusso di lavoro +rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informazioni richieste +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informazioni richieste +rmwf_workflowmodel.property.rmwf_message.title=Messaggio +rmwf_workflowmodel.property.rmwf_message.decription=Messaggio + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Attivit\u00e0 di richiesta informazioni +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Attivit\u00e0 di richiesta informazioni +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Assegnatari +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Assegnatari + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Attivit\u00e0 di richiesta informazioni +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Attivit\u00e0 di richiesta informazioni + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Attivit\u00e0 di richiesta informazioni rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Attivit\u00e0 di richiesta informazioni \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ja.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ja.properties index 70d58d9100..eed2793d70 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ja.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ja.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 -activitiReviewPooled.workflow.info.provided=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u63d0\u4f9b\u3055\u308c\u305f\u60c5\u5831 -activitiReviewPooled.workflow.email.subject=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u63d0\u4f9b\u3055\u308c\u305f\u60c5\u5831 -activitiReviewPooled.workflow.email.body1=\u30e6\u30fc\u30b6\u30fc\u304c -activitiReviewPooled.workflow.email.body2=\u30ec\u30b3\u30fc\u30c9\u306b\u5fc5\u8981\u306a\u60c5\u5831\u3092\u63d0\u4f9b\u3057\u307e\u3057\u305f\u3002 - -rmwf_workflowmodel.type.rmwf_workflowTask.title=\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u30bf\u30b9\u30af -rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u30bf\u30b9\u30af -rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 -rmwf_workflowmodel.property.rmwf_message.title=\u30e1\u30c3\u30bb\u30fc\u30b8 -rmwf_workflowmodel.property.rmwf_message.decription=\u30e1\u30c3\u30bb\u30fc\u30b8 - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u62c5\u5f53\u8005 -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u62c5\u5f53\u8005 - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af +activitiReviewPooled.workflow.info.requested=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 +activitiReviewPooled.workflow.info.provided=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u63d0\u4f9b\u3055\u308c\u305f\u60c5\u5831 +activitiReviewPooled.workflow.email.subject=\u30ec\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u63d0\u4f9b\u3055\u308c\u305f\u60c5\u5831 +activitiReviewPooled.workflow.email.body1=\u30e6\u30fc\u30b6\u30fc\u304c +activitiReviewPooled.workflow.email.body2=\u30ec\u30b3\u30fc\u30c9\u306b\u5fc5\u8981\u306a\u60c5\u5831\u3092\u63d0\u4f9b\u3057\u307e\u3057\u305f\u3002 + +rmwf_workflowmodel.type.rmwf_workflowTask.title=\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u30bf\u30b9\u30af +rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u30bf\u30b9\u30af +rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u60c5\u5831 +rmwf_workflowmodel.property.rmwf_message.title=\u30e1\u30c3\u30bb\u30fc\u30b8 +rmwf_workflowmodel.property.rmwf_message.decription=\u30e1\u30c3\u30bb\u30fc\u30b8 + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u62c5\u5f53\u8005 +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u62c5\u5f53\u8005 + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=\u60c5\u5831\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30bf\u30b9\u30af \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nb.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nb.properties index 561f46950a..aee20d7c6a 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nb.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nb.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=Informasjon som ble forespurt for oppf\u00f8ringen -activitiReviewPooled.workflow.info.provided=Informasjon som er s\u00f8rget for, til oppf\u00f8ringen -activitiReviewPooled.workflow.email.subject=Informasjon som er s\u00f8rget for, til oppf\u00f8ringen -activitiReviewPooled.workflow.email.body1=Brukeren -activitiReviewPooled.workflow.email.body2=har s\u00f8rget for den n\u00f8dvendige informasjonen til oppf\u00f8ringen. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Arbeidsflytoppgave -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Arbeidsflytoppgave -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Forespurt informasjon -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Forespurt informasjon -rmwf_workflowmodel.property.rmwf_message.title=Melding -rmwf_workflowmodel.property.rmwf_message.decription=Melding - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Be om informasjonsoppgave -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Be om informasjonsoppgave -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=De som tilordnes -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=De som tilordnes - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Be om informasjonsoppgave -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Be om informasjonsoppgave - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Be om informasjonsoppgave +activitiReviewPooled.workflow.info.requested=Informasjon som ble forespurt for oppf\u00f8ringen +activitiReviewPooled.workflow.info.provided=Informasjon som er s\u00f8rget for, til oppf\u00f8ringen +activitiReviewPooled.workflow.email.subject=Informasjon som er s\u00f8rget for, til oppf\u00f8ringen +activitiReviewPooled.workflow.email.body1=Brukeren +activitiReviewPooled.workflow.email.body2=har s\u00f8rget for den n\u00f8dvendige informasjonen til oppf\u00f8ringen. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=Arbeidsflytoppgave +rmwf_workflowmodel.type.rmwf_workflowTask.decription=Arbeidsflytoppgave +rmwf_workflowmodel.property.rmwf_requestedInformation.title=Forespurt informasjon +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Forespurt informasjon +rmwf_workflowmodel.property.rmwf_message.title=Melding +rmwf_workflowmodel.property.rmwf_message.decription=Melding + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Be om informasjonsoppgave +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Be om informasjonsoppgave +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=De som tilordnes +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=De som tilordnes + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Be om informasjonsoppgave +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Be om informasjonsoppgave + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Be om informasjonsoppgave rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Be om informasjonsoppgave \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nl.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nl.properties index b36974a238..1d5c8a921d 100755 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nl.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_nl.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=Informatie aangevraagd voor de record -activitiReviewPooled.workflow.info.provided=Informatie aangeleverd voor de record -activitiReviewPooled.workflow.email.subject=Informatie aangeleverd voor de record -activitiReviewPooled.workflow.email.body1=De gebruiker -activitiReviewPooled.workflow.email.body2=heeft de vereiste informatie voor de record aangeleverd. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Workflowtaak -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Workflowtaak -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Aangevraagde informatie -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Aangevraagde informatie -rmwf_workflowmodel.property.rmwf_message.title=Bericht -rmwf_workflowmodel.property.rmwf_message.decription=Bericht - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Informatie-aanvraagtaak -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Informatie-aanvraagtaak -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Uitvoerders -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Uitvoerders - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Informatie-aanvraagtaak -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Informatie-aanvraagtaak - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Informatie-aanvraagtaak +activitiReviewPooled.workflow.info.requested=Informatie aangevraagd voor de record +activitiReviewPooled.workflow.info.provided=Informatie aangeleverd voor de record +activitiReviewPooled.workflow.email.subject=Informatie aangeleverd voor de record +activitiReviewPooled.workflow.email.body1=De gebruiker +activitiReviewPooled.workflow.email.body2=heeft de vereiste informatie voor de record aangeleverd. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=Workflowtaak +rmwf_workflowmodel.type.rmwf_workflowTask.decription=Workflowtaak +rmwf_workflowmodel.property.rmwf_requestedInformation.title=Aangevraagde informatie +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Aangevraagde informatie +rmwf_workflowmodel.property.rmwf_message.title=Bericht +rmwf_workflowmodel.property.rmwf_message.decription=Bericht + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Informatie-aanvraagtaak +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Informatie-aanvraagtaak +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Uitvoerders +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Uitvoerders + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Informatie-aanvraagtaak +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Informatie-aanvraagtaak + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Informatie-aanvraagtaak rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Informatie-aanvraagtaak \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_pt_BR.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_pt_BR.properties index 3f7d40eb74..b12bc3ed0e 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_pt_BR.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_pt_BR.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=Informa\u00e7\u00f5es solicitadas do documento arquiv\u00edstico -activitiReviewPooled.workflow.info.provided=Informa\u00e7\u00f5es fornecidas do documento arquiv\u00edstico -activitiReviewPooled.workflow.email.subject=Informa\u00e7\u00f5es fornecidas do documento arquiv\u00edstico -activitiReviewPooled.workflow.email.body1=O usu\u00e1rio -activitiReviewPooled.workflow.email.body2=forneceu as informa\u00e7\u00f5es necess\u00e1rias do documento arquiv\u00edstico. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Tarefa de fluxo de trabalho -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Tarefa de fluxo de trabalho -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informa\u00e7\u00f5es solicitadas -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informa\u00e7\u00f5es solicitadas -rmwf_workflowmodel.property.rmwf_message.title=Mensagem -rmwf_workflowmodel.property.rmwf_message.decription=Mensagem - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Destinat\u00e1rios -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Destinat\u00e1rios - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es +activitiReviewPooled.workflow.info.requested=Informa\u00e7\u00f5es solicitadas do documento arquiv\u00edstico +activitiReviewPooled.workflow.info.provided=Informa\u00e7\u00f5es fornecidas do documento arquiv\u00edstico +activitiReviewPooled.workflow.email.subject=Informa\u00e7\u00f5es fornecidas do documento arquiv\u00edstico +activitiReviewPooled.workflow.email.body1=O usu\u00e1rio +activitiReviewPooled.workflow.email.body2=forneceu as informa\u00e7\u00f5es necess\u00e1rias do documento arquiv\u00edstico. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=Tarefa de fluxo de trabalho +rmwf_workflowmodel.type.rmwf_workflowTask.decription=Tarefa de fluxo de trabalho +rmwf_workflowmodel.property.rmwf_requestedInformation.title=Informa\u00e7\u00f5es solicitadas +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Informa\u00e7\u00f5es solicitadas +rmwf_workflowmodel.property.rmwf_message.title=Mensagem +rmwf_workflowmodel.property.rmwf_message.decription=Mensagem + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=Destinat\u00e1rios +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=Destinat\u00e1rios + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Tarefa de solicita\u00e7\u00e3o de informa\u00e7\u00f5es \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ru.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ru.properties index 9c94c17859..3abcd96a93 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ru.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_ru.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 -activitiReviewPooled.workflow.info.provided=\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 -activitiReviewPooled.workflow.email.subject=\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 -activitiReviewPooled.workflow.email.body1=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c -activitiReviewPooled.workflow.email.body2=\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 -rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u0417\u0430\u0434\u0430\u0447\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 -rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e -rmwf_workflowmodel.property.rmwf_message.title=\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 -rmwf_workflowmodel.property.rmwf_message.decription=\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 +activitiReviewPooled.workflow.info.requested=\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 +activitiReviewPooled.workflow.info.provided=\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 +activitiReviewPooled.workflow.email.subject=\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 +activitiReviewPooled.workflow.email.body1=\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c +activitiReviewPooled.workflow.email.body2=\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438. + +rmwf_workflowmodel.type.rmwf_workflowTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 +rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u0417\u0430\u0434\u0430\u0447\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 +rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e +rmwf_workflowmodel.property.rmwf_message.title=\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 +rmwf_workflowmodel.property.rmwf_message.decription=\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u0438 + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=\u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_zh_CN.properties b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_zh_CN.properties index 12047dd7d9..272c703087 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_zh_CN.properties +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rm-workflow-messages_zh_CN.properties @@ -1,23 +1,23 @@ -activitiReviewPooled.workflow.info.requested=\u4e3a\u8bb0\u5f55\u8bf7\u6c42\u7684\u4fe1\u606f -activitiReviewPooled.workflow.info.provided=\u4e3a\u8bb0\u5f55\u63d0\u4f9b\u7684\u4fe1\u606f -activitiReviewPooled.workflow.email.subject=\u4e3a\u8bb0\u5f55\u63d0\u4f9b\u7684\u4fe1\u606f -activitiReviewPooled.workflow.email.body1=\u7528\u6237 -activitiReviewPooled.workflow.email.body2=\u5df2\u7ecf\u63d0\u4f9b\u8bb0\u5f55\u6240\u9700\u7684\u4fe1\u606f\u3002 - -rmwf_workflowmodel.type.rmwf_workflowTask.title=\u5de5\u4f5c\u6d41\u7a0b\u4efb\u52a1 -rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u5de5\u4f5c\u6d41\u7a0b\u4efb\u52a1 -rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u8bf7\u6c42\u7684\u4fe1\u606f -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u8bf7\u6c42\u7684\u4fe1\u606f -rmwf_workflowmodel.property.rmwf_message.title=\u6d88\u606f -rmwf_workflowmodel.property.rmwf_message.decription=\u6d88\u606f - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u88ab\u6307\u6d3e\u8005\u6570 -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u88ab\u6307\u6d3e\u8005\u6570 - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 +activitiReviewPooled.workflow.info.requested=\u4e3a\u8bb0\u5f55\u8bf7\u6c42\u7684\u4fe1\u606f +activitiReviewPooled.workflow.info.provided=\u4e3a\u8bb0\u5f55\u63d0\u4f9b\u7684\u4fe1\u606f +activitiReviewPooled.workflow.email.subject=\u4e3a\u8bb0\u5f55\u63d0\u4f9b\u7684\u4fe1\u606f +activitiReviewPooled.workflow.email.body1=\u7528\u6237 +activitiReviewPooled.workflow.email.body2=\u5df2\u7ecf\u63d0\u4f9b\u8bb0\u5f55\u6240\u9700\u7684\u4fe1\u606f\u3002 + +rmwf_workflowmodel.type.rmwf_workflowTask.title=\u5de5\u4f5c\u6d41\u7a0b\u4efb\u52a1 +rmwf_workflowmodel.type.rmwf_workflowTask.decription=\u5de5\u4f5c\u6d41\u7a0b\u4efb\u52a1 +rmwf_workflowmodel.property.rmwf_requestedInformation.title=\u8bf7\u6c42\u7684\u4fe1\u606f +rmwf_workflowmodel.property.rmwf_requestedInformation.decription=\u8bf7\u6c42\u7684\u4fe1\u606f +rmwf_workflowmodel.property.rmwf_message.title=\u6d88\u606f +rmwf_workflowmodel.property.rmwf_message.decription=\u6d88\u606f + +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 +rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 +rmwf_workflowmodel.association.rmwf_mixedAssignees.title=\u88ab\u6307\u6d3e\u8005\u6570 +rmwf_workflowmodel.association.rmwf_mixedAssignees.description=\u88ab\u6307\u6d3e\u8005\u6570 + +rmwf_workflowmodel.type.rmwf_requestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 +rmwf_workflowmodel.type.rmwf_requestInfoTask.description=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 + +rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=\u8bf7\u6c42\u4fe1\u606f\u4efb\u52a1 \ No newline at end of file diff --git a/rm-community/rm-community-repo/config/alfresco/workflow/rmWorkflowModel.xml b/rm-community/rm-community-repo/config/alfresco/workflow/rmWorkflowModel.xml index 33bbf8aa52..7ee9da4b23 100644 --- a/rm-community/rm-community-repo/config/alfresco/workflow/rmWorkflowModel.xml +++ b/rm-community/rm-community-repo/config/alfresco/workflow/rmWorkflowModel.xml @@ -1,62 +1,62 @@ - - - - - - - - - - - - - - - - - - bpm:workflowTask - - - d:text - true - - - d:text - true - - - - - - rmwf:workflowTask - - - - false - false - - - cm:authority - true - true - - - - - - - rmwf:workflowTask - - - - rmwf:workflowTask - - - false - - - - - + + + + + + + + + + + + + + + + + + bpm:workflowTask + + + d:text + true + + + d:text + true + + + + + + rmwf:workflowTask + + + + false + false + + + cm:authority + true + true + + + + + + + rmwf:workflowTask + + + + rmwf:workflowTask + + + false + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_dod5015/caveat/RMListOfValuesConstraint.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_dod5015/caveat/RMListOfValuesConstraint.java index e02a8a32d2..43d36e830d 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_dod5015/caveat/RMListOfValuesConstraint.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_dod5015/caveat/RMListOfValuesConstraint.java @@ -1,41 +1,41 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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_dod5015.caveat; - -/** - * Compatibility Implementation. - *

- * Used as a compatibility implementation when migrating from V1.0 to V2.0. RMCustom model still references - * this class implementation, but package has been changed. - * - * @author Roy Wetherall - */ -public class RMListOfValuesConstraint extends org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint -{ - // No implementation -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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_dod5015.caveat; + +/** + * Compatibility Implementation. + *

+ * Used as a compatibility implementation when migrating from V1.0 to V2.0. RMCustom model still references + * this class implementation, but package has been changed. + * + * @author Roy Wetherall + */ +public class RMListOfValuesConstraint extends org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint +{ + // No implementation +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CannotApplyConstraintMetadataException.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CannotApplyConstraintMetadataException.java index df58361a2f..3cf37d9a8e 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CannotApplyConstraintMetadataException.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CannotApplyConstraintMetadataException.java @@ -1,45 +1,45 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CannotApplyConstraintMetadataException} - */ -public class CannotApplyConstraintMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint"; - - public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType) - { - super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CannotApplyConstraintMetadataException} + */ +public class CannotApplyConstraintMetadataException extends CustomMetadataException +{ + private static final long serialVersionUID = -6194867814140009959L; + public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint"; + + public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType) + { + super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType)); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CustomMetadataException.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CustomMetadataException.java index 876406b601..67de31ca00 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CustomMetadataException.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/CustomMetadataException.java @@ -1,41 +1,41 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException} - */ -public abstract class CustomMetadataException extends Exception -{ - private static final long serialVersionUID = -6676112294794381360L; - - public CustomMetadataException(String msg) - { - super(msg); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +/** + * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException} + */ +public abstract class CustomMetadataException extends Exception +{ + private static final long serialVersionUID = -6676112294794381360L; + + public CustomMetadataException(String msg) + { + super(msg); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/InvalidCustomAspectMetadataException.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/InvalidCustomAspectMetadataException.java index e23d5796ee..e7cb3ce053 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/InvalidCustomAspectMetadataException.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/InvalidCustomAspectMetadataException.java @@ -1,45 +1,45 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.InvalidCustomAspectMetadataException} - */ -public class InvalidCustomAspectMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect"; - - public InvalidCustomAspectMetadataException(QName customAspect, String aspectName) - { - super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.InvalidCustomAspectMetadataException} + */ +public class InvalidCustomAspectMetadataException extends CustomMetadataException +{ + private static final long serialVersionUID = -6194867814140009959L; + public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect"; + + public InvalidCustomAspectMetadataException(QName customAspect, String aspectName) + { + super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName)); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/NotCustomisableMetadataException.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/NotCustomisableMetadataException.java index 318512bc7d..ae8c3586b4 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/NotCustomisableMetadataException.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/NotCustomisableMetadataException.java @@ -1,44 +1,44 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.NotCustomisableMetadataException} - */ -public class NotCustomisableMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable"; - - public NotCustomisableMetadataException(String aspectName) - { - super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.NotCustomisableMetadataException} + */ +public class NotCustomisableMetadataException extends CustomMetadataException +{ + private static final long serialVersionUID = -6194867814140009959L; + public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable"; + + public NotCustomisableMetadataException(String aspectName) + { + super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName)); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/PropertyAlreadyExistsMetadataException.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/PropertyAlreadyExistsMetadataException.java index 5ede0622b4..f7d24d89f7 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/PropertyAlreadyExistsMetadataException.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/PropertyAlreadyExistsMetadataException.java @@ -1,45 +1,45 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.PropertyAlreadyExistsMetadataException} - */ -public class PropertyAlreadyExistsMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - - public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists"; - - public PropertyAlreadyExistsMetadataException(String propIdAsString) - { - super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.PropertyAlreadyExistsMetadataException} + */ +public class PropertyAlreadyExistsMetadataException extends CustomMetadataException +{ + private static final long serialVersionUID = -6194867814140009959L; + + public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists"; + + public PropertyAlreadyExistsMetadataException(String propIdAsString) + { + super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString)); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminService.java index 28411c873e..5e6710736a 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminService.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminService.java @@ -1,37 +1,37 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -/** - * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService} - */ -public interface RecordsManagementAdminService - extends org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService -{ - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +/** + * @deprecated as of 2.1 see {@link org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService} + */ +public interface RecordsManagementAdminService + extends org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService +{ + +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java index d438fda846..f6a5973873 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java @@ -1,308 +1,308 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management service interface. - * - * Allows simple creation, manipulation and querying of records management components. - * - * @author Roy Wetherall - * @deprecated as of 2.2 - */ -public interface RecordsManagementService -{ - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} - */ - @Deprecated - boolean isFilePlanComponent(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKind(NodeRef)} - */ - @Deprecated - FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKindFromType(QName)} - */ - @Deprecated - FilePlanComponentKind getFilePlanComponentKindFromType(QName type); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanContainer(NodeRef)} - */ - @Deprecated - boolean isRecordsManagementContainer(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} - */ - @Deprecated - boolean isFilePlan(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isRecordCategory(NodeRef)} - */ - @Deprecated - boolean isRecordCategory(NodeRef nodeRef); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolder(NodeRef)} - */ - @Deprecated - boolean isRecordFolder(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.2, see {@link TransferService#isTransfer(NodeRef)} - */ - @Deprecated - boolean isTransfer(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.2, see {@link RecordService#isMetadataStub(NodeRef)} - */ - @Deprecated - boolean isMetadataStub(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.2, see {@link DispositionService#isDisposableItemCutoff(NodeRef)} - */ - boolean isCutoff(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)} - */ - @Deprecated - List getNodeRefPath(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlan(NodeRef)} - */ - @Deprecated - NodeRef getFilePlan(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlans()} - */ - @Deprecated - List getFilePlans(); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName)} - */ - @Deprecated - NodeRef createFilePlan(NodeRef parent, String name, QName type); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName, Map)} - */ - @Deprecated - NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String)} - */ - @Deprecated - NodeRef createFilePlan(NodeRef parent, String name); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, Map)} - */ - @Deprecated - NodeRef createFilePlan(NodeRef parent, String name, Map properties); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef, boolean)} - */ - @Deprecated - List getAllContained(NodeRef recordCategory, boolean deep); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef)} - */ - @Deprecated - List getAllContained(NodeRef recordCategory); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} - */ - @Deprecated - List getContainedRecordCategories(NodeRef recordCategory, boolean deep); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef)} - */ - @Deprecated - List getContainedRecordCategories(NodeRef recordCategory); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} - */ - @Deprecated - List getContainedRecordFolders(NodeRef container, boolean deep); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef)} - */ - @Deprecated - List getContainedRecordFolders(NodeRef container); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName)} - */ - @Deprecated - NodeRef createRecordCategory(NodeRef parent, String name, QName type); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName, Map)} - */ - @Deprecated - NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String)} - */ - @Deprecated - NodeRef createRecordCategory(NodeRef parent, String name); - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, Map)} - */ - @Deprecated - NodeRef createRecordCategory(NodeRef parent, String name, Map properties); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderDeclared(NodeRef)} - */ - @Deprecated - boolean isRecordFolderDeclared(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderClosed(NodeRef)} - */ - @Deprecated - boolean isRecordFolderClosed(NodeRef nodeRef); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName)} - */ - @Deprecated - NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName, Map)} - */ - @Deprecated - NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String)} - */ - @Deprecated - NodeRef createRecordFolder(NodeRef parent, String name); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map) - */ - @Deprecated - NodeRef createRecordFolder(NodeRef parent, String name, Map properties); - - /** - * @deprecated As of 2.2, see {@link RecordService#getRecords(NodeRef)} - */ - @Deprecated - List getRecords(NodeRef recordFolder); - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#getRecordFolders(NodeRef)} - */ - @Deprecated - List getRecordFolders(NodeRef record); - - /** - * @deprecated As of 2.1, replaced by {@link RecordService#getRecordMetaDataAspects()} - */ - @Deprecated - Set getRecordMetaDataAspects(); - - /** - * @deprecated As of 2.1, replaced by {@link RecordService#isDeclared(NodeRef)} - */ - @Deprecated - boolean isRecordDeclared(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, replaced by {@link FreezeService#isHold(NodeRef)} - */ - @Deprecated - boolean isHold(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, replaced by {@link FreezeService#isFrozen(NodeRef)} - */ - @Deprecated - boolean isFrozen(NodeRef nodeRef); - - /** - * @since 2.0 - * @deprecated As of 2.1, replaced by {@link FreezeService#hasFrozenChildren(NodeRef)} - */ - @Deprecated - boolean hasFrozenChildren(NodeRef nodeRef); - - /** - * @deprecated As of 2.1, replaced by {@link RecordService#isRecord(NodeRef)} - */ - @Deprecated - boolean isRecord(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Records management service interface. + * + * Allows simple creation, manipulation and querying of records management components. + * + * @author Roy Wetherall + * @deprecated as of 2.2 + */ +public interface RecordsManagementService +{ + /** + * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} + */ + @Deprecated + boolean isFilePlanComponent(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKind(NodeRef)} + */ + @Deprecated + FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKindFromType(QName)} + */ + @Deprecated + FilePlanComponentKind getFilePlanComponentKindFromType(QName type); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanContainer(NodeRef)} + */ + @Deprecated + boolean isRecordsManagementContainer(NodeRef nodeRef); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} + */ + @Deprecated + boolean isFilePlan(NodeRef nodeRef); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#isRecordCategory(NodeRef)} + */ + @Deprecated + boolean isRecordCategory(NodeRef nodeRef); + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolder(NodeRef)} + */ + @Deprecated + boolean isRecordFolder(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.2, see {@link TransferService#isTransfer(NodeRef)} + */ + @Deprecated + boolean isTransfer(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.2, see {@link RecordService#isMetadataStub(NodeRef)} + */ + @Deprecated + boolean isMetadataStub(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.2, see {@link DispositionService#isDisposableItemCutoff(NodeRef)} + */ + boolean isCutoff(NodeRef nodeRef); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)} + */ + @Deprecated + List getNodeRefPath(NodeRef nodeRef); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getFilePlan(NodeRef)} + */ + @Deprecated + NodeRef getFilePlan(NodeRef nodeRef); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getFilePlans()} + */ + @Deprecated + List getFilePlans(); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName)} + */ + @Deprecated + NodeRef createFilePlan(NodeRef parent, String name, QName type); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName, Map)} + */ + @Deprecated + NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String)} + */ + @Deprecated + NodeRef createFilePlan(NodeRef parent, String name); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, Map)} + */ + @Deprecated + NodeRef createFilePlan(NodeRef parent, String name, Map properties); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef, boolean)} + */ + @Deprecated + List getAllContained(NodeRef recordCategory, boolean deep); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef)} + */ + @Deprecated + List getAllContained(NodeRef recordCategory); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} + */ + @Deprecated + List getContainedRecordCategories(NodeRef recordCategory, boolean deep); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef)} + */ + @Deprecated + List getContainedRecordCategories(NodeRef recordCategory); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} + */ + @Deprecated + List getContainedRecordFolders(NodeRef container, boolean deep); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef)} + */ + @Deprecated + List getContainedRecordFolders(NodeRef container); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName)} + */ + @Deprecated + NodeRef createRecordCategory(NodeRef parent, String name, QName type); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName, Map)} + */ + @Deprecated + NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String)} + */ + @Deprecated + NodeRef createRecordCategory(NodeRef parent, String name); + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, Map)} + */ + @Deprecated + NodeRef createRecordCategory(NodeRef parent, String name, Map properties); + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderDeclared(NodeRef)} + */ + @Deprecated + boolean isRecordFolderDeclared(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderClosed(NodeRef)} + */ + @Deprecated + boolean isRecordFolderClosed(NodeRef nodeRef); + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName)} + */ + @Deprecated + NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type); + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName, Map)} + */ + @Deprecated + NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties); + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String)} + */ + @Deprecated + NodeRef createRecordFolder(NodeRef parent, String name); + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map) + */ + @Deprecated + NodeRef createRecordFolder(NodeRef parent, String name, Map properties); + + /** + * @deprecated As of 2.2, see {@link RecordService#getRecords(NodeRef)} + */ + @Deprecated + List getRecords(NodeRef recordFolder); + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#getRecordFolders(NodeRef)} + */ + @Deprecated + List getRecordFolders(NodeRef record); + + /** + * @deprecated As of 2.1, replaced by {@link RecordService#getRecordMetaDataAspects()} + */ + @Deprecated + Set getRecordMetaDataAspects(); + + /** + * @deprecated As of 2.1, replaced by {@link RecordService#isDeclared(NodeRef)} + */ + @Deprecated + boolean isRecordDeclared(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.1, replaced by {@link FreezeService#isHold(NodeRef)} + */ + @Deprecated + boolean isHold(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.1, replaced by {@link FreezeService#isFrozen(NodeRef)} + */ + @Deprecated + boolean isFrozen(NodeRef nodeRef); + + /** + * @since 2.0 + * @deprecated As of 2.1, replaced by {@link FreezeService#hasFrozenChildren(NodeRef)} + */ + @Deprecated + boolean hasFrozenChildren(NodeRef nodeRef); + + /** + * @deprecated As of 2.1, replaced by {@link RecordService#isRecord(NodeRef)} + */ + @Deprecated + boolean isRecord(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java index 31a9e26a37..0d49574dad 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java @@ -1,504 +1,504 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management service implementation. - * - * @author Roy Wetherall - * @deprecated as of 2.2 - */ -public class RecordsManagementServiceImpl extends ServiceBaseImpl - implements RecordsManagementService, - RecordsManagementModel -{ - /** Store that the RM roots are contained within */ - @SuppressWarnings("unused") - @Deprecated - private StoreRef defaultStoreRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; - - /** Service registry */ - private RecordsManagementServiceRegistry serviceRegistry; - - /** - * Set the service registry service - * - * @param serviceRegistry service registry - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry) - { - // Internal ops use the unprotected services from the voter (e.g. nodeService) - this.serviceRegistry = serviceRegistry; - this.dictionaryService = serviceRegistry.getDictionaryService(); - } - - /** - * Sets the default RM store reference - * @param defaultStoreRef store reference - */ - @Deprecated - public void setDefaultStoreRef(StoreRef defaultStoreRef) - { - this.defaultStoreRef = defaultStoreRef; - } - - /** - * @return File plan service - */ - private FilePlanService getFilePlanService() - { - return serviceRegistry.getFilePlanService(); - } - - /** - * @return Record Folder Service - */ - private RecordFolderService getRecordFolderService() - { - return serviceRegistry.getRecordFolderService(); - } - - /** - * @return Record Service - */ - private RecordService getRecordService() - { - return serviceRegistry.getRecordService(); - } - - /** - * @return Freeze Service - */ - private FreezeService getFreezeService() - { - return serviceRegistry.getFreezeService(); - } - - /** - * @return Disposition Service - */ - private DispositionService getDispositionService() - { - return serviceRegistry.getDispositionService(); - } - - /** - * @return Transfer service - */ - private TransferService getTransferService() - { - return serviceRegistry.getTransferService(); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanComponent(NodeRef)} - */ - @Override - public boolean isFilePlanComponent(NodeRef nodeRef) - { - return getFilePlanService().isFilePlanComponent(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKind(NodeRef)} - */ - @Override - public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef) - { - return getFilePlanService().getFilePlanComponentKind(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKindFromType(QName)} - */ - @Override - public FilePlanComponentKind getFilePlanComponentKindFromType(QName type) - { - return getFilePlanService().getFilePlanComponentKindFromType(type); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanContainer(NodeRef)} - */ - @Override - public boolean isRecordsManagementContainer(NodeRef nodeRef) - { - return getFilePlanService().isFilePlanContainer(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} - */ - @Override - public boolean isFilePlan(NodeRef nodeRef) - { - return getFilePlanService().isFilePlan(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#isRecordCategory(NodeRef)} - */ - @Override - public boolean isRecordCategory(NodeRef nodeRef) - { - return getFilePlanService().isRecordCategory(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolder(NodeRef)} - */ - @Override - public boolean isRecordFolder(NodeRef nodeRef) - { - return getRecordFolderService().isRecordFolder(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link TransferService#isTransfer(NodeRef)} - */ - @Override - public boolean isTransfer(NodeRef nodeRef) - { - return getTransferService().isTransfer(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link RecordService#isMetadataStub(NodeRef)} - */ - @Override - public boolean isMetadataStub(NodeRef nodeRef) - { - return getRecordService().isMetadataStub(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link DispositionService#isDisposableItemCutoff(NodeRef)} - */ - @Override - public boolean isCutoff(NodeRef nodeRef) - { - return getDispositionService().isDisposableItemCutoff(nodeRef); - } - - /** - * @deprecated as of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)} - */ - @Override - public List getNodeRefPath(NodeRef nodeRef) - { - return getFilePlanService().getNodeRefPath(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlan(NodeRef)} - */ - @Override - public NodeRef getFilePlan(NodeRef nodeRef) - { - return getFilePlanService().getFilePlan(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getFilePlans()} - */ - @Override - public List getFilePlans() - { - return new ArrayList(getFilePlanService().getFilePlans()); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName)} - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name, QName type) - { - return getFilePlanService().createFilePlan(parent, name, type); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName, Map)} - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties) - { - return getFilePlanService().createFilePlan(parent, name, type, properties); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String)} - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name) - { - return getFilePlanService().createFilePlan(parent, name); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, Map)} - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name, Map properties) - { - return getFilePlanService().createFilePlan(parent, name, properties); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef, boolean)} - */ - @Override - public List getAllContained(NodeRef container, boolean deep) - { - return getFilePlanService().getAllContained(container, deep); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef)} - */ - @Override - public List getAllContained(NodeRef container) - { - return getFilePlanService().getAllContained(container); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} - */ - @Override - public List getContainedRecordCategories(NodeRef container, boolean deep) - { - return getFilePlanService().getContainedRecordCategories(container, deep); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef)} - */ - @Override - public List getContainedRecordCategories(NodeRef container) - { - return getFilePlanService().getContainedRecordCategories(container); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef, boolean)} - */ - @Override - public List getContainedRecordFolders(NodeRef container, boolean deep) - { - return getFilePlanService().getContainedRecordFolders(container, deep); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef)} - */ - @Override - public List getContainedRecordFolders(NodeRef container) - { - return getFilePlanService().getContainedRecordFolders(container); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName)} - */ - @Override - public NodeRef createRecordCategory(NodeRef parent, String name, QName type) - { - return getFilePlanService().createRecordCategory(parent, name, type); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName, Map)} - */ - @Override - public NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties) - { - return getFilePlanService().createRecordCategory(parent, name, type, properties); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String)} - */ - @Override - public NodeRef createRecordCategory(NodeRef parent, String name) - { - return getFilePlanService().createRecordCategory(parent, name); - } - - /** - * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, Map)} - */ - public NodeRef createRecordCategory(NodeRef parent, String name, Map properties) - { - return getFilePlanService().createRecordCategory(parent, name, properties); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderDeclared(NodeRef)} - */ - @Override - public boolean isRecordFolderDeclared(NodeRef recordFolder) - { - return getRecordFolderService().isRecordFolderDeclared(recordFolder); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderClosed(NodeRef)} - */ - @Override - public boolean isRecordFolderClosed(NodeRef nodeRef) - { - return getRecordFolderService().isRecordFolderClosed(nodeRef); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName)} - */ - @Override - public NodeRef createRecordFolder(NodeRef parent, String name, QName type) - { - return getRecordFolderService().createRecordFolder(parent, name, type); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName, Map)} - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties) - { - return getRecordFolderService().createRecordFolder(rmContainer, name, type, properties); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String)} - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContrainer, String name) - { - return getRecordFolderService().createRecordFolder(rmContrainer, name); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map)} - */ - @Override - public NodeRef createRecordFolder(NodeRef parent, String name, Map properties) - { - return getRecordFolderService().createRecordFolder(parent, name, properties); - } - - /** - * @deprecated As of 2.2, see {@link RecordService#getRecords(NodeRef)} - */ - @Override - public List getRecords(NodeRef recordFolder) - { - return getRecordService().getRecords(recordFolder); - } - - /** - * @deprecated As of 2.2, see {@link RecordFolderService#getRecordFolders(NodeRef)} - */ - @Override - public List getRecordFolders(NodeRef record) - { - return getRecordFolderService().getRecordFolders(record); - } - - /** - * @deprecated As of 2.1, see {@link RecordService#getRecordMetaDataAspects()} - */ - @Override - public Set getRecordMetaDataAspects() - { - return getRecordService().getRecordMetaDataAspects(); - } - - /** - * @deprecated As of 2.1, see {@link RecordService#isDeclared(NodeRef)} - */ - @Override - public boolean isRecordDeclared(NodeRef nodeRef) - { - return getRecordService().isDeclared(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FreezeService#isHold(NodeRef)} - */ - @Override - public boolean isHold(NodeRef nodeRef) - { - return getFreezeService().isHold(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FreezeService#isFrozen(NodeRef)} - */ - @Override - public boolean isFrozen(NodeRef nodeRef) - { - return getFreezeService().isFrozen(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link FreezeService#hasFrozenChildren(NodeRef)} - */ - @Override - public boolean hasFrozenChildren(NodeRef nodeRef) - { - return getFreezeService().hasFrozenChildren(nodeRef); - } - - /** - * @deprecated As of 2.1, see {@link RecordService#isRecord(NodeRef)} - */ - @Override - public boolean isRecord(NodeRef nodeRef) - { - return getRecordService().isRecord(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.QName; + +/** + * Records management service implementation. + * + * @author Roy Wetherall + * @deprecated as of 2.2 + */ +public class RecordsManagementServiceImpl extends ServiceBaseImpl + implements RecordsManagementService, + RecordsManagementModel +{ + /** Store that the RM roots are contained within */ + @SuppressWarnings("unused") + @Deprecated + private StoreRef defaultStoreRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; + + /** Service registry */ + private RecordsManagementServiceRegistry serviceRegistry; + + /** + * Set the service registry service + * + * @param serviceRegistry service registry + */ + public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry) + { + // Internal ops use the unprotected services from the voter (e.g. nodeService) + this.serviceRegistry = serviceRegistry; + this.dictionaryService = serviceRegistry.getDictionaryService(); + } + + /** + * Sets the default RM store reference + * @param defaultStoreRef store reference + */ + @Deprecated + public void setDefaultStoreRef(StoreRef defaultStoreRef) + { + this.defaultStoreRef = defaultStoreRef; + } + + /** + * @return File plan service + */ + private FilePlanService getFilePlanService() + { + return serviceRegistry.getFilePlanService(); + } + + /** + * @return Record Folder Service + */ + private RecordFolderService getRecordFolderService() + { + return serviceRegistry.getRecordFolderService(); + } + + /** + * @return Record Service + */ + private RecordService getRecordService() + { + return serviceRegistry.getRecordService(); + } + + /** + * @return Freeze Service + */ + private FreezeService getFreezeService() + { + return serviceRegistry.getFreezeService(); + } + + /** + * @return Disposition Service + */ + private DispositionService getDispositionService() + { + return serviceRegistry.getDispositionService(); + } + + /** + * @return Transfer service + */ + private TransferService getTransferService() + { + return serviceRegistry.getTransferService(); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanComponent(NodeRef)} + */ + @Override + public boolean isFilePlanComponent(NodeRef nodeRef) + { + return getFilePlanService().isFilePlanComponent(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKind(NodeRef)} + */ + @Override + public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef) + { + return getFilePlanService().getFilePlanComponentKind(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getFilePlanComponentKindFromType(QName)} + */ + @Override + public FilePlanComponentKind getFilePlanComponentKindFromType(QName type) + { + return getFilePlanService().getFilePlanComponentKindFromType(type); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#isFilePlanContainer(NodeRef)} + */ + @Override + public boolean isRecordsManagementContainer(NodeRef nodeRef) + { + return getFilePlanService().isFilePlanContainer(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)} + */ + @Override + public boolean isFilePlan(NodeRef nodeRef) + { + return getFilePlanService().isFilePlan(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#isRecordCategory(NodeRef)} + */ + @Override + public boolean isRecordCategory(NodeRef nodeRef) + { + return getFilePlanService().isRecordCategory(nodeRef); + } + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolder(NodeRef)} + */ + @Override + public boolean isRecordFolder(NodeRef nodeRef) + { + return getRecordFolderService().isRecordFolder(nodeRef); + } + + /** + * @deprecated As of 2.2, see {@link TransferService#isTransfer(NodeRef)} + */ + @Override + public boolean isTransfer(NodeRef nodeRef) + { + return getTransferService().isTransfer(nodeRef); + } + + /** + * @deprecated As of 2.2, see {@link RecordService#isMetadataStub(NodeRef)} + */ + @Override + public boolean isMetadataStub(NodeRef nodeRef) + { + return getRecordService().isMetadataStub(nodeRef); + } + + /** + * @deprecated As of 2.2, see {@link DispositionService#isDisposableItemCutoff(NodeRef)} + */ + @Override + public boolean isCutoff(NodeRef nodeRef) + { + return getDispositionService().isDisposableItemCutoff(nodeRef); + } + + /** + * @deprecated as of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)} + */ + @Override + public List getNodeRefPath(NodeRef nodeRef) + { + return getFilePlanService().getNodeRefPath(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getFilePlan(NodeRef)} + */ + @Override + public NodeRef getFilePlan(NodeRef nodeRef) + { + return getFilePlanService().getFilePlan(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getFilePlans()} + */ + @Override + public List getFilePlans() + { + return new ArrayList(getFilePlanService().getFilePlans()); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName)} + */ + @Override + public NodeRef createFilePlan(NodeRef parent, String name, QName type) + { + return getFilePlanService().createFilePlan(parent, name, type); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName, Map)} + */ + @Override + public NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties) + { + return getFilePlanService().createFilePlan(parent, name, type, properties); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String)} + */ + @Override + public NodeRef createFilePlan(NodeRef parent, String name) + { + return getFilePlanService().createFilePlan(parent, name); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, Map)} + */ + @Override + public NodeRef createFilePlan(NodeRef parent, String name, Map properties) + { + return getFilePlanService().createFilePlan(parent, name, properties); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef, boolean)} + */ + @Override + public List getAllContained(NodeRef container, boolean deep) + { + return getFilePlanService().getAllContained(container, deep); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getAllContained(NodeRef)} + */ + @Override + public List getAllContained(NodeRef container) + { + return getFilePlanService().getAllContained(container); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)} + */ + @Override + public List getContainedRecordCategories(NodeRef container, boolean deep) + { + return getFilePlanService().getContainedRecordCategories(container, deep); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef)} + */ + @Override + public List getContainedRecordCategories(NodeRef container) + { + return getFilePlanService().getContainedRecordCategories(container); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef, boolean)} + */ + @Override + public List getContainedRecordFolders(NodeRef container, boolean deep) + { + return getFilePlanService().getContainedRecordFolders(container, deep); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef)} + */ + @Override + public List getContainedRecordFolders(NodeRef container) + { + return getFilePlanService().getContainedRecordFolders(container); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName)} + */ + @Override + public NodeRef createRecordCategory(NodeRef parent, String name, QName type) + { + return getFilePlanService().createRecordCategory(parent, name, type); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName, Map)} + */ + @Override + public NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties) + { + return getFilePlanService().createRecordCategory(parent, name, type, properties); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String)} + */ + @Override + public NodeRef createRecordCategory(NodeRef parent, String name) + { + return getFilePlanService().createRecordCategory(parent, name); + } + + /** + * @deprecated As of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, Map)} + */ + public NodeRef createRecordCategory(NodeRef parent, String name, Map properties) + { + return getFilePlanService().createRecordCategory(parent, name, properties); + } + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderDeclared(NodeRef)} + */ + @Override + public boolean isRecordFolderDeclared(NodeRef recordFolder) + { + return getRecordFolderService().isRecordFolderDeclared(recordFolder); + } + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#isRecordFolderClosed(NodeRef)} + */ + @Override + public boolean isRecordFolderClosed(NodeRef nodeRef) + { + return getRecordFolderService().isRecordFolderClosed(nodeRef); + } + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName)} + */ + @Override + public NodeRef createRecordFolder(NodeRef parent, String name, QName type) + { + return getRecordFolderService().createRecordFolder(parent, name, type); + } + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, QName, Map)} + */ + @Override + public NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties) + { + return getRecordFolderService().createRecordFolder(rmContainer, name, type, properties); + } + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String)} + */ + @Override + public NodeRef createRecordFolder(NodeRef rmContrainer, String name) + { + return getRecordFolderService().createRecordFolder(rmContrainer, name); + } + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#createRecordFolder(NodeRef, String, Map)} + */ + @Override + public NodeRef createRecordFolder(NodeRef parent, String name, Map properties) + { + return getRecordFolderService().createRecordFolder(parent, name, properties); + } + + /** + * @deprecated As of 2.2, see {@link RecordService#getRecords(NodeRef)} + */ + @Override + public List getRecords(NodeRef recordFolder) + { + return getRecordService().getRecords(recordFolder); + } + + /** + * @deprecated As of 2.2, see {@link RecordFolderService#getRecordFolders(NodeRef)} + */ + @Override + public List getRecordFolders(NodeRef record) + { + return getRecordFolderService().getRecordFolders(record); + } + + /** + * @deprecated As of 2.1, see {@link RecordService#getRecordMetaDataAspects()} + */ + @Override + public Set getRecordMetaDataAspects() + { + return getRecordService().getRecordMetaDataAspects(); + } + + /** + * @deprecated As of 2.1, see {@link RecordService#isDeclared(NodeRef)} + */ + @Override + public boolean isRecordDeclared(NodeRef nodeRef) + { + return getRecordService().isDeclared(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FreezeService#isHold(NodeRef)} + */ + @Override + public boolean isHold(NodeRef nodeRef) + { + return getFreezeService().isHold(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FreezeService#isFrozen(NodeRef)} + */ + @Override + public boolean isFrozen(NodeRef nodeRef) + { + return getFreezeService().isFrozen(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link FreezeService#hasFrozenChildren(NodeRef)} + */ + @Override + public boolean hasFrozenChildren(NodeRef nodeRef) + { + return getFreezeService().hasFrozenChildren(nodeRef); + } + + /** + * @deprecated As of 2.1, see {@link RecordService#isRecord(NodeRef)} + */ + @Override + public boolean isRecord(NodeRef nodeRef) + { + return getRecordService().isRecord(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java index 249a48e301..d9e758f3ac 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceDeprecated.java @@ -1,83 +1,83 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Deprecated records management audit interface methods. - * - * @author Roy Wetherall - * @since 2.1 - * @deprecated as of 2.1, see {@link RecordsManagementAuditService}. - */ -@AlfrescoPublicApi -public interface RecordsManagementAuditServiceDeprecated -{ - /** - * @deprecated as of 2.1, see {@link #stop(NodeRef)} - */ - @Deprecated - void stop(); - - /** - * @deprecated as of 2.1, see {@link #clear(NodeRef)} - */ - @Deprecated - void clear(); - - /** - * @deprecated as of 2.1, see {@link #isEnabled(NodeRef)} - */ - @Deprecated - boolean isEnabled(); - - /** - * @deprecated as of 2.1, see {@link #getDateLastStarted(NodeRef)} - */ - @Deprecated - Date getDateLastStarted(); - - /** - * @deprecated as of 2.1, see {@link #getDateLastStopped(NodeRef)} - */ - Date getDateLastStopped(); - - /** - * @deprecated as of 2.1 - */ - @Deprecated - void auditRMAction(RecordsManagementAction action, NodeRef nodeRef, Map parameters); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Deprecated records management audit interface methods. + * + * @author Roy Wetherall + * @since 2.1 + * @deprecated as of 2.1, see {@link RecordsManagementAuditService}. + */ +@AlfrescoPublicApi +public interface RecordsManagementAuditServiceDeprecated +{ + /** + * @deprecated as of 2.1, see {@link #stop(NodeRef)} + */ + @Deprecated + void stop(); + + /** + * @deprecated as of 2.1, see {@link #clear(NodeRef)} + */ + @Deprecated + void clear(); + + /** + * @deprecated as of 2.1, see {@link #isEnabled(NodeRef)} + */ + @Deprecated + boolean isEnabled(); + + /** + * @deprecated as of 2.1, see {@link #getDateLastStarted(NodeRef)} + */ + @Deprecated + Date getDateLastStarted(); + + /** + * @deprecated as of 2.1, see {@link #getDateLastStopped(NodeRef)} + */ + Date getDateLastStopped(); + + /** + * @deprecated as of 2.1 + */ + @Deprecated + void auditRMAction(RecordsManagementAction action, NodeRef nodeRef, Map parameters); + +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/PivotUtil.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/PivotUtil.java index 2fe741e78b..96626177ee 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/PivotUtil.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/PivotUtil.java @@ -1,71 +1,71 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/* package scope */ final class PivotUtil -{ - private PivotUtil() - { - // Will not be called - } - - static Map> getPivot(Map> source) - { - - Map> pivot = new HashMap>(); - - for (Map.Entry> entry : source.entrySet()) - { - Listvalues = entry.getValue(); - for (String value : values) - { - String authority = entry.getKey(); - if (pivot.containsKey(value)) - { - // already exists - List list = pivot.get(value); - list.add(authority ); - } - else - { - // New value - List list = new ArrayList(); - list.add(authority); - pivot.put(value, list); - } - } - } - - return pivot; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/* package scope */ final class PivotUtil +{ + private PivotUtil() + { + // Will not be called + } + + static Map> getPivot(Map> source) + { + + Map> pivot = new HashMap>(); + + for (Map.Entry> entry : source.entrySet()) + { + Listvalues = entry.getValue(); + for (String value : values) + { + String authority = entry.getKey(); + if (pivot.containsKey(value)) + { + // already exists + List list = pivot.get(value); + list.add(authority ); + } + else + { + // New value + List list = new ArrayList(); + list.add(authority); + pivot.put(value, list); + } + } + } + + return pivot; + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponent.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponent.java index 4a9269639e..ebb84140a8 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponent.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponent.java @@ -1,121 +1,121 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.io.File; -import java.io.InputStream; -import java.util.List; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -public interface RMCaveatConfigComponent -{ - void init(); - - /** - * Get allowed values for given caveat list (for current user) - * - * @param constraintName - * @return - */ - List getRMAllowedValues(String constraintName); - - /** - * Get custom caveat models - * - * @return - */ - List getRMCaveatModels(); - - /** - * Check whether access to 'record component' node is vetoed for current user due to caveat(s) - * - * @param nodeRef - * @return false, if caveat(s) veto access otherwise return true - */ - boolean hasAccess(NodeRef nodeRef); - - /** - * Get RM constraint list - * - * @param listName the name of the RMConstraintList - */ - RMConstraintInfo getRMConstraint(String listName); - - /** - * Add RM constraint - */ - void addRMConstraint(String listName); - - /** - * Add RM constraint value for given authority - */ - void addRMConstraintListValue(String listName, String authorityName, String value); - - /** - * Update RM constraint values for given authority - */ - void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues); - - /** - * Update RM constraint authorities for given value - */ - void updateRMConstraintListValue(String listName, String valueName, Listauthorities); - - /** - * Remove RM constraint value (all authorities) - */ - void removeRMConstraintListValue(String listName, String valueName); - - /** - * Remove RM constraint authority (all values) - */ - void removeRMConstraintListAuthority(String listName, String authorityName); - - /** - * Delete RM Constraint - * - * @param listName the name of the RMConstraintList - */ - void deleteRMConstraint(String listName); - - /** - * Get the details of a caveat list - * @param listName - * @return - */ - Map> getListDetails(String listName); - - NodeRef updateOrCreateCaveatConfig(File jsonFile); - - NodeRef updateOrCreateCaveatConfig(String jsonString); - - NodeRef updateOrCreateCaveatConfig(InputStream is); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.io.File; +import java.io.InputStream; +import java.util.List; +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +public interface RMCaveatConfigComponent +{ + void init(); + + /** + * Get allowed values for given caveat list (for current user) + * + * @param constraintName + * @return + */ + List getRMAllowedValues(String constraintName); + + /** + * Get custom caveat models + * + * @return + */ + List getRMCaveatModels(); + + /** + * Check whether access to 'record component' node is vetoed for current user due to caveat(s) + * + * @param nodeRef + * @return false, if caveat(s) veto access otherwise return true + */ + boolean hasAccess(NodeRef nodeRef); + + /** + * Get RM constraint list + * + * @param listName the name of the RMConstraintList + */ + RMConstraintInfo getRMConstraint(String listName); + + /** + * Add RM constraint + */ + void addRMConstraint(String listName); + + /** + * Add RM constraint value for given authority + */ + void addRMConstraintListValue(String listName, String authorityName, String value); + + /** + * Update RM constraint values for given authority + */ + void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues); + + /** + * Update RM constraint authorities for given value + */ + void updateRMConstraintListValue(String listName, String valueName, Listauthorities); + + /** + * Remove RM constraint value (all authorities) + */ + void removeRMConstraintListValue(String listName, String valueName); + + /** + * Remove RM constraint authority (all values) + */ + void removeRMConstraintListAuthority(String listName, String authorityName); + + /** + * Delete RM Constraint + * + * @param listName the name of the RMConstraintList + */ + void deleteRMConstraint(String listName); + + /** + * Get the details of a caveat list + * @param listName + * @return + */ + Map> getListDetails(String listName); + + NodeRef updateOrCreateCaveatConfig(File jsonFile); + + NodeRef updateOrCreateCaveatConfig(String jsonString); + + NodeRef updateOrCreateCaveatConfig(InputStream is); +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java index a519825f5a..904f7c4bb7 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java @@ -1,1148 +1,1148 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import static org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace; - -import java.io.File; -import java.io.InputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.repo.content.ContentServicePolicies; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.dictionary.Constraint; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.JSONtoFmModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; - -import net.sf.acegisecurity.AccessDeniedException; - -/** - * RM Caveat Config component impl - * - * @author janv - */ -@BehaviourBean(defaultType = "rma:caveatConfig") -public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnContentUpdatePolicy, - NodeServicePolicies.BeforeDeleteNodePolicy, - NodeServicePolicies.OnCreateNodePolicy, - RMCaveatConfigComponent -{ - private static Log logger = LogFactory.getLog(RMCaveatConfigComponentImpl.class); - - private ContentService contentService; - private DictionaryService dictionaryService; - private NamespaceService namespaceService; - private AuthorityService authorityService; - private PersonService personService; - private NodeService nodeService; - - // Default - private StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private List caveatAspectURINames = new ArrayList(0); - private List caveatAspectQNames = new ArrayList(0); - - private List caveatModelURINames = new ArrayList(0); - private List caveatModelQNames = new ArrayList(0); - - private static final String CAVEAT_CONFIG_NAME = "caveatConfig.json"; - - private static final QName DATATYPE_TEXT = DataTypeDefinition.TEXT; - - /** - * Lock objects - */ - private ReadWriteLock lock = new ReentrantReadWriteLock(); - private Lock readLock = lock.readLock(); - private Lock writeLock = lock.writeLock(); - - /* - * Caveat Config (Shared) config - * first string is property name - * second string is authority name (user or group full name) - * third string is list of values of property - */ - private SimpleCache>> caveatConfig; - - public void setCaveatConfig(SimpleCache>> caveatConfig) - { - this.caveatConfig = caveatConfig; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - public void setStoreRef(String storeRef) - { - this.storeRef = new StoreRef(storeRef); - } - - public void setCaveatAspects(List caveatAspectNames) - { - this.caveatAspectURINames = caveatAspectNames; - } - - public void setCaveatModels(List caveatModelNames) - { - this.caveatModelURINames = caveatModelNames; - } - - /** - * Initialise behaviours and caveat config cache - */ - public void init() - { - if (caveatAspectURINames.size() > 0) - { - for (String caveatAspectURIName : caveatAspectURINames) - { - caveatAspectQNames.add(QName.createQName(caveatAspectURIName)); - } - - if (logger.isInfoEnabled()) - { - logger.info("Caveat aspects configured "+caveatAspectQNames); - } - } - else - { - logger.warn("No caveat aspects configured - caveats will not be applied"); - } - - if (caveatModelURINames.size() > 0) - { - for (String caveatModelURIName : caveatModelURINames) - { - caveatModelQNames.add(QName.createQName(caveatModelURIName)); - } - - if (logger.isInfoEnabled()) - { - logger.info("Caveat models configured "+caveatModelQNames); - } - } - else - { - logger.info("No caveat models configured - all models will be checked"); - } - - NodeRef caveatConfigNodeRef = getCaveatConfigNode(); - if (caveatConfigNodeRef != null) - { - validateAndReset(caveatConfigNodeRef); - } - } - - /** - * @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) - * RM-2770 - this method has to be fired on transaction commit to be able to validate the content when the content store is encrypted - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onContentUpdate(NodeRef nodeRef, boolean newContent) - { - if (logger.isInfoEnabled()) - { - logger.info("onContentUpdate: "+nodeRef+", "+newContent); - } - - validateAndReset(nodeRef); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS) - public void beforeDeleteNode(NodeRef nodeRef) - { - if (logger.isInfoEnabled()) - { - logger.info("beforeDeleteNode: "+nodeRef); - } - - validateAndReset(nodeRef); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour(kind = BehaviourKind.CLASS) - public void onCreateNode(ChildAssociationRef childAssocRef) - { - if (logger.isInfoEnabled()) - { - logger.info("onCreateNode: "+childAssocRef); - } - - validateAndReset(childAssocRef.getChildRef()); - } - - /** - * Validate the caveat config and optionally update the cache. - * - * @param nodeRef The nodeRef of the config - * @param updateCache Set to true to update the cache - */ - @SuppressWarnings("unchecked") - protected void validateAndReset(NodeRef nodeRef) - { - ContentReader cr = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); - if (cr != null) - { - // TODO - check who can change caveat config ! - // TODO - locking (or checkout/checkin) - - String caveatConfigData = cr.getContentString(); - if (caveatConfigData != null) - { - NodeRef existing = getCaveatConfigNode(); - if ((existing != null && (! existing.equals(nodeRef)))) - { - throw new AlfrescoRuntimeException("Cannot create more than one caveat config (existing="+existing+", new="+nodeRef+")"); - } - - try - { - if (logger.isTraceEnabled()) - { - logger.trace(caveatConfigData); - } - - Set models = new HashSet(1); - Set props = new HashSet(10); - Set expectedPrefixes = new HashSet(10); - - if (caveatModelQNames.size() > 0) - { - models.addAll(caveatModelQNames); - } - else - { - models.addAll(dictionaryService.getAllModels()); - } - - if (logger.isTraceEnabled()) - { - logger.trace("validateAndReset: models to check "+models); - } - - for (QName model : models) - { - props.addAll(dictionaryService.getProperties(model, DATATYPE_TEXT)); - expectedPrefixes.addAll(namespaceService.getPrefixes(model.getNamespaceURI())); - } - - if (props.size() == 0) - { - logger.warn("validateAndReset: no caveat properties found"); - } - else - { - if (logger.isTraceEnabled()) - { - logger.trace("validateAndReset: properties to check "+props); - } - } - - Map caveatConfigMap = JSONtoFmModel.convertJSONObjectToMap(caveatConfigData); - - for (Map.Entry conEntry : caveatConfigMap.entrySet()) - { - String conStr = conEntry.getKey(); - - QName conQName = QName.resolveToQName(namespaceService, conStr); - - // check prefix - String conPrefix = QName.splitPrefixedQName(conStr)[0]; - boolean prefixFound = false; - for (String expectedPrefix : expectedPrefixes) - { - if (conPrefix.equals(expectedPrefix)) - { - prefixFound = true; - } - } - - if (! prefixFound) - { - throw new AlfrescoRuntimeException("Unexpected prefix: "+ conPrefix + " (" + conStr +") expected one of "+expectedPrefixes+")"); - } - - Map> caveatMap = (Map>)conEntry.getValue(); - - List allowedValues = null; - @SuppressWarnings("unused") - boolean found = false; - - for (QName propertyName : props) - { - PropertyDefinition propDef = dictionaryService.getProperty(propertyName); - List conDefs = propDef.getConstraints(); - for (ConstraintDefinition conDef : conDefs) - { - final Constraint con = conDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - String conName = ((RMListOfValuesConstraint)con).getShortName(); - if (conName.equals(conStr)) - { - // note: assumes only one caveat/LOV against a given property - allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return ((RMListOfValuesConstraint)con).getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - found = true; - break; - } - } - } - } - - if (allowedValues != null) - { - if (logger.isInfoEnabled()) - { - logger.info("Processing constraint: "+conQName); - } - - for (Map.Entry> caveatEntry : caveatMap.entrySet()) - { - String authorityName = caveatEntry.getKey(); - List caveatList = caveatEntry.getValue(); - - // validate authority (user or group) - note: groups are configured with fullname (ie. GROUP_xxx) - if ((! authorityService.authorityExists(authorityName) && ! personService.personExists(authorityName))) - { - // TODO - review warnings (& I18N) - String msg = "User/group does not exist: "+authorityName+" (constraint="+conStr+")"; - logger.warn(msg); - } - - // validate caveat list - for (String value : caveatList) - { - if (! allowedValues.contains(value)) - { - // TODO - review warnings (& add I18N) - String msg = "Invalid value in list: "+value+" (authority="+authorityName+", constraint="+conStr+")"; - logger.warn(msg); - } - } - } - } - } - - try - { - writeLock.lock(); - // we can't just clear the cache, as all puts to the cache afterwards in this transaction will be ignored - // first delete all keys that are now not in the config - caveatConfig.getKeys().retainAll(caveatConfigMap.keySet()); - - for (Map.Entry conEntry : caveatConfigMap.entrySet()) - { - String conStr = conEntry.getKey(); - Map> caveatMap = (Map>)conEntry.getValue(); - - Map> cacheValue = caveatConfig.get(conStr); - if (cacheValue == null || !cacheValue.equals(caveatMap)) - { - // update the cache - caveatConfig.put(conStr, caveatMap); - } - } - } - finally - { - writeLock.unlock(); - } - } - catch (JSONException e) - { - throw new AlfrescoRuntimeException("Invalid caveat config syntax: "+e); - } - } - } - } - - private NodeRef getCaveatConfigNode() - { - NodeRef rootNode = nodeService.getRootNode(storeRef); - return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_CAVEAT_CONFIG, CAVEAT_CONFIG_NAME); - } - - - public NodeRef updateOrCreateCaveatConfig(InputStream is) - { - NodeRef caveatConfig = getOrCreateCaveatConfig(); - - // Update the content - ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(is); - - return caveatConfig; - } - - public NodeRef updateOrCreateCaveatConfig(File jsonFile) - { - NodeRef caveatConfig = getOrCreateCaveatConfig(); - - // Update the content - ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(jsonFile); - - return caveatConfig; - } - - public NodeRef updateOrCreateCaveatConfig(String jsonString) - { - NodeRef caveatConfig = getOrCreateCaveatConfig(); - - // Update the content - ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(jsonString); - - return caveatConfig; - } - - private NodeRef getOrCreateCaveatConfig() - { - NodeRef caveatConfig = getCaveatConfigNode(); - if (caveatConfig == null) - { - NodeRef rootNode = nodeService.getRootNode(storeRef); - nodeService.addAspect(rootNode, VersionModel.ASPECT_VERSION_STORE_ROOT, null); - - // Create caveat config - caveatConfig = nodeService.createNode(rootNode, - RecordsManagementModel.ASSOC_CAVEAT_CONFIG, - QName.createQName(RecordsManagementModel.RM_URI, CAVEAT_CONFIG_NAME), - RecordsManagementModel.TYPE_CAVEAT_CONFIG).getChildRef(); - - nodeService.setProperty(caveatConfig, ContentModel.PROP_NAME, CAVEAT_CONFIG_NAME); - } - - return caveatConfig; - } - - // Get list of all caveat qualified names - public Collection getRMConstraintNames() - { - Collection rmConstraintNames = Collections.emptySet(); - try - { - readLock.lock(); - rmConstraintNames = caveatConfig.getKeys(); - } - finally - { - readLock.unlock(); - } - return Collections.unmodifiableCollection(rmConstraintNames); - } - - // Get allowed values for given caveat (for current user) - public List getRMAllowedValues(String constraintName) - { - List allowedValues = new ArrayList(0); - - String userName = AuthenticationUtil.getRunAsUser(); - if (userName != null && !(AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser())) - { - // note: userName and userGroupNames must not be null - caveatConfig.get(constraintName); - - Set userGroupFullNames = authorityService.getAuthoritiesForUser(userName); - allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName); - } - - return allowedValues; - } - - private List getRMAllowedValues(String userName, Set userGroupFullNames, String constraintName) - { - SetallowedValues = new HashSet(); - - // note: userName and userGroupNames must not be null - Map> caveatConstraintDef = null; - try - { - readLock.lock(); - caveatConstraintDef = caveatConfig.get(constraintName); - } - finally - { - readLock.unlock(); - } - - if (caveatConstraintDef != null) - { - List direct = caveatConstraintDef.get(userName); - if(direct != null) - { - allowedValues.addAll(direct); - } - - for (String group : userGroupFullNames) - { - List values = caveatConstraintDef.get(group); - if(values != null) - { - allowedValues.addAll(values); - } - } - } - - Listret = new ArrayList(); - ret.addAll(allowedValues); - return Collections.unmodifiableList(ret); - } - - /** - * Check whether access to 'record component' node is vetoed for current user due to caveat(s) - * - * @param nodeRef - * @return false, if caveat(s) veto access otherwise return true - */ - @SuppressWarnings("unchecked") - public boolean hasAccess(NodeRef nodeRef) - { - try - { - if ((! nodeService.exists(nodeRef)) || (caveatAspectQNames.size() == 0)) - { - return true; - } - - boolean found = false; - for (QName caveatAspectQName : caveatAspectQNames) - { - if (nodeService.hasAspect(nodeRef, caveatAspectQName)) - { - found = true; - break; - } - } - - if (! found) - { - // no caveat aspect - return true; - } - else - { - // check for caveats - String userName = AuthenticationUtil.getRunAsUser(); - if (userName != null) - { - // check all text properties - Map props = nodeService.getProperties(nodeRef); - for (Map.Entry entry : props.entrySet()) - { - QName propName = entry.getKey(); - PropertyDefinition propDef = dictionaryService.getProperty(propName); - - if ((propDef != null) && (propDef.getDataType().getName().equals(DATATYPE_TEXT))) - { - List conDefs = propDef.getConstraints(); - for (ConstraintDefinition conDef : conDefs) - { - Constraint con = conDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - RMListOfValuesConstraint rmCon = ((RMListOfValuesConstraint)con); - String conName = rmCon.getShortName(); - MatchLogic matchLogic = rmCon.getMatchLogicEnum(); - Map> caveatConstraintDef = caveatConfig.get(conName); - if (caveatConstraintDef == null) - { - continue; - } - else - { - Set userGroupNames = authorityService.getAuthoritiesForUser(userName); - List allowedValues = getRMAllowedValues(userName, userGroupNames, conName); - - List propValues = null; - Object val = entry.getValue(); - if (val instanceof String) - { - propValues = new ArrayList(1); - propValues.add((String)val); - } - else if (val instanceof List) - { - propValues = (List)val; - } - - if (propValues != null && !isAllowed(propValues, allowedValues, matchLogic)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Veto access: caveat="+conName+", userName="+userName+", nodeRef="+nodeRef+", propName="+propName+", propValues="+propValues+", allowedValues="+allowedValues); - } - return false; - } - } - } - } - } - } - } - - return true; - } - } - catch (AccessDeniedException ade) - { - return false; - } - } - - private boolean isAllowed(List propValues, List userGroupValues, MatchLogic matchLogic) - { - if (matchLogic.equals(MatchLogic.AND)) - { - // check user/group values match all values on node - for (String propValue : propValues) - { - if (! userGroupValues.contains(propValue)) - { - if (logger.isTraceEnabled()) - { - logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic); - } - - return false; - } - } - - return true; - } - else if (matchLogic.equals(MatchLogic.OR)) - { - // check user/group values match at least one value on node - for (String propValue : propValues) - { - if (userGroupValues.contains(propValue)) - { - return true; - } - } - - if (logger.isTraceEnabled()) - { - logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic); - } - - return false; - } - - logger.error("Unexpected match logic type: "+matchLogic); - return false; - } - - /** - * Add a single value to an authority in a list. The existing values of the list remain. - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param value - * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. - */ - public void addRMConstraintListValue(String listName, String authorityName, String value) - { - Map> members = null; - try - { - readLock.lock(); - members = caveatConfig.get(listName); - if(members == null) - { - throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName); - } - - try - { - readLock.unlock(); - writeLock.lock(); - // check again - members = caveatConfig.get(listName); - if(members == null) - { - throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName); - } - - List values = members.get(authorityName); - if(values == null) - { - throw new AlfrescoRuntimeException("Unable to add to authority in list. Authority not member listName: "+ listName + " authorityName:" +authorityName); - } - values.add(value); - - caveatConfig.put(listName, members); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - readLock.lock(); - writeLock.unlock(); - } - - } - finally - { - readLock.unlock(); - } - } - - /** - * Get the member details of the specified list - * @param listName - * @return the details of the specified list - */ - public Map> getListDetails(String listName) - { - Map> listDetails = null; - try - { - readLock.lock(); - listDetails = caveatConfig.get(listName); - } - finally - { - readLock.unlock(); - } - if (listDetails == null) - { - return Collections.emptyMap(); - } - else - { - return Collections.unmodifiableMap(listDetails); - } - } - - public List getRMCaveatModels() - { - return caveatModelQNames; - } - - /** - * Replace the values for an authority in a list. - * The existing values are removed. - * - * If the authority does not already exist in the list, it will be added - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - public void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues) - { - Map> members = null; - try - { - writeLock.lock(); - members = caveatConfig.get(listName); - if(members == null) - { - // Create the new list, with the authority name - Map> constraint = new HashMap>(0); - constraint.put(authorityName, new ArrayList(values)); - members = constraint; - } - else - { - members.put(authorityName, new ArrayList(values)); - } - - caveatConfig.put(listName, members); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - writeLock.unlock(); - } - } - - /** - * Replace the authorities for a value in a list - * - * @param listName - * @param valueName - * @param authorities - */ - public void updateRMConstraintListValue(String listName, String valueName, Listauthorities) - { - - Map> members = caveatConfig.get(listName); - try - { - writeLock.lock(); - - if(members == null) - { - // Members List does not exist - Map> emptyConstraint = new HashMap>(0); - caveatConfig.put(listName, emptyConstraint); - members = emptyConstraint; - - } - // authorities contains authority, values[] - // pivot contains value, members[] - Map> pivot = PivotUtil.getPivot(members); - - // remove all authorities which have this value - List existingAuthorities = pivot.get(valueName); - if(existingAuthorities != null) - { - for(String authority : existingAuthorities) - { - List vals = members.get(authority); - vals.remove(valueName); - } - } - // add the new authorities for this value - for(String authority : authorities) - { - List vals = members.get(authority); - if(vals == null) - { - vals= new ArrayList(); - members.put(authority, vals); - } - vals.add(valueName); - } - caveatConfig.put(listName, members); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - writeLock.unlock(); - } - } - - public void removeRMConstraintListValue(String listName, String valueName) - { - Map> members = null; - try - { - readLock.lock(); - - members = caveatConfig.get(listName); - if (members != null) - { - try - { - readLock.unlock(); - writeLock.lock(); - // check again - members = caveatConfig.get(listName); - if (members != null) - { - // authorities contains authority, values[] - // pivot contains value, members[] - Map> pivot = PivotUtil.getPivot(members); - - // remove all authorities which have this value - List existingAuthorities = pivot.get(valueName); - if(existingAuthorities != null) - { - for(String authority : existingAuthorities) - { - List vals = members.get(authority); - vals.remove(valueName); - } - caveatConfig.put(listName, members); - } - } - - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - readLock.lock(); - writeLock.unlock(); - } - } - } - finally - { - readLock.unlock(); - } - } - - /** - * Remove an authority from a list - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - public void removeRMConstraintListAuthority(String listName, String authorityName) - { - Map> members = null; - try - { - writeLock.lock(); - members = caveatConfig.get(listName); - if(members != null) - { - members.remove(listName); - } - - caveatConfig.put(listName, members); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - - } - finally - { - writeLock.unlock(); - } -} - - /** - * @param config the configuration to convert - * @return a String containing the JSON representation of the configuration. - */ - private String convertToJSONString(SimpleCache>> config) - { - JSONObject configJSONObject = new JSONObject(); - - Collection listNames = config.getKeys(); - for (String listName : listNames) - { - Map> members = config.get(listName); - - Set authorityNames = members.keySet(); - JSONObject listMembers = new JSONObject(); - - for (String authorityName : authorityNames) - { - List authorities = members.get(authorityName); - try - { - listMembers.put(authorityName, authorities); - } - catch (JSONException error) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot add the key '"); - sb.append(authorityName); - sb.append("' with the value '"); - sb.append(authorities); - sb.append("' to the JSONObject 'listMembers' '"); - sb.append(listMembers); - sb.append("': "); - sb.append(getFullStackTrace(error)); - throw new AlfrescoRuntimeException(sb.toString()); - } - } - - try - { - configJSONObject.put(listName, listMembers); - } - catch (JSONException error) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot add the key '"); - sb.append(listName); - sb.append("' with the value '"); - sb.append(listMembers); - sb.append("' to the JSONObject 'configJSONObject' '"); - sb.append(configJSONObject); - sb.append("': "); - sb.append(getFullStackTrace(error)); - throw new AlfrescoRuntimeException(sb.toString()); - } - } - - return configJSONObject.toString(); - } - - /** - * Get an RMConstraintInfo - * @param listQName - * @return the constraint or null if it does not exist - */ - public RMConstraintInfo getRMConstraint(QName listQName) - { - ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); - if(dictionaryDef != null) - { - Constraint con = dictionaryDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; - - RMConstraintInfo info = new RMConstraintInfo(); - info.setName(listQName.toPrefixString()); - info.setTitle(con.getTitle()); - List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return def.getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - info.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); - info.setCaseSensitive(def.isCaseSensitive()); - return info; - } - } - return null; - } - - /** - * Get RM Constraint detail. - * - * @return the constraintInfo or null - */ - public RMConstraintInfo getRMConstraint(String listName) - { - QName listQName = QName.createQName(listName, namespaceService); - return getRMConstraint(listQName); - } - - public void deleteRMConstraint(String listName) - { - try - { - writeLock.lock(); - caveatConfig.remove(listName); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - writeLock.unlock(); - } - } - - public void addRMConstraint(String listName) - { - try - { - writeLock.lock(); - Map> emptyConstraint = new HashMap>(0); - caveatConfig.put(listName, emptyConstraint); - updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); - } - finally - { - writeLock.unlock(); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import static org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace; + +import java.io.File; +import java.io.InputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.cache.SimpleCache; +import org.alfresco.repo.content.ContentServicePolicies; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.version.VersionModel; +import org.alfresco.service.cmr.dictionary.Constraint; +import org.alfresco.service.cmr.dictionary.ConstraintDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +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.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.JSONtoFmModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONException; +import org.json.JSONObject; + +import net.sf.acegisecurity.AccessDeniedException; + +/** + * RM Caveat Config component impl + * + * @author janv + */ +@BehaviourBean(defaultType = "rma:caveatConfig") +public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnContentUpdatePolicy, + NodeServicePolicies.BeforeDeleteNodePolicy, + NodeServicePolicies.OnCreateNodePolicy, + RMCaveatConfigComponent +{ + private static Log logger = LogFactory.getLog(RMCaveatConfigComponentImpl.class); + + private ContentService contentService; + private DictionaryService dictionaryService; + private NamespaceService namespaceService; + private AuthorityService authorityService; + private PersonService personService; + private NodeService nodeService; + + // Default + private StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); + + private List caveatAspectURINames = new ArrayList(0); + private List caveatAspectQNames = new ArrayList(0); + + private List caveatModelURINames = new ArrayList(0); + private List caveatModelQNames = new ArrayList(0); + + private static final String CAVEAT_CONFIG_NAME = "caveatConfig.json"; + + private static final QName DATATYPE_TEXT = DataTypeDefinition.TEXT; + + /** + * Lock objects + */ + private ReadWriteLock lock = new ReentrantReadWriteLock(); + private Lock readLock = lock.readLock(); + private Lock writeLock = lock.writeLock(); + + /* + * Caveat Config (Shared) config + * first string is property name + * second string is authority name (user or group full name) + * third string is list of values of property + */ + private SimpleCache>> caveatConfig; + + public void setCaveatConfig(SimpleCache>> caveatConfig) + { + this.caveatConfig = caveatConfig; + } + + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + public void setPersonService(PersonService personService) + { + this.personService = personService; + } + + public void setStoreRef(String storeRef) + { + this.storeRef = new StoreRef(storeRef); + } + + public void setCaveatAspects(List caveatAspectNames) + { + this.caveatAspectURINames = caveatAspectNames; + } + + public void setCaveatModels(List caveatModelNames) + { + this.caveatModelURINames = caveatModelNames; + } + + /** + * Initialise behaviours and caveat config cache + */ + public void init() + { + if (caveatAspectURINames.size() > 0) + { + for (String caveatAspectURIName : caveatAspectURINames) + { + caveatAspectQNames.add(QName.createQName(caveatAspectURIName)); + } + + if (logger.isInfoEnabled()) + { + logger.info("Caveat aspects configured "+caveatAspectQNames); + } + } + else + { + logger.warn("No caveat aspects configured - caveats will not be applied"); + } + + if (caveatModelURINames.size() > 0) + { + for (String caveatModelURIName : caveatModelURINames) + { + caveatModelQNames.add(QName.createQName(caveatModelURIName)); + } + + if (logger.isInfoEnabled()) + { + logger.info("Caveat models configured "+caveatModelQNames); + } + } + else + { + logger.info("No caveat models configured - all models will be checked"); + } + + NodeRef caveatConfigNodeRef = getCaveatConfigNode(); + if (caveatConfigNodeRef != null) + { + validateAndReset(caveatConfigNodeRef); + } + } + + /** + * @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) + * RM-2770 - this method has to be fired on transaction commit to be able to validate the content when the content store is encrypted + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onContentUpdate(NodeRef nodeRef, boolean newContent) + { + if (logger.isInfoEnabled()) + { + logger.info("onContentUpdate: "+nodeRef+", "+newContent); + } + + validateAndReset(nodeRef); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Behaviour(kind = BehaviourKind.CLASS) + public void beforeDeleteNode(NodeRef nodeRef) + { + if (logger.isInfoEnabled()) + { + logger.info("beforeDeleteNode: "+nodeRef); + } + + validateAndReset(nodeRef); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour(kind = BehaviourKind.CLASS) + public void onCreateNode(ChildAssociationRef childAssocRef) + { + if (logger.isInfoEnabled()) + { + logger.info("onCreateNode: "+childAssocRef); + } + + validateAndReset(childAssocRef.getChildRef()); + } + + /** + * Validate the caveat config and optionally update the cache. + * + * @param nodeRef The nodeRef of the config + * @param updateCache Set to true to update the cache + */ + @SuppressWarnings("unchecked") + protected void validateAndReset(NodeRef nodeRef) + { + ContentReader cr = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); + if (cr != null) + { + // TODO - check who can change caveat config ! + // TODO - locking (or checkout/checkin) + + String caveatConfigData = cr.getContentString(); + if (caveatConfigData != null) + { + NodeRef existing = getCaveatConfigNode(); + if ((existing != null && (! existing.equals(nodeRef)))) + { + throw new AlfrescoRuntimeException("Cannot create more than one caveat config (existing="+existing+", new="+nodeRef+")"); + } + + try + { + if (logger.isTraceEnabled()) + { + logger.trace(caveatConfigData); + } + + Set models = new HashSet(1); + Set props = new HashSet(10); + Set expectedPrefixes = new HashSet(10); + + if (caveatModelQNames.size() > 0) + { + models.addAll(caveatModelQNames); + } + else + { + models.addAll(dictionaryService.getAllModels()); + } + + if (logger.isTraceEnabled()) + { + logger.trace("validateAndReset: models to check "+models); + } + + for (QName model : models) + { + props.addAll(dictionaryService.getProperties(model, DATATYPE_TEXT)); + expectedPrefixes.addAll(namespaceService.getPrefixes(model.getNamespaceURI())); + } + + if (props.size() == 0) + { + logger.warn("validateAndReset: no caveat properties found"); + } + else + { + if (logger.isTraceEnabled()) + { + logger.trace("validateAndReset: properties to check "+props); + } + } + + Map caveatConfigMap = JSONtoFmModel.convertJSONObjectToMap(caveatConfigData); + + for (Map.Entry conEntry : caveatConfigMap.entrySet()) + { + String conStr = conEntry.getKey(); + + QName conQName = QName.resolveToQName(namespaceService, conStr); + + // check prefix + String conPrefix = QName.splitPrefixedQName(conStr)[0]; + boolean prefixFound = false; + for (String expectedPrefix : expectedPrefixes) + { + if (conPrefix.equals(expectedPrefix)) + { + prefixFound = true; + } + } + + if (! prefixFound) + { + throw new AlfrescoRuntimeException("Unexpected prefix: "+ conPrefix + " (" + conStr +") expected one of "+expectedPrefixes+")"); + } + + Map> caveatMap = (Map>)conEntry.getValue(); + + List allowedValues = null; + @SuppressWarnings("unused") + boolean found = false; + + for (QName propertyName : props) + { + PropertyDefinition propDef = dictionaryService.getProperty(propertyName); + List conDefs = propDef.getConstraints(); + for (ConstraintDefinition conDef : conDefs) + { + final Constraint con = conDef.getConstraint(); + if (con instanceof RMListOfValuesConstraint) + { + String conName = ((RMListOfValuesConstraint)con).getShortName(); + if (conName.equals(conStr)) + { + // note: assumes only one caveat/LOV against a given property + allowedValues = AuthenticationUtil.runAs(new RunAsWork>() + { + public List doWork() + { + return ((RMListOfValuesConstraint)con).getAllowedValues(); + } + }, AuthenticationUtil.getSystemUserName()); + + found = true; + break; + } + } + } + } + + if (allowedValues != null) + { + if (logger.isInfoEnabled()) + { + logger.info("Processing constraint: "+conQName); + } + + for (Map.Entry> caveatEntry : caveatMap.entrySet()) + { + String authorityName = caveatEntry.getKey(); + List caveatList = caveatEntry.getValue(); + + // validate authority (user or group) - note: groups are configured with fullname (ie. GROUP_xxx) + if ((! authorityService.authorityExists(authorityName) && ! personService.personExists(authorityName))) + { + // TODO - review warnings (& I18N) + String msg = "User/group does not exist: "+authorityName+" (constraint="+conStr+")"; + logger.warn(msg); + } + + // validate caveat list + for (String value : caveatList) + { + if (! allowedValues.contains(value)) + { + // TODO - review warnings (& add I18N) + String msg = "Invalid value in list: "+value+" (authority="+authorityName+", constraint="+conStr+")"; + logger.warn(msg); + } + } + } + } + } + + try + { + writeLock.lock(); + // we can't just clear the cache, as all puts to the cache afterwards in this transaction will be ignored + // first delete all keys that are now not in the config + caveatConfig.getKeys().retainAll(caveatConfigMap.keySet()); + + for (Map.Entry conEntry : caveatConfigMap.entrySet()) + { + String conStr = conEntry.getKey(); + Map> caveatMap = (Map>)conEntry.getValue(); + + Map> cacheValue = caveatConfig.get(conStr); + if (cacheValue == null || !cacheValue.equals(caveatMap)) + { + // update the cache + caveatConfig.put(conStr, caveatMap); + } + } + } + finally + { + writeLock.unlock(); + } + } + catch (JSONException e) + { + throw new AlfrescoRuntimeException("Invalid caveat config syntax: "+e); + } + } + } + } + + private NodeRef getCaveatConfigNode() + { + NodeRef rootNode = nodeService.getRootNode(storeRef); + return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_CAVEAT_CONFIG, CAVEAT_CONFIG_NAME); + } + + + public NodeRef updateOrCreateCaveatConfig(InputStream is) + { + NodeRef caveatConfig = getOrCreateCaveatConfig(); + + // Update the content + ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.setEncoding("UTF-8"); + writer.putContent(is); + + return caveatConfig; + } + + public NodeRef updateOrCreateCaveatConfig(File jsonFile) + { + NodeRef caveatConfig = getOrCreateCaveatConfig(); + + // Update the content + ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.setEncoding("UTF-8"); + writer.putContent(jsonFile); + + return caveatConfig; + } + + public NodeRef updateOrCreateCaveatConfig(String jsonString) + { + NodeRef caveatConfig = getOrCreateCaveatConfig(); + + // Update the content + ContentWriter writer = this.contentService.getWriter(caveatConfig, ContentModel.PROP_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.setEncoding("UTF-8"); + writer.putContent(jsonString); + + return caveatConfig; + } + + private NodeRef getOrCreateCaveatConfig() + { + NodeRef caveatConfig = getCaveatConfigNode(); + if (caveatConfig == null) + { + NodeRef rootNode = nodeService.getRootNode(storeRef); + nodeService.addAspect(rootNode, VersionModel.ASPECT_VERSION_STORE_ROOT, null); + + // Create caveat config + caveatConfig = nodeService.createNode(rootNode, + RecordsManagementModel.ASSOC_CAVEAT_CONFIG, + QName.createQName(RecordsManagementModel.RM_URI, CAVEAT_CONFIG_NAME), + RecordsManagementModel.TYPE_CAVEAT_CONFIG).getChildRef(); + + nodeService.setProperty(caveatConfig, ContentModel.PROP_NAME, CAVEAT_CONFIG_NAME); + } + + return caveatConfig; + } + + // Get list of all caveat qualified names + public Collection getRMConstraintNames() + { + Collection rmConstraintNames = Collections.emptySet(); + try + { + readLock.lock(); + rmConstraintNames = caveatConfig.getKeys(); + } + finally + { + readLock.unlock(); + } + return Collections.unmodifiableCollection(rmConstraintNames); + } + + // Get allowed values for given caveat (for current user) + public List getRMAllowedValues(String constraintName) + { + List allowedValues = new ArrayList(0); + + String userName = AuthenticationUtil.getRunAsUser(); + if (userName != null && !(AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser())) + { + // note: userName and userGroupNames must not be null + caveatConfig.get(constraintName); + + Set userGroupFullNames = authorityService.getAuthoritiesForUser(userName); + allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName); + } + + return allowedValues; + } + + private List getRMAllowedValues(String userName, Set userGroupFullNames, String constraintName) + { + SetallowedValues = new HashSet(); + + // note: userName and userGroupNames must not be null + Map> caveatConstraintDef = null; + try + { + readLock.lock(); + caveatConstraintDef = caveatConfig.get(constraintName); + } + finally + { + readLock.unlock(); + } + + if (caveatConstraintDef != null) + { + List direct = caveatConstraintDef.get(userName); + if(direct != null) + { + allowedValues.addAll(direct); + } + + for (String group : userGroupFullNames) + { + List values = caveatConstraintDef.get(group); + if(values != null) + { + allowedValues.addAll(values); + } + } + } + + Listret = new ArrayList(); + ret.addAll(allowedValues); + return Collections.unmodifiableList(ret); + } + + /** + * Check whether access to 'record component' node is vetoed for current user due to caveat(s) + * + * @param nodeRef + * @return false, if caveat(s) veto access otherwise return true + */ + @SuppressWarnings("unchecked") + public boolean hasAccess(NodeRef nodeRef) + { + try + { + if ((! nodeService.exists(nodeRef)) || (caveatAspectQNames.size() == 0)) + { + return true; + } + + boolean found = false; + for (QName caveatAspectQName : caveatAspectQNames) + { + if (nodeService.hasAspect(nodeRef, caveatAspectQName)) + { + found = true; + break; + } + } + + if (! found) + { + // no caveat aspect + return true; + } + else + { + // check for caveats + String userName = AuthenticationUtil.getRunAsUser(); + if (userName != null) + { + // check all text properties + Map props = nodeService.getProperties(nodeRef); + for (Map.Entry entry : props.entrySet()) + { + QName propName = entry.getKey(); + PropertyDefinition propDef = dictionaryService.getProperty(propName); + + if ((propDef != null) && (propDef.getDataType().getName().equals(DATATYPE_TEXT))) + { + List conDefs = propDef.getConstraints(); + for (ConstraintDefinition conDef : conDefs) + { + Constraint con = conDef.getConstraint(); + if (con instanceof RMListOfValuesConstraint) + { + RMListOfValuesConstraint rmCon = ((RMListOfValuesConstraint)con); + String conName = rmCon.getShortName(); + MatchLogic matchLogic = rmCon.getMatchLogicEnum(); + Map> caveatConstraintDef = caveatConfig.get(conName); + if (caveatConstraintDef == null) + { + continue; + } + else + { + Set userGroupNames = authorityService.getAuthoritiesForUser(userName); + List allowedValues = getRMAllowedValues(userName, userGroupNames, conName); + + List propValues = null; + Object val = entry.getValue(); + if (val instanceof String) + { + propValues = new ArrayList(1); + propValues.add((String)val); + } + else if (val instanceof List) + { + propValues = (List)val; + } + + if (propValues != null && !isAllowed(propValues, allowedValues, matchLogic)) + { + if (logger.isDebugEnabled()) + { + logger.debug("Veto access: caveat="+conName+", userName="+userName+", nodeRef="+nodeRef+", propName="+propName+", propValues="+propValues+", allowedValues="+allowedValues); + } + return false; + } + } + } + } + } + } + } + + return true; + } + } + catch (AccessDeniedException ade) + { + return false; + } + } + + private boolean isAllowed(List propValues, List userGroupValues, MatchLogic matchLogic) + { + if (matchLogic.equals(MatchLogic.AND)) + { + // check user/group values match all values on node + for (String propValue : propValues) + { + if (! userGroupValues.contains(propValue)) + { + if (logger.isTraceEnabled()) + { + logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic); + } + + return false; + } + } + + return true; + } + else if (matchLogic.equals(MatchLogic.OR)) + { + // check user/group values match at least one value on node + for (String propValue : propValues) + { + if (userGroupValues.contains(propValue)) + { + return true; + } + } + + if (logger.isTraceEnabled()) + { + logger.trace("Not allowed: "+propValues+", "+userGroupValues+", "+matchLogic); + } + + return false; + } + + logger.error("Unexpected match logic type: "+matchLogic); + return false; + } + + /** + * Add a single value to an authority in a list. The existing values of the list remain. + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param value + * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. + */ + public void addRMConstraintListValue(String listName, String authorityName, String value) + { + Map> members = null; + try + { + readLock.lock(); + members = caveatConfig.get(listName); + if(members == null) + { + throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName); + } + + try + { + readLock.unlock(); + writeLock.lock(); + // check again + members = caveatConfig.get(listName); + if(members == null) + { + throw new AlfrescoRuntimeException("unable to add to list, list not defined:"+ listName); + } + + List values = members.get(authorityName); + if(values == null) + { + throw new AlfrescoRuntimeException("Unable to add to authority in list. Authority not member listName: "+ listName + " authorityName:" +authorityName); + } + values.add(value); + + caveatConfig.put(listName, members); + updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); + } + finally + { + readLock.lock(); + writeLock.unlock(); + } + + } + finally + { + readLock.unlock(); + } + } + + /** + * Get the member details of the specified list + * @param listName + * @return the details of the specified list + */ + public Map> getListDetails(String listName) + { + Map> listDetails = null; + try + { + readLock.lock(); + listDetails = caveatConfig.get(listName); + } + finally + { + readLock.unlock(); + } + if (listDetails == null) + { + return Collections.emptyMap(); + } + else + { + return Collections.unmodifiableMap(listDetails); + } + } + + public List getRMCaveatModels() + { + return caveatModelQNames; + } + + /** + * Replace the values for an authority in a list. + * The existing values are removed. + * + * If the authority does not already exist in the list, it will be added + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param values + */ + public void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues) + { + Map> members = null; + try + { + writeLock.lock(); + members = caveatConfig.get(listName); + if(members == null) + { + // Create the new list, with the authority name + Map> constraint = new HashMap>(0); + constraint.put(authorityName, new ArrayList(values)); + members = constraint; + } + else + { + members.put(authorityName, new ArrayList(values)); + } + + caveatConfig.put(listName, members); + updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); + } + finally + { + writeLock.unlock(); + } + } + + /** + * Replace the authorities for a value in a list + * + * @param listName + * @param valueName + * @param authorities + */ + public void updateRMConstraintListValue(String listName, String valueName, Listauthorities) + { + + Map> members = caveatConfig.get(listName); + try + { + writeLock.lock(); + + if(members == null) + { + // Members List does not exist + Map> emptyConstraint = new HashMap>(0); + caveatConfig.put(listName, emptyConstraint); + members = emptyConstraint; + + } + // authorities contains authority, values[] + // pivot contains value, members[] + Map> pivot = PivotUtil.getPivot(members); + + // remove all authorities which have this value + List existingAuthorities = pivot.get(valueName); + if(existingAuthorities != null) + { + for(String authority : existingAuthorities) + { + List vals = members.get(authority); + vals.remove(valueName); + } + } + // add the new authorities for this value + for(String authority : authorities) + { + List vals = members.get(authority); + if(vals == null) + { + vals= new ArrayList(); + members.put(authority, vals); + } + vals.add(valueName); + } + caveatConfig.put(listName, members); + updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); + } + finally + { + writeLock.unlock(); + } + } + + public void removeRMConstraintListValue(String listName, String valueName) + { + Map> members = null; + try + { + readLock.lock(); + + members = caveatConfig.get(listName); + if (members != null) + { + try + { + readLock.unlock(); + writeLock.lock(); + // check again + members = caveatConfig.get(listName); + if (members != null) + { + // authorities contains authority, values[] + // pivot contains value, members[] + Map> pivot = PivotUtil.getPivot(members); + + // remove all authorities which have this value + List existingAuthorities = pivot.get(valueName); + if(existingAuthorities != null) + { + for(String authority : existingAuthorities) + { + List vals = members.get(authority); + vals.remove(valueName); + } + caveatConfig.put(listName, members); + } + } + + updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); + } + finally + { + readLock.lock(); + writeLock.unlock(); + } + } + } + finally + { + readLock.unlock(); + } + } + + /** + * Remove an authority from a list + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param values + */ + public void removeRMConstraintListAuthority(String listName, String authorityName) + { + Map> members = null; + try + { + writeLock.lock(); + members = caveatConfig.get(listName); + if(members != null) + { + members.remove(listName); + } + + caveatConfig.put(listName, members); + updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); + + } + finally + { + writeLock.unlock(); + } +} + + /** + * @param config the configuration to convert + * @return a String containing the JSON representation of the configuration. + */ + private String convertToJSONString(SimpleCache>> config) + { + JSONObject configJSONObject = new JSONObject(); + + Collection listNames = config.getKeys(); + for (String listName : listNames) + { + Map> members = config.get(listName); + + Set authorityNames = members.keySet(); + JSONObject listMembers = new JSONObject(); + + for (String authorityName : authorityNames) + { + List authorities = members.get(authorityName); + try + { + listMembers.put(authorityName, authorities); + } + catch (JSONException error) + { + StringBuilder sb = new StringBuilder(); + sb.append("Cannot add the key '"); + sb.append(authorityName); + sb.append("' with the value '"); + sb.append(authorities); + sb.append("' to the JSONObject 'listMembers' '"); + sb.append(listMembers); + sb.append("': "); + sb.append(getFullStackTrace(error)); + throw new AlfrescoRuntimeException(sb.toString()); + } + } + + try + { + configJSONObject.put(listName, listMembers); + } + catch (JSONException error) + { + StringBuilder sb = new StringBuilder(); + sb.append("Cannot add the key '"); + sb.append(listName); + sb.append("' with the value '"); + sb.append(listMembers); + sb.append("' to the JSONObject 'configJSONObject' '"); + sb.append(configJSONObject); + sb.append("': "); + sb.append(getFullStackTrace(error)); + throw new AlfrescoRuntimeException(sb.toString()); + } + } + + return configJSONObject.toString(); + } + + /** + * Get an RMConstraintInfo + * @param listQName + * @return the constraint or null if it does not exist + */ + public RMConstraintInfo getRMConstraint(QName listQName) + { + ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); + if(dictionaryDef != null) + { + Constraint con = dictionaryDef.getConstraint(); + if (con instanceof RMListOfValuesConstraint) + { + final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; + + RMConstraintInfo info = new RMConstraintInfo(); + info.setName(listQName.toPrefixString()); + info.setTitle(con.getTitle()); + List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() + { + public List doWork() + { + return def.getAllowedValues(); + } + }, AuthenticationUtil.getSystemUserName()); + + info.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); + info.setCaseSensitive(def.isCaseSensitive()); + return info; + } + } + return null; + } + + /** + * Get RM Constraint detail. + * + * @return the constraintInfo or null + */ + public RMConstraintInfo getRMConstraint(String listName) + { + QName listQName = QName.createQName(listName, namespaceService); + return getRMConstraint(listQName); + } + + public void deleteRMConstraint(String listName) + { + try + { + writeLock.lock(); + caveatConfig.remove(listName); + updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); + } + finally + { + writeLock.unlock(); + } + } + + public void addRMConstraint(String listName) + { + try + { + writeLock.lock(); + Map> emptyConstraint = new HashMap>(0); + caveatConfig.put(listName, emptyConstraint); + updateOrCreateCaveatConfig(convertToJSONString(caveatConfig)); + } + finally + { + writeLock.unlock(); + } + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java index 4ef215a322..ba2760c27c 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigService.java @@ -1,161 +1,161 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.io.File; -import java.io.InputStream; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.repository.NodeRef; - -public interface RMCaveatConfigService -{ - void init(); - - /** - * Get allowed values for given caveat list (for current user) - * @param constraintName - * @return - */ - List getRMAllowedValues(String constraintName); - - /** - * Check whether access to 'record component' node is vetoed for current user due to caveat(s) - * - * @param nodeRef - * @return false, if caveat(s) veto access otherwise return true - */ - boolean hasAccess(NodeRef nodeRef); - - /* - * Get a single RM constraint - */ - RMConstraintInfo getRMConstraint(String listName); - - /* - * Get the names of all the caveat lists - */ - Set getAllRMConstraints(); - - /** - * Get the details of a caveat list - * @param listName - * @return - */ - Map> getListDetails(String listName); - - NodeRef updateOrCreateCaveatConfig(File jsonFile); - - NodeRef updateOrCreateCaveatConfig(String jsonString); - - NodeRef updateOrCreateCaveatConfig(InputStream is); - - /** - * add RM constraint list - * @param listName the name of the RMConstraintList - * @param listTitle - */ - RMConstraintInfo addRMConstraint(String listName, String listTitle, String[] allowedValues); - - /** - * update RM constraint list allowed values - * @param listName the name of the RMConstraintList - can not be changed - * @param allowedValues - */ - RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues); - - /** - * update RM constraint Title - * @param listName the name of the RMConstraintList - can not be changed - * @param allowedValues - */ - RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle); - - - /** - * delete RM Constraint - * - * @param listName the name of the RMConstraintList - */ - void deleteRMConstraint(String listName); - - /** - * Add a single value to an authority in a list. The existing values of the list remain. - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. - */ - void addRMConstraintListValue(String listName, String authorityName, String value); - - /** - * Replace the values for an authority in a list. - * The existing values are removed. - * - * If the authority does not already exist in the list, it will be added - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues); - - /** - * Remove an authority from a list - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - void removeRMConstraintListAuthority(String listName, String authorityName); - - /** - * Replace the values for an authority in a list. - * The existing values are removed. - * - * If the authority does not already exist in the list, it will be added - * - * @param listName the name of the RMConstraintList - * @param value - * @param authorities - */ - void updateRMConstraintListValue(String listName, String value, Listauthorities); - - /** - * Remove an authority from a list - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param value - */ - void removeRMConstraintListValue(String listName, String valueName); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.io.File; +import java.io.InputStream; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.service.cmr.repository.NodeRef; + +public interface RMCaveatConfigService +{ + void init(); + + /** + * Get allowed values for given caveat list (for current user) + * @param constraintName + * @return + */ + List getRMAllowedValues(String constraintName); + + /** + * Check whether access to 'record component' node is vetoed for current user due to caveat(s) + * + * @param nodeRef + * @return false, if caveat(s) veto access otherwise return true + */ + boolean hasAccess(NodeRef nodeRef); + + /* + * Get a single RM constraint + */ + RMConstraintInfo getRMConstraint(String listName); + + /* + * Get the names of all the caveat lists + */ + Set getAllRMConstraints(); + + /** + * Get the details of a caveat list + * @param listName + * @return + */ + Map> getListDetails(String listName); + + NodeRef updateOrCreateCaveatConfig(File jsonFile); + + NodeRef updateOrCreateCaveatConfig(String jsonString); + + NodeRef updateOrCreateCaveatConfig(InputStream is); + + /** + * add RM constraint list + * @param listName the name of the RMConstraintList + * @param listTitle + */ + RMConstraintInfo addRMConstraint(String listName, String listTitle, String[] allowedValues); + + /** + * update RM constraint list allowed values + * @param listName the name of the RMConstraintList - can not be changed + * @param allowedValues + */ + RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues); + + /** + * update RM constraint Title + * @param listName the name of the RMConstraintList - can not be changed + * @param allowedValues + */ + RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle); + + + /** + * delete RM Constraint + * + * @param listName the name of the RMConstraintList + */ + void deleteRMConstraint(String listName); + + /** + * Add a single value to an authority in a list. The existing values of the list remain. + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param values + * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. + */ + void addRMConstraintListValue(String listName, String authorityName, String value); + + /** + * Replace the values for an authority in a list. + * The existing values are removed. + * + * If the authority does not already exist in the list, it will be added + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param values + */ + void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues); + + /** + * Remove an authority from a list + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param values + */ + void removeRMConstraintListAuthority(String listName, String authorityName); + + /** + * Replace the values for an authority in a list. + * The existing values are removed. + * + * If the authority does not already exist in the list, it will be added + * + * @param listName the name of the RMConstraintList + * @param value + * @param authorities + */ + void updateRMConstraintListValue(String listName, String value, Listauthorities); + + /** + * Remove an authority from a list + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param value + */ + void removeRMConstraintListValue(String listName, String valueName); +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java index 8994ff4d18..38dc6db54d 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java @@ -1,437 +1,437 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.io.File; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.Constraint; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * RM Caveat Config Service impl - * - * @author janv - */ -public class RMCaveatConfigServiceImpl implements RMCaveatConfigService -{ - private static Log logger = LogFactory.getLog(RMCaveatConfigServiceImpl.class); - - private NamespaceService namespaceService; - private DictionaryService dictionaryService; - - private RMCaveatConfigComponent rmCaveatConfigComponent; - private RecordsManagementAdminService recordsManagementAdminService; - - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - public void setCaveatConfigComponent(RMCaveatConfigComponent rmCaveatConfigComponent) - { - this.rmCaveatConfigComponent = rmCaveatConfigComponent; - } - - public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - public RecordsManagementAdminService getRecordsManagementAdminService() - { - return recordsManagementAdminService; - } - - public void init() - { - rmCaveatConfigComponent.init(); - } - - public NodeRef updateOrCreateCaveatConfig(InputStream is) - { - return rmCaveatConfigComponent.updateOrCreateCaveatConfig(is); - } - - public NodeRef updateOrCreateCaveatConfig(File jsonFile) - { - return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonFile); - } - - public NodeRef updateOrCreateCaveatConfig(String jsonString) - { - return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonString); - } - - // Get allowed values for given caveat (for current user) - public List getRMAllowedValues(String constraintName) - { - return rmCaveatConfigComponent.getRMAllowedValues(constraintName); - } - - /** - * Check whether access to 'record component' node is vetoed for current user due to caveat(s) - * - * @param nodeRef - * @return false, if caveat(s) veto access otherwise return true - */ - public boolean hasAccess(NodeRef nodeRef) - { - return rmCaveatConfigComponent.hasAccess(nodeRef); - } - - /** - * add RM constraint list - * @param listName the name of the RMConstraintList - */ - public RMConstraintInfo addRMConstraint(String listName, String title, String[] values) - { - return addRMConstraint(listName, title, values, MatchLogic.AND); - } - - public RMConstraintInfo addRMConstraint(String listName, String title, String[] values, MatchLogic matchLogic) - { - if (listName == null) - { - // Generate a list name - StringBuilder sb = new StringBuilder(); - sb.append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX); - sb.append(QName.NAMESPACE_PREFIX); - sb.append(UUID.randomUUID().toString()); - listName = sb.toString(); - } - - ListallowedValues = new ArrayList(); - for(String value : values) - { - allowedValues.add(value); - } - - QName listQName = QName.createQName(listName, namespaceService); - - // TEMP review - if it already exists then change it for now - try - { - recordsManagementAdminService.addCustomConstraintDefinition(listQName, title, true, allowedValues, matchLogic); - } - catch (AlfrescoRuntimeException e) - { - if (e.getMessage().contains("Constraint already exists")) - { - recordsManagementAdminService.changeCustomConstraintValues(listQName, allowedValues); - recordsManagementAdminService.changeCustomConstraintTitle(listQName, title); - } - } - - rmCaveatConfigComponent.addRMConstraint(listName); - - RMConstraintInfo info = new RMConstraintInfo(); - info.setName(listQName.toPrefixString()); - info.setTitle(title); - info.setAllowedValues(values); - info.setCaseSensitive(true); - return info; - } - - /** - * delete RM Constraint List - * - * @param listName the name of the RMConstraintList - */ - public void deleteRMConstraint(String listName) - { - rmCaveatConfigComponent.deleteRMConstraint(listName); - - QName listQName = QName.createQName(listName, namespaceService); - - recordsManagementAdminService.removeCustomConstraintDefinition(listQName); - } - - /** - * Add a single value to an authority in a list. The existing values of the list remain. - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. - */ - public void addRMConstraintListValue(String listName, String authorityName, String value) - { - rmCaveatConfigComponent.addRMConstraintListValue(listName, authorityName, value); - } - - /** - * Get the details of the specified list - * @param listName - * @return the details of the specified list - */ - public Map> getListDetails(String listName) - { - return rmCaveatConfigComponent.getListDetails(listName); - } - - /** - * Replace the values for an authority in a list. - * The existing values are removed. - * - * If the authority does not already exist in the list, it will be added - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - public void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues) - { - rmCaveatConfigComponent.updateRMConstraintListAuthority(listName, authorityName, values); - } - - /** - * Replace the authorities for a value in a list - * - * @param listName - * @param valueName - * @param authorities - */ - public void updateRMConstraintListValue(String listName, String valueName, Listauthorities) - { - rmCaveatConfigComponent.updateRMConstraintListValue(listName, valueName, authorities); - } - - /** - * Remove an authority from a list - * - * @param listName the name of the RMConstraintList - * @param authorityName - * @param values - */ - public void removeRMConstraintListAuthority(String listName, String authorityName) - { - rmCaveatConfigComponent.removeRMConstraintListAuthority(listName, authorityName); - } - - /** - * Get all Constraint Lists - */ - public Set getAllRMConstraints() - { - Set info = new HashSet(); - - List defs = new ArrayList(10); - for (QName caveatModelQName : rmCaveatConfigComponent.getRMCaveatModels()) - { - defs.addAll(recordsManagementAdminService.getCustomConstraintDefinitions(caveatModelQName)); - } - - for(ConstraintDefinition dictionaryDef : defs) - { - Constraint con = dictionaryDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; - RMConstraintInfo i = new RMConstraintInfo(); - i.setName(def.getShortName()); - i.setTitle(def.getTitle()); - - // note: assumes only one caveat/LOV against a given property - List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return def.getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - i.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); - i.setCaseSensitive(def.isCaseSensitive()); - info.add(i); - } - - } - - return info; - } - - /** - * Get an RMConstraintInfo - * @param listQName - * @return the constraint or null if it does not exist - */ - public RMConstraintInfo getRMConstraint(QName listQName) - { - ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); - if(dictionaryDef != null) - { - Constraint con = dictionaryDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; - - RMConstraintInfo info = new RMConstraintInfo(); - info.setName(listQName.toPrefixString()); - info.setTitle(con.getTitle()); - List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return def.getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - info.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); - info.setCaseSensitive(def.isCaseSensitive()); - return info; - } - } - return null; - } - - /** - * Get RM Constraint detail. - * - * @return the constraintInfo or null - */ - public RMConstraintInfo getRMConstraint(String listName) - { - QName listQName = QName.createQName(listName, namespaceService); - return getRMConstraint(listQName); - - } - - /** - * Update The allowed values for an RM Constraint. - * - * @param listName The name of the list. - * @param allowedValues the new alowed values - * - */ - public RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues) - { - QName listQName = QName.createQName(listName, namespaceService); - - if(allowedValues != null) - { - ListallowedValueList = new ArrayList(); - for(String value : allowedValues) - { - allowedValueList.add(value); - } - - ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); - Constraint con = dictionaryDef.getConstraint(); - if (con instanceof RMListOfValuesConstraint) - { - final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; - List oldAllowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - return def.getAllowedValues(); - } - }, AuthenticationUtil.getSystemUserName()); - - /** - * Deal with any additions - */ - for(String newValue : allowedValueList) - { - if(!oldAllowedValues.contains(newValue) && logger.isDebugEnabled()) - { - // This is an addition - logger.debug("value added to list:" + listQName + ":" + newValue); - } - } - - /** - * Deal with any deletions - */ - for(String oldValue : oldAllowedValues) - { - if(!allowedValueList.contains(oldValue)) - { - // This is a deletion - if(logger.isDebugEnabled()) - { - logger.debug("value removed from list:" + listQName + ":" + oldValue); - } - removeRMConstraintListValue(listName, oldValue); - } - } - } - - recordsManagementAdminService.changeCustomConstraintValues(listQName, allowedValueList); - } - - return getRMConstraint(listName); - } - - /** - * Remove a value from a list and cascade delete. - */ - public void removeRMConstraintListValue(String listName, String valueName) - { - //TODO need to update the rm constraint definition - // recordsManagementAdminService. - - rmCaveatConfigComponent.removeRMConstraintListValue(listName, valueName); - } - - /** - * Update the title of this RM Constraint. - */ - public RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle) - { - QName listQName = QName.createQName(listName, namespaceService); - - recordsManagementAdminService.changeCustomConstraintTitle(listQName, newTitle); - return getRMConstraint(listName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.io.File; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.dictionary.Constraint; +import org.alfresco.service.cmr.dictionary.ConstraintDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * RM Caveat Config Service impl + * + * @author janv + */ +public class RMCaveatConfigServiceImpl implements RMCaveatConfigService +{ + private static Log logger = LogFactory.getLog(RMCaveatConfigServiceImpl.class); + + private NamespaceService namespaceService; + private DictionaryService dictionaryService; + + private RMCaveatConfigComponent rmCaveatConfigComponent; + private RecordsManagementAdminService recordsManagementAdminService; + + + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + public void setCaveatConfigComponent(RMCaveatConfigComponent rmCaveatConfigComponent) + { + this.rmCaveatConfigComponent = rmCaveatConfigComponent; + } + + public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) + { + this.recordsManagementAdminService = recordsManagementAdminService; + } + + public RecordsManagementAdminService getRecordsManagementAdminService() + { + return recordsManagementAdminService; + } + + public void init() + { + rmCaveatConfigComponent.init(); + } + + public NodeRef updateOrCreateCaveatConfig(InputStream is) + { + return rmCaveatConfigComponent.updateOrCreateCaveatConfig(is); + } + + public NodeRef updateOrCreateCaveatConfig(File jsonFile) + { + return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonFile); + } + + public NodeRef updateOrCreateCaveatConfig(String jsonString) + { + return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonString); + } + + // Get allowed values for given caveat (for current user) + public List getRMAllowedValues(String constraintName) + { + return rmCaveatConfigComponent.getRMAllowedValues(constraintName); + } + + /** + * Check whether access to 'record component' node is vetoed for current user due to caveat(s) + * + * @param nodeRef + * @return false, if caveat(s) veto access otherwise return true + */ + public boolean hasAccess(NodeRef nodeRef) + { + return rmCaveatConfigComponent.hasAccess(nodeRef); + } + + /** + * add RM constraint list + * @param listName the name of the RMConstraintList + */ + public RMConstraintInfo addRMConstraint(String listName, String title, String[] values) + { + return addRMConstraint(listName, title, values, MatchLogic.AND); + } + + public RMConstraintInfo addRMConstraint(String listName, String title, String[] values, MatchLogic matchLogic) + { + if (listName == null) + { + // Generate a list name + StringBuilder sb = new StringBuilder(); + sb.append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX); + sb.append(QName.NAMESPACE_PREFIX); + sb.append(UUID.randomUUID().toString()); + listName = sb.toString(); + } + + ListallowedValues = new ArrayList(); + for(String value : values) + { + allowedValues.add(value); + } + + QName listQName = QName.createQName(listName, namespaceService); + + // TEMP review - if it already exists then change it for now + try + { + recordsManagementAdminService.addCustomConstraintDefinition(listQName, title, true, allowedValues, matchLogic); + } + catch (AlfrescoRuntimeException e) + { + if (e.getMessage().contains("Constraint already exists")) + { + recordsManagementAdminService.changeCustomConstraintValues(listQName, allowedValues); + recordsManagementAdminService.changeCustomConstraintTitle(listQName, title); + } + } + + rmCaveatConfigComponent.addRMConstraint(listName); + + RMConstraintInfo info = new RMConstraintInfo(); + info.setName(listQName.toPrefixString()); + info.setTitle(title); + info.setAllowedValues(values); + info.setCaseSensitive(true); + return info; + } + + /** + * delete RM Constraint List + * + * @param listName the name of the RMConstraintList + */ + public void deleteRMConstraint(String listName) + { + rmCaveatConfigComponent.deleteRMConstraint(listName); + + QName listQName = QName.createQName(listName, namespaceService); + + recordsManagementAdminService.removeCustomConstraintDefinition(listQName); + } + + /** + * Add a single value to an authority in a list. The existing values of the list remain. + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param values + * @throws AlfrescoRuntimeException if either the list or the authority do not already exist. + */ + public void addRMConstraintListValue(String listName, String authorityName, String value) + { + rmCaveatConfigComponent.addRMConstraintListValue(listName, authorityName, value); + } + + /** + * Get the details of the specified list + * @param listName + * @return the details of the specified list + */ + public Map> getListDetails(String listName) + { + return rmCaveatConfigComponent.getListDetails(listName); + } + + /** + * Replace the values for an authority in a list. + * The existing values are removed. + * + * If the authority does not already exist in the list, it will be added + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param values + */ + public void updateRMConstraintListAuthority(String listName, String authorityName, Listvalues) + { + rmCaveatConfigComponent.updateRMConstraintListAuthority(listName, authorityName, values); + } + + /** + * Replace the authorities for a value in a list + * + * @param listName + * @param valueName + * @param authorities + */ + public void updateRMConstraintListValue(String listName, String valueName, Listauthorities) + { + rmCaveatConfigComponent.updateRMConstraintListValue(listName, valueName, authorities); + } + + /** + * Remove an authority from a list + * + * @param listName the name of the RMConstraintList + * @param authorityName + * @param values + */ + public void removeRMConstraintListAuthority(String listName, String authorityName) + { + rmCaveatConfigComponent.removeRMConstraintListAuthority(listName, authorityName); + } + + /** + * Get all Constraint Lists + */ + public Set getAllRMConstraints() + { + Set info = new HashSet(); + + List defs = new ArrayList(10); + for (QName caveatModelQName : rmCaveatConfigComponent.getRMCaveatModels()) + { + defs.addAll(recordsManagementAdminService.getCustomConstraintDefinitions(caveatModelQName)); + } + + for(ConstraintDefinition dictionaryDef : defs) + { + Constraint con = dictionaryDef.getConstraint(); + if (con instanceof RMListOfValuesConstraint) + { + final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; + RMConstraintInfo i = new RMConstraintInfo(); + i.setName(def.getShortName()); + i.setTitle(def.getTitle()); + + // note: assumes only one caveat/LOV against a given property + List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() + { + public List doWork() + { + return def.getAllowedValues(); + } + }, AuthenticationUtil.getSystemUserName()); + + i.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); + i.setCaseSensitive(def.isCaseSensitive()); + info.add(i); + } + + } + + return info; + } + + /** + * Get an RMConstraintInfo + * @param listQName + * @return the constraint or null if it does not exist + */ + public RMConstraintInfo getRMConstraint(QName listQName) + { + ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); + if(dictionaryDef != null) + { + Constraint con = dictionaryDef.getConstraint(); + if (con instanceof RMListOfValuesConstraint) + { + final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; + + RMConstraintInfo info = new RMConstraintInfo(); + info.setName(listQName.toPrefixString()); + info.setTitle(con.getTitle()); + List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() + { + public List doWork() + { + return def.getAllowedValues(); + } + }, AuthenticationUtil.getSystemUserName()); + + info.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); + info.setCaseSensitive(def.isCaseSensitive()); + return info; + } + } + return null; + } + + /** + * Get RM Constraint detail. + * + * @return the constraintInfo or null + */ + public RMConstraintInfo getRMConstraint(String listName) + { + QName listQName = QName.createQName(listName, namespaceService); + return getRMConstraint(listQName); + + } + + /** + * Update The allowed values for an RM Constraint. + * + * @param listName The name of the list. + * @param allowedValues the new alowed values + * + */ + public RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues) + { + QName listQName = QName.createQName(listName, namespaceService); + + if(allowedValues != null) + { + ListallowedValueList = new ArrayList(); + for(String value : allowedValues) + { + allowedValueList.add(value); + } + + ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); + Constraint con = dictionaryDef.getConstraint(); + if (con instanceof RMListOfValuesConstraint) + { + final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; + List oldAllowedValues = AuthenticationUtil.runAs(new RunAsWork>() + { + public List doWork() + { + return def.getAllowedValues(); + } + }, AuthenticationUtil.getSystemUserName()); + + /** + * Deal with any additions + */ + for(String newValue : allowedValueList) + { + if(!oldAllowedValues.contains(newValue) && logger.isDebugEnabled()) + { + // This is an addition + logger.debug("value added to list:" + listQName + ":" + newValue); + } + } + + /** + * Deal with any deletions + */ + for(String oldValue : oldAllowedValues) + { + if(!allowedValueList.contains(oldValue)) + { + // This is a deletion + if(logger.isDebugEnabled()) + { + logger.debug("value removed from list:" + listQName + ":" + oldValue); + } + removeRMConstraintListValue(listName, oldValue); + } + } + } + + recordsManagementAdminService.changeCustomConstraintValues(listQName, allowedValueList); + } + + return getRMConstraint(listName); + } + + /** + * Remove a value from a list and cascade delete. + */ + public void removeRMConstraintListValue(String listName, String valueName) + { + //TODO need to update the rm constraint definition + // recordsManagementAdminService. + + rmCaveatConfigComponent.removeRMConstraintListValue(listName, valueName); + } + + /** + * Update the title of this RM Constraint. + */ + public RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle) + { + QName listQName = QName.createQName(listName, namespaceService); + + recordsManagementAdminService.changeCustomConstraintTitle(listQName, newTitle); + return getRMConstraint(listName); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintInfo.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintInfo.java index cc6d92cd49..c1f64ac184 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintInfo.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintInfo.java @@ -1,88 +1,88 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.util.Arrays; - -public class RMConstraintInfo -{ - private String name; - private String title; - private boolean caseSensitive; - private String[] allowedValues; - - public void setName(String name) - { - this.name = name; - } - public String getName() - { - return name; - } - public void setTitle(String title) - { - this.title = title; - } - public String getTitle() - { - return title; - } - public void setCaseSensitive(boolean caseSensitive) - { - this.caseSensitive = caseSensitive; - } - public boolean isCaseSensitive() - { - return caseSensitive; - } - public void setAllowedValues(String[] values) - { - this.allowedValues = values.clone(); - } - public String[] getAllowedValues() - { - return allowedValues; - } - - @Override - public String toString() - { - StringBuilder builder = new StringBuilder(); - builder.append("RMConstraintInfo [name="); - builder.append(this.name); - builder.append(", title="); - builder.append(this.title); - builder.append(", caseSensitive="); - builder.append(this.caseSensitive); - builder.append(", allowedValues="); - builder.append(Arrays.toString(this.allowedValues)); - builder.append("]"); - return builder.toString(); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.util.Arrays; + +public class RMConstraintInfo +{ + private String name; + private String title; + private boolean caseSensitive; + private String[] allowedValues; + + public void setName(String name) + { + this.name = name; + } + public String getName() + { + return name; + } + public void setTitle(String title) + { + this.title = title; + } + public String getTitle() + { + return title; + } + public void setCaseSensitive(boolean caseSensitive) + { + this.caseSensitive = caseSensitive; + } + public boolean isCaseSensitive() + { + return caseSensitive; + } + public void setAllowedValues(String[] values) + { + this.allowedValues = values.clone(); + } + public String[] getAllowedValues() + { + return allowedValues; + } + + @Override + public String toString() + { + StringBuilder builder = new StringBuilder(); + builder.append("RMConstraintInfo [name="); + builder.append(this.name); + builder.append(", title="); + builder.append(this.title); + builder.append(", caseSensitive="); + builder.append(this.caseSensitive); + builder.append(", allowedValues="); + builder.append(Arrays.toString(this.allowedValues)); + builder.append("]"); + return builder.toString(); + } + +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintMessageKeys.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintMessageKeys.java index 23fe1dfc89..5a898e79ed 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintMessageKeys.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMConstraintMessageKeys.java @@ -1,39 +1,39 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -/** - * A class to hold I18N keys for messages related to constraint validation. - * - * @author tpage - */ -public class RMConstraintMessageKeys -{ - public static final String ERR_NON_STRING = "d_dictionary.constraint.string_length.non_string"; - public static final String ERR_INVALID_VALUE = "d_dictionary.constraint.list_of_values.invalid_value"; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +/** + * A class to hold I18N keys for messages related to constraint validation. + * + * @author tpage + */ +public class RMConstraintMessageKeys +{ + public static final String ERR_NON_STRING = "d_dictionary.constraint.string_length.non_string"; + public static final String ERR_INVALID_VALUE = "d_dictionary.constraint.list_of_values.invalid_value"; +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java index a6e8b51710..d207004788 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/RMListOfValuesConstraint.java @@ -1,259 +1,259 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.dictionary.ConstraintException; -import org.alfresco.service.cmr.i18n.MessageLookup; -import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; -import org.alfresco.service.cmr.repository.datatype.TypeConversionException; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * RM Constraint implementation that ensures the value is one of a constrained - * list of values. By default, this constraint is case-sensitive. - * - * @see #setAllowedValues(List) - * @see #setCaseSensitive(boolean) - * - * @author janv - */ -public class RMListOfValuesConstraint extends ListOfValuesConstraint -{ - private static final String LOV_CONSTRAINT_VALUE = "listconstraint"; - private List allowedValues; - private List allowedValuesUpper; - // defined match logic used by caveat matching (default = "AND") - private MatchLogic matchLogic = MatchLogic.AND; - - public enum MatchLogic - { - // closed marking - all values must match - AND, - // open marking - at least one value must match - OR; - } - - // note: alternative to static init could be to use 'registered' constraint - private static RMCaveatConfigService caveatConfigService; - - public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) - { - RMListOfValuesConstraint.caveatConfigService = caveatConfigService; - } - - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(80); - sb.append("RMListOfValuesConstraint") - .append("[allowedValues=").append(getAllowedValues()) - .append(", caseSensitive=").append(isCaseSensitive()) - .append(", sorted=").append(isSorted()) - .append(", matchLogic=").append(getMatchLogic()) - .append("]"); - return sb.toString(); - } - - public RMListOfValuesConstraint() - { - super(); - - // Set RM list of value constraints to be sorted by default - sorted = true; - } - - /** - * Get the allowed values. Note that these are String instances, but may - * represent non-String values. It is up to the caller to distinguish. - * - * @return Returns the values allowed - */ - @Override - public List getRawAllowedValues() - { - String runAsUser = AuthenticationUtil.getRunAsUser(); - if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null)) - { - // get allowed values for current user - List allowedForUser = caveatConfigService.getRMAllowedValues(getShortName()); - - List filteredList = new ArrayList(allowedForUser.size()); - for (String allowed : allowedForUser) - { - if (this.allowedValues.contains(allowed)) - { - filteredList.add(allowed); - } - } - - return filteredList; - } - else - { - return this.allowedValues; - } - } - - public String getDisplayLabel(String constraintAllowableValue, MessageLookup messageLookup) - { - if (!this.allowedValues.contains(constraintAllowableValue)) - { - return null; - } - - String key = LOV_CONSTRAINT_VALUE; - key += "." + this.getShortName(); - key += "." + constraintAllowableValue; - key = StringUtils.replace(key, ":", "_"); - - String message = messageLookup.getMessage(key, I18NUtil.getLocale()); - return message == null ? constraintAllowableValue : message; - } - - private List getAllowedValuesUpper() - { - String runAsUser = AuthenticationUtil.getRunAsUser(); - if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null)) - { - // get allowed values for current user - List allowedForUser = caveatConfigService.getRMAllowedValues(getType()); - - List filteredList = new ArrayList(allowedForUser.size()); - for (String allowed : allowedForUser) - { - if (this.allowedValuesUpper.contains(allowed.toUpperCase())) - { - filteredList.add(allowed); - } - } - - return filteredList; - } - else - { - return this.allowedValuesUpper; - } - } - /** - * Set the values that are allowed by the constraint. - * - * @param values a list of allowed values - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void setAllowedValues(List allowedValues) - { - if (allowedValues == null) - { - allowedValues = new ArrayList(0); - } - int valueCount = allowedValues.size(); - this.allowedValues = Collections.unmodifiableList(allowedValues); - - // make the upper case versions - this.allowedValuesUpper = new ArrayList(valueCount); - for (String allowedValue : this.allowedValues) - { - allowedValuesUpper.add(allowedValue.toUpperCase()); - } - } - - @Override - public void initialize() - { - checkPropertyNotNull("allowedValues", allowedValues); - } - - @Override - public Map getParameters() - { - Map params = new HashMap(2); - - params.put("caseSensitive", isCaseSensitive()); - params.put("allowedValues", getAllowedValues()); - params.put("sorted", isSorted()); - params.put("matchLogic", getMatchLogic()); - - return params; - } - - public MatchLogic getMatchLogicEnum() - { - return matchLogic; - } - - public String getMatchLogic() - { - return matchLogic.toString(); - } - - public void setMatchLogic(String matchLogicStr) - { - this.matchLogic = MatchLogic.valueOf(matchLogicStr); - } - - @Override - protected void evaluateSingleValue(Object value) - { - // convert the value to a String - String valueStr = null; - try - { - valueStr = DefaultTypeConverter.INSTANCE.convert(String.class, value); - } - catch (TypeConversionException e) - { - throw new ConstraintException(RMConstraintMessageKeys.ERR_NON_STRING, value, e); - } - // check that the value is in the set of allowed values - if (isCaseSensitive()) - { - if (!getAllowedValues().contains(valueStr)) - { - throw new ConstraintException(RMConstraintMessageKeys.ERR_INVALID_VALUE, value); - } - } - else - { - if (!getAllowedValuesUpper().contains(valueStr.toUpperCase())) - { - throw new ConstraintException(RMConstraintMessageKeys.ERR_INVALID_VALUE, value); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.dictionary.ConstraintException; +import org.alfresco.service.cmr.i18n.MessageLookup; +import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; +import org.alfresco.service.cmr.repository.datatype.TypeConversionException; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * RM Constraint implementation that ensures the value is one of a constrained + * list of values. By default, this constraint is case-sensitive. + * + * @see #setAllowedValues(List) + * @see #setCaseSensitive(boolean) + * + * @author janv + */ +public class RMListOfValuesConstraint extends ListOfValuesConstraint +{ + private static final String LOV_CONSTRAINT_VALUE = "listconstraint"; + private List allowedValues; + private List allowedValuesUpper; + // defined match logic used by caveat matching (default = "AND") + private MatchLogic matchLogic = MatchLogic.AND; + + public enum MatchLogic + { + // closed marking - all values must match + AND, + // open marking - at least one value must match + OR; + } + + // note: alternative to static init could be to use 'registered' constraint + private static RMCaveatConfigService caveatConfigService; + + public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) + { + RMListOfValuesConstraint.caveatConfigService = caveatConfigService; + } + + + @Override + public String toString() + { + StringBuilder sb = new StringBuilder(80); + sb.append("RMListOfValuesConstraint") + .append("[allowedValues=").append(getAllowedValues()) + .append(", caseSensitive=").append(isCaseSensitive()) + .append(", sorted=").append(isSorted()) + .append(", matchLogic=").append(getMatchLogic()) + .append("]"); + return sb.toString(); + } + + public RMListOfValuesConstraint() + { + super(); + + // Set RM list of value constraints to be sorted by default + sorted = true; + } + + /** + * Get the allowed values. Note that these are String instances, but may + * represent non-String values. It is up to the caller to distinguish. + * + * @return Returns the values allowed + */ + @Override + public List getRawAllowedValues() + { + String runAsUser = AuthenticationUtil.getRunAsUser(); + if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null)) + { + // get allowed values for current user + List allowedForUser = caveatConfigService.getRMAllowedValues(getShortName()); + + List filteredList = new ArrayList(allowedForUser.size()); + for (String allowed : allowedForUser) + { + if (this.allowedValues.contains(allowed)) + { + filteredList.add(allowed); + } + } + + return filteredList; + } + else + { + return this.allowedValues; + } + } + + public String getDisplayLabel(String constraintAllowableValue, MessageLookup messageLookup) + { + if (!this.allowedValues.contains(constraintAllowableValue)) + { + return null; + } + + String key = LOV_CONSTRAINT_VALUE; + key += "." + this.getShortName(); + key += "." + constraintAllowableValue; + key = StringUtils.replace(key, ":", "_"); + + String message = messageLookup.getMessage(key, I18NUtil.getLocale()); + return message == null ? constraintAllowableValue : message; + } + + private List getAllowedValuesUpper() + { + String runAsUser = AuthenticationUtil.getRunAsUser(); + if ((runAsUser != null) && (! runAsUser.equals(AuthenticationUtil.getSystemUserName())) && (caveatConfigService != null)) + { + // get allowed values for current user + List allowedForUser = caveatConfigService.getRMAllowedValues(getType()); + + List filteredList = new ArrayList(allowedForUser.size()); + for (String allowed : allowedForUser) + { + if (this.allowedValuesUpper.contains(allowed.toUpperCase())) + { + filteredList.add(allowed); + } + } + + return filteredList; + } + else + { + return this.allowedValuesUpper; + } + } + /** + * Set the values that are allowed by the constraint. + * + * @param values a list of allowed values + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void setAllowedValues(List allowedValues) + { + if (allowedValues == null) + { + allowedValues = new ArrayList(0); + } + int valueCount = allowedValues.size(); + this.allowedValues = Collections.unmodifiableList(allowedValues); + + // make the upper case versions + this.allowedValuesUpper = new ArrayList(valueCount); + for (String allowedValue : this.allowedValues) + { + allowedValuesUpper.add(allowedValue.toUpperCase()); + } + } + + @Override + public void initialize() + { + checkPropertyNotNull("allowedValues", allowedValues); + } + + @Override + public Map getParameters() + { + Map params = new HashMap(2); + + params.put("caseSensitive", isCaseSensitive()); + params.put("allowedValues", getAllowedValues()); + params.put("sorted", isSorted()); + params.put("matchLogic", getMatchLogic()); + + return params; + } + + public MatchLogic getMatchLogicEnum() + { + return matchLogic; + } + + public String getMatchLogic() + { + return matchLogic.toString(); + } + + public void setMatchLogic(String matchLogicStr) + { + this.matchLogic = MatchLogic.valueOf(matchLogicStr); + } + + @Override + protected void evaluateSingleValue(Object value) + { + // convert the value to a String + String valueStr = null; + try + { + valueStr = DefaultTypeConverter.INSTANCE.convert(String.class, value); + } + catch (TypeConversionException e) + { + throw new ConstraintException(RMConstraintMessageKeys.ERR_NON_STRING, value, e); + } + // check that the value is in the set of allowed values + if (isCaseSensitive()) + { + if (!getAllowedValues().contains(valueStr)) + { + throw new ConstraintException(RMConstraintMessageKeys.ERR_INVALID_VALUE, value); + } + } + else + { + if (!getAllowedValuesUpper().contains(valueStr.toUpperCase())) + { + throw new ConstraintException(RMConstraintMessageKeys.ERR_INVALID_VALUE, value); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptAuthority.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptAuthority.java index 72eb9f263f..eb30b1beca 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptAuthority.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptAuthority.java @@ -1,60 +1,60 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.io.Serializable; - - -public class ScriptAuthority implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = 1L; - private String authorityTitle; - private String authorityName; - - public void setAuthorityName(String authorityName) - { - this.authorityName = authorityName; - } - public String getAuthorityName() - { - return authorityName; - } - public void setAuthorityTitle(String authorityName) - { - this.authorityTitle = authorityName; - } - public String getAuthorityTitle() - { - return authorityTitle; - } - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.io.Serializable; + + +public class ScriptAuthority implements Serializable +{ + /** + * + */ + private static final long serialVersionUID = 1L; + private String authorityTitle; + private String authorityName; + + public void setAuthorityName(String authorityName) + { + this.authorityName = authorityName; + } + public String getAuthorityName() + { + return authorityName; + } + public void setAuthorityTitle(String authorityName) + { + this.authorityTitle = authorityName; + } + public String getAuthorityTitle() + { + return authorityTitle; + } + + +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java index 651d81195c..62e17f26bc 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraint.java @@ -1,270 +1,270 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.service.cmr.security.AuthorityService; -import org.apache.commons.lang.StringUtils; -import org.json.JSONArray; -import org.json.JSONObject; - -public class ScriptConstraint implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = 1L; - - private RMConstraintInfo info; - - private RMCaveatConfigService rmCaveatconfigService; - - private AuthorityService authorityService; - - ScriptConstraint(RMConstraintInfo info, RMCaveatConfigService rmCaveatconfigService, AuthorityService authorityService) - { - this.info = info; - this.rmCaveatconfigService = rmCaveatconfigService; - this.authorityService = authorityService; - } - - public void setTitle(String title) - { - info.setTitle(title); - } - public String getTitle() - { - return info.getTitle(); - } - public void setName(String name) - { - info.setName(name); - } - - public String getName() - { - return info.getName().replace(":", "_"); - } - - public boolean isCaseSensitive() - { - return info.isCaseSensitive(); - } - - public String[] getAllowedValues() - { - return info.getAllowedValues(); - } - - public ScriptConstraintAuthority[] getAuthorities() - { - Map> values = rmCaveatconfigService.getListDetails(info.getName()); - - if (values == null) - { - return new ScriptConstraintAuthority[0]; - } - - // Here with some data to return - Set authorities = values.keySet(); - - ArrayList constraints = new ArrayList(values.size()); - for(String authority : authorities) - { - ScriptConstraintAuthority constraint = new ScriptConstraintAuthority(); - constraint.setAuthorityName(authority); - constraint.setValues(values.get(authority)); - constraints.add(constraint); - } - - ScriptConstraintAuthority[] retVal = constraints.toArray(new ScriptConstraintAuthority[constraints.size()]); - - return retVal; - } - - /** - * updateTitle - */ - public void updateTitle(String newTitle) - { - info.setTitle(newTitle); - rmCaveatconfigService.updateRMConstraintTitle(info.getName(), newTitle) ; - } - - /** - * updateAllowedValues - */ - public void updateAllowedValues(String[] allowedValues) - { - info.setAllowedValues(allowedValues); - rmCaveatconfigService.updateRMConstraintAllowedValues(info.getName(), allowedValues); - } - - /** - * Update a value - * @param values - * @param authorities - */ - public void updateValues(JSONArray bodge) throws Exception - { - for(int i = 0; i < bodge.length(); i++) - { - - JSONObject obj = bodge.getJSONObject(i); - String value = obj.getString("value"); - JSONArray authorities = obj.getJSONArray("authorities"); - List aList = new ArrayList(); - for(int j = 0; j < authorities.length();j++) - { - aList.add(authorities.getString(j)); - } - rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, aList); - } - } - - /** - * Update a value - * @param values - * @param authorities - */ - public void updateValues(String value, String[] authorities) - { - List list = Arrays.asList(authorities); - rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, list); - } - - /** - * Cascade delete an authority - * @param authority - */ - public void deleteAuthority(String authority) - { - - } - - /** - * Cascade delete a value - * @param value - */ - public void deleteValue(String value) - { - - } - - - /** - * Get a single value - * @param value - * @return - */ - public ScriptConstraintValue getValue(String value) - { - ScriptConstraintValue[] values = getValues(); - - for(ScriptConstraintValue val : values) - { - if(val.getValueName().equalsIgnoreCase(value)) - { - return val; - } - } - return null; - } - - public ScriptConstraintValue[] getValues() - { - // authority, values - Map> details = rmCaveatconfigService.getListDetails(info.getName()); - - if (details == null) - { - details = new HashMap>(); - } - - // values, authorities - Map> pivot = PivotUtil.getPivot(details); - - // Here with some data to return - Set values = pivot.keySet(); - - ArrayList constraints = new ArrayList(pivot.size()); - for(String value : values) - { - ScriptConstraintValue constraint = new ScriptConstraintValue(); - constraint.setValueName(value); - constraint.setValueTitle(value); - - Listauthorities = pivot.get(value); - List sauth = new ArrayList(); - for(String authority : authorities) - { - ScriptAuthority a = new ScriptAuthority(); - a.setAuthorityName(authority); - - String displayName = authorityService.getAuthorityDisplayName(authority); - if(StringUtils.isNotBlank(displayName)) - { - a.setAuthorityTitle(displayName); - } - else - { - a.setAuthorityTitle(authority); - } - sauth.add(a); - } - constraint.setAuthorities(sauth); - constraints.add(constraint); - } - - /** - * Now go through and add any "empty" values - */ - for(String value : info.getAllowedValues()) - { - if(!values.contains(value)) - { - ScriptConstraintValue constraint = new ScriptConstraintValue(); - constraint.setValueName(value); - constraint.setValueTitle(value); - List sauth = new ArrayList(); - constraint.setAuthorities(sauth); - constraints.add(constraint); - } - } - - return constraints.toArray(new ScriptConstraintValue[constraints.size()]); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.service.cmr.security.AuthorityService; +import org.apache.commons.lang.StringUtils; +import org.json.JSONArray; +import org.json.JSONObject; + +public class ScriptConstraint implements Serializable +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + private RMConstraintInfo info; + + private RMCaveatConfigService rmCaveatconfigService; + + private AuthorityService authorityService; + + ScriptConstraint(RMConstraintInfo info, RMCaveatConfigService rmCaveatconfigService, AuthorityService authorityService) + { + this.info = info; + this.rmCaveatconfigService = rmCaveatconfigService; + this.authorityService = authorityService; + } + + public void setTitle(String title) + { + info.setTitle(title); + } + public String getTitle() + { + return info.getTitle(); + } + public void setName(String name) + { + info.setName(name); + } + + public String getName() + { + return info.getName().replace(":", "_"); + } + + public boolean isCaseSensitive() + { + return info.isCaseSensitive(); + } + + public String[] getAllowedValues() + { + return info.getAllowedValues(); + } + + public ScriptConstraintAuthority[] getAuthorities() + { + Map> values = rmCaveatconfigService.getListDetails(info.getName()); + + if (values == null) + { + return new ScriptConstraintAuthority[0]; + } + + // Here with some data to return + Set authorities = values.keySet(); + + ArrayList constraints = new ArrayList(values.size()); + for(String authority : authorities) + { + ScriptConstraintAuthority constraint = new ScriptConstraintAuthority(); + constraint.setAuthorityName(authority); + constraint.setValues(values.get(authority)); + constraints.add(constraint); + } + + ScriptConstraintAuthority[] retVal = constraints.toArray(new ScriptConstraintAuthority[constraints.size()]); + + return retVal; + } + + /** + * updateTitle + */ + public void updateTitle(String newTitle) + { + info.setTitle(newTitle); + rmCaveatconfigService.updateRMConstraintTitle(info.getName(), newTitle) ; + } + + /** + * updateAllowedValues + */ + public void updateAllowedValues(String[] allowedValues) + { + info.setAllowedValues(allowedValues); + rmCaveatconfigService.updateRMConstraintAllowedValues(info.getName(), allowedValues); + } + + /** + * Update a value + * @param values + * @param authorities + */ + public void updateValues(JSONArray bodge) throws Exception + { + for(int i = 0; i < bodge.length(); i++) + { + + JSONObject obj = bodge.getJSONObject(i); + String value = obj.getString("value"); + JSONArray authorities = obj.getJSONArray("authorities"); + List aList = new ArrayList(); + for(int j = 0; j < authorities.length();j++) + { + aList.add(authorities.getString(j)); + } + rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, aList); + } + } + + /** + * Update a value + * @param values + * @param authorities + */ + public void updateValues(String value, String[] authorities) + { + List list = Arrays.asList(authorities); + rmCaveatconfigService.updateRMConstraintListValue(info.getName(), value, list); + } + + /** + * Cascade delete an authority + * @param authority + */ + public void deleteAuthority(String authority) + { + + } + + /** + * Cascade delete a value + * @param value + */ + public void deleteValue(String value) + { + + } + + + /** + * Get a single value + * @param value + * @return + */ + public ScriptConstraintValue getValue(String value) + { + ScriptConstraintValue[] values = getValues(); + + for(ScriptConstraintValue val : values) + { + if(val.getValueName().equalsIgnoreCase(value)) + { + return val; + } + } + return null; + } + + public ScriptConstraintValue[] getValues() + { + // authority, values + Map> details = rmCaveatconfigService.getListDetails(info.getName()); + + if (details == null) + { + details = new HashMap>(); + } + + // values, authorities + Map> pivot = PivotUtil.getPivot(details); + + // Here with some data to return + Set values = pivot.keySet(); + + ArrayList constraints = new ArrayList(pivot.size()); + for(String value : values) + { + ScriptConstraintValue constraint = new ScriptConstraintValue(); + constraint.setValueName(value); + constraint.setValueTitle(value); + + Listauthorities = pivot.get(value); + List sauth = new ArrayList(); + for(String authority : authorities) + { + ScriptAuthority a = new ScriptAuthority(); + a.setAuthorityName(authority); + + String displayName = authorityService.getAuthorityDisplayName(authority); + if(StringUtils.isNotBlank(displayName)) + { + a.setAuthorityTitle(displayName); + } + else + { + a.setAuthorityTitle(authority); + } + sauth.add(a); + } + constraint.setAuthorities(sauth); + constraints.add(constraint); + } + + /** + * Now go through and add any "empty" values + */ + for(String value : info.getAllowedValues()) + { + if(!values.contains(value)) + { + ScriptConstraintValue constraint = new ScriptConstraintValue(); + constraint.setValueName(value); + constraint.setValueTitle(value); + List sauth = new ArrayList(); + constraint.setAuthorities(sauth); + constraints.add(constraint); + } + } + + return constraints.toArray(new ScriptConstraintValue[constraints.size()]); + } + +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintAuthority.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintAuthority.java index 2fbf847906..d99a23b897 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintAuthority.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintAuthority.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.io.Serializable; -import java.util.List; - -public class ScriptConstraintAuthority implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = -4659454215122271811L; - private String authorityName; - private Listvalues; - - public void setValues(List values) - { - this.values = values; - } - public List getValues() - { - return values; - } - public void setAuthorityName(String authorityName) - { - this.authorityName = authorityName; - } - public String getAuthorityName() - { - return authorityName; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.io.Serializable; +import java.util.List; + +public class ScriptConstraintAuthority implements Serializable +{ + /** + * + */ + private static final long serialVersionUID = -4659454215122271811L; + private String authorityName; + private Listvalues; + + public void setValues(List values) + { + this.values = values; + } + public List getValues() + { + return values; + } + public void setAuthorityName(String authorityName) + { + this.authorityName = authorityName; + } + public String getAuthorityName() + { + return authorityName; + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintValue.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintValue.java index 2f43a8e5d3..0374426265 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintValue.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptConstraintValue.java @@ -1,66 +1,66 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.io.Serializable; -import java.util.List; - -public class ScriptConstraintValue implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = -4659454215122271811L; - private String value; - private Listauthorities; - - public void setAuthorities(List values) - { - this.authorities = values; - } - public List getAuthorities() - { - return authorities; - } - public void setValueName(String authorityName) - { - this.value = authorityName; - } - public String getValueName() - { - return value; - } - public void setValueTitle(String authorityName) - { - this.value = authorityName; - } - public String getValueTitle() - { - return value; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.io.Serializable; +import java.util.List; + +public class ScriptConstraintValue implements Serializable +{ + /** + * + */ + private static final long serialVersionUID = -4659454215122271811L; + private String value; + private Listauthorities; + + public void setAuthorities(List values) + { + this.authorities = values; + } + public List getAuthorities() + { + return authorities; + } + public void setValueName(String authorityName) + { + this.value = authorityName; + } + public String getValueName() + { + return value; + } + public void setValueTitle(String authorityName) + { + this.value = authorityName; + } + public String getValueTitle() + { + return value; + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptRMCaveatConfigService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptRMCaveatConfigService.java index 1e40342b5c..e7417971d6 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptRMCaveatConfigService.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/caveat/ScriptRMCaveatConfigService.java @@ -1,174 +1,174 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.caveat; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.alfresco.repo.jscript.BaseScopableProcessorExtension; -import org.alfresco.service.cmr.security.AuthorityService; - -/** - * Script projection of RM Caveat Config Service - * - * @author Mark Rogers - */ -public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension -{ - private RMCaveatConfigService caveatConfigService; - private AuthorityService authorityService; - - public void setCaveatConfigService(RMCaveatConfigService rmCaveatConfigService) - { - this.caveatConfigService = rmCaveatConfigService; - } - - public RMCaveatConfigService getRmCaveatConfigService() - { - return caveatConfigService; - } - - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - public AuthorityService getAuthorityService() - { - return authorityService; - } - - public ScriptConstraint getConstraint(String listName) - { - //TODO Temporary conversion - String xxx = listName.replace("_", ":"); - - RMConstraintInfo info = caveatConfigService.getRMConstraint(xxx); - - if(info != null) - { - return new ScriptConstraint(info, caveatConfigService, getAuthorityService()); - } - - return null; - } - - public ScriptConstraint[] getAllConstraints() - { - return getConstraints(true); - } - - public ScriptConstraint[] getConstraintsWithoutEmptyList() - { - return getConstraints(false); - } - - private ScriptConstraint[] getConstraints(boolean includeEmptyList) - { - Set values = caveatConfigService.getAllRMConstraints(); - - List vals = new ArrayList(values.size()); - for(RMConstraintInfo value : values) - { - ScriptConstraint c = new ScriptConstraint(value, caveatConfigService, getAuthorityService()); - if (includeEmptyList) - { - vals.add(c); - } - else - { - if (c.getValues().length > 0) - { - vals.add(c); - } - } - } - - return vals.toArray(new ScriptConstraint[vals.size()]); - } - - /** - * Delete list - * @param listName - - */ - public void deleteConstraintList(String listName) - { - //TODO Temporary conversion - String xxx = listName.replace("_", ":"); - caveatConfigService.deleteRMConstraint(xxx); - } - - - - /** - * Update value - */ - public void updateConstraintValues(String listName, String authorityName, String[]values) - { - List vals = new ArrayList(); - caveatConfigService.updateRMConstraintListAuthority(listName, authorityName, vals); - } - - /** - * Delete the constraint values. i.e remove an authority from a constraint list - */ - public void deleteRMConstraintListAuthority(String listName, String authorityName) - { - //TODO Temporary conversion - String xxx = listName.replace("_", ":"); - - caveatConfigService.removeRMConstraintListAuthority(xxx, authorityName); - } - - /** - * Delete the constraint values. i.e remove a value from a constraint list - */ - public void deleteRMConstraintListValue(String listName, String valueName) - { - //TODO Temporary conversion - String xxx = listName.replace("_", ":"); - - caveatConfigService.removeRMConstraintListValue(xxx, valueName); - - } - - public ScriptConstraint createConstraint(String listName, String title, String[] allowedValues) - { - //TODO Temporary conversion - if(listName != null) - { - listName = listName.replace("_", ":"); - } - - RMConstraintInfo info = caveatConfigService.addRMConstraint(listName, title, allowedValues); - return new ScriptConstraint(info, caveatConfigService, getAuthorityService()); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.caveat; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.alfresco.repo.jscript.BaseScopableProcessorExtension; +import org.alfresco.service.cmr.security.AuthorityService; + +/** + * Script projection of RM Caveat Config Service + * + * @author Mark Rogers + */ +public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension +{ + private RMCaveatConfigService caveatConfigService; + private AuthorityService authorityService; + + public void setCaveatConfigService(RMCaveatConfigService rmCaveatConfigService) + { + this.caveatConfigService = rmCaveatConfigService; + } + + public RMCaveatConfigService getRmCaveatConfigService() + { + return caveatConfigService; + } + + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + public AuthorityService getAuthorityService() + { + return authorityService; + } + + public ScriptConstraint getConstraint(String listName) + { + //TODO Temporary conversion + String xxx = listName.replace("_", ":"); + + RMConstraintInfo info = caveatConfigService.getRMConstraint(xxx); + + if(info != null) + { + return new ScriptConstraint(info, caveatConfigService, getAuthorityService()); + } + + return null; + } + + public ScriptConstraint[] getAllConstraints() + { + return getConstraints(true); + } + + public ScriptConstraint[] getConstraintsWithoutEmptyList() + { + return getConstraints(false); + } + + private ScriptConstraint[] getConstraints(boolean includeEmptyList) + { + Set values = caveatConfigService.getAllRMConstraints(); + + List vals = new ArrayList(values.size()); + for(RMConstraintInfo value : values) + { + ScriptConstraint c = new ScriptConstraint(value, caveatConfigService, getAuthorityService()); + if (includeEmptyList) + { + vals.add(c); + } + else + { + if (c.getValues().length > 0) + { + vals.add(c); + } + } + } + + return vals.toArray(new ScriptConstraint[vals.size()]); + } + + /** + * Delete list + * @param listName + + */ + public void deleteConstraintList(String listName) + { + //TODO Temporary conversion + String xxx = listName.replace("_", ":"); + caveatConfigService.deleteRMConstraint(xxx); + } + + + + /** + * Update value + */ + public void updateConstraintValues(String listName, String authorityName, String[]values) + { + List vals = new ArrayList(); + caveatConfigService.updateRMConstraintListAuthority(listName, authorityName, vals); + } + + /** + * Delete the constraint values. i.e remove an authority from a constraint list + */ + public void deleteRMConstraintListAuthority(String listName, String authorityName) + { + //TODO Temporary conversion + String xxx = listName.replace("_", ":"); + + caveatConfigService.removeRMConstraintListAuthority(xxx, authorityName); + } + + /** + * Delete the constraint values. i.e remove a value from a constraint list + */ + public void deleteRMConstraintListValue(String listName, String valueName) + { + //TODO Temporary conversion + String xxx = listName.replace("_", ":"); + + caveatConfigService.removeRMConstraintListValue(xxx, valueName); + + } + + public ScriptConstraint createConstraint(String listName, String title, String[] allowedValues) + { + //TODO Temporary conversion + if(listName != null) + { + listName = listName.replace("_", ":"); + } + + RMConstraintInfo info = caveatConfigService.addRMConstraint(listName, title, allowedValues); + return new ScriptConstraint(info, caveatConfigService, getAuthorityService()); + } + +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/compatibility/CompatibilityModel.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/compatibility/CompatibilityModel.java index 2302f7605a..e89091bbac 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/compatibility/CompatibilityModel.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/compatibility/CompatibilityModel.java @@ -1,48 +1,48 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.compatibility; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.service.namespace.QName; - -/** - * RM 1.0 compatibility model - * - * @author Roy Wetherall - */ -public interface CompatibilityModel extends DOD5015Model -{ - // Record series DOD type - QName TYPE_RECORD_SERIES = QName.createQName(DOD_URI, "recordSeries"); - - // V1.0 custom property aspect names - String NAME_CUSTOM_RECORD_PROPERTIES = "customRecordProperties"; - String NAME_CUSTOM_RECORD_FOLDER_PROPERTIES = "customRecordFolderProperties"; - String NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES = "customRecordCategoryProperties"; - String NAME_CUSTOM_RECORD_SERIES_PROPERTIES = "customRecordSeriesProperties"; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.compatibility; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.service.namespace.QName; + +/** + * RM 1.0 compatibility model + * + * @author Roy Wetherall + */ +public interface CompatibilityModel extends DOD5015Model +{ + // Record series DOD type + QName TYPE_RECORD_SERIES = QName.createQName(DOD_URI, "recordSeries"); + + // V1.0 custom property aspect names + String NAME_CUSTOM_RECORD_PROPERTIES = "customRecordProperties"; + String NAME_CUSTOM_RECORD_FOLDER_PROPERTIES = "customRecordFolderProperties"; + String NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES = "customRecordCategoryProperties"; + String NAME_CUSTOM_RECORD_SERIES_PROPERTIES = "customRecordSeriesProperties"; +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java index b844594bf0..7be4c3382f 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/DeprecatedExtendedSecurityService.java @@ -1,148 +1,148 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.Set; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Deprecated extended security service for compatibility. - * - * @author Roy Wetherall - */ -public interface DeprecatedExtendedSecurityService -{ - /** - * Gets the set of authorities that are extended readers for the given node. - * - * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended readers - * - * @deprecated as of 2.5, use {@link ExtendedSecurityService#getReaders(NodeRef)} - */ - Set getExtendedReaders(NodeRef nodeRef); - - /** - * Get the set of authorities that are extended writers for the given node. - * - * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended writers - * - * @deprecated as of 2.5, use {@link ExtendedSecurityService#getWriters(NodeRef)} - */ - Set getExtendedWriters(NodeRef nodeRef); - - /** - * Add extended security for the specified authorities to a node. - * - * As of, 2.5 this method no longer applies the extended security to parents. - * - * @param nodeRef node reference - * @param readers set of authorities to add extended read permissions - * @param writers set of authorities to add extended write permissions - * - * @deprecated as of 2.5, use {@link ExtendedSecurityService#set(NodeRef, Set, Set)} - */ - @Deprecated - void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers); - - /** - * Add extended security for the specified authorities to a node. - *

- * If specified, the read and write extended permissions are applied to all parents up to the file plan as - * extended read. This ensures parental read, but not parental write. - * - * @param nodeRef node reference - * @param readers set of authorities to add extended read permissions - * @param writers set of authorities to add extended write permissions - * @param applyToParents true if extended security applied to parents (read only) false otherwise. - * - * @deprecated as of 2.5, because extended security is no longer applied to parents. Note that calling this method will - * only apply the extended security to the node and the applyToParents parameter value will be ignored. - * - * @see ExtendedSecurityService#set(NodeRef, Set, Set) - */ - @Deprecated void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents); - - /** - * Remove all extended readers and writers from the given node reference. - * - * @param nodeRef node reference - * - * @deprecated as of 2.5, see {@link ExtendedSecurityService#remove(NodeRef)} - */ - @Deprecated void removeAllExtendedSecurity(NodeRef nodeRef); - - /** - * Remove the extended security for the specified authorities from a node. - * - * @param nodeRef node reference - * @param readers set of authorities to remove as extended readers - * @param writers set of authorities to remove as extended writers - * - * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. - * Note that calling this method will now remove all extended security from the node and never applied to parents. - * - * @see {@link ExtendedSecurityService#remove(NodeRef)} - */ - @Deprecated void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers); - - /** - * Remove the extended security for the specified authorities from a node. - *

- * If specified, extended security will also be removed from the parent hierarchy.(read only). Note that - * extended security is records as a reference count, so security will only be utterly removed from the parent - * hierarchy if all references to the authority are removed. - * - * @param nodeRef node reference - * @param readers set of authorities to remove as extended readers - * @param writers set of authorities to remove as extedned writers - * @param applyToParents true if removal of extended security is applied to parent hierarchy (read only), false - * otherwise - * - * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. - * Note that calling this method will now remove all extended security from the node and never applied to parents. - * - * @see {@link ExtendedSecurityService#remove(NodeRef)} - */ - @Deprecated void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents); - - /** - * Remove all extended readers and writers from the given node reference. - * - * @param nodeRef node reference - * @param applyToParents if true then apply removal to parent hierarchy (read only) false otherwise. - * - * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. - * Note that calling this method will now remove all extended security from the node and never applied to parents. - * - * @see {@link ExtendedSecurityService#remove(NodeRef)} - */ - @Deprecated void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.Set; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Deprecated extended security service for compatibility. + * + * @author Roy Wetherall + */ +public interface DeprecatedExtendedSecurityService +{ + /** + * Gets the set of authorities that are extended readers for the given node. + * + * @param nodeRef node reference + * @return {@link Set}<{@link String}> set of extended readers + * + * @deprecated as of 2.5, use {@link ExtendedSecurityService#getReaders(NodeRef)} + */ + Set getExtendedReaders(NodeRef nodeRef); + + /** + * Get the set of authorities that are extended writers for the given node. + * + * @param nodeRef node reference + * @return {@link Set}<{@link String}> set of extended writers + * + * @deprecated as of 2.5, use {@link ExtendedSecurityService#getWriters(NodeRef)} + */ + Set getExtendedWriters(NodeRef nodeRef); + + /** + * Add extended security for the specified authorities to a node. + * + * As of, 2.5 this method no longer applies the extended security to parents. + * + * @param nodeRef node reference + * @param readers set of authorities to add extended read permissions + * @param writers set of authorities to add extended write permissions + * + * @deprecated as of 2.5, use {@link ExtendedSecurityService#set(NodeRef, Set, Set)} + */ + @Deprecated + void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers); + + /** + * Add extended security for the specified authorities to a node. + *

+ * If specified, the read and write extended permissions are applied to all parents up to the file plan as + * extended read. This ensures parental read, but not parental write. + * + * @param nodeRef node reference + * @param readers set of authorities to add extended read permissions + * @param writers set of authorities to add extended write permissions + * @param applyToParents true if extended security applied to parents (read only) false otherwise. + * + * @deprecated as of 2.5, because extended security is no longer applied to parents. Note that calling this method will + * only apply the extended security to the node and the applyToParents parameter value will be ignored. + * + * @see ExtendedSecurityService#set(NodeRef, Set, Set) + */ + @Deprecated void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents); + + /** + * Remove all extended readers and writers from the given node reference. + * + * @param nodeRef node reference + * + * @deprecated as of 2.5, see {@link ExtendedSecurityService#remove(NodeRef)} + */ + @Deprecated void removeAllExtendedSecurity(NodeRef nodeRef); + + /** + * Remove the extended security for the specified authorities from a node. + * + * @param nodeRef node reference + * @param readers set of authorities to remove as extended readers + * @param writers set of authorities to remove as extended writers + * + * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. + * Note that calling this method will now remove all extended security from the node and never applied to parents. + * + * @see {@link ExtendedSecurityService#remove(NodeRef)} + */ + @Deprecated void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers); + + /** + * Remove the extended security for the specified authorities from a node. + *

+ * If specified, extended security will also be removed from the parent hierarchy.(read only). Note that + * extended security is records as a reference count, so security will only be utterly removed from the parent + * hierarchy if all references to the authority are removed. + * + * @param nodeRef node reference + * @param readers set of authorities to remove as extended readers + * @param writers set of authorities to remove as extedned writers + * @param applyToParents true if removal of extended security is applied to parent hierarchy (read only), false + * otherwise + * + * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. + * Note that calling this method will now remove all extended security from the node and never applied to parents. + * + * @see {@link ExtendedSecurityService#remove(NodeRef)} + */ + @Deprecated void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents); + + /** + * Remove all extended readers and writers from the given node reference. + * + * @param nodeRef node reference + * @param applyToParents if true then apply removal to parent hierarchy (read only) false otherwise. + * + * @deprecated as of 2.5, because partial removal of readers and writers from node or parents is no longer supported. + * Note that calling this method will now remove all extended security from the node and never applied to parents. + * + * @see {@link ExtendedSecurityService#remove(NodeRef)} + */ + @Deprecated void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents); +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedReaderDynamicAuthority.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedReaderDynamicAuthority.java index 27b6c97292..4b166ba686 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedReaderDynamicAuthority.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedReaderDynamicAuthority.java @@ -1,98 +1,98 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.repo.security.permissions.PermissionReference; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Extended readers dynamic authority implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public class ExtendedReaderDynamicAuthority extends ExtendedSecurityBaseDynamicAuthority -{ - /** Extended reader role */ - public static final String EXTENDED_READER = "ROLE_EXTENDED_READER"; - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority() - */ - @Override - public String getAuthority() - { - return EXTENDED_READER; - } - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor() - */ - @Override - public Set requiredFor() - { - if (requiredFor == null) - { - requiredFor = Collections.singleton(getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS)); - } - - return requiredFor; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - protected Set getAuthorites(NodeRef nodeRef) - { - Set result = null; - - Map readerMap = (Map)getNodeService().getProperty(nodeRef, PROP_READERS); - if (readerMap != null) - { - result = readerMap.keySet(); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName() - */ - @Override - protected String getTransactionCacheName() - { - return "rm.extendedreaderdynamicauthority"; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.Collections; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.repo.security.permissions.PermissionReference; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Extended readers dynamic authority implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +@Deprecated +public class ExtendedReaderDynamicAuthority extends ExtendedSecurityBaseDynamicAuthority +{ + /** Extended reader role */ + public static final String EXTENDED_READER = "ROLE_EXTENDED_READER"; + + /** + * @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority() + */ + @Override + public String getAuthority() + { + return EXTENDED_READER; + } + + /** + * @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor() + */ + @Override + public Set requiredFor() + { + if (requiredFor == null) + { + requiredFor = Collections.singleton(getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS)); + } + + return requiredFor; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + protected Set getAuthorites(NodeRef nodeRef) + { + Set result = null; + + Map readerMap = (Map)getNodeService().getProperty(nodeRef, PROP_READERS); + if (readerMap != null) + { + result = readerMap.keySet(); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName() + */ + @Override + protected String getTransactionCacheName() + { + return "rm.extendedreaderdynamicauthority"; + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java index c6b676a230..d48150633b 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java @@ -1,192 +1,192 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.permissions.DynamicAuthority; -import org.alfresco.repo.security.permissions.PermissionReference; -import org.alfresco.repo.security.permissions.impl.ModelDAO; -import org.alfresco.repo.transaction.TransactionalResourceHelper; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.util.Pair; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Extended readers dynamic authority implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAuthority, - RecordsManagementModel, - ApplicationContextAware -{ - /** Authority service */ - private AuthorityService authorityService; - - /** Extended security service */ - private ExtendedSecurityService extendedSecurityService; - - /** Node service */ - private NodeService nodeService; - - /** Application context */ - protected ApplicationContext applicationContext; - - /** model DAO */ - protected ModelDAO modelDAO; - - /** permission reference */ - protected Set requiredFor; - - // NOTE: we get the services directly from the application context in this way to avoid - // cyclic relationships and issues when loading the application context - - /** - * @return authority service - */ - protected AuthorityService getAuthorityService() - { - if (authorityService == null) - { - authorityService = (AuthorityService)applicationContext.getBean("authorityService"); - } - return authorityService; - } - - /** - * @return extended security service - */ - protected ExtendedSecurityService getExtendedSecurityService() - { - if (extendedSecurityService == null) - { - extendedSecurityService = (ExtendedSecurityService)applicationContext.getBean("extendedSecurityService"); - } - return extendedSecurityService; - } - - /** - * @return node service - */ - protected NodeService getNodeService() - { - if (nodeService == null) - { - nodeService = (NodeService)applicationContext.getBean("dbNodeService"); - } - return nodeService; - } - - /** - * @return model DAO - */ - protected ModelDAO getModelDAO() - { - if (modelDAO == null) - { - modelDAO = (ModelDAO)applicationContext.getBean("permissionsModelDAO"); - } - return modelDAO; - } - - /** - * @return String transaction cache name - */ - protected abstract String getTransactionCacheName(); - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * Gets a list of the authorities from the extended security aspect that this dynamic - * authority is checking against. - * - * @param nodeRef - * @return - */ - protected abstract Set getAuthorites(NodeRef nodeRef); - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#hasAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public boolean hasAuthority(NodeRef nodeRef, String userName) - { - boolean result = false; - - Map, Boolean> transactionCache = TransactionalResourceHelper.getMap(getTransactionCacheName()); - Pair key = new Pair(nodeRef, userName); - - if (transactionCache.containsKey(key)) - { - result = transactionCache.get(key); - } - else - { - if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY)) - { - Set authorities = getAuthorites(nodeRef); - if (authorities != null) - { - // check for everyone or the user - if (authorities.contains("GROUP_EVEYONE") || - authorities.contains(userName)) - { - result = true; - } - else - { - // determine whether any of the users groups are in the extended security - Set contained = getAuthorityService().getAuthoritiesForUser(userName); - authorities.retainAll(contained); - result = (authorities.size() != 0); - } - } - } - - // cache result - transactionCache.put(key, result); - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.permissions.DynamicAuthority; +import org.alfresco.repo.security.permissions.PermissionReference; +import org.alfresco.repo.security.permissions.impl.ModelDAO; +import org.alfresco.repo.transaction.TransactionalResourceHelper; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.util.Pair; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * Extended readers dynamic authority implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +@Deprecated +public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAuthority, + RecordsManagementModel, + ApplicationContextAware +{ + /** Authority service */ + private AuthorityService authorityService; + + /** Extended security service */ + private ExtendedSecurityService extendedSecurityService; + + /** Node service */ + private NodeService nodeService; + + /** Application context */ + protected ApplicationContext applicationContext; + + /** model DAO */ + protected ModelDAO modelDAO; + + /** permission reference */ + protected Set requiredFor; + + // NOTE: we get the services directly from the application context in this way to avoid + // cyclic relationships and issues when loading the application context + + /** + * @return authority service + */ + protected AuthorityService getAuthorityService() + { + if (authorityService == null) + { + authorityService = (AuthorityService)applicationContext.getBean("authorityService"); + } + return authorityService; + } + + /** + * @return extended security service + */ + protected ExtendedSecurityService getExtendedSecurityService() + { + if (extendedSecurityService == null) + { + extendedSecurityService = (ExtendedSecurityService)applicationContext.getBean("extendedSecurityService"); + } + return extendedSecurityService; + } + + /** + * @return node service + */ + protected NodeService getNodeService() + { + if (nodeService == null) + { + nodeService = (NodeService)applicationContext.getBean("dbNodeService"); + } + return nodeService; + } + + /** + * @return model DAO + */ + protected ModelDAO getModelDAO() + { + if (modelDAO == null) + { + modelDAO = (ModelDAO)applicationContext.getBean("permissionsModelDAO"); + } + return modelDAO; + } + + /** + * @return String transaction cache name + */ + protected abstract String getTransactionCacheName(); + + /** + * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) + { + this.applicationContext = applicationContext; + } + + /** + * Gets a list of the authorities from the extended security aspect that this dynamic + * authority is checking against. + * + * @param nodeRef + * @return + */ + protected abstract Set getAuthorites(NodeRef nodeRef); + + /** + * @see org.alfresco.repo.security.permissions.DynamicAuthority#hasAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public boolean hasAuthority(NodeRef nodeRef, String userName) + { + boolean result = false; + + Map, Boolean> transactionCache = TransactionalResourceHelper.getMap(getTransactionCacheName()); + Pair key = new Pair(nodeRef, userName); + + if (transactionCache.containsKey(key)) + { + result = transactionCache.get(key); + } + else + { + if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY)) + { + Set authorities = getAuthorites(nodeRef); + if (authorities != null) + { + // check for everyone or the user + if (authorities.contains("GROUP_EVEYONE") || + authorities.contains(userName)) + { + result = true; + } + else + { + // determine whether any of the users groups are in the extended security + Set contained = getAuthorityService().getAuthoritiesForUser(userName); + authorities.retainAll(contained); + result = (authorities.size() != 0); + } + } + } + + // cache result + transactionCache.put(key, result); + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedWriterDynamicAuthority.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedWriterDynamicAuthority.java index 787e3c7eb8..2ce3c6a8f1 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedWriterDynamicAuthority.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/ExtendedWriterDynamicAuthority.java @@ -1,103 +1,103 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.repo.security.permissions.PermissionReference; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Extended writers dynamic authority implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public class ExtendedWriterDynamicAuthority extends ExtendedSecurityBaseDynamicAuthority -{ - /** Extended writer role */ - public static final String EXTENDED_WRITER = "ROLE_EXTENDED_WRITER"; - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority() - */ - @Override - public String getAuthority() - { - return EXTENDED_WRITER; - } - - /** - * @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor() - */ - @Override - public Set requiredFor() - { - if (requiredFor == null) - { - requiredFor = new HashSet(3); - Collections.addAll(requiredFor, - getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS), - getModelDAO().getPermissionReference(null, RMPermissionModel.FILING), - getModelDAO().getPermissionReference(null, RMPermissionModel.FILE_RECORDS)); - } - - return requiredFor; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - protected Set getAuthorites(NodeRef nodeRef) - { - Set result = null; - - Map map = (Map)getNodeService().getProperty(nodeRef, PROP_WRITERS); - if (map != null) - { - result = map.keySet(); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName() - */ - @Override - protected String getTransactionCacheName() - { - return "rm.extendedwriterdynamicauthority"; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.repo.security.permissions.PermissionReference; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Extended writers dynamic authority implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +@Deprecated +public class ExtendedWriterDynamicAuthority extends ExtendedSecurityBaseDynamicAuthority +{ + /** Extended writer role */ + public static final String EXTENDED_WRITER = "ROLE_EXTENDED_WRITER"; + + /** + * @see org.alfresco.repo.security.permissions.DynamicAuthority#getAuthority() + */ + @Override + public String getAuthority() + { + return EXTENDED_WRITER; + } + + /** + * @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor() + */ + @Override + public Set requiredFor() + { + if (requiredFor == null) + { + requiredFor = new HashSet(3); + Collections.addAll(requiredFor, + getModelDAO().getPermissionReference(null, RMPermissionModel.READ_RECORDS), + getModelDAO().getPermissionReference(null, RMPermissionModel.FILING), + getModelDAO().getPermissionReference(null, RMPermissionModel.FILE_RECORDS)); + } + + return requiredFor; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getAuthorites(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + protected Set getAuthorites(NodeRef nodeRef) + { + Set result = null; + + Map map = (Map)getNodeService().getProperty(nodeRef, PROP_WRITERS); + if (map != null) + { + result = map.keySet(); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityBaseDynamicAuthority#getTransactionCacheName() + */ + @Override + protected String getTransactionCacheName() + { + return "rm.extendedwriterdynamicauthority"; + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java index af9f9f22ed..88914c0563 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationService.java @@ -1,59 +1,59 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; - -/** - * File plan authentication service. - * - * @author Roy Wetherall - * @since 2.1 - * @deprecated as of 2.2, use {@link AuthenticationUtil}. - */ -public interface FilePlanAuthenticationService -{ - /** - * @return rm admin user name - * - * @deprecated as of 2.2, use {@link AuthenticationUtil#getAdminUserName()} - */ - String getRmAdminUserName(); - - /** - * Run provided work as the global rm admin user. - * - * @param return type - * @param runAsWork work to execute as the rm admin user - * @return R result of work execution - * - * @deprecated as of 2.2, use {@link AuthenticationUtil#runAs(RunAsWork, AuthenticationUtil#getAdminUserName())} - */ - R runAsRmAdmin(RunAsWork runAsWork); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; + +/** + * File plan authentication service. + * + * @author Roy Wetherall + * @since 2.1 + * @deprecated as of 2.2, use {@link AuthenticationUtil}. + */ +public interface FilePlanAuthenticationService +{ + /** + * @return rm admin user name + * + * @deprecated as of 2.2, use {@link AuthenticationUtil#getAdminUserName()} + */ + String getRmAdminUserName(); + + /** + * Run provided work as the global rm admin user. + * + * @param return type + * @param runAsWork work to execute as the rm admin user + * @return R result of work execution + * + * @deprecated as of 2.2, use {@link AuthenticationUtil#runAs(RunAsWork, AuthenticationUtil#getAdminUserName())} + */ + R runAsRmAdmin(RunAsWork runAsWork); +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java index 8055fa5301..5c0a5f8ff5 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/FilePlanAuthenticationServiceImpl.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; - -/** - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public class FilePlanAuthenticationServiceImpl implements FilePlanAuthenticationService -{ - /** Default rm admin user values */ - @Deprecated - public static final String DEFAULT_RM_ADMIN_USER = "rmadmin"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#getRMAdminUserName() - */ - @Override - @Deprecated - public String getRmAdminUserName() - { - return AuthenticationUtil.getAdminUserName(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#runAsRMAdmin(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork) - */ - @Override - @Deprecated - public R runAsRmAdmin(RunAsWork runAsWork) - { - return AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; + +/** + * @author Roy Wetherall + * @since 2.1 + */ +@Deprecated +public class FilePlanAuthenticationServiceImpl implements FilePlanAuthenticationService +{ + /** Default rm admin user values */ + @Deprecated + public static final String DEFAULT_RM_ADMIN_USER = "rmadmin"; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#getRMAdminUserName() + */ + @Override + @Deprecated + public String getRmAdminUserName() + { + return AuthenticationUtil.getAdminUserName(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#runAsRMAdmin(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork) + */ + @Override + @Deprecated + public R runAsRmAdmin(RunAsWork runAsWork) + { + return AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java index f9e721124a..0ae0db2c86 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityService.java @@ -1,215 +1,215 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management permission service interface - * - * @author Roy Wetherall - * - * @deprecated As of release 2.1, replaced by {@link ModelSecurityService}, {@link FilePlanRoleService} and {@link FilePlanPermissionService} - */ -public interface RecordsManagementSecurityService -{ - /** - * Creates the initial set of default roles for a root records management node - * - * @param rmRootNode root node - * - * @deprecated As of release 2.1, operation no longer supported - */ - @Deprecated - void bootstrapDefaultRoles(NodeRef rmRootNode); - - /** - * Returns the name of the container group for all roles of a specified file - * plan. - * - * @param filePlan file plan node reference - * @return String group name - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getAllRolesContainerGroup(NodeRef)} - */ - @Deprecated - String getAllRolesContainerGroup(NodeRef filePlan); - - /** - * Get all the available roles for the given records management root node - * - * @param rmRootNode root node - * @return {@link Set}<{@link Role}> all roles for a given root node - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRoles(NodeRef)} - */ - @Deprecated - Set getRoles(NodeRef rmRootNode); - - /** - * Gets the roles for a given user - * - * @param rmRootNode - * @param user - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRolesByUser(NodeRef, String)} - */ - @Deprecated - Set getRolesByUser(NodeRef rmRootNode, String user); - - /** - * Get a role by name - * - * @param rmRootNode - * @param role - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRole(NodeRef, String)} - */ - @Deprecated - Role getRole(NodeRef rmRootNode, String role); - - /** - * Indicate whether a role exists for a given records management root node - * @param rmRootNode - * @param role - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#existsRole(NodeRef, String)} - */ - @Deprecated - boolean existsRole(NodeRef rmRootNode, String role); - - /** - * Determines whether the given user has the RM Admin role - * - * @param rmRootNode RM root node - * @param user user name to check - * @return true if the user has the RM Admin role, false otherwise - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#hasRMAdminRole(NodeRef, String)} - */ - @Deprecated - boolean hasRMAdminRole(NodeRef rmRootNode, String user); - - /** - * Create a new role - * - * @param rmRootNode - * @param role - * @param roleDisplayLabel - * @param capabilities - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#createRole(NodeRef, String, String, Set)} - */ - @Deprecated - Role createRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities); - - /** - * Update an existing role - * - * @param rmRootNode - * @param role - * @param roleDisplayLabel - * @param capabilities - * @return - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#updateRole(NodeRef, String, String, Set)} - */ - @Deprecated - Role updateRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities); - - /** - * Delete a role - * - * @param rmRootNode - * @param role - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#deleteRole(NodeRef, String)} - */ - @Deprecated - void deleteRole(NodeRef rmRootNode, String role); - - /** - * Assign a role to an authority - * - * @param authorityName - * @param rmRootNode - * @param role - * - * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#assignRoleToAuthority(NodeRef, String, String)} - */ - @Deprecated - void assignRoleToAuthority(NodeRef rmRootNode, String role, String authorityName); - - /** - * Sets a permission on a RM object. Assumes allow is true. Cascades permission down to record folder. - * Cascades ReadRecord up to file plan. - * - * @param nodeRef node reference - * @param authority authority - * @param permission permission - * - * @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#setPermission(NodeRef, String, String)} - */ - @Deprecated - void setPermission(NodeRef nodeRef, String authority, String permission); - - /** - * Deletes a permission from a RM object. Cascades removal down to record folder. - * - * @param nodeRef node reference - * @param authority authority - * @param permission permission - * - * @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#deletePermission(NodeRef, String, String)} - */ - @Deprecated - void deletePermission(NodeRef nodeRef, String authority, String permission); - - /** - * @return {@link Set}<{@link QName}> protected aspect names - * @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedAspects} - */ - @Deprecated - Set getProtectedAspects(); - - /** - * @return {@link Set}<{@link QName}> protected properties - * @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedProperties} - */ - Set getProtectedProperties(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Records management permission service interface + * + * @author Roy Wetherall + * + * @deprecated As of release 2.1, replaced by {@link ModelSecurityService}, {@link FilePlanRoleService} and {@link FilePlanPermissionService} + */ +public interface RecordsManagementSecurityService +{ + /** + * Creates the initial set of default roles for a root records management node + * + * @param rmRootNode root node + * + * @deprecated As of release 2.1, operation no longer supported + */ + @Deprecated + void bootstrapDefaultRoles(NodeRef rmRootNode); + + /** + * Returns the name of the container group for all roles of a specified file + * plan. + * + * @param filePlan file plan node reference + * @return String group name + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getAllRolesContainerGroup(NodeRef)} + */ + @Deprecated + String getAllRolesContainerGroup(NodeRef filePlan); + + /** + * Get all the available roles for the given records management root node + * + * @param rmRootNode root node + * @return {@link Set}<{@link Role}> all roles for a given root node + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRoles(NodeRef)} + */ + @Deprecated + Set getRoles(NodeRef rmRootNode); + + /** + * Gets the roles for a given user + * + * @param rmRootNode + * @param user + * @return + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRolesByUser(NodeRef, String)} + */ + @Deprecated + Set getRolesByUser(NodeRef rmRootNode, String user); + + /** + * Get a role by name + * + * @param rmRootNode + * @param role + * @return + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#getRole(NodeRef, String)} + */ + @Deprecated + Role getRole(NodeRef rmRootNode, String role); + + /** + * Indicate whether a role exists for a given records management root node + * @param rmRootNode + * @param role + * @return + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#existsRole(NodeRef, String)} + */ + @Deprecated + boolean existsRole(NodeRef rmRootNode, String role); + + /** + * Determines whether the given user has the RM Admin role + * + * @param rmRootNode RM root node + * @param user user name to check + * @return true if the user has the RM Admin role, false otherwise + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#hasRMAdminRole(NodeRef, String)} + */ + @Deprecated + boolean hasRMAdminRole(NodeRef rmRootNode, String user); + + /** + * Create a new role + * + * @param rmRootNode + * @param role + * @param roleDisplayLabel + * @param capabilities + * @return + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#createRole(NodeRef, String, String, Set)} + */ + @Deprecated + Role createRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities); + + /** + * Update an existing role + * + * @param rmRootNode + * @param role + * @param roleDisplayLabel + * @param capabilities + * @return + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#updateRole(NodeRef, String, String, Set)} + */ + @Deprecated + Role updateRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities); + + /** + * Delete a role + * + * @param rmRootNode + * @param role + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#deleteRole(NodeRef, String)} + */ + @Deprecated + void deleteRole(NodeRef rmRootNode, String role); + + /** + * Assign a role to an authority + * + * @param authorityName + * @param rmRootNode + * @param role + * + * @deprecated As of release 2.1, replaced by {@link FilePlanRoleService#assignRoleToAuthority(NodeRef, String, String)} + */ + @Deprecated + void assignRoleToAuthority(NodeRef rmRootNode, String role, String authorityName); + + /** + * Sets a permission on a RM object. Assumes allow is true. Cascades permission down to record folder. + * Cascades ReadRecord up to file plan. + * + * @param nodeRef node reference + * @param authority authority + * @param permission permission + * + * @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#setPermission(NodeRef, String, String)} + */ + @Deprecated + void setPermission(NodeRef nodeRef, String authority, String permission); + + /** + * Deletes a permission from a RM object. Cascades removal down to record folder. + * + * @param nodeRef node reference + * @param authority authority + * @param permission permission + * + * @deprecated As of release 2.1, replaced by {@link FilePlanPermissionService#deletePermission(NodeRef, String, String)} + */ + @Deprecated + void deletePermission(NodeRef nodeRef, String authority, String permission); + + /** + * @return {@link Set}<{@link QName}> protected aspect names + * @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedAspects} + */ + @Deprecated + Set getProtectedAspects(); + + /** + * @return {@link Set}<{@link QName}> protected properties + * @deprecated As of release 2.1, replaced by {@link ModelSecurityService#getProtectedProperties} + */ + Set getProtectedProperties(); +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityServiceImpl.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityServiceImpl.java index 8b315bc43e..abab5c3d7f 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityServiceImpl.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/RecordsManagementSecurityServiceImpl.java @@ -1,230 +1,230 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management permission service implementation - * - * @author Roy Wetherall - */ -@SuppressWarnings("deprecation") -public class RecordsManagementSecurityServiceImpl implements RecordsManagementSecurityService, - RecordsManagementModel -{ - /** Model security service */ - private ModelSecurityService modelSecurityService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** File plan permission service */ - private FilePlanPermissionService filePlanPermissionService; - - /** - * @param modelSecurityService model security service - */ - public void setModelSecurityService(ModelSecurityService modelSecurityService) - { - this.modelSecurityService = modelSecurityService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanPermissionService file plan permission service - */ - public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) - { - this.filePlanPermissionService = filePlanPermissionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getProtectedAspects() - */ - @Deprecated - @Override - public Set getProtectedAspects() - { - return modelSecurityService.getProtectedAspects(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getProtectedProperties() - */ - @Deprecated - @Override - public Set getProtectedProperties() - { - return modelSecurityService.getProtectedProperties(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Deprecated - @Override - public void assignRoleToAuthority(NodeRef rmRootNode, String role, String authorityName) - { - filePlanRoleService.assignRoleToAuthority(rmRootNode, role, authorityName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#bootstrapDefaultRoles(org.alfresco.service.cmr.repository.NodeRef) - */ - @Deprecated - @Override - public void bootstrapDefaultRoles(NodeRef rmRootNode) - { - throw new UnsupportedOperationException("This method is no longer supported."); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#createRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) - */ - @Deprecated - @Override - public Role createRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities) - { - return Role.toRole(filePlanRoleService.createRole(rmRootNode, role, roleDisplayLabel, capabilities)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deleteRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public void deleteRole(NodeRef rmRootNode, String role) - { - filePlanRoleService.deleteRole(rmRootNode, role); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#existsRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public boolean existsRole(NodeRef rmRootNode, String role) - { - return filePlanRoleService.existsRole(rmRootNode, role); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getAllRolesContainerGroup(org.alfresco.service.cmr.repository.NodeRef) - */ - @Deprecated - @Override - public String getAllRolesContainerGroup(NodeRef filePlan) - { - return filePlanRoleService.getAllRolesContainerGroup(filePlan); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public Role getRole(NodeRef rmRootNode, String role) - { - return Role.toRole(filePlanRoleService.getRole(rmRootNode, role)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRoles(org.alfresco.service.cmr.repository.NodeRef) - */ - @Deprecated - @Override - public Set getRoles(NodeRef rmRootNode) - { - return Role.toRoleSet(filePlanRoleService.getRoles(rmRootNode)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRolesByUser(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public Set getRolesByUser(NodeRef rmRootNode, String user) - { - return Role.toRoleSet(filePlanRoleService.getRolesByUser(rmRootNode, user)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Deprecated - @Override - public boolean hasRMAdminRole(NodeRef rmRootNode, String user) - { - return filePlanRoleService.hasRMAdminRole(rmRootNode, user); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#updateRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) - */ - @Deprecated - @Override - public Role updateRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities) - { - return Role.toRole(filePlanRoleService.updateRole(rmRootNode, role, roleDisplayLabel, capabilities)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deletePermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Deprecated - @Override - public void deletePermission(NodeRef nodeRef, String authority, String permission) - { - filePlanPermissionService.deletePermission(nodeRef, authority, permission); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#setPermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Deprecated - @Override - public void setPermission(NodeRef nodeRef, String authority, String permission) - { - filePlanPermissionService.setPermission(nodeRef, authority, permission); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Records management permission service implementation + * + * @author Roy Wetherall + */ +@SuppressWarnings("deprecation") +public class RecordsManagementSecurityServiceImpl implements RecordsManagementSecurityService, + RecordsManagementModel +{ + /** Model security service */ + private ModelSecurityService modelSecurityService; + + /** File plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** File plan permission service */ + private FilePlanPermissionService filePlanPermissionService; + + /** + * @param modelSecurityService model security service + */ + public void setModelSecurityService(ModelSecurityService modelSecurityService) + { + this.modelSecurityService = modelSecurityService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param filePlanPermissionService file plan permission service + */ + public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) + { + this.filePlanPermissionService = filePlanPermissionService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getProtectedAspects() + */ + @Deprecated + @Override + public Set getProtectedAspects() + { + return modelSecurityService.getProtectedAspects(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getProtectedProperties() + */ + @Deprecated + @Override + public Set getProtectedProperties() + { + return modelSecurityService.getProtectedProperties(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) + */ + @Deprecated + @Override + public void assignRoleToAuthority(NodeRef rmRootNode, String role, String authorityName) + { + filePlanRoleService.assignRoleToAuthority(rmRootNode, role, authorityName); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#bootstrapDefaultRoles(org.alfresco.service.cmr.repository.NodeRef) + */ + @Deprecated + @Override + public void bootstrapDefaultRoles(NodeRef rmRootNode) + { + throw new UnsupportedOperationException("This method is no longer supported."); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#createRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) + */ + @Deprecated + @Override + public Role createRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities) + { + return Role.toRole(filePlanRoleService.createRole(rmRootNode, role, roleDisplayLabel, capabilities)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deleteRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Deprecated + @Override + public void deleteRole(NodeRef rmRootNode, String role) + { + filePlanRoleService.deleteRole(rmRootNode, role); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#existsRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Deprecated + @Override + public boolean existsRole(NodeRef rmRootNode, String role) + { + return filePlanRoleService.existsRole(rmRootNode, role); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getAllRolesContainerGroup(org.alfresco.service.cmr.repository.NodeRef) + */ + @Deprecated + @Override + public String getAllRolesContainerGroup(NodeRef filePlan) + { + return filePlanRoleService.getAllRolesContainerGroup(filePlan); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Deprecated + @Override + public Role getRole(NodeRef rmRootNode, String role) + { + return Role.toRole(filePlanRoleService.getRole(rmRootNode, role)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRoles(org.alfresco.service.cmr.repository.NodeRef) + */ + @Deprecated + @Override + public Set getRoles(NodeRef rmRootNode) + { + return Role.toRoleSet(filePlanRoleService.getRoles(rmRootNode)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRolesByUser(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Deprecated + @Override + public Set getRolesByUser(NodeRef rmRootNode, String user) + { + return Role.toRoleSet(filePlanRoleService.getRolesByUser(rmRootNode, user)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Deprecated + @Override + public boolean hasRMAdminRole(NodeRef rmRootNode, String user) + { + return filePlanRoleService.hasRMAdminRole(rmRootNode, user); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#updateRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) + */ + @Deprecated + @Override + public Role updateRole(NodeRef rmRootNode, String role, String roleDisplayLabel, Set capabilities) + { + return Role.toRole(filePlanRoleService.updateRole(rmRootNode, role, roleDisplayLabel, capabilities)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deletePermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) + */ + @Deprecated + @Override + public void deletePermission(NodeRef nodeRef, String authority, String permission) + { + filePlanPermissionService.deletePermission(nodeRef, authority, permission); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#setPermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) + */ + @Deprecated + @Override + public void setPermission(NodeRef nodeRef, String authority, String permission) + { + filePlanPermissionService.setPermission(nodeRef, authority, permission); + } +} diff --git a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/Role.java b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/Role.java index 99e2c9a6fb..da063a5761 100644 --- a/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/Role.java +++ b/rm-community/rm-community-repo/source/compatibility/org/alfresco/module/org_alfresco_module_rm/security/Role.java @@ -1,73 +1,73 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; - -/** - * Records management role class - * - * @author Roy Wetherall - * - * @deprecated As of release 2.1, see {@link org.alfresco.module.org_alfresco_module_rm.role.Role} - */ -public class Role extends org.alfresco.module.org_alfresco_module_rm.role.Role -{ - /** - * Compatibility method - */ - public static Role toRole(org.alfresco.module.org_alfresco_module_rm.role.Role role) - { - return new Role(role.getName(), role.getDisplayLabel(), role.getCapabilities(), role.getRoleGroupName()); - } - - /** - * Compatibility method - */ - public static Set toRoleSet(Set roles) - { - Set result = new HashSet(roles.size()); - for (org.alfresco.module.org_alfresco_module_rm.role.Role role : roles) - { - result.add(Role.toRole(role)); - } - return result; - } - - /** - * Constructor - */ - @Deprecated - public Role(String name, String displayLabel, Set capabilities, String roleGroupName) - { - super(name, displayLabel, capabilities, roleGroupName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; + +/** + * Records management role class + * + * @author Roy Wetherall + * + * @deprecated As of release 2.1, see {@link org.alfresco.module.org_alfresco_module_rm.role.Role} + */ +public class Role extends org.alfresco.module.org_alfresco_module_rm.role.Role +{ + /** + * Compatibility method + */ + public static Role toRole(org.alfresco.module.org_alfresco_module_rm.role.Role role) + { + return new Role(role.getName(), role.getDisplayLabel(), role.getCapabilities(), role.getRoleGroupName()); + } + + /** + * Compatibility method + */ + public static Set toRoleSet(Set roles) + { + Set result = new HashSet(roles.size()); + for (org.alfresco.module.org_alfresco_module_rm.role.Role role : roles) + { + result.add(Role.toRole(role)); + } + return result; + } + + /** + * Constructor + */ + @Deprecated + public Role(String name, String displayLabel, Set capabilities, String roleGroupName) + { + super(name, displayLabel, capabilities, roleGroupName); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPolicies.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPolicies.java index 5b470ecc16..d850db6eaa 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPolicies.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPolicies.java @@ -1,129 +1,129 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.policy.ClassPolicy; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Interface containing records management policies - * - * @author Roy Wetherall - */ -public interface RecordsManagementPolicies -{ - /** Policy names */ - QName BEFORE_RM_ACTION_EXECUTION = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRMActionExecution"); - QName ON_RM_ACTION_EXECUTION = QName.createQName(NamespaceService.ALFRESCO_URI, "onRMActionExecution"); - QName BEFORE_CREATE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateReference"); - QName ON_CREATE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateReference"); - QName BEFORE_REMOVE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRemoveReference"); - QName ON_REMOVE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveReference"); - - /** Before records management action execution */ - interface BeforeRMActionExecution extends ClassPolicy - { - void beforeRMActionExecution(NodeRef nodeRef, String name, Map parameters); - } - - /** On records management action execution */ - interface OnRMActionExecution extends ClassPolicy - { - void onRMActionExecution(NodeRef nodeRef, String name, Map parameters); - } - - /** Before creation of reference */ - interface BeforeCreateReference extends ClassPolicy - { - void beforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); - } - - /** On creation of reference */ - interface OnCreateReference extends ClassPolicy - { - void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); - } - - /** Before removal of reference */ - interface BeforeRemoveReference extends ClassPolicy - { - void beforeRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); - } - - /** - * On removal of reference - * - * @since 1.0 - */ - interface OnRemoveReference extends ClassPolicy - { - /** - * @param fromNodeRef from node reference - * @param toNodeRef to node reference - * @param reference name of reference - */ - void onRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); - } - - /** - * Before record file policy - * - * @since 2.2 - */ - interface BeforeFileRecord extends ClassPolicy - { - /** policy name */ - QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRecordFile"); - - /** - * @param nodeRef node reference - */ - void beforeFileRecord(NodeRef nodeRef); - } - - /** - * On record file policy - * - * @since 2.2 - */ - interface OnFileRecord extends ClassPolicy - { - /** policy name */ - QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRecordFile"); - - /** - * @param nodeRef node reference - */ - void onFileRecord(NodeRef nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.repo.policy.ClassPolicy; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Interface containing records management policies + * + * @author Roy Wetherall + */ +public interface RecordsManagementPolicies +{ + /** Policy names */ + QName BEFORE_RM_ACTION_EXECUTION = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRMActionExecution"); + QName ON_RM_ACTION_EXECUTION = QName.createQName(NamespaceService.ALFRESCO_URI, "onRMActionExecution"); + QName BEFORE_CREATE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateReference"); + QName ON_CREATE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateReference"); + QName BEFORE_REMOVE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRemoveReference"); + QName ON_REMOVE_REFERENCE = QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveReference"); + + /** Before records management action execution */ + interface BeforeRMActionExecution extends ClassPolicy + { + void beforeRMActionExecution(NodeRef nodeRef, String name, Map parameters); + } + + /** On records management action execution */ + interface OnRMActionExecution extends ClassPolicy + { + void onRMActionExecution(NodeRef nodeRef, String name, Map parameters); + } + + /** Before creation of reference */ + interface BeforeCreateReference extends ClassPolicy + { + void beforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); + } + + /** On creation of reference */ + interface OnCreateReference extends ClassPolicy + { + void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); + } + + /** Before removal of reference */ + interface BeforeRemoveReference extends ClassPolicy + { + void beforeRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); + } + + /** + * On removal of reference + * + * @since 1.0 + */ + interface OnRemoveReference extends ClassPolicy + { + /** + * @param fromNodeRef from node reference + * @param toNodeRef to node reference + * @param reference name of reference + */ + void onRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference); + } + + /** + * Before record file policy + * + * @since 2.2 + */ + interface BeforeFileRecord extends ClassPolicy + { + /** policy name */ + QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRecordFile"); + + /** + * @param nodeRef node reference + */ + void beforeFileRecord(NodeRef nodeRef); + } + + /** + * On record file policy + * + * @since 2.2 + */ + interface OnFileRecord extends ClassPolicy + { + /** policy name */ + QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRecordFile"); + + /** + * @param nodeRef node reference + */ + void onFileRecord(NodeRef nodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistry.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistry.java index d4fab87046..255e1e8dcf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistry.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistry.java @@ -1,193 +1,193 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.service.NotAuditable; -import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Records management service registry - * - * @author Roy Wetherall - */ -@SuppressWarnings("deprecation") -public interface RecordsManagementServiceRegistry extends ServiceRegistry -{ - /** Service QName constants */ - QName RECORDS_MANAGEMENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementService"); - QName DISPOSITION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DispositionService"); - QName RECORDS_MANAGEMENT_ADMIN_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAdminService"); - QName RECORDS_MANAGEMENT_ACTION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementActionService"); - QName RECORDS_MANAGEMENT_EVENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementEventService"); - QName RECORDS_MANAGEMENT_AUDIT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAuditService"); - QName CAPABILITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CapabilityService"); - QName RECORD_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordService"); - QName FREEZE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FreezeService"); - QName EXTENDED_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ExtendedSecurityService"); - QName FILE_PLAN_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanService"); - QName FILE_PLAN_ROLE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanRoleService"); - QName FILE_PLAN_PERMISSION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanPermissionService"); - QName FILE_PLAN_AUTHENTICATION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanAuthenticationService"); - QName IDENTIFIER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "recordsManagementIdentifierService"); - QName RECORD_FOLDER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordFolderService"); - QName TRANSFER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TransferService"); - @Deprecated - QName RECORDS_MANAGEMENT_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementSecurityService"); - - - /** - * @return records management service - */ - @NotAuditable - RecordsManagementService getRecordsManagementService(); - - /** - * @return record service - */ - @NotAuditable - RecordService getRecordService(); - - /** - * @return disposition service - */ - @NotAuditable - DispositionService getDispositionService(); - - /** - * @return records management admin service - */ - @NotAuditable - RecordsManagementAdminService getRecordsManagementAdminService(); - - /** - * @return records management action service - */ - @NotAuditable - RecordsManagementActionService getRecordsManagementActionService(); - - /** - * @return records management event service - */ - @NotAuditable - RecordsManagementEventService getRecordsManagementEventService(); - - /** - * @return records management security service - * - * @deprecated As of release 2.1, replaced with {@link FilePlanRoleService}, {@link FilePlanPermissionService} and {@link ModelSecurityService} - */ - @Deprecated - @NotAuditable - RecordsManagementSecurityService getRecordsManagementSecurityService(); - - /** - * @return records management audit service - */ - @NotAuditable - RecordsManagementAuditService getRecordsManagementAuditService(); - - /** - * @return capability service - * @since 2.0 - */ - @NotAuditable - CapabilityService getCapabilityService(); - - /** - * @return freeze service - * @since 2.1 - */ - @NotAuditable - FreezeService getFreezeService(); - - /** - * @return extended security service - * @since 2.1 - */ - @NotAuditable - ExtendedSecurityService getExtendedSecurityService(); - - /** - * @return file plan service - * @since 2.1 - */ - @NotAuditable - FilePlanService getFilePlanService(); - - /** - * @return file plan role service - * @since 2.1 - */ - @NotAuditable - FilePlanRoleService getFilePlanRoleService(); - - /** - * @return file plan permission service - * @since 2.1 - */ - @NotAuditable - FilePlanPermissionService getFilePlanPermissionService(); - - /** - * @return identifier service - * @since 2.1 - */ - IdentifierService getIdentifierService(); - - /** - * @return record folder service - * @since 2.2 - */ - @NotAuditable - RecordFolderService getRecordFolderService(); - - /** - * @return transfer service - * @since 2.2 - */ - @NotAuditable - TransferService getTransferService(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; +import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; +import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; +import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; +import org.alfresco.service.NotAuditable; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Records management service registry + * + * @author Roy Wetherall + */ +@SuppressWarnings("deprecation") +public interface RecordsManagementServiceRegistry extends ServiceRegistry +{ + /** Service QName constants */ + QName RECORDS_MANAGEMENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementService"); + QName DISPOSITION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "DispositionService"); + QName RECORDS_MANAGEMENT_ADMIN_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAdminService"); + QName RECORDS_MANAGEMENT_ACTION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementActionService"); + QName RECORDS_MANAGEMENT_EVENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementEventService"); + QName RECORDS_MANAGEMENT_AUDIT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAuditService"); + QName CAPABILITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CapabilityService"); + QName RECORD_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordService"); + QName FREEZE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FreezeService"); + QName EXTENDED_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ExtendedSecurityService"); + QName FILE_PLAN_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanService"); + QName FILE_PLAN_ROLE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanRoleService"); + QName FILE_PLAN_PERMISSION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanPermissionService"); + QName FILE_PLAN_AUTHENTICATION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanAuthenticationService"); + QName IDENTIFIER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "recordsManagementIdentifierService"); + QName RECORD_FOLDER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordFolderService"); + QName TRANSFER_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "TransferService"); + @Deprecated + QName RECORDS_MANAGEMENT_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementSecurityService"); + + + /** + * @return records management service + */ + @NotAuditable + RecordsManagementService getRecordsManagementService(); + + /** + * @return record service + */ + @NotAuditable + RecordService getRecordService(); + + /** + * @return disposition service + */ + @NotAuditable + DispositionService getDispositionService(); + + /** + * @return records management admin service + */ + @NotAuditable + RecordsManagementAdminService getRecordsManagementAdminService(); + + /** + * @return records management action service + */ + @NotAuditable + RecordsManagementActionService getRecordsManagementActionService(); + + /** + * @return records management event service + */ + @NotAuditable + RecordsManagementEventService getRecordsManagementEventService(); + + /** + * @return records management security service + * + * @deprecated As of release 2.1, replaced with {@link FilePlanRoleService}, {@link FilePlanPermissionService} and {@link ModelSecurityService} + */ + @Deprecated + @NotAuditable + RecordsManagementSecurityService getRecordsManagementSecurityService(); + + /** + * @return records management audit service + */ + @NotAuditable + RecordsManagementAuditService getRecordsManagementAuditService(); + + /** + * @return capability service + * @since 2.0 + */ + @NotAuditable + CapabilityService getCapabilityService(); + + /** + * @return freeze service + * @since 2.1 + */ + @NotAuditable + FreezeService getFreezeService(); + + /** + * @return extended security service + * @since 2.1 + */ + @NotAuditable + ExtendedSecurityService getExtendedSecurityService(); + + /** + * @return file plan service + * @since 2.1 + */ + @NotAuditable + FilePlanService getFilePlanService(); + + /** + * @return file plan role service + * @since 2.1 + */ + @NotAuditable + FilePlanRoleService getFilePlanRoleService(); + + /** + * @return file plan permission service + * @since 2.1 + */ + @NotAuditable + FilePlanPermissionService getFilePlanPermissionService(); + + /** + * @return identifier service + * @since 2.1 + */ + IdentifierService getIdentifierService(); + + /** + * @return record folder service + * @since 2.2 + */ + @NotAuditable + RecordFolderService getRecordFolderService(); + + /** + * @return transfer service + * @since 2.2 + */ + @NotAuditable + TransferService getTransferService(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistryImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistryImpl.java index 99ca206516..f45c7f47be 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistryImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceRegistryImpl.java @@ -1,208 +1,208 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.repo.service.ServiceDescriptorRegistry; - -/** - * Records management service registry implementation - * - * @author Roy Wetherall - */ -@SuppressWarnings("deprecation") -public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegistry - implements RecordsManagementServiceRegistry -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementActionService() - */ - @Override - public RecordsManagementActionService getRecordsManagementActionService() - { - return (RecordsManagementActionService) getService(RECORDS_MANAGEMENT_ACTION_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementAdminService() - */ - @Override - public RecordsManagementAdminService getRecordsManagementAdminService() - { - return (RecordsManagementAdminService) getService(RECORDS_MANAGEMENT_ADMIN_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementEventService() - */ - @Override - public RecordsManagementEventService getRecordsManagementEventService() - { - return (RecordsManagementEventService) getService(RECORDS_MANAGEMENT_EVENT_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementService() - */ - @Override - public RecordsManagementService getRecordsManagementService() - { - return (RecordsManagementService) getService(RECORDS_MANAGEMENT_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordService() - */ - public RecordService getRecordService() - { - return (RecordService) getService(RECORD_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementSecurityService() - */ - @Override - @Deprecated - public RecordsManagementSecurityService getRecordsManagementSecurityService() - { - return (RecordsManagementSecurityService) getService(RECORDS_MANAGEMENT_SECURITY_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementAuditService() - */ - @Override - public RecordsManagementAuditService getRecordsManagementAuditService() - { - return (RecordsManagementAuditService) getService(RECORDS_MANAGEMENT_AUDIT_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getDictionaryService() - */ - @Override - public DispositionService getDispositionService() - { - return (DispositionService) getService(DISPOSITION_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getCapabilityService() - */ - @Override - public CapabilityService getCapabilityService() - { - return (CapabilityService) getService(CAPABILITY_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFreezeService() - */ - @Override - public FreezeService getFreezeService() - { - return (FreezeService) getService(FREEZE_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getExtendedSecurityService() - */ - @Override - public ExtendedSecurityService getExtendedSecurityService() - { - return (ExtendedSecurityService) getService(EXTENDED_SECURITY_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanService() - */ - @Override - public FilePlanService getFilePlanService() - { - return (FilePlanService) getService(FILE_PLAN_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanRoleService() - */ - @Override - public FilePlanRoleService getFilePlanRoleService() - { - return (FilePlanRoleService) getService(FILE_PLAN_ROLE_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanPermissionService() - */ - @Override - public FilePlanPermissionService getFilePlanPermissionService() - { - return (FilePlanPermissionService) getService(FILE_PLAN_PERMISSION_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getIdentifierService() - */ - @Override - public IdentifierService getIdentifierService() - { - return (IdentifierService) getService(IDENTIFIER_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordFolderService() - */ - @Override - public RecordFolderService getRecordFolderService() - { - return (RecordFolderService) getService(RECORD_FOLDER_SERVICE); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getTransferService() - */ - @Override - public TransferService getTransferService() - { - return (TransferService) getService(TRANSFER_SERVICE); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; +import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; +import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; +import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; +import org.alfresco.repo.service.ServiceDescriptorRegistry; + +/** + * Records management service registry implementation + * + * @author Roy Wetherall + */ +@SuppressWarnings("deprecation") +public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegistry + implements RecordsManagementServiceRegistry +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementActionService() + */ + @Override + public RecordsManagementActionService getRecordsManagementActionService() + { + return (RecordsManagementActionService) getService(RECORDS_MANAGEMENT_ACTION_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementAdminService() + */ + @Override + public RecordsManagementAdminService getRecordsManagementAdminService() + { + return (RecordsManagementAdminService) getService(RECORDS_MANAGEMENT_ADMIN_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementEventService() + */ + @Override + public RecordsManagementEventService getRecordsManagementEventService() + { + return (RecordsManagementEventService) getService(RECORDS_MANAGEMENT_EVENT_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementService() + */ + @Override + public RecordsManagementService getRecordsManagementService() + { + return (RecordsManagementService) getService(RECORDS_MANAGEMENT_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordService() + */ + public RecordService getRecordService() + { + return (RecordService) getService(RECORD_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementSecurityService() + */ + @Override + @Deprecated + public RecordsManagementSecurityService getRecordsManagementSecurityService() + { + return (RecordsManagementSecurityService) getService(RECORDS_MANAGEMENT_SECURITY_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementAuditService() + */ + @Override + public RecordsManagementAuditService getRecordsManagementAuditService() + { + return (RecordsManagementAuditService) getService(RECORDS_MANAGEMENT_AUDIT_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getDictionaryService() + */ + @Override + public DispositionService getDispositionService() + { + return (DispositionService) getService(DISPOSITION_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getCapabilityService() + */ + @Override + public CapabilityService getCapabilityService() + { + return (CapabilityService) getService(CAPABILITY_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFreezeService() + */ + @Override + public FreezeService getFreezeService() + { + return (FreezeService) getService(FREEZE_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getExtendedSecurityService() + */ + @Override + public ExtendedSecurityService getExtendedSecurityService() + { + return (ExtendedSecurityService) getService(EXTENDED_SECURITY_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanService() + */ + @Override + public FilePlanService getFilePlanService() + { + return (FilePlanService) getService(FILE_PLAN_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanRoleService() + */ + @Override + public FilePlanRoleService getFilePlanRoleService() + { + return (FilePlanRoleService) getService(FILE_PLAN_ROLE_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanPermissionService() + */ + @Override + public FilePlanPermissionService getFilePlanPermissionService() + { + return (FilePlanPermissionService) getService(FILE_PLAN_PERMISSION_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getIdentifierService() + */ + @Override + public IdentifierService getIdentifierService() + { + return (IdentifierService) getService(IDENTIFIER_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordFolderService() + */ + @Override + public RecordFolderService getRecordFolderService() + { + return (RecordFolderService) getService(RECORD_FOLDER_SERVICE); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getTransferService() + */ + @Override + public TransferService getTransferService() + { + return (TransferService) getService(TRANSFER_SERVICE); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java index f845177a6d..3e0a2ffc07 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java @@ -1,169 +1,169 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Auditable action executer abstract base - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class AuditableActionExecuterAbstractBase extends ActionExecuterAbstractBase implements ApplicationContextAware -{ - /** Indicates whether the action is auditable or not */ - private boolean auditable = true; - - /** Indicates whether the action is audited immediately or not */ - private boolean auditedImmediately = false; - - /** Application context */ - private ApplicationContext applicationContext; - - /** Records management audit service */ - private RecordsManagementAuditService auditService; - - /** - * @return True if auditable, false otherwise - */ - protected boolean isAuditable() - { - return this.auditable; - } - - /** - * @return True if audited immediately, false otherwise - */ - protected boolean isAuditedImmediately() - { - return this.auditedImmediately; - } - - /** - * @return Application context - */ - protected ApplicationContext getApplicationContext() - { - return this.applicationContext; - } - - /** - * @param auditable true if auditable, false otherwise - */ - public void setAuditable(boolean auditable) - { - this.auditable = auditable; - } - - /** - * @param auditedImmediately true if to be audited immediately, false to be audited after transaction commits - */ - public void setAuditedImmediately(boolean auditedImmediately) - { - this.auditedImmediately = auditedImmediately; - } - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * @return records management audit service - */ - private RecordsManagementAuditService getAuditService() - { - if (auditService == null) - { - auditService = (RecordsManagementAuditService) getApplicationContext().getBean("recordsManagementAuditService"); - } - return auditService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#init() - */ - @Override - public void init() - { - if (!(this instanceof RecordsManagementAction)) - { - super.init(); - } - - if (isAuditable()) - { - // get the details of the action - String name = getActionDefinition().getName(); - String title = getActionDefinition().getTitle(); - if (title == null || title.isEmpty()) - { - // default to name if no title available - title = name; - } - - // register audit event - getAuditService().registerAuditEvent(name, title); - } - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#execute(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void execute(Action action, NodeRef actionedUponNodeRef) - { - // audit the execution of the action - if (isAuditable()) - { - if (isAuditedImmediately()) - { - // To be audited immediately before the action is executed, eg. to audit before actionedUponNodeRef gets deleted during the execution. - getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName(), null, null, true); - } - else - { - // To be stacked up with other audit entries and audited after the transaction commits. - getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName()); - } - } - - // execute the action - super.execute(action, actionedUponNodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * Auditable action executer abstract base + * + * @author Roy Wetherall + * @since 2.1 + */ +public abstract class AuditableActionExecuterAbstractBase extends ActionExecuterAbstractBase implements ApplicationContextAware +{ + /** Indicates whether the action is auditable or not */ + private boolean auditable = true; + + /** Indicates whether the action is audited immediately or not */ + private boolean auditedImmediately = false; + + /** Application context */ + private ApplicationContext applicationContext; + + /** Records management audit service */ + private RecordsManagementAuditService auditService; + + /** + * @return True if auditable, false otherwise + */ + protected boolean isAuditable() + { + return this.auditable; + } + + /** + * @return True if audited immediately, false otherwise + */ + protected boolean isAuditedImmediately() + { + return this.auditedImmediately; + } + + /** + * @return Application context + */ + protected ApplicationContext getApplicationContext() + { + return this.applicationContext; + } + + /** + * @param auditable true if auditable, false otherwise + */ + public void setAuditable(boolean auditable) + { + this.auditable = auditable; + } + + /** + * @param auditedImmediately true if to be audited immediately, false to be audited after transaction commits + */ + public void setAuditedImmediately(boolean auditedImmediately) + { + this.auditedImmediately = auditedImmediately; + } + + /** + * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) + { + this.applicationContext = applicationContext; + } + + /** + * @return records management audit service + */ + private RecordsManagementAuditService getAuditService() + { + if (auditService == null) + { + auditService = (RecordsManagementAuditService) getApplicationContext().getBean("recordsManagementAuditService"); + } + return auditService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#init() + */ + @Override + public void init() + { + if (!(this instanceof RecordsManagementAction)) + { + super.init(); + } + + if (isAuditable()) + { + // get the details of the action + String name = getActionDefinition().getName(); + String title = getActionDefinition().getTitle(); + if (title == null || title.isEmpty()) + { + // default to name if no title available + title = name; + } + + // register audit event + getAuditService().registerAuditEvent(name, title); + } + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#execute(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void execute(Action action, NodeRef actionedUponNodeRef) + { + // audit the execution of the action + if (isAuditable()) + { + if (isAuditedImmediately()) + { + // To be audited immediately before the action is executed, eg. to audit before actionedUponNodeRef gets deleted during the execution. + getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName(), null, null, true); + } + else + { + // To be stacked up with other audit entries and audited after the transaction commits. + getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName()); + } + } + + // execute the action + super.execute(action, actionedUponNodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java index cf6697edbf..e0f3b13f8a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java @@ -1,96 +1,96 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import org.alfresco.repo.action.parameter.ParameterProcessorComponent; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Extension to action implementation hierarchy to insert parameter substitution processing. - * - * NOTE: this should eventually be pushed into the core. - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class PropertySubActionExecuterAbstractBase extends AuditableActionExecuterAbstractBase -{ - /** Parameter processor component */ - private ParameterProcessorComponent parameterProcessorComponent; - - /** Indicates whether parameter substitutions are allowed */ - private boolean allowParameterSubstitutions = false; - - /** - * @return Parameter processor component - */ - protected ParameterProcessorComponent getParameterProcessorComponent() - { - return this.parameterProcessorComponent; - } - - /** - * @return True if parameter substitutions are allowed, false otherwise - */ - protected boolean isAllowParameterSubstitutions() - { - return this.allowParameterSubstitutions; - } - - /** - * @param parameterProcessorComponent parameter processor component - */ - public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) - { - this.parameterProcessorComponent = parameterProcessorComponent; - } - - /** - * @param allowParameterSubstitutions true if property subs allowed, false otherwise - */ - public void setAllowParameterSubstitutions(boolean allowParameterSubstitutions) - { - this.allowParameterSubstitutions = allowParameterSubstitutions; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#execute(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void execute(Action action, NodeRef actionedUponNodeRef) - { - // do the property subs (if any exist) - if (isAllowParameterSubstitutions()) - { - getParameterProcessorComponent().process(action, getActionDefinition(), actionedUponNodeRef); - } - - super.execute(action, actionedUponNodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import org.alfresco.repo.action.parameter.ParameterProcessorComponent; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Extension to action implementation hierarchy to insert parameter substitution processing. + * + * NOTE: this should eventually be pushed into the core. + * + * @author Roy Wetherall + * @since 2.1 + */ +public abstract class PropertySubActionExecuterAbstractBase extends AuditableActionExecuterAbstractBase +{ + /** Parameter processor component */ + private ParameterProcessorComponent parameterProcessorComponent; + + /** Indicates whether parameter substitutions are allowed */ + private boolean allowParameterSubstitutions = false; + + /** + * @return Parameter processor component + */ + protected ParameterProcessorComponent getParameterProcessorComponent() + { + return this.parameterProcessorComponent; + } + + /** + * @return True if parameter substitutions are allowed, false otherwise + */ + protected boolean isAllowParameterSubstitutions() + { + return this.allowParameterSubstitutions; + } + + /** + * @param parameterProcessorComponent parameter processor component + */ + public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) + { + this.parameterProcessorComponent = parameterProcessorComponent; + } + + /** + * @param allowParameterSubstitutions true if property subs allowed, false otherwise + */ + public void setAllowParameterSubstitutions(boolean allowParameterSubstitutions) + { + this.allowParameterSubstitutions = allowParameterSubstitutions; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#execute(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void execute(Action action, NodeRef actionedUponNodeRef) + { + // do the property subs (if any exist) + if (isAllowParameterSubstitutions()) + { + getParameterProcessorComponent().process(action, getActionDefinition(), actionedUponNodeRef); + } + + super.execute(action, actionedUponNodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java index 5785a3372e..9efb9256d1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java @@ -1,687 +1,687 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import static org.apache.commons.lang.StringUtils.leftPad; - -import java.io.Serializable; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.alfresco.service.cmr.action.ActionService; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.PropertyCheck; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.util.StringUtils; - -/** - * Records management action executer base class - * - * @author Roy Wetherall - */ -public abstract class RMActionExecuterAbstractBase extends PropertySubActionExecuterAbstractBase - implements RecordsManagementAction, - RecordsManagementModel, - BeanNameAware -{ - /** Namespace service */ - private NamespaceService namespaceService; - - /** Used to control transactional behaviour including post-commit auditing */ - private TransactionService transactionService; - - /** Node service */ - private NodeService nodeService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Content service */ - private ContentService contentService; - - /** Action service */ - private ActionService actionService; - - /** Records management action service */ - private RecordsManagementAuditService recordsManagementAuditService; - - /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** Record service */ - private RecordService recordService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Vital record service */ - private VitalRecordService vitalRecordService; - - /** Records management event service */ - private RecordsManagementEventService recordsManagementEventService; - - /** Records management action service */ - private RecordsManagementAdminService recordsManagementAdminService; - - /** Ownable service **/ - private OwnableService ownableService; - - /** Freeze service */ - private FreezeService freezeService; - - /** Model security service */ - private ModelSecurityService modelSecurityService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Hold service */ - private HoldService holdService; - - /** List of kinds for which this action is applicable */ - protected Set applicableKinds = new HashSet(); - - /** - * Get the transaction service - * - * @return The transaction service - */ - protected TransactionService getTransactionService() - { - return this.transactionService; - } - - /** - * Set the transaction service - * - * @param transactionService The transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Gets the namespace service - * - * @return The namespace service - */ - protected NamespaceService getNamespaceService() - { - return this.namespaceService; - } - - /** - * Set the namespace service - * - * @param namespaceService The namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Gets the node service - * - * @return The node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Set the node service - * - * @param nodeService The node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Gets the dictionary service - * - * @return The dictionary service - */ - protected DictionaryService getDictionaryService() - { - return this.dictionaryService; - } - - /** - * Set the dictionary service - * - * @param dictionaryService The dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Gets the content service - * - * @return The content service - */ - protected ContentService getContentService() - { - return this.contentService; - } - - /** - * Set the content service - * - * @param contentService The content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * Gets the action service - * - * @return The action service - */ - protected ActionService getActionService() - { - return this.actionService; - } - - /** - * Set action service - * - * @param actionService The action service - */ - public void setActionService(ActionService actionService) - { - this.actionService = actionService; - } - - /** - * Gets the records management audit service - * - * @return The records management audit service - */ - protected RecordsManagementAuditService getRecordsManagementAuditService() - { - return this.recordsManagementAuditService; - } - - /** - * Set the audit service that action details will be sent to - * - * @param recordsManagementAuditService The audit service that action details will be sent to - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * Gets the records management action service - * - * @return The records management action service - */ - protected RecordsManagementActionService getRecordsManagementActionService() - { - return this.recordsManagementActionService; - } - - /** - * Set records management service - * - * @param recordsManagementActionService The records management service - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * Gets the disposition service - * - * @return The disposition service - */ - protected DispositionService getDispositionService() - { - return this.dispositionService; - } - - /** - * Set the disposition service - * - * @param dispositionService The disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Gets the vital record service - * - * @return The vital record service - */ - protected VitalRecordService getVitalRecordService() - { - return this.vitalRecordService; - } - - /** - * Sets the vital record service - * - * @param vitalRecordService vital record service - */ - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - /** - * Gets the records management event service - * - * @return The records management event service - */ - protected RecordsManagementEventService getRecordsManagementEventService() - { - return this.recordsManagementEventService; - } - - /** - * Set the records management event service - * - * @param recordsManagementEventService The records management event service - */ - public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) - { - this.recordsManagementEventService = recordsManagementEventService; - } - - /** - * Gets the ownable service - * - * @return The ownable service - */ - protected OwnableService getOwnableService() - { - return this.ownableService; - } - - /** - * Set the ownable service - * - * @param ownableService The ownable service - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - - /** - * Gets the freeze service - * - * @return The freeze service - */ - protected FreezeService getFreezeService() - { - return this.freezeService; - } - - /** - * Set freeze service - * - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * Gets the record service - * - * @return The record service - */ - protected RecordService getRecordService() - { - return this.recordService; - } - - /** - * Set record service - * - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * Gets the records management admin service - * - * @return The records management admin service - */ - protected RecordsManagementAdminService getRecordsManagementAdminService() - { - return recordsManagementAdminService; - } - - /** - * Sets the records management admin service - * - * @param recordsManagementAdminService records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - /** - * Gets the model security service - * - * @return The model security service - */ - protected ModelSecurityService getModelSecurityService() - { - return this.modelSecurityService; - } - - /** - * Sets the model security service - * - * @param modelSecurityService model security service - */ - public void setModelSecurityService(ModelSecurityService modelSecurityService) - { - this.modelSecurityService = modelSecurityService; - } - - /** - * Gets the record folder service - * - * @return The record folder service - */ - protected RecordFolderService getRecordFolderService() - { - return this.recordFolderService; - } - - /** - * Sets the record folder service - * - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * Gets the hold service - * - * @return The hold service - */ - protected HoldService getHoldService() - { - return this.holdService; - } - - /** - * Sets the hold service - * - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * Sets the applicable kinds - * - * @param applicableKinds kinds that this action is applicable for - */ - public void setApplicableKinds(String[] applicableKinds) - { - for(String kind : applicableKinds) - { - this.applicableKinds.add(FilePlanComponentKind.valueOf(kind)); - } - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#createActionDefinition(java.lang.String) - */ - @Override - protected ActionDefinition createActionDefinition(String name) - { - return new RecordsManagementActionDefinitionImpl(name); - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#getActionDefinition() - */ - @Override - public ActionDefinition getActionDefinition() - { - ActionDefinition actionDefinition = super.getActionDefinition(); - ((RecordsManagementActionDefinitionImpl)this.actionDefinition).setApplicableKinds(applicableKinds); - return actionDefinition; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getRecordsManagementActionDefinition() - */ - @Override - public RecordsManagementActionDefinition getRecordsManagementActionDefinition() - { - return (RecordsManagementActionDefinition)getActionDefinition(); - } - - /** - * Init method - */ - @Override - public void init() - { - PropertyCheck.mandatory(this, "namespaceService", namespaceService); - PropertyCheck.mandatory(this, "transactionService", transactionService); - PropertyCheck.mandatory(this, "nodeService", nodeService); - PropertyCheck.mandatory(this, "dictionaryService", dictionaryService); - PropertyCheck.mandatory(this, "contentService", contentService); - PropertyCheck.mandatory(this, "actionService", actionService); - PropertyCheck.mandatory(this, "transactionService", transactionService); - PropertyCheck.mandatory(this, "recordsManagementAuditService", recordsManagementAuditService); - PropertyCheck.mandatory(this, "recordsManagementActionService", recordsManagementActionService); - PropertyCheck.mandatory(this, "recordsManagementAdminService", recordsManagementAdminService); - PropertyCheck.mandatory(this, "recordsManagementEventService", recordsManagementEventService); - - super.init(); - } - - /** - * Indicates whether this records management action is public or not - * - * @return boolean true if public, false otherwise - */ - @Override - public boolean isPublicAction() - { - return publicAction; - } - - /** - * @see org.alfresco.repo.action.CommonResourceAbstractBase#setBeanName(java.lang.String) - */ - @Override - public void setBeanName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getName() - */ - public String getName() - { - return this.name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getLabel() - */ - public String getLabel() - { - String label = I18NUtil.getMessage(this.getTitleKey()); - - if (label == null) - { - // default to the name of the action with first letter capitalised - label = StringUtils.capitalize(this.name); - } - - return label; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getDescription() - */ - public String getDescription() - { - String desc = I18NUtil.getMessage(this.getDescriptionKey()); - - if (desc == null) - { - // default to the name of the action with first letter capitalised - desc = StringUtils.capitalize(this.name); - } - - return desc; - } - - /** - * By default an action is not a disposition action - * - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#isDispositionAction() - */ - public boolean isDispositionAction() - { - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#execute(org.alfresco.service.cmr.repository.NodeRef, java.util.Map) - */ - public RecordsManagementActionResult execute(NodeRef filePlanComponent, Map parameters) - { - // Create the action - Action action = this.actionService.createAction(name); - action.setParameterValues(parameters); - - // disable model security whilst we execute the RM rule - modelSecurityService.disable(); - try - { - // Execute the action - actionService.executeAction(action, filePlanComponent); - } - finally - { - modelSecurityService.enable(); - } - - // Get the result - Object value = action.getParameterValue(ActionExecuterAbstractBase.PARAM_RESULT); - return new RecordsManagementActionResult(value); - } - - /** - * Function to pad a string with zero '0' characters to the required length - * - * @param s String to pad with leading zero '0' characters - * @param len Length to pad to - * - * @return padded string or the original if already at >= len characters - * - * @deprecated As of 2.1, replaced by {@link org.apache.commons.lang.StringUtils.leftPad} - */ - @Deprecated - protected String padString(String s, int len) - { - return leftPad(s, len); - } - - /** - * By default there are no parameters. - * - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // No parameters - } - - /** - * By default, rmActions do not provide an implicit target nodeRef. - */ - public NodeRef getImplicitTargetNodeRef() - { - return null; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import static org.apache.commons.lang.StringUtils.leftPad; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ActionDefinition; +import org.alfresco.service.cmr.action.ActionService; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.PropertyCheck; +import org.springframework.beans.factory.BeanNameAware; +import org.springframework.extensions.surf.util.I18NUtil; +import org.springframework.util.StringUtils; + +/** + * Records management action executer base class + * + * @author Roy Wetherall + */ +public abstract class RMActionExecuterAbstractBase extends PropertySubActionExecuterAbstractBase + implements RecordsManagementAction, + RecordsManagementModel, + BeanNameAware +{ + /** Namespace service */ + private NamespaceService namespaceService; + + /** Used to control transactional behaviour including post-commit auditing */ + private TransactionService transactionService; + + /** Node service */ + private NodeService nodeService; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** Content service */ + private ContentService contentService; + + /** Action service */ + private ActionService actionService; + + /** Records management action service */ + private RecordsManagementAuditService recordsManagementAuditService; + + /** Records management action service */ + private RecordsManagementActionService recordsManagementActionService; + + /** Record service */ + private RecordService recordService; + + /** Disposition service */ + private DispositionService dispositionService; + + /** Vital record service */ + private VitalRecordService vitalRecordService; + + /** Records management event service */ + private RecordsManagementEventService recordsManagementEventService; + + /** Records management action service */ + private RecordsManagementAdminService recordsManagementAdminService; + + /** Ownable service **/ + private OwnableService ownableService; + + /** Freeze service */ + private FreezeService freezeService; + + /** Model security service */ + private ModelSecurityService modelSecurityService; + + /** Record folder service */ + private RecordFolderService recordFolderService; + + /** Hold service */ + private HoldService holdService; + + /** List of kinds for which this action is applicable */ + protected Set applicableKinds = new HashSet(); + + /** + * Get the transaction service + * + * @return The transaction service + */ + protected TransactionService getTransactionService() + { + return this.transactionService; + } + + /** + * Set the transaction service + * + * @param transactionService The transaction service + */ + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + /** + * Gets the namespace service + * + * @return The namespace service + */ + protected NamespaceService getNamespaceService() + { + return this.namespaceService; + } + + /** + * Set the namespace service + * + * @param namespaceService The namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * Gets the node service + * + * @return The node service + */ + protected NodeService getNodeService() + { + return this.nodeService; + } + + /** + * Set the node service + * + * @param nodeService The node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Gets the dictionary service + * + * @return The dictionary service + */ + protected DictionaryService getDictionaryService() + { + return this.dictionaryService; + } + + /** + * Set the dictionary service + * + * @param dictionaryService The dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * Gets the content service + * + * @return The content service + */ + protected ContentService getContentService() + { + return this.contentService; + } + + /** + * Set the content service + * + * @param contentService The content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * Gets the action service + * + * @return The action service + */ + protected ActionService getActionService() + { + return this.actionService; + } + + /** + * Set action service + * + * @param actionService The action service + */ + public void setActionService(ActionService actionService) + { + this.actionService = actionService; + } + + /** + * Gets the records management audit service + * + * @return The records management audit service + */ + protected RecordsManagementAuditService getRecordsManagementAuditService() + { + return this.recordsManagementAuditService; + } + + /** + * Set the audit service that action details will be sent to + * + * @param recordsManagementAuditService The audit service that action details will be sent to + */ + public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) + { + this.recordsManagementAuditService = recordsManagementAuditService; + } + + /** + * Gets the records management action service + * + * @return The records management action service + */ + protected RecordsManagementActionService getRecordsManagementActionService() + { + return this.recordsManagementActionService; + } + + /** + * Set records management service + * + * @param recordsManagementActionService The records management service + */ + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * Gets the disposition service + * + * @return The disposition service + */ + protected DispositionService getDispositionService() + { + return this.dispositionService; + } + + /** + * Set the disposition service + * + * @param dispositionService The disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Gets the vital record service + * + * @return The vital record service + */ + protected VitalRecordService getVitalRecordService() + { + return this.vitalRecordService; + } + + /** + * Sets the vital record service + * + * @param vitalRecordService vital record service + */ + public void setVitalRecordService(VitalRecordService vitalRecordService) + { + this.vitalRecordService = vitalRecordService; + } + + /** + * Gets the records management event service + * + * @return The records management event service + */ + protected RecordsManagementEventService getRecordsManagementEventService() + { + return this.recordsManagementEventService; + } + + /** + * Set the records management event service + * + * @param recordsManagementEventService The records management event service + */ + public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) + { + this.recordsManagementEventService = recordsManagementEventService; + } + + /** + * Gets the ownable service + * + * @return The ownable service + */ + protected OwnableService getOwnableService() + { + return this.ownableService; + } + + /** + * Set the ownable service + * + * @param ownableService The ownable service + */ + public void setOwnableService(OwnableService ownableService) + { + this.ownableService = ownableService; + } + + /** + * Gets the freeze service + * + * @return The freeze service + */ + protected FreezeService getFreezeService() + { + return this.freezeService; + } + + /** + * Set freeze service + * + * @param freezeService freeze service + */ + public void setFreezeService(FreezeService freezeService) + { + this.freezeService = freezeService; + } + + /** + * Gets the record service + * + * @return The record service + */ + protected RecordService getRecordService() + { + return this.recordService; + } + + /** + * Set record service + * + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * Gets the records management admin service + * + * @return The records management admin service + */ + protected RecordsManagementAdminService getRecordsManagementAdminService() + { + return recordsManagementAdminService; + } + + /** + * Sets the records management admin service + * + * @param recordsManagementAdminService records management admin service + */ + public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) + { + this.recordsManagementAdminService = recordsManagementAdminService; + } + + /** + * Gets the model security service + * + * @return The model security service + */ + protected ModelSecurityService getModelSecurityService() + { + return this.modelSecurityService; + } + + /** + * Sets the model security service + * + * @param modelSecurityService model security service + */ + public void setModelSecurityService(ModelSecurityService modelSecurityService) + { + this.modelSecurityService = modelSecurityService; + } + + /** + * Gets the record folder service + * + * @return The record folder service + */ + protected RecordFolderService getRecordFolderService() + { + return this.recordFolderService; + } + + /** + * Sets the record folder service + * + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * Gets the hold service + * + * @return The hold service + */ + protected HoldService getHoldService() + { + return this.holdService; + } + + /** + * Sets the hold service + * + * @param holdService hold service + */ + public void setHoldService(HoldService holdService) + { + this.holdService = holdService; + } + + /** + * Sets the applicable kinds + * + * @param applicableKinds kinds that this action is applicable for + */ + public void setApplicableKinds(String[] applicableKinds) + { + for(String kind : applicableKinds) + { + this.applicableKinds.add(FilePlanComponentKind.valueOf(kind)); + } + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#createActionDefinition(java.lang.String) + */ + @Override + protected ActionDefinition createActionDefinition(String name) + { + return new RecordsManagementActionDefinitionImpl(name); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#getActionDefinition() + */ + @Override + public ActionDefinition getActionDefinition() + { + ActionDefinition actionDefinition = super.getActionDefinition(); + ((RecordsManagementActionDefinitionImpl)this.actionDefinition).setApplicableKinds(applicableKinds); + return actionDefinition; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getRecordsManagementActionDefinition() + */ + @Override + public RecordsManagementActionDefinition getRecordsManagementActionDefinition() + { + return (RecordsManagementActionDefinition)getActionDefinition(); + } + + /** + * Init method + */ + @Override + public void init() + { + PropertyCheck.mandatory(this, "namespaceService", namespaceService); + PropertyCheck.mandatory(this, "transactionService", transactionService); + PropertyCheck.mandatory(this, "nodeService", nodeService); + PropertyCheck.mandatory(this, "dictionaryService", dictionaryService); + PropertyCheck.mandatory(this, "contentService", contentService); + PropertyCheck.mandatory(this, "actionService", actionService); + PropertyCheck.mandatory(this, "transactionService", transactionService); + PropertyCheck.mandatory(this, "recordsManagementAuditService", recordsManagementAuditService); + PropertyCheck.mandatory(this, "recordsManagementActionService", recordsManagementActionService); + PropertyCheck.mandatory(this, "recordsManagementAdminService", recordsManagementAdminService); + PropertyCheck.mandatory(this, "recordsManagementEventService", recordsManagementEventService); + + super.init(); + } + + /** + * Indicates whether this records management action is public or not + * + * @return boolean true if public, false otherwise + */ + @Override + public boolean isPublicAction() + { + return publicAction; + } + + /** + * @see org.alfresco.repo.action.CommonResourceAbstractBase#setBeanName(java.lang.String) + */ + @Override + public void setBeanName(String name) + { + this.name = name; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getName() + */ + public String getName() + { + return this.name; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getLabel() + */ + public String getLabel() + { + String label = I18NUtil.getMessage(this.getTitleKey()); + + if (label == null) + { + // default to the name of the action with first letter capitalised + label = StringUtils.capitalize(this.name); + } + + return label; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getDescription() + */ + public String getDescription() + { + String desc = I18NUtil.getMessage(this.getDescriptionKey()); + + if (desc == null) + { + // default to the name of the action with first letter capitalised + desc = StringUtils.capitalize(this.name); + } + + return desc; + } + + /** + * By default an action is not a disposition action + * + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#isDispositionAction() + */ + public boolean isDispositionAction() + { + return false; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#execute(org.alfresco.service.cmr.repository.NodeRef, java.util.Map) + */ + public RecordsManagementActionResult execute(NodeRef filePlanComponent, Map parameters) + { + // Create the action + Action action = this.actionService.createAction(name); + action.setParameterValues(parameters); + + // disable model security whilst we execute the RM rule + modelSecurityService.disable(); + try + { + // Execute the action + actionService.executeAction(action, filePlanComponent); + } + finally + { + modelSecurityService.enable(); + } + + // Get the result + Object value = action.getParameterValue(ActionExecuterAbstractBase.PARAM_RESULT); + return new RecordsManagementActionResult(value); + } + + /** + * Function to pad a string with zero '0' characters to the required length + * + * @param s String to pad with leading zero '0' characters + * @param len Length to pad to + * + * @return padded string or the original if already at >= len characters + * + * @deprecated As of 2.1, replaced by {@link org.apache.commons.lang.StringUtils.leftPad} + */ + @Deprecated + protected String padString(String s, int len) + { + return leftPad(s, len); + } + + /** + * By default there are no parameters. + * + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + // No parameters + } + + /** + * By default, rmActions do not provide an implicit target nodeRef. + */ + public NodeRef getImplicitTargetNodeRef() + { + return null; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java index adf51e214e..59a89f730b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java @@ -1,312 +1,312 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import java.util.Date; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * @author Roy Wetherall - */ -public abstract class RMDispositionActionExecuterAbstractBase extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_RECORD_NOT_DECLARED = "rm.action.record-not-declared"; - private static final String MSG_EXPECTED_RECORD_LEVEL = "rm.action.expected-record-level"; - private static final String MSG_NOT_ALL_RECORDS_DECLARED = "rm.action.not-all-records-declared"; - private static final String MSG_NOT_ELIGIBLE = "rm.action.not-eligible"; - private static final String MSG_NO_DISPOITION_INSTRUCTIONS = "rm.action.no-disposition-instructions"; - private static final String MSG_NO_DIS_LIFECYCLE_SET = "rm.action.no-disposition-lisfecycle-set"; - private static final String MSG_NEXT_DISP_NOT_SET = "rm.action.next-disp-not-set"; - private static final String MSG_NOT_NEXT_DISP = "rm.action.not-next-disp"; - private static final String MSG_NOT_RECORD_FOLDER = "rm.action.not-record-folder"; - - /** Parameter value indicating whether we should be doing non-error raising state checks */ - public static final String PARAM_NO_ERROR_CHECK = "rm.no-error-check"; - - /** - * All children of this implementation are disposition actions. - * - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#isDispositionAction() - */ - @Override - public boolean isDispositionAction() - { - return true; - } - - /** - * Indicates whether the disposition is marked complete - * - * @return true if marked complete, false otherwise - */ - public boolean getSetDispositionActionComplete() - { - return true; - } - - /** - * Indicates whether we should validate the next disposition action is the action we are - * trying to execute. - * - * @return - */ - protected boolean checkNextDispositionAction(NodeRef actionedUponNodeRef) - { - return true; - } - - /** - * Indicated whether we should validate the disposition action is eligible or not. - * - * @param actionedUponNodeRef - * @return - */ - protected boolean checkEligibility(NodeRef actionedUponNodeRef) - { - return true; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - NodeRef nextDispositionActionNodeRef = getNextDispostionAction(actionedUponNodeRef); - - // determine whether we should be raising errors during state checking or not - boolean checkError = true; - Boolean checkErrorValue = (Boolean)action.getParameterValue(PARAM_NO_ERROR_CHECK); - if (checkErrorValue != null) - { - checkError = checkErrorValue.booleanValue(); - } - - // Check the validity of the action (is it the next action, are we dealing with the correct type of object for - // the disposition level? - DispositionSchedule di = checkDispositionActionExecutionValidity(actionedUponNodeRef, nextDispositionActionNodeRef, checkError); - if (di != null) - { - // Check the eligibility of the action - if (!checkEligibility(actionedUponNodeRef) || - getDispositionService().isNextDispositionActionEligible(actionedUponNodeRef)) - { - if (di.isRecordLevelDisposition()) - { - // Check that we do indeed have a record - if (getRecordService().isRecord(actionedUponNodeRef)) - { - // Can only execute disposition action on record if declared - if (getRecordService().isDeclared(actionedUponNodeRef)) - { - // Indicate that the disposition action is underway - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY, AuthenticationUtil.getRunAsUser()); - - // Execute record level disposition - executeRecordLevelDisposition(action, actionedUponNodeRef); - - if (getNodeService().exists(nextDispositionActionNodeRef) && - getSetDispositionActionComplete()) - { - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_NOT_DECLARED, getName(), actionedUponNodeRef.toString())); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EXPECTED_RECORD_LEVEL, getName(), actionedUponNodeRef.toString())); - } - } - else - { - if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) - { - if (getRecordFolderService().isRecordFolderDeclared(actionedUponNodeRef)) - { - // Indicate that the disposition action is underway - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY, AuthenticationUtil.getRunAsUser()); - - executeRecordFolderLevelDisposition(action, actionedUponNodeRef); - - // Indicate that the disposition action is compelte - if (getNodeService().exists(nextDispositionActionNodeRef) && - getSetDispositionActionComplete()) - { - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); - } - - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_ALL_RECORDS_DECLARED, getName(), actionedUponNodeRef.toString())); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_RECORD_FOLDER, getName(), actionedUponNodeRef.toString())); - } - - } - - if (getNodeService().exists(actionedUponNodeRef) && getSetDispositionActionComplete()) - { - // Update the disposition schedule - getDispositionService().updateNextDispositionAction(actionedUponNodeRef); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_ELIGIBLE, getName(), actionedUponNodeRef.toString())); - } - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // TODO add the "checkEligibility" parameter - } - - /** - * @param action - * @param record - */ - protected abstract void executeRecordLevelDisposition(Action action, NodeRef record); - - /** - * @param action - * @param recordFolder - */ - protected abstract void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder); - - /** - * @param nodeRef - * @return - */ - protected DispositionSchedule checkDispositionActionExecutionValidity(NodeRef nodeRef, NodeRef nextDispositionActionNodeRef, boolean throwError) - { - // Check the node has associated disposition instructions - DispositionSchedule di = getDispositionService().getDispositionSchedule(nodeRef); - if (di == null) - { - if (throwError) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_DISPOITION_INSTRUCTIONS, getName(), nodeRef.toString())); - } - else - { - return null; - } - } - - // Check the node has the disposition schedule aspect applied - if (!getNodeService().hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - if (throwError) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_DIS_LIFECYCLE_SET, getName(), nodeRef.toString())); - } - else - { - return null; - } - } - - if (checkNextDispositionAction(nodeRef)) - { - // Check this the next disposition action - NodeRef nextDispositionAction = nextDispositionActionNodeRef; - if (nextDispositionAction == null) - { - if (throwError) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NEXT_DISP_NOT_SET, getName(), nodeRef.toString())); - } - else - { - return null; - } - } - String actionName = (String) getNodeService().getProperty(nextDispositionAction, PROP_DISPOSITION_ACTION); - if (actionName == null || !actionName.equals(getName())) - { - if (throwError) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_NEXT_DISP, getName(), nodeRef.toString())); - } - else - { - return null; - } - } - } - - return di; - } - - /** - * Get the next disposition action node. Null if none present. - * - * @param nodeRef - * the disposable node reference - * @return NodeRef the next disposition action, null if none - */ - private NodeRef getNextDispostionAction(NodeRef nodeRef) - { - NodeRef result = null; - List assocs = getNodeService().getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, RegexQNamePattern.MATCH_ALL); - if (assocs.size() != 0) - { - result = assocs.get(0).getChildRef(); - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import java.util.Date; +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * @author Roy Wetherall + */ +public abstract class RMDispositionActionExecuterAbstractBase extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_RECORD_NOT_DECLARED = "rm.action.record-not-declared"; + private static final String MSG_EXPECTED_RECORD_LEVEL = "rm.action.expected-record-level"; + private static final String MSG_NOT_ALL_RECORDS_DECLARED = "rm.action.not-all-records-declared"; + private static final String MSG_NOT_ELIGIBLE = "rm.action.not-eligible"; + private static final String MSG_NO_DISPOITION_INSTRUCTIONS = "rm.action.no-disposition-instructions"; + private static final String MSG_NO_DIS_LIFECYCLE_SET = "rm.action.no-disposition-lisfecycle-set"; + private static final String MSG_NEXT_DISP_NOT_SET = "rm.action.next-disp-not-set"; + private static final String MSG_NOT_NEXT_DISP = "rm.action.not-next-disp"; + private static final String MSG_NOT_RECORD_FOLDER = "rm.action.not-record-folder"; + + /** Parameter value indicating whether we should be doing non-error raising state checks */ + public static final String PARAM_NO_ERROR_CHECK = "rm.no-error-check"; + + /** + * All children of this implementation are disposition actions. + * + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#isDispositionAction() + */ + @Override + public boolean isDispositionAction() + { + return true; + } + + /** + * Indicates whether the disposition is marked complete + * + * @return true if marked complete, false otherwise + */ + public boolean getSetDispositionActionComplete() + { + return true; + } + + /** + * Indicates whether we should validate the next disposition action is the action we are + * trying to execute. + * + * @return + */ + protected boolean checkNextDispositionAction(NodeRef actionedUponNodeRef) + { + return true; + } + + /** + * Indicated whether we should validate the disposition action is eligible or not. + * + * @param actionedUponNodeRef + * @return + */ + protected boolean checkEligibility(NodeRef actionedUponNodeRef) + { + return true; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + NodeRef nextDispositionActionNodeRef = getNextDispostionAction(actionedUponNodeRef); + + // determine whether we should be raising errors during state checking or not + boolean checkError = true; + Boolean checkErrorValue = (Boolean)action.getParameterValue(PARAM_NO_ERROR_CHECK); + if (checkErrorValue != null) + { + checkError = checkErrorValue.booleanValue(); + } + + // Check the validity of the action (is it the next action, are we dealing with the correct type of object for + // the disposition level? + DispositionSchedule di = checkDispositionActionExecutionValidity(actionedUponNodeRef, nextDispositionActionNodeRef, checkError); + if (di != null) + { + // Check the eligibility of the action + if (!checkEligibility(actionedUponNodeRef) || + getDispositionService().isNextDispositionActionEligible(actionedUponNodeRef)) + { + if (di.isRecordLevelDisposition()) + { + // Check that we do indeed have a record + if (getRecordService().isRecord(actionedUponNodeRef)) + { + // Can only execute disposition action on record if declared + if (getRecordService().isDeclared(actionedUponNodeRef)) + { + // Indicate that the disposition action is underway + getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date()); + getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY, AuthenticationUtil.getRunAsUser()); + + // Execute record level disposition + executeRecordLevelDisposition(action, actionedUponNodeRef); + + if (getNodeService().exists(nextDispositionActionNodeRef) && + getSetDispositionActionComplete()) + { + getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); + getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); + } + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_NOT_DECLARED, getName(), actionedUponNodeRef.toString())); + } + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EXPECTED_RECORD_LEVEL, getName(), actionedUponNodeRef.toString())); + } + } + else + { + if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) + { + if (getRecordFolderService().isRecordFolderDeclared(actionedUponNodeRef)) + { + // Indicate that the disposition action is underway + getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date()); + getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY, AuthenticationUtil.getRunAsUser()); + + executeRecordFolderLevelDisposition(action, actionedUponNodeRef); + + // Indicate that the disposition action is compelte + if (getNodeService().exists(nextDispositionActionNodeRef) && + getSetDispositionActionComplete()) + { + getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); + getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); + } + + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_ALL_RECORDS_DECLARED, getName(), actionedUponNodeRef.toString())); + } + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_RECORD_FOLDER, getName(), actionedUponNodeRef.toString())); + } + + } + + if (getNodeService().exists(actionedUponNodeRef) && getSetDispositionActionComplete()) + { + // Update the disposition schedule + getDispositionService().updateNextDispositionAction(actionedUponNodeRef); + } + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_ELIGIBLE, getName(), actionedUponNodeRef.toString())); + } + } + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + // TODO add the "checkEligibility" parameter + } + + /** + * @param action + * @param record + */ + protected abstract void executeRecordLevelDisposition(Action action, NodeRef record); + + /** + * @param action + * @param recordFolder + */ + protected abstract void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder); + + /** + * @param nodeRef + * @return + */ + protected DispositionSchedule checkDispositionActionExecutionValidity(NodeRef nodeRef, NodeRef nextDispositionActionNodeRef, boolean throwError) + { + // Check the node has associated disposition instructions + DispositionSchedule di = getDispositionService().getDispositionSchedule(nodeRef); + if (di == null) + { + if (throwError) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_DISPOITION_INSTRUCTIONS, getName(), nodeRef.toString())); + } + else + { + return null; + } + } + + // Check the node has the disposition schedule aspect applied + if (!getNodeService().hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + { + if (throwError) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_DIS_LIFECYCLE_SET, getName(), nodeRef.toString())); + } + else + { + return null; + } + } + + if (checkNextDispositionAction(nodeRef)) + { + // Check this the next disposition action + NodeRef nextDispositionAction = nextDispositionActionNodeRef; + if (nextDispositionAction == null) + { + if (throwError) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NEXT_DISP_NOT_SET, getName(), nodeRef.toString())); + } + else + { + return null; + } + } + String actionName = (String) getNodeService().getProperty(nextDispositionAction, PROP_DISPOSITION_ACTION); + if (actionName == null || !actionName.equals(getName())) + { + if (throwError) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_NEXT_DISP, getName(), nodeRef.toString())); + } + else + { + return null; + } + } + } + + return di; + } + + /** + * Get the next disposition action node. Null if none present. + * + * @param nodeRef + * the disposable node reference + * @return NodeRef the next disposition action, null if none + */ + private NodeRef getNextDispostionAction(NodeRef nodeRef) + { + NodeRef result = null; + List assocs = getNodeService().getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, RegexQNamePattern.MATCH_ALL); + if (assocs.size() != 0) + { + result = assocs.get(0).getChildRef(); + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementAction.java index 02230503ef..42f0304a87 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementAction.java @@ -1,104 +1,104 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Record Management Action - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementAction -{ - /** - * Get the name of the action - * - * @return String action name - */ - String getName(); - - /** - * Get the label of the action - * - * @return String action label - */ - String getLabel(); - - /** - * Get the description of the action - * - * @return String action description - */ - String getDescription(); - - /** - * Indicates whether this is a disposition action or not - * - * @return boolean true if a disposition action, false otherwise - */ - boolean isDispositionAction(); - - /** - * Execution of the action - * - * @param filePlanComponent file plan component the action is executed upon - * @param parameters action parameters - * @return The result of the executed action - */ - RecordsManagementActionResult execute(NodeRef filePlanComponent, Map parameters); - - /** - * Some admin-related rmActions execute against a target nodeRef which is not provided - * by the calling code, but is instead an implementation detail of the action. - * - * @return the target nodeRef - */ - NodeRef getImplicitTargetNodeRef(); - - /** - * Get the records management action definition. - * - * @return The records management action definition. - * @since 2.1 - */ - RecordsManagementActionDefinition getRecordsManagementActionDefinition(); - - /** - * Indicates whether the action is public or not - * - * @return true if the action is public, false otherwise - * @since 2.1 - */ - boolean isPublicAction(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Record Management Action + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface RecordsManagementAction +{ + /** + * Get the name of the action + * + * @return String action name + */ + String getName(); + + /** + * Get the label of the action + * + * @return String action label + */ + String getLabel(); + + /** + * Get the description of the action + * + * @return String action description + */ + String getDescription(); + + /** + * Indicates whether this is a disposition action or not + * + * @return boolean true if a disposition action, false otherwise + */ + boolean isDispositionAction(); + + /** + * Execution of the action + * + * @param filePlanComponent file plan component the action is executed upon + * @param parameters action parameters + * @return The result of the executed action + */ + RecordsManagementActionResult execute(NodeRef filePlanComponent, Map parameters); + + /** + * Some admin-related rmActions execute against a target nodeRef which is not provided + * by the calling code, but is instead an implementation detail of the action. + * + * @return the target nodeRef + */ + NodeRef getImplicitTargetNodeRef(); + + /** + * Get the records management action definition. + * + * @return The records management action definition. + * @since 2.1 + */ + RecordsManagementActionDefinition getRecordsManagementActionDefinition(); + + /** + * Indicates whether the action is public or not + * + * @return true if the action is public, false otherwise + * @since 2.1 + */ + boolean isPublicAction(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java index 40116e7e6f..a740df83e2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionCondition.java @@ -1,73 +1,73 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Record Management Action Condition - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordsManagementActionCondition -{ - /** - * Get the name of the action condition - * - * @return String action condition name - */ - String getName(); - - /** - * Get the label of the action condition - * - * @return String action condition label - */ - String getLabel(); - - /** - * Get the description of the action condition - * - * @return String action condition description - */ - String getDescription(); - - /** - * - * @return The records management action condition definition - */ - RecordsManagementActionConditionDefinition getRecordsManagementActionConditionDefinition(); - - /** - * - * @return true if the condition is public, false otherwise - */ - boolean isPublicCondition(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Record Management Action Condition + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface RecordsManagementActionCondition +{ + /** + * Get the name of the action condition + * + * @return String action condition name + */ + String getName(); + + /** + * Get the label of the action condition + * + * @return String action condition label + */ + String getLabel(); + + /** + * Get the description of the action condition + * + * @return String action condition description + */ + String getDescription(); + + /** + * + * @return The records management action condition definition + */ + RecordsManagementActionConditionDefinition getRecordsManagementActionConditionDefinition(); + + /** + * + * @return true if the condition is public, false otherwise + */ + boolean isPublicCondition(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinition.java index eafc22cc33..2366c446fc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinition.java @@ -1,44 +1,44 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.action.ActionConditionDefinition; - -/** - * Records management condition definition. - * - * Primarily used as a marker interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordsManagementActionConditionDefinition extends ActionConditionDefinition -{ -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.action.ActionConditionDefinition; + +/** + * Records management condition definition. + * + * Primarily used as a marker interface. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface RecordsManagementActionConditionDefinition extends ActionConditionDefinition +{ +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinitionImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinitionImpl.java index 64277f8324..55121d4306 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinitionImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionDefinitionImpl.java @@ -1,53 +1,53 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import org.alfresco.repo.action.ActionConditionDefinitionImpl; - -/** - * Records management condition definition implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordsManagementActionConditionDefinitionImpl extends ActionConditionDefinitionImpl - implements RecordsManagementActionConditionDefinition -{ - /** Serial Version UID */ - private static final long serialVersionUID = -7599279732731533610L; - - /** - * Default constructor. - * - * @param name name of the condition - */ - public RecordsManagementActionConditionDefinitionImpl(String name) - { - super(name); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import org.alfresco.repo.action.ActionConditionDefinitionImpl; + +/** + * Records management condition definition implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RecordsManagementActionConditionDefinitionImpl extends ActionConditionDefinitionImpl + implements RecordsManagementActionConditionDefinition +{ + /** Serial Version UID */ + private static final long serialVersionUID = -7599279732731533610L; + + /** + * Default constructor. + * + * @param name name of the condition + */ + public RecordsManagementActionConditionDefinitionImpl(String name) + { + super(name); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java index 4f89449532..fc9cd10151 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java @@ -1,224 +1,224 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.action.ActionConditionDefinition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Records management action condition evaluator abstract base implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class RecordsManagementActionConditionEvaluatorAbstractBase extends ActionConditionEvaluatorAbstractBase - implements RecordsManagementActionCondition, - BeanNameAware -{ - /** records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** bean name */ - private String name; - - /** public condition */ - private boolean publicCondition = true; - - private RetryingTransactionHelper retryingTransactionHelper; - - /** - * @return Records management action service - */ - protected RecordsManagementActionService getRecordsManagementActionService() - { - return this.recordsManagementActionService; - } - - /** - * @return File plan service - */ - protected FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * @param recordsManagementActionService records management action service - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param retryingTransactionHelper retrying transaction helper - */ - public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#init() - */ - @Override - public void init() - { - // override to prevent condition being registered with the core action service - - // run the following code as System - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - getRecordsManagementActionService().register(RecordsManagementActionConditionEvaluatorAbstractBase.this); - - return null; - } - }; - - retryingTransactionHelper.doInTransaction(callback); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - } - - @Override - public void setPublicCondition(boolean publicCondition) - { - this.publicCondition = publicCondition; - } - - /** - * @see org.alfresco.repo.action.CommonResourceAbstractBase#setBeanName(java.lang.String) - */ - @Override - public void setBeanName(String name) - { - this.name = name; - super.setBeanName(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getName() - */ - public String getName() - { - return this.name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getLabel() - */ - public String getLabel() - { - return getActionConditionDefintion().getTitle(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getDescription() - */ - public String getDescription() - { - return getActionConditionDefintion().getDescription(); - } - - /** - * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#getActionConditionDefintion() - * - * TODO base class should provide "createActionDefinition" method that can be over-ridden like the ActionExecuter - * base class to prevent duplication of code and a cleaner extension. - */ - @Override - public ActionConditionDefinition getActionConditionDefintion() - { - if (this.actionConditionDefinition == null) - { - this.actionConditionDefinition = new RecordsManagementActionConditionDefinitionImpl(name); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setTitleKey(getTitleKey()); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setDescriptionKey(getDescriptionKey()); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setAdhocPropertiesAllowed(getAdhocPropertiesAllowed()); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setConditionEvaluator(name); - ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setLocalizedParameterDefinitions(getLocalizedParameterDefinitions()); - } - return this.actionConditionDefinition; - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List arg0) - { - // No param implementation by default - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#isPublicCondition() - */ - @Override - public boolean isPublicCondition() - { - return publicCondition; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getRecordsManagementActionConditionDefinition() - */ - @Override - public RecordsManagementActionConditionDefinition getRecordsManagementActionConditionDefinition() - { - return (RecordsManagementActionConditionDefinition)getActionConditionDefintion(); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.action.ActionConditionDefinition; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.springframework.beans.factory.BeanNameAware; + +/** + * Records management action condition evaluator abstract base implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public abstract class RecordsManagementActionConditionEvaluatorAbstractBase extends ActionConditionEvaluatorAbstractBase + implements RecordsManagementActionCondition, + BeanNameAware +{ + /** records management action service */ + private RecordsManagementActionService recordsManagementActionService; + + /** File Plan Service */ + private FilePlanService filePlanService; + + /** bean name */ + private String name; + + /** public condition */ + private boolean publicCondition = true; + + private RetryingTransactionHelper retryingTransactionHelper; + + /** + * @return Records management action service + */ + protected RecordsManagementActionService getRecordsManagementActionService() + { + return this.recordsManagementActionService; + } + + /** + * @return File plan service + */ + protected FilePlanService getFilePlanService() + { + return this.filePlanService; + } + + /** + * @param recordsManagementActionService records management action service + */ + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param retryingTransactionHelper retrying transaction helper + */ + public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) + { + this.retryingTransactionHelper = retryingTransactionHelper; + } + + /** + * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#init() + */ + @Override + public void init() + { + // override to prevent condition being registered with the core action service + + // run the following code as System + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + RetryingTransactionCallback callback = new RetryingTransactionCallback() + { + public Void execute() + { + getRecordsManagementActionService().register(RecordsManagementActionConditionEvaluatorAbstractBase.this); + + return null; + } + }; + + retryingTransactionHelper.doInTransaction(callback); + return null; + } + }, AuthenticationUtil.getSystemUserName()); + + } + + @Override + public void setPublicCondition(boolean publicCondition) + { + this.publicCondition = publicCondition; + } + + /** + * @see org.alfresco.repo.action.CommonResourceAbstractBase#setBeanName(java.lang.String) + */ + @Override + public void setBeanName(String name) + { + this.name = name; + super.setBeanName(name); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getName() + */ + public String getName() + { + return this.name; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getLabel() + */ + public String getLabel() + { + return getActionConditionDefintion().getTitle(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction#getDescription() + */ + public String getDescription() + { + return getActionConditionDefintion().getDescription(); + } + + /** + * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#getActionConditionDefintion() + * + * TODO base class should provide "createActionDefinition" method that can be over-ridden like the ActionExecuter + * base class to prevent duplication of code and a cleaner extension. + */ + @Override + public ActionConditionDefinition getActionConditionDefintion() + { + if (this.actionConditionDefinition == null) + { + this.actionConditionDefinition = new RecordsManagementActionConditionDefinitionImpl(name); + ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setTitleKey(getTitleKey()); + ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setDescriptionKey(getDescriptionKey()); + ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setAdhocPropertiesAllowed(getAdhocPropertiesAllowed()); + ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setConditionEvaluator(name); + ((RecordsManagementActionConditionDefinitionImpl)actionConditionDefinition).setLocalizedParameterDefinitions(getLocalizedParameterDefinitions()); + } + return this.actionConditionDefinition; + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List arg0) + { + // No param implementation by default + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#isPublicCondition() + */ + @Override + public boolean isPublicCondition() + { + return publicCondition; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition#getRecordsManagementActionConditionDefinition() + */ + @Override + public RecordsManagementActionConditionDefinition getRecordsManagementActionConditionDefinition() + { + return (RecordsManagementActionConditionDefinition)getActionConditionDefintion(); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java index 8764b99b21..cb4aed5f60 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.service.cmr.action.ActionDefinition; - -/** - * Extended action definition interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordsManagementActionDefinition extends ActionDefinition -{ - /** - * @return list of applicable file plan component kinds - */ - Set getApplicableKinds(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.service.cmr.action.ActionDefinition; + +/** + * Extended action definition interface. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface RecordsManagementActionDefinition extends ActionDefinition +{ + /** + * @return list of applicable file plan component kinds + */ + Set getApplicableKinds(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java index 6faab0f9df..df99acbcaf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java @@ -1,75 +1,75 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.repo.action.ActionDefinitionImpl; - -/** - * Extended action definition implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordsManagementActionDefinitionImpl extends ActionDefinitionImpl implements RecordsManagementActionDefinition -{ - /** generated serial version id */ - private static final long serialVersionUID = -5226538434707253206L; - - /** Applicable kinds */ - private Set applicableKinds; - - /** - * Default constructor. - * - * @param name action definition name - */ - public RecordsManagementActionDefinitionImpl(String name) - { - super(name); - } - - /** - * @param applicableKinds applicable kinds - */ - public void setApplicableKinds(Set applicableKinds) - { - this.applicableKinds = applicableKinds; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition#getApplicableKinds() - */ - @Override - public Set getApplicableKinds() - { - return applicableKinds; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.repo.action.ActionDefinitionImpl; + +/** + * Extended action definition implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RecordsManagementActionDefinitionImpl extends ActionDefinitionImpl implements RecordsManagementActionDefinition +{ + /** generated serial version id */ + private static final long serialVersionUID = -5226538434707253206L; + + /** Applicable kinds */ + private Set applicableKinds; + + /** + * Default constructor. + * + * @param name action definition name + */ + public RecordsManagementActionDefinitionImpl(String name) + { + super(name); + } + + /** + * @param applicableKinds applicable kinds + */ + public void setApplicableKinds(Set applicableKinds) + { + this.applicableKinds = applicableKinds; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition#getApplicableKinds() + */ + @Override + public Set getApplicableKinds() + { + return applicableKinds; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionResult.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionResult.java index a6780abe4a..ce13d47cd7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionResult.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionResult.java @@ -1,60 +1,60 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Records management action result. - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public class RecordsManagementActionResult -{ - /** Result value */ - private Object value; - - /** - * Constructor. - * - * @param value result value - */ - public RecordsManagementActionResult(Object value) - { - this.value = value; - } - - /** - * @return result value - */ - public Object getValue() - { - return this.value; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Records management action result. + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public class RecordsManagementActionResult +{ + /** Result value */ + private Object value; + + /** + * Constructor. + * + * @param value result value + */ + public RecordsManagementActionResult(Object value) + { + this.value = value; + } + + /** + * @return result value + */ + public Object getValue() + { + return this.value; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionService.java index eaaa887c86..0762ed47b0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionService.java @@ -1,147 +1,147 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - - -/** - * Records management action service interface - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementActionService -{ - /** - * Get a list of the available records management actions - * - * @return List of records management actions - */ - List getRecordsManagementActions(); - - /** - * Get a list of the available records management action conditions - * - * @return List of records management action conditions - * @since 2.1 - */ - List getRecordsManagementActionConditions(); - - /** - * Get a list of the available disposition actions. A disposition action is a records - * management action that can be used when defining disposition instructions. - * - * @return List of disposition actions - */ - List getDispositionActions(); - - /** - * Gets the named records management action - * - * @param name The name of the RM action to retrieve - * @return The RecordsManagementAction or null if it doesn't exist - */ - RecordsManagementAction getRecordsManagementAction(String name); - - /** - * Gets the named disposition action - * - * @param name The name of the disposition action to retrieve - * @return The RecordsManagementAction or null if it doesn't exist - */ - RecordsManagementAction getDispositionAction(String name); - - /** - * Execute a records management action - * - * @param nodeRef node reference to a rm container, rm folder or record - * @param name action name - * @return The result of executed records management action - */ - RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name); - - /** - * Execute a records management action against several nodes - * - * @param nodeRefs node references to rm containers, rm folders or records - * @param name action name - * @return The result of executed records management action against several nodes - */ - Map executeRecordsManagementAction(List nodeRefs, String name); - - /** - * Execute a records management action - * - * @param nodeRef node reference to a rm container, rm folder or record - * @param name action name - * @param parameters action parameters - * @return The result of executed records management action - */ - RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name, Map parameters); - - /** - * Execute a records management action against several nodes - * - * @param nodeRefs node references to rm containers, rm folders or records - * @param name action name - * @param parameters action parameters - * @return The result of executed records management action against several nodes - */ - Map executeRecordsManagementAction(List nodeRefs, String name, Map parameters); - - /** - * Execute a records management action. The nodeRef against which the action is to be - * executed must be provided by the RecordsManagementAction implementation. - * - * @param name action name - * @param parameters action parameters - * @return The result of executed records management action - */ - RecordsManagementActionResult executeRecordsManagementAction(String name, Map parameters); - - /** - * Register records management action - * - * @param rmAction records management action - */ - void register(RecordsManagementAction rmAction); - - /** - * Register records management condition - * - * @param rmCondition records management condition - * @since 2.1 - */ - void register(RecordsManagementActionCondition rmCondition); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + + +/** + * Records management action service interface + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface RecordsManagementActionService +{ + /** + * Get a list of the available records management actions + * + * @return List of records management actions + */ + List getRecordsManagementActions(); + + /** + * Get a list of the available records management action conditions + * + * @return List of records management action conditions + * @since 2.1 + */ + List getRecordsManagementActionConditions(); + + /** + * Get a list of the available disposition actions. A disposition action is a records + * management action that can be used when defining disposition instructions. + * + * @return List of disposition actions + */ + List getDispositionActions(); + + /** + * Gets the named records management action + * + * @param name The name of the RM action to retrieve + * @return The RecordsManagementAction or null if it doesn't exist + */ + RecordsManagementAction getRecordsManagementAction(String name); + + /** + * Gets the named disposition action + * + * @param name The name of the disposition action to retrieve + * @return The RecordsManagementAction or null if it doesn't exist + */ + RecordsManagementAction getDispositionAction(String name); + + /** + * Execute a records management action + * + * @param nodeRef node reference to a rm container, rm folder or record + * @param name action name + * @return The result of executed records management action + */ + RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name); + + /** + * Execute a records management action against several nodes + * + * @param nodeRefs node references to rm containers, rm folders or records + * @param name action name + * @return The result of executed records management action against several nodes + */ + Map executeRecordsManagementAction(List nodeRefs, String name); + + /** + * Execute a records management action + * + * @param nodeRef node reference to a rm container, rm folder or record + * @param name action name + * @param parameters action parameters + * @return The result of executed records management action + */ + RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name, Map parameters); + + /** + * Execute a records management action against several nodes + * + * @param nodeRefs node references to rm containers, rm folders or records + * @param name action name + * @param parameters action parameters + * @return The result of executed records management action against several nodes + */ + Map executeRecordsManagementAction(List nodeRefs, String name, Map parameters); + + /** + * Execute a records management action. The nodeRef against which the action is to be + * executed must be provided by the RecordsManagementAction implementation. + * + * @param name action name + * @param parameters action parameters + * @return The result of executed records management action + */ + RecordsManagementActionResult executeRecordsManagementAction(String name, Map parameters); + + /** + * Register records management action + * + * @param rmAction records management action + */ + void register(RecordsManagementAction rmAction); + + /** + * Register records management condition + * + * @param rmCondition records management condition + * @since 2.1 + */ + void register(RecordsManagementActionCondition rmCondition); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java index 2ac5d6c15a..4134cdafcc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java @@ -1,337 +1,337 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil; -import org.alfresco.repo.policy.ClassPolicyDelegate; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Records Management Action Service Implementation - * - * @author Roy Wetherall - */ -public class RecordsManagementActionServiceImpl implements RecordsManagementActionService -{ - /** I18N */ - private static final String MSG_NOT_DEFINED = "rm.action.not-defined"; - private static final String MSG_NO_IMPLICIT_NODEREF = "rm.action.no-implicit-noderef"; - - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementActionServiceImpl.class); - - /** Registered records management actions */ - private Map rmActions = new HashMap(13); - private Map rmConditions = new HashMap(13); - - private Map dispositionActions = new HashMap(5); - - /** Policy component */ - private PolicyComponent policyComponent; - - /** Node service */ - private NodeService nodeService; - - /** Policy delegates */ - private ClassPolicyDelegate beforeRMActionExecutionDelegate; - private ClassPolicyDelegate onRMActionExecutionDelegate; - - /** - * @return Policy component - */ - protected PolicyComponent getPolicyComponent() - { - return this.policyComponent; - } - - /** - * @return Node Service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Set the policy component - * - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Set the node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Initialise RM action service - */ - public void init() - { - // Register the various policies - beforeRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(BeforeRMActionExecution.class); - onRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(OnRMActionExecution.class); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#register(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction) - */ - public void register(RecordsManagementAction rmAction) - { - if (!rmActions.containsKey(rmAction.getName())) - { - rmActions.put(rmAction.getName(), rmAction); - - if (rmAction.isDispositionAction()) - { - dispositionActions.put(rmAction.getName(), rmAction); - } - } - } - - public void register(RecordsManagementActionCondition rmCondition) - { - if (!rmConditions.containsKey(rmCondition.getName())) - { - rmConditions.put(rmCondition.getName(), rmCondition); - } - } - - /** - * Invoke beforeRMActionExecution policy - * - * @param nodeRef node reference - * @param name action name - * @param parameters action parameters - */ - protected void invokeBeforeRMActionExecution(NodeRef nodeRef, String name, Map parameters) - { - // get qnames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef); - // execute policy for node type and aspects - BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames); - policy.beforeRMActionExecution(nodeRef, name, parameters); - } - - /** - * Invoke onRMActionExecution policy - * - * @param nodeRef node reference - * @param name action name - * @param parameters action parameters - */ - protected void invokeOnRMActionExecution(NodeRef nodeRef, String name, Map parameters) - { - // get qnames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef); - // execute policy for node type and aspects - OnRMActionExecution policy = onRMActionExecutionDelegate.get(qnames); - policy.onRMActionExecution(nodeRef, name, parameters); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActions() - */ - public List getRecordsManagementActions() - { - List result = new ArrayList(this.rmActions.size()); - result.addAll(this.rmActions.values()); - return Collections.unmodifiableList(result); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActionConditions() - */ - @Override - public List getRecordsManagementActionConditions() - { - List result = new ArrayList(rmConditions.size()); - result.addAll(rmConditions.values()); - return Collections.unmodifiableList(result); - } - - /** - * Gets the disposition actions for the given node - * - * @param nodeRef The node reference - * @return List of records management action - */ - @SuppressWarnings("unused") - public List getDispositionActions(NodeRef nodeRef) - { - List result = new ArrayList(this.rmActions.size()); - - for (RecordsManagementAction action : this.rmActions.values()) - { - // TODO check the permissions on the action ... - } - - return Collections.unmodifiableList(result); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionActions() - */ - public List getDispositionActions() - { - List result = new ArrayList(dispositionActions.size()); - result.addAll(dispositionActions.values()); - return Collections.unmodifiableList(result); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionAction(java.lang.String) - */ - public RecordsManagementAction getDispositionAction(String name) - { - return dispositionActions.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementAction(java.lang.String) - */ - public RecordsManagementAction getRecordsManagementAction(String name) - { - return this.rmActions.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name) - { - return executeRecordsManagementAction(nodeRef, name, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String) - */ - public Map executeRecordsManagementAction(List nodeRefs, String name) - { - return executeRecordsManagementAction(nodeRefs, name, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) - */ - public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name, Map parameters) - { - if (logger.isDebugEnabled()) - { - logger.debug("Executing record management action on " + nodeRef); - logger.debug(" actionName = " + name); - logger.debug(" parameters = " + parameters); - } - - RecordsManagementAction rmAction = this.rmActions.get(name); - if (rmAction == null) - { - String msg = I18NUtil.getMessage(MSG_NOT_DEFINED, name); - if (logger.isWarnEnabled()) - { - logger.warn(msg); - } - throw new AlfrescoRuntimeException(msg); - } - - // Execute action - invokeBeforeRMActionExecution(nodeRef, name, parameters); - RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters); - if (getNodeService().exists(nodeRef)) - { - invokeOnRMActionExecution(nodeRef, name, parameters); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.lang.String, java.util.Map) - */ - public RecordsManagementActionResult executeRecordsManagementAction(String name, Map parameters) - { - RecordsManagementAction rmAction = rmActions.get(name); - - NodeRef implicitTargetNode = rmAction.getImplicitTargetNodeRef(); - if (implicitTargetNode == null) - { - String msg = I18NUtil.getMessage(MSG_NO_IMPLICIT_NODEREF, name); - if (logger.isWarnEnabled()) - { - logger.warn(msg); - } - throw new AlfrescoRuntimeException(msg); - } - else - { - return this.executeRecordsManagementAction(implicitTargetNode, name, parameters); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String, java.util.Map) - */ - public Map executeRecordsManagementAction(List nodeRefs, String name, Map parameters) - { - // Execute the action on each node in the list - Map results = new HashMap(nodeRefs.size()); - for (NodeRef nodeRef : nodeRefs) - { - RecordsManagementActionResult result = executeRecordsManagementAction(nodeRef, name, parameters); - results.put(nodeRef, result); - } - - return results; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution; +import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil; +import org.alfresco.repo.policy.ClassPolicyDelegate; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Records Management Action Service Implementation + * + * @author Roy Wetherall + */ +public class RecordsManagementActionServiceImpl implements RecordsManagementActionService +{ + /** I18N */ + private static final String MSG_NOT_DEFINED = "rm.action.not-defined"; + private static final String MSG_NO_IMPLICIT_NODEREF = "rm.action.no-implicit-noderef"; + + /** Logger */ + private static Log logger = LogFactory.getLog(RecordsManagementActionServiceImpl.class); + + /** Registered records management actions */ + private Map rmActions = new HashMap(13); + private Map rmConditions = new HashMap(13); + + private Map dispositionActions = new HashMap(5); + + /** Policy component */ + private PolicyComponent policyComponent; + + /** Node service */ + private NodeService nodeService; + + /** Policy delegates */ + private ClassPolicyDelegate beforeRMActionExecutionDelegate; + private ClassPolicyDelegate onRMActionExecutionDelegate; + + /** + * @return Policy component + */ + protected PolicyComponent getPolicyComponent() + { + return this.policyComponent; + } + + /** + * @return Node Service + */ + protected NodeService getNodeService() + { + return this.nodeService; + } + + /** + * Set the policy component + * + * @param policyComponent policy component + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + /** + * Set the node service + * + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Initialise RM action service + */ + public void init() + { + // Register the various policies + beforeRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(BeforeRMActionExecution.class); + onRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(OnRMActionExecution.class); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#register(org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction) + */ + public void register(RecordsManagementAction rmAction) + { + if (!rmActions.containsKey(rmAction.getName())) + { + rmActions.put(rmAction.getName(), rmAction); + + if (rmAction.isDispositionAction()) + { + dispositionActions.put(rmAction.getName(), rmAction); + } + } + } + + public void register(RecordsManagementActionCondition rmCondition) + { + if (!rmConditions.containsKey(rmCondition.getName())) + { + rmConditions.put(rmCondition.getName(), rmCondition); + } + } + + /** + * Invoke beforeRMActionExecution policy + * + * @param nodeRef node reference + * @param name action name + * @param parameters action parameters + */ + protected void invokeBeforeRMActionExecution(NodeRef nodeRef, String name, Map parameters) + { + // get qnames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef); + // execute policy for node type and aspects + BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames); + policy.beforeRMActionExecution(nodeRef, name, parameters); + } + + /** + * Invoke onRMActionExecution policy + * + * @param nodeRef node reference + * @param name action name + * @param parameters action parameters + */ + protected void invokeOnRMActionExecution(NodeRef nodeRef, String name, Map parameters) + { + // get qnames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef); + // execute policy for node type and aspects + OnRMActionExecution policy = onRMActionExecutionDelegate.get(qnames); + policy.onRMActionExecution(nodeRef, name, parameters); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActions() + */ + public List getRecordsManagementActions() + { + List result = new ArrayList(this.rmActions.size()); + result.addAll(this.rmActions.values()); + return Collections.unmodifiableList(result); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementActionConditions() + */ + @Override + public List getRecordsManagementActionConditions() + { + List result = new ArrayList(rmConditions.size()); + result.addAll(rmConditions.values()); + return Collections.unmodifiableList(result); + } + + /** + * Gets the disposition actions for the given node + * + * @param nodeRef The node reference + * @return List of records management action + */ + @SuppressWarnings("unused") + public List getDispositionActions(NodeRef nodeRef) + { + List result = new ArrayList(this.rmActions.size()); + + for (RecordsManagementAction action : this.rmActions.values()) + { + // TODO check the permissions on the action ... + } + + return Collections.unmodifiableList(result); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionActions() + */ + public List getDispositionActions() + { + List result = new ArrayList(dispositionActions.size()); + result.addAll(dispositionActions.values()); + return Collections.unmodifiableList(result); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getDispositionAction(java.lang.String) + */ + public RecordsManagementAction getDispositionAction(String name) + { + return dispositionActions.get(name); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#getRecordsManagementAction(java.lang.String) + */ + public RecordsManagementAction getRecordsManagementAction(String name) + { + return this.rmActions.get(name); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name) + { + return executeRecordsManagementAction(nodeRef, name, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String) + */ + public Map executeRecordsManagementAction(List nodeRefs, String name) + { + return executeRecordsManagementAction(nodeRefs, name, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) + */ + public RecordsManagementActionResult executeRecordsManagementAction(NodeRef nodeRef, String name, Map parameters) + { + if (logger.isDebugEnabled()) + { + logger.debug("Executing record management action on " + nodeRef); + logger.debug(" actionName = " + name); + logger.debug(" parameters = " + parameters); + } + + RecordsManagementAction rmAction = this.rmActions.get(name); + if (rmAction == null) + { + String msg = I18NUtil.getMessage(MSG_NOT_DEFINED, name); + if (logger.isWarnEnabled()) + { + logger.warn(msg); + } + throw new AlfrescoRuntimeException(msg); + } + + // Execute action + invokeBeforeRMActionExecution(nodeRef, name, parameters); + RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters); + if (getNodeService().exists(nodeRef)) + { + invokeOnRMActionExecution(nodeRef, name, parameters); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.lang.String, java.util.Map) + */ + public RecordsManagementActionResult executeRecordsManagementAction(String name, Map parameters) + { + RecordsManagementAction rmAction = rmActions.get(name); + + NodeRef implicitTargetNode = rmAction.getImplicitTargetNodeRef(); + if (implicitTargetNode == null) + { + String msg = I18NUtil.getMessage(MSG_NO_IMPLICIT_NODEREF, name); + if (logger.isWarnEnabled()) + { + logger.warn(msg); + } + throw new AlfrescoRuntimeException(msg); + } + else + { + return this.executeRecordsManagementAction(implicitTargetNode, name, parameters); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService#executeRecordsManagementAction(java.util.List, java.lang.String, java.util.Map) + */ + public Map executeRecordsManagementAction(List nodeRefs, String name, Map parameters) + { + // Execute the action on each node in the list + Map results = new HashMap(nodeRefs.size()); + for (NodeRef nodeRef : nodeRefs) + { + RecordsManagementActionResult result = executeRecordsManagementAction(nodeRef, name, parameters); + results.put(nodeRef, result); + } + + return results; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java index e1a52fddd5..d9bcc00f7b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java @@ -1,138 +1,138 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import java.util.Calendar; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -/** - * Scheduled disposition job. - * - * Automatically cuts off eligible nodes. - * - * @author Roy Wetherall - */ -public class ScheduledDispositionJob implements Job -{ - /** Logger */ - private static Log logger = LogFactory.getLog(ScheduledDispositionJob.class); - - /** - * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) - */ - public void execute(JobExecutionContext context) throws JobExecutionException - { - RecordsManagementActionService rmActionService - = (RecordsManagementActionService)context.getJobDetail().getJobDataMap().get("recordsManagementActionService"); - NodeService nodeService = (NodeService)context.getJobDetail().getJobDataMap().get("nodeService"); - - - // Calculate the date range used in the query - Calendar cal = Calendar.getInstance(); - String year = String.valueOf(cal.get(Calendar.YEAR)); - String month = String.valueOf(cal.get(Calendar.MONTH) + 1); - String dayOfMonth = String.valueOf(cal.get(Calendar.DAY_OF_MONTH)); - - //TODO These pad() calls are in RMActionExecuterAbstractBase. I've copied them - // here as I have no access to that class. - - final String currentDate = padString(year, 2) + "-" + padString(month, 2) + - "-" + padString(dayOfMonth, 2) + "T00:00:00.00Z"; - - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Executing ") - .append(this.getClass().getSimpleName()) - .append(" with currentDate ") - .append(currentDate); - logger.debug(msg.toString()); - } - - //TODO Copied the 1970 start date from the old RM JavaScript impl. - String dateRange = "[\"1970-01-01T00:00:00.00Z\" TO \"" + currentDate + "\"]"; - - // Execute the query and process the results - String query = "+ASPECT:\"rma:record\" +ASPECT:\"rma:dispositionSchedule\" +@rma\\:dispositionAsOf:" + dateRange; - - SearchService search = (SearchService)context.getJobDetail().getJobDataMap().get("searchService"); - ResultSet results = search.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query); - - List resultNodes = results.getNodeRefs(); - results.close(); - - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Found ") - .append(resultNodes.size()) - .append(" records eligible for disposition."); - logger.debug(msg.toString()); - } - - for (NodeRef node : resultNodes ) - { - String dispActionName = (String)nodeService.getProperty(node, RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME); - - // Only automatically execute "cutoff" actions. - // destroy and transfer and anything else should be manual for now - if (dispActionName != null && dispActionName.equalsIgnoreCase("cutoff")) - { - rmActionService.executeRecordsManagementAction(node, dispActionName); - - if (logger.isDebugEnabled()) - { - logger.debug("Performing " + dispActionName + " dispoition action on disposable item " + node.toString()); - } - } - } - } - - //TODO This has been pasted out of RMActionExecuterAbstractBase. To be relocated. - private String padString(String s, int len) - { - String result = s; - for (int i=0; i<(len - s.length()); i++) - { - result = "0" + result; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import java.util.Calendar; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +/** + * Scheduled disposition job. + * + * Automatically cuts off eligible nodes. + * + * @author Roy Wetherall + */ +public class ScheduledDispositionJob implements Job +{ + /** Logger */ + private static Log logger = LogFactory.getLog(ScheduledDispositionJob.class); + + /** + * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) + */ + public void execute(JobExecutionContext context) throws JobExecutionException + { + RecordsManagementActionService rmActionService + = (RecordsManagementActionService)context.getJobDetail().getJobDataMap().get("recordsManagementActionService"); + NodeService nodeService = (NodeService)context.getJobDetail().getJobDataMap().get("nodeService"); + + + // Calculate the date range used in the query + Calendar cal = Calendar.getInstance(); + String year = String.valueOf(cal.get(Calendar.YEAR)); + String month = String.valueOf(cal.get(Calendar.MONTH) + 1); + String dayOfMonth = String.valueOf(cal.get(Calendar.DAY_OF_MONTH)); + + //TODO These pad() calls are in RMActionExecuterAbstractBase. I've copied them + // here as I have no access to that class. + + final String currentDate = padString(year, 2) + "-" + padString(month, 2) + + "-" + padString(dayOfMonth, 2) + "T00:00:00.00Z"; + + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Executing ") + .append(this.getClass().getSimpleName()) + .append(" with currentDate ") + .append(currentDate); + logger.debug(msg.toString()); + } + + //TODO Copied the 1970 start date from the old RM JavaScript impl. + String dateRange = "[\"1970-01-01T00:00:00.00Z\" TO \"" + currentDate + "\"]"; + + // Execute the query and process the results + String query = "+ASPECT:\"rma:record\" +ASPECT:\"rma:dispositionSchedule\" +@rma\\:dispositionAsOf:" + dateRange; + + SearchService search = (SearchService)context.getJobDetail().getJobDataMap().get("searchService"); + ResultSet results = search.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query); + + List resultNodes = results.getNodeRefs(); + results.close(); + + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Found ") + .append(resultNodes.size()) + .append(" records eligible for disposition."); + logger.debug(msg.toString()); + } + + for (NodeRef node : resultNodes ) + { + String dispActionName = (String)nodeService.getProperty(node, RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME); + + // Only automatically execute "cutoff" actions. + // destroy and transfer and anything else should be manual for now + if (dispActionName != null && dispActionName.equalsIgnoreCase("cutoff")) + { + rmActionService.executeRecordsManagementAction(node, dispActionName); + + if (logger.isDebugEnabled()) + { + logger.debug("Performing " + dispActionName + " dispoition action on disposable item " + node.toString()); + } + } + } + } + + //TODO This has been pasted out of RMActionExecuterAbstractBase. To be relocated. + private String padString(String s, int len) + { + String result = s; + for (int i=0; i<(len - s.length()); i++) + { + result = "0" + result; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java index d261f6d636..21d9cc9091 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/CustomParameterConstraint.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.constraint; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.repo.action.constraint.BaseParameterConstraint; - -/** - * A parameter constraint that reads in a list of allowable values from Spring configuration - * - * @author Craig Tan - * @since 2.1 - */ -public class CustomParameterConstraint extends BaseParameterConstraint -{ - private List parameterValues; - - /** - * Sets the parameter values - * - * @param parameterValues The parameter values - */ - public void setParameterValues(List parameterValues) - { - this.parameterValues = parameterValues; - } - - /** - * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() - */ - protected Map getAllowableValuesImpl() - { - Map allowableValues = new HashMap(parameterValues.size()); - - for (Object parameterValue : parameterValues) - { - // Look up the I18N value - String displayLabel = getI18NLabel(parameterValue.toString()); - - // Add to the map of allowed values - allowableValues.put(parameterValue.toString(), displayLabel); - } - - return allowableValues; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.constraint; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.repo.action.constraint.BaseParameterConstraint; + +/** + * A parameter constraint that reads in a list of allowable values from Spring configuration + * + * @author Craig Tan + * @since 2.1 + */ +public class CustomParameterConstraint extends BaseParameterConstraint +{ + private List parameterValues; + + /** + * Sets the parameter values + * + * @param parameterValues The parameter values + */ + public void setParameterValues(List parameterValues) + { + this.parameterValues = parameterValues; + } + + /** + * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() + */ + protected Map getAllowableValuesImpl() + { + Map allowableValues = new HashMap(parameterValues.size()); + + for (Object parameterValue : parameterValues) + { + // Look up the I18N value + String displayLabel = getI18NLabel(parameterValue.toString()); + + // Add to the map of allowed values + allowableValues.put(parameterValue.toString(), displayLabel); + } + + return allowableValues; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java index e5f0425ad1..9a02797822 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/DispositionActionParameterConstraint.java @@ -1,72 +1,72 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.constraint; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.repo.action.constraint.BaseParameterConstraint; - -/** - * Record type parameter constraint - * - * @author Craig Tan - * @since 2.1 - */ -public class DispositionActionParameterConstraint extends BaseParameterConstraint -{ - /** Name constant */ - public static final String NAME = "rm-ac-record-types"; - - private RecordsManagementActionService rmActionService; - - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() - */ - protected Map getAllowableValuesImpl() - { - List rmActions = rmActionService.getDispositionActions(); - - Map result = new HashMap(rmActions.size()); - for (RecordsManagementAction rmAction : rmActions) - { - result.put(rmAction.getName(), rmAction.getLabel()); - } - return result; - } - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.constraint; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.repo.action.constraint.BaseParameterConstraint; + +/** + * Record type parameter constraint + * + * @author Craig Tan + * @since 2.1 + */ +public class DispositionActionParameterConstraint extends BaseParameterConstraint +{ + /** Name constant */ + public static final String NAME = "rm-ac-record-types"; + + private RecordsManagementActionService rmActionService; + + public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) + { + this.rmActionService = rmActionService; + } + + /** + * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() + */ + protected Map getAllowableValuesImpl() + { + List rmActions = rmActionService.getDispositionActions(); + + Map result = new HashMap(rmActions.size()); + for (RecordsManagementAction rmAction : rmActions) + { + result.put(rmAction.getName(), rmAction.getLabel()); + } + return result; + } + + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/ManualEventParameterConstraint.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/ManualEventParameterConstraint.java index 6932d69225..96f40a88de 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/ManualEventParameterConstraint.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/ManualEventParameterConstraint.java @@ -1,75 +1,75 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.constraint; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; -import org.alfresco.repo.action.constraint.BaseParameterConstraint; - -/** - * Manual event parameter constraint - * - * @author Craig Tan - */ -public class ManualEventParameterConstraint extends BaseParameterConstraint -{ - /** Name constant */ - public static final String NAME = "rm-ac-manual-events"; - - private RecordsManagementEventService recordsManagementEventService; - - public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) - { - this.recordsManagementEventService = recordsManagementEventService; - } - - /** - * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() - */ - protected Map getAllowableValuesImpl() - { - List events = recordsManagementEventService.getEvents(); - Map result = new HashMap(events.size()); - for (RecordsManagementEvent event : events) - { - RecordsManagementEventType eventType = recordsManagementEventService.getEventType(event.getType()); - if (eventType != null && !eventType.isAutomaticEvent()) - { - result.put(event.getName(), event.getDisplayLabel()); - } - } - return result; - } - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.constraint; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; +import org.alfresco.repo.action.constraint.BaseParameterConstraint; + +/** + * Manual event parameter constraint + * + * @author Craig Tan + */ +public class ManualEventParameterConstraint extends BaseParameterConstraint +{ + /** Name constant */ + public static final String NAME = "rm-ac-manual-events"; + + private RecordsManagementEventService recordsManagementEventService; + + public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) + { + this.recordsManagementEventService = recordsManagementEventService; + } + + /** + * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() + */ + protected Map getAllowableValuesImpl() + { + List events = recordsManagementEventService.getEvents(); + Map result = new HashMap(events.size()); + for (RecordsManagementEvent event : events) + { + RecordsManagementEventType eventType = recordsManagementEventService.getEventType(event.getType()); + if (eventType != null && !eventType.isAutomaticEvent()) + { + result.put(event.getName(), event.getDisplayLabel()); + } + } + return result; + } + + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java index 9cd19fa509..ac3b56eec5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java @@ -1,126 +1,126 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.constraint; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.action.constraint.BaseParameterConstraint; -import org.alfresco.repo.i18n.StaticMessageLookup; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Record type parameter constraint - * - * @author Craig Tan - * @since 2.1 - */ -public class RecordTypeParameterConstraint extends BaseParameterConstraint -{ - /** Name constant */ - public static final String NAME = "rm-ac-record-types"; - - /** record service */ - private RecordService recordService; - - /** dictionary service */ - private DictionaryService dictionaryService; - - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() - */ - protected Map getAllowableValuesImpl() - { - return AuthenticationUtil.runAsSystem(new RunAsWork>() - { - @SuppressWarnings("unchecked") - public Map doWork() - { - Map result = Collections.EMPTY_MAP; - - // get the file plan - // TODO we will likely have to re-implement as a custom control so that context of the file - // plan can be correctly determined when setting the rule up - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - if (filePlan != null) - { - Set recordTypes = recordService.getRecordMetadataAspects(filePlan); - - result = new HashMap(recordTypes.size()); - for (QName recordType : recordTypes) - { - AspectDefinition aspectDefinition = dictionaryService.getAspect(recordType); - if (aspectDefinition != null) - { - result.put(aspectDefinition.getName().getLocalName(), aspectDefinition.getTitle(new StaticMessageLookup())); - } - } - } - - return result; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.constraint; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.repo.action.constraint.BaseParameterConstraint; +import org.alfresco.repo.i18n.StaticMessageLookup; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Record type parameter constraint + * + * @author Craig Tan + * @since 2.1 + */ +public class RecordTypeParameterConstraint extends BaseParameterConstraint +{ + /** Name constant */ + public static final String NAME = "rm-ac-record-types"; + + /** record service */ + private RecordService recordService; + + /** dictionary service */ + private DictionaryService dictionaryService; + + /** file plan service */ + private FilePlanService filePlanService; + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues() + */ + protected Map getAllowableValuesImpl() + { + return AuthenticationUtil.runAsSystem(new RunAsWork>() + { + @SuppressWarnings("unchecked") + public Map doWork() + { + Map result = Collections.EMPTY_MAP; + + // get the file plan + // TODO we will likely have to re-implement as a custom control so that context of the file + // plan can be correctly determined when setting the rule up + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + + if (filePlan != null) + { + Set recordTypes = recordService.getRecordMetadataAspects(filePlan); + + result = new HashMap(recordTypes.size()); + for (QName recordType : recordTypes) + { + AspectDefinition aspectDefinition = dictionaryService.getAspect(recordType); + if (aspectDefinition != null) + { + result.put(aspectDefinition.getName().getLocalName(), aspectDefinition.getTitle(new StaticMessageLookup())); + } + } + } + + return result; + } + }); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java index 00d9ae336b..99f72e98c6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java @@ -1,59 +1,59 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.constraint; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.repo.action.constraint.BaseParameterConstraint; - -/** - * Recordable version config constraint - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class VersionParameterConstraint extends BaseParameterConstraint -{ - /** - * @see org.alfresco.repo.action.constraint.BaseParameterConstraint#getAllowableValuesImpl() - */ - @Override - protected Map getAllowableValuesImpl() - { - RecordableVersionPolicy[] recordableVersionPolicies = RecordableVersionPolicy.values(); - Map allowableValues = new HashMap(recordableVersionPolicies.length); - for (RecordableVersionPolicy recordableVersionPolicy : recordableVersionPolicies) - { - String policy = recordableVersionPolicy.toString(); - allowableValues.put(policy, getI18NLabel(policy)); - } - return allowableValues; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.constraint; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.alfresco.repo.action.constraint.BaseParameterConstraint; + +/** + * Recordable version config constraint + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class VersionParameterConstraint extends BaseParameterConstraint +{ + /** + * @see org.alfresco.repo.action.constraint.BaseParameterConstraint#getAllowableValuesImpl() + */ + @Override + protected Map getAllowableValuesImpl() + { + RecordableVersionPolicy[] recordableVersionPolicies = RecordableVersionPolicy.values(); + Map allowableValues = new HashMap(recordableVersionPolicies.length); + for (RecordableVersionPolicy recordableVersionPolicy : recordableVersionPolicies) + { + String policy = recordableVersionPolicy.toString(); + allowableValues.put(policy, getI18NLabel(policy)); + } + return allowableValues; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index 2c53e55992..ecb90daa7d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -1,242 +1,242 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.dm; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Creates a new record from an existing content object. - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Roy Wetherall - */ -public class CreateRecordAction extends AuditableActionExecuterAbstractBase - implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(CreateRecordAction.class); - - /** Action name */ - public static final String NAME = "create-record"; - - /** Parameter names */ - public static final String PARAM_FILE_PLAN = "file-plan"; - public static final String PARAM_HIDE_RECORD = "hide-record"; - - /** Sync Model URI */ - static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; - /** Synced aspect */ - static final QName ASPECT_SYNCED = QName.createQName(SYNC_MODEL_1_0_URI, "synced"); - - /** Record service */ - private RecordService recordService; - - /** Node service */ - private NodeService nodeService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) - { - - if (!nodeService.exists(actionedUponNodeRef)) - { - // do not create record if the actioned upon node does not exist! - if (logger.isDebugEnabled()) - { - logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " does not exist."); - } - } - else if (!dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT)) - { - // TODO eventually we should support other types .. either as record folders or as composite records - if (logger.isDebugEnabled()) - { - logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " is not a supported type."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD)) - { - // Do not create record if the actioned upon node is already a record! - if (logger.isDebugEnabled()) - { - logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " is already a record."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY)) - { - // We can not create records from working copies - if (logger.isDebugEnabled()) - { - logger.debug("Can node create record, because " + actionedUponNodeRef.toString() + " is a working copy."); - } - - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS)) - { - // can not create a record from a previously rejected one - if (logger.isDebugEnabled()) - { - logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " has previously been rejected."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_SYNCED)) - { - // can't declare the record if the node is sync'ed - if (logger.isDebugEnabled()) - { - logger.debug("Can't declare as record, because " + actionedUponNodeRef.toString() + " is synched content."); - } - } - else - { - NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); - if (filePlan == null) - { - // TODO .. eventually make the file plan parameter required - - filePlan = AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - }, AuthenticationUtil.getAdminUserName()); - - // if the file plan is still null, raise an exception - if (filePlan == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Can not create record, because the default file plan can not be determined. Make sure at least one file plan has been created."); - } - throw new AlfrescoRuntimeException("Can not create record, because the default file plan can not be determined."); - } - } - else - { - // verify that the provided file plan is actually a file plan - if (!filePlanService.isFilePlan(filePlan)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Can not create record, because the provided file plan node reference is not a file plan."); - } - throw new AlfrescoRuntimeException("Can not create record, because the provided file plan node reference is not a file plan."); - } - } - - // indicate whether the record should be hidden or not (default not) - boolean hideRecord = false; - Boolean hideRecordValue = ((Boolean)action.getParameterValue(PARAM_HIDE_RECORD)); - if (hideRecordValue != null) - { - hideRecord = hideRecordValue.booleanValue(); - } - - synchronized (this) - { - // create record from existing document - recordService.createRecord(filePlan, actionedUponNodeRef, !hideRecord); - } - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List params) - { - // NOTE: commented out for now so that it doesn't appear in the UI ... enable later when multi-file plan support is added - //params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN))); - params.add(new ParameterDefinitionImpl(PARAM_HIDE_RECORD, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_HIDE_RECORD))); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.dm; + +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Creates a new record from an existing content object. + * + * Note: This is a 'normal' dm action, rather than a records management action. + * + * @author Roy Wetherall + */ +public class CreateRecordAction extends AuditableActionExecuterAbstractBase + implements RecordsManagementModel +{ + /** Logger */ + private static Log logger = LogFactory.getLog(CreateRecordAction.class); + + /** Action name */ + public static final String NAME = "create-record"; + + /** Parameter names */ + public static final String PARAM_FILE_PLAN = "file-plan"; + public static final String PARAM_HIDE_RECORD = "hide-record"; + + /** Sync Model URI */ + static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; + /** Synced aspect */ + static final QName ASPECT_SYNCED = QName.createQName(SYNC_MODEL_1_0_URI, "synced"); + + /** Record service */ + private RecordService recordService; + + /** Node service */ + private NodeService nodeService; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) + { + + if (!nodeService.exists(actionedUponNodeRef)) + { + // do not create record if the actioned upon node does not exist! + if (logger.isDebugEnabled()) + { + logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " does not exist."); + } + } + else if (!dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT)) + { + // TODO eventually we should support other types .. either as record folders or as composite records + if (logger.isDebugEnabled()) + { + logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " is not a supported type."); + } + } + else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD)) + { + // Do not create record if the actioned upon node is already a record! + if (logger.isDebugEnabled()) + { + logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " is already a record."); + } + } + else if (nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY)) + { + // We can not create records from working copies + if (logger.isDebugEnabled()) + { + logger.debug("Can node create record, because " + actionedUponNodeRef.toString() + " is a working copy."); + } + + } + else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS)) + { + // can not create a record from a previously rejected one + if (logger.isDebugEnabled()) + { + logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " has previously been rejected."); + } + } + else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_SYNCED)) + { + // can't declare the record if the node is sync'ed + if (logger.isDebugEnabled()) + { + logger.debug("Can't declare as record, because " + actionedUponNodeRef.toString() + " is synched content."); + } + } + else + { + NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); + if (filePlan == null) + { + // TODO .. eventually make the file plan parameter required + + filePlan = AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public NodeRef doWork() + { + return filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + } + }, AuthenticationUtil.getAdminUserName()); + + // if the file plan is still null, raise an exception + if (filePlan == null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Can not create record, because the default file plan can not be determined. Make sure at least one file plan has been created."); + } + throw new AlfrescoRuntimeException("Can not create record, because the default file plan can not be determined."); + } + } + else + { + // verify that the provided file plan is actually a file plan + if (!filePlanService.isFilePlan(filePlan)) + { + if (logger.isDebugEnabled()) + { + logger.debug("Can not create record, because the provided file plan node reference is not a file plan."); + } + throw new AlfrescoRuntimeException("Can not create record, because the provided file plan node reference is not a file plan."); + } + } + + // indicate whether the record should be hidden or not (default not) + boolean hideRecord = false; + Boolean hideRecordValue = ((Boolean)action.getParameterValue(PARAM_HIDE_RECORD)); + if (hideRecordValue != null) + { + hideRecord = hideRecordValue.booleanValue(); + } + + synchronized (this) + { + // create record from existing document + recordService.createRecord(filePlan, actionedUponNodeRef, !hideRecord); + } + } + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List params) + { + // NOTE: commented out for now so that it doesn't appear in the UI ... enable later when multi-file plan support is added + //params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN))); + params.add(new ParameterDefinitionImpl(PARAM_HIDE_RECORD, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_HIDE_RECORD))); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java index c2f6a9a7bb..ed713691bf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java @@ -1,244 +1,244 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.dm; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Creates a new record from the 'current' document version. - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Roy Wetherall - */ -public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstractBase - implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(DeclareAsVersionRecordAction.class); - - /** Action name */ - public static final String NAME = "declare-version-record"; - - /** Parameter names */ - public static final String PARAM_FILE_PLAN = "file-plan"; - - /** Sync Model URI */ - private static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; - - /** Synced aspect */ - private static final QName ASPECT_SYNCED = QName.createQName(SYNC_MODEL_1_0_URI, "synced"); - - /** Node service */ - private NodeService nodeService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** recordable version service */ - private RecordableVersionService recordableVersionService; - - /** authentication util */ - private AuthenticationUtil authenticationUtil; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param recordableVersionService recordable version service - */ - public void setRecordableVersionService(RecordableVersionService recordableVersionService) - { - this.recordableVersionService = recordableVersionService; - } - - /** - * @param authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) - { - if (!nodeService.exists(actionedUponNodeRef)) - { - // do not create record if the actioned upon node does not exist! - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " does not exist."); - } - } - else if (!dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT)) - { - // TODO eventually we should support other types .. either as record folders or as composite records - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " is not a supported type."); - } - } - else if (!nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " does not have the versionable aspect applied."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD)) - { - // Do not declare version record if the actioned upon node is already a record! - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " is already a record."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY)) - { - // We can not create records from working copies - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " is a working copy."); - } - - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS)) - { - // can not create a record from a previously rejected one - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " has previously been rejected."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_SYNCED)) - { - // can't declare the record if the node is sync'ed - if (logger.isDebugEnabled()) - { - logger.debug("Can't declare version record, because " + actionedUponNodeRef.toString() + " is synched content."); - } - } - else - { - NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); - if (filePlan == null) - { - // TODO .. eventually make the file plan parameter required - - filePlan = authenticationUtil.runAs(new org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork() - { - @Override - public NodeRef doWork() - { - return filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - }, authenticationUtil.getAdminUserName()); - - // if the file plan is still null, raise an exception - if (filePlan == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because the default file plan can not be determined. Make sure at least one file plan has been created."); - } - throw new AlfrescoRuntimeException("Can not declare version record, because the default file plan can not be determined."); - } - } - else - { - // verify that the provided file plan is actually a file plan - if (!filePlanService.isFilePlan(filePlan)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because the provided file plan node reference is not a file plan."); - } - throw new AlfrescoRuntimeException("Can not declare version record, because the provided file plan node reference is not a file plan."); - } - } - - // create record from latest version - recordableVersionService.createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List params) - { - // NOTE: commented out for now so that it doesn't appear in the UI ... enable later when multi-file plan support is added - //params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN))); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.dm; + +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Creates a new record from the 'current' document version. + * + * Note: This is a 'normal' dm action, rather than a records management action. + * + * @author Roy Wetherall + */ +public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstractBase + implements RecordsManagementModel +{ + /** Logger */ + private static Log logger = LogFactory.getLog(DeclareAsVersionRecordAction.class); + + /** Action name */ + public static final String NAME = "declare-version-record"; + + /** Parameter names */ + public static final String PARAM_FILE_PLAN = "file-plan"; + + /** Sync Model URI */ + private static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; + + /** Synced aspect */ + private static final QName ASPECT_SYNCED = QName.createQName(SYNC_MODEL_1_0_URI, "synced"); + + /** Node service */ + private NodeService nodeService; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** recordable version service */ + private RecordableVersionService recordableVersionService; + + /** authentication util */ + private AuthenticationUtil authenticationUtil; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param recordableVersionService recordable version service + */ + public void setRecordableVersionService(RecordableVersionService recordableVersionService) + { + this.recordableVersionService = recordableVersionService; + } + + /** + * @param authenticationUtil authentication util + */ + public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) + { + this.authenticationUtil = authenticationUtil; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) + { + if (!nodeService.exists(actionedUponNodeRef)) + { + // do not create record if the actioned upon node does not exist! + if (logger.isDebugEnabled()) + { + logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " does not exist."); + } + } + else if (!dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT)) + { + // TODO eventually we should support other types .. either as record folders or as composite records + if (logger.isDebugEnabled()) + { + logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " is not a supported type."); + } + } + else if (!nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE)) + { + if (logger.isDebugEnabled()) + { + logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " does not have the versionable aspect applied."); + } + } + else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD)) + { + // Do not declare version record if the actioned upon node is already a record! + if (logger.isDebugEnabled()) + { + logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " is already a record."); + } + } + else if (nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY)) + { + // We can not create records from working copies + if (logger.isDebugEnabled()) + { + logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " is a working copy."); + } + + } + else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS)) + { + // can not create a record from a previously rejected one + if (logger.isDebugEnabled()) + { + logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " has previously been rejected."); + } + } + else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_SYNCED)) + { + // can't declare the record if the node is sync'ed + if (logger.isDebugEnabled()) + { + logger.debug("Can't declare version record, because " + actionedUponNodeRef.toString() + " is synched content."); + } + } + else + { + NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); + if (filePlan == null) + { + // TODO .. eventually make the file plan parameter required + + filePlan = authenticationUtil.runAs(new org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork() + { + @Override + public NodeRef doWork() + { + return filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + } + }, authenticationUtil.getAdminUserName()); + + // if the file plan is still null, raise an exception + if (filePlan == null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Can not declare version record, because the default file plan can not be determined. Make sure at least one file plan has been created."); + } + throw new AlfrescoRuntimeException("Can not declare version record, because the default file plan can not be determined."); + } + } + else + { + // verify that the provided file plan is actually a file plan + if (!filePlanService.isFilePlan(filePlan)) + { + if (logger.isDebugEnabled()) + { + logger.debug("Can not declare version record, because the provided file plan node reference is not a file plan."); + } + throw new AlfrescoRuntimeException("Can not declare version record, because the provided file plan node reference is not a file plan."); + } + } + + // create record from latest version + recordableVersionService.createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List params) + { + // NOTE: commented out for now so that it doesn't appear in the UI ... enable later when multi-file plan support is added + //params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN))); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/ExecuteScriptAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/ExecuteScriptAction.java index 6a93a3bdeb..26e7b4b480 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/ExecuteScriptAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/ExecuteScriptAction.java @@ -1,56 +1,56 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.dm; - -import java.util.List; - -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.action.executer.ScriptActionExecuter; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; - -/** - * Executes a JavaScript - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Craig Tan - */ -public class ExecuteScriptAction extends ScriptActionExecuter -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_SCRIPTREF, DataTypeDefinition.NODE_REF, true, - getParamDisplayLabel(PARAM_SCRIPTREF), false, "rm-ac-scripts")); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.dm; + +import java.util.List; + +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.action.executer.ScriptActionExecuter; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; + +/** + * Executes a JavaScript + * + * Note: This is a 'normal' dm action, rather than a records management action. + * + * @author Craig Tan + */ +public class ExecuteScriptAction extends ScriptActionExecuter +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_SCRIPTREF, DataTypeDefinition.NODE_REF, true, + getParamDisplayLabel(PARAM_SCRIPTREF), false, "rm-ac-scripts")); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java index 3d433c1acc..d588119f96 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java @@ -1,111 +1,111 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.dm; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Hides a record within a collaboration site. - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class HideRecordAction extends AuditableActionExecuterAbstractBase - implements RecordsManagementModel -{ - - /** Logger */ - private static Log logger = LogFactory.getLog(HideRecordAction.class); - - /** Action name */ - public static final String NAME = "hide-record"; - - /** Node service */ - private NodeService nodeService; - - /** Inplace record service */ - private InplaceRecordService inplaceRecordService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param inplaceRecordService inplace record service - */ - public void setInplaceRecordService(InplaceRecordService inplaceRecordService) - { - this.inplaceRecordService = inplaceRecordService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (!nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD)) - { - // we cannot hide a document which is not a record - if (logger.isDebugEnabled()) - { - logger.debug("Cannot hide the document, because '" + actionedUponNodeRef.toString() + "' is not a record."); - } - } - else - { - // hide the record from the collaboration site - inplaceRecordService.hideRecord(actionedUponNodeRef); - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // Intentionally empty - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.dm; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Hides a record within a collaboration site. + * + * Note: This is a 'normal' dm action, rather than a records management action. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class HideRecordAction extends AuditableActionExecuterAbstractBase + implements RecordsManagementModel +{ + + /** Logger */ + private static Log logger = LogFactory.getLog(HideRecordAction.class); + + /** Action name */ + public static final String NAME = "hide-record"; + + /** Node service */ + private NodeService nodeService; + + /** Inplace record service */ + private InplaceRecordService inplaceRecordService; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param inplaceRecordService inplace record service + */ + public void setInplaceRecordService(InplaceRecordService inplaceRecordService) + { + this.inplaceRecordService = inplaceRecordService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (!nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD)) + { + // we cannot hide a document which is not a record + if (logger.isDebugEnabled()) + { + logger.debug("Cannot hide the document, because '" + actionedUponNodeRef.toString() + "' is not a record."); + } + } + else + { + // hide the record from the collaboration site + inplaceRecordService.hideRecord(actionedUponNodeRef); + } + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + // Intentionally empty + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java index aac2702700..45413c4062 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java @@ -1,152 +1,152 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.dm; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Moves a record within a collaboration site. - * The record can be moved only within the collaboration site where it was declared. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class MoveDmRecordAction extends AuditableActionExecuterAbstractBase implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(MoveDmRecordAction.class); - - /** Action name */ - public static final String NAME = "move-dm-record"; - - /** Constant for target node reference parameter */ - public static final String PARAM_TARGET_NODE_REF = "targetNodeRef"; - - /** Node service */ - private NodeService nodeService; - - /** Inplace record service */ - private InplaceRecordService inplaceRecordService; - - /** - * Gets the node service - * - * @return Node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Sets the node service - * - * @param nodeService Node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Gets the inplace record service - * - * @return Inplace record service - */ - protected InplaceRecordService getInplaceRecordService() - { - return this.inplaceRecordService; - } - - /** - * Sets the inplace record service - * - * @param inplaceRecordService Inplace record service - */ - public void setInplaceRecordService(InplaceRecordService inplaceRecordService) - { - this.inplaceRecordService = inplaceRecordService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - // Cannot move a document which is not a record - if (!getNodeService().hasAspect(actionedUponNodeRef, ASPECT_RECORD) && logger.isDebugEnabled()) - { - logger.debug("Cannot move the document, because '" + actionedUponNodeRef.toString() + "' is not a record."); - } - else - { - // Move the record within the collaboration site - getInplaceRecordService().moveRecord(actionedUponNodeRef, getTargetNodeRef(action)); - } - } - - /** - * Helper method to get the target node reference from the action parameter - * - * @param action The action - * @return Node reference of the target - */ - private NodeRef getTargetNodeRef(Action action) - { - String targetNodeRef = (String) action.getParameterValue(PARAM_TARGET_NODE_REF); - - if (StringUtils.isBlank(targetNodeRef)) - { - throw new AlfrescoRuntimeException("Could not find target node reference."); - } - - return new NodeRef(targetNodeRef); - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // Intentionally empty - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.dm; + +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Moves a record within a collaboration site. + * The record can be moved only within the collaboration site where it was declared. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class MoveDmRecordAction extends AuditableActionExecuterAbstractBase implements RecordsManagementModel +{ + /** Logger */ + private static Log logger = LogFactory.getLog(MoveDmRecordAction.class); + + /** Action name */ + public static final String NAME = "move-dm-record"; + + /** Constant for target node reference parameter */ + public static final String PARAM_TARGET_NODE_REF = "targetNodeRef"; + + /** Node service */ + private NodeService nodeService; + + /** Inplace record service */ + private InplaceRecordService inplaceRecordService; + + /** + * Gets the node service + * + * @return Node service + */ + protected NodeService getNodeService() + { + return this.nodeService; + } + + /** + * Sets the node service + * + * @param nodeService Node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Gets the inplace record service + * + * @return Inplace record service + */ + protected InplaceRecordService getInplaceRecordService() + { + return this.inplaceRecordService; + } + + /** + * Sets the inplace record service + * + * @param inplaceRecordService Inplace record service + */ + public void setInplaceRecordService(InplaceRecordService inplaceRecordService) + { + this.inplaceRecordService = inplaceRecordService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + // Cannot move a document which is not a record + if (!getNodeService().hasAspect(actionedUponNodeRef, ASPECT_RECORD) && logger.isDebugEnabled()) + { + logger.debug("Cannot move the document, because '" + actionedUponNodeRef.toString() + "' is not a record."); + } + else + { + // Move the record within the collaboration site + getInplaceRecordService().moveRecord(actionedUponNodeRef, getTargetNodeRef(action)); + } + } + + /** + * Helper method to get the target node reference from the action parameter + * + * @param action The action + * @return Node reference of the target + */ + private NodeRef getTargetNodeRef(Action action) + { + String targetNodeRef = (String) action.getParameterValue(PARAM_TARGET_NODE_REF); + + if (StringUtils.isBlank(targetNodeRef)) + { + throw new AlfrescoRuntimeException("Could not find target node reference."); + } + + return new NodeRef(targetNodeRef); + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + // Intentionally empty + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java index 5c36bf4a27..239ec6f886 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java @@ -1,204 +1,204 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.dm; - -import static org.alfresco.model.ContentModel.ASPECT_VERSIONABLE; -import static org.alfresco.model.ContentModel.TYPE_CONTENT; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; -import static org.alfresco.service.cmr.dictionary.DataTypeDefinition.TEXT; -import static org.apache.commons.logging.LogFactory.getLog; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; - -/** - * Sets the recordable version config for a document within a collaboration site. - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordableVersionConfigAction extends ActionExecuterAbstractBase -{ - /** Logger */ - private static Log LOGGER = getLog(RecordableVersionConfigAction.class); - - /** Action name */ - public static final String NAME = "recordable-version-config"; - - /** Parameter names */ - public static final String PARAM_VERSION = "version"; - - /** Node service */ - private NodeService nodeService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** - * Gets the node service - * - * @return The node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Sets the node service - * - * @param nodeService The node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Gets the dictionary service - * - * @return The dictionary service - */ - protected DictionaryService getDictionaryService() - { - return this.dictionaryService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService) - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (passedChecks(actionedUponNodeRef)) - { - String version = (String) action.getParameterValue(PARAM_VERSION); - getNodeService().setProperty(actionedUponNodeRef, PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.valueOf(version)); - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_VERSION, TEXT, true, getParamDisplayLabel(PARAM_VERSION), false, "ac-versions")); - } - - /** - * Helper method to do checks on the actioned upon node reference - * - * @param actionedUponNodeRef The actioned upon node reference - * @return true if the actioned upon node reference passes the checks, false otherwise - */ - private boolean passedChecks(NodeRef actionedUponNodeRef) - { - boolean passedChecks = true; - - if (!getNodeService().exists(actionedUponNodeRef)) - { - passedChecks = false; - if (LOGGER.isDebugEnabled()) - { - String message = buildLogMessage(actionedUponNodeRef, "' because the node does not exist."); - LOGGER.debug(message); - } - } - - QName type = getNodeService().getType(actionedUponNodeRef); - if (!getDictionaryService().isSubClass(type, TYPE_CONTENT)) - { - passedChecks = false; - if (LOGGER.isDebugEnabled()) - { - String message = buildLogMessage(actionedUponNodeRef, "' because the type of the node '" + type.getLocalName() + "' is not supported."); - LOGGER.debug(message); - } - } - - if (getNodeService().hasAspect(actionedUponNodeRef, ASPECT_RECORD)) - { - passedChecks = false; - if (LOGGER.isDebugEnabled()) - { - String message = buildLogMessage(actionedUponNodeRef, "' because the rule cannot be applied to records."); - LOGGER.debug(message); - } - } - - if (!getNodeService().hasAspect(actionedUponNodeRef, ASPECT_VERSIONABLE)) - { - passedChecks = false; - if (LOGGER.isDebugEnabled()) - { - String buildLogMessage = buildLogMessage(actionedUponNodeRef, "' because the rule cannot be applied to records."); - LOGGER.debug(buildLogMessage); - } - } - - return passedChecks; - } - - /** - * Helper method to construct log message - * - * @param actionedUponNodeRef The actioned upon node reference - * @param messagePart The message which should be appended. - * @return The constructed log message - */ - private String buildLogMessage(NodeRef actionedUponNodeRef, String messagePart) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot set recordable version config for '"); - sb.append(actionedUponNodeRef.toString()); - sb.append(messagePart); - return sb.toString(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.dm; + +import static org.alfresco.model.ContentModel.ASPECT_VERSIONABLE; +import static org.alfresco.model.ContentModel.TYPE_CONTENT; +import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; +import static org.alfresco.service.cmr.dictionary.DataTypeDefinition.TEXT; +import static org.apache.commons.logging.LogFactory.getLog; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; + +/** + * Sets the recordable version config for a document within a collaboration site. + * + * Note: This is a 'normal' dm action, rather than a records management action. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RecordableVersionConfigAction extends ActionExecuterAbstractBase +{ + /** Logger */ + private static Log LOGGER = getLog(RecordableVersionConfigAction.class); + + /** Action name */ + public static final String NAME = "recordable-version-config"; + + /** Parameter names */ + public static final String PARAM_VERSION = "version"; + + /** Node service */ + private NodeService nodeService; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** + * Gets the node service + * + * @return The node service + */ + protected NodeService getNodeService() + { + return this.nodeService; + } + + /** + * Sets the node service + * + * @param nodeService The node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Gets the dictionary service + * + * @return The dictionary service + */ + protected DictionaryService getDictionaryService() + { + return this.dictionaryService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService) + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (passedChecks(actionedUponNodeRef)) + { + String version = (String) action.getParameterValue(PARAM_VERSION); + getNodeService().setProperty(actionedUponNodeRef, PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.valueOf(version)); + } + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_VERSION, TEXT, true, getParamDisplayLabel(PARAM_VERSION), false, "ac-versions")); + } + + /** + * Helper method to do checks on the actioned upon node reference + * + * @param actionedUponNodeRef The actioned upon node reference + * @return true if the actioned upon node reference passes the checks, false otherwise + */ + private boolean passedChecks(NodeRef actionedUponNodeRef) + { + boolean passedChecks = true; + + if (!getNodeService().exists(actionedUponNodeRef)) + { + passedChecks = false; + if (LOGGER.isDebugEnabled()) + { + String message = buildLogMessage(actionedUponNodeRef, "' because the node does not exist."); + LOGGER.debug(message); + } + } + + QName type = getNodeService().getType(actionedUponNodeRef); + if (!getDictionaryService().isSubClass(type, TYPE_CONTENT)) + { + passedChecks = false; + if (LOGGER.isDebugEnabled()) + { + String message = buildLogMessage(actionedUponNodeRef, "' because the type of the node '" + type.getLocalName() + "' is not supported."); + LOGGER.debug(message); + } + } + + if (getNodeService().hasAspect(actionedUponNodeRef, ASPECT_RECORD)) + { + passedChecks = false; + if (LOGGER.isDebugEnabled()) + { + String message = buildLogMessage(actionedUponNodeRef, "' because the rule cannot be applied to records."); + LOGGER.debug(message); + } + } + + if (!getNodeService().hasAspect(actionedUponNodeRef, ASPECT_VERSIONABLE)) + { + passedChecks = false; + if (LOGGER.isDebugEnabled()) + { + String buildLogMessage = buildLogMessage(actionedUponNodeRef, "' because the rule cannot be applied to records."); + LOGGER.debug(buildLogMessage); + } + } + + return passedChecks; + } + + /** + * Helper method to construct log message + * + * @param actionedUponNodeRef The actioned upon node reference + * @param messagePart The message which should be appended. + * @return The constructed log message + */ + private String buildLogMessage(NodeRef actionedUponNodeRef, String messagePart) + { + StringBuilder sb = new StringBuilder(); + sb.append("Cannot set recordable version config for '"); + sb.append(actionedUponNodeRef.toString()); + sb.append(messagePart); + return sb.toString(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/CapabilityConditionEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/CapabilityConditionEvaluator.java index 3966a581da..597ee8ff7e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/CapabilityConditionEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/CapabilityConditionEvaluator.java @@ -1,66 +1,66 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Records management evaluator base implementation that delegates to a configured capability condition - * implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class CapabilityConditionEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase -{ - /** Capability Condition */ - private CapabilityCondition capabilityCondition; - - /** - * @param capabilityCondition capability condition - */ - public void setCapabilityCondition(CapabilityCondition capabilityCondition) - { - this.capabilityCondition = capabilityCondition; - } - - /** - * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#evaluateImpl(org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - // check a capability condition has been set and delegate - ParameterCheck.mandatory("capabilityCondition", capabilityCondition); - return capabilityCondition.evaluate(actionedUponNodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.evaluator; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; +import org.alfresco.service.cmr.action.ActionCondition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.ParameterCheck; + +/** + * Records management evaluator base implementation that delegates to a configured capability condition + * implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class CapabilityConditionEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase +{ + /** Capability Condition */ + private CapabilityCondition capabilityCondition; + + /** + * @param capabilityCondition capability condition + */ + public void setCapabilityCondition(CapabilityCondition capabilityCondition) + { + this.capabilityCondition = capabilityCondition; + } + + /** + * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#evaluateImpl(org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) + { + // check a capability condition has been set and delegate + ParameterCheck.mandatory("capabilityCondition", capabilityCondition); + return capabilityCondition.evaluate(actionedUponNodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DelegateActionCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DelegateActionCondition.java index 3b15cc989a..49d117bbfa 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DelegateActionCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DelegateActionCondition.java @@ -1,80 +1,80 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.repo.action.evaluator.ActionConditionEvaluator; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Records management action condition who's implementation is delegated to an existing - * action condition. - *

- * Useful for creating a RM version of an existing action condition implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class DelegateActionCondition extends RecordsManagementActionConditionEvaluatorAbstractBase -{ - /** Delegate action evaluator */ - private ActionConditionEvaluator actionConditionEvaluator; - - /** - * Sets the action condition evaluator - * - * @param actionConditionEvaluator The action condition evaluator - */ - public void setActionConditionEvaluator(ActionConditionEvaluator actionConditionEvaluator) - { - this.actionConditionEvaluator = actionConditionEvaluator; - } - - /** - * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#evaluateImpl(org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - return actionConditionEvaluator.evaluate(actionCondition, actionedUponNodeRef); - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#getParameterDefintions() - */ - @Override - protected List getParameterDefintions() - { - return actionConditionEvaluator.getActionConditionDefintion().getParameterDefinitions(); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.evaluator; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; +import org.alfresco.repo.action.evaluator.ActionConditionEvaluator; +import org.alfresco.service.cmr.action.ActionCondition; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Records management action condition who's implementation is delegated to an existing + * action condition. + *

+ * Useful for creating a RM version of an existing action condition implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class DelegateActionCondition extends RecordsManagementActionConditionEvaluatorAbstractBase +{ + /** Delegate action evaluator */ + private ActionConditionEvaluator actionConditionEvaluator; + + /** + * Sets the action condition evaluator + * + * @param actionConditionEvaluator The action condition evaluator + */ + public void setActionConditionEvaluator(ActionConditionEvaluator actionConditionEvaluator) + { + this.actionConditionEvaluator = actionConditionEvaluator; + } + + /** + * @see org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase#evaluateImpl(org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) + { + return actionConditionEvaluator.evaluate(actionCondition, actionedUponNodeRef); + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#getParameterDefintions() + */ + @Override + protected List getParameterDefintions() + { + return actionConditionEvaluator.getActionConditionDefintion().getParameterDefinitions(); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java index 686327bedf..9dcedb938c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java @@ -1,39 +1,39 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.evaluator; - -/** - * Disposition action relative position enumeration class.
- * - * @author Craig Tan - * @since 2.1 - */ -public enum DispositionActionRelativePositions -{ - ANY, NEXT, PREVIOUS; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.evaluator; + +/** + * Disposition action relative position enumeration class.
+ * + * @author Craig Tan + * @since 2.1 + */ +public enum DispositionActionRelativePositions +{ + ANY, NEXT, PREVIOUS; +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java index 08b48afc5b..745ec892a0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java @@ -1,141 +1,141 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - - -/** - * Records management hasDispositionAction evaluator that evaluates whether the given node's disposition schedule has the specified disposition action. - * - * @author Craig Tan - * @since 2.1 - */ -public class HasDispositionActionEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase -{ - /** - * Evaluator constants - */ - public static final String NAME = "hasDispositionAction"; - - public static final String PARAM_DISPOSITION_ACTION_RELATIVE_POSITION = "position"; - - public static final String PARAM_DISPOSITION_ACTION = "action"; - - private DispositionService dispositionService; - - /** - * Sets the disposition service - * - * @param dispositionService The disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - boolean result = false; - String position = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION)).getLocalName(); - String action = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION)).getLocalName(); - - - if (dispositionService.isDisposableItem(actionedUponNodeRef)) - { - - if (position.equals(DispositionActionRelativePositions.ANY.toString())) - { - - DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(actionedUponNodeRef); - if (dispositionSchedule != null) - { - for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions()) - { - if (dispositionActionDefinition.getName().equals(action)) - { - result = true; - break; - } - } - } - } - else if (position.equals(DispositionActionRelativePositions.NEXT.toString())) - { - DispositionAction nextDispositionAction = dispositionService.getNextDispositionAction(actionedUponNodeRef); - if (nextDispositionAction != null) - { - // Get the disposition actions name - String actionName = nextDispositionAction.getName(); - if (actionName.equals(action)) - { - result = true; - } - } - } - else if (position.equals(DispositionActionRelativePositions.PREVIOUS.toString())) - { - DispositionAction lastCompletedDispositionAction = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef); - if (lastCompletedDispositionAction != null) - { - // Get the disposition actions name - String actionName = lastCompletedDispositionAction.getName(); - if (actionName.equals(action)) - { - result = true; - } - } - } - } - return result; - } - - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION, DataTypeDefinition.QNAME, true, - getParamDisplayLabel(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION), false, "rm-ac-disposition-action-relative-positions")); - paramList.add(new ParameterDefinitionImpl(PARAM_DISPOSITION_ACTION, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_DISPOSITION_ACTION), false, - "rm-ac-disposition-actions")); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.evaluator; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.ActionCondition; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + + + +/** + * Records management hasDispositionAction evaluator that evaluates whether the given node's disposition schedule has the specified disposition action. + * + * @author Craig Tan + * @since 2.1 + */ +public class HasDispositionActionEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase +{ + /** + * Evaluator constants + */ + public static final String NAME = "hasDispositionAction"; + + public static final String PARAM_DISPOSITION_ACTION_RELATIVE_POSITION = "position"; + + public static final String PARAM_DISPOSITION_ACTION = "action"; + + private DispositionService dispositionService; + + /** + * Sets the disposition service + * + * @param dispositionService The disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + @Override + protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) + { + boolean result = false; + String position = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION)).getLocalName(); + String action = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION)).getLocalName(); + + + if (dispositionService.isDisposableItem(actionedUponNodeRef)) + { + + if (position.equals(DispositionActionRelativePositions.ANY.toString())) + { + + DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(actionedUponNodeRef); + if (dispositionSchedule != null) + { + for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions()) + { + if (dispositionActionDefinition.getName().equals(action)) + { + result = true; + break; + } + } + } + } + else if (position.equals(DispositionActionRelativePositions.NEXT.toString())) + { + DispositionAction nextDispositionAction = dispositionService.getNextDispositionAction(actionedUponNodeRef); + if (nextDispositionAction != null) + { + // Get the disposition actions name + String actionName = nextDispositionAction.getName(); + if (actionName.equals(action)) + { + result = true; + } + } + } + else if (position.equals(DispositionActionRelativePositions.PREVIOUS.toString())) + { + DispositionAction lastCompletedDispositionAction = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef); + if (lastCompletedDispositionAction != null) + { + // Get the disposition actions name + String actionName = lastCompletedDispositionAction.getName(); + if (actionName.equals(action)) + { + result = true; + } + } + } + } + return result; + } + + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION, DataTypeDefinition.QNAME, true, + getParamDisplayLabel(PARAM_DISPOSITION_ACTION_RELATIVE_POSITION), false, "rm-ac-disposition-action-relative-positions")); + paramList.add(new ParameterDefinitionImpl(PARAM_DISPOSITION_ACTION, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_DISPOSITION_ACTION), false, + "rm-ac-disposition-actions")); + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java index a3cc91b989..9d1516026c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java @@ -1,83 +1,83 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - - -/** - * Records management IsKind evaluator that evaluates according to the file plan - * component kind passed in. - * - * @author Craig Tan - * @since 2.1 - */ -/** - * @author ctan - */ -public class IsKindEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase -{ - /** - * Evaluator constants - */ - public static final String NAME = "isKind"; - public static final String PARAM_KIND = "kind"; - - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - boolean result = false; - String kind = ((QName) actionCondition.getParameterValue(PARAM_KIND)).getLocalName(); - - FilePlanComponentKind filePlanComponentKind = getFilePlanService().getFilePlanComponentKind(actionedUponNodeRef); - - if (filePlanComponentKind != null && - filePlanComponentKind.toString().equals(kind)) - { - result = true; - } - return result; - } - - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_KIND, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_KIND), false, "rm-ac-is-kind-kinds")); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.evaluator; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.ActionCondition; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + + + +/** + * Records management IsKind evaluator that evaluates according to the file plan + * component kind passed in. + * + * @author Craig Tan + * @since 2.1 + */ +/** + * @author ctan + */ +public class IsKindEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase +{ + /** + * Evaluator constants + */ + public static final String NAME = "isKind"; + public static final String PARAM_KIND = "kind"; + + @Override + protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) + { + boolean result = false; + String kind = ((QName) actionCondition.getParameterValue(PARAM_KIND)).getLocalName(); + + FilePlanComponentKind filePlanComponentKind = getFilePlanService().getFilePlanComponentKind(actionedUponNodeRef); + + if (filePlanComponentKind != null && + filePlanComponentKind.toString().equals(kind)) + { + result = true; + } + return result; + } + + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_KIND, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_KIND), false, "rm-ac-is-kind-kinds")); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java index 34bf7f2584..2d4cea4219 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsRecordTypeEvaluator.java @@ -1,92 +1,92 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.ActionCondition; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Records management IsRecordType evaluator that evaluates whether the record is of the specified type. - * - * @author Craig Tan - * @since 2.1 - */ -/** - * @author ctan - */ -public class IsRecordTypeEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase implements DOD5015Model -{ - /** - * Evaluator constants - */ - public static final String NAME = "isRecordType"; - - public static final String PARAM_RECORD_TYPE = "type"; - - private NodeService nodeService; - - /** - * Sets the node service - * - * @param nodeService The node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - @Override - protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) - { - boolean result = false; - String type = ((QName) actionCondition.getParameterValue(PARAM_RECORD_TYPE)).getLocalName(); - - if (type != null) - { - result = nodeService.hasAspect(actionedUponNodeRef, QName.createQName(DOD_URI, type)); - } - - return result; - } - - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_RECORD_TYPE, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_RECORD_TYPE), false, "rm-ac-record-types")); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.evaluator; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.ActionCondition; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; + +/** + * Records management IsRecordType evaluator that evaluates whether the record is of the specified type. + * + * @author Craig Tan + * @since 2.1 + */ +/** + * @author ctan + */ +public class IsRecordTypeEvaluator extends RecordsManagementActionConditionEvaluatorAbstractBase implements DOD5015Model +{ + /** + * Evaluator constants + */ + public static final String NAME = "isRecordType"; + + public static final String PARAM_RECORD_TYPE = "type"; + + private NodeService nodeService; + + /** + * Sets the node service + * + * @param nodeService The node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + @Override + protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef) + { + boolean result = false; + String type = ((QName) actionCondition.getParameterValue(PARAM_RECORD_TYPE)).getLocalName(); + + if (type != null) + { + result = nodeService.hasAspect(actionedUponNodeRef, QName.createQName(DOD_URI, type)); + } + + return result; + } + + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_RECORD_TYPE, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_RECORD_TYPE), false, "rm-ac-record-types")); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java index a5d6bc706a..b52f688091 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java @@ -1,130 +1,130 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Action to add types to a record - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class AddRecordTypeAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(AddRecordTypeAction.class); - - /** I18N */ - private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record"; - - /** Constant */ - private static final String DELIMITER = ","; - - /** Parameter names */ - public static final String PARAM_ADD_RECORD_TYPES = "recordTypes"; - - /** Action name */ - public static final String NAME = "addRecordTypes"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (eligibleForAction(actionedUponNodeRef)) - { - for (String type : getRecordTypes(action)) - { - getRecordService().addRecordType(actionedUponNodeRef, QName.createQName(type, getNamespaceService())); - } - } - else if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString())); - } - } - - /** - * Helper method to check the actioned upon node reference to decide to execute the action - * The preconditions are: - * - The node must exist - * - The node must not be frozen - * - The node must be record - * - The node must not be declared - * - * @param actionedUponNodeRef node reference - * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise - */ - private boolean eligibleForAction(NodeRef actionedUponNodeRef) - { - boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - getRecordService().isRecord(actionedUponNodeRef) && - !getRecordService().isDeclared(actionedUponNodeRef)) - { - result = true; - } - return result; - } - - /** - * Helper method to get the record types from the action - * - * @param action The action - * @return An array of record types - */ - private String[] getRecordTypes(Action action) - { - String recordTypes = (String) action.getParameterValue(PARAM_ADD_RECORD_TYPES); - return recordTypes.split(DELIMITER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_ADD_RECORD_TYPES, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_ADD_RECORD_TYPES))); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Action to add types to a record + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class AddRecordTypeAction extends RMActionExecuterAbstractBase +{ + /** Logger */ + private static Log logger = LogFactory.getLog(AddRecordTypeAction.class); + + /** I18N */ + private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record"; + + /** Constant */ + private static final String DELIMITER = ","; + + /** Parameter names */ + public static final String PARAM_ADD_RECORD_TYPES = "recordTypes"; + + /** Action name */ + public static final String NAME = "addRecordTypes"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (eligibleForAction(actionedUponNodeRef)) + { + for (String type : getRecordTypes(action)) + { + getRecordService().addRecordType(actionedUponNodeRef, QName.createQName(type, getNamespaceService())); + } + } + else if (logger.isWarnEnabled()) + { + logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString())); + } + } + + /** + * Helper method to check the actioned upon node reference to decide to execute the action + * The preconditions are: + * - The node must exist + * - The node must not be frozen + * - The node must be record + * - The node must not be declared + * + * @param actionedUponNodeRef node reference + * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise + */ + private boolean eligibleForAction(NodeRef actionedUponNodeRef) + { + boolean result = false; + if (getNodeService().exists(actionedUponNodeRef) && + !getFreezeService().isFrozen(actionedUponNodeRef) && + getRecordService().isRecord(actionedUponNodeRef) && + !getRecordService().isDeclared(actionedUponNodeRef)) + { + result = true; + } + return result; + } + + /** + * Helper method to get the record types from the action + * + * @param action The action + * @return An array of record types + */ + private String[] getRecordTypes(Action action) + { + String recordTypes = (String) action.getParameterValue(PARAM_ADD_RECORD_TYPES); + return recordTypes.split(DELIMITER); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_ADD_RECORD_TYPES, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_ADD_RECORD_TYPES))); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java index 08108dba11..0aea034506 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java @@ -1,154 +1,154 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * This class applies the aspect specified in the spring bean property customTypeAspect. - * It is used to apply one of the 4 "custom type" aspects from the DOD 5015 model. - * - * @author Neil McErlean - */ -public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record"; - private static final String MSG_CUSTOM_ASPECT_NOT_RECOGNISED = "rm.action.custom-aspect-not-recognised"; - - private static Log logger = LogFactory.getLog(ApplyCustomTypeAction.class); - private QName customTypeAspect; - private List parameterDefinitions; - - public void setCustomTypeAspect(String customTypeAspect) - { - this.customTypeAspect = QName.createQName(customTypeAspect, getNamespaceService()); - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (logger.isDebugEnabled()) - { - logger.debug("Executing action [" + action.getActionDefinitionName() + "] on " + actionedUponNodeRef); - } - - if (getRecordService().isRecord(actionedUponNodeRef)) - { - // Apply the appropriate aspect and set the properties. - Map aspectProps = getPropertyValues(action); - this.getNodeService().addAspect(actionedUponNodeRef, customTypeAspect, aspectProps); - } - else if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString())); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected final void addParameterDefinitions(List paramList) - { - AspectDefinition aspectDef = getDictionaryService().getAspect(customTypeAspect); - for (PropertyDefinition propDef : aspectDef.getProperties().values()) - { - QName propName = propDef.getName(); - QName propType = propDef.getDataType().getName(); - paramList.add(new ParameterDefinitionImpl(propName.toPrefixString(), propType, propDef.isMandatory(), null)); - } - } - - /** - * This method converts a Map of String, Serializable to a Map of QName, Serializable. - * To do this, it assumes that each parameter name is a String representing a qname - * of the form prefix:localName. - */ - private Map getPropertyValues(Action action) - { - Map paramValues = action.getParameterValues(); - - Map result = new HashMap(paramValues.size()); - for (Map.Entry entry : paramValues.entrySet()) - { - QName propQName = QName.createQName(entry.getKey(), this.getNamespaceService()); - result.put(propQName, entry.getValue()); - } - - return result; - } - - @Override - protected synchronized List getParameterDefintions() - { - // We can take these parameter definitions from the properties defined in the dod model. - if (this.parameterDefinitions == null) - { - AspectDefinition aspectDefinition = getDictionaryService().getAspect(customTypeAspect); - if (aspectDefinition == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_ASPECT_NOT_RECOGNISED, customTypeAspect)); - } - - Map props = aspectDefinition.getProperties(); - - this.parameterDefinitions = new ArrayList(props.size()); - - for (Map.Entry entry : props.entrySet()) - { - String paramName = entry.getKey().toPrefixString(getNamespaceService()); - PropertyDefinition value = entry.getValue(); - QName paramType = value.getDataType().getName(); - boolean paramIsMandatory = value.isMandatory(); - parameterDefinitions.add(new ParameterDefinitionImpl(paramName, paramType, paramIsMandatory, null)); - } - } - return parameterDefinitions; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * This class applies the aspect specified in the spring bean property customTypeAspect. + * It is used to apply one of the 4 "custom type" aspects from the DOD 5015 model. + * + * @author Neil McErlean + */ +public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record"; + private static final String MSG_CUSTOM_ASPECT_NOT_RECOGNISED = "rm.action.custom-aspect-not-recognised"; + + private static Log logger = LogFactory.getLog(ApplyCustomTypeAction.class); + private QName customTypeAspect; + private List parameterDefinitions; + + public void setCustomTypeAspect(String customTypeAspect) + { + this.customTypeAspect = QName.createQName(customTypeAspect, getNamespaceService()); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (logger.isDebugEnabled()) + { + logger.debug("Executing action [" + action.getActionDefinitionName() + "] on " + actionedUponNodeRef); + } + + if (getRecordService().isRecord(actionedUponNodeRef)) + { + // Apply the appropriate aspect and set the properties. + Map aspectProps = getPropertyValues(action); + this.getNodeService().addAspect(actionedUponNodeRef, customTypeAspect, aspectProps); + } + else if (logger.isWarnEnabled()) + { + logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString())); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected final void addParameterDefinitions(List paramList) + { + AspectDefinition aspectDef = getDictionaryService().getAspect(customTypeAspect); + for (PropertyDefinition propDef : aspectDef.getProperties().values()) + { + QName propName = propDef.getName(); + QName propType = propDef.getDataType().getName(); + paramList.add(new ParameterDefinitionImpl(propName.toPrefixString(), propType, propDef.isMandatory(), null)); + } + } + + /** + * This method converts a Map of String, Serializable to a Map of QName, Serializable. + * To do this, it assumes that each parameter name is a String representing a qname + * of the form prefix:localName. + */ + private Map getPropertyValues(Action action) + { + Map paramValues = action.getParameterValues(); + + Map result = new HashMap(paramValues.size()); + for (Map.Entry entry : paramValues.entrySet()) + { + QName propQName = QName.createQName(entry.getKey(), this.getNamespaceService()); + result.put(propQName, entry.getValue()); + } + + return result; + } + + @Override + protected synchronized List getParameterDefintions() + { + // We can take these parameter definitions from the properties defined in the dod model. + if (this.parameterDefinitions == null) + { + AspectDefinition aspectDefinition = getDictionaryService().getAspect(customTypeAspect); + if (aspectDefinition == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_ASPECT_NOT_RECOGNISED, customTypeAspect)); + } + + Map props = aspectDefinition.getProperties(); + + this.parameterDefinitions = new ArrayList(props.size()); + + for (Map.Entry entry : props.entrySet()) + { + String paramName = entry.getKey().toPrefixString(getNamespaceService()); + PropertyDefinition value = entry.getValue(); + QName paramType = value.getDataType().getName(); + boolean paramIsMandatory = value.isMandatory(); + parameterDefinitions.add(new ParameterDefinitionImpl(paramName, paramType, paramIsMandatory, null)); + } + } + return parameterDefinitions; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java index 54590c7d38..5a4ba42b70 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java @@ -1,275 +1,275 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Action to implement the consequences of a change to the value of the DispositionActionDefinition - * properties. When these properties are changed on a disposition schedule, then any associated - * disposition actions may need to be updated as a consequence. - * - * @author Neil McErlean - */ -public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(BroadcastDispositionActionDefinitionUpdateAction.class); - - public static final String NAME = "broadcastDispositionActionDefinitionUpdate"; - public static final String CHANGED_PROPERTIES = "changedProperties"; - - private BehaviourFilter behaviourFilter; - - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (!RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION.equals(getNodeService().getType(actionedUponNodeRef))) - { - return; - } - - List changedProps = (List)action.getParameterValue(CHANGED_PROPERTIES); - - // Navigate up the containment hierarchy to get the record category grandparent and schedule. - NodeRef dispositionScheduleNode = getNodeService().getPrimaryParent(actionedUponNodeRef).getParentRef(); - NodeRef rmContainer = getNodeService().getPrimaryParent(dispositionScheduleNode).getParentRef(); - DispositionSchedule dispositionSchedule = getDispositionService().getAssociatedDispositionSchedule(rmContainer); - - behaviourFilter.disableBehaviour(); - try - { - List disposableItems = getDispositionService().getDisposableItems(dispositionSchedule); - for (NodeRef disposableItem : disposableItems) - { - updateDisposableItem(dispositionSchedule, disposableItem, actionedUponNodeRef, changedProps); - } - } - finally - { - behaviourFilter.enableBehaviour(); - } - } - - /** - * - * @param ds - * @param disposableItem - * @param dispositionActionDefinition - * @param changedProps - */ - private void updateDisposableItem(DispositionSchedule ds, NodeRef disposableItem, NodeRef dispositionActionDefinition, List changedProps) - { - // We need to check that this folder is under the management of the disposition schedule that - // has been updated - DispositionSchedule itemDs = getDispositionService().getDispositionSchedule(disposableItem); - if (itemDs != null && - itemDs.getNodeRef().equals(ds.getNodeRef())) - { - if (getNodeService().hasAspect(disposableItem, ASPECT_DISPOSITION_LIFECYCLE)) - { - // disposition lifecycle already exists for node so process changes - processActionDefinitionChanges(dispositionActionDefinition, changedProps, disposableItem); - } - else - { - // disposition lifecycle does not exist on the node so setup disposition - getDispositionService().updateNextDispositionAction(disposableItem); - } - - // update rolled up search information - rollupSearchProperties(disposableItem); - } - } - - /** - * Manually update the rolled up search properties - * - * @param disposableItem disposable item - */ - private void rollupSearchProperties(NodeRef disposableItem) - { - DispositionAction da = getDispositionService().getNextDispositionAction(disposableItem); - if (da != null) - { - Map props = getNodeService().getProperties(disposableItem); - - props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName()); - props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate()); - props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, getNodeService().getProperty(da.getNodeRef(), PROP_DISPOSITION_EVENTS_ELIGIBLE)); - - DispositionActionDefinition daDefinition = da.getDispositionActionDefinition(); - Period period = daDefinition.getPeriod(); - if (period != null) - { - props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType()); - props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression()); - } - else - { - props.put(PROP_RS_DISPOSITION_PERIOD, null); - props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null); - } - - List events = da.getEventCompletionDetails(); - List list = new ArrayList(events.size()); - for (EventCompletionDetails event : events) - { - list.add(event.getEventName()); - } - props.put(PROP_RS_DISPOSITION_EVENTS, (Serializable)list); - - getNodeService().setProperties(disposableItem, props); - } - } - - /** - * Processes all the changes applied to the given disposition - * action definition node for the given record or folder node. - * - * @param dispositionActionDef The disposition action definition node - * @param changedProps The set of properties changed on the action definition - * @param recordOrFolder The record or folder the changes potentially need to be applied to - */ - private void processActionDefinitionChanges(NodeRef dispositionActionDef, List changedProps, NodeRef recordOrFolder) - { - // check that the step being edited is the current step for the folder, - // if not, the change has no effect on the current step so ignore - DispositionAction nextAction = getDispositionService().getNextDispositionAction(recordOrFolder); - if (doesChangedStepAffectNextAction(dispositionActionDef, nextAction)) - { - // the change does effect the nextAction for this node - // so go ahead and determine what needs updating - if (changedProps.contains(PROP_DISPOSITION_PERIOD)) - { - persistPeriodChanges(dispositionActionDef, nextAction); - } - - if (changedProps.contains(PROP_DISPOSITION_EVENT) || changedProps.contains(PROP_DISPOSITION_EVENT_COMBINATION)) - { - nextAction.refreshEvents(); - } - - if (changedProps.contains(PROP_DISPOSITION_ACTION_NAME)) - { - String action = (String)getNodeService().getProperty(dispositionActionDef, PROP_DISPOSITION_ACTION_NAME); - getNodeService().setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_ACTION, action); - } - } - } - - /** - * Determines whether the disposition action definition (step) being - * updated has any effect on the given next action - * - * @param dispositionActionDef The disposition action definition node - * @param nextAction The next disposition action - * @return true if the step change affects the next action - */ - private boolean doesChangedStepAffectNextAction(NodeRef dispositionActionDef, - DispositionAction nextAction) - { - boolean affectsNextAction = false; - - if (dispositionActionDef != null && nextAction != null) - { - // check whether the id of the action definition node being changed - // is the same as the id of the next action - String nextActionId = nextAction.getId(); - if (dispositionActionDef.getId().equals(nextActionId)) - { - affectsNextAction = true; - } - } - - return affectsNextAction; - } - - /** - * Persists any changes made to the period on the given disposition action - * definition on the given next action. - * - * @param dispositionActionDef The disposition action definition node - * @param nextAction The next disposition action - */ - private void persistPeriodChanges(NodeRef dispositionActionDef, DispositionAction nextAction) - { - Date newAsOfDate = null; - Period dispositionPeriod = (Period) getNodeService().getProperty(dispositionActionDef, PROP_DISPOSITION_PERIOD); - - if (dispositionPeriod != null) - { - // calculate the new as of date as we have been provided a new period - Date now = new Date(); - newAsOfDate = dispositionPeriod.getNextDate(now); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Set disposition as of date for next action '" + nextAction.getName() + - "' (" + nextAction.getNodeRef() + ") to: " + newAsOfDate); - } - - getNodeService().setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_AS_OF, newAsOfDate); - } - - @Override - protected void addParameterDefinitions(List paramList) - { - // Intentionally empty - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Action to implement the consequences of a change to the value of the DispositionActionDefinition + * properties. When these properties are changed on a disposition schedule, then any associated + * disposition actions may need to be updated as a consequence. + * + * @author Neil McErlean + */ +public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionExecuterAbstractBase +{ + /** Logger */ + private static Log logger = LogFactory.getLog(BroadcastDispositionActionDefinitionUpdateAction.class); + + public static final String NAME = "broadcastDispositionActionDefinitionUpdate"; + public static final String CHANGED_PROPERTIES = "changedProperties"; + + private BehaviourFilter behaviourFilter; + + public void setBehaviourFilter(BehaviourFilter behaviourFilter) + { + this.behaviourFilter = behaviourFilter; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (!RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION.equals(getNodeService().getType(actionedUponNodeRef))) + { + return; + } + + List changedProps = (List)action.getParameterValue(CHANGED_PROPERTIES); + + // Navigate up the containment hierarchy to get the record category grandparent and schedule. + NodeRef dispositionScheduleNode = getNodeService().getPrimaryParent(actionedUponNodeRef).getParentRef(); + NodeRef rmContainer = getNodeService().getPrimaryParent(dispositionScheduleNode).getParentRef(); + DispositionSchedule dispositionSchedule = getDispositionService().getAssociatedDispositionSchedule(rmContainer); + + behaviourFilter.disableBehaviour(); + try + { + List disposableItems = getDispositionService().getDisposableItems(dispositionSchedule); + for (NodeRef disposableItem : disposableItems) + { + updateDisposableItem(dispositionSchedule, disposableItem, actionedUponNodeRef, changedProps); + } + } + finally + { + behaviourFilter.enableBehaviour(); + } + } + + /** + * + * @param ds + * @param disposableItem + * @param dispositionActionDefinition + * @param changedProps + */ + private void updateDisposableItem(DispositionSchedule ds, NodeRef disposableItem, NodeRef dispositionActionDefinition, List changedProps) + { + // We need to check that this folder is under the management of the disposition schedule that + // has been updated + DispositionSchedule itemDs = getDispositionService().getDispositionSchedule(disposableItem); + if (itemDs != null && + itemDs.getNodeRef().equals(ds.getNodeRef())) + { + if (getNodeService().hasAspect(disposableItem, ASPECT_DISPOSITION_LIFECYCLE)) + { + // disposition lifecycle already exists for node so process changes + processActionDefinitionChanges(dispositionActionDefinition, changedProps, disposableItem); + } + else + { + // disposition lifecycle does not exist on the node so setup disposition + getDispositionService().updateNextDispositionAction(disposableItem); + } + + // update rolled up search information + rollupSearchProperties(disposableItem); + } + } + + /** + * Manually update the rolled up search properties + * + * @param disposableItem disposable item + */ + private void rollupSearchProperties(NodeRef disposableItem) + { + DispositionAction da = getDispositionService().getNextDispositionAction(disposableItem); + if (da != null) + { + Map props = getNodeService().getProperties(disposableItem); + + props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName()); + props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate()); + props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, getNodeService().getProperty(da.getNodeRef(), PROP_DISPOSITION_EVENTS_ELIGIBLE)); + + DispositionActionDefinition daDefinition = da.getDispositionActionDefinition(); + Period period = daDefinition.getPeriod(); + if (period != null) + { + props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType()); + props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression()); + } + else + { + props.put(PROP_RS_DISPOSITION_PERIOD, null); + props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null); + } + + List events = da.getEventCompletionDetails(); + List list = new ArrayList(events.size()); + for (EventCompletionDetails event : events) + { + list.add(event.getEventName()); + } + props.put(PROP_RS_DISPOSITION_EVENTS, (Serializable)list); + + getNodeService().setProperties(disposableItem, props); + } + } + + /** + * Processes all the changes applied to the given disposition + * action definition node for the given record or folder node. + * + * @param dispositionActionDef The disposition action definition node + * @param changedProps The set of properties changed on the action definition + * @param recordOrFolder The record or folder the changes potentially need to be applied to + */ + private void processActionDefinitionChanges(NodeRef dispositionActionDef, List changedProps, NodeRef recordOrFolder) + { + // check that the step being edited is the current step for the folder, + // if not, the change has no effect on the current step so ignore + DispositionAction nextAction = getDispositionService().getNextDispositionAction(recordOrFolder); + if (doesChangedStepAffectNextAction(dispositionActionDef, nextAction)) + { + // the change does effect the nextAction for this node + // so go ahead and determine what needs updating + if (changedProps.contains(PROP_DISPOSITION_PERIOD)) + { + persistPeriodChanges(dispositionActionDef, nextAction); + } + + if (changedProps.contains(PROP_DISPOSITION_EVENT) || changedProps.contains(PROP_DISPOSITION_EVENT_COMBINATION)) + { + nextAction.refreshEvents(); + } + + if (changedProps.contains(PROP_DISPOSITION_ACTION_NAME)) + { + String action = (String)getNodeService().getProperty(dispositionActionDef, PROP_DISPOSITION_ACTION_NAME); + getNodeService().setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_ACTION, action); + } + } + } + + /** + * Determines whether the disposition action definition (step) being + * updated has any effect on the given next action + * + * @param dispositionActionDef The disposition action definition node + * @param nextAction The next disposition action + * @return true if the step change affects the next action + */ + private boolean doesChangedStepAffectNextAction(NodeRef dispositionActionDef, + DispositionAction nextAction) + { + boolean affectsNextAction = false; + + if (dispositionActionDef != null && nextAction != null) + { + // check whether the id of the action definition node being changed + // is the same as the id of the next action + String nextActionId = nextAction.getId(); + if (dispositionActionDef.getId().equals(nextActionId)) + { + affectsNextAction = true; + } + } + + return affectsNextAction; + } + + /** + * Persists any changes made to the period on the given disposition action + * definition on the given next action. + * + * @param dispositionActionDef The disposition action definition node + * @param nextAction The next disposition action + */ + private void persistPeriodChanges(NodeRef dispositionActionDef, DispositionAction nextAction) + { + Date newAsOfDate = null; + Period dispositionPeriod = (Period) getNodeService().getProperty(dispositionActionDef, PROP_DISPOSITION_PERIOD); + + if (dispositionPeriod != null) + { + // calculate the new as of date as we have been provided a new period + Date now = new Date(); + newAsOfDate = dispositionPeriod.getNextDate(now); + } + + if (logger.isDebugEnabled()) + { + logger.debug("Set disposition as of date for next action '" + nextAction.getName() + + "' (" + nextAction.getNodeRef() + ") to: " + newAsOfDate); + } + + getNodeService().setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_AS_OF, newAsOfDate); + } + + @Override + protected void addParameterDefinitions(List paramList) + { + // Intentionally empty + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java index 2f2aa263e4..8e8d05fb21 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java @@ -1,89 +1,89 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Action to close the records folder - * - * @author Roy Wetherall - */ -public class CloseRecordFolderAction extends RMActionExecuterAbstractBase -{ - /** Parameter names */ - public static final String PARAM_CLOSE_PARENT = "closeParent"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, final NodeRef actionedUponNodeRef) - { - if (eligibleForAction(actionedUponNodeRef)) - { - // do the work of creating the record as the system user - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - getRecordFolderService().closeRecordFolder(actionedUponNodeRef); - - return null; - } - }); - } - } - - /** - * Helper method to check the actioned upon node reference to decide to execute the action - * The preconditions are: - * - The node must exist - * - The node must not be frozen - * - * @param actionedUponNodeRef node reference - * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise - */ - private boolean eligibleForAction(NodeRef actionedUponNodeRef) - { - boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - !TYPE_UNFILED_RECORD_FOLDER.equals(getNodeService().getType(actionedUponNodeRef))) - { - result = true; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Action to close the records folder + * + * @author Roy Wetherall + */ +public class CloseRecordFolderAction extends RMActionExecuterAbstractBase +{ + /** Parameter names */ + public static final String PARAM_CLOSE_PARENT = "closeParent"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, final NodeRef actionedUponNodeRef) + { + if (eligibleForAction(actionedUponNodeRef)) + { + // do the work of creating the record as the system user + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + getRecordFolderService().closeRecordFolder(actionedUponNodeRef); + + return null; + } + }); + } + } + + /** + * Helper method to check the actioned upon node reference to decide to execute the action + * The preconditions are: + * - The node must exist + * - The node must not be frozen + * + * @param actionedUponNodeRef node reference + * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise + */ + private boolean eligibleForAction(NodeRef actionedUponNodeRef) + { + boolean result = false; + if (getNodeService().exists(actionedUponNodeRef) && + !getFreezeService().isFrozen(actionedUponNodeRef) && + !TYPE_UNFILED_RECORD_FOLDER.equals(getNodeService().getType(actionedUponNodeRef))) + { + result = true; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java index 7ddd553b52..bf030a69c9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java @@ -1,98 +1,98 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.Date; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Complete event action - * - * @author Roy Wetherall - * @since 1.0 - */ -public class CompleteEventAction extends RMActionExecuterAbstractBase -{ - /** action name */ - public static final String NAME = "completeEvent"; - - /** action parameter names */ - public static final String PARAM_EVENT_NAME = "eventName"; - public static final String PARAM_EVENT_COMPLETED_BY = "eventCompletedBy"; - public static final String PARAM_EVENT_COMPLETED_AT = "eventCompletedAt"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_EVENT_NAME, - DataTypeDefinition.TEXT, - true, - getParamDisplayLabel(PARAM_EVENT_NAME), - false, - "rm-ac-manual-events")); - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef)) - { - /** get parameter values */ - String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME); - String eventCompletedBy = (String)action.getParameterValue(PARAM_EVENT_COMPLETED_BY); - Date eventCompletedAt = (Date)action.getParameterValue(PARAM_EVENT_COMPLETED_AT); - - if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - // Get the next disposition action - DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef); - if (da != null) - { - // complete event - da.completeEvent(eventName, eventCompletedAt, eventCompletedBy); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.Date; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Complete event action + * + * @author Roy Wetherall + * @since 1.0 + */ +public class CompleteEventAction extends RMActionExecuterAbstractBase +{ + /** action name */ + public static final String NAME = "completeEvent"; + + /** action parameter names */ + public static final String PARAM_EVENT_NAME = "eventName"; + public static final String PARAM_EVENT_COMPLETED_BY = "eventCompletedBy"; + public static final String PARAM_EVENT_COMPLETED_AT = "eventCompletedAt"; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_EVENT_NAME, + DataTypeDefinition.TEXT, + true, + getParamDisplayLabel(PARAM_EVENT_NAME), + false, + "rm-ac-manual-events")); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getNodeService().exists(actionedUponNodeRef) && + !getFreezeService().isFrozen(actionedUponNodeRef)) + { + /** get parameter values */ + String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME); + String eventCompletedBy = (String)action.getParameterValue(PARAM_EVENT_COMPLETED_BY); + Date eventCompletedAt = (Date)action.getParameterValue(PARAM_EVENT_COMPLETED_AT); + + if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + { + // Get the next disposition action + DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef); + if (da != null) + { + // complete event + da.completeEvent(eventName, eventCompletedAt, eventCompletedBy); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java index 1c0d10ea83..468d0a709f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java @@ -1,483 +1,483 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.Arrays; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.dao.ConcurrencyFailureException; -import org.springframework.util.StringUtils; - -/** - * File To action implementation. - * - * @author Mark Hibbins - * @since 2.2 - */ -public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstractBase -{ - private static Log logger = LogFactory.getLog(CopyMoveLinkFileToBaseAction.class); - - /** Retrying transaction helper */ - private RetryingTransactionHelper retryingTransactionHelper; - - /** action parameters */ - public static final String PARAM_DESTINATION_RECORD_FOLDER = "destinationRecordFolder"; - public static final String PARAM_PATH = "path"; - public static final String PARAM_CREATE_RECORD_PATH = "createRecordPath"; - public static final String ACTION_FILETO = "fileTo"; - public static final String ACTION_LINKTO = "linkTo"; - - /** file folder service */ - private FileFolderService fileFolderService; - - /** file plan service */ - private FilePlanService filePlanService; - - /** action modes */ - public enum CopyMoveLinkFileToActionMode - { - COPY, MOVE, LINK - }; - - /** Action Mode */ - private CopyMoveLinkFileToActionMode mode; - - /** - * @return Action Mode - */ - protected CopyMoveLinkFileToActionMode getMode() - { - return this.mode; - } - - /** - * Sets the action mode - * - * @param mode Action mode - */ - protected void setMode(CopyMoveLinkFileToActionMode mode) - { - this.mode = mode; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param retryingTransactionHelper retrying transaction helper - */ - public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_PATH))); - paramList.add(new ParameterDefinitionImpl(PARAM_CREATE_RECORD_PATH, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_CREATE_RECORD_PATH))); - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected synchronized void executeImpl(final Action action, final NodeRef actionedUponNodeRef) - { - String actionName = action.getActionDefinitionName(); - if (isOkToProceedWithAction(actionedUponNodeRef, actionName)) - { - QName actionedUponType = getNodeService().getType(actionedUponNodeRef); - - boolean targetIsUnfiledRecords; - if (ACTION_FILETO.equals(action.getActionDefinitionName())) - { - targetIsUnfiledRecords = false; - } - else - { - targetIsUnfiledRecords = (getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && !getRecordService().isFiled(actionedUponNodeRef)) - || TYPE_UNFILED_RECORD_FOLDER.equals(actionedUponType); - } - - // first look to see if the destination record folder has been specified - NodeRef recordFolder = (NodeRef)action.getParameterValue(PARAM_DESTINATION_RECORD_FOLDER); - if (recordFolder == null) - { - final boolean finaltargetIsUnfiledRecords = targetIsUnfiledRecords; - recordFolder = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public NodeRef execute() throws Throwable - { - NodeRef result = null; - try - { - // get the reference to the record folder based on the relative path - result = createOrResolvePath(action, actionedUponNodeRef, finaltargetIsUnfiledRecords); - } - catch (DuplicateChildNodeNameException ex) - { - throw new ConcurrencyFailureException("Cannot create or resolve path.", ex); - } - - return result; - } - }, false, true); - } - - // now we have the reference to the target folder we can do some final checks to see if the action is valid - validateActionPostPathResolution(actionedUponNodeRef, recordFolder, actionName, targetIsUnfiledRecords); - - final NodeRef finalRecordFolder = recordFolder; - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - try - { - synchronized (this) - { - if (getMode() == CopyMoveLinkFileToActionMode.MOVE) - { - fileFolderService.move(actionedUponNodeRef, finalRecordFolder, null); - } - else if (getMode() == CopyMoveLinkFileToActionMode.COPY) - { - fileFolderService.copy(actionedUponNodeRef, finalRecordFolder, null); - } - else if (getMode() == CopyMoveLinkFileToActionMode.LINK) - { - getRecordService().link(actionedUponNodeRef, finalRecordFolder); - } - } - } - catch (FileNotFoundException fileNotFound) - { - throw new AlfrescoRuntimeException("Unable to execute file to action, because the " + (mode == CopyMoveLinkFileToActionMode.MOVE ? "move" : "copy") + " operation failed.", fileNotFound); - } - - return null; - } - - }); - } - } - - /** - * Return true if the passed parameters to the action are valid for the given action - * - * @param actionedUponNodeRef - * @param actionName - * @return - */ - private boolean isOkToProceedWithAction(NodeRef actionedUponNodeRef, String actionName) - { - // Check that the incoming parameters are valid prior to performing any action - boolean okToProceed = false; - if(getNodeService().exists(actionedUponNodeRef) && !getFreezeService().isFrozen(actionedUponNodeRef)) - { - QName actionedUponType = getNodeService().getType(actionedUponNodeRef); - if(ACTION_FILETO.equals(actionName)) - { - // file to action can only be performed on unfiled records - okToProceed = !getRecordService().isFiled(actionedUponNodeRef) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT); - if(!okToProceed && logger.isDebugEnabled()) - { - logger.debug("Unable to run " + actionName + " action on a node that isn't unfiled and a sub-class of content type"); - } - } - else if(ACTION_LINKTO.equals(actionName)) - { - // link to action can only be performed on filed records - okToProceed = getRecordService().isFiled(actionedUponNodeRef) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT); - if(!okToProceed && logger.isDebugEnabled()) - { - logger.debug("Unable to run " + actionName + " action on a node that isn't filed and a sub-class of content type"); - } - } - else - { - okToProceed = true; - } - } - return okToProceed; - } - - /** - * Do a final validation for the parameters and the resolve target path - * - * @param actionedUponNodeRef - * @param target - * @param actionName - * @param targetIsUnfiledRecords - */ - private void validateActionPostPathResolution(NodeRef actionedUponNodeRef, NodeRef target, String actionName, boolean targetIsUnfiledRecords) - { - QName actionedUponType = getNodeService().getType(actionedUponNodeRef); - // now we have the reference to the target folder we can do some final checks to see if the action is valid - if (target == null) - { - throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder could not be determined."); - } - if(targetIsUnfiledRecords) - { - QName targetFolderType = getNodeService().getType(target); - if(!TYPE_UNFILED_RECORD_CONTAINER.equals(targetFolderType) && !TYPE_UNFILED_RECORD_FOLDER.equals(targetFolderType)) - { - throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type."); - } - } - else - { - if(getRecordFolderService().isRecordFolder(target) && !getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && (getRecordFolderService().isRecordFolder(actionedUponNodeRef) || filePlanService.isRecordCategory(actionedUponNodeRef))) - { - throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type. A record folder cannot contain another folder or a category"); - } - else if(filePlanService.isRecordCategory(target) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT)) - { - throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type. A record category cannot contain a record"); - } - } - } - - /** - * Create or resolve the path specified in the action's path parameter - * - * @param action - * @param actionedUponNodeRef - * @param targetisUnfiledRecords true is the target is in unfiled records - * @return - */ - private NodeRef createOrResolvePath(final Action action, final NodeRef actionedUponNodeRef, final boolean targetisUnfiledRecords) - { - // get the starting context - final NodeRef context = getContext(action, actionedUponNodeRef, targetisUnfiledRecords); - NodeRef path = context; - - // get the path we wish to resolve - String pathParameter = (String)action.getParameterValue(PARAM_PATH); - final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true); - if((pathElementsArray != null) && (pathElementsArray.length > 0)) - { - // get the create parameter - Boolean createValue = (Boolean)action.getParameterValue(PARAM_CREATE_RECORD_PATH); - final boolean create = createValue == null ? false : createValue.booleanValue(); - - // create or resolve the specified path - path = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public NodeRef execute() throws Throwable - { - NodeRef path = null; - try - { - path = createOrResolvePath(action, context, actionedUponNodeRef, Arrays.asList(pathElementsArray), targetisUnfiledRecords, - create, false); - } - catch (DuplicateChildNodeNameException ex) - { - throw new ConcurrencyFailureException("Cannot create or resolve path.", ex); - } - return path; - } - }, false, true); - } - return path; - } - - /** - * Create or resolve the specified path - * - * @param action Action to use for reporting if anything goes wrong - * @param parent Parent of path to be created - * @param actionedUponNodeRef The node subject to the file/move/copy action - * @param pathElements The elements of the path to be created - * @param targetisUnfiledRecords true if the target is within unfiled records - * @param create true if the path should be creeated if it does not exist - * @param creating true if we have already created the parent and therefore can skip the check to see if the next path element already exists - * @return - */ - private NodeRef createOrResolvePath(Action action, NodeRef parent, NodeRef actionedUponNodeRef, List pathElements, boolean targetisUnfiledRecords, boolean create, boolean creating) - { - NodeRef nodeRef = null; - String childName = pathElements.get(0); - boolean lastPathElement = pathElements.size() == 1; - if(!creating) - { - nodeRef = getChild(parent, childName); - } - if(nodeRef == null) - { - if(create) - { - creating = true; - boolean lastAsFolder = lastPathElement && (getDictionaryService().isSubClass(getNodeService().getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) || RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT.equals(getNodeService().getType(actionedUponNodeRef))); - nodeRef = createChild(action, parent, childName, targetisUnfiledRecords, lastAsFolder); - } - else - { - throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path could not be determined."); - } - } - else - { - QName nodeType = getNodeService().getType(nodeRef); - if(nodeType.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER) || - nodeType.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER) || - nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER)) - { - throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path in invalid."); - } - } - if(pathElements.size() > 1) - { - nodeRef = createOrResolvePath(action, nodeRef, actionedUponNodeRef, pathElements.subList(1, pathElements.size()), targetisUnfiledRecords, create, creating); - } - return nodeRef; - } - - /** - * Get the specified child node ref of the specified parent if it exists, otherwise return null - * - * @param parent - * @param childName - * @return - */ - private NodeRef getChild(NodeRef parent, String childName) - { - return getNodeService().getChildByName(parent, ContentModel.ASSOC_CONTAINS, childName); - } - - /** - * Create the specified child of the specified parent - * - * @param action Action to use for reporting if anything goes wrong - * @param parent Parent of the child to be created - * @param childName The name of the child to be created - * @param targetisUnfiledRecords true if the child is being created in the unfiled directory (determines type as unfiled container child) - * @param lastAsFolder true if this is the last element of the pathe being created and it should be created as a folder. ignored if targetIsUnfiledRecords is true - * @return - */ - private NodeRef createChild(final Action action, final NodeRef parent, final String childName, final boolean targetisUnfiledRecords, final boolean lastAsFolder) - { - return AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() - { - // double check that the child hasn't been created by another thread - NodeRef child = getChild(parent, childName); - if (child == null) - { - if(targetisUnfiledRecords) - { - // create unfiled folder - child = fileFolderService.create(parent, childName, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER).getNodeRef(); - } - else if(lastAsFolder) - { - // create record folder - child = getRecordFolderService().createRecordFolder(parent, childName); - } - else - { - // ensure we are not trying to create a record categtory in a record folder - if(RecordsManagementModel.TYPE_RECORD_FOLDER.equals(getNodeService().getType(parent))) - { - throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path has a record category within a record folder."); - } - - // create record category - child = filePlanService.createRecordCategory(parent, childName); - } - } - return child; - } - }); - } - - /** - * Return the context. This will be the unfiled records container of the context if targetisUnfiledRecords is true - * - * @param action - * @param actionedUponNodeRef - * @param targetisUnfiledRecords - * @return - */ - private NodeRef getContext(Action action, NodeRef actionedUponNodeRef, boolean targetisUnfiledRecords) - { - NodeRef context = filePlanService.getFilePlan(actionedUponNodeRef); - if(targetisUnfiledRecords && (context != null) && getNodeService().exists(context)) - { - context = filePlanService.getUnfiledContainer(context); - } - if((context == null) || (!getNodeService().exists(context))) - { - throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the path resolution context could not be determined."); - } - return context; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.Arrays; +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileNotFoundException; +import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.util.StringUtils; + +/** + * File To action implementation. + * + * @author Mark Hibbins + * @since 2.2 + */ +public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstractBase +{ + private static Log logger = LogFactory.getLog(CopyMoveLinkFileToBaseAction.class); + + /** Retrying transaction helper */ + private RetryingTransactionHelper retryingTransactionHelper; + + /** action parameters */ + public static final String PARAM_DESTINATION_RECORD_FOLDER = "destinationRecordFolder"; + public static final String PARAM_PATH = "path"; + public static final String PARAM_CREATE_RECORD_PATH = "createRecordPath"; + public static final String ACTION_FILETO = "fileTo"; + public static final String ACTION_LINKTO = "linkTo"; + + /** file folder service */ + private FileFolderService fileFolderService; + + /** file plan service */ + private FilePlanService filePlanService; + + /** action modes */ + public enum CopyMoveLinkFileToActionMode + { + COPY, MOVE, LINK + }; + + /** Action Mode */ + private CopyMoveLinkFileToActionMode mode; + + /** + * @return Action Mode + */ + protected CopyMoveLinkFileToActionMode getMode() + { + return this.mode; + } + + /** + * Sets the action mode + * + * @param mode Action mode + */ + protected void setMode(CopyMoveLinkFileToActionMode mode) + { + this.mode = mode; + } + + /** + * @param fileFolderService file folder service + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param retryingTransactionHelper retrying transaction helper + */ + public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) + { + this.retryingTransactionHelper = retryingTransactionHelper; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_PATH))); + paramList.add(new ParameterDefinitionImpl(PARAM_CREATE_RECORD_PATH, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_CREATE_RECORD_PATH))); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected synchronized void executeImpl(final Action action, final NodeRef actionedUponNodeRef) + { + String actionName = action.getActionDefinitionName(); + if (isOkToProceedWithAction(actionedUponNodeRef, actionName)) + { + QName actionedUponType = getNodeService().getType(actionedUponNodeRef); + + boolean targetIsUnfiledRecords; + if (ACTION_FILETO.equals(action.getActionDefinitionName())) + { + targetIsUnfiledRecords = false; + } + else + { + targetIsUnfiledRecords = (getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && !getRecordService().isFiled(actionedUponNodeRef)) + || TYPE_UNFILED_RECORD_FOLDER.equals(actionedUponType); + } + + // first look to see if the destination record folder has been specified + NodeRef recordFolder = (NodeRef)action.getParameterValue(PARAM_DESTINATION_RECORD_FOLDER); + if (recordFolder == null) + { + final boolean finaltargetIsUnfiledRecords = targetIsUnfiledRecords; + recordFolder = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public NodeRef execute() throws Throwable + { + NodeRef result = null; + try + { + // get the reference to the record folder based on the relative path + result = createOrResolvePath(action, actionedUponNodeRef, finaltargetIsUnfiledRecords); + } + catch (DuplicateChildNodeNameException ex) + { + throw new ConcurrencyFailureException("Cannot create or resolve path.", ex); + } + + return result; + } + }, false, true); + } + + // now we have the reference to the target folder we can do some final checks to see if the action is valid + validateActionPostPathResolution(actionedUponNodeRef, recordFolder, actionName, targetIsUnfiledRecords); + + final NodeRef finalRecordFolder = recordFolder; + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + try + { + synchronized (this) + { + if (getMode() == CopyMoveLinkFileToActionMode.MOVE) + { + fileFolderService.move(actionedUponNodeRef, finalRecordFolder, null); + } + else if (getMode() == CopyMoveLinkFileToActionMode.COPY) + { + fileFolderService.copy(actionedUponNodeRef, finalRecordFolder, null); + } + else if (getMode() == CopyMoveLinkFileToActionMode.LINK) + { + getRecordService().link(actionedUponNodeRef, finalRecordFolder); + } + } + } + catch (FileNotFoundException fileNotFound) + { + throw new AlfrescoRuntimeException("Unable to execute file to action, because the " + (mode == CopyMoveLinkFileToActionMode.MOVE ? "move" : "copy") + " operation failed.", fileNotFound); + } + + return null; + } + + }); + } + } + + /** + * Return true if the passed parameters to the action are valid for the given action + * + * @param actionedUponNodeRef + * @param actionName + * @return + */ + private boolean isOkToProceedWithAction(NodeRef actionedUponNodeRef, String actionName) + { + // Check that the incoming parameters are valid prior to performing any action + boolean okToProceed = false; + if(getNodeService().exists(actionedUponNodeRef) && !getFreezeService().isFrozen(actionedUponNodeRef)) + { + QName actionedUponType = getNodeService().getType(actionedUponNodeRef); + if(ACTION_FILETO.equals(actionName)) + { + // file to action can only be performed on unfiled records + okToProceed = !getRecordService().isFiled(actionedUponNodeRef) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT); + if(!okToProceed && logger.isDebugEnabled()) + { + logger.debug("Unable to run " + actionName + " action on a node that isn't unfiled and a sub-class of content type"); + } + } + else if(ACTION_LINKTO.equals(actionName)) + { + // link to action can only be performed on filed records + okToProceed = getRecordService().isFiled(actionedUponNodeRef) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT); + if(!okToProceed && logger.isDebugEnabled()) + { + logger.debug("Unable to run " + actionName + " action on a node that isn't filed and a sub-class of content type"); + } + } + else + { + okToProceed = true; + } + } + return okToProceed; + } + + /** + * Do a final validation for the parameters and the resolve target path + * + * @param actionedUponNodeRef + * @param target + * @param actionName + * @param targetIsUnfiledRecords + */ + private void validateActionPostPathResolution(NodeRef actionedUponNodeRef, NodeRef target, String actionName, boolean targetIsUnfiledRecords) + { + QName actionedUponType = getNodeService().getType(actionedUponNodeRef); + // now we have the reference to the target folder we can do some final checks to see if the action is valid + if (target == null) + { + throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder could not be determined."); + } + if(targetIsUnfiledRecords) + { + QName targetFolderType = getNodeService().getType(target); + if(!TYPE_UNFILED_RECORD_CONTAINER.equals(targetFolderType) && !TYPE_UNFILED_RECORD_FOLDER.equals(targetFolderType)) + { + throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type."); + } + } + else + { + if(getRecordFolderService().isRecordFolder(target) && !getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && (getRecordFolderService().isRecordFolder(actionedUponNodeRef) || filePlanService.isRecordCategory(actionedUponNodeRef))) + { + throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type. A record folder cannot contain another folder or a category"); + } + else if(filePlanService.isRecordCategory(target) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT)) + { + throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type. A record category cannot contain a record"); + } + } + } + + /** + * Create or resolve the path specified in the action's path parameter + * + * @param action + * @param actionedUponNodeRef + * @param targetisUnfiledRecords true is the target is in unfiled records + * @return + */ + private NodeRef createOrResolvePath(final Action action, final NodeRef actionedUponNodeRef, final boolean targetisUnfiledRecords) + { + // get the starting context + final NodeRef context = getContext(action, actionedUponNodeRef, targetisUnfiledRecords); + NodeRef path = context; + + // get the path we wish to resolve + String pathParameter = (String)action.getParameterValue(PARAM_PATH); + final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true); + if((pathElementsArray != null) && (pathElementsArray.length > 0)) + { + // get the create parameter + Boolean createValue = (Boolean)action.getParameterValue(PARAM_CREATE_RECORD_PATH); + final boolean create = createValue == null ? false : createValue.booleanValue(); + + // create or resolve the specified path + path = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public NodeRef execute() throws Throwable + { + NodeRef path = null; + try + { + path = createOrResolvePath(action, context, actionedUponNodeRef, Arrays.asList(pathElementsArray), targetisUnfiledRecords, + create, false); + } + catch (DuplicateChildNodeNameException ex) + { + throw new ConcurrencyFailureException("Cannot create or resolve path.", ex); + } + return path; + } + }, false, true); + } + return path; + } + + /** + * Create or resolve the specified path + * + * @param action Action to use for reporting if anything goes wrong + * @param parent Parent of path to be created + * @param actionedUponNodeRef The node subject to the file/move/copy action + * @param pathElements The elements of the path to be created + * @param targetisUnfiledRecords true if the target is within unfiled records + * @param create true if the path should be creeated if it does not exist + * @param creating true if we have already created the parent and therefore can skip the check to see if the next path element already exists + * @return + */ + private NodeRef createOrResolvePath(Action action, NodeRef parent, NodeRef actionedUponNodeRef, List pathElements, boolean targetisUnfiledRecords, boolean create, boolean creating) + { + NodeRef nodeRef = null; + String childName = pathElements.get(0); + boolean lastPathElement = pathElements.size() == 1; + if(!creating) + { + nodeRef = getChild(parent, childName); + } + if(nodeRef == null) + { + if(create) + { + creating = true; + boolean lastAsFolder = lastPathElement && (getDictionaryService().isSubClass(getNodeService().getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) || RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT.equals(getNodeService().getType(actionedUponNodeRef))); + nodeRef = createChild(action, parent, childName, targetisUnfiledRecords, lastAsFolder); + } + else + { + throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path could not be determined."); + } + } + else + { + QName nodeType = getNodeService().getType(nodeRef); + if(nodeType.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER) || + nodeType.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER) || + nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER)) + { + throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path in invalid."); + } + } + if(pathElements.size() > 1) + { + nodeRef = createOrResolvePath(action, nodeRef, actionedUponNodeRef, pathElements.subList(1, pathElements.size()), targetisUnfiledRecords, create, creating); + } + return nodeRef; + } + + /** + * Get the specified child node ref of the specified parent if it exists, otherwise return null + * + * @param parent + * @param childName + * @return + */ + private NodeRef getChild(NodeRef parent, String childName) + { + return getNodeService().getChildByName(parent, ContentModel.ASSOC_CONTAINS, childName); + } + + /** + * Create the specified child of the specified parent + * + * @param action Action to use for reporting if anything goes wrong + * @param parent Parent of the child to be created + * @param childName The name of the child to be created + * @param targetisUnfiledRecords true if the child is being created in the unfiled directory (determines type as unfiled container child) + * @param lastAsFolder true if this is the last element of the pathe being created and it should be created as a folder. ignored if targetIsUnfiledRecords is true + * @return + */ + private NodeRef createChild(final Action action, final NodeRef parent, final String childName, final boolean targetisUnfiledRecords, final boolean lastAsFolder) + { + return AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public NodeRef doWork() + { + // double check that the child hasn't been created by another thread + NodeRef child = getChild(parent, childName); + if (child == null) + { + if(targetisUnfiledRecords) + { + // create unfiled folder + child = fileFolderService.create(parent, childName, RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER).getNodeRef(); + } + else if(lastAsFolder) + { + // create record folder + child = getRecordFolderService().createRecordFolder(parent, childName); + } + else + { + // ensure we are not trying to create a record categtory in a record folder + if(RecordsManagementModel.TYPE_RECORD_FOLDER.equals(getNodeService().getType(parent))) + { + throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path has a record category within a record folder."); + } + + // create record category + child = filePlanService.createRecordCategory(parent, childName); + } + } + return child; + } + }); + } + + /** + * Return the context. This will be the unfiled records container of the context if targetisUnfiledRecords is true + * + * @param action + * @param actionedUponNodeRef + * @param targetisUnfiledRecords + * @return + */ + private NodeRef getContext(Action action, NodeRef actionedUponNodeRef, boolean targetisUnfiledRecords) + { + NodeRef context = filePlanService.getFilePlan(actionedUponNodeRef); + if(targetisUnfiledRecords && (context != null) && getNodeService().exists(context)) + { + context = filePlanService.getUnfiledContainer(context); + } + if((context == null) || (!getNodeService().exists(context))) + { + throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the path resolution context could not be determined."); + } + return context; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyToAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyToAction.java index cde6b6bf4b..71ff1675b9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyToAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyToAction.java @@ -1,47 +1,47 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -/** - * File To action implementation. - * - * @author Mark Hibbins - * @since 2.2 - */ -public class CopyToAction extends CopyMoveLinkFileToBaseAction -{ - /** action name */ - public static final String NAME = "copyTo"; - - @Override - public void init() - { - super.init(); - setMode(CopyMoveLinkFileToActionMode.COPY); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +/** + * File To action implementation. + * + * @author Mark Hibbins + * @since 2.2 + */ +public class CopyToAction extends CopyMoveLinkFileToBaseAction +{ + /** action name */ + public static final String NAME = "copyTo"; + + @Override + public void init() + { + super.init(); + setMode(CopyMoveLinkFileToActionMode.COPY); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java index e13c788e5b..9f46d73b59 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java @@ -1,94 +1,94 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Create disposition schedule action - * - * @author Roy Wetherall - */ -public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_NODE_NOT_RECORD_CATEGORY = "rm.action.node-not-record-category"; - - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (eligibleForAction(actionedUponNodeRef)) - { - // Create the disposition schedule - getDispositionService().createDispositionSchedule(actionedUponNodeRef, null); - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_NOT_RECORD_CATEGORY, actionedUponNodeRef)); - } - } - - /** - * Helper method to check the actioned upon node reference to decide to execute the action - * The preconditions are: - * - The node must exist - * - The node must not be a record category - * - * @param actionedUponNodeRef node reference - * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise - */ - private boolean eligibleForAction(NodeRef actionedUponNodeRef) - { - boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && - filePlanService.isRecordCategory(actionedUponNodeRef)) - { - result = true; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Create disposition schedule action + * + * @author Roy Wetherall + */ +public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_NODE_NOT_RECORD_CATEGORY = "rm.action.node-not-record-category"; + + /** file plan service */ + private FilePlanService filePlanService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (eligibleForAction(actionedUponNodeRef)) + { + // Create the disposition schedule + getDispositionService().createDispositionSchedule(actionedUponNodeRef, null); + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_NOT_RECORD_CATEGORY, actionedUponNodeRef)); + } + } + + /** + * Helper method to check the actioned upon node reference to decide to execute the action + * The preconditions are: + * - The node must exist + * - The node must not be a record category + * + * @param actionedUponNodeRef node reference + * @return Return true if the node reference passes all the preconditions for executing the action, false otherwise + */ + private boolean eligibleForAction(NodeRef actionedUponNodeRef) + { + boolean result = false; + if (getNodeService().exists(actionedUponNodeRef) && + filePlanService.isRecordCategory(actionedUponNodeRef)) + { + result = true; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java index 414e870135..8970b55696 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java @@ -1,98 +1,98 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Cut off disposition action - * - * @author Roy Wetherall - */ -public class CutOffAction extends RMDispositionActionExecuterAbstractBase -{ - /** Action name */ - public static final String NAME = "cutoff"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) - { - if(checkUncutOffStatus(action, recordFolder)) - { - // Mark the folder as cut off - getDispositionService().cutoffDisposableItem(recordFolder); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordLevelDisposition(Action action, NodeRef record) - { - if(checkUncutOffStatus(action, record)) - { - // Mark the record as cut off - getDispositionService().cutoffDisposableItem(record); - } - } - - /** - * Check if the record or folder has been uncut off. If it has and this cut off action is an - * automated disposition action then the cut off isn't run. If it has and this is a manual - * cut off action then the uncut off aspect is removed prior to the uncut action. - * - * @param action The cut off action - * @param recordOrFolder The record or folder to be cut off - * @return True if the record or folder can be cut off - */ - private boolean checkUncutOffStatus(Action action, NodeRef recordOrFolder) - { - boolean okToCutOff = true; - if(getNodeService().hasAspect(recordOrFolder, ASPECT_UNCUT_OFF)) - { - if(action.getParameterValue(PARAM_NO_ERROR_CHECK) != null) - { - // this exception stops the cut off disposition schedule action taking place and because we're - // running from the schedule (PARAM_NO_ERROR_CHECK is set) then the exception will not be reported - throw new AlfrescoRuntimeException("Cannot cut off from schedule when uncut off aspect is present"); - } - else - { - getNodeService().removeAspect(recordOrFolder, ASPECT_UNCUT_OFF); - } - } - return okToCutOff; - } - } +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Cut off disposition action + * + * @author Roy Wetherall + */ +public class CutOffAction extends RMDispositionActionExecuterAbstractBase +{ + /** Action name */ + public static final String NAME = "cutoff"; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) + { + if(checkUncutOffStatus(action, recordFolder)) + { + // Mark the folder as cut off + getDispositionService().cutoffDisposableItem(recordFolder); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeRecordLevelDisposition(Action action, NodeRef record) + { + if(checkUncutOffStatus(action, record)) + { + // Mark the record as cut off + getDispositionService().cutoffDisposableItem(record); + } + } + + /** + * Check if the record or folder has been uncut off. If it has and this cut off action is an + * automated disposition action then the cut off isn't run. If it has and this is a manual + * cut off action then the uncut off aspect is removed prior to the uncut action. + * + * @param action The cut off action + * @param recordOrFolder The record or folder to be cut off + * @return True if the record or folder can be cut off + */ + private boolean checkUncutOffStatus(Action action, NodeRef recordOrFolder) + { + boolean okToCutOff = true; + if(getNodeService().hasAspect(recordOrFolder, ASPECT_UNCUT_OFF)) + { + if(action.getParameterValue(PARAM_NO_ERROR_CHECK) != null) + { + // this exception stops the cut off disposition schedule action taking place and because we're + // running from the schedule (PARAM_NO_ERROR_CHECK is set) then the exception will not be reported + throw new AlfrescoRuntimeException("Cannot cut off from schedule when uncut off aspect is present"); + } + else + { + getNodeService().removeAspect(recordOrFolder, ASPECT_UNCUT_OFF); + } + } + return okToCutOff; + } + } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java index fc3b85c7da..feb2e5a0dc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java @@ -1,215 +1,215 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Declare record action - * - * @author Roy Wetherall - */ -public class DeclareRecordAction extends RMActionExecuterAbstractBase -{ - /** action name */ - public static final String NAME = "declareRecord"; - - /** I18N */ - private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records"; - private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop"; - - /** Logger */ - private static Log logger = LogFactory.getLog(DeclareRecordAction.class); - - /** check mandatory properties */ - private boolean checkMandatoryPropertiesEnabled = true; - - /** - * @param checkMandatoryPropertiesEnabled true if check mandatory properties is enabled, false otherwise - */ - public void setCheckMandatoryPropertiesEnabled(boolean checkMandatoryPropertiesEnabled) - { - this.checkMandatoryPropertiesEnabled = checkMandatoryPropertiesEnabled; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) - { - if (getNodeService().exists(actionedUponNodeRef) && - getRecordService().isRecord(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef)) - { - if (!getRecordService().isDeclared(actionedUponNodeRef)) - { - List missingProperties = new ArrayList(5); - // Aspect not already defined - check mandatory properties then add - if (!checkMandatoryPropertiesEnabled || - mandatoryPropertiesSet(actionedUponNodeRef, missingProperties)) - { - getRecordService().disablePropertyEditableCheck(); - try - { - // Add the declared aspect - Map declaredProps = new HashMap(2); - declaredProps.put(PROP_DECLARED_AT, new Date()); - declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser()); - this.getNodeService().addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps); - - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // remove all owner related rights - getOwnableService().setOwner(actionedUponNodeRef, OwnableService.NO_OWNER); - return null; - } - }); - } - finally - { - getRecordService().enablePropertyEditableCheck(); - } - } - else - { - logger.debug(buildMissingPropertiesErrorString(missingProperties)); - action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, "missingProperties"); - } - } - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString())); - } - } - } - - private String buildMissingPropertiesErrorString(List missingProperties) - { - StringBuilder builder = new StringBuilder(255); - builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP)); - builder.append(" "); - for (String missingProperty : missingProperties) - { - builder.append(missingProperty).append(", "); - } - return builder.toString(); - } - - /** - * Helper method to check whether all the mandatory properties of the node have been set - * - * @param nodeRef node reference - * @return boolean true if all mandatory properties are set, false otherwise - */ - private boolean mandatoryPropertiesSet(NodeRef nodeRef, List missingProperties) - { - boolean result = true; - - Map nodeRefProps = this.getNodeService().getProperties(nodeRef); - - QName nodeRefType = this.getNodeService().getType(nodeRef); - - TypeDefinition typeDef = this.getDictionaryService().getType(nodeRefType); - for (PropertyDefinition propDef : typeDef.getProperties().values()) - { - if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null) - { - logMissingProperty(propDef, missingProperties); - - result = false; - break; - } - } - - if (result) - { - Set aspects = this.getNodeService().getAspects(nodeRef); - for (QName aspect : aspects) - { - AspectDefinition aspectDef = this.getDictionaryService().getAspect(aspect); - for (PropertyDefinition propDef : aspectDef.getProperties().values()) - { - if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null) - { - logMissingProperty(propDef, missingProperties); - - result = false; - break; - } - } - } - } - - return result; - } - - /** - * Log information about missing properties. - * - * @param propDef property definition - * @param missingProperties missing properties - */ - private void logMissingProperty(PropertyDefinition propDef, List missingProperties) - { - if (logger.isWarnEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Mandatory property missing: ").append(propDef.getName()); - logger.warn(msg.toString()); - } - missingProperties.add(propDef.getName().toString()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.dictionary.TypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Declare record action + * + * @author Roy Wetherall + */ +public class DeclareRecordAction extends RMActionExecuterAbstractBase +{ + /** action name */ + public static final String NAME = "declareRecord"; + + /** I18N */ + private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records"; + private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop"; + + /** Logger */ + private static Log logger = LogFactory.getLog(DeclareRecordAction.class); + + /** check mandatory properties */ + private boolean checkMandatoryPropertiesEnabled = true; + + /** + * @param checkMandatoryPropertiesEnabled true if check mandatory properties is enabled, false otherwise + */ + public void setCheckMandatoryPropertiesEnabled(boolean checkMandatoryPropertiesEnabled) + { + this.checkMandatoryPropertiesEnabled = checkMandatoryPropertiesEnabled; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) + { + if (getNodeService().exists(actionedUponNodeRef) && + getRecordService().isRecord(actionedUponNodeRef) && + !getFreezeService().isFrozen(actionedUponNodeRef)) + { + if (!getRecordService().isDeclared(actionedUponNodeRef)) + { + List missingProperties = new ArrayList(5); + // Aspect not already defined - check mandatory properties then add + if (!checkMandatoryPropertiesEnabled || + mandatoryPropertiesSet(actionedUponNodeRef, missingProperties)) + { + getRecordService().disablePropertyEditableCheck(); + try + { + // Add the declared aspect + Map declaredProps = new HashMap(2); + declaredProps.put(PROP_DECLARED_AT, new Date()); + declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser()); + this.getNodeService().addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps); + + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // remove all owner related rights + getOwnableService().setOwner(actionedUponNodeRef, OwnableService.NO_OWNER); + return null; + } + }); + } + finally + { + getRecordService().enablePropertyEditableCheck(); + } + } + else + { + logger.debug(buildMissingPropertiesErrorString(missingProperties)); + action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, "missingProperties"); + } + } + } + else + { + if (logger.isWarnEnabled()) + { + logger.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString())); + } + } + } + + private String buildMissingPropertiesErrorString(List missingProperties) + { + StringBuilder builder = new StringBuilder(255); + builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP)); + builder.append(" "); + for (String missingProperty : missingProperties) + { + builder.append(missingProperty).append(", "); + } + return builder.toString(); + } + + /** + * Helper method to check whether all the mandatory properties of the node have been set + * + * @param nodeRef node reference + * @return boolean true if all mandatory properties are set, false otherwise + */ + private boolean mandatoryPropertiesSet(NodeRef nodeRef, List missingProperties) + { + boolean result = true; + + Map nodeRefProps = this.getNodeService().getProperties(nodeRef); + + QName nodeRefType = this.getNodeService().getType(nodeRef); + + TypeDefinition typeDef = this.getDictionaryService().getType(nodeRefType); + for (PropertyDefinition propDef : typeDef.getProperties().values()) + { + if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null) + { + logMissingProperty(propDef, missingProperties); + + result = false; + break; + } + } + + if (result) + { + Set aspects = this.getNodeService().getAspects(nodeRef); + for (QName aspect : aspects) + { + AspectDefinition aspectDef = this.getDictionaryService().getAspect(aspect); + for (PropertyDefinition propDef : aspectDef.getProperties().values()) + { + if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null) + { + logMissingProperty(propDef, missingProperties); + + result = false; + break; + } + } + } + } + + return result; + } + + /** + * Log information about missing properties. + * + * @param propDef property definition + * @param missingProperties missing properties + */ + private void logMissingProperty(PropertyDefinition propDef, List missingProperties) + { + if (logger.isWarnEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Mandatory property missing: ").append(propDef.getName()); + logger.warn(msg.toString()); + } + missingProperties.add(propDef.getName().toString()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java index 1531957ad7..e39f197f2e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java @@ -1,104 +1,104 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.executer.ActionExecuter; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Records management action who's implementation is delegated to an existing Action. - *

- * Useful for creating a RM version of an existing action implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class DelegateAction extends RMActionExecuterAbstractBase -{ - /** Delegate action executer*/ - private ActionExecuter delegateActionExecuter; - - /** should we check whether the node is frozen */ - private boolean checkFrozen = false; - - /** - * @param delegateActionExecuter delegate action executer - */ - public void setDelegateAction(ActionExecuter delegateActionExecuter) - { - this.delegateActionExecuter = delegateActionExecuter; - } - - /** - * @param checkFrozen true if we check whether the actioned upon node reference is frozen, false otherwise - */ - public void setCheckFrozen(boolean checkFrozen) - { - this.checkFrozen = checkFrozen; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getNodeService().exists(actionedUponNodeRef) && - (!checkFrozen || !getFreezeService().isFrozen(actionedUponNodeRef))) - { - // do the property subs (if any exist) - if (isAllowParameterSubstitutions()) - { - getParameterProcessorComponent().process(action, delegateActionExecuter.getActionDefinition(), actionedUponNodeRef); - } - - delegateActionExecuter.execute(action, actionedUponNodeRef); - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#getParameterDefintions() - */ - @Override - protected List getParameterDefintions() - { - return delegateActionExecuter.getActionDefinition().getParameterDefinitions(); - } - - @Override - protected void addParameterDefinitions(List paramList) - { - super.addParameterDefinitions(paramList); - paramList.addAll(delegateActionExecuter.getActionDefinition().getParameterDefinitions()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.executer.ActionExecuter; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Records management action who's implementation is delegated to an existing Action. + *

+ * Useful for creating a RM version of an existing action implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class DelegateAction extends RMActionExecuterAbstractBase +{ + /** Delegate action executer*/ + private ActionExecuter delegateActionExecuter; + + /** should we check whether the node is frozen */ + private boolean checkFrozen = false; + + /** + * @param delegateActionExecuter delegate action executer + */ + public void setDelegateAction(ActionExecuter delegateActionExecuter) + { + this.delegateActionExecuter = delegateActionExecuter; + } + + /** + * @param checkFrozen true if we check whether the actioned upon node reference is frozen, false otherwise + */ + public void setCheckFrozen(boolean checkFrozen) + { + this.checkFrozen = checkFrozen; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getNodeService().exists(actionedUponNodeRef) && + (!checkFrozen || !getFreezeService().isFrozen(actionedUponNodeRef))) + { + // do the property subs (if any exist) + if (isAllowParameterSubstitutions()) + { + getParameterProcessorComponent().process(action, delegateActionExecuter.getActionDefinition(), actionedUponNodeRef); + } + + delegateActionExecuter.execute(action, actionedUponNodeRef); + } + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#getParameterDefintions() + */ + @Override + protected List getParameterDefintions() + { + return delegateActionExecuter.getActionDefinition().getParameterDefinitions(); + } + + @Override + protected void addParameterDefinitions(List paramList) + { + super.addParameterDefinitions(paramList); + paramList.addAll(delegateActionExecuter.getActionDefinition().getParameterDefinitions()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java index 63680b9de9..556bd5c455 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Delete Hold Action - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class DeleteHoldAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_DELETE_NOT_HOLD_TYPE = "rm.action.delete-not-hold-type"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getHoldService().isHold(actionedUponNodeRef)) - { - getHoldService().deleteHold(actionedUponNodeRef); - } - else - { - throw new AlfrescoRuntimeException(MSG_DELETE_NOT_HOLD_TYPE, new Object[]{ TYPE_HOLD.toString(), actionedUponNodeRef.toString() }); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Delete Hold Action + * + * @author Tuna Aksoy + * @since 2.2 + * @version 1.0 + */ +public class DeleteHoldAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_DELETE_NOT_HOLD_TYPE = "rm.action.delete-not-hold-type"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getHoldService().isHold(actionedUponNodeRef)) + { + getHoldService().deleteHold(actionedUponNodeRef); + } + else + { + throw new AlfrescoRuntimeException(MSG_DELETE_NOT_HOLD_TYPE, new Object[]{ TYPE_HOLD.toString(), actionedUponNodeRef.toString() }); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java index 0835e60768..3a35dd2713 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java @@ -1,231 +1,231 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.io.Serializable; -import java.util.Collections; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.content.ContentDestructionComponent; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang.StringUtils; - -/** - * Destroy action. - * - * @author Roy Wetherall - */ -public class DestroyAction extends RMDispositionActionExecuterAbstractBase -{ - /** Action name */ - public static final String NAME = "destroy"; - - /** content destruction component */ - private ContentDestructionComponent contentDestructionComponent; - - /** Capability service */ - private CapabilityService capabilityService; - - /** Recordable version service */ - private RecordableVersionService recordableVersionService; - - /** Inplace record service */ - private InplaceRecordService inplaceRecordService; - - /** Indicates if ghosting is enabled or not */ - private boolean ghostingEnabled = true; - - /** - * @param contentDestructionComponent content destruction component - */ - public void setContentDestructionComponent(ContentDestructionComponent contentDestructionComponent) - { - this.contentDestructionComponent = contentDestructionComponent; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param recordableVersionService recordable version service - */ - public void setRecordableVersionService(RecordableVersionService recordableVersionService) - { - this.recordableVersionService = recordableVersionService; - } - - /** - * @param inplaceRecordService inplace record service - */ - public void setInplaceRecordService(InplaceRecordService inplaceRecordService) - { - this.inplaceRecordService = inplaceRecordService; - } - - /** - * @param ghostingEnabled true if ghosting is enabled, false otherwise - */ - public void setGhostingEnabled(boolean ghostingEnabled) - { - this.ghostingEnabled = ghostingEnabled; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#checkNextDispositionAction(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean checkNextDispositionAction(NodeRef actionedUponNodeRef) - { - return checkForDestroyRecordsCapability(actionedUponNodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#checkEligibility(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean checkEligibility(NodeRef actionedUponNodeRef) - { - return checkForDestroyRecordsCapability(actionedUponNodeRef); - } - - /** - * - * @param actionedUponNodeRef - * @return - */ - private boolean checkForDestroyRecordsCapability(NodeRef actionedUponNodeRef) - { - boolean result = true; - if (AccessStatus.ALLOWED.equals(capabilityService.getCapability("DestroyRecords").hasPermission(actionedUponNodeRef))) - { - result = false; - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) - { - List records = getRecordService().getRecords(recordFolder); - for (NodeRef record : records) - { - executeRecordLevelDisposition(action, record); - } - if (isGhostOnDestroySetForAction(action, recordFolder)) - { - // add aspect - getNodeService().addAspect(recordFolder, ASPECT_GHOSTED, Collections. emptyMap()); - } - else - { - // just delete the node - getNodeService().deleteNode(recordFolder); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordLevelDisposition(Action action, NodeRef record) - { - if (isGhostOnDestroySetForAction(action, record)) - { - // mark version as destroyed - Version version = recordableVersionService.getRecordedVersion(record); - if (version != null) - { - recordableVersionService.destroyRecordedVersion(version); - } - - // Add the ghosted aspect - getNodeService().addAspect(record, ASPECT_GHOSTED, null); - - // Hide from inplace users to give the impression of destruction - inplaceRecordService.hideRecord(record); - - // destroy content - contentDestructionComponent.destroyContent(record); - } - else - { - // just delete the node - getNodeService().deleteNode(record); - } - } - - /** - * Return true if the ghost on destroy property is set against the - * definition for the passed action on the specified node - * - * @param action - * @param nodeRef - * @return - */ - private boolean isGhostOnDestroySetForAction(Action action, NodeRef nodeRef) - { - boolean ghostOnDestroy = this.ghostingEnabled; - String actionDefinitionName = action.getActionDefinitionName(); - if (!StringUtils.isEmpty(actionDefinitionName)) - { - DispositionSchedule dispositionSchedule = this.getDispositionService().getDispositionSchedule(nodeRef); - if (dispositionSchedule != null) - { - DispositionActionDefinition actionDefinition = dispositionSchedule - .getDispositionActionDefinitionByName(actionDefinitionName); - if (actionDefinition != null) - { - String ghostOnDestroyProperty = actionDefinition.getGhostOnDestroy(); - if (ghostOnDestroyProperty != null) - { - ghostOnDestroy = "ghost".equals(actionDefinition.getGhostOnDestroy()); - } - } - } - } - return ghostOnDestroy; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.io.Serializable; +import java.util.Collections; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.content.ContentDestructionComponent; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.namespace.QName; +import org.apache.commons.lang.StringUtils; + +/** + * Destroy action. + * + * @author Roy Wetherall + */ +public class DestroyAction extends RMDispositionActionExecuterAbstractBase +{ + /** Action name */ + public static final String NAME = "destroy"; + + /** content destruction component */ + private ContentDestructionComponent contentDestructionComponent; + + /** Capability service */ + private CapabilityService capabilityService; + + /** Recordable version service */ + private RecordableVersionService recordableVersionService; + + /** Inplace record service */ + private InplaceRecordService inplaceRecordService; + + /** Indicates if ghosting is enabled or not */ + private boolean ghostingEnabled = true; + + /** + * @param contentDestructionComponent content destruction component + */ + public void setContentDestructionComponent(ContentDestructionComponent contentDestructionComponent) + { + this.contentDestructionComponent = contentDestructionComponent; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param recordableVersionService recordable version service + */ + public void setRecordableVersionService(RecordableVersionService recordableVersionService) + { + this.recordableVersionService = recordableVersionService; + } + + /** + * @param inplaceRecordService inplace record service + */ + public void setInplaceRecordService(InplaceRecordService inplaceRecordService) + { + this.inplaceRecordService = inplaceRecordService; + } + + /** + * @param ghostingEnabled true if ghosting is enabled, false otherwise + */ + public void setGhostingEnabled(boolean ghostingEnabled) + { + this.ghostingEnabled = ghostingEnabled; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#checkNextDispositionAction(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected boolean checkNextDispositionAction(NodeRef actionedUponNodeRef) + { + return checkForDestroyRecordsCapability(actionedUponNodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#checkEligibility(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected boolean checkEligibility(NodeRef actionedUponNodeRef) + { + return checkForDestroyRecordsCapability(actionedUponNodeRef); + } + + /** + * + * @param actionedUponNodeRef + * @return + */ + private boolean checkForDestroyRecordsCapability(NodeRef actionedUponNodeRef) + { + boolean result = true; + if (AccessStatus.ALLOWED.equals(capabilityService.getCapability("DestroyRecords").hasPermission(actionedUponNodeRef))) + { + result = false; + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) + { + List records = getRecordService().getRecords(recordFolder); + for (NodeRef record : records) + { + executeRecordLevelDisposition(action, record); + } + if (isGhostOnDestroySetForAction(action, recordFolder)) + { + // add aspect + getNodeService().addAspect(recordFolder, ASPECT_GHOSTED, Collections. emptyMap()); + } + else + { + // just delete the node + getNodeService().deleteNode(recordFolder); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeRecordLevelDisposition(Action action, NodeRef record) + { + if (isGhostOnDestroySetForAction(action, record)) + { + // mark version as destroyed + Version version = recordableVersionService.getRecordedVersion(record); + if (version != null) + { + recordableVersionService.destroyRecordedVersion(version); + } + + // Add the ghosted aspect + getNodeService().addAspect(record, ASPECT_GHOSTED, null); + + // Hide from inplace users to give the impression of destruction + inplaceRecordService.hideRecord(record); + + // destroy content + contentDestructionComponent.destroyContent(record); + } + else + { + // just delete the node + getNodeService().deleteNode(record); + } + } + + /** + * Return true if the ghost on destroy property is set against the + * definition for the passed action on the specified node + * + * @param action + * @param nodeRef + * @return + */ + private boolean isGhostOnDestroySetForAction(Action action, NodeRef nodeRef) + { + boolean ghostOnDestroy = this.ghostingEnabled; + String actionDefinitionName = action.getActionDefinitionName(); + if (!StringUtils.isEmpty(actionDefinitionName)) + { + DispositionSchedule dispositionSchedule = this.getDispositionService().getDispositionSchedule(nodeRef); + if (dispositionSchedule != null) + { + DispositionActionDefinition actionDefinition = dispositionSchedule + .getDispositionActionDefinitionByName(actionDefinitionName); + if (actionDefinition != null) + { + String ghostOnDestroyProperty = actionDefinition.getGhostOnDestroy(); + if (ghostOnDestroyProperty != null) + { + ghostOnDestroy = "ghost".equals(actionDefinition.getGhostOnDestroy()); + } + } + } + } + return ghostOnDestroy; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java index 071b3a2da2..f1aa942dd5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java @@ -1,84 +1,84 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.Date; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Edit review as of date action. - * - * @author Roy Wetherall - */ -public class EditDispositionActionAsOfDateAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_VALID_DATE_DISP_ASOF = "rm.action.valid-date-disp-asof"; - private static final String MSG_DISP_ASOF_LIFECYCLE_APPLIED = "rm.action.disp-asof-lifecycle-applied"; - - /** Action name */ - public static final String NAME = "editDispositionActionAsOfDate"; - - /** Action parameters */ - public static final String PARAM_AS_OF_DATE = "asOfDate"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - // Get the action parameter - Date asOfDate = (Date)action.getParameterValue(PARAM_AS_OF_DATE); - if (asOfDate == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_VALID_DATE_DISP_ASOF)); - } - - // Set the dispostion action as of date - DispositionAction da = getDispositionService().getNextDispositionAction(actionedUponNodeRef); - if (da != null) - { - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DISP_ASOF_LIFECYCLE_APPLIED)); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.Date; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Edit review as of date action. + * + * @author Roy Wetherall + */ +public class EditDispositionActionAsOfDateAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_VALID_DATE_DISP_ASOF = "rm.action.valid-date-disp-asof"; + private static final String MSG_DISP_ASOF_LIFECYCLE_APPLIED = "rm.action.disp-asof-lifecycle-applied"; + + /** Action name */ + public static final String NAME = "editDispositionActionAsOfDate"; + + /** Action parameters */ + public static final String PARAM_AS_OF_DATE = "asOfDate"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + { + // Get the action parameter + Date asOfDate = (Date)action.getParameterValue(PARAM_AS_OF_DATE); + if (asOfDate == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_VALID_DATE_DISP_ASOF)); + } + + // Set the dispostion action as of date + DispositionAction da = getDispositionService().getNextDispositionAction(actionedUponNodeRef); + if (da != null) + { + getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate); + } + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DISP_ASOF_LIFECYCLE_APPLIED)); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java index 7f686b04dc..d16361c734 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Edit freeze reason Action - * - * @author Roy Wetherall - */ -public class EditHoldReasonAction extends RMActionExecuterAbstractBase -{ - private static final String MSG_HOLD_EDIT_REASON_NONE = "rm.action.hold-edit-reason-none"; - private static final String MSG_HOLD_EDIT_TYPE = "rm.action.hold-edit-type"; - - /** Parameter names */ - public static final String PARAM_REASON = "reason"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("deprecation") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getFreezeService().isHold(actionedUponNodeRef)) - { - // Get the property values - String reason = (String) action.getParameterValue(PARAM_REASON); - if (StringUtils.isBlank(reason)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_HOLD_EDIT_REASON_NONE)); - } - - // Update hold reason - getFreezeService().updateReason(actionedUponNodeRef, reason); - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_HOLD_EDIT_TYPE, TYPE_HOLD.toString(), actionedUponNodeRef.toString())); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Edit freeze reason Action + * + * @author Roy Wetherall + */ +public class EditHoldReasonAction extends RMActionExecuterAbstractBase +{ + private static final String MSG_HOLD_EDIT_REASON_NONE = "rm.action.hold-edit-reason-none"; + private static final String MSG_HOLD_EDIT_TYPE = "rm.action.hold-edit-type"; + + /** Parameter names */ + public static final String PARAM_REASON = "reason"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("deprecation") + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getFreezeService().isHold(actionedUponNodeRef)) + { + // Get the property values + String reason = (String) action.getParameterValue(PARAM_REASON); + if (StringUtils.isBlank(reason)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_HOLD_EDIT_REASON_NONE)); + } + + // Update hold reason + getFreezeService().updateReason(actionedUponNodeRef, reason); + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_HOLD_EDIT_TYPE, TYPE_HOLD.toString(), actionedUponNodeRef.toString())); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java index 664771f6fd..306975b864 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java @@ -1,78 +1,78 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.Date; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * - * Edit review as of date action - * - * @author Roy Wetherall - */ -public class EditReviewAsOfDateAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_SPECIFY_VALID_DATE = "rm.action.specify-avlid-date"; - private static final String MSG_REVIEW_DETAILS_ONLY = "rm.action.review-details-only"; - - public static final String PARAM_AS_OF_DATE = "asOfDate"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getRecordService().isRecord(actionedUponNodeRef) && - getNodeService().hasAspect(actionedUponNodeRef, ASPECT_VITAL_RECORD)) - { - // Get the action parameter - Date reviewAsOf = (Date)action.getParameterValue(PARAM_AS_OF_DATE); - if (reviewAsOf == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SPECIFY_VALID_DATE)); - } - - // Set the as of date - this.getNodeService().setProperty(actionedUponNodeRef, PROP_REVIEW_AS_OF, reviewAsOf); - - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_REVIEW_DETAILS_ONLY)); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.Date; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * + * Edit review as of date action + * + * @author Roy Wetherall + */ +public class EditReviewAsOfDateAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_SPECIFY_VALID_DATE = "rm.action.specify-avlid-date"; + private static final String MSG_REVIEW_DETAILS_ONLY = "rm.action.review-details-only"; + + public static final String PARAM_AS_OF_DATE = "asOfDate"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getRecordService().isRecord(actionedUponNodeRef) && + getNodeService().hasAspect(actionedUponNodeRef, ASPECT_VITAL_RECORD)) + { + // Get the action parameter + Date reviewAsOf = (Date)action.getParameterValue(PARAM_AS_OF_DATE); + if (reviewAsOf == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SPECIFY_VALID_DATE)); + } + + // Set the as of date + this.getNodeService().setProperty(actionedUponNodeRef, PROP_REVIEW_AS_OF, reviewAsOf); + + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_REVIEW_DETAILS_ONLY)); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java index 077620e241..a4af5eeea2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java @@ -1,200 +1,200 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; -import org.alfresco.module.org_alfresco_module_rm.report.ReportService; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * File report generic action. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class FileReportAction extends RMActionExecuterAbstractBase implements ReportModel -{ - /** action name */ - public static final String NAME = "fileReport"; - - /** Constants for the parameters passed from the UI */ - public static final String REPORT_TYPE = "reportType"; - - public static final String DESTINATION = "destination"; - - public static final String MIMETYPE = "mimetype"; - - /** I18N */ - private static final String MSG_PARAM_NOT_SUPPLIED = "rm.action.parameter-not-supplied"; - - /** Report service */ - private ReportService reportService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * @return Report service - */ - protected ReportService getReportService() - { - return this.reportService; - } - - /** - * @return Capability service - */ - protected CapabilityService getCapabilityService() - { - return this.capabilityService; - } - - /** - * @param reportService report service - */ - public void setReportService(ReportService reportService) - { - this.reportService = reportService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - // get the mimetype of the report - String mimetype = (String) action.getParameterValue(MIMETYPE); - if (mimetype == null || mimetype.isEmpty()) - { - mimetype = MimetypeMap.MIMETYPE_HTML; - } - - // get the report type - QName reportType = getReportType(action); - - // get the destination - final NodeRef destination = getDestination(action); - - // Check the filing permission only capability for the destination - checkFilingPermissionOnlyCapability(destination); - - // generate the report - final Report report = getReportService().generateReport(reportType, actionedUponNodeRef, mimetype); - - // file the report as system - NodeRef filedReport = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return getReportService().fileReport(destination, report); - } - }); - - // return the report name - String filedReportName = (String) getNodeService().getProperty(filedReport, ContentModel.PROP_NAME); - action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, filedReportName); - } - - /** - * Checks if the destination is frozen, closed, cut off or not. In case if it is an exception will be thrown. - * - * @param nodeRef The destination node reference for which the capability should be checked - */ - private void checkFilingPermissionOnlyCapability(NodeRef nodeRef) - { - if (AccessStatus.DENIED.equals(capabilityService.getCapability("FillingPermissionOnly").hasPermission(nodeRef))) - { - throw new AlfrescoRuntimeException("You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"); - } - } - - /** - * Retrieves the value of the given parameter. If the parameter has not been - * passed from the UI an error will be thrown - * - * @param action The action - * @param parameter The parameter for which the value should be retrieved - * @return The value of the given parameter - */ - private String getParameterValue(Action action, String parameter) - { - String paramValue = (String) action.getParameterValue(parameter); - if (StringUtils.isBlank(paramValue)) { throw new AlfrescoRuntimeException(I18NUtil.getMessage( - MSG_PARAM_NOT_SUPPLIED, parameter)); } - return paramValue; - } - - /** - * Helper method for getting the destination. - * - * @param action The action - * @return The file plan node reference - */ - private NodeRef getDestination(Action action) - { - String destination = getParameterValue(action, DESTINATION); - return new NodeRef(destination); - } - - /** - * Helper method for getting the report type. - * - * @param action The action - * @return The report type - */ - private QName getReportType(Action action) - { - String reportType = getParameterValue(action, REPORT_TYPE); - return QName.createQName(reportType, getNamespaceService()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.report.Report; +import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; +import org.alfresco.module.org_alfresco_module_rm.report.ReportService; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.QName; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * File report generic action. + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class FileReportAction extends RMActionExecuterAbstractBase implements ReportModel +{ + /** action name */ + public static final String NAME = "fileReport"; + + /** Constants for the parameters passed from the UI */ + public static final String REPORT_TYPE = "reportType"; + + public static final String DESTINATION = "destination"; + + public static final String MIMETYPE = "mimetype"; + + /** I18N */ + private static final String MSG_PARAM_NOT_SUPPLIED = "rm.action.parameter-not-supplied"; + + /** Report service */ + private ReportService reportService; + + /** Capability service */ + private CapabilityService capabilityService; + + /** + * @return Report service + */ + protected ReportService getReportService() + { + return this.reportService; + } + + /** + * @return Capability service + */ + protected CapabilityService getCapabilityService() + { + return this.capabilityService; + } + + /** + * @param reportService report service + */ + public void setReportService(ReportService reportService) + { + this.reportService = reportService; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + // get the mimetype of the report + String mimetype = (String) action.getParameterValue(MIMETYPE); + if (mimetype == null || mimetype.isEmpty()) + { + mimetype = MimetypeMap.MIMETYPE_HTML; + } + + // get the report type + QName reportType = getReportType(action); + + // get the destination + final NodeRef destination = getDestination(action); + + // Check the filing permission only capability for the destination + checkFilingPermissionOnlyCapability(destination); + + // generate the report + final Report report = getReportService().generateReport(reportType, actionedUponNodeRef, mimetype); + + // file the report as system + NodeRef filedReport = AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public NodeRef doWork() + { + return getReportService().fileReport(destination, report); + } + }); + + // return the report name + String filedReportName = (String) getNodeService().getProperty(filedReport, ContentModel.PROP_NAME); + action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, filedReportName); + } + + /** + * Checks if the destination is frozen, closed, cut off or not. In case if it is an exception will be thrown. + * + * @param nodeRef The destination node reference for which the capability should be checked + */ + private void checkFilingPermissionOnlyCapability(NodeRef nodeRef) + { + if (AccessStatus.DENIED.equals(capabilityService.getCapability("FillingPermissionOnly").hasPermission(nodeRef))) + { + throw new AlfrescoRuntimeException("You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"); + } + } + + /** + * Retrieves the value of the given parameter. If the parameter has not been + * passed from the UI an error will be thrown + * + * @param action The action + * @param parameter The parameter for which the value should be retrieved + * @return The value of the given parameter + */ + private String getParameterValue(Action action, String parameter) + { + String paramValue = (String) action.getParameterValue(parameter); + if (StringUtils.isBlank(paramValue)) { throw new AlfrescoRuntimeException(I18NUtil.getMessage( + MSG_PARAM_NOT_SUPPLIED, parameter)); } + return paramValue; + } + + /** + * Helper method for getting the destination. + * + * @param action The action + * @return The file plan node reference + */ + private NodeRef getDestination(Action action) + { + String destination = getParameterValue(action, DESTINATION); + return new NodeRef(destination); + } + + /** + * Helper method for getting the report type. + * + * @param action The action + * @return The report type + */ + private QName getReportType(Action action) + { + String reportType = getParameterValue(action, REPORT_TYPE); + return QName.createQName(reportType, getNamespaceService()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java index 0b750b6517..ec76f3a70c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java @@ -1,47 +1,47 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -/** - * File To action implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FileToAction extends CopyMoveLinkFileToBaseAction -{ - /** action name */ - public static final String NAME = "fileTo"; - - @Override - public void init() - { - super.init(); - setMode(CopyMoveLinkFileToActionMode.MOVE); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +/** + * File To action implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class FileToAction extends CopyMoveLinkFileToBaseAction +{ + /** action name */ + public static final String NAME = "fileTo"; + + @Override + public void init() + { + super.init(); + setMode(CopyMoveLinkFileToActionMode.MOVE); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java index c5439236d8..f4b753bcee 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java @@ -1,76 +1,76 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Freeze Action - * - * @author Roy Wetherall - */ -public class FreezeAction extends RMActionExecuterAbstractBase -{ - /** Parameter names */ - public static final String PARAM_REASON = "reason"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_REASON, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REASON))); - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("deprecation") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - // NOTE: we can only freeze records and record folders so ignore everything else - if (getNodeService().exists(actionedUponNodeRef) && - !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && - (getRecordService().isRecord(actionedUponNodeRef) || - getRecordFolderService().isRecordFolder(actionedUponNodeRef)) && - !getFreezeService().isFrozen(actionedUponNodeRef)) - { - getFreezeService().freeze((String) action.getParameterValue(PARAM_REASON), actionedUponNodeRef); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Freeze Action + * + * @author Roy Wetherall + */ +public class FreezeAction extends RMActionExecuterAbstractBase +{ + /** Parameter names */ + public static final String PARAM_REASON = "reason"; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_REASON, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REASON))); + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("deprecation") + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + // NOTE: we can only freeze records and record folders so ignore everything else + if (getNodeService().exists(actionedUponNodeRef) && + !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && + (getRecordService().isRecord(actionedUponNodeRef) || + getRecordFolderService().isRecordFolder(actionedUponNodeRef)) && + !getFreezeService().isFrozen(actionedUponNodeRef)) + { + getFreezeService().freeze((String) action.getParameterValue(PARAM_REASON), actionedUponNodeRef); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/LinkToAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/LinkToAction.java index 47720f7d30..fbc4a3dc64 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/LinkToAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/LinkToAction.java @@ -1,47 +1,47 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -/** - * Link To action implementation. - * - * @author Mark Hibbins - * @since 2.2 - */ -public class LinkToAction extends CopyMoveLinkFileToBaseAction -{ - /** action name */ - public static final String NAME = "linkTo"; - - @Override - public void init() - { - super.init(); - setMode(CopyMoveLinkFileToActionMode.LINK); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +/** + * Link To action implementation. + * + * @author Mark Hibbins + * @since 2.2 + */ +public class LinkToAction extends CopyMoveLinkFileToBaseAction +{ + /** action name */ + public static final String NAME = "linkTo"; + + @Override + public void init() + { + super.init(); + setMode(CopyMoveLinkFileToActionMode.LINK); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/MoveToAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/MoveToAction.java index c48ccf8042..a70d566d56 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/MoveToAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/MoveToAction.java @@ -1,47 +1,47 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -/** - * File To action implementation. - * - * @author Mark Hibbins - * @since 2.2 - */ -public class MoveToAction extends CopyMoveLinkFileToBaseAction -{ - /** action name */ - public static final String NAME = "moveTo"; - - @Override - public void init() - { - super.init(); - setMode(CopyMoveLinkFileToActionMode.MOVE); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +/** + * File To action implementation. + * + * @author Mark Hibbins + * @since 2.2 + */ +public class MoveToAction extends CopyMoveLinkFileToBaseAction +{ + /** action name */ + public static final String NAME = "moveTo"; + + @Override + public void init() + { + super.init(); + setMode(CopyMoveLinkFileToActionMode.MOVE); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java index ccadafa77c..d3cd59d44b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java @@ -1,95 +1,95 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Action to re-open the records folder - * - * @author Roy Wetherall - */ -public class OpenRecordFolderAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(OpenRecordFolderAction.class); - - /** I18N */ - private static final String MSG_NO_OPEN_RECORD_FOLDER = "rm.action.no-open-record-folder"; - - /** Parameter names */ - public static final String PARAM_OPEN_PARENT = "openParent"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - !(getDictionaryService().isSubClass(getNodeService().getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) && !getRecordService().isFiled(actionedUponNodeRef))) - { - // TODO move re-open logic into a service method - // TODO check that the user in question has the correct permission to re-open a records folder - - if (getRecordService().isRecord(actionedUponNodeRef)) - { - ChildAssociationRef assocRef = getNodeService().getPrimaryParent(actionedUponNodeRef); - if (assocRef != null) - { - actionedUponNodeRef = assocRef.getParentRef(); - } - } - - if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) - { - Boolean isClosed = (Boolean) getNodeService().getProperty(actionedUponNodeRef, PROP_IS_CLOSED); - if (Boolean.TRUE.equals(isClosed)) - { - getNodeService().setProperty(actionedUponNodeRef, PROP_IS_CLOSED, false); - } - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_NO_OPEN_RECORD_FOLDER, actionedUponNodeRef.toString())); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Action to re-open the records folder + * + * @author Roy Wetherall + */ +public class OpenRecordFolderAction extends RMActionExecuterAbstractBase +{ + /** Logger */ + private static Log logger = LogFactory.getLog(OpenRecordFolderAction.class); + + /** I18N */ + private static final String MSG_NO_OPEN_RECORD_FOLDER = "rm.action.no-open-record-folder"; + + /** Parameter names */ + public static final String PARAM_OPEN_PARENT = "openParent"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getNodeService().exists(actionedUponNodeRef) && + !getFreezeService().isFrozen(actionedUponNodeRef) && + !(getDictionaryService().isSubClass(getNodeService().getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) && !getRecordService().isFiled(actionedUponNodeRef))) + { + // TODO move re-open logic into a service method + // TODO check that the user in question has the correct permission to re-open a records folder + + if (getRecordService().isRecord(actionedUponNodeRef)) + { + ChildAssociationRef assocRef = getNodeService().getPrimaryParent(actionedUponNodeRef); + if (assocRef != null) + { + actionedUponNodeRef = assocRef.getParentRef(); + } + } + + if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) + { + Boolean isClosed = (Boolean) getNodeService().getProperty(actionedUponNodeRef, PROP_IS_CLOSED); + if (Boolean.TRUE.equals(isClosed)) + { + getNodeService().setProperty(actionedUponNodeRef, PROP_IS_CLOSED, false); + } + } + else + { + if (logger.isWarnEnabled()) + { + logger.warn(I18NUtil.getMessage(MSG_NO_OPEN_RECORD_FOLDER, actionedUponNodeRef.toString())); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java index 31431a4622..1bd2fb3d99 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java @@ -1,75 +1,75 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Reject action for an unfiled record - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RejectAction extends RMActionExecuterAbstractBase -{ - /** Parameter names */ - public static final String PARAM_REASON = "reason"; - - /** Action name */ - public static final String NAME = "reject"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - getNodeService().getProperty(actionedUponNodeRef, PROP_RECORD_ORIGINATING_LOCATION) != null) - { - getRecordService().rejectRecord(actionedUponNodeRef, (String) action.getParameterValue(PARAM_REASON)); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_REASON, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_REASON))); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Reject action for an unfiled record + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RejectAction extends RMActionExecuterAbstractBase +{ + /** Parameter names */ + public static final String PARAM_REASON = "reason"; + + /** Action name */ + public static final String NAME = "reject"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getNodeService().exists(actionedUponNodeRef) && + !getFreezeService().isFrozen(actionedUponNodeRef) && + getNodeService().getProperty(actionedUponNodeRef, PROP_RECORD_ORIGINATING_LOCATION) != null) + { + getRecordService().rejectRecord(actionedUponNodeRef, (String) action.getParameterValue(PARAM_REASON)); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_REASON, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_REASON))); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java index bd5fb8e210..00137e9f9b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Relinquish Hold Action - * - * @author Roy Wetherall - */ -public class RelinquishHoldAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_NOT_HOLD_TYPE = "rm.action.not-hold-type"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("deprecation") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getFreezeService().isHold(actionedUponNodeRef)) - { - getFreezeService().relinquish(actionedUponNodeRef); - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_HOLD_TYPE, TYPE_HOLD.toString(), actionedUponNodeRef.toString())); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Relinquish Hold Action + * + * @author Roy Wetherall + */ +public class RelinquishHoldAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_NOT_HOLD_TYPE = "rm.action.not-hold-type"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("deprecation") + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getFreezeService().isHold(actionedUponNodeRef)) + { + getFreezeService().relinquish(actionedUponNodeRef); + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_HOLD_TYPE, TYPE_HOLD.toString(), actionedUponNodeRef.toString())); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java index f1aeed9243..29a4611fec 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java @@ -1,179 +1,179 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.workflow.WorkflowModel; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.workflow.WorkflowService; -import org.alfresco.service.namespace.QName; -import org.alfresco.workflow.RMWorkflowModel; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Request info action for starting a workflow to request more information for an undeclared record - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RequestInfoAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RequestInfoAction.class); - - /** Parameter names */ - public static final String PARAM_REQUESTED_INFO = "requestedInfo"; - public static final String PARAM_ASSIGNEES = "assignees"; - public static final String PARAM_RULE_CREATOR = "ruleCreator"; - - /** Action name */ - public static final String NAME = "requestInfo"; - - /** Workflow definition name */ - private static final String REQUEST_INFO_WORKFLOW_DEFINITION_NAME = "activiti$activitiRequestForInformation"; - - /** Workflow service */ - private WorkflowService workflowService; - - /** - * @param workflowService workflow service - */ - public void setWorkflowService(WorkflowService workflowService) - { - this.workflowService = workflowService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getNodeService().exists(actionedUponNodeRef) && - !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && - getRecordService().isRecord(actionedUponNodeRef) && - !getRecordService().isDeclared(actionedUponNodeRef)) - { - String workflowDefinitionId = workflowService.getDefinitionByName(REQUEST_INFO_WORKFLOW_DEFINITION_NAME).getId(); - Map parameters = new HashMap(); - - parameters.put(WorkflowModel.ASSOC_PACKAGE, getWorkflowPackage(action, actionedUponNodeRef)); - parameters.put(RMWorkflowModel.RM_MIXED_ASSIGNEES, getAssignees(action)); - parameters.put(RMWorkflowModel.RM_REQUESTED_INFORMATION, getRequestedInformation(action)); - parameters.put(RMWorkflowModel.RM_RULE_CREATOR, getRuleCreator(action)); - - workflowService.startWorkflow(workflowDefinitionId, parameters); - } - else - { - logger.info("Can't start the request information workflow for node '" + actionedUponNodeRef.toString() + "'."); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_REQUESTED_INFO, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REQUESTED_INFO))); - paramList.add(new ParameterDefinitionImpl(PARAM_ASSIGNEES, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_ASSIGNEES))); - paramList.add(new ParameterDefinitionImpl(PARAM_RULE_CREATOR, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_RULE_CREATOR))); - } - - /** - * Helper method for creating a workflow package to contain the actioned upon nodeRef - * - * @param action The request info action - * @param actionedUponNodeRef The actioned upon nodeRef - * @return Returns a workflow package containing the actioned upon nodeRef - */ - private NodeRef getWorkflowPackage(Action action, NodeRef actionedUponNodeRef) - { - NodeRef workflowPackage = (NodeRef) action.getParameterValue(WorkflowModel.ASSOC_PACKAGE.toPrefixString(getNamespaceService())); - workflowPackage = workflowService.createPackage(workflowPackage); - ChildAssociationRef childAssoc = getNodeService().getPrimaryParent(actionedUponNodeRef); - getNodeService().addChild(workflowPackage, actionedUponNodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, childAssoc.getQName()); - return workflowPackage; - } - - /** - * Helper method for getting the assignees from the action - * - * @param action The request info action - * @return Returns a list of {@link NodeRef}s each representing the assignee - */ - private Serializable getAssignees(Action action) - { - List assigneesList = new ArrayList(); - String assigneesAsString = (String) action.getParameterValue(PARAM_ASSIGNEES); - String[] assignees = StringUtils.split(assigneesAsString, ','); - for (String assignee : assignees) - { - assigneesList.add(new NodeRef(assignee)); - } - return (Serializable) assigneesList; - } - - /** - * Helper method for getting the requested information from the action - * - * @param action The request info action - * @return Returns the requested information - */ - private Serializable getRequestedInformation(Action action) - { - return action.getParameterValue(PARAM_REQUESTED_INFO); - } - - /** - * Helper method for getting the rule creator - * - * @param action The request info action - * @return Returns the rule creator - */ - private Serializable getRuleCreator(Action action) - { - return action.getParameterValue(PARAM_RULE_CREATOR); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.workflow.WorkflowModel; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.workflow.WorkflowService; +import org.alfresco.service.namespace.QName; +import org.alfresco.workflow.RMWorkflowModel; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Request info action for starting a workflow to request more information for an undeclared record + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RequestInfoAction extends RMActionExecuterAbstractBase +{ + /** Logger */ + private static Log logger = LogFactory.getLog(RequestInfoAction.class); + + /** Parameter names */ + public static final String PARAM_REQUESTED_INFO = "requestedInfo"; + public static final String PARAM_ASSIGNEES = "assignees"; + public static final String PARAM_RULE_CREATOR = "ruleCreator"; + + /** Action name */ + public static final String NAME = "requestInfo"; + + /** Workflow definition name */ + private static final String REQUEST_INFO_WORKFLOW_DEFINITION_NAME = "activiti$activitiRequestForInformation"; + + /** Workflow service */ + private WorkflowService workflowService; + + /** + * @param workflowService workflow service + */ + public void setWorkflowService(WorkflowService workflowService) + { + this.workflowService = workflowService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getNodeService().exists(actionedUponNodeRef) && + !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && + getRecordService().isRecord(actionedUponNodeRef) && + !getRecordService().isDeclared(actionedUponNodeRef)) + { + String workflowDefinitionId = workflowService.getDefinitionByName(REQUEST_INFO_WORKFLOW_DEFINITION_NAME).getId(); + Map parameters = new HashMap(); + + parameters.put(WorkflowModel.ASSOC_PACKAGE, getWorkflowPackage(action, actionedUponNodeRef)); + parameters.put(RMWorkflowModel.RM_MIXED_ASSIGNEES, getAssignees(action)); + parameters.put(RMWorkflowModel.RM_REQUESTED_INFORMATION, getRequestedInformation(action)); + parameters.put(RMWorkflowModel.RM_RULE_CREATOR, getRuleCreator(action)); + + workflowService.startWorkflow(workflowDefinitionId, parameters); + } + else + { + logger.info("Can't start the request information workflow for node '" + actionedUponNodeRef.toString() + "'."); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl(PARAM_REQUESTED_INFO, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REQUESTED_INFO))); + paramList.add(new ParameterDefinitionImpl(PARAM_ASSIGNEES, DataTypeDefinition.ANY, true, getParamDisplayLabel(PARAM_ASSIGNEES))); + paramList.add(new ParameterDefinitionImpl(PARAM_RULE_CREATOR, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_RULE_CREATOR))); + } + + /** + * Helper method for creating a workflow package to contain the actioned upon nodeRef + * + * @param action The request info action + * @param actionedUponNodeRef The actioned upon nodeRef + * @return Returns a workflow package containing the actioned upon nodeRef + */ + private NodeRef getWorkflowPackage(Action action, NodeRef actionedUponNodeRef) + { + NodeRef workflowPackage = (NodeRef) action.getParameterValue(WorkflowModel.ASSOC_PACKAGE.toPrefixString(getNamespaceService())); + workflowPackage = workflowService.createPackage(workflowPackage); + ChildAssociationRef childAssoc = getNodeService().getPrimaryParent(actionedUponNodeRef); + getNodeService().addChild(workflowPackage, actionedUponNodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, childAssoc.getQName()); + return workflowPackage; + } + + /** + * Helper method for getting the assignees from the action + * + * @param action The request info action + * @return Returns a list of {@link NodeRef}s each representing the assignee + */ + private Serializable getAssignees(Action action) + { + List assigneesList = new ArrayList(); + String assigneesAsString = (String) action.getParameterValue(PARAM_ASSIGNEES); + String[] assignees = StringUtils.split(assigneesAsString, ','); + for (String assignee : assignees) + { + assigneesList.add(new NodeRef(assignee)); + } + return (Serializable) assigneesList; + } + + /** + * Helper method for getting the requested information from the action + * + * @param action The request info action + * @return Returns the requested information + */ + private Serializable getRequestedInformation(Action action) + { + return action.getParameterValue(PARAM_REQUESTED_INFO); + } + + /** + * Helper method for getting the rule creator + * + * @param action The request info action + * @return Returns the rule creator + */ + private Serializable getRuleCreator(Action action) + { + return action.getParameterValue(PARAM_RULE_CREATOR); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RetainAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RetainAction.java index bcf2e53e67..e6eeee4c96 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RetainAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RetainAction.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Retain action - * - * @author Roy Wetherall - */ -public class RetainAction extends RMDispositionActionExecuterAbstractBase -{ - @Override - protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) - { - // Do nothing - } - - @Override - protected void executeRecordLevelDisposition(Action action, NodeRef record) - { - // Do nothing - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Retain action + * + * @author Roy Wetherall + */ +public class RetainAction extends RMDispositionActionExecuterAbstractBase +{ + @Override + protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) + { + // Do nothing + } + + @Override + protected void executeRecordLevelDisposition(Action action, NodeRef record) + { + // Do nothing + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java index 4379617271..6388b8b017 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java @@ -1,302 +1,302 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import static org.apache.commons.lang.StringUtils.isBlank; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.mail.MessagingException; -import javax.mail.Multipart; -import javax.mail.Part; -import javax.mail.internet.ContentType; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeUtility; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.model.ImapModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.util.FileCopyUtils; - -/** - * Split Email Action - * - * Splits the attachments for an email message out to independent records. - * - * @author Mark Rogers - */ -public class SplitEmailAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_NO_READ_MIME_MESSAGE = "rm.action.no-read-mime-message"; - private static final String MSG_EMAIL_DECLARED = "rm.action.email-declared"; - private static final String MSG_EMAIL_NOT_RECORD = "rm.action.email-not-record"; - - /** Relationship Labels */ - private static final String REL_FROM = "Message"; - private static final String REL_TO = "Attachment"; - - /** Logger */ - private static Log logger = LogFactory.getLog(SplitEmailAction.class); - - /** Relationship service */ - private RelationshipService relationshipService; - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** Unique name of the relationship definition */ - private String relationshipUniqueName; - - public void bootstrap() - { - Set relationshipDefinitions = getRelationshipService().getRelationshipDefinitions(); - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) - { - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - - if (sourceText.equals(REL_FROM) && targetText.equals(REL_TO)) - { - relationshipUniqueName = relationshipDefinition.getUniqueName(); - } - } - - if (isBlank(relationshipUniqueName)) - { - RelationshipDisplayName displayName = new RelationshipDisplayName(REL_FROM, REL_TO); - RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); - relationshipUniqueName = relationshipDefinition.getUniqueName(); - } - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - // get node type - getNodeService().getType(actionedUponNodeRef); - - if (logger.isDebugEnabled()) - { - logger.debug("split email:" + actionedUponNodeRef); - } - - if (getRecordService().isRecord(actionedUponNodeRef)) - { - if (!getRecordService().isDeclared(actionedUponNodeRef)) - { - ChildAssociationRef parent = getNodeService().getPrimaryParent(actionedUponNodeRef); - - /** - * Check whether the email message has already been split - do nothing if it has already been split - */ - List refs = getNodeService().getTargetAssocs(actionedUponNodeRef, ImapModel.ASSOC_IMAP_ATTACHMENT); - if(refs.size() > 0) - { - if (logger.isDebugEnabled()) - { - logger.debug("mail message has already been split - do nothing"); - } - return; - } - - /** - * Get the content and if its a mime message then create atachments for each part - */ - try - { - ContentReader reader = getContentService().getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT); - InputStream is = reader.getContentInputStream(); - MimeMessage mimeMessage = new MimeMessage(null, is); - Object content = mimeMessage.getContent(); - if (content instanceof Multipart) - { - Multipart multipart = (Multipart)content; - - for (int i = 0, n = multipart.getCount(); i < n; i++) - { - Part part = multipart.getBodyPart(i); - if ("attachment".equalsIgnoreCase(part.getDisposition())) - { - createAttachment(actionedUponNodeRef, parent.getParentRef(), part); - } - } - } - } - catch (Exception e) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_READ_MIME_MESSAGE, e.toString()), e); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_DECLARED, actionedUponNodeRef.toString())); - } - } - else - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_NOT_RECORD, actionedUponNodeRef.toString())); - } - } - - /** - * Create attachment from Mime Message Part - * @param messageNodeRef - the node ref of the mime message - * @param parentNodeRef - the node ref of the parent folder - * @param part - * @throws MessagingException - * @throws IOException - */ - private void createAttachment(NodeRef messageNodeRef, NodeRef parentNodeRef, Part part) throws MessagingException, IOException - { - String fileName = part.getFileName(); - try - { - fileName = MimeUtility.decodeText(fileName); - } - catch (UnsupportedEncodingException e) - { - if (logger.isWarnEnabled()) - { - logger.warn("Cannot decode file name '" + fileName + "'", e); - } - } - - Map messageProperties = getNodeService().getProperties(messageNodeRef); - String messageTitle = (String)messageProperties.get(ContentModel.PROP_NAME); - if(messageTitle == null) - { - messageTitle = fileName; - } - else - { - messageTitle = messageTitle + " - " + fileName; - } - - ContentType contentType = new ContentType(part.getContentType()); - - Map docProps = new HashMap(1); - docProps.put(ContentModel.PROP_NAME, messageTitle + " - " + fileName); - docProps.put(ContentModel.PROP_TITLE, fileName); - - /** - * Create an attachment node in the same folder as the message - */ - ChildAssociationRef attachmentRef = getNodeService().createNode(parentNodeRef, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, fileName), - ContentModel.TYPE_CONTENT, - docProps); - - /** - * Write the content into the new attachment node - */ - ContentWriter writer = getContentService().getWriter(attachmentRef.getChildRef(), ContentModel.PROP_CONTENT, true); - writer.setMimetype(contentType.getBaseType()); - OutputStream os = writer.getContentOutputStream(); - FileCopyUtils.copy(part.getInputStream(), os); - - /** - * Create a link from the message to the attachment - */ - createRMReference(messageNodeRef, attachmentRef.getChildRef()); - - - } - - /** - * Create a link from the message to the attachment - */ - private void createRMReference(final NodeRef parentRef, final NodeRef childRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // add the relationship - getRelationshipService().addRelationship(relationshipUniqueName, parentRef, childRef); - - // add the IMAP attachment aspect - getNodeService().createAssociation( - parentRef, - childRef, - ImapModel.ASSOC_IMAP_ATTACHMENT); - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import static org.apache.commons.lang.StringUtils.isBlank; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.mail.MessagingException; +import javax.mail.Multipart; +import javax.mail.Part; +import javax.mail.internet.ContentType; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.model.ImapModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; +import org.springframework.util.FileCopyUtils; + +/** + * Split Email Action + * + * Splits the attachments for an email message out to independent records. + * + * @author Mark Rogers + */ +public class SplitEmailAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_NO_READ_MIME_MESSAGE = "rm.action.no-read-mime-message"; + private static final String MSG_EMAIL_DECLARED = "rm.action.email-declared"; + private static final String MSG_EMAIL_NOT_RECORD = "rm.action.email-not-record"; + + /** Relationship Labels */ + private static final String REL_FROM = "Message"; + private static final String REL_TO = "Attachment"; + + /** Logger */ + private static Log logger = LogFactory.getLog(SplitEmailAction.class); + + /** Relationship service */ + private RelationshipService relationshipService; + + /** + * Gets the relationship service instance + * + * @return The relationship service instance + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Sets the relationship service instance + * + * @param relationshipService The relationship service instance + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** Unique name of the relationship definition */ + private String relationshipUniqueName; + + public void bootstrap() + { + Set relationshipDefinitions = getRelationshipService().getRelationshipDefinitions(); + for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) + { + RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); + String sourceText = displayName.getSourceText(); + String targetText = displayName.getTargetText(); + + if (sourceText.equals(REL_FROM) && targetText.equals(REL_TO)) + { + relationshipUniqueName = relationshipDefinition.getUniqueName(); + } + } + + if (isBlank(relationshipUniqueName)) + { + RelationshipDisplayName displayName = new RelationshipDisplayName(REL_FROM, REL_TO); + RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); + relationshipUniqueName = relationshipDefinition.getUniqueName(); + } + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + // get node type + getNodeService().getType(actionedUponNodeRef); + + if (logger.isDebugEnabled()) + { + logger.debug("split email:" + actionedUponNodeRef); + } + + if (getRecordService().isRecord(actionedUponNodeRef)) + { + if (!getRecordService().isDeclared(actionedUponNodeRef)) + { + ChildAssociationRef parent = getNodeService().getPrimaryParent(actionedUponNodeRef); + + /** + * Check whether the email message has already been split - do nothing if it has already been split + */ + List refs = getNodeService().getTargetAssocs(actionedUponNodeRef, ImapModel.ASSOC_IMAP_ATTACHMENT); + if(refs.size() > 0) + { + if (logger.isDebugEnabled()) + { + logger.debug("mail message has already been split - do nothing"); + } + return; + } + + /** + * Get the content and if its a mime message then create atachments for each part + */ + try + { + ContentReader reader = getContentService().getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT); + InputStream is = reader.getContentInputStream(); + MimeMessage mimeMessage = new MimeMessage(null, is); + Object content = mimeMessage.getContent(); + if (content instanceof Multipart) + { + Multipart multipart = (Multipart)content; + + for (int i = 0, n = multipart.getCount(); i < n; i++) + { + Part part = multipart.getBodyPart(i); + if ("attachment".equalsIgnoreCase(part.getDisposition())) + { + createAttachment(actionedUponNodeRef, parent.getParentRef(), part); + } + } + } + } + catch (Exception e) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_READ_MIME_MESSAGE, e.toString()), e); + } + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_DECLARED, actionedUponNodeRef.toString())); + } + } + else + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_NOT_RECORD, actionedUponNodeRef.toString())); + } + } + + /** + * Create attachment from Mime Message Part + * @param messageNodeRef - the node ref of the mime message + * @param parentNodeRef - the node ref of the parent folder + * @param part + * @throws MessagingException + * @throws IOException + */ + private void createAttachment(NodeRef messageNodeRef, NodeRef parentNodeRef, Part part) throws MessagingException, IOException + { + String fileName = part.getFileName(); + try + { + fileName = MimeUtility.decodeText(fileName); + } + catch (UnsupportedEncodingException e) + { + if (logger.isWarnEnabled()) + { + logger.warn("Cannot decode file name '" + fileName + "'", e); + } + } + + Map messageProperties = getNodeService().getProperties(messageNodeRef); + String messageTitle = (String)messageProperties.get(ContentModel.PROP_NAME); + if(messageTitle == null) + { + messageTitle = fileName; + } + else + { + messageTitle = messageTitle + " - " + fileName; + } + + ContentType contentType = new ContentType(part.getContentType()); + + Map docProps = new HashMap(1); + docProps.put(ContentModel.PROP_NAME, messageTitle + " - " + fileName); + docProps.put(ContentModel.PROP_TITLE, fileName); + + /** + * Create an attachment node in the same folder as the message + */ + ChildAssociationRef attachmentRef = getNodeService().createNode(parentNodeRef, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, fileName), + ContentModel.TYPE_CONTENT, + docProps); + + /** + * Write the content into the new attachment node + */ + ContentWriter writer = getContentService().getWriter(attachmentRef.getChildRef(), ContentModel.PROP_CONTENT, true); + writer.setMimetype(contentType.getBaseType()); + OutputStream os = writer.getContentOutputStream(); + FileCopyUtils.copy(part.getInputStream(), os); + + /** + * Create a link from the message to the attachment + */ + createRMReference(messageNodeRef, attachmentRef.getChildRef()); + + + } + + /** + * Create a link from the message to the attachment + */ + private void createRMReference(final NodeRef parentRef, final NodeRef childRef) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // add the relationship + getRelationshipService().addRelationship(relationshipUniqueName, parentRef, childRef); + + // add the IMAP attachment aspect + getNodeService().createAssociation( + parentRef, + childRef, + ImapModel.ASSOC_IMAP_ATTACHMENT); + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java index d469d1b5a4..191ca3cfa9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java @@ -1,120 +1,120 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.repo.action.executer.ActionExecuter; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Transfer action - * - * @author Roy Wetherall - */ -public class TransferAction extends RMDispositionActionExecuterAbstractBase -{ - /** Action name */ - public static final String NAME = "transfer"; - - /** Indicates whether the transfer is an accession or not */ - private boolean isAccession = false; - - /** transfer service */ - private TransferService transferService; - - /** - * Indicates whether this transfer is an accession or not - * - * @param isAccession Is the transfer an accession or not - */ - public void setIsAccession(boolean isAccession) - { - this.isAccession = isAccession; - } - - /** - * Sets the transfer service - * - * @param transferService transfer service - */ - public void setTransferService(TransferService transferService) - { - this.transferService = transferService; - } - - /** - * Do not set the transfer action to auto-complete - * - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#getSetDispositionActionComplete() - */ - @Override - public boolean getSetDispositionActionComplete() - { - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) - { - doTransfer(action, recordFolder); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeRecordLevelDisposition(Action action, NodeRef record) - { - doTransfer(action, record); - } - - /** - * Create the transfer node and link the disposition lifecycle node beneath it - * - * @param action action - * @param dispositionLifeCycleNodeRef disposition lifecycle node - */ - private void doTransfer(Action action, NodeRef dispositionLifeCycleNodeRef) - { - NodeRef transferNodeRef = transferService.transfer(dispositionLifeCycleNodeRef, isAccession); - - // Set the return value of the action - action.setParameterValue(ActionExecuter.PARAM_RESULT, transferNodeRef); - - // Cut off the disposable item if it's not cut off already - if (!getDispositionService().isDisposableItemCutoff(dispositionLifeCycleNodeRef)) - { - getDispositionService().cutoffDisposableItem(dispositionLifeCycleNodeRef); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; +import org.alfresco.repo.action.executer.ActionExecuter; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Transfer action + * + * @author Roy Wetherall + */ +public class TransferAction extends RMDispositionActionExecuterAbstractBase +{ + /** Action name */ + public static final String NAME = "transfer"; + + /** Indicates whether the transfer is an accession or not */ + private boolean isAccession = false; + + /** transfer service */ + private TransferService transferService; + + /** + * Indicates whether this transfer is an accession or not + * + * @param isAccession Is the transfer an accession or not + */ + public void setIsAccession(boolean isAccession) + { + this.isAccession = isAccession; + } + + /** + * Sets the transfer service + * + * @param transferService transfer service + */ + public void setTransferService(TransferService transferService) + { + this.transferService = transferService; + } + + /** + * Do not set the transfer action to auto-complete + * + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#getSetDispositionActionComplete() + */ + @Override + public boolean getSetDispositionActionComplete() + { + return false; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordFolderLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) + { + doTransfer(action, recordFolder); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase#executeRecordLevelDisposition(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeRecordLevelDisposition(Action action, NodeRef record) + { + doTransfer(action, record); + } + + /** + * Create the transfer node and link the disposition lifecycle node beneath it + * + * @param action action + * @param dispositionLifeCycleNodeRef disposition lifecycle node + */ + private void doTransfer(Action action, NodeRef dispositionLifeCycleNodeRef) + { + NodeRef transferNodeRef = transferService.transfer(dispositionLifeCycleNodeRef, isAccession); + + // Set the return value of the action + action.setParameterValue(ActionExecuter.PARAM_RESULT, transferNodeRef); + + // Cut off the disposable item if it's not cut off already + if (!getDispositionService().isDisposableItemCutoff(dispositionLifeCycleNodeRef)) + { + getDispositionService().cutoffDisposableItem(dispositionLifeCycleNodeRef); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java index 7d8fb4075f..08a92bd099 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java @@ -1,94 +1,94 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Transfer complete action - * - * @author Roy Wetherall - */ -public class TransferCompleteAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_NODE_NOT_TRANSFER = "rm.action.node-not-transfer"; - - /** Action name */ - public static final String NAME = "transferComplete"; - - /** Transfer service */ - private TransferService transferService; - - /** - * @return transfer service - */ - protected TransferService getTransferService() - { - return this.transferService; - } - - /** - * @param transferService transfer service - */ - public void setTransferService(TransferService transferService) - { - this.transferService = transferService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - checkTransferSubClass(actionedUponNodeRef); - getTransferService().completeTransfer(actionedUponNodeRef); - } - - /** - * Checks if the actioned upon node reference is a sub class of transfer - * - * @param actionedUponNodeRef actioned upon node reference - */ - private void checkTransferSubClass(NodeRef actionedUponNodeRef) - { - QName type = getNodeService().getType(actionedUponNodeRef); - if (!getDictionaryService().isSubClass(type, TYPE_TRANSFER)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_NOT_TRANSFER)); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.transfer.TransferService; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Transfer complete action + * + * @author Roy Wetherall + */ +public class TransferCompleteAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_NODE_NOT_TRANSFER = "rm.action.node-not-transfer"; + + /** Action name */ + public static final String NAME = "transferComplete"; + + /** Transfer service */ + private TransferService transferService; + + /** + * @return transfer service + */ + protected TransferService getTransferService() + { + return this.transferService; + } + + /** + * @param transferService transfer service + */ + public void setTransferService(TransferService transferService) + { + this.transferService = transferService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + checkTransferSubClass(actionedUponNodeRef); + getTransferService().completeTransfer(actionedUponNodeRef); + } + + /** + * Checks if the actioned upon node reference is a sub class of transfer + * + * @param actionedUponNodeRef actioned upon node reference + */ + private void checkTransferSubClass(NodeRef actionedUponNodeRef) + { + QName type = getNodeService().getType(actionedUponNodeRef); + if (!getDictionaryService().isSubClass(type, TYPE_TRANSFER)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_NOT_TRANSFER)); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java index a9e9a4d28b..d7cb6e986f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java @@ -1,98 +1,98 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * UnCutoff action implementation - * - * @author Roy Wetherall - */ -public class UnCutoffAction extends RMActionExecuterAbstractBase -{ - /** I18N */ - private static final String MSG_UNDO_NOT_LAST = "rm.action.undo-not-last"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) && - getNodeService().hasAspect(actionedUponNodeRef, ASPECT_CUT_OFF)) - { - // Get the last disposition action - DispositionAction da = getDispositionService().getLastCompletedDispostionAction(actionedUponNodeRef); - - // Check that the last disposition action was a cutoff - if (da == null || !da.getName().equals("cutoff")) - { - // Can not undo cut off since cut off was not the last thing done - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDO_NOT_LAST)); - } - - // Remove the cutoff aspect and add the uncutoff aspect - getNodeService().removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF); - getNodeService().addAspect(actionedUponNodeRef, ASPECT_UNCUT_OFF, null); - if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) - { - List records = getRecordService().getRecords(actionedUponNodeRef); - for (NodeRef record : records) - { - getNodeService().removeAspect(record, ASPECT_CUT_OFF); - getNodeService().addAspect(record, ASPECT_UNCUT_OFF, null); - } - } - - // Delete the current disposition action - DispositionAction currentDa = getDispositionService().getNextDispositionAction(actionedUponNodeRef); - if (currentDa != null) - { - getNodeService().deleteNode(currentDa.getNodeRef()); - } - - // Move the previous (cutoff) disposition back to be current - getNodeService().moveNode(da.getNodeRef(), actionedUponNodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); - - // Reset the started and completed property values - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_AT, null); - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_BY, null); - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, null); - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, null); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * UnCutoff action implementation + * + * @author Roy Wetherall + */ +public class UnCutoffAction extends RMActionExecuterAbstractBase +{ + /** I18N */ + private static final String MSG_UNDO_NOT_LAST = "rm.action.undo-not-last"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) && + getNodeService().hasAspect(actionedUponNodeRef, ASPECT_CUT_OFF)) + { + // Get the last disposition action + DispositionAction da = getDispositionService().getLastCompletedDispostionAction(actionedUponNodeRef); + + // Check that the last disposition action was a cutoff + if (da == null || !da.getName().equals("cutoff")) + { + // Can not undo cut off since cut off was not the last thing done + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDO_NOT_LAST)); + } + + // Remove the cutoff aspect and add the uncutoff aspect + getNodeService().removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF); + getNodeService().addAspect(actionedUponNodeRef, ASPECT_UNCUT_OFF, null); + if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) + { + List records = getRecordService().getRecords(actionedUponNodeRef); + for (NodeRef record : records) + { + getNodeService().removeAspect(record, ASPECT_CUT_OFF); + getNodeService().addAspect(record, ASPECT_UNCUT_OFF, null); + } + } + + // Delete the current disposition action + DispositionAction currentDa = getDispositionService().getNextDispositionAction(actionedUponNodeRef); + if (currentDa != null) + { + getNodeService().deleteNode(currentDa.getNodeRef()); + } + + // Move the previous (cutoff) disposition back to be current + getNodeService().moveNode(da.getNodeRef(), actionedUponNodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); + + // Reset the started and completed property values + getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_AT, null); + getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_BY, null); + getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, null); + getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, null); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java index 9899c3bf67..a4df31e988 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java @@ -1,77 +1,77 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Undeclare record action - * - * @author Roy Wetherall - */ -public class UndeclareRecordAction extends RMActionExecuterAbstractBase -{ - /** Logger */ - private static Log logger = LogFactory.getLog(UndeclareRecordAction.class); - - /** I18N */ - private static final String MSG_RECORDS_ONLY_UNDECLARED = "rm.action.records_only_undeclared"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (getNodeService().exists(actionedUponNodeRef)) - { - if (getRecordService().isRecord(actionedUponNodeRef)) - { - // repoen if already complete and not frozen - if (getRecordService().isDeclared(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef)) - { - // Remove the declared aspect - this.getNodeService().removeAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD); - } - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_RECORDS_ONLY_UNDECLARED)); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Undeclare record action + * + * @author Roy Wetherall + */ +public class UndeclareRecordAction extends RMActionExecuterAbstractBase +{ + /** Logger */ + private static Log logger = LogFactory.getLog(UndeclareRecordAction.class); + + /** I18N */ + private static final String MSG_RECORDS_ONLY_UNDECLARED = "rm.action.records_only_undeclared"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (getNodeService().exists(actionedUponNodeRef)) + { + if (getRecordService().isRecord(actionedUponNodeRef)) + { + // repoen if already complete and not frozen + if (getRecordService().isDeclared(actionedUponNodeRef) && + !getFreezeService().isFrozen(actionedUponNodeRef)) + { + // Remove the declared aspect + this.getNodeService().removeAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD); + } + } + else + { + if (logger.isWarnEnabled()) + { + logger.warn(I18NUtil.getMessage(MSG_RECORDS_ONLY_UNDECLARED)); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java index 783ae3893c..6e3882b963 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java @@ -1,78 +1,78 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Undo event action - * - * @author Roy Wetherall - * @since 1.0 - */ -public class UndoEventAction extends RMActionExecuterAbstractBase -{ - /** Params */ - public static final String PARAM_EVENT_NAME = "eventName"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME); - - if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - // Get the next disposition action - DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef); - if (da != null) - { - // undo completed event - da.undoEvent(eventName); - } - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // TODO add parameter definitions .... - // eventName - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Undo event action + * + * @author Roy Wetherall + * @since 1.0 + */ +public class UndoEventAction extends RMActionExecuterAbstractBase +{ + /** Params */ + public static final String PARAM_EVENT_NAME = "eventName"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME); + + if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + { + // Get the next disposition action + DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef); + if (da != null) + { + // undo completed event + da.undoEvent(eventName); + } + } + } + + /** + * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) + */ + @Override + protected void addParameterDefinitions(List paramList) + { + // TODO add parameter definitions .... + // eventName + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java index 10b0e4b0c7..60a9423319 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java @@ -1,50 +1,50 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unfreeze Action - * - * @author Roy Wetherall - */ -public class UnfreezeAction extends RMActionExecuterAbstractBase -{ - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("deprecation") - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - getFreezeService().unFreeze(actionedUponNodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Unfreeze Action + * + * @author Roy Wetherall + */ +public class UnfreezeAction extends RMActionExecuterAbstractBase +{ + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("deprecation") + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + getFreezeService().unFreeze(actionedUponNodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java index d7bb819f3d..404630028e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unlink from action implementation. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class UnlinkFromAction extends RMActionExecuterAbstractBase -{ - /** action name */ - public static final String NAME = "unlinkFrom"; - - /** action parameters */ - public static final String PARAM_RECORD_FOLDER = "recordFolder"; - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - // check that the actioned upon node reference exists and is of the correct type - if (getNodeService().exists(actionedUponNodeRef) && - !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && - getRecordService().isRecord(actionedUponNodeRef)) - { - // get the record folder we are unlinking from - String recordFolderValue = (String)action.getParameterValue(PARAM_RECORD_FOLDER); - if (recordFolderValue == null || recordFolderValue.isEmpty()) - { - // indicate that the record folder is mandatory - throw new AlfrescoRuntimeException("Can't unlink, because no record folder was provided."); - } - NodeRef recordFolder = new NodeRef(recordFolderValue); - - // unlink record from record folder - getRecordService().unlink(actionedUponNodeRef, recordFolder); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Unlink from action implementation. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class UnlinkFromAction extends RMActionExecuterAbstractBase +{ + /** action name */ + public static final String NAME = "unlinkFrom"; + + /** action parameters */ + public static final String PARAM_RECORD_FOLDER = "recordFolder"; + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + // check that the actioned upon node reference exists and is of the correct type + if (getNodeService().exists(actionedUponNodeRef) && + !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && + getRecordService().isRecord(actionedUponNodeRef)) + { + // get the record folder we are unlinking from + String recordFolderValue = (String)action.getParameterValue(PARAM_RECORD_FOLDER); + if (recordFolderValue == null || recordFolderValue.isEmpty()) + { + // indicate that the record folder is mandatory + throw new AlfrescoRuntimeException("Can't unlink, because no record folder was provided."); + } + NodeRef recordFolder = new NodeRef(recordFolderValue); + + // unlink record from record folder + getRecordService().unlink(actionedUponNodeRef, recordFolder); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CannotApplyConstraintMetadataException.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CannotApplyConstraintMetadataException.java index 7c683dfac7..a504ced011 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CannotApplyConstraintMetadataException.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CannotApplyConstraintMetadataException.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.admin; - -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.CannotApplyConstraintMetadataException - */ -public class CannotApplyConstraintMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint"; - - public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType) - { - super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.admin; + +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Custom metadata exception. + * + * @author Roy Wethearll + * @since 2.1 + * @see org.alfresco.module.org_alfresco_module_rm.CannotApplyConstraintMetadataException + */ +public class CannotApplyConstraintMetadataException extends CustomMetadataException +{ + private static final long serialVersionUID = -6194867814140009959L; + public static final String MSG_CANNOT_APPLY_CONSTRAINT = "rm.admin.cannot-apply-constraint"; + + public CannotApplyConstraintMetadataException(QName lovConstraint, String propIdAsString, QName dataType) + { + super(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, lovConstraint, propIdAsString, dataType)); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CustomMetadataException.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CustomMetadataException.java index 3763bb6b76..edac1e36cb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CustomMetadataException.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/CustomMetadataException.java @@ -1,48 +1,48 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.admin; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.CustomMetadataException - */ -@AlfrescoPublicApi -public abstract class CustomMetadataException extends Exception -{ - private static final long serialVersionUID = -6676112294794381360L; - - public CustomMetadataException(String msg) - { - super(msg); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.admin; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Custom metadata exception. + * + * @author Roy Wethearll + * @since 2.1 + * @see org.alfresco.module.org_alfresco_module_rm.CustomMetadataException + */ +@AlfrescoPublicApi +public abstract class CustomMetadataException extends Exception +{ + private static final long serialVersionUID = -6676112294794381360L; + + public CustomMetadataException(String msg) + { + super(msg); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/InvalidCustomAspectMetadataException.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/InvalidCustomAspectMetadataException.java index 4dea6a5470..bd3e19c896 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/InvalidCustomAspectMetadataException.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/InvalidCustomAspectMetadataException.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.admin; - -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.InvalidCustomAspectMetadataException - */ -public class InvalidCustomAspectMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect"; - - public InvalidCustomAspectMetadataException(QName customAspect, String aspectName) - { - super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.admin; + +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Custom metadata exception. + * + * @author Roy Wethearll + * @since 2.1 + * @see org.alfresco.module.org_alfresco_module_rm.InvalidCustomAspectMetadataException + */ +public class InvalidCustomAspectMetadataException extends CustomMetadataException +{ + private static final long serialVersionUID = -6194867814140009959L; + public static final String MSG_INVALID_CUSTOM_ASPECT = "rm.admin.invalid-custom-aspect"; + + public InvalidCustomAspectMetadataException(QName customAspect, String aspectName) + { + super(I18NUtil.getMessage(MSG_INVALID_CUSTOM_ASPECT, customAspect, aspectName)); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/NotCustomisableMetadataException.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/NotCustomisableMetadataException.java index 1f613845de..67f69796c8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/NotCustomisableMetadataException.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/NotCustomisableMetadataException.java @@ -1,48 +1,48 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.admin; - -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.NotCustomisableMetadataException - */ -public class NotCustomisableMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable"; - - public NotCustomisableMetadataException(String aspectName) - { - super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.admin; + +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Custom metadata exception. + * + * @author Roy Wethearll + * @since 2.1 + * @see org.alfresco.module.org_alfresco_module_rm.NotCustomisableMetadataException + */ +public class NotCustomisableMetadataException extends CustomMetadataException +{ + private static final long serialVersionUID = -6194867814140009959L; + public static final String MSG_NOT_CUSTOMISABLE = "rm.admin.not-customisable"; + + public NotCustomisableMetadataException(String aspectName) + { + super(I18NUtil.getMessage(MSG_NOT_CUSTOMISABLE, aspectName)); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/PropertyAlreadyExistsMetadataException.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/PropertyAlreadyExistsMetadataException.java index 6814ba6d36..00edf68674 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/PropertyAlreadyExistsMetadataException.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/PropertyAlreadyExistsMetadataException.java @@ -1,51 +1,51 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.admin; - -import org.alfresco.api.AlfrescoPublicApi; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Custom metadata exception. - * - * @author Roy Wethearll - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.PropertyAlreadyExistsMetadataException - */ -@AlfrescoPublicApi -public class PropertyAlreadyExistsMetadataException extends CustomMetadataException -{ - private static final long serialVersionUID = -6194867814140009959L; - - public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists"; - - public PropertyAlreadyExistsMetadataException(String propIdAsString) - { - super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.admin; + +import org.alfresco.api.AlfrescoPublicApi; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Custom metadata exception. + * + * @author Roy Wethearll + * @since 2.1 + * @see org.alfresco.module.org_alfresco_module_rm.PropertyAlreadyExistsMetadataException + */ +@AlfrescoPublicApi +public class PropertyAlreadyExistsMetadataException extends CustomMetadataException +{ + private static final long serialVersionUID = -6194867814140009959L; + + public static final String MSG_PROPERTY_ALREADY_EXISTS = "rm.admin.property-already-exists"; + + public PropertyAlreadyExistsMetadataException(String propIdAsString) + { + super(I18NUtil.getMessage(MSG_PROPERTY_ALREADY_EXISTS, propIdAsString)); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java index 3555958c76..69ee945d1d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java @@ -1,385 +1,385 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.admin; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap; -import org.alfresco.repo.dictionary.M2Model; -import org.alfresco.repo.dictionary.M2Namespace; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryException; -import org.alfresco.service.cmr.dictionary.DictionaryService; -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.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Base class for RM admin services - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordsManagementAdminBase implements RecordsManagementCustomModel -{ - /** Logger */ - protected Log logger = LogFactory.getLog(this.getClass()); - - /** Constants */ - private static final String SOURCE_TARGET_ID_SEPARATOR = "__"; - private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "records_management_custom_model"); - - /** I18N */ - private static final String MSG_CUSTOM_MODEL_NOT_FOUND = "rm.admin.custom-model-not-found"; - private static final String MSG_CUSTOM_MODEL_NO_CONTENT = "rm.admin.custom-model-no-content"; - private static final String MSG_ERROR_WRITE_CUSTOM_MODEL = "rm.admin.error-write-custom-model"; - private static final String MSG_ERROR_SPLIT_ID = "rm.admin.error-split-id"; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Dictionary repository bootstrap */ - private DictionaryRepositoryBootstrap dictionaryRepositoryBootstrap; - - /** - * Gets the dictionary service instance - * - * @return The dictionary service instance - */ - protected DictionaryService getDictionaryService() - { - return this.dictionaryService; - } - - /** - * Gets the node service instance - * - * @return The node service instance - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Gets the content service instance - * - * @return The content service instance - */ - protected ContentService getContentService() - { - return this.contentService; - } - - /** - * Gets the namespace service instance - * - * @return The namespace service instance - */ - protected NamespaceService getNamespaceService() - { - return this.namespaceService; - } - - /** - * Gets the dictionary repository bootstrap instance - * - * @return The dictionary repository bootstrap instance - */ - protected DictionaryRepositoryBootstrap getDictionaryRepositoryBootstrap() - { - return this.dictionaryRepositoryBootstrap; - } - - /** - * Sets the dictionary service instance - * - * @param dictionaryService The dictionary service instance - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Sets the node service instance - * - * @param nodeService The node service instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Sets the content service instance - * - * @param contentService The content service instance - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * Sets the namespace service instance - * - * @param namespaceService The namespace service instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Sets the dictionary repository bootstrap instance - * - * @param dictionaryRepositoryBootstrap The dictionary repository bootstrap instance - */ - public void setDictionaryRepositoryBootstrap(DictionaryRepositoryBootstrap dictionaryRepositoryBootstrap) - { - this.dictionaryRepositoryBootstrap = dictionaryRepositoryBootstrap; - } - - /** - * Gets all the custom associations - * - * @return All custom associations - */ - protected Map getCustomAssociations() - { - Map customAssociations = new HashMap(); - - AspectDefinition aspectDefn = getDictionaryService().getAspect(ASPECT_CUSTOM_ASSOCIATIONS); - if (aspectDefn != null) - { - customAssociations.putAll(aspectDefn.getAssociations()); - } - - return customAssociations; - } - - /** - * Gets the node reference of the custom model - * - * @param uri The URI of the model namespace - * @return The node reference of the custom model - */ - protected NodeRef getCustomModelRef(String uri) - { - if ((uri.equals("")) || (uri.equals(RecordsManagementModel.RM_CUSTOM_URI))) - { - // note: short-cut for "rmc" currently assumes that RM custom model does not define additional namespaces - return RM_CUSTOM_MODEL_NODE_REF; - } - else - { - // ALF-5875 - List modelRefs = getDictionaryRepositoryBootstrap().getModelRefs(); - - for (NodeRef modelRef : modelRefs) - { - try - { - M2Model model = readCustomContentModel(modelRef); - - for (M2Namespace namespace : model.getNamespaces()) - { - if (namespace.getUri().equals(uri)) - { - return modelRef; - } - } - } - catch (DictionaryException de) - { - logger.warn("readCustomContentModel: skip model ("+modelRef+") whilst searching for uri ("+uri+"): ", de); - } - } - - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NOT_FOUND, uri)); - } - } - - /** - * Gets the deserialized model - * - * @param modelNodeRef The node reference of the model - * @return The deserialized model - */ - protected M2Model readCustomContentModel(NodeRef modelNodeRef) - { - ContentReader reader = getContentService().getReader(modelNodeRef, ContentModel.TYPE_CONTENT); - if (!reader.exists()) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NO_CONTENT, modelNodeRef.toString())); - } - - InputStream contentIn = null; - M2Model deserializedModel = null; - - try - { - contentIn = reader.getContentInputStream(); - deserializedModel = M2Model.createModel(contentIn); - } - finally - { - try - { - if (contentIn != null) - { - contentIn.close(); - } - } - catch (IOException ignored) - { - // Intentionally empty. - } - } - - return deserializedModel; - } - - /** - * Updates the content of the custom model - * - * @param modelRef The node reference of the model - * @param deserializedModel The deserialized model - */ - protected void writeCustomContentModel(NodeRef modelRef, M2Model deserializedModel) - { - ContentWriter writer = getContentService().getWriter(modelRef, ContentModel.TYPE_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_XML); - writer.setEncoding("UTF-8"); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - deserializedModel.toXML(baos); - - String updatedModelXml; - try - { - updatedModelXml = baos.toString("UTF-8"); - writer.putContent(updatedModelXml); - // putContent closes all resources. - // so we don't have to. - } - catch (UnsupportedEncodingException uex) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_WRITE_CUSTOM_MODEL, modelRef.toString()), uex); - } - } - - /** - * Checks if the given association definition title exists - * - * @param associationDefinitionTitle The association definition title - * @return true if the association definition title exists, false otherwise - */ - protected boolean existsTitle(String associationDefinitionTitle) - { - boolean existsLabel = false; - Collection associationDefinitions = getCustomAssociations().values(); - for (AssociationDefinition associationDefinition : associationDefinitions) - { - if (associationDefinition.getTitle(getDictionaryService()).equalsIgnoreCase(associationDefinitionTitle)) - { - existsLabel = true; - } - } - return existsLabel; - } - - /** - * Splits the association definition title into source text and target text - * - * @param sourceTargetText The text to split into source text and target text - * @return Splited association definition title which includes source text and target text - */ - protected String[] splitAssociationDefinitionTitle(String sourceTargetText) - { - if (!sourceTargetText.contains(SOURCE_TARGET_ID_SEPARATOR)) - { - throw new IllegalArgumentException(I18NUtil.getMessage(MSG_ERROR_SPLIT_ID, sourceTargetText, SOURCE_TARGET_ID_SEPARATOR)); - } - - return sourceTargetText.split(SOURCE_TARGET_ID_SEPARATOR); - } - - /** - * Creates the association definition title form the source text and target text - * - * @param sourceText The source text - * @param targetText The target text - * @return The association definition title created from the source text and target text - */ - protected String composeAssociationDefinitionTitle(String sourceText, String targetText) - { - if (sourceText.contains(SOURCE_TARGET_ID_SEPARATOR)) - { - throw new IllegalArgumentException("sourceId cannot contain '" + SOURCE_TARGET_ID_SEPARATOR + "': " + sourceText); - } - - StringBuilder sb = new StringBuilder(); - sb.append(sourceText) - .append(SOURCE_TARGET_ID_SEPARATOR) - .append(targetText); - - return sb.toString(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.admin; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap; +import org.alfresco.repo.dictionary.M2Model; +import org.alfresco.repo.dictionary.M2Namespace; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryException; +import org.alfresco.service.cmr.dictionary.DictionaryService; +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.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Base class for RM admin services + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RecordsManagementAdminBase implements RecordsManagementCustomModel +{ + /** Logger */ + protected Log logger = LogFactory.getLog(this.getClass()); + + /** Constants */ + private static final String SOURCE_TARGET_ID_SEPARATOR = "__"; + private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "records_management_custom_model"); + + /** I18N */ + private static final String MSG_CUSTOM_MODEL_NOT_FOUND = "rm.admin.custom-model-not-found"; + private static final String MSG_CUSTOM_MODEL_NO_CONTENT = "rm.admin.custom-model-no-content"; + private static final String MSG_ERROR_WRITE_CUSTOM_MODEL = "rm.admin.error-write-custom-model"; + private static final String MSG_ERROR_SPLIT_ID = "rm.admin.error-split-id"; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** Node service */ + private NodeService nodeService; + + /** Content service */ + private ContentService contentService; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** Dictionary repository bootstrap */ + private DictionaryRepositoryBootstrap dictionaryRepositoryBootstrap; + + /** + * Gets the dictionary service instance + * + * @return The dictionary service instance + */ + protected DictionaryService getDictionaryService() + { + return this.dictionaryService; + } + + /** + * Gets the node service instance + * + * @return The node service instance + */ + protected NodeService getNodeService() + { + return this.nodeService; + } + + /** + * Gets the content service instance + * + * @return The content service instance + */ + protected ContentService getContentService() + { + return this.contentService; + } + + /** + * Gets the namespace service instance + * + * @return The namespace service instance + */ + protected NamespaceService getNamespaceService() + { + return this.namespaceService; + } + + /** + * Gets the dictionary repository bootstrap instance + * + * @return The dictionary repository bootstrap instance + */ + protected DictionaryRepositoryBootstrap getDictionaryRepositoryBootstrap() + { + return this.dictionaryRepositoryBootstrap; + } + + /** + * Sets the dictionary service instance + * + * @param dictionaryService The dictionary service instance + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * Sets the node service instance + * + * @param nodeService The node service instance + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Sets the content service instance + * + * @param contentService The content service instance + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * Sets the namespace service instance + * + * @param namespaceService The namespace service instance + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * Sets the dictionary repository bootstrap instance + * + * @param dictionaryRepositoryBootstrap The dictionary repository bootstrap instance + */ + public void setDictionaryRepositoryBootstrap(DictionaryRepositoryBootstrap dictionaryRepositoryBootstrap) + { + this.dictionaryRepositoryBootstrap = dictionaryRepositoryBootstrap; + } + + /** + * Gets all the custom associations + * + * @return All custom associations + */ + protected Map getCustomAssociations() + { + Map customAssociations = new HashMap(); + + AspectDefinition aspectDefn = getDictionaryService().getAspect(ASPECT_CUSTOM_ASSOCIATIONS); + if (aspectDefn != null) + { + customAssociations.putAll(aspectDefn.getAssociations()); + } + + return customAssociations; + } + + /** + * Gets the node reference of the custom model + * + * @param uri The URI of the model namespace + * @return The node reference of the custom model + */ + protected NodeRef getCustomModelRef(String uri) + { + if ((uri.equals("")) || (uri.equals(RecordsManagementModel.RM_CUSTOM_URI))) + { + // note: short-cut for "rmc" currently assumes that RM custom model does not define additional namespaces + return RM_CUSTOM_MODEL_NODE_REF; + } + else + { + // ALF-5875 + List modelRefs = getDictionaryRepositoryBootstrap().getModelRefs(); + + for (NodeRef modelRef : modelRefs) + { + try + { + M2Model model = readCustomContentModel(modelRef); + + for (M2Namespace namespace : model.getNamespaces()) + { + if (namespace.getUri().equals(uri)) + { + return modelRef; + } + } + } + catch (DictionaryException de) + { + logger.warn("readCustomContentModel: skip model ("+modelRef+") whilst searching for uri ("+uri+"): ", de); + } + } + + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NOT_FOUND, uri)); + } + } + + /** + * Gets the deserialized model + * + * @param modelNodeRef The node reference of the model + * @return The deserialized model + */ + protected M2Model readCustomContentModel(NodeRef modelNodeRef) + { + ContentReader reader = getContentService().getReader(modelNodeRef, ContentModel.TYPE_CONTENT); + if (!reader.exists()) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NO_CONTENT, modelNodeRef.toString())); + } + + InputStream contentIn = null; + M2Model deserializedModel = null; + + try + { + contentIn = reader.getContentInputStream(); + deserializedModel = M2Model.createModel(contentIn); + } + finally + { + try + { + if (contentIn != null) + { + contentIn.close(); + } + } + catch (IOException ignored) + { + // Intentionally empty. + } + } + + return deserializedModel; + } + + /** + * Updates the content of the custom model + * + * @param modelRef The node reference of the model + * @param deserializedModel The deserialized model + */ + protected void writeCustomContentModel(NodeRef modelRef, M2Model deserializedModel) + { + ContentWriter writer = getContentService().getWriter(modelRef, ContentModel.TYPE_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_XML); + writer.setEncoding("UTF-8"); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + deserializedModel.toXML(baos); + + String updatedModelXml; + try + { + updatedModelXml = baos.toString("UTF-8"); + writer.putContent(updatedModelXml); + // putContent closes all resources. + // so we don't have to. + } + catch (UnsupportedEncodingException uex) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_WRITE_CUSTOM_MODEL, modelRef.toString()), uex); + } + } + + /** + * Checks if the given association definition title exists + * + * @param associationDefinitionTitle The association definition title + * @return true if the association definition title exists, false otherwise + */ + protected boolean existsTitle(String associationDefinitionTitle) + { + boolean existsLabel = false; + Collection associationDefinitions = getCustomAssociations().values(); + for (AssociationDefinition associationDefinition : associationDefinitions) + { + if (associationDefinition.getTitle(getDictionaryService()).equalsIgnoreCase(associationDefinitionTitle)) + { + existsLabel = true; + } + } + return existsLabel; + } + + /** + * Splits the association definition title into source text and target text + * + * @param sourceTargetText The text to split into source text and target text + * @return Splited association definition title which includes source text and target text + */ + protected String[] splitAssociationDefinitionTitle(String sourceTargetText) + { + if (!sourceTargetText.contains(SOURCE_TARGET_ID_SEPARATOR)) + { + throw new IllegalArgumentException(I18NUtil.getMessage(MSG_ERROR_SPLIT_ID, sourceTargetText, SOURCE_TARGET_ID_SEPARATOR)); + } + + return sourceTargetText.split(SOURCE_TARGET_ID_SEPARATOR); + } + + /** + * Creates the association definition title form the source text and target text + * + * @param sourceText The source text + * @param targetText The target text + * @return The association definition title created from the source text and target text + */ + protected String composeAssociationDefinitionTitle(String sourceText, String targetText) + { + if (sourceText.contains(SOURCE_TARGET_ID_SEPARATOR)) + { + throw new IllegalArgumentException("sourceId cannot contain '" + SOURCE_TARGET_ID_SEPARATOR + "': " + sourceText); + } + + StringBuilder sb = new StringBuilder(); + sb.append(sourceText) + .append(SOURCE_TARGET_ID_SEPARATOR) + .append(targetText); + + return sb.toString(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java index fe8b7e4ffa..12e04e8f8c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java @@ -1,428 +1,428 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.admin; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; - -/** - * Records management custom model service interface. Implementations of this class are responsible - * for the creation and maintenance of RM-related custom properties and custom associations. - * - * @author Neil McErlean, janv - * @since 2.1 - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService - */ -// Not @AlfrescoPublicApi at the moment as it requires MatchLogic which is not public API. -public interface RecordsManagementAdminService -{ - /** - * Get a list of all registered customisable types and aspects. - * - * @return Set of <{@link QName}>s of customisable types and aspects - */ - Set getCustomisable(); - - /** - * Get a list of all the registered customisable types and aspects present on a given - * node reference. - * - * @param nodeRef node reference - * @return Set of <{@link QName}>s of customisable types and aspects, empty if none - */ - Set getCustomisable(NodeRef nodeRef); - - /** - * Indicates whether a type (or aspect) is customisable. - * - * @param type customisable type {@link QName} - * @return boolean true if type customisable, false otherwise - */ - boolean isCustomisable(QName type); - - /** - * Makes a type customisable. - * - * @param type type {@link QName} to make customisable - */ - void makeCustomisable(QName type); - - /** - * Assuming the custom properties are not in use, makes a type no longer customisable. - * - * @param type type {@link QName} to make customisable - */ - void unmakeCustomisable(QName type); - - /** - * Indicates whether the custom property exists. - * - * @param property properties {@link QName} - * @return boolean true if property exists, false otherwise - */ - boolean existsCustomProperty(QName property); - - /** - * This method returns the custom properties that have been defined for the specified - * customisable RM element. - *

- * Note: the custom property definitions are retrieved from the dictionaryService - * which is notified of any newly created definitions on transaction commit. - * Therefore custom properties created in the current transaction will not appear - * in the result of this method. - * - * @param customisableType - * @return - * @see CustomisableRmElement - */ - Map getCustomPropertyDefinitions(QName customisableType); - - /** - * This method returns the custom properties that have been defined for all of - * the specified customisable RM elements. - * Note: the custom property definitions are retrieved from the dictionaryService - * which is notified of any newly created definitions on transaction commit. - * Therefore custom properties created in the current transaction will not appear - * in the result of this method. - * - * @return - * @see CustomisableRmElement - */ - Map getCustomPropertyDefinitions(); - - /** - * Add custom property definition - * - * Note: no default value, single valued, optional, not system protected, no constraints - * - * @param propId - If a value for propId is provided it will be used to identify property definitions - * within URLs and in QNames. Therefore it must contain URL/QName-valid characters - * only. It must also be unique. - * If a null value is passed, an id will be generated. - * @param aspectName - mandatory. The aspect within which the property is to be defined. - * This must be one of the CustomisableRmElements. - * @param label - mandatory - * @param dataType - mandatory - * @param title - optional - * @param description - optional - * - * @return the propId, whether supplied as a parameter or generated. - * @see CustomisableRmElement#getCorrespondingAspect() - */ - QName addCustomPropertyDefinition(QName propId, QName typeName, String label, QName dataType, String title, String description) throws CustomMetadataException; - - /** - * Add custom property definition with one optional constraint reference - * - * @param propId - If a value for propId is provided it will be used to identify property definitions - * within URLs and in QNames. Therefore it must contain URL/QName-valid characters - * only. It must also be unique. - * If a null value is passed, an id will be generated. - * @param aspectName - mandatory. The aspect within which the property is to be defined. - * This must be one of the CustomisableRmElements. - * @param label - mandatory - * @param dataType - mandatory - * @param title - optional - * @param description - optional - * @param defaultValue - optional - * @param multiValued - TRUE if multi-valued property - * @param mandatory - TRUE if mandatory property - * @param isProtected - TRUE if protected property - * @param lovConstraintQName - optional custom constraint - * - * @return the propId, whether supplied as a parameter or generated. - * @see CustomisableRmElement#getCorrespondingAspect() - */ - - // TODO propId string (not QName) ? - // TODO remove title (since it is ignored) (or remove label to title) - - QName addCustomPropertyDefinition(QName propId, - QName typeName, - String label, - QName dataType, - String title, - String description, - String defaultValue, - boolean multiValued, - boolean mandatory, - boolean isProtected, - QName lovConstraintQName) throws CustomMetadataException; - - /** - * Update the custom property definition's label (title). - * - * @param propQName the qname of the property definition - * @param newLabel the new value for the label. - * @return the propId. - */ - QName setCustomPropertyDefinitionLabel(QName propQName, String newLabel) throws PropertyAlreadyExistsMetadataException; - - /** - * Update the name and label of the custom property definition. - * @param propQName The qname of the existing property definition - * @param newName THe new name for both the custom property and its label. - * @return - * @throws CustomMetadataException - */ - QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException; - - /** - * Sets a new list of values constraint on the custom property definition. - * - * @param propQName the qname of the property definition - * @param newLovConstraint the List-Of-Values constraintRef. - * @return the propId. - */ - QName setCustomPropertyDefinitionConstraint(QName propQName, QName newLovConstraint); - - /** - * Removes all list of values constraints from the custom property definition. - * - * @param propQName the qname of the property definition - * @return the propId. - */ - QName removeCustomPropertyDefinitionConstraints(QName propQName); +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.admin; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.ConstraintDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; + +/** + * Records management custom model service interface. Implementations of this class are responsible + * for the creation and maintenance of RM-related custom properties and custom associations. + * + * @author Neil McErlean, janv + * @since 2.1 + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService + */ +// Not @AlfrescoPublicApi at the moment as it requires MatchLogic which is not public API. +public interface RecordsManagementAdminService +{ + /** + * Get a list of all registered customisable types and aspects. + * + * @return Set of <{@link QName}>s of customisable types and aspects + */ + Set getCustomisable(); + + /** + * Get a list of all the registered customisable types and aspects present on a given + * node reference. + * + * @param nodeRef node reference + * @return Set of <{@link QName}>s of customisable types and aspects, empty if none + */ + Set getCustomisable(NodeRef nodeRef); + + /** + * Indicates whether a type (or aspect) is customisable. + * + * @param type customisable type {@link QName} + * @return boolean true if type customisable, false otherwise + */ + boolean isCustomisable(QName type); + + /** + * Makes a type customisable. + * + * @param type type {@link QName} to make customisable + */ + void makeCustomisable(QName type); + + /** + * Assuming the custom properties are not in use, makes a type no longer customisable. + * + * @param type type {@link QName} to make customisable + */ + void unmakeCustomisable(QName type); + + /** + * Indicates whether the custom property exists. + * + * @param property properties {@link QName} + * @return boolean true if property exists, false otherwise + */ + boolean existsCustomProperty(QName property); + + /** + * This method returns the custom properties that have been defined for the specified + * customisable RM element. + *

+ * Note: the custom property definitions are retrieved from the dictionaryService + * which is notified of any newly created definitions on transaction commit. + * Therefore custom properties created in the current transaction will not appear + * in the result of this method. + * + * @param customisableType + * @return + * @see CustomisableRmElement + */ + Map getCustomPropertyDefinitions(QName customisableType); + + /** + * This method returns the custom properties that have been defined for all of + * the specified customisable RM elements. + * Note: the custom property definitions are retrieved from the dictionaryService + * which is notified of any newly created definitions on transaction commit. + * Therefore custom properties created in the current transaction will not appear + * in the result of this method. + * + * @return + * @see CustomisableRmElement + */ + Map getCustomPropertyDefinitions(); + + /** + * Add custom property definition + * + * Note: no default value, single valued, optional, not system protected, no constraints + * + * @param propId - If a value for propId is provided it will be used to identify property definitions + * within URLs and in QNames. Therefore it must contain URL/QName-valid characters + * only. It must also be unique. + * If a null value is passed, an id will be generated. + * @param aspectName - mandatory. The aspect within which the property is to be defined. + * This must be one of the CustomisableRmElements. + * @param label - mandatory + * @param dataType - mandatory + * @param title - optional + * @param description - optional + * + * @return the propId, whether supplied as a parameter or generated. + * @see CustomisableRmElement#getCorrespondingAspect() + */ + QName addCustomPropertyDefinition(QName propId, QName typeName, String label, QName dataType, String title, String description) throws CustomMetadataException; + + /** + * Add custom property definition with one optional constraint reference + * + * @param propId - If a value for propId is provided it will be used to identify property definitions + * within URLs and in QNames. Therefore it must contain URL/QName-valid characters + * only. It must also be unique. + * If a null value is passed, an id will be generated. + * @param aspectName - mandatory. The aspect within which the property is to be defined. + * This must be one of the CustomisableRmElements. + * @param label - mandatory + * @param dataType - mandatory + * @param title - optional + * @param description - optional + * @param defaultValue - optional + * @param multiValued - TRUE if multi-valued property + * @param mandatory - TRUE if mandatory property + * @param isProtected - TRUE if protected property + * @param lovConstraintQName - optional custom constraint + * + * @return the propId, whether supplied as a parameter or generated. + * @see CustomisableRmElement#getCorrespondingAspect() + */ + + // TODO propId string (not QName) ? + // TODO remove title (since it is ignored) (or remove label to title) + + QName addCustomPropertyDefinition(QName propId, + QName typeName, + String label, + QName dataType, + String title, + String description, + String defaultValue, + boolean multiValued, + boolean mandatory, + boolean isProtected, + QName lovConstraintQName) throws CustomMetadataException; + + /** + * Update the custom property definition's label (title). + * + * @param propQName the qname of the property definition + * @param newLabel the new value for the label. + * @return the propId. + */ + QName setCustomPropertyDefinitionLabel(QName propQName, String newLabel) throws PropertyAlreadyExistsMetadataException; + + /** + * Update the name and label of the custom property definition. + * @param propQName The qname of the existing property definition + * @param newName THe new name for both the custom property and its label. + * @return + * @throws CustomMetadataException + */ + QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException; + + /** + * Sets a new list of values constraint on the custom property definition. + * + * @param propQName the qname of the property definition + * @param newLovConstraint the List-Of-Values constraintRef. + * @return the propId. + */ + QName setCustomPropertyDefinitionConstraint(QName propQName, QName newLovConstraint); + + /** + * Removes all list of values constraints from the custom property definition. + * + * @param propQName the qname of the property definition + * @return the propId. + */ + QName removeCustomPropertyDefinitionConstraints(QName propQName); + + /** * Remove custom property definition - * - * @param propQName - */ - void removeCustomPropertyDefinition(QName propQName); - - /** - * This method returns the custom references that have been defined in the custom - * model. - * Note: the custom reference definitions are retrieved from the dictionaryService - * which is notified of any newly created definitions on transaction commit. - * Therefore custom references created in the current transaction will not appear - * in the results. - * - * @return The Map of custom references (both parent-child and standard). - * @deprecated as of RM 2.3, please use {@link RelationshipService#getRelationshipDefinitions()} instead. - */ - Map getCustomReferenceDefinitions(); - - /** - * Fetches all associations from the given source. - * - * @param node the node from which the associations start. - * @return a List of associations. - * @deprecated as of RM 2.3, please use {@link NodeService#getTargetAssocs(NodeRef, RegexQNamePattern.MATCH_ALL)} instead. - */ - List getCustomReferencesFrom(NodeRef node); - - /** - * Fetches all child associations of the given source. i.e. all associations where the - * given node is the parent. - * - * @param node - * @return - * @deprecated as of RM 2.3, please use {@link NodeService#getChildAssocs(NodeRef)} instead. - */ - List getCustomChildReferences(NodeRef node); - - /** - * Returns a List of all associations to the given node. - * - * @param node the node to which the associations point. - * @return a List of associations. - * @deprecated as of RM 2.3, please use {@link NodeService#getSourceAssocs(NodeRef, RegexQNamePattern.MATCH_ALL)} instead. - */ - List getCustomReferencesTo(NodeRef node); - - /** - * Fetches all child associations where the given node is the child. - * - * @param node - * @return - * @deprecated as of RM 2.3, please use {@link NodeService#getParentAssocs(NodeRef)} instead. - */ - List getCustomParentReferences(NodeRef node); - - /** - * This method adds the specified custom reference instance between the specified nodes. - * Only one instance of any custom reference type is allowed in a given direction - * between two given records. - * - * @param fromNode - * @param toNode - * @param assocId the server-side qname e.g. {http://www.alfresco.org/model/rmcustom/1.0}abcd-12-efgh-4567 - * @throws AlfrescoRuntimeException if an instance of the specified reference type - * already exists from fromNode to toNode. - * @deprecated as of RM 2.3, please use {@link RelationshipService#addRelationship(String, NodeRef, NodeRef)} instead. - */ - void addCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId); - - /** - * This method removes the specified custom reference instance from the specified node. - * - * @param fromNode - * @param toNode - * @param assocId the server-side qname e.g. {http://www.alfresco.org/model/rmcustom/1.0}abcd-12-efgh-4567 - * @deprecated as of RM 2.3, please use {@link RelationshipService#removeRelationship(String, NodeRef, NodeRef)} instead. - */ - void removeCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId); - - /** - * This method creates a new custom association, using the given label as the title. - * - * @param label the title of the association definition - * @return the QName of the newly-created association. - * @deprecated as of RM 2.3, please use {@link RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. - */ - QName addCustomAssocDefinition(String label); - - /** - * This method creates a new custom child association, combining the given source and - * target and using the combined String as the title. - * - * @param source - * @param target - * @return the QName of the newly-created association. - * @deprecated as of RM 2.3, please use {@link RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. - */ - QName addCustomChildAssocDefinition(String source, String target); - - /** - * This method updates the source and target values for the specified child association. - * The source and target will be combined into a single string and stored in the title property. - * Source and target are String metadata for RM parent/child custom references. - * - * @param refQName qname of the child association. - * @param newSource the new value for the source field. - * @param newTarget the new value for the target field. - * @see #getCompoundIdFor(String, String) - * @see #splitSourceTargetId(String) - * @deprecated as of RM 2.3, please use {@link RelationshipService#updateRelationshipDefinition(String, org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. - */ - QName updateCustomChildAssocDefinition(QName refQName, String newSource, String newTarget); - - /** - * This method updates the label value for the specified association. - * The label will be stored in the title property. - * Label is String metadata for bidirectional custom references. - * - * @param refQName qname of the child association. - * @param newLabel the new value for the label field. - * @deprecated as of RM 2.3, please use {@link RelationshipService#updateRelationshipDefinition(String, org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. - */ - QName updateCustomAssocDefinition(QName refQName, String newLabel); + * + * @param propQName + */ + void removeCustomPropertyDefinition(QName propQName); - /** + /** + * This method returns the custom references that have been defined in the custom + * model. + * Note: the custom reference definitions are retrieved from the dictionaryService + * which is notified of any newly created definitions on transaction commit. + * Therefore custom references created in the current transaction will not appear + * in the results. + * + * @return The Map of custom references (both parent-child and standard). + * @deprecated as of RM 2.3, please use {@link RelationshipService#getRelationshipDefinitions()} instead. + */ + Map getCustomReferenceDefinitions(); + + /** + * Fetches all associations from the given source. + * + * @param node the node from which the associations start. + * @return a List of associations. + * @deprecated as of RM 2.3, please use {@link NodeService#getTargetAssocs(NodeRef, RegexQNamePattern.MATCH_ALL)} instead. + */ + List getCustomReferencesFrom(NodeRef node); + + /** + * Fetches all child associations of the given source. i.e. all associations where the + * given node is the parent. + * + * @param node + * @return + * @deprecated as of RM 2.3, please use {@link NodeService#getChildAssocs(NodeRef)} instead. + */ + List getCustomChildReferences(NodeRef node); + + /** + * Returns a List of all associations to the given node. + * + * @param node the node to which the associations point. + * @return a List of associations. + * @deprecated as of RM 2.3, please use {@link NodeService#getSourceAssocs(NodeRef, RegexQNamePattern.MATCH_ALL)} instead. + */ + List getCustomReferencesTo(NodeRef node); + + /** + * Fetches all child associations where the given node is the child. + * + * @param node + * @return + * @deprecated as of RM 2.3, please use {@link NodeService#getParentAssocs(NodeRef)} instead. + */ + List getCustomParentReferences(NodeRef node); + + /** + * This method adds the specified custom reference instance between the specified nodes. + * Only one instance of any custom reference type is allowed in a given direction + * between two given records. + * + * @param fromNode + * @param toNode + * @param assocId the server-side qname e.g. {http://www.alfresco.org/model/rmcustom/1.0}abcd-12-efgh-4567 + * @throws AlfrescoRuntimeException if an instance of the specified reference type + * already exists from fromNode to toNode. + * @deprecated as of RM 2.3, please use {@link RelationshipService#addRelationship(String, NodeRef, NodeRef)} instead. + */ + void addCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId); + + /** + * This method removes the specified custom reference instance from the specified node. + * + * @param fromNode + * @param toNode + * @param assocId the server-side qname e.g. {http://www.alfresco.org/model/rmcustom/1.0}abcd-12-efgh-4567 + * @deprecated as of RM 2.3, please use {@link RelationshipService#removeRelationship(String, NodeRef, NodeRef)} instead. + */ + void removeCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId); + + /** + * This method creates a new custom association, using the given label as the title. + * + * @param label the title of the association definition + * @return the QName of the newly-created association. + * @deprecated as of RM 2.3, please use {@link RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. + */ + QName addCustomAssocDefinition(String label); + + /** + * This method creates a new custom child association, combining the given source and + * target and using the combined String as the title. + * + * @param source + * @param target + * @return the QName of the newly-created association. + * @deprecated as of RM 2.3, please use {@link RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. + */ + QName addCustomChildAssocDefinition(String source, String target); + + /** + * This method updates the source and target values for the specified child association. + * The source and target will be combined into a single string and stored in the title property. + * Source and target are String metadata for RM parent/child custom references. + * + * @param refQName qname of the child association. + * @param newSource the new value for the source field. + * @param newTarget the new value for the target field. + * @see #getCompoundIdFor(String, String) + * @see #splitSourceTargetId(String) + * @deprecated as of RM 2.3, please use {@link RelationshipService#updateRelationshipDefinition(String, org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. + */ + QName updateCustomChildAssocDefinition(QName refQName, String newSource, String newTarget); + + /** + * This method updates the label value for the specified association. + * The label will be stored in the title property. + * Label is String metadata for bidirectional custom references. + * + * @param refQName qname of the child association. + * @param newLabel the new value for the label field. + * @deprecated as of RM 2.3, please use {@link RelationshipService#updateRelationshipDefinition(String, org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. + */ + QName updateCustomAssocDefinition(QName refQName, String newLabel); + + /** * This method returns ConstraintDefinition objects defined in the given model - * (note: not property references or in-line defs) - * The custom constraint definitions are retrieved from the dictionaryService - * which is notified of any newly created definitions on transaction commit. - * Therefore custom constraints created in the current transaction will not appear - * in the results. - */ + * (note: not property references or in-line defs) + * The custom constraint definitions are retrieved from the dictionaryService + * which is notified of any newly created definitions on transaction commit. + * Therefore custom constraints created in the current transaction will not appear + * in the results. + */ List getCustomConstraintDefinitions(QName modelQName); - - /** - * This method adds a Constraint definition to the custom model. - * The implementation of this method would have to go into the M2Model and insert - * the relevant M2Objects for this new constraint. - * - * param type not included as it would always be RMListOfValuesConstraint for RM. - * - * @param constraintName the name e.g. rmc:foo - * @param title the human-readable title e.g. My foo list - * @param caseSensitive - * @param allowedValues the allowed values list + + /** + * This method adds a Constraint definition to the custom model. + * The implementation of this method would have to go into the M2Model and insert + * the relevant M2Objects for this new constraint. + * + * param type not included as it would always be RMListOfValuesConstraint for RM. + * + * @param constraintName the name e.g. rmc:foo + * @param title the human-readable title e.g. My foo list + * @param caseSensitive + * @param allowedValues the allowed values list * @param matchLogic AND (all values must match), OR (at least one values must match) - */ + */ void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List allowedValues, MatchLogic matchLogic); - - /** + + /** * Remove custom constraint definition - if not referenced (by any properties) - * - * + * + * * @param constraintName the name e.g. rmc:foo - */ - void removeCustomConstraintDefinition(QName constraintName); - - /** + */ + void removeCustomConstraintDefinition(QName constraintName); + + /** * Update custom constraint definition with new list of values (replaces existing list, if any) - * + * * @param constraintName the name e.g. rmc:foo - * @param newValues - */ - void changeCustomConstraintValues(QName constraintName, List newValues); - - /** - * - * @param constraintName - * @param title - */ - void changeCustomConstraintTitle(QName constraintName, String title); - - /** - * This method iterates over the custom properties, references looking for one whose id - * exactly matches that specified. - * - * @param localName the localName part of the qname of the property or reference definition. - * @return the QName of the property, association definition which matches, or null. - */ - QName getQNameForClientId(String localName); + * @param newValues + */ + void changeCustomConstraintValues(QName constraintName, List newValues); - /** - * Given a compound id for source and target strings (as used with parent/child - * custom references), this method splits the String and returns an array containing - * the source and target IDs separately. - * - * @param sourceTargetId the compound ID. - * @return a String array, where result[0] == sourceId and result[1] == targetId. - */ - String[] splitSourceTargetId(String sourceTargetId); + /** + * + * @param constraintName + * @param title + */ + void changeCustomConstraintTitle(QName constraintName, String title); - /** - * This method retrieves a compound ID (client-side) for the specified - * sourceId and targetId. - * - * @param sourceId - * @param targetId - * @return - */ - String getCompoundIdFor(String sourceId, String targetId); -} + /** + * This method iterates over the custom properties, references looking for one whose id + * exactly matches that specified. + * + * @param localName the localName part of the qname of the property or reference definition. + * @return the QName of the property, association definition which matches, or null. + */ + QName getQNameForClientId(String localName); + + /** + * Given a compound id for source and target strings (as used with parent/child + * custom references), this method splits the String and returns an array containing + * the source and target IDs separately. + * + * @param sourceTargetId the compound ID. + * @return a String array, where result[0] == sourceId and result[1] == targetId. + */ + String[] splitSourceTargetId(String sourceTargetId); + + /** + * This method retrieves a compound ID (client-side) for the specified + * sourceId and targetId. + * + * @param sourceId + * @param targetId + * @return + */ + String getCompoundIdFor(String sourceId, String targetId); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java index c17b74b822..0375590153 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java @@ -1,1371 +1,1371 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.admin; - -import static org.springframework.extensions.surf.util.ParameterCheck.mandatory; -import static org.springframework.extensions.surf.util.ParameterCheck.mandatoryString; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; -import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.repo.dictionary.IndexTokenisationMode; -import org.alfresco.repo.dictionary.M2Aspect; -import org.alfresco.repo.dictionary.M2Constraint; -import org.alfresco.repo.dictionary.M2Model; -import org.alfresco.repo.dictionary.M2Property; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.Constraint; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.GUID; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.core.Ordered; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.extensions.surf.util.URLDecoder; - -/** - * Records Management AdminService Implementation. - * - * @author Neil McErlean, janv - */ -@BehaviourBean -public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBase - implements RecordsManagementAdminService, - RecordsManagementCustomModel, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnRemoveAspectPolicy, - NodeServicePolicies.OnCreateNodePolicy, - ApplicationListener, - Ordered -{ - /** I18N messages*/ - private static final String MSG_SERVICE_NOT_INIT = "rm.admin.service-not-init"; - private static final String MSG_PROP_EXIST = "rm.admin.prop-exist"; - private static final String MSG_CUSTOM_PROP_EXIST = "rm.admin.custom-prop-exist"; - private static final String MSG_UNKNOWN_ASPECT = "rm.admin.unknown-aspect"; - private static final String MSG_CONSTRAINT_EXISTS = "rm.admin.constraint-exists"; - private static final String MSG_CANNOT_FIND_CONSTRAINT = "rm.admin.contraint-cannot-find"; - private static final String MSG_UNEXPECTED_TYPE_CONSTRAINT = "rm.admin.unexpected_type_constraint"; - private static final String MSG_ERROR_CLIENT_ID = "rm.admin.error-client-id"; - - /** Constants */ - private static final String CUSTOM_CONSTRAINT_TYPE = org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.class.getName(); - private static final String CAPATIBILITY_CUSTOM_CONTRAINT_TYPE = org.alfresco.module.org_alfresco_module_dod5015.caveat.RMListOfValuesConstraint.class.getName(); - private static final String PARAM_ALLOWED_VALUES = "allowedValues"; - private static final String PARAM_CASE_SENSITIVE = "caseSensitive"; - private static final String PARAM_MATCH_LOGIC = "matchLogic"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Transaction service */ - private TransactionService transactionService; - - /** List of types that can be customisable */ - private List pendingCustomisableTypes; - private Map customisableTypes; - - /** indicates whether the custom map has been initialised or not */ - private boolean isCustomMapInit = false; - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Indicate that this application content listener must be executed with the lowest - * precedence. (ie last) - * - * @see Ordered#getOrder() - */ - @Override - public int getOrder() - { - return Ordered.LOWEST_PRECEDENCE; - } - - /** - * Load the custom properties map - * - * @see ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) - */ - @Override - public void onApplicationEvent(ContextRefreshedEvent event) - { - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // initialise custom properties - initCustomMap(); - - return null; - } - }); - } - - /** - * Helper method to indicate whether the custom map is initialised or not. - * - * @return boolean true if initialised, false otherwise - */ - public boolean isCustomMapInit() - { - return isCustomMapInit; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - if (isCustomMapInit) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (getNodeService().exists(nodeRef) && - getDictionaryService().getAllModels().contains(RM_CUSTOM_MODEL) && - isCustomisable(aspectTypeQName)) - { - QName customPropertyAspect = getCustomAspect(aspectTypeQName); - getNodeService().addAspect(nodeRef, customPropertyAspect, null); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onRemoveAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - if (isCustomMapInit) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (getNodeService().exists(nodeRef) && - isCustomisable(aspectTypeQName)) - { - QName customPropertyAspect = getCustomAspect(aspectTypeQName); - getNodeService().removeAspect(nodeRef, customPropertyAspect); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * Make sure any custom property aspects are applied to newly created nodes. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onCreateNode(final ChildAssociationRef childAssocRef) - { - if (isCustomMapInit) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (getDictionaryService().getAllModels().contains(RecordsManagementCustomModel.RM_CUSTOM_MODEL)) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - QName type = getNodeService().getType(nodeRef); - while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type)) - { - if (isCustomisable(type)) - { - QName customPropertyAspect = getCustomAspect(type); - getNodeService().addAspect(nodeRef, customPropertyAspect, null); - } - - TypeDefinition def = getDictionaryService().getType(type); - if (def != null) - { - type = def.getParentName(); - } - else - { - type = null; - } - } - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * @param customisableTypes list of string representations of the type qnames that are customisable - */ - public void setCustomisableTypes(List customisableTypes) - { - mandatory("customisableTypes", customisableTypes); - - pendingCustomisableTypes = new ArrayList(); - for (String customisableType : customisableTypes) - { - pendingCustomisableTypes.add(QName.createQName(customisableType, getNamespaceService())); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomisable() - */ - public Set getCustomisable() - { - return getCustomisableMap().keySet(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomisable(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Set getCustomisable(NodeRef nodeRef) - { - mandatory("nodeRef", nodeRef); - - Set result = new HashSet(5); - - // Check the nodes hierarchy for customisable types - QName type = getNodeService().getType(nodeRef); - while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type)) - { - // Add to the list if the type is customisable - if (isCustomisable(type)) - { - result.add(type); - } - - // Type and get the types parent - TypeDefinition def = getDictionaryService().getType(type); - if (def != null) - { - type = def.getParentName(); - } - else - { - type = null; - } - } - - // Get all the nodes aspects - Set aspects = getNodeService().getAspects(nodeRef); - for (QName aspect : aspects) - { - QName tempAspect = QName.createQName(aspect.toString()); - while (tempAspect != null) - { - // Add to the list if the aspect is customisable - if (isCustomisable(tempAspect)) - { - result.add(tempAspect); - } - - // Try and get the parent aspect - AspectDefinition aspectDef = getDictionaryService().getAspect(tempAspect); - if (aspectDef != null) - { - tempAspect = aspectDef.getParentName(); - } - else - { - tempAspect = null; - } - } - } - - return result; - } - - /** - * Initialise custom type map - */ - private void initCustomMap() - { - customisableTypes = new HashMap(7); - Collection aspects = getDictionaryService().getAspects(RM_CUSTOM_MODEL); - for (QName aspect : aspects) - { - AspectDefinition aspectDef = getDictionaryService().getAspect(aspect); - String name = aspectDef.getName().getLocalName(); - if (name.endsWith("Properties")) - { - QName type = null; - String prefixString = aspectDef.getDescription(getDictionaryService()); - if (prefixString == null) - { - // Backward compatibility from previous RM V1.0 custom models - if (CompatibilityModel.NAME_CUSTOM_RECORD_PROPERTIES.equals(name)) - { - type = RecordsManagementModel.ASPECT_RECORD; - } - else if (CompatibilityModel.NAME_CUSTOM_RECORD_FOLDER_PROPERTIES.equals(name)) - { - type = RecordsManagementModel.TYPE_RECORD_FOLDER; - } - else if (CompatibilityModel.NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES.equals(name)) - { - type = RecordsManagementModel.TYPE_RECORD_CATEGORY; - } - else if (CompatibilityModel.NAME_CUSTOM_RECORD_SERIES_PROPERTIES.equals(name) && - // Only add the deprecated record series type as customisable if - // a v1.0 installation has added custom properties - aspectDef.getProperties().size() != 0) - { - type = CompatibilityModel.TYPE_RECORD_SERIES; - } - } - else - { - type = QName.createQName(prefixString, getNamespaceService()); - } - - // Add the customisable type to the map - if (type != null) - { - customisableTypes.put(type, aspect); - - // Remove customisable type from the pending list - if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type)) - { - pendingCustomisableTypes.remove(type); - } - } - } - } - - // Deal with any pending types left over - if (pendingCustomisableTypes != null && pendingCustomisableTypes.size() != 0) - { - NodeRef modelRef = getCustomModelRef(RecordsManagementModel.RM_CUSTOM_URI); - M2Model model = readCustomContentModel(modelRef); - try - { - for (QName customisableType : pendingCustomisableTypes) - { - QName customAspect = getCustomAspectImpl(customisableType); - - // Create the new aspect to hold the custom properties - M2Aspect aspect = model.createAspect(customAspect.toPrefixString(getNamespaceService())); - aspect.setDescription(customisableType.toPrefixString(getNamespaceService())); - - // Make a record of the customisable type - customisableTypes.put(customisableType, customAspect); - } - } - finally - { - writeCustomContentModel(modelRef, model); - } - } - - // indicate map is initialised - isCustomMapInit = true; - } - - /** - * Gets a map containing all the customisable types - * - * @return map from the customisable type to its custom aspect - */ - private Map getCustomisableMap() - { - if (customisableTypes == null) - { - throw AlfrescoRuntimeException.create("Customisable map has not been initialised correctly."); - } - return customisableTypes; - } - - /** - * Gets the QName of the custom aspect given the customisable type QName - * - * @param customisableType - * @return - */ - private QName getCustomAspect(QName customisableType) - { - Map map = getCustomisableMap(); - QName result = map.get(customisableType); - if (result == null) - { - result = getCustomAspectImpl(customisableType); - } - return result; - } - - /** - * Builds a custom aspect QName from a customisable type/aspect QName - * - * @param customisableType - * @return - */ - private QName getCustomAspectImpl(QName customisableType) - { - String localName = customisableType.toPrefixString(getNamespaceService()).replace(":", ""); - localName = MessageFormat.format("{0}CustomProperties", localName); - return QName.createQName(RM_CUSTOM_URI, localName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#isCustomisable(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isCustomisable(QName type) - { - mandatory("type", type); - - return getCustomisable().contains(type); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#makeCustomisable(org.alfresco.service.namespace.QName) - */ - @Override - public void makeCustomisable(QName type) - { - mandatory("type", type); - - if (customisableTypes == null) - { - // Add the type to the pending list - pendingCustomisableTypes.add(type); - } - else - { - QName customAspect = getCustomAspect(type); - if (getDictionaryService().getAspect(customAspect) == null) - { - NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI()); - M2Model model = readCustomContentModel(modelRef); - try - { - // Create the new aspect to hold the custom properties - M2Aspect aspect = model.createAspect(customAspect.toPrefixString(getNamespaceService())); - aspect.setDescription(type.toPrefixString(getNamespaceService())); - } - finally - { - writeCustomContentModel(modelRef, model); - } - customisableTypes.put(type, customAspect); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#unmakeCustomisable(org.alfresco.service.namespace.QName) - */ - @Override - public void unmakeCustomisable(QName type) - { - mandatory("type", type); - - if (customisableTypes == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SERVICE_NOT_INIT)); - } - - QName customAspect = getCustomAspect(type); - if (getDictionaryService().getAspect(customAspect) != null) - { - // TODO need to confirm that the custom properties are not being used! - - NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI()); - M2Model model = readCustomContentModel(modelRef); - try - { - // Create the new aspect to hold the custom properties - model.removeAspect(customAspect.toPrefixString(getNamespaceService())); - } - finally - { - writeCustomContentModel(modelRef, model); - } - customisableTypes.remove(type); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#existsCustomProperty(org.alfresco.service.namespace.QName) - */ - @Override - public boolean existsCustomProperty(QName propertyName) - { - mandatory("propertyName", propertyName); - - boolean result = false; - if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) && - getDictionaryService().getProperty(propertyName) != null) - { - result = true; - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions() - */ - public Map getCustomPropertyDefinitions() - { - Map result = new HashMap(); - for (QName customisableType : getCustomisable()) - { - Map props = getCustomPropertyDefinitions(customisableType); - if (props != null) - { - result.putAll(props); - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions(org.alfresco.module.org_alfresco_module_rm.CustomisableRmElement) - */ - public Map getCustomPropertyDefinitions(QName customisableType) - { - mandatory("customisableType", customisableType); - - Map propDefns = null; - QName relevantAspectQName = getCustomAspect(customisableType); - AspectDefinition aspectDefn = getDictionaryService().getAspect(relevantAspectQName); - if (aspectDefn != null) - { - propDefns = aspectDefn.getProperties(); - } - - return propDefns; - } - - /** - * @throws CustomMetadataException - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomPropertyDefinition(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.namespace.QName, java.lang.String, java.lang.String) - */ - public QName addCustomPropertyDefinition(QName propId, QName aspectName, String label, QName dataType, String title, String description) throws CustomMetadataException - { - return addCustomPropertyDefinition(propId, aspectName, label, dataType, title, description, null, false, false, false, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomPropertyDefinition(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.namespace.QName, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, boolean, org.alfresco.service.namespace.QName) - */ - public QName addCustomPropertyDefinition(QName propId, - QName aspectName, - String label, - QName dataType, - String title, - String description, - String defaultValue, - boolean multiValued, - boolean mandatory, - boolean isProtected, - QName lovConstraint) throws CustomMetadataException - { - if (!isCustomisable(aspectName)) - { - throw new NotCustomisableMetadataException(aspectName.toPrefixString(getNamespaceService())); - } - - // title parameter is currently ignored. Intentionally. - if (propId == null) - { - // Generate a propId - propId = this.generateQNameFor(label); - } - - mandatory("aspectName", aspectName); - mandatory("label", label); - mandatory("dataType", dataType); - - NodeRef modelRef = getCustomModelRef(propId.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - QName customAspect = getCustomAspect(aspectName); - M2Aspect customPropsAspect = deserializedModel.getAspect(customAspect.toPrefixString(getNamespaceService())); - - if (customPropsAspect == null) - { - throw new InvalidCustomAspectMetadataException(customAspect, aspectName.toPrefixString(getNamespaceService())); - } - - String propIdAsString = propId.toPrefixString(getNamespaceService()); - M2Property customProp = customPropsAspect.getProperty(propIdAsString); - if (customProp != null) - { - throw new PropertyAlreadyExistsMetadataException(propIdAsString); - } - - M2Property newProp = customPropsAspect.createProperty(propIdAsString); - newProp.setName(propIdAsString); - newProp.setType(dataType.toPrefixString(getNamespaceService())); - - // Note that the title is used to store the RM 'label'. - newProp.setTitle(label); - newProp.setDescription(description); - newProp.setDefaultValue(defaultValue); - - newProp.setMandatory(mandatory); - newProp.setProtected(isProtected); - newProp.setMultiValued(multiValued); - - newProp.setIndexed(true); - newProp.setIndexedAtomically(true); - newProp.setStoredInIndex(false); - newProp.setIndexTokenisationMode(IndexTokenisationMode.FALSE); - - if (lovConstraint != null) - { - if (! dataType.equals(DataTypeDefinition.TEXT)) - { - throw new CannotApplyConstraintMetadataException(lovConstraint, propIdAsString, dataType); - } - - String lovConstraintQNameAsString = lovConstraint.toPrefixString(getNamespaceService()); - newProp.addConstraintRef(lovConstraintQNameAsString); - } - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("addCustomPropertyDefinition: "+label+ - "=" + propIdAsString + " to aspect: "+aspectName); - } - - return propId; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#updateCustomPropertyDefinitionName(org.alfresco.service.namespace.QName, java.lang.String) - */ - public QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException - { - mandatory("propQName", propQName); - - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); - if (propDefn == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); - } - - if (newName == null) - { - return propQName; - } - - QName newPropQName = getQNameForClientId(newName); - if (newPropQName != null) - { - PropertyDefinition newPropDefn = getDictionaryService().getProperty(newPropQName); - if (newPropDefn != null && !propDefn.equals(newPropDefn)) - { - // The requested QName is already in use - String propIdAsString = newPropQName.toPrefixString(getNamespaceService()); - throw new PropertyAlreadyExistsMetadataException(propIdAsString); - } - } - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - M2Property targetProperty = findProperty(propQName, deserializedModel); - targetProperty.setName(new StringBuilder().append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX).append(QName.NAMESPACE_PREFIX).append(newName).toString()); - targetProperty.setTitle(URLDecoder.decode(newName)); - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("setCustomPropertyDefinitionLabel: "+propQName+ - "=" + newName); - } - - return propQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#setCustomPropertyDefinitionLabel(org.alfresco.service.namespace.QName, java.lang.String) - */ - public QName setCustomPropertyDefinitionLabel(QName propQName, String newLabel) - { - mandatory("propQName", propQName); - - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); - if (propDefn == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); - } - - if (newLabel == null) - { - return propQName; - } - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - M2Property targetProperty = findProperty(propQName, deserializedModel); - - targetProperty.setTitle(newLabel); - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("setCustomPropertyDefinitionLabel: "+propQName+ - "=" + newLabel); - } - - return propQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#setCustomPropertyDefinitionConstraint(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName) - */ - public QName setCustomPropertyDefinitionConstraint(QName propQName, QName newLovConstraint) - { - mandatory("propQName", propQName); - mandatory("newLovConstraint", newLovConstraint); - - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); - if (propDefn == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); - } - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - M2Property targetProp = findProperty(propQName, deserializedModel); - String dataType = targetProp.getType(); - - if (! dataType.equals(DataTypeDefinition.TEXT.toPrefixString(getNamespaceService()))) - { - - throw new AlfrescoRuntimeException(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, newLovConstraint, targetProp.getName(), dataType)); - } - String lovConstraintQNameAsString = newLovConstraint.toPrefixString(getNamespaceService()); - - // Add the constraint - if it isn't already there. - String refOfExistingConstraint = null; - - for (M2Constraint c : targetProp.getConstraints()) - { - // There should only be one constraint. - refOfExistingConstraint = c.getRef(); - break; - } - if (refOfExistingConstraint != null) - { - targetProp.removeConstraintRef(refOfExistingConstraint); - } - targetProp.addConstraintRef(lovConstraintQNameAsString); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("addCustomPropertyDefinitionConstraint: "+lovConstraintQNameAsString); - } - - return propQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#removeCustomPropertyDefinitionConstraints(org.alfresco.service.namespace.QName) - */ - public QName removeCustomPropertyDefinitionConstraints(QName propQName) - { - mandatory("propQName", propQName); - - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); - if (propDefn == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); - } - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - M2Property targetProperty = findProperty(propQName, deserializedModel); - - // Need to count backwards to remove constraints - for (int i = targetProperty.getConstraints().size() - 1; i >= 0; i--) - { - String ref = targetProperty.getConstraints().get(i).getRef(); - targetProperty.removeConstraintRef(ref); - } - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("removeCustomPropertyDefinitionConstraints: "+propQName); - } - - return propQName; - } - - /** - * - * @param propQName - * @param deserializedModel - * @return - */ - private M2Property findProperty(QName propQName, M2Model deserializedModel) - { - List aspects = deserializedModel.getAspects(); - // Search through the aspects looking for the custom property - for (M2Aspect aspect : aspects) - { - for (M2Property prop : aspect.getProperties()) - { - if (propQName.toPrefixString(getNamespaceService()).equals(prop.getName())) - { - return prop; - } - } - } - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_PROP_EXIST, propQName)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#removeCustomPropertyDefinition(org.alfresco.service.namespace.QName) - */ - public void removeCustomPropertyDefinition(QName propQName) - { - mandatory("propQName", propQName); - - NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String propQNameAsString = propQName.toPrefixString(getNamespaceService()); - - String aspectName = null; - - boolean found = false; - - // Need to select the correct aspect in the customModel from which we'll - // attempt to delete the property definition. - for (QName customisableType : getCustomisable()) - { - aspectName = getCustomAspect(customisableType).toPrefixString(getNamespaceService()); - M2Aspect customPropsAspect = deserializedModel.getAspect(aspectName); - - if (customPropsAspect == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNKNOWN_ASPECT, aspectName)); - } - - M2Property prop = customPropsAspect.getProperty(propQNameAsString); - if (prop != null) - { - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Attempting to delete custom property: "); - msg.append(propQNameAsString); - logger.debug(msg.toString()); - } - - found = true; - customPropsAspect.removeProperty(propQNameAsString); - break; - } - } - - if (!found) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQNameAsString)); - } - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("deleteCustomPropertyDefinition: "+propQNameAsString+" from aspect: "+aspectName); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomReferenceDefinitions() - */ - public Map getCustomReferenceDefinitions() - { - return getCustomAssociations(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - public void addCustomReference(NodeRef fromNode, NodeRef toNode, QName refId) - { - mandatory("fromNode", fromNode); - mandatory("toNode", toNode); - mandatory("refId", refId); - - getRelationshipService().addRelationship(refId.getLocalName(), fromNode, toNode); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - public void removeCustomReference(final NodeRef fromNode, final NodeRef toNode, final QName assocId) - { - mandatory("fromNode", fromNode); - mandatory("toNode", toNode); - mandatory("assocId",assocId); - - getRelationshipService().removeRelationship(assocId.getLocalName(), fromNode, toNode); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesFrom(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getCustomReferencesFrom(NodeRef node) - { - mandatory("node", node); - - return getNodeService().getTargetAssocs(node, RegexQNamePattern.MATCH_ALL); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomChildReferences(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getCustomChildReferences(NodeRef node) - { - mandatory("node", node); - - return getNodeService().getChildAssocs(node); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesTo(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getCustomReferencesTo(NodeRef node) - { - mandatory("node", node); - - return getNodeService().getSourceAssocs(node, RegexQNamePattern.MATCH_ALL); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomParentReferences(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getCustomParentReferences(NodeRef node) - { - mandatory("node", node); - - return getNodeService().getParentAssocs(node); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomAssocDefinition(java.lang.String) - * - * note: currently RMC custom assocs only - */ - public QName addCustomAssocDefinition(String label) - { - mandatoryString("label", label); - - return addCustomChildAssocDefinition(label, label); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomChildAssocDefinition(java.lang.String, java.lang.String) - * - * note: currently RMC custom assocs only - */ - public QName addCustomChildAssocDefinition(String source, String target) - { - mandatoryString("source", source); - mandatoryString("target", target); - - RelationshipDisplayName displayName = new RelationshipDisplayName(source, target); - RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); - - return QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), getNamespaceService()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#updateCustomChildAssocDefinition(org.alfresco.service.namespace.QName, java.lang.String, java.lang.String) - * - * note: currently RMC custom assocs only - */ - public QName updateCustomChildAssocDefinition(QName refQName, String newSource, String newTarget) - { - mandatory("refQName", refQName); - mandatoryString("newSource", newSource); - mandatoryString("newTarget", newTarget); - - RelationshipDisplayName displayName = new RelationshipDisplayName(newSource, newTarget); - String localName = refQName.getLocalName(); - RelationshipDefinition relationshipDefinition = getRelationshipService().updateRelationshipDefinition(localName, displayName); - return QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), getNamespaceService()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#updateCustomAssocDefinition(org.alfresco.service.namespace.QName, java.lang.String) - * - * note: currently RMC custom assocs only - */ - public QName updateCustomAssocDefinition(QName refQName, String newLabel) - { - mandatory("refQName", refQName); - mandatoryString("newLabel", newLabel); - - return updateCustomChildAssocDefinition(refQName, newLabel, newLabel); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomConstraintDefinition(org.alfresco.service.namespace.QName, java.lang.String, boolean, java.util.List, org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic) - */ - public void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List allowedValues, MatchLogic matchLogic) - { - mandatory("constraintName", constraintName); - mandatoryString("title", title); - mandatory("allowedValues", allowedValues); - mandatory("matchLogic", matchLogic); - - NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); - - M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); - if (customConstraint != null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONSTRAINT_EXISTS, constraintNameAsPrefixString)); - } - - M2Constraint newCon = deserializedModel.createConstraint(constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE); - - newCon.setTitle(title); - newCon.createParameter(PARAM_ALLOWED_VALUES, allowedValues); - newCon.createParameter(PARAM_CASE_SENSITIVE, caseSensitive ? "true" : "false"); - newCon.createParameter(PARAM_MATCH_LOGIC, matchLogic.toString()); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("addCustomConstraintDefinition: "+constraintNameAsPrefixString+" (valueCnt: "+allowedValues.size()+")"); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#changeCustomConstraintValues(org.alfresco.service.namespace.QName, java.util.List) - */ - public void changeCustomConstraintValues(QName constraintName, List newAllowedValues) - { - mandatory("constraintName", constraintName); - mandatory("newAllowedValues", newAllowedValues); - - NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); - - M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); - if (customConstraint == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); - } - - String type = customConstraint.getType(); - if (type == null || - (!type.equals(CUSTOM_CONSTRAINT_TYPE) && - !type.equals(CAPATIBILITY_CUSTOM_CONTRAINT_TYPE))) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE)); - } - - customConstraint.removeParameter(PARAM_ALLOWED_VALUES); - customConstraint.createParameter(PARAM_ALLOWED_VALUES, newAllowedValues); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("changeCustomConstraintValues: "+constraintNameAsPrefixString+" (valueCnt: "+newAllowedValues.size()+")"); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#changeCustomConstraintTitle(org.alfresco.service.namespace.QName, java.lang.String) - */ - public void changeCustomConstraintTitle(QName constraintName, String title) - { - mandatory("constraintName", constraintName); - mandatoryString("title", title); - - NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); - - M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); - if (customConstraint == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); - } - - String type = customConstraint.getType(); - if ((type == null) || (! type.equals(CUSTOM_CONSTRAINT_TYPE))) - { - - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE)); - } - - customConstraint.setTitle(title); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("changeCustomConstraintTitle: "+constraintNameAsPrefixString+" (title: "+title+")"); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomConstraintDefinitions(org.alfresco.service.namespace.QName) - */ - public List getCustomConstraintDefinitions(QName modelQName) - { - mandatory("modelQName", modelQName); - - Collection conDefs = getDictionaryService().getConstraints(modelQName, true); - - for (ConstraintDefinition conDef : conDefs) - { - Constraint con = conDef.getConstraint(); - if (! (con instanceof RMListOfValuesConstraint)) - { - conDefs.remove(conDef); - } - } - - return new ArrayList(conDefs); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomConstraintDefinition(org.alfresco.service.namespace.QName) - */ - public void removeCustomConstraintDefinition(QName constraintName) - { - mandatory("constraintName", constraintName); - - NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); - - M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); - if (customConstraint == null) - { - - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); - } - - deserializedModel.removeConstraint(constraintNameAsPrefixString); - - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("deleteCustomConstraintDefinition: "+constraintNameAsPrefixString); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getQNameForClientId(java.lang.String) - */ - public QName getQNameForClientId(String localName) - { - //TODO 1. After certification. This implementation currently does not support reference, - // property, constraints definitions with the same names, which is technically allowed by Alfresco. - - //TODO 2. Note the implicit assumption here that all custom references will have - // unique titles. This is, in fact, not guaranteed. - - QName propertyResult = null; - for (QName qn : getCustomPropertyDefinitions().keySet()) - { - if (localName != null && localName.equals(qn.getLocalName())) - { - propertyResult = qn; - } - } - - if (propertyResult != null) - { - return propertyResult; - } - - QName referenceResult = null; - for (QName refQn : getCustomReferenceDefinitions().keySet()) - { - if (localName != null && localName.equals(refQn.getLocalName())) - { - referenceResult = refQn; - } - } - - // TODO Handle the case where both are not null - return referenceResult; - } - - /** - * @param clientId - * @return - */ - private QName generateQNameFor(String clientId) - { - if (getQNameForClientId(clientId) != null) - { - // TODO log it's already taken. What to do? - throw new IllegalArgumentException(I18NUtil.getMessage(MSG_ERROR_CLIENT_ID, clientId)); - } - - String newGUID = GUID.generate(); - QName newQName = QName.createQName(RM_CUSTOM_PREFIX, newGUID, getNamespaceService()); - - return newQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#splitSourceTargetId(java.lang.String) - */ - public String[] splitSourceTargetId(String sourceTargetId) - { - mandatoryString("sourceTargetId", sourceTargetId); - - return splitAssociationDefinitionTitle(sourceTargetId); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCompoundIdFor(java.lang.String, java.lang.String) - */ - public String getCompoundIdFor(String sourceId, String targetId) - { - mandatoryString("sourceId", sourceId); - mandatoryString("targetId", targetId); - - return composeAssociationDefinitionTitle(sourceId, targetId); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.admin; + +import static org.springframework.extensions.surf.util.ParameterCheck.mandatory; +import static org.springframework.extensions.surf.util.ParameterCheck.mandatoryString; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; +import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.repo.dictionary.IndexTokenisationMode; +import org.alfresco.repo.dictionary.M2Aspect; +import org.alfresco.repo.dictionary.M2Constraint; +import org.alfresco.repo.dictionary.M2Model; +import org.alfresco.repo.dictionary.M2Property; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.Constraint; +import org.alfresco.service.cmr.dictionary.ConstraintDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.dictionary.TypeDefinition; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.GUID; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.core.Ordered; +import org.springframework.extensions.surf.util.I18NUtil; +import org.springframework.extensions.surf.util.URLDecoder; + +/** + * Records Management AdminService Implementation. + * + * @author Neil McErlean, janv + */ +@BehaviourBean +public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBase + implements RecordsManagementAdminService, + RecordsManagementCustomModel, + NodeServicePolicies.OnAddAspectPolicy, + NodeServicePolicies.OnRemoveAspectPolicy, + NodeServicePolicies.OnCreateNodePolicy, + ApplicationListener, + Ordered +{ + /** I18N messages*/ + private static final String MSG_SERVICE_NOT_INIT = "rm.admin.service-not-init"; + private static final String MSG_PROP_EXIST = "rm.admin.prop-exist"; + private static final String MSG_CUSTOM_PROP_EXIST = "rm.admin.custom-prop-exist"; + private static final String MSG_UNKNOWN_ASPECT = "rm.admin.unknown-aspect"; + private static final String MSG_CONSTRAINT_EXISTS = "rm.admin.constraint-exists"; + private static final String MSG_CANNOT_FIND_CONSTRAINT = "rm.admin.contraint-cannot-find"; + private static final String MSG_UNEXPECTED_TYPE_CONSTRAINT = "rm.admin.unexpected_type_constraint"; + private static final String MSG_ERROR_CLIENT_ID = "rm.admin.error-client-id"; + + /** Constants */ + private static final String CUSTOM_CONSTRAINT_TYPE = org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.class.getName(); + private static final String CAPATIBILITY_CUSTOM_CONTRAINT_TYPE = org.alfresco.module.org_alfresco_module_dod5015.caveat.RMListOfValuesConstraint.class.getName(); + private static final String PARAM_ALLOWED_VALUES = "allowedValues"; + private static final String PARAM_CASE_SENSITIVE = "caseSensitive"; + private static final String PARAM_MATCH_LOGIC = "matchLogic"; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** Transaction service */ + private TransactionService transactionService; + + /** List of types that can be customisable */ + private List pendingCustomisableTypes; + private Map customisableTypes; + + /** indicates whether the custom map has been initialised or not */ + private boolean isCustomMapInit = false; + + /** + * @param transactionService transaction service + */ + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + /** + * @param relationshipService The relationship service instance + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * Gets the relationship service instance + * + * @return The relationship service instance + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Indicate that this application content listener must be executed with the lowest + * precedence. (ie last) + * + * @see Ordered#getOrder() + */ + @Override + public int getOrder() + { + return Ordered.LOWEST_PRECEDENCE; + } + + /** + * Load the custom properties map + * + * @see ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) + */ + @Override + public void onApplicationEvent(ContextRefreshedEvent event) + { + transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + // initialise custom properties + initCustomMap(); + + return null; + } + }); + } + + /** + * Helper method to indicate whether the custom map is initialised or not. + * + * @return boolean true if initialised, false otherwise + */ + public boolean isCustomMapInit() + { + return isCustomMapInit; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + isService = true, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) + { + if (isCustomMapInit) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + if (getNodeService().exists(nodeRef) && + getDictionaryService().getAllModels().contains(RM_CUSTOM_MODEL) && + isCustomisable(aspectTypeQName)) + { + QName customPropertyAspect = getCustomAspect(aspectTypeQName); + getNodeService().addAspect(nodeRef, customPropertyAspect, null); + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + isService = true, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onRemoveAspect(final NodeRef nodeRef, final QName aspectTypeQName) + { + if (isCustomMapInit) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + if (getNodeService().exists(nodeRef) && + isCustomisable(aspectTypeQName)) + { + QName customPropertyAspect = getCustomAspect(aspectTypeQName); + getNodeService().removeAspect(nodeRef, customPropertyAspect); + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + } + + /** + * Make sure any custom property aspects are applied to newly created nodes. + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + isService = true, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onCreateNode(final ChildAssociationRef childAssocRef) + { + if (isCustomMapInit) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + if (getDictionaryService().getAllModels().contains(RecordsManagementCustomModel.RM_CUSTOM_MODEL)) + { + NodeRef nodeRef = childAssocRef.getChildRef(); + QName type = getNodeService().getType(nodeRef); + while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type)) + { + if (isCustomisable(type)) + { + QName customPropertyAspect = getCustomAspect(type); + getNodeService().addAspect(nodeRef, customPropertyAspect, null); + } + + TypeDefinition def = getDictionaryService().getType(type); + if (def != null) + { + type = def.getParentName(); + } + else + { + type = null; + } + } + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + } + + /** + * @param customisableTypes list of string representations of the type qnames that are customisable + */ + public void setCustomisableTypes(List customisableTypes) + { + mandatory("customisableTypes", customisableTypes); + + pendingCustomisableTypes = new ArrayList(); + for (String customisableType : customisableTypes) + { + pendingCustomisableTypes.add(QName.createQName(customisableType, getNamespaceService())); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomisable() + */ + public Set getCustomisable() + { + return getCustomisableMap().keySet(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomisable(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Set getCustomisable(NodeRef nodeRef) + { + mandatory("nodeRef", nodeRef); + + Set result = new HashSet(5); + + // Check the nodes hierarchy for customisable types + QName type = getNodeService().getType(nodeRef); + while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type)) + { + // Add to the list if the type is customisable + if (isCustomisable(type)) + { + result.add(type); + } + + // Type and get the types parent + TypeDefinition def = getDictionaryService().getType(type); + if (def != null) + { + type = def.getParentName(); + } + else + { + type = null; + } + } + + // Get all the nodes aspects + Set aspects = getNodeService().getAspects(nodeRef); + for (QName aspect : aspects) + { + QName tempAspect = QName.createQName(aspect.toString()); + while (tempAspect != null) + { + // Add to the list if the aspect is customisable + if (isCustomisable(tempAspect)) + { + result.add(tempAspect); + } + + // Try and get the parent aspect + AspectDefinition aspectDef = getDictionaryService().getAspect(tempAspect); + if (aspectDef != null) + { + tempAspect = aspectDef.getParentName(); + } + else + { + tempAspect = null; + } + } + } + + return result; + } + + /** + * Initialise custom type map + */ + private void initCustomMap() + { + customisableTypes = new HashMap(7); + Collection aspects = getDictionaryService().getAspects(RM_CUSTOM_MODEL); + for (QName aspect : aspects) + { + AspectDefinition aspectDef = getDictionaryService().getAspect(aspect); + String name = aspectDef.getName().getLocalName(); + if (name.endsWith("Properties")) + { + QName type = null; + String prefixString = aspectDef.getDescription(getDictionaryService()); + if (prefixString == null) + { + // Backward compatibility from previous RM V1.0 custom models + if (CompatibilityModel.NAME_CUSTOM_RECORD_PROPERTIES.equals(name)) + { + type = RecordsManagementModel.ASPECT_RECORD; + } + else if (CompatibilityModel.NAME_CUSTOM_RECORD_FOLDER_PROPERTIES.equals(name)) + { + type = RecordsManagementModel.TYPE_RECORD_FOLDER; + } + else if (CompatibilityModel.NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES.equals(name)) + { + type = RecordsManagementModel.TYPE_RECORD_CATEGORY; + } + else if (CompatibilityModel.NAME_CUSTOM_RECORD_SERIES_PROPERTIES.equals(name) && + // Only add the deprecated record series type as customisable if + // a v1.0 installation has added custom properties + aspectDef.getProperties().size() != 0) + { + type = CompatibilityModel.TYPE_RECORD_SERIES; + } + } + else + { + type = QName.createQName(prefixString, getNamespaceService()); + } + + // Add the customisable type to the map + if (type != null) + { + customisableTypes.put(type, aspect); + + // Remove customisable type from the pending list + if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type)) + { + pendingCustomisableTypes.remove(type); + } + } + } + } + + // Deal with any pending types left over + if (pendingCustomisableTypes != null && pendingCustomisableTypes.size() != 0) + { + NodeRef modelRef = getCustomModelRef(RecordsManagementModel.RM_CUSTOM_URI); + M2Model model = readCustomContentModel(modelRef); + try + { + for (QName customisableType : pendingCustomisableTypes) + { + QName customAspect = getCustomAspectImpl(customisableType); + + // Create the new aspect to hold the custom properties + M2Aspect aspect = model.createAspect(customAspect.toPrefixString(getNamespaceService())); + aspect.setDescription(customisableType.toPrefixString(getNamespaceService())); + + // Make a record of the customisable type + customisableTypes.put(customisableType, customAspect); + } + } + finally + { + writeCustomContentModel(modelRef, model); + } + } + + // indicate map is initialised + isCustomMapInit = true; + } + + /** + * Gets a map containing all the customisable types + * + * @return map from the customisable type to its custom aspect + */ + private Map getCustomisableMap() + { + if (customisableTypes == null) + { + throw AlfrescoRuntimeException.create("Customisable map has not been initialised correctly."); + } + return customisableTypes; + } + + /** + * Gets the QName of the custom aspect given the customisable type QName + * + * @param customisableType + * @return + */ + private QName getCustomAspect(QName customisableType) + { + Map map = getCustomisableMap(); + QName result = map.get(customisableType); + if (result == null) + { + result = getCustomAspectImpl(customisableType); + } + return result; + } + + /** + * Builds a custom aspect QName from a customisable type/aspect QName + * + * @param customisableType + * @return + */ + private QName getCustomAspectImpl(QName customisableType) + { + String localName = customisableType.toPrefixString(getNamespaceService()).replace(":", ""); + localName = MessageFormat.format("{0}CustomProperties", localName); + return QName.createQName(RM_CUSTOM_URI, localName); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#isCustomisable(org.alfresco.service.namespace.QName) + */ + @Override + public boolean isCustomisable(QName type) + { + mandatory("type", type); + + return getCustomisable().contains(type); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#makeCustomisable(org.alfresco.service.namespace.QName) + */ + @Override + public void makeCustomisable(QName type) + { + mandatory("type", type); + + if (customisableTypes == null) + { + // Add the type to the pending list + pendingCustomisableTypes.add(type); + } + else + { + QName customAspect = getCustomAspect(type); + if (getDictionaryService().getAspect(customAspect) == null) + { + NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI()); + M2Model model = readCustomContentModel(modelRef); + try + { + // Create the new aspect to hold the custom properties + M2Aspect aspect = model.createAspect(customAspect.toPrefixString(getNamespaceService())); + aspect.setDescription(type.toPrefixString(getNamespaceService())); + } + finally + { + writeCustomContentModel(modelRef, model); + } + customisableTypes.put(type, customAspect); + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#unmakeCustomisable(org.alfresco.service.namespace.QName) + */ + @Override + public void unmakeCustomisable(QName type) + { + mandatory("type", type); + + if (customisableTypes == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SERVICE_NOT_INIT)); + } + + QName customAspect = getCustomAspect(type); + if (getDictionaryService().getAspect(customAspect) != null) + { + // TODO need to confirm that the custom properties are not being used! + + NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI()); + M2Model model = readCustomContentModel(modelRef); + try + { + // Create the new aspect to hold the custom properties + model.removeAspect(customAspect.toPrefixString(getNamespaceService())); + } + finally + { + writeCustomContentModel(modelRef, model); + } + customisableTypes.remove(type); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#existsCustomProperty(org.alfresco.service.namespace.QName) + */ + @Override + public boolean existsCustomProperty(QName propertyName) + { + mandatory("propertyName", propertyName); + + boolean result = false; + if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) && + getDictionaryService().getProperty(propertyName) != null) + { + result = true; + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions() + */ + public Map getCustomPropertyDefinitions() + { + Map result = new HashMap(); + for (QName customisableType : getCustomisable()) + { + Map props = getCustomPropertyDefinitions(customisableType); + if (props != null) + { + result.putAll(props); + } + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomPropertyDefinitions(org.alfresco.module.org_alfresco_module_rm.CustomisableRmElement) + */ + public Map getCustomPropertyDefinitions(QName customisableType) + { + mandatory("customisableType", customisableType); + + Map propDefns = null; + QName relevantAspectQName = getCustomAspect(customisableType); + AspectDefinition aspectDefn = getDictionaryService().getAspect(relevantAspectQName); + if (aspectDefn != null) + { + propDefns = aspectDefn.getProperties(); + } + + return propDefns; + } + + /** + * @throws CustomMetadataException + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomPropertyDefinition(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.namespace.QName, java.lang.String, java.lang.String) + */ + public QName addCustomPropertyDefinition(QName propId, QName aspectName, String label, QName dataType, String title, String description) throws CustomMetadataException + { + return addCustomPropertyDefinition(propId, aspectName, label, dataType, title, description, null, false, false, false, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomPropertyDefinition(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.namespace.QName, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, boolean, org.alfresco.service.namespace.QName) + */ + public QName addCustomPropertyDefinition(QName propId, + QName aspectName, + String label, + QName dataType, + String title, + String description, + String defaultValue, + boolean multiValued, + boolean mandatory, + boolean isProtected, + QName lovConstraint) throws CustomMetadataException + { + if (!isCustomisable(aspectName)) + { + throw new NotCustomisableMetadataException(aspectName.toPrefixString(getNamespaceService())); + } + + // title parameter is currently ignored. Intentionally. + if (propId == null) + { + // Generate a propId + propId = this.generateQNameFor(label); + } + + mandatory("aspectName", aspectName); + mandatory("label", label); + mandatory("dataType", dataType); + + NodeRef modelRef = getCustomModelRef(propId.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + QName customAspect = getCustomAspect(aspectName); + M2Aspect customPropsAspect = deserializedModel.getAspect(customAspect.toPrefixString(getNamespaceService())); + + if (customPropsAspect == null) + { + throw new InvalidCustomAspectMetadataException(customAspect, aspectName.toPrefixString(getNamespaceService())); + } + + String propIdAsString = propId.toPrefixString(getNamespaceService()); + M2Property customProp = customPropsAspect.getProperty(propIdAsString); + if (customProp != null) + { + throw new PropertyAlreadyExistsMetadataException(propIdAsString); + } + + M2Property newProp = customPropsAspect.createProperty(propIdAsString); + newProp.setName(propIdAsString); + newProp.setType(dataType.toPrefixString(getNamespaceService())); + + // Note that the title is used to store the RM 'label'. + newProp.setTitle(label); + newProp.setDescription(description); + newProp.setDefaultValue(defaultValue); + + newProp.setMandatory(mandatory); + newProp.setProtected(isProtected); + newProp.setMultiValued(multiValued); + + newProp.setIndexed(true); + newProp.setIndexedAtomically(true); + newProp.setStoredInIndex(false); + newProp.setIndexTokenisationMode(IndexTokenisationMode.FALSE); + + if (lovConstraint != null) + { + if (! dataType.equals(DataTypeDefinition.TEXT)) + { + throw new CannotApplyConstraintMetadataException(lovConstraint, propIdAsString, dataType); + } + + String lovConstraintQNameAsString = lovConstraint.toPrefixString(getNamespaceService()); + newProp.addConstraintRef(lovConstraintQNameAsString); + } + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("addCustomPropertyDefinition: "+label+ + "=" + propIdAsString + " to aspect: "+aspectName); + } + + return propId; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#updateCustomPropertyDefinitionName(org.alfresco.service.namespace.QName, java.lang.String) + */ + public QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException + { + mandatory("propQName", propQName); + + PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); + if (propDefn == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); + } + + if (newName == null) + { + return propQName; + } + + QName newPropQName = getQNameForClientId(newName); + if (newPropQName != null) + { + PropertyDefinition newPropDefn = getDictionaryService().getProperty(newPropQName); + if (newPropDefn != null && !propDefn.equals(newPropDefn)) + { + // The requested QName is already in use + String propIdAsString = newPropQName.toPrefixString(getNamespaceService()); + throw new PropertyAlreadyExistsMetadataException(propIdAsString); + } + } + + NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + M2Property targetProperty = findProperty(propQName, deserializedModel); + targetProperty.setName(new StringBuilder().append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX).append(QName.NAMESPACE_PREFIX).append(newName).toString()); + targetProperty.setTitle(URLDecoder.decode(newName)); + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("setCustomPropertyDefinitionLabel: "+propQName+ + "=" + newName); + } + + return propQName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#setCustomPropertyDefinitionLabel(org.alfresco.service.namespace.QName, java.lang.String) + */ + public QName setCustomPropertyDefinitionLabel(QName propQName, String newLabel) + { + mandatory("propQName", propQName); + + PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); + if (propDefn == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); + } + + if (newLabel == null) + { + return propQName; + } + + NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + M2Property targetProperty = findProperty(propQName, deserializedModel); + + targetProperty.setTitle(newLabel); + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("setCustomPropertyDefinitionLabel: "+propQName+ + "=" + newLabel); + } + + return propQName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#setCustomPropertyDefinitionConstraint(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName) + */ + public QName setCustomPropertyDefinitionConstraint(QName propQName, QName newLovConstraint) + { + mandatory("propQName", propQName); + mandatory("newLovConstraint", newLovConstraint); + + PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); + if (propDefn == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); + } + + NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + M2Property targetProp = findProperty(propQName, deserializedModel); + String dataType = targetProp.getType(); + + if (! dataType.equals(DataTypeDefinition.TEXT.toPrefixString(getNamespaceService()))) + { + + throw new AlfrescoRuntimeException(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, newLovConstraint, targetProp.getName(), dataType)); + } + String lovConstraintQNameAsString = newLovConstraint.toPrefixString(getNamespaceService()); + + // Add the constraint - if it isn't already there. + String refOfExistingConstraint = null; + + for (M2Constraint c : targetProp.getConstraints()) + { + // There should only be one constraint. + refOfExistingConstraint = c.getRef(); + break; + } + if (refOfExistingConstraint != null) + { + targetProp.removeConstraintRef(refOfExistingConstraint); + } + targetProp.addConstraintRef(lovConstraintQNameAsString); + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("addCustomPropertyDefinitionConstraint: "+lovConstraintQNameAsString); + } + + return propQName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#removeCustomPropertyDefinitionConstraints(org.alfresco.service.namespace.QName) + */ + public QName removeCustomPropertyDefinitionConstraints(QName propQName) + { + mandatory("propQName", propQName); + + PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); + if (propDefn == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); + } + + NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + M2Property targetProperty = findProperty(propQName, deserializedModel); + + // Need to count backwards to remove constraints + for (int i = targetProperty.getConstraints().size() - 1; i >= 0; i--) + { + String ref = targetProperty.getConstraints().get(i).getRef(); + targetProperty.removeConstraintRef(ref); + } + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("removeCustomPropertyDefinitionConstraints: "+propQName); + } + + return propQName; + } + + /** + * + * @param propQName + * @param deserializedModel + * @return + */ + private M2Property findProperty(QName propQName, M2Model deserializedModel) + { + List aspects = deserializedModel.getAspects(); + // Search through the aspects looking for the custom property + for (M2Aspect aspect : aspects) + { + for (M2Property prop : aspect.getProperties()) + { + if (propQName.toPrefixString(getNamespaceService()).equals(prop.getName())) + { + return prop; + } + } + } + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_PROP_EXIST, propQName)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#removeCustomPropertyDefinition(org.alfresco.service.namespace.QName) + */ + public void removeCustomPropertyDefinition(QName propQName) + { + mandatory("propQName", propQName); + + NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + String propQNameAsString = propQName.toPrefixString(getNamespaceService()); + + String aspectName = null; + + boolean found = false; + + // Need to select the correct aspect in the customModel from which we'll + // attempt to delete the property definition. + for (QName customisableType : getCustomisable()) + { + aspectName = getCustomAspect(customisableType).toPrefixString(getNamespaceService()); + M2Aspect customPropsAspect = deserializedModel.getAspect(aspectName); + + if (customPropsAspect == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNKNOWN_ASPECT, aspectName)); + } + + M2Property prop = customPropsAspect.getProperty(propQNameAsString); + if (prop != null) + { + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Attempting to delete custom property: "); + msg.append(propQNameAsString); + logger.debug(msg.toString()); + } + + found = true; + customPropsAspect.removeProperty(propQNameAsString); + break; + } + } + + if (!found) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQNameAsString)); + } + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("deleteCustomPropertyDefinition: "+propQNameAsString+" from aspect: "+aspectName); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomReferenceDefinitions() + */ + public Map getCustomReferenceDefinitions() + { + return getCustomAssociations(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + public void addCustomReference(NodeRef fromNode, NodeRef toNode, QName refId) + { + mandatory("fromNode", fromNode); + mandatory("toNode", toNode); + mandatory("refId", refId); + + getRelationshipService().addRelationship(refId.getLocalName(), fromNode, toNode); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + public void removeCustomReference(final NodeRef fromNode, final NodeRef toNode, final QName assocId) + { + mandatory("fromNode", fromNode); + mandatory("toNode", toNode); + mandatory("assocId",assocId); + + getRelationshipService().removeRelationship(assocId.getLocalName(), fromNode, toNode); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesFrom(org.alfresco.service.cmr.repository.NodeRef) + */ + public List getCustomReferencesFrom(NodeRef node) + { + mandatory("node", node); + + return getNodeService().getTargetAssocs(node, RegexQNamePattern.MATCH_ALL); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomChildReferences(org.alfresco.service.cmr.repository.NodeRef) + */ + public List getCustomChildReferences(NodeRef node) + { + mandatory("node", node); + + return getNodeService().getChildAssocs(node); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesTo(org.alfresco.service.cmr.repository.NodeRef) + */ + public List getCustomReferencesTo(NodeRef node) + { + mandatory("node", node); + + return getNodeService().getSourceAssocs(node, RegexQNamePattern.MATCH_ALL); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomParentReferences(org.alfresco.service.cmr.repository.NodeRef) + */ + public List getCustomParentReferences(NodeRef node) + { + mandatory("node", node); + + return getNodeService().getParentAssocs(node); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomAssocDefinition(java.lang.String) + * + * note: currently RMC custom assocs only + */ + public QName addCustomAssocDefinition(String label) + { + mandatoryString("label", label); + + return addCustomChildAssocDefinition(label, label); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomChildAssocDefinition(java.lang.String, java.lang.String) + * + * note: currently RMC custom assocs only + */ + public QName addCustomChildAssocDefinition(String source, String target) + { + mandatoryString("source", source); + mandatoryString("target", target); + + RelationshipDisplayName displayName = new RelationshipDisplayName(source, target); + RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); + + return QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), getNamespaceService()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#updateCustomChildAssocDefinition(org.alfresco.service.namespace.QName, java.lang.String, java.lang.String) + * + * note: currently RMC custom assocs only + */ + public QName updateCustomChildAssocDefinition(QName refQName, String newSource, String newTarget) + { + mandatory("refQName", refQName); + mandatoryString("newSource", newSource); + mandatoryString("newTarget", newTarget); + + RelationshipDisplayName displayName = new RelationshipDisplayName(newSource, newTarget); + String localName = refQName.getLocalName(); + RelationshipDefinition relationshipDefinition = getRelationshipService().updateRelationshipDefinition(localName, displayName); + return QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), getNamespaceService()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#updateCustomAssocDefinition(org.alfresco.service.namespace.QName, java.lang.String) + * + * note: currently RMC custom assocs only + */ + public QName updateCustomAssocDefinition(QName refQName, String newLabel) + { + mandatory("refQName", refQName); + mandatoryString("newLabel", newLabel); + + return updateCustomChildAssocDefinition(refQName, newLabel, newLabel); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomConstraintDefinition(org.alfresco.service.namespace.QName, java.lang.String, boolean, java.util.List, org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic) + */ + public void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List allowedValues, MatchLogic matchLogic) + { + mandatory("constraintName", constraintName); + mandatoryString("title", title); + mandatory("allowedValues", allowedValues); + mandatory("matchLogic", matchLogic); + + NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); + + M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); + if (customConstraint != null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONSTRAINT_EXISTS, constraintNameAsPrefixString)); + } + + M2Constraint newCon = deserializedModel.createConstraint(constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE); + + newCon.setTitle(title); + newCon.createParameter(PARAM_ALLOWED_VALUES, allowedValues); + newCon.createParameter(PARAM_CASE_SENSITIVE, caseSensitive ? "true" : "false"); + newCon.createParameter(PARAM_MATCH_LOGIC, matchLogic.toString()); + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("addCustomConstraintDefinition: "+constraintNameAsPrefixString+" (valueCnt: "+allowedValues.size()+")"); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#changeCustomConstraintValues(org.alfresco.service.namespace.QName, java.util.List) + */ + public void changeCustomConstraintValues(QName constraintName, List newAllowedValues) + { + mandatory("constraintName", constraintName); + mandatory("newAllowedValues", newAllowedValues); + + NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); + + M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); + if (customConstraint == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); + } + + String type = customConstraint.getType(); + if (type == null || + (!type.equals(CUSTOM_CONSTRAINT_TYPE) && + !type.equals(CAPATIBILITY_CUSTOM_CONTRAINT_TYPE))) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE)); + } + + customConstraint.removeParameter(PARAM_ALLOWED_VALUES); + customConstraint.createParameter(PARAM_ALLOWED_VALUES, newAllowedValues); + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("changeCustomConstraintValues: "+constraintNameAsPrefixString+" (valueCnt: "+newAllowedValues.size()+")"); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#changeCustomConstraintTitle(org.alfresco.service.namespace.QName, java.lang.String) + */ + public void changeCustomConstraintTitle(QName constraintName, String title) + { + mandatory("constraintName", constraintName); + mandatoryString("title", title); + + NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); + + M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); + if (customConstraint == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); + } + + String type = customConstraint.getType(); + if ((type == null) || (! type.equals(CUSTOM_CONSTRAINT_TYPE))) + { + + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE)); + } + + customConstraint.setTitle(title); + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("changeCustomConstraintTitle: "+constraintNameAsPrefixString+" (title: "+title+")"); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomConstraintDefinitions(org.alfresco.service.namespace.QName) + */ + public List getCustomConstraintDefinitions(QName modelQName) + { + mandatory("modelQName", modelQName); + + Collection conDefs = getDictionaryService().getConstraints(modelQName, true); + + for (ConstraintDefinition conDef : conDefs) + { + Constraint con = conDef.getConstraint(); + if (! (con instanceof RMListOfValuesConstraint)) + { + conDefs.remove(conDef); + } + } + + return new ArrayList(conDefs); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomConstraintDefinition(org.alfresco.service.namespace.QName) + */ + public void removeCustomConstraintDefinition(QName constraintName) + { + mandatory("constraintName", constraintName); + + NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); + M2Model deserializedModel = readCustomContentModel(modelRef); + + String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); + + M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); + if (customConstraint == null) + { + + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString)); + } + + deserializedModel.removeConstraint(constraintNameAsPrefixString); + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("deleteCustomConstraintDefinition: "+constraintNameAsPrefixString); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getQNameForClientId(java.lang.String) + */ + public QName getQNameForClientId(String localName) + { + //TODO 1. After certification. This implementation currently does not support reference, + // property, constraints definitions with the same names, which is technically allowed by Alfresco. + + //TODO 2. Note the implicit assumption here that all custom references will have + // unique titles. This is, in fact, not guaranteed. + + QName propertyResult = null; + for (QName qn : getCustomPropertyDefinitions().keySet()) + { + if (localName != null && localName.equals(qn.getLocalName())) + { + propertyResult = qn; + } + } + + if (propertyResult != null) + { + return propertyResult; + } + + QName referenceResult = null; + for (QName refQn : getCustomReferenceDefinitions().keySet()) + { + if (localName != null && localName.equals(refQn.getLocalName())) + { + referenceResult = refQn; + } + } + + // TODO Handle the case where both are not null + return referenceResult; + } + + /** + * @param clientId + * @return + */ + private QName generateQNameFor(String clientId) + { + if (getQNameForClientId(clientId) != null) + { + // TODO log it's already taken. What to do? + throw new IllegalArgumentException(I18NUtil.getMessage(MSG_ERROR_CLIENT_ID, clientId)); + } + + String newGUID = GUID.generate(); + QName newQName = QName.createQName(RM_CUSTOM_PREFIX, newGUID, getNamespaceService()); + + return newQName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#splitSourceTargetId(java.lang.String) + */ + public String[] splitSourceTargetId(String sourceTargetId) + { + mandatoryString("sourceTargetId", sourceTargetId); + + return splitAssociationDefinitionTitle(sourceTargetId); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCompoundIdFor(java.lang.String, java.lang.String) + */ + public String getCompoundIdFor(String sourceId, String targetId) + { + mandatoryString("sourceId", sourceId); + mandatoryString("targetId", targetId); + + return composeAssociationDefinitionTitle(sourceId, targetId); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditEntry.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditEntry.java index ffd71af27e..4ff6abb0d8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditEntry.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditEntry.java @@ -1,279 +1,279 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.springframework.extensions.surf.util.ISO8601DateFormat; - -/** - * Class to represent a Records Management audit entry. - * - * @author Gavin Cornwell - */ -@AlfrescoPublicApi -public final class RecordsManagementAuditEntry -{ - private final Date timestamp; - private final String userName; - private final String fullName; - private final String userRole; - private final NodeRef nodeRef; - private final String nodeName; - private final String nodeType; - private final String event; - private final String identifier; - private final String path; - private final Map beforeProperties; - private final Map afterProperties; - private Map> changedProperties; - - /** - * Default constructor - */ - public RecordsManagementAuditEntry(Date timestamp, - String userName, String fullName, String userRole, - NodeRef nodeRef, String nodeName, String nodeType, - String event, String identifier, String path, - Map beforeProperties, - Map afterProperties) - { - ParameterCheck.mandatory("timestamp", timestamp); - ParameterCheck.mandatory("userName", userName); - - this.timestamp = timestamp; - this.userName = userName; - this.userRole = userRole; - this.fullName = fullName; - this.nodeRef = nodeRef; - this.nodeName = nodeName; - this.nodeType = nodeType; - this.event = event; - this.identifier = identifier; - this.path = path; - this.beforeProperties = beforeProperties; - this.afterProperties = afterProperties; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("(") - .append("timestamp=").append(timestamp) - .append(", userName=").append(userName) - .append(", userRole=").append(userRole) - .append(", fullName=").append(fullName) - .append(", nodeRef=").append(nodeRef) - .append(", nodeName=").append(nodeName) - .append(", event=").append(event) - .append(", identifier=").append(identifier) - .append(", path=").append(path) - .append(", beforeProperties=").append(beforeProperties) - .append(", afterProperties=").append(afterProperties) - .append(", changedProperties=").append(changedProperties) - .append(")"); - return sb.toString(); - } - - /** - * - * @return The date of the audit entry - */ - public Date getTimestamp() - { - return this.timestamp; - } - - /** - * - * @return The date of the audit entry as an ISO8601 formatted String - */ - public String getTimestampString() - { - return ISO8601DateFormat.format(this.timestamp); - } - - /** - * - * @return The username of the user that caused the audit log entry to be created - */ - public String getUserName() - { - return this.userName; - } - - /** - * - * @return The full name of the user that caused the audit log entry to be created - */ - public String getFullName() - { - return this.fullName; - } - - /** - * - * @return The role of the user that caused the audit log entry to be created - */ - public String getUserRole() - { - return this.userRole; - } - - /** - * - * @return The NodeRef of the node the audit log entry is for - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - /** - * - * @return The name of the node the audit log entry is for - */ - public String getNodeName() - { - return this.nodeName; - } - - /** - * - * @return The type of the node the audit log entry is for - */ - public String getNodeType() - { - return this.nodeType; - } - - /** - * - * @return The human readable description of the reason for the audit log - * entry i.e. metadata updated, record declared - */ - public String getEvent() - { - return this.event; - } - - /** - * An identifier for the item being audited, for example for a record - * it will be the unique record identifier, for a user it would be the - * username etc. - * - * @return Ad identifier for the thing being audited - */ - public String getIdentifier() - { - return this.identifier; - } - - /** - * - * @return The path to the object being audited - */ - public String getPath() - { - return this.path; - } - - /** - * - * @return Map of properties before the audited action - */ - public Map getBeforeProperties() - { - return this.beforeProperties; - } - - /** - * - * @return Map of properties after the audited action - */ - public Map getAfterProperties() - { - return this.afterProperties; - } - - /** - * - * @return Map of changed properties - */ - public Map> getChangedProperties() - { - if (this.changedProperties == null) - { - initChangedProperties(); - } - - return this.changedProperties; - } - - /** - * Initialises the map of changed values given the before and after properties - */ - private void initChangedProperties() - { - if (this.beforeProperties != null && this.afterProperties != null) - { - this.changedProperties = new HashMap>( - this.beforeProperties.size() + this.afterProperties.size()); - - // add all the properties present before the audited action - for (QName valuePropName : this.beforeProperties.keySet()) - { - Pair values = new Pair( - this.beforeProperties.get(valuePropName), - this.afterProperties.get(valuePropName)); - this.changedProperties.put(valuePropName, values); - } - - // add all the properties present after the audited action that - // have not already been added - for (QName valuePropName : this.afterProperties.keySet()) - { - if (!this.beforeProperties.containsKey(valuePropName)) - { - Pair values = new Pair(null, - this.afterProperties.get(valuePropName)); - this.changedProperties.put(valuePropName, values); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.alfresco.util.ParameterCheck; +import org.springframework.extensions.surf.util.ISO8601DateFormat; + +/** + * Class to represent a Records Management audit entry. + * + * @author Gavin Cornwell + */ +@AlfrescoPublicApi +public final class RecordsManagementAuditEntry +{ + private final Date timestamp; + private final String userName; + private final String fullName; + private final String userRole; + private final NodeRef nodeRef; + private final String nodeName; + private final String nodeType; + private final String event; + private final String identifier; + private final String path; + private final Map beforeProperties; + private final Map afterProperties; + private Map> changedProperties; + + /** + * Default constructor + */ + public RecordsManagementAuditEntry(Date timestamp, + String userName, String fullName, String userRole, + NodeRef nodeRef, String nodeName, String nodeType, + String event, String identifier, String path, + Map beforeProperties, + Map afterProperties) + { + ParameterCheck.mandatory("timestamp", timestamp); + ParameterCheck.mandatory("userName", userName); + + this.timestamp = timestamp; + this.userName = userName; + this.userRole = userRole; + this.fullName = fullName; + this.nodeRef = nodeRef; + this.nodeName = nodeName; + this.nodeType = nodeType; + this.event = event; + this.identifier = identifier; + this.path = path; + this.beforeProperties = beforeProperties; + this.afterProperties = afterProperties; + } + + @Override + public String toString() + { + StringBuilder sb = new StringBuilder(); + sb.append("(") + .append("timestamp=").append(timestamp) + .append(", userName=").append(userName) + .append(", userRole=").append(userRole) + .append(", fullName=").append(fullName) + .append(", nodeRef=").append(nodeRef) + .append(", nodeName=").append(nodeName) + .append(", event=").append(event) + .append(", identifier=").append(identifier) + .append(", path=").append(path) + .append(", beforeProperties=").append(beforeProperties) + .append(", afterProperties=").append(afterProperties) + .append(", changedProperties=").append(changedProperties) + .append(")"); + return sb.toString(); + } + + /** + * + * @return The date of the audit entry + */ + public Date getTimestamp() + { + return this.timestamp; + } + + /** + * + * @return The date of the audit entry as an ISO8601 formatted String + */ + public String getTimestampString() + { + return ISO8601DateFormat.format(this.timestamp); + } + + /** + * + * @return The username of the user that caused the audit log entry to be created + */ + public String getUserName() + { + return this.userName; + } + + /** + * + * @return The full name of the user that caused the audit log entry to be created + */ + public String getFullName() + { + return this.fullName; + } + + /** + * + * @return The role of the user that caused the audit log entry to be created + */ + public String getUserRole() + { + return this.userRole; + } + + /** + * + * @return The NodeRef of the node the audit log entry is for + */ + public NodeRef getNodeRef() + { + return this.nodeRef; + } + + /** + * + * @return The name of the node the audit log entry is for + */ + public String getNodeName() + { + return this.nodeName; + } + + /** + * + * @return The type of the node the audit log entry is for + */ + public String getNodeType() + { + return this.nodeType; + } + + /** + * + * @return The human readable description of the reason for the audit log + * entry i.e. metadata updated, record declared + */ + public String getEvent() + { + return this.event; + } + + /** + * An identifier for the item being audited, for example for a record + * it will be the unique record identifier, for a user it would be the + * username etc. + * + * @return Ad identifier for the thing being audited + */ + public String getIdentifier() + { + return this.identifier; + } + + /** + * + * @return The path to the object being audited + */ + public String getPath() + { + return this.path; + } + + /** + * + * @return Map of properties before the audited action + */ + public Map getBeforeProperties() + { + return this.beforeProperties; + } + + /** + * + * @return Map of properties after the audited action + */ + public Map getAfterProperties() + { + return this.afterProperties; + } + + /** + * + * @return Map of changed properties + */ + public Map> getChangedProperties() + { + if (this.changedProperties == null) + { + initChangedProperties(); + } + + return this.changedProperties; + } + + /** + * Initialises the map of changed values given the before and after properties + */ + private void initChangedProperties() + { + if (this.beforeProperties != null && this.afterProperties != null) + { + this.changedProperties = new HashMap>( + this.beforeProperties.size() + this.afterProperties.size()); + + // add all the properties present before the audited action + for (QName valuePropName : this.beforeProperties.keySet()) + { + Pair values = new Pair( + this.beforeProperties.get(valuePropName), + this.afterProperties.get(valuePropName)); + this.changedProperties.put(valuePropName, values); + } + + // add all the properties present after the audited action that + // have not already been added + for (QName valuePropName : this.afterProperties.keySet()) + { + if (!this.beforeProperties.containsKey(valuePropName)) + { + Pair values = new Pair(null, + this.afterProperties.get(valuePropName)); + this.changedProperties.put(valuePropName, values); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java index f64eae495a..4cc11842a7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditQueryParameters.java @@ -1,216 +1,216 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit; - -import java.util.Date; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Class to represent the parameters for a Records Management - * audit log query. - * - * @author Gavin Cornwell - */ -@AlfrescoPublicApi -public final class RecordsManagementAuditQueryParameters -{ - private int maxEntries = -1; - private String user; - private NodeRef nodeRef; - private Date dateFrom; - private Date dateTo; - private String event; - private QName property; - - /** - * Default constructor. - */ - public RecordsManagementAuditQueryParameters() - { - } - - /** - * - * @return The username to filter by - */ - public String getUser() - { - return this.user; - } - - /** - * Restricts the retrieved audit trail to entries made by - * the provided user. - * - * @param user The username to filter by - */ - public void setUser(String user) - { - this.user = user; - } - - /** - * - * @return The maximum number of audit log entries to retrieve - */ - public int getMaxEntries() - { - return this.maxEntries; - } - - /** - * Restricts the retrieved audit trail to the last - * maxEntries entries. - * - * @param maxEntries Maximum number of entries - */ - public void setMaxEntries(int maxEntries) - { - this.maxEntries = maxEntries; - } - - /** - * - * @return The node to get entries for - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - /** - * Restricts the retrieved audit trail to only those entries - * created by the give node. - * - * @param nodeRef The node to get entries for - */ - public void setNodeRef(NodeRef nodeRef) - { - this.nodeRef = nodeRef; - } - - /** - * - * @return The date to retrieve entries from - */ - public Date getDateFrom() - { - return this.dateFrom; - } - - /** - * Restricts the retrieved audit trail to only those entries - * that occurred after the given date. - * - * @param dateFrom Date to retrieve entries after - */ - public void setDateFrom(Date dateFrom) - { - this.dateFrom = dateFrom; - } - - /** - * - * @return The date to retrive entries to - */ - public Date getDateTo() - { - return this.dateTo; - } - - /** - * Restricts the retrieved audit trail to only those entries - * that occurred before the given date. - * - * @param dateTo Date to retrieve entries before - */ - public void setDateTo(Date dateTo) - { - this.dateTo = dateTo; - } - - /** - * - * @return The event to retrive entries for - */ - public String getEvent() - { - return this.event; - } - - /** - * Restricts the retrieved audit trail to only those entries - * that match the given event string. - * - * @param event Event to retrieve entries for - */ - public void setEvent(String event) - { - this.event = event; - } - - /** - * - * @return The property to retrieve entries for - */ - public QName getProperty() - { - return this.property; - } - - /** - * Restricts the audit trail to only those entries that involve - * the given property. - * - * @param property The property to retrieve entries for - */ - public void setProperty(QName property) - { - this.property = property; - } - - /* - * @see java.lang.Object#toString() - */ - @Override - public String toString() - { - StringBuilder builder = new StringBuilder(super.toString()); - - builder.append(" (nodeRef='").append(nodeRef).append("', user='") - .append(user).append("', dateFrom='").append(dateFrom) - .append("', dateTo='").append(dateTo).append("', maxEntries='") - .append(maxEntries).append("', event='").append(event) - .append("', property='").append(property).append("')"); - - return builder.toString(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit; + +import java.util.Date; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Class to represent the parameters for a Records Management + * audit log query. + * + * @author Gavin Cornwell + */ +@AlfrescoPublicApi +public final class RecordsManagementAuditQueryParameters +{ + private int maxEntries = -1; + private String user; + private NodeRef nodeRef; + private Date dateFrom; + private Date dateTo; + private String event; + private QName property; + + /** + * Default constructor. + */ + public RecordsManagementAuditQueryParameters() + { + } + + /** + * + * @return The username to filter by + */ + public String getUser() + { + return this.user; + } + + /** + * Restricts the retrieved audit trail to entries made by + * the provided user. + * + * @param user The username to filter by + */ + public void setUser(String user) + { + this.user = user; + } + + /** + * + * @return The maximum number of audit log entries to retrieve + */ + public int getMaxEntries() + { + return this.maxEntries; + } + + /** + * Restricts the retrieved audit trail to the last + * maxEntries entries. + * + * @param maxEntries Maximum number of entries + */ + public void setMaxEntries(int maxEntries) + { + this.maxEntries = maxEntries; + } + + /** + * + * @return The node to get entries for + */ + public NodeRef getNodeRef() + { + return this.nodeRef; + } + + /** + * Restricts the retrieved audit trail to only those entries + * created by the give node. + * + * @param nodeRef The node to get entries for + */ + public void setNodeRef(NodeRef nodeRef) + { + this.nodeRef = nodeRef; + } + + /** + * + * @return The date to retrieve entries from + */ + public Date getDateFrom() + { + return this.dateFrom; + } + + /** + * Restricts the retrieved audit trail to only those entries + * that occurred after the given date. + * + * @param dateFrom Date to retrieve entries after + */ + public void setDateFrom(Date dateFrom) + { + this.dateFrom = dateFrom; + } + + /** + * + * @return The date to retrive entries to + */ + public Date getDateTo() + { + return this.dateTo; + } + + /** + * Restricts the retrieved audit trail to only those entries + * that occurred before the given date. + * + * @param dateTo Date to retrieve entries before + */ + public void setDateTo(Date dateTo) + { + this.dateTo = dateTo; + } + + /** + * + * @return The event to retrive entries for + */ + public String getEvent() + { + return this.event; + } + + /** + * Restricts the retrieved audit trail to only those entries + * that match the given event string. + * + * @param event Event to retrieve entries for + */ + public void setEvent(String event) + { + this.event = event; + } + + /** + * + * @return The property to retrieve entries for + */ + public QName getProperty() + { + return this.property; + } + + /** + * Restricts the audit trail to only those entries that involve + * the given property. + * + * @param property The property to retrieve entries for + */ + public void setProperty(QName property) + { + this.property = property; + } + + /* + * @see java.lang.Object#toString() + */ + @Override + public String toString() + { + StringBuilder builder = new StringBuilder(super.toString()); + + builder.append(" (nodeRef='").append(nodeRef).append("', user='") + .append(user).append("', dateFrom='").append(dateFrom) + .append("', dateTo='").append(dateTo).append("', maxEntries='") + .append(maxEntries).append("', event='").append(event) + .append("', property='").append(property).append("')"); + + return builder.toString(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java index e324093dcb..bef1ae271c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java @@ -1,225 +1,225 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit; - -import java.io.File; -import java.io.Serializable; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management audit service. - * - * @author Gavin Cornwell - */ -@AlfrescoPublicApi -@SuppressWarnings("deprecation") -public interface RecordsManagementAuditService extends RecordsManagementAuditServiceDeprecated -{ - public enum ReportFormat { HTML, JSON } - - - - /** - * Retrieves a list of audit events. - * - * @return List of audit events - */ - List getAuditEvents(); - - /** - * Register audit event. - *

- * Creates an instance of a simple audit event and registers it with - * the service. - * - * @param name name of audit event - * @param label display label of audit event - */ - void registerAuditEvent(String name, String label); - - /** - * Register audit event. - * - * @param auditEvent audit event - */ - void registerAuditEvent(AuditEvent auditEvent); - - /** - * Audits an event, assumes no properties where modified and that the event should not be audited - * immediately. - * - * @param nodeRef node reference - * @param eventName event name - */ - void auditEvent(NodeRef nodeRef, - String eventName); - - /** - * Audits an event, assumes that the event should not be audited immediately and not be removed if no property is changed. - * - * @param nodeRef node reference - * @param eventName event name - * @param before property values before event - * @param after property values after event - */ - void auditEvent(NodeRef nodeRef, - String eventName, - Map before, - Map after); - - /** - * Audit event, assumes not to be removed if no property is changed. - * - * @param nodeRef node reference - * @param eventName event name - * @param before property values before event - * @param after property values after event - * @param immediate true if event is to be audited immediately, false otherwise - */ - void auditEvent(NodeRef nodeRef, - String eventName, - Map before, - Map after, - boolean immediate); - - /** - * Audit event. - * - * @param nodeRef node reference - * @param eventName event name - * @param before property values before event - * @param after property values after event - * @param immediate true if event is to be audited immediately, false otherwise - * @param removeIfNoPropertyChanged true if event is not audited when there are no properties changed, false otherwise - */ - void auditEvent(NodeRef nodeRef, - String eventName, - Map before, - Map after, - boolean immediate, - boolean removeIfNoPropertyChanged); - - /** - * Determines whether the RM audit log is currently enabled. - * - * @param filePlan file plan - * @return true if RM auditing is active false otherwise - */ - boolean isAuditLogEnabled(NodeRef filePlan); - - /** - * Start RM auditing. - * - * @param filePlan file plan - */ - void startAuditLog(NodeRef filePlan); - - /** - * Stop RM auditing. - * - * @param filePlan file plan - */ - void stopAuditLog(NodeRef filePlan); - - - /** - * Clears the RM audit. - * - * @param filePlan file plan - */ - void clearAuditLog(NodeRef filePlan); - - /** - * Returns the date the RM audit was last started. - * - * @param filePlan file plan - * @return Date the audit was last started - */ - Date getDateAuditLogLastStarted(NodeRef filePlan); - - /** - * Returns the date the RM audit was last stopped. - * - * @return Date the audit was last stopped - */ - Date getDateAuditLogLastStopped(NodeRef filePlan); - - /** - * Retrieves a list of audit log entries using the provided parameters - * represented by the RecordsManagementAuditQueryParameters instance. - *

- * The parameters are all optional so an empty RecordsManagementAuditQueryParameters - * object will result in ALL audit log entries for the RM system being - * returned. Setting the various parameters effectively filters the full - * audit trail. - * - * @param params Parameters to use to retrieve audit trail (never null) - * @param format The format the report should be produced in - * @return File containing JSON representation of audit trail - */ - File getAuditTrailFile(RecordsManagementAuditQueryParameters params, ReportFormat format); - - /** - * Retrieves a list of audit log entries using the provided parameters - * represented by the RecordsManagementAuditQueryParameters instance. - *

- * The parameters are all optional so an empty RecordsManagementAuditQueryParameters - * object will result in ALL audit log entries for the RM system being - * returned. Setting the various parameters effectively filters the full - * audit trail. - * - * @param params Parameters to use to retrieve audit trail (never null) - * @return All entries for the audit trail - */ - List getAuditTrail(RecordsManagementAuditQueryParameters params); - - /** - * Retrieves a list of audit log entries using the provided parameters - * represented by the RecordsManagementAuditQueryParameters instance and - * then files the resulting log as an undeclared record in the record folder - * represented by the given NodeRef. - *

- * The parameters are all optional so an empty RecordsManagementAuditQueryParameters - * object will result in ALL audit log entries for the RM system being - * returned. Setting the various parameters effectively filters the full - * audit trail. - * - * @param params Parameters to use to retrieve audit trail (never null) - * @param destination NodeRef representing a record folder in which to file the audit log - * @param format The format the report should be produced in - * @return NodeRef of the undeclared record filed - */ - NodeRef fileAuditTrailAsRecord(RecordsManagementAuditQueryParameters params, NodeRef destination, ReportFormat format); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit; + +import java.io.File; +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Records management audit service. + * + * @author Gavin Cornwell + */ +@AlfrescoPublicApi +@SuppressWarnings("deprecation") +public interface RecordsManagementAuditService extends RecordsManagementAuditServiceDeprecated +{ + public enum ReportFormat { HTML, JSON } + + + + /** + * Retrieves a list of audit events. + * + * @return List of audit events + */ + List getAuditEvents(); + + /** + * Register audit event. + *

+ * Creates an instance of a simple audit event and registers it with + * the service. + * + * @param name name of audit event + * @param label display label of audit event + */ + void registerAuditEvent(String name, String label); + + /** + * Register audit event. + * + * @param auditEvent audit event + */ + void registerAuditEvent(AuditEvent auditEvent); + + /** + * Audits an event, assumes no properties where modified and that the event should not be audited + * immediately. + * + * @param nodeRef node reference + * @param eventName event name + */ + void auditEvent(NodeRef nodeRef, + String eventName); + + /** + * Audits an event, assumes that the event should not be audited immediately and not be removed if no property is changed. + * + * @param nodeRef node reference + * @param eventName event name + * @param before property values before event + * @param after property values after event + */ + void auditEvent(NodeRef nodeRef, + String eventName, + Map before, + Map after); + + /** + * Audit event, assumes not to be removed if no property is changed. + * + * @param nodeRef node reference + * @param eventName event name + * @param before property values before event + * @param after property values after event + * @param immediate true if event is to be audited immediately, false otherwise + */ + void auditEvent(NodeRef nodeRef, + String eventName, + Map before, + Map after, + boolean immediate); + + /** + * Audit event. + * + * @param nodeRef node reference + * @param eventName event name + * @param before property values before event + * @param after property values after event + * @param immediate true if event is to be audited immediately, false otherwise + * @param removeIfNoPropertyChanged true if event is not audited when there are no properties changed, false otherwise + */ + void auditEvent(NodeRef nodeRef, + String eventName, + Map before, + Map after, + boolean immediate, + boolean removeIfNoPropertyChanged); + + /** + * Determines whether the RM audit log is currently enabled. + * + * @param filePlan file plan + * @return true if RM auditing is active false otherwise + */ + boolean isAuditLogEnabled(NodeRef filePlan); + + /** + * Start RM auditing. + * + * @param filePlan file plan + */ + void startAuditLog(NodeRef filePlan); + + /** + * Stop RM auditing. + * + * @param filePlan file plan + */ + void stopAuditLog(NodeRef filePlan); + + + /** + * Clears the RM audit. + * + * @param filePlan file plan + */ + void clearAuditLog(NodeRef filePlan); + + /** + * Returns the date the RM audit was last started. + * + * @param filePlan file plan + * @return Date the audit was last started + */ + Date getDateAuditLogLastStarted(NodeRef filePlan); + + /** + * Returns the date the RM audit was last stopped. + * + * @return Date the audit was last stopped + */ + Date getDateAuditLogLastStopped(NodeRef filePlan); + + /** + * Retrieves a list of audit log entries using the provided parameters + * represented by the RecordsManagementAuditQueryParameters instance. + *

+ * The parameters are all optional so an empty RecordsManagementAuditQueryParameters + * object will result in ALL audit log entries for the RM system being + * returned. Setting the various parameters effectively filters the full + * audit trail. + * + * @param params Parameters to use to retrieve audit trail (never null) + * @param format The format the report should be produced in + * @return File containing JSON representation of audit trail + */ + File getAuditTrailFile(RecordsManagementAuditQueryParameters params, ReportFormat format); + + /** + * Retrieves a list of audit log entries using the provided parameters + * represented by the RecordsManagementAuditQueryParameters instance. + *

+ * The parameters are all optional so an empty RecordsManagementAuditQueryParameters + * object will result in ALL audit log entries for the RM system being + * returned. Setting the various parameters effectively filters the full + * audit trail. + * + * @param params Parameters to use to retrieve audit trail (never null) + * @return All entries for the audit trail + */ + List getAuditTrail(RecordsManagementAuditQueryParameters params); + + /** + * Retrieves a list of audit log entries using the provided parameters + * represented by the RecordsManagementAuditQueryParameters instance and + * then files the resulting log as an undeclared record in the record folder + * represented by the given NodeRef. + *

+ * The parameters are all optional so an empty RecordsManagementAuditQueryParameters + * object will result in ALL audit log entries for the RM system being + * returned. Setting the various parameters effectively filters the full + * audit trail. + * + * @param params Parameters to use to retrieve audit trail (never null) + * @param destination NodeRef representing a record folder in which to file the audit log + * @param format The format the report should be produced in + * @return NodeRef of the undeclared record filed + */ + NodeRef fileAuditTrailAsRecord(RecordsManagementAuditQueryParameters params, NodeRef destination, ReportFormat format); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java index e238562ecf..fe0745a966 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java @@ -1,1759 +1,1759 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.repo.audit.AuditComponent; -import org.alfresco.repo.audit.model.AuditApplication; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.transaction.AlfrescoTransactionSupport; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.transaction.TransactionalResourceHelper; -import org.alfresco.service.cmr.audit.AuditQueryParameters; -import org.alfresco.service.cmr.audit.AuditService; -import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.MLText; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.Pair; -import org.alfresco.util.PropertyCheck; -import org.alfresco.util.PropertyMap; -import org.alfresco.util.TempFileProvider; -import org.alfresco.util.transaction.TransactionListenerAdapter; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.context.ApplicationEvent; -import org.springframework.extensions.surf.util.AbstractLifecycleBean; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Records Management Audit Service Implementation. - * - * @author Gavin Cornwell - * @since 3.2 - */ -public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean - implements RecordsManagementAuditService -{ - /** I18N */ - private static final String MSG_TRAIL_FILE_FAIL = "rm.audit.trail-file-fail"; - private static final String MSG_AUDIT_REPORT = "rm.audit.audit-report"; - - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementAuditServiceImpl.class); - - private static final String ACCESS_AUDIT_CAPABILITY = "AccessAudit"; - - private static final String KEY_RM_AUDIT_NODE_RECORDS = "RMAUditNodeRecords"; - - protected static final String RM_AUDIT_EVENT_LOGIN_SUCCESS = "Login.Success"; - protected static final String RM_AUDIT_EVENT_LOGIN_FAILURE = "Login.Failure"; - - protected static final String RM_AUDIT_APPLICATION_NAME = "RM"; - protected static final String RM_AUDIT_PATH_ROOT = "/RM"; - protected static final String RM_AUDIT_SNIPPET_EVENT = "/event"; - protected static final String RM_AUDIT_SNIPPET_PERSON = "/person"; - protected static final String RM_AUDIT_SNIPPET_NAME = "/name"; - protected static final String RM_AUDIT_SNIPPET_NODE = "/node"; - protected static final String RM_AUDIT_SNIPPET_CHANGES = "/changes"; - protected static final String RM_AUDIT_SNIPPET_BEFORE = "/before"; - protected static final String RM_AUDIT_SNIPPET_AFTER = "/after"; - - protected static final String RM_AUDIT_DATA_PERSON_FULLNAME = "/RM/event/person/fullName"; - protected static final String RM_AUDIT_DATA_PERSON_ROLES = "/RM/event/person/roles"; - protected static final String RM_AUDIT_DATA_EVENT_NAME = "/RM/event/name/value"; - protected static final String RM_AUDIT_DATA_NODE_NODEREF = "/RM/event/node/noderef"; - protected static final String RM_AUDIT_DATA_NODE_NAME = "/RM/event/node/name"; - protected static final String RM_AUDIT_DATA_NODE_TYPE = "/RM/event/node/type"; - protected static final String RM_AUDIT_DATA_NODE_IDENTIFIER = "/RM/event/node/identifier"; - protected static final String RM_AUDIT_DATA_NODE_NAMEPATH = "/RM/event/node/namePath"; - protected static final String RM_AUDIT_DATA_NODE_CHANGES_BEFORE = "/RM/event/node/changes/before/value"; - protected static final String RM_AUDIT_DATA_NODE_CHANGES_AFTER = "/RM/event/node/changes/after/value"; - - protected static final String RM_AUDIT_DATA_LOGIN_USERNAME = "/RM/login/args/userName/value"; - protected static final String RM_AUDIT_DATA_LOGIN_FULLNAME = "/RM/login/no-error/fullName"; - protected static final String RM_AUDIT_DATA_LOGIN_ERROR = "/RM/login/error/value"; - - /* Provide Backward compatibility with DOD5015 Audit Events RM-904*/ - protected static final String DOD5015_AUDIT_APPLICATION_NAME = "DOD5015"; - protected static final String DOD5015_AUDIT_PATH_ROOT = "/DOD5015"; - protected static final String DOD5015_AUDIT_SNIPPET_EVENT = "/event"; - protected static final String DOD5015_AUDIT_SNIPPET_PERSON = "/person"; - protected static final String DOD5015_AUDIT_SNIPPET_NAME = "/name"; - protected static final String DOD5015_AUDIT_SNIPPET_NODE = "/node"; - protected static final String DOD5015_AUDIT_SNIPPET_CHANGES = "/changes"; - protected static final String DOD5015_AUDIT_SNIPPET_BEFORE = "/before"; - protected static final String DOD5015_AUDIT_SNIPPET_AFTER = "/after"; - - protected static final String DOD5015_AUDIT_DATA_PERSON_FULLNAME = "/DOD5015/event/person/fullName"; - protected static final String DOD5015_AUDIT_DATA_PERSON_ROLES = "/DOD5015/event/person/roles"; - protected static final String DOD5015_AUDIT_DATA_EVENT_NAME = "/DOD5015/event/name/value"; - protected static final String DOD5015_AUDIT_DATA_NODE_NODEREF = "/DOD5015/event/node/noderef"; - protected static final String DOD5015_AUDIT_DATA_NODE_NAME = "/DOD5015/event/node/name"; - protected static final String DOD5015_AUDIT_DATA_NODE_TYPE = "/DOD5015/event/node/type"; - protected static final String DOD5015_AUDIT_DATA_NODE_IDENTIFIER = "/DOD5015/event/node/identifier"; - protected static final String DOD5015_AUDIT_DATA_NODE_NAMEPATH = "/DOD5015/event/node/namePath"; - protected static final String DOD5015_AUDIT_DATA_NODE_CHANGES_BEFORE = "/DOD5015/event/node/changes/before/value"; - protected static final String DOD5015_AUDIT_DATA_NODE_CHANGES_AFTER = "/DOD5015/event/node/changes/after/value"; - - protected static final String DOD5015_AUDIT_DATA_LOGIN_USERNAME = "/DOD5015/login/args/userName/value"; - protected static final String DOD5015_AUDIT_DATA_LOGIN_FULLNAME = "/DOD5015/login/no-error/fullName"; - protected static final String DOD5015_AUDIT_DATA_LOGIN_ERROR = "/DOD5015/login/error/value"; - /* End Backward compatibility with DOD5015 Audit Events */ - - protected static final String AUDIT_TRAIL_FILE_PREFIX = "audit_"; - protected static final String AUDIT_TRAIL_JSON_FILE_SUFFIX = ".json"; - protected static final String AUDIT_TRAIL_HTML_FILE_SUFFIX = ".html"; - - /** Audit auditing events */ - private static final String AUDIT_EVENT_START = "audit.start"; - private static final String MSG_AUDIT_START = "rm.audit.audit-start"; - private static final String AUDIT_EVENT_STOP = "audit.stop"; - private static final String MSG_AUDIT_STOP = "rm.audit.audit-stop"; - private static final String AUDIT_EVENT_CLEAR = "audit.clear"; - private static final String MSG_AUDIT_CLEAR = "rm.audit.audit-clear"; - private static final String AUDIT_EVENT_VIEW = "audit.view"; - private static final String MSG_AUDIT_VIEW = "rm.audit.audit-view"; - - private PolicyComponent policyComponent; - private DictionaryService dictionaryService; - private TransactionService transactionService; - private NodeService nodeService; - private ContentService contentService; - private AuditComponent auditComponent; - private AuditService auditService; - private RecordsManagementActionService rmActionService; - private FilePlanService filePlanService; - private NamespaceService namespaceService; - protected CapabilityService capabilityService; - - private boolean shutdown = false; - - private List ignoredAuditProperties; - - private List propertiesToBeRemoved = new ArrayList(); - - private RMAuditTxnListener txnListener = new RMAuditTxnListener(); - - /** Registered and initialised records management auditEvents */ - private Map auditEvents = new HashMap(); - - /** - * Set the component used to bind to behaviour callbacks - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Provides user-readable names for types - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Set the component used to start new transactions - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Sets the NodeService instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Sets the ContentService instance - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * The component to create audit events - */ - public void setAuditComponent(AuditComponent auditComponent) - { - this.auditComponent = auditComponent; - } - - /** - * Sets the AuditService instance - */ - public void setAuditService(AuditService auditService) - { - this.auditService = auditService; - } - - /** - * Sets the RecordsManagementActionService instance - */ - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - - - - /** - * @param ignoredAuditProperties - */ - public void setIgnoredAuditProperties(List ignoredAuditProperties) - { - this.ignoredAuditProperties = ignoredAuditProperties; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#registerAuditEvent(java.lang.String, java.lang.String) - */ - @Override - public void registerAuditEvent(String name, String label) - { - registerAuditEvent(new AuditEvent(name, label)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#registerAuditEvent(org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent) - */ - @Override - public void registerAuditEvent(AuditEvent auditEvent) - { - if (logger.isDebugEnabled()) - { - logger.debug("Registering audit event " + auditEvent.getName()); - } - - this.auditEvents.put(auditEvent.getName(), auditEvent); - } - - /** - * Checks that all necessary properties have been set. - */ - public void init() - { - PropertyCheck.mandatory(this, "policyComponent", policyComponent); - PropertyCheck.mandatory(this, "transactionService", transactionService); - PropertyCheck.mandatory(this, "nodeService", nodeService); - PropertyCheck.mandatory(this, "contentService", contentService); - PropertyCheck.mandatory(this, "auditComponent", auditComponent); - PropertyCheck.mandatory(this, "auditService", auditService); - PropertyCheck.mandatory(this, "rmActionService", rmActionService); - PropertyCheck.mandatory(this, "dictionaryService", dictionaryService); - PropertyCheck.mandatory(this, "filePlanService", filePlanService); - - // register audit auditing events - registerAuditEvent(AUDIT_EVENT_CLEAR, MSG_AUDIT_CLEAR); - registerAuditEvent(AUDIT_EVENT_START, MSG_AUDIT_START); - registerAuditEvent(AUDIT_EVENT_STOP, MSG_AUDIT_STOP); - registerAuditEvent(AUDIT_EVENT_VIEW, MSG_AUDIT_VIEW); - - // properties to be ignored by audit - for (String qname : ignoredAuditProperties) - { - this.propertiesToBeRemoved.add(QName.createQName(qname, this.namespaceService)); - } - } - - /** - * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onBootstrap(ApplicationEvent event) - { - shutdown = false; - } - - /** - * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onShutdown(ApplicationEvent event) - { - shutdown = true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#isAuditLogEnabled(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isAuditLogEnabled(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - return auditService.isAuditEnabled( - RM_AUDIT_APPLICATION_NAME, - RM_AUDIT_PATH_ROOT); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#startAuditLog(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void startAuditLog(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - auditService.enableAudit( - RM_AUDIT_APPLICATION_NAME, - RM_AUDIT_PATH_ROOT); - - if (logger.isInfoEnabled()) - { - logger.info("Started Records Management auditing"); - } - - auditEvent(filePlan, AUDIT_EVENT_START, null, null, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#stopAuditLog(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void stopAuditLog(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - auditEvent(filePlan, AUDIT_EVENT_STOP, null, null, true); - - auditService.disableAudit( - RM_AUDIT_APPLICATION_NAME, - RM_AUDIT_PATH_ROOT); - - if (logger.isInfoEnabled()) - { - logger.info("Stopped Records Management auditing"); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#clearAuditLog(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void clearAuditLog(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - auditService.clearAudit(RM_AUDIT_APPLICATION_NAME, null, null); - if (logger.isInfoEnabled()) - { - logger.debug("Records Management audit log has been cleared"); - } - - auditEvent(filePlan, AUDIT_EVENT_CLEAR, null, null, true); - } - - /** - * {@inheritDoc} - */ - @Override - public Date getDateAuditLogLastStarted(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - // TODO: return proper date, for now it's today's date - return getStartOfDay(new Date()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#getDateAuditLogLastStopped(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Date getDateAuditLogLastStopped(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - // TODO use file plan to scope audit log - - // TODO: return proper date, for now it's today's date - return getEndOfDay(new Date()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void auditEvent(NodeRef nodeRef, String eventName) - { - auditEvent(nodeRef, eventName, null, null, false, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map) - */ - @Override - public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after) - { - auditEvent(nodeRef, eventName, before, after, false, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map, boolean) - */ - @Override - public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after, boolean immediate) - { - auditEvent(nodeRef, eventName, before, after, immediate, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map, boolean) - */ - @Override - public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after, boolean immediate, boolean removeIfNoPropertyChanged) - { - // deal with immediate auditing if required - if (immediate) - { - Map auditMap = buildAuditMap(nodeRef, eventName, before, after, removeIfNoPropertyChanged); - auditComponent.recordAuditValues(RM_AUDIT_PATH_ROOT, auditMap); - } - else - { - Set auditDetails = TransactionalResourceHelper.getSet(KEY_RM_AUDIT_NODE_RECORDS); - AlfrescoTransactionSupport.bindListener(txnListener); - - // RM-936: Eliminate multiple audit maps from being generated when events with the same name are required to be fired multiple times in the same transaction. - // Check if auditDetails already contains an auditedNode with the same combination of nodeRef and eventName. - boolean auditNodeAlreadyExists = false; - for (RMAuditNode existingRMAuditNode : auditDetails) - { - if (existingRMAuditNode.getNodeRef().equals(nodeRef) && existingRMAuditNode.getEventName().equals(eventName)) - { - // If there exists such an auditNode, update its 'after' properties with the latest set of properties and leave its 'before' properties unchanged so that it - // retains the original set of properties. The first 'before' and last 'after' will be diff'ed when comes to building the auditMap later when the transaction - // commits. - existingRMAuditNode.setNodePropertiesAfter(after); - auditNodeAlreadyExists = true; - break; - } - } - - if (!auditNodeAlreadyExists) - { - // Create a new auditNode if it doesn't already exist - RMAuditNode auditedNode = new RMAuditNode(); - auditedNode.setNodeRef(nodeRef); - auditedNode.setEventName(eventName); - auditedNode.setNodePropertiesBefore(before); - auditedNode.setNodePropertiesAfter(after); - auditedNode.setRemoveIfNoPropertyChanged(removeIfNoPropertyChanged); - - auditDetails.add(auditedNode); - } - } - } - - /** - * Helper method to build audit map - * - * @param nodeRef - * @param eventName - * @return - * @since 2.0.3 - */ - private Map buildAuditMap(NodeRef nodeRef, String eventName, Map propertiesBefore, Map propertiesAfter, boolean removeOnNoPropertyChange) - { - Map auditMap = new HashMap(13); - auditMap.put( - AuditApplication.buildPath( - RM_AUDIT_SNIPPET_EVENT, - RM_AUDIT_SNIPPET_NAME), - eventName); - - if (nodeRef != null) - { - auditMap.put( - AuditApplication.buildPath( - RM_AUDIT_SNIPPET_EVENT, - RM_AUDIT_SNIPPET_NODE), - nodeRef); - } - - // Filter out any properties to be audited if specified in the Spring configuration. - if (!ignoredAuditProperties.isEmpty()) - { - removeAuditProperties(propertiesBefore, propertiesAfter); - } - - // Property changes - Pair, Map> deltaPair = PropertyMap.getBeforeAndAfterMapsForChanges(propertiesBefore, propertiesAfter); - - // If both the first and second Map in the deltaPair are empty and removeOnNoPropertyChange is true, the entire auditMap is discarded so it won't be audited. - if (deltaPair.getFirst().isEmpty() && deltaPair.getSecond().isEmpty() && removeOnNoPropertyChange) - { - auditMap.clear(); - } - else - { - auditMap.put( - AuditApplication.buildPath( - RM_AUDIT_SNIPPET_EVENT, - RM_AUDIT_SNIPPET_NODE, - RM_AUDIT_SNIPPET_CHANGES, - RM_AUDIT_SNIPPET_BEFORE), - (Serializable) deltaPair.getFirst()); - auditMap.put( - AuditApplication.buildPath( - RM_AUDIT_SNIPPET_EVENT, - RM_AUDIT_SNIPPET_NODE, - RM_AUDIT_SNIPPET_CHANGES, - RM_AUDIT_SNIPPET_AFTER), - (Serializable) deltaPair.getSecond()); - } - return auditMap; - } - - /** - * Helper method to remove system properties from maps - * - * @param properties - */ - private void removeAuditProperties(Map before, Map after) - { - if (before != null) - { - before.keySet().removeAll(this.propertiesToBeRemoved); - } - if (after != null) - { - after.keySet().removeAll(this.propertiesToBeRemoved); - } - } - - /** - * A stateless transaction listener for RM auditing. This component picks up the data of modified nodes and generates the audit information. - *

- * This class is not static so that the instances will have access to the action's implementation. - * - * @author Derek Hulley - * @since 3.2 - */ - private class RMAuditTxnListener extends TransactionListenerAdapter - { - private final Log logger = LogFactory.getLog(RecordsManagementAuditServiceImpl.class); - - /* - * Equality and hashcode generation are left unimplemented; we expect to only have a single - * instance of this class per action. - */ - - /** - * Get the action parameters from the transaction and audit them. - */ - @Override - public void afterCommit() - { - final Set auditedNodes = TransactionalResourceHelper.getSet(KEY_RM_AUDIT_NODE_RECORDS); - - // Start a *new* read-write transaction to audit in - RetryingTransactionCallback auditCallback = new RetryingTransactionCallback() - { - @Override - public Void execute() throws Throwable - { - auditInTxn(auditedNodes); - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(auditCallback, false, true); - } - - /** - * Do the actual auditing, assuming the presence of a viable transaction - * - * @param auditedNodes details of the nodes that were modified - */ - private void auditInTxn(Set auditedNodes) throws Throwable - { - // Go through all the audit information and audit it - boolean auditedSomething = false; - for (RMAuditNode auditedNode : auditedNodes) - { - NodeRef nodeRef = auditedNode.getNodeRef(); - - // If the node is gone, then do nothing - if (nodeRef != null && !nodeService.exists(nodeRef)) - { - continue; - } - - // build the audit map - Map auditMap = buildAuditMap(nodeRef, - auditedNode.getEventName(), - auditedNode.getNodePropertiesBefore(), - auditedNode.getNodePropertiesAfter(), - auditedNode.getRemoveIfNoPropertyChanged()); - // Audit it - if (logger.isDebugEnabled()) - { - logger.debug("RM Audit: Auditing values: \n" + auditMap); - } - auditMap = auditComponent.recordAuditValues(RM_AUDIT_PATH_ROOT, auditMap); - if (auditMap.isEmpty()) - { - if (logger.isDebugEnabled()) - { - logger.debug("RM Audit: Nothing was audited."); - } - } - else - { - if (logger.isDebugEnabled()) - { - logger.debug("RM Audit: Audited values: \n" + auditMap); - } - // We must commit the transaction to get the values in - auditedSomething = true; - } - } - // Check if anything was audited - if (!auditedSomething) - { - // Nothing was audited, so do nothing - RetryingTransactionHelper.getActiveUserTransaction().setRollbackOnly(); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public File getAuditTrailFile(RecordsManagementAuditQueryParameters params, ReportFormat format) - { - ParameterCheck.mandatory("params", params); - - Writer fileWriter = null; - try - { - File auditTrailFile = TempFileProvider.createTempFile(AUDIT_TRAIL_FILE_PREFIX, - format == ReportFormat.HTML ? AUDIT_TRAIL_HTML_FILE_SUFFIX : AUDIT_TRAIL_JSON_FILE_SUFFIX); - fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(auditTrailFile),"UTF8")); - // Get the results, dumping to file - getAuditTrailImpl(params, null, fileWriter, format); - // Done - return auditTrailFile; - } - catch (IOException e) - { - throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, e); - } - finally - { - // close the writer - if (fileWriter != null) - { - try { fileWriter.close(); } catch (IOException closeEx) {} - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public List getAuditTrail(RecordsManagementAuditQueryParameters params) - { - ParameterCheck.mandatory("params", params); - - List entries = new ArrayList(50); - try - { - getAuditTrailImpl(params, entries, null, null); - // Done - return entries; - } - catch (IOException e) - { - // Should be - throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, e); - } - } - - /** - * Get the audit trail, optionally dumping the results the the given writer dumping to a list. - * - * @param params the search parameters - * @param results the list to which individual results will be dumped - * @param writer Writer to write the audit trail - * @param reportFormat Format to write the audit trail in, ignored if writer is null - */ - private void getAuditTrailImpl( - final RecordsManagementAuditQueryParameters params, - final List results, - final Writer writer, - final ReportFormat reportFormat) - throws IOException - { - if (logger.isDebugEnabled()) - { - logger.debug("Retrieving audit trail in '" + reportFormat + "' format using parameters: " + params); - } - - // define the callback - AuditQueryCallback callback = new AuditQueryCallback() - { - private boolean firstEntry = true; - - - @Override - public boolean valuesRequired() - { - return true; - } - - /** - * Just log the error, but continue - */ - @Override - public boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error) - { - logger.warn(errorMsg, error); - return true; - } - - @Override - @SuppressWarnings("unchecked") - public boolean handleAuditEntry( - Long entryId, - String applicationName, - String user, - long time, - Map values) - { - // Check for context shutdown - if (shutdown) - { - return false; - } - - - Date timestamp = new Date(time); - String eventName = null; - String fullName = null; - String userRoles = null; - NodeRef nodeRef = null; - String nodeName = null; - String nodeType = null; - String nodeIdentifier = null; - String namePath = null; - Map beforeProperties = null; - Map afterProperties = null; - - if (values.containsKey(RM_AUDIT_DATA_EVENT_NAME)) - { - // This data is /RM/event/... - eventName = (String) values.get(RM_AUDIT_DATA_EVENT_NAME); - fullName = (String) values.get(RM_AUDIT_DATA_PERSON_FULLNAME); - userRoles = (String) values.get(RM_AUDIT_DATA_PERSON_ROLES); - nodeRef = (NodeRef) values.get(RM_AUDIT_DATA_NODE_NODEREF); - nodeName = (String) values.get(RM_AUDIT_DATA_NODE_NAME); - QName nodeTypeQname = (QName) values.get(RM_AUDIT_DATA_NODE_TYPE); - nodeIdentifier = (String) values.get(RM_AUDIT_DATA_NODE_IDENTIFIER); - namePath = (String) values.get(RM_AUDIT_DATA_NODE_NAMEPATH); - beforeProperties = (Map) values.get(RM_AUDIT_DATA_NODE_CHANGES_BEFORE); - afterProperties = (Map) values.get(RM_AUDIT_DATA_NODE_CHANGES_AFTER); - - // Convert some of the values to recognizable forms - nodeType = null; - if (nodeTypeQname != null) - { - TypeDefinition typeDef = dictionaryService.getType(nodeTypeQname); - nodeType = (typeDef != null) ? typeDef.getTitle(dictionaryService) : null; - } - } - else if (values.containsKey(DOD5015_AUDIT_DATA_EVENT_NAME)) - { - // This data is /RM/event/... - eventName = (String) values.get(DOD5015_AUDIT_DATA_EVENT_NAME); - fullName = (String) values.get(DOD5015_AUDIT_DATA_PERSON_FULLNAME); - userRoles = (String) values.get(DOD5015_AUDIT_DATA_PERSON_ROLES); - nodeRef = (NodeRef) values.get(DOD5015_AUDIT_DATA_NODE_NODEREF); - nodeName = (String) values.get(DOD5015_AUDIT_DATA_NODE_NAME); - QName nodeTypeQname = (QName) values.get(DOD5015_AUDIT_DATA_NODE_TYPE); - nodeIdentifier = (String) values.get(DOD5015_AUDIT_DATA_NODE_IDENTIFIER); - namePath = (String) values.get(DOD5015_AUDIT_DATA_NODE_NAMEPATH); - beforeProperties = (Map) values.get( DOD5015_AUDIT_DATA_NODE_CHANGES_BEFORE); - afterProperties = (Map) values.get(DOD5015_AUDIT_DATA_NODE_CHANGES_AFTER); - - // Convert some of the values to recognizable forms - nodeType = null; - if (nodeTypeQname != null) - { - TypeDefinition typeDef = dictionaryService.getType(nodeTypeQname); - nodeType = (typeDef != null) ? typeDef.getTitle(dictionaryService) : null; - } - } - else if (values.containsKey(RM_AUDIT_DATA_LOGIN_USERNAME)) - { - user = (String) values.get(RM_AUDIT_DATA_LOGIN_USERNAME); - if (values.containsKey(RM_AUDIT_DATA_LOGIN_ERROR)) - { - eventName = RM_AUDIT_EVENT_LOGIN_FAILURE; - // The user didn't log in - fullName = user; - } - else - { - eventName = RM_AUDIT_EVENT_LOGIN_SUCCESS; - fullName = (String) values.get(RM_AUDIT_DATA_LOGIN_FULLNAME); - } - } - else if (values.containsKey(DOD5015_AUDIT_DATA_LOGIN_USERNAME)) - { - user = (String) values.get(DOD5015_AUDIT_DATA_LOGIN_USERNAME); - if (values.containsKey(DOD5015_AUDIT_DATA_LOGIN_ERROR)) - { - eventName = RM_AUDIT_EVENT_LOGIN_FAILURE; - // The user didn't log in - fullName = user; - } - else - { - eventName = RM_AUDIT_EVENT_LOGIN_SUCCESS; - fullName = (String) values.get(DOD5015_AUDIT_DATA_LOGIN_FULLNAME); - } - } - else - { - // This is not recognisable data - logger.warn( - "Unable to process audit entry for RM. Unexpected data: \n" + - " Entry: " + entryId + "\n" + - " Data: " + values); - // Skip it - return true; - } - - if(nodeRef != null && nodeService.exists(nodeRef) && - !AccessStatus.ALLOWED.equals( - capabilityService.getCapabilityAccessState(nodeRef, ACCESS_AUDIT_CAPABILITY))) - { - return true; - } - - // TODO: Refactor this to use the builder pattern - RecordsManagementAuditEntry entry = new RecordsManagementAuditEntry( - timestamp, - user, - fullName, - // A concatenated string of roles - userRoles, - nodeRef, - nodeName, - nodeType, - eventName, - nodeIdentifier, - namePath, - beforeProperties, - afterProperties); - - // write out the entry to the file in requested format - writeEntryToFile(entry); - - if (results != null) - { - results.add(entry); - } - - if (logger.isDebugEnabled()) - { - logger.debug(" " + entry); - } - - // Keep going - return true; - } - - private void writeEntryToFile(RecordsManagementAuditEntry entry) - { - if (writer == null) - { - return; - } - try - { - if (!firstEntry) - { - if (reportFormat == ReportFormat.HTML) - { - writer.write("\n"); - } - else - { - writer.write(","); - } - } - else - { - firstEntry = false; - } - - // write the entry to the file - if (reportFormat == ReportFormat.JSON) - { - writer.write("\n\t\t"); - } - - writeAuditTrailEntry(writer, entry, reportFormat); - } - catch (IOException ioe) - { - throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, ioe); - } - } - }; - - String user = params.getUser(); - Long fromTime = getFromDateTime(params.getDateFrom()); - Long toTime = getToDateTime(params.getDateTo()); - NodeRef nodeRef = params.getNodeRef(); - int maxEntries = params.getMaxEntries(); - // Reverse order if the results are limited - boolean forward = maxEntries > 0 ? false : true; - - // start the audit trail report - writeAuditTrailHeader(writer, params, reportFormat); - - if (logger.isDebugEnabled()) - { - logger.debug("RM Audit: Issuing query: " + params); - } - - // Build audit query parameters - AuditQueryParameters dod5015AuditQueryParams = new AuditQueryParameters(); - dod5015AuditQueryParams.setForward(forward); - dod5015AuditQueryParams.setApplicationName(DOD5015_AUDIT_APPLICATION_NAME); - dod5015AuditQueryParams.setUser(user); - dod5015AuditQueryParams.setFromTime(fromTime); - dod5015AuditQueryParams.setToTime(toTime); - if (nodeRef != null) - { - dod5015AuditQueryParams.addSearchKey(DOD5015_AUDIT_DATA_NODE_NODEREF, nodeRef); - } - - // - AuditQueryParameters auditQueryParams = new AuditQueryParameters(); - auditQueryParams.setForward(forward); - auditQueryParams.setApplicationName(RM_AUDIT_APPLICATION_NAME); - auditQueryParams.setUser(user); - auditQueryParams.setFromTime(fromTime); - auditQueryParams.setToTime(toTime); - if (nodeRef != null) - { - auditQueryParams.addSearchKey(RM_AUDIT_DATA_NODE_NODEREF, nodeRef); - } - else if (params.getEvent() != null) - { - auditQueryParams.addSearchKey(RM_AUDIT_DATA_EVENT_NAME, params.getEvent()); - } - - // Get audit entries - auditService.auditQuery(callback, dod5015AuditQueryParams, maxEntries); - auditService.auditQuery(callback, auditQueryParams, maxEntries); - - // finish off the audit trail report - writeAuditTrailFooter(writer, reportFormat); - - // audit that the audit has been view'ed - if (nodeRef == null) - { - // grab the default file plan, but don't fail if it can't be found! - nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - auditEvent(nodeRef, AUDIT_EVENT_VIEW, null, null, true); - } - - /** - * Calculates the start of the given date. - * For example, if you had the date time of 12 Aug 2013 12:10:15.158 - * the result would be 12 Aug 2013 00:00:00.000. - * - * @param date The date for which the start should be calculated. - * @return Returns the start of the given date. - */ - private Date getStartOfDay(Date date) - { - return DateUtils.truncate(date == null ? new Date() : date, Calendar.DATE); - } - - /** - * Gets the start of the from date - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl.getStartOfDay() - * - * @param date The date for which the start should be retrieved. - * @return Returns null if the given date is null, otherwise the start of the given day. - */ - private Date getFromDate(Date date) - { - return date == null ? null : getStartOfDay(date); - } - - /** - * Returns the number of milliseconds for the "from date". - * - * @param date The date for which the number of milliseconds should retrieved. - * @return Returns null if the given date is null, otherwise the number of milliseconds for the given date. - */ - private Long getFromDateTime(Date date) - { - Long fromDateTime = null; - Date fromDate = getFromDate(date); - if (fromDate != null) - { - fromDateTime = Long.valueOf(fromDate.getTime()); - } - return fromDateTime; - } - - /** - * Calculates the end of the given date. - * For example, if you had the date time of 12 Aug 2013 12:10:15.158 - * the result would be 12 Aug 2013 23:59:59.999. - * - * @param date The date for which the end should be calculated. - * @return Returns the end of the given date. - */ - private Date getEndOfDay(Date date) - { - return DateUtils.addMilliseconds(DateUtils.ceiling(date == null ? new Date() : date, Calendar.DATE), -1); - } - - /** - * Gets the end of the from date - * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl.getEndOfDay() - * - * @param date The date for which the end should be retrieved. - * @return Returns null if the given date is null, otherwise the end of the given day. - */ - private Date getToDate(Date date) - { - return date == null ? null : getEndOfDay(date); - } - - /** - * Returns the number of milliseconds for the "to date". - * - * @param date The date for which the number of milliseconds should retrieved. - * @return Returns null if the given date is null, otherwise the number of milliseconds for the given date. - */ - private Long getToDateTime(Date date) - { - Long toDateTime = null; - Date toDate = getToDate(date); - if (toDate != null) - { - toDateTime = Long.valueOf(toDate.getTime()); - } - return toDateTime; - } - - /** - * {@inheritDoc} - */ - @Override - public NodeRef fileAuditTrailAsRecord(RecordsManagementAuditQueryParameters params, - NodeRef destination, ReportFormat format) - { - ParameterCheck.mandatory("params", params); - ParameterCheck.mandatory("destination", destination); - - // NOTE: the underlying RM services will check all the remaining pre-conditions - - NodeRef record = null; - - // get the audit trail for the provided parameters - File auditTrail = this.getAuditTrailFile(params, format); - - if (logger.isDebugEnabled()) - { - logger.debug("Filing audit trail in file " + auditTrail.getAbsolutePath() + - " as a record in record folder: " + destination); - } - - try - { - Map properties = new HashMap(1); - properties.put(ContentModel.PROP_NAME, auditTrail.getName()); - - // file the audit log as an undeclared record - record = this.nodeService.createNode(destination, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(auditTrail.getName())), - ContentModel.TYPE_CONTENT, properties).getChildRef(); - - // Set the content - ContentWriter writer = this.contentService.getWriter(record, ContentModel.PROP_CONTENT, true); - writer.setMimetype(format == ReportFormat.HTML ? MimetypeMap.MIMETYPE_HTML : MimetypeMap.MIMETYPE_JSON); - writer.setEncoding("UTF-8"); - writer.putContent(auditTrail); - } - finally - { - if (logger.isDebugEnabled()) - { - logger.debug("Audit trail report saved to temporary file: " + auditTrail.getAbsolutePath()); - } - else - { - auditTrail.delete(); - } - } - - return record; - } - - /** - * {@inheritDoc} - */ - @Override - public List getAuditEvents() - { - List listAuditEvents = new ArrayList(this.auditEvents.size()); - listAuditEvents.addAll(this.auditEvents.values()); - Collections.sort(listAuditEvents); - return listAuditEvents; - } - - /** - * Writes the start of the audit trail stream to the given writer - * - * @param writer The writer to write to - * @params params The parameters being used - * @param reportFormat The format to write the header in - * @throws IOException - */ - private void writeAuditTrailHeader(Writer writer, - RecordsManagementAuditQueryParameters params, - ReportFormat reportFormat) throws IOException - { - if (writer == null) - { - return; - } - - if (reportFormat == ReportFormat.HTML) - { - // write header as HTML - writer.write("\n"); - writer.write("\n\n"); - writer.write(""); - writer.write(I18NUtil.getMessage(MSG_AUDIT_REPORT)); - writer.write("\n"); - writer.write("\n"); - writer.write("\n

"); - writer.write(I18NUtil.getMessage(MSG_AUDIT_REPORT)); - writer.write("

\n"); - writer.write("
\n"); - - writer.write("From:"); - writer.write(""); - Date from = params.getDateFrom(); - writer.write(from == null ? "<Not Set>" : StringEscapeUtils.escapeHtml(from.toString())); - writer.write(""); - - writer.write("To:"); - writer.write(""); - Date to = params.getDateTo(); - writer.write(to == null ? "<Not Set>" : StringEscapeUtils.escapeHtml(to.toString())); - writer.write(""); - - writer.write("Property:"); - writer.write(""); - QName prop = params.getProperty(); - writer.write(prop == null ? "All" : StringEscapeUtils.escapeHtml(getPropertyLabel(prop))); - writer.write(""); - - writer.write("User:"); - writer.write(""); - writer.write(params.getUser() == null ? "All" : StringEscapeUtils.escapeHtml(params.getUser())); - writer.write(""); - - writer.write("Event:"); - writer.write(""); - writer.write(params.getEvent() == null ? "All" : StringEscapeUtils.escapeHtml(getAuditEventLabel(params.getEvent()))); - writer.write("\n"); - - writer.write("
\n"); - } - else - { - // write header as JSON - writer.write("{\n\t\"data\":\n\t{"); - writer.write("\n\t\t\"started\": \""); - writer.write(ISO8601DateFormat.format(getStartOfDay(params.getDateFrom()))); - writer.write("\",\n\t\t\"stopped\": \""); - writer.write(ISO8601DateFormat.format(getEndOfDay(params.getDateTo()))); - writer.write("\",\n\t\t\"enabled\": "); - writer.write(Boolean.toString(isEnabled())); - writer.write(",\n\t\t\"entries\":["); - } - } - - /** - * Writes an audit trail entry to the given writer - * - * @param writer The writer to write to - * @param entry The entry to write - * @param reportFormat The format to write the header in - * @throws IOException - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private void writeAuditTrailEntry(Writer writer, RecordsManagementAuditEntry entry, - ReportFormat reportFormat) throws IOException - { - if (writer == null) - { - return; - } - - if (reportFormat == ReportFormat.HTML) - { - writer.write("
\n"); - writer.write("
"); - writer.write("Timestamp:"); - writer.write(""); - writer.write(StringEscapeUtils.escapeHtml(entry.getTimestamp().toString())); - writer.write(""); - writer.write("User:"); - writer.write(""); - writer.write(entry.getFullName() != null ? - StringEscapeUtils.escapeHtml(entry.getFullName()) : - StringEscapeUtils.escapeHtml(entry.getUserName())); - writer.write(""); - if (entry.getUserRole() != null && entry.getUserRole().length() > 0) - { - writer.write("Role:"); - writer.write(""); - writer.write(StringEscapeUtils.escapeHtml(entry.getUserRole())); - writer.write(""); - } - if (entry.getEvent() != null && entry.getEvent().length() > 0) - { - writer.write("Event:"); - writer.write(""); - writer.write(StringEscapeUtils.escapeHtml(getAuditEventLabel(entry.getEvent()))); - writer.write("\n"); - } - writer.write("
\n"); - writer.write("
"); - if (entry.getIdentifier() != null && entry.getIdentifier().length() > 0) - { - writer.write("Identifier:"); - writer.write(""); - writer.write(StringEscapeUtils.escapeHtml(entry.getIdentifier())); - writer.write(""); - } - if (entry.getNodeType() != null && entry.getNodeType().length() > 0) - { - writer.write("Type:"); - writer.write(""); - writer.write(StringEscapeUtils.escapeHtml(entry.getNodeType())); - writer.write(""); - } - if (entry.getPath() != null && entry.getPath().length() > 0) - { - // we need to strip off the first part of the path - String path = entry.getPath(); - String displayPath = path; - int idx = path.indexOf('/', 1); - if (idx != -1) - { - displayPath = "/File Plan" + path.substring(idx); - } - - writer.write("Location:"); - writer.write(""); - writer.write(StringEscapeUtils.escapeHtml(displayPath)); - writer.write(""); - } - writer.write("
\n"); - - if (entry.getChangedProperties() != null) - { - writer.write(""); - writer.write(""); - - // create an entry for each property that changed - for (QName valueName : entry.getChangedProperties().keySet()) - { - Pair values = entry.getChangedProperties().get(valueName); - writer.write(""); - } - - writer.write("
PropertyPrevious ValueNew Value
"); - writer.write(getPropertyLabel(valueName)); - writer.write(""); - - // inspect the property to determine it's data type - QName propDataType = DataTypeDefinition.TEXT; - PropertyDefinition propDef = dictionaryService.getProperty(valueName); - if (propDef != null) - { - propDataType = propDef.getDataType().getName(); - } - - if(DataTypeDefinition.MLTEXT.equals(propDataType)) - { - writer.write(values.getFirst() == null ? "<none>" : StringEscapeUtils.escapeHtml(convertToMlText((Map)values.getFirst()).getDefaultValue())); - writer.write(""); - writer.write(values.getSecond() == null ? "<none>" : StringEscapeUtils.escapeHtml(convertToMlText((Map)values.getSecond()).getDefaultValue())); - } - else - { - Serializable oldValue = values.getFirst(); - writer.write(oldValue == null ? "<none>" : StringEscapeUtils.escapeHtml(oldValue.toString())); - writer.write(""); - Serializable newValue = values.getSecond(); - writer.write(newValue == null ? "<none>" : StringEscapeUtils.escapeHtml(newValue.toString())); - } - - writer.write("
\n"); - } - - writer.write("
"); - } - else - { - try - { - JSONObject json = new JSONObject(); - - json.put("timestamp", entry.getTimestampString()); - json.put("userName", entry.getUserName()); - json.put("userRole", entry.getUserRole() == null ? "": entry.getUserRole()); - json.put("fullName", entry.getFullName() == null ? "": entry.getFullName()); - json.put("nodeRef", entry.getNodeRef() == null ? "": entry.getNodeRef()); - - // TODO: Find another way for checking the event - if (entry.getEvent().equals("Create Person") && entry.getNodeRef() != null) - { - NodeRef nodeRef = entry.getNodeRef(); - String userName = null; - if(nodeService.exists(nodeRef)) - { - userName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME); - } - json.put("nodeName", userName == null ? "": userName); - json.put("createPerson", true); - } - else - { - json.put("nodeName", entry.getNodeName() == null ? "": entry.getNodeName()); - } - - // TODO: Find another way for checking the event - if (entry.getEvent().equals("Delete RM Object")) - { - json.put("deleteObject", true); - } - - json.put("nodeType", entry.getNodeType() == null ? "": entry.getNodeType()); - json.put("event", entry.getEvent() == null ? "": getAuditEventLabel(entry.getEvent())); - json.put("identifier", entry.getIdentifier() == null ? "": entry.getIdentifier()); - json.put("path", entry.getPath() == null ? "": entry.getPath()); - - JSONArray changedValues = new JSONArray(); - - if (entry.getChangedProperties() != null) - { - // create an entry for each property that changed - for (QName valueName : entry.getChangedProperties().keySet()) - { - Pair values = entry.getChangedProperties().get(valueName); - - JSONObject changedValue = new JSONObject(); - changedValue.put("name", getPropertyLabel(valueName)); - - // inspect the property to determine it's data type - QName propDataType = DataTypeDefinition.TEXT; - PropertyDefinition propDef = dictionaryService.getProperty(valueName); - if (propDef != null) - { - propDataType = propDef.getDataType().getName(); - } - - // handle output of mltext properties - if(DataTypeDefinition.MLTEXT.equals(propDataType)) - { - changedValue.put("previous", values.getFirst() == null ? "" : convertToMlText((Map)values.getFirst()).getDefaultValue()); - changedValue.put("new", values.getSecond() == null ? "" : convertToMlText((Map)values.getSecond()).getDefaultValue()); - } - else - { - changedValue.put("previous", values.getFirst() == null ? "" : values.getFirst().toString()); - changedValue.put("new", values.getSecond() == null ? "" : values.getSecond().toString()); - } - - changedValues.put(changedValue); - } - } - - json.put("changedValues", changedValues); - - writer.write(json.toString()); - } - catch (JSONException je) - { - writer.write("{}"); - } - } - } - - /** - * Helper method to convert value to MLText - * - * @param map map of locale's and values - * @return {@link MLText} multilingual text value - */ - private MLText convertToMlText(Map map) - { - MLText mlText = new MLText(); - mlText.putAll(map); - return mlText; - } - - /** - * Writes the end of the audit trail stream to the given writer - * - * @param writer The writer to write to - * @param reportFormat The format to write the footer in - * @throws IOException - */ - private void writeAuditTrailFooter(Writer writer, ReportFormat reportFormat) throws IOException - { - if (writer == null) - { - return; - } - - if (reportFormat == ReportFormat.HTML) - { - // write footer as HTML - writer.write("\n"); - } - else - { - // write footer as JSON - writer.write("\n\t\t]\n\t}\n}"); - } - } - - /** - * Returns the display label for a property QName - * - * @param property The property to get label for - * @param ddService DictionaryService instance - * @param namespaceService NamespaceService instance - * @return The label - */ - private String getPropertyLabel(QName property) - { - String label = null; - - PropertyDefinition propDef = this.dictionaryService.getProperty(property); - if (propDef != null) - { - label = propDef.getTitle(dictionaryService); - } - - if (label == null) - { - label = property.getLocalName(); - } - - return label; - } - - /** - * Returns the display label for the given audit event key - * - * @param eventKey The audit event key - * @return The display label or null if the key does not exist - */ - private String getAuditEventLabel(String eventKey) - { - String label = eventKey; - - AuditEvent event = this.auditEvents.get(eventKey); - if (event != null) - { - label = event.getLabel(); - } - - return label; - } - - /** - * A class to carry audit information through the transaction. - * - * @author Derek Hulley - * @since 3.2 - */ - private static class RMAuditNode - { - private NodeRef nodeRef; - private String eventName; - private Map nodePropertiesBefore; - private Map nodePropertiesAfter; - private boolean removeIfNoPropertyChanged = false; - - public NodeRef getNodeRef() - { - return nodeRef; - } - - public void setNodeRef(NodeRef nodeRef) - { - this.nodeRef = nodeRef; - } - - public String getEventName() - { - return eventName; - } - - public void setEventName(String eventName) - { - this.eventName = eventName; - } - - public Map getNodePropertiesBefore() - { - return nodePropertiesBefore; - } - - public void setNodePropertiesBefore(Map nodePropertiesBefore) - { - this.nodePropertiesBefore = nodePropertiesBefore; - } - - public Map getNodePropertiesAfter() - { - return nodePropertiesAfter; - } - - public void setNodePropertiesAfter(Map nodePropertiesAfter) - { - this.nodePropertiesAfter = nodePropertiesAfter; - } - - public boolean getRemoveIfNoPropertyChanged() - { - return removeIfNoPropertyChanged; - } - - public void setRemoveIfNoPropertyChanged(boolean removeIfNoPropertyChanged) - { - this.removeIfNoPropertyChanged = removeIfNoPropertyChanged; - } - } - - /** Deprecated Method Implementations **/ - - /** - * Helper method to get the default file plan - * - * @return NodRef default file plan - */ - private NodeRef getDefaultFilePlan() - { - NodeRef defaultFilePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (defaultFilePlan == null) - { - throw new AlfrescoRuntimeException("Default file plan could not be found."); - } - return defaultFilePlan; - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public boolean isEnabled() - { - return isAuditLogEnabled(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Deprecated - public void start() - { - startAuditLog(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public void stop() - { - stopAuditLog(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public Date getDateLastStarted() - { - return getDateAuditLogLastStarted(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public Date getDateLastStopped() - { - return getDateAuditLogLastStopped(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public void clear() - { - clearAuditLog(getDefaultFilePlan()); - } - - /** - * {@inheritDoc} - * @since 3.2 - * @deprecated since 2.1 - */ - @Override - @Deprecated - public void auditRMAction( - RecordsManagementAction action, - NodeRef nodeRef, - Map parameters) - { - auditEvent(nodeRef, action.getName()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Serializable; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.repo.audit.AuditComponent; +import org.alfresco.repo.audit.model.AuditApplication; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.transaction.AlfrescoTransactionSupport; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.repo.transaction.TransactionalResourceHelper; +import org.alfresco.service.cmr.audit.AuditQueryParameters; +import org.alfresco.service.cmr.audit.AuditService; +import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.dictionary.TypeDefinition; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.MLText; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.Pair; +import org.alfresco.util.PropertyCheck; +import org.alfresco.util.PropertyMap; +import org.alfresco.util.TempFileProvider; +import org.alfresco.util.transaction.TransactionListenerAdapter; +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.context.ApplicationEvent; +import org.springframework.extensions.surf.util.AbstractLifecycleBean; +import org.springframework.extensions.surf.util.I18NUtil; +import org.springframework.extensions.surf.util.ISO8601DateFormat; +import org.springframework.extensions.surf.util.ParameterCheck; + +/** + * Records Management Audit Service Implementation. + * + * @author Gavin Cornwell + * @since 3.2 + */ +public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean + implements RecordsManagementAuditService +{ + /** I18N */ + private static final String MSG_TRAIL_FILE_FAIL = "rm.audit.trail-file-fail"; + private static final String MSG_AUDIT_REPORT = "rm.audit.audit-report"; + + /** Logger */ + private static Log logger = LogFactory.getLog(RecordsManagementAuditServiceImpl.class); + + private static final String ACCESS_AUDIT_CAPABILITY = "AccessAudit"; + + private static final String KEY_RM_AUDIT_NODE_RECORDS = "RMAUditNodeRecords"; + + protected static final String RM_AUDIT_EVENT_LOGIN_SUCCESS = "Login.Success"; + protected static final String RM_AUDIT_EVENT_LOGIN_FAILURE = "Login.Failure"; + + protected static final String RM_AUDIT_APPLICATION_NAME = "RM"; + protected static final String RM_AUDIT_PATH_ROOT = "/RM"; + protected static final String RM_AUDIT_SNIPPET_EVENT = "/event"; + protected static final String RM_AUDIT_SNIPPET_PERSON = "/person"; + protected static final String RM_AUDIT_SNIPPET_NAME = "/name"; + protected static final String RM_AUDIT_SNIPPET_NODE = "/node"; + protected static final String RM_AUDIT_SNIPPET_CHANGES = "/changes"; + protected static final String RM_AUDIT_SNIPPET_BEFORE = "/before"; + protected static final String RM_AUDIT_SNIPPET_AFTER = "/after"; + + protected static final String RM_AUDIT_DATA_PERSON_FULLNAME = "/RM/event/person/fullName"; + protected static final String RM_AUDIT_DATA_PERSON_ROLES = "/RM/event/person/roles"; + protected static final String RM_AUDIT_DATA_EVENT_NAME = "/RM/event/name/value"; + protected static final String RM_AUDIT_DATA_NODE_NODEREF = "/RM/event/node/noderef"; + protected static final String RM_AUDIT_DATA_NODE_NAME = "/RM/event/node/name"; + protected static final String RM_AUDIT_DATA_NODE_TYPE = "/RM/event/node/type"; + protected static final String RM_AUDIT_DATA_NODE_IDENTIFIER = "/RM/event/node/identifier"; + protected static final String RM_AUDIT_DATA_NODE_NAMEPATH = "/RM/event/node/namePath"; + protected static final String RM_AUDIT_DATA_NODE_CHANGES_BEFORE = "/RM/event/node/changes/before/value"; + protected static final String RM_AUDIT_DATA_NODE_CHANGES_AFTER = "/RM/event/node/changes/after/value"; + + protected static final String RM_AUDIT_DATA_LOGIN_USERNAME = "/RM/login/args/userName/value"; + protected static final String RM_AUDIT_DATA_LOGIN_FULLNAME = "/RM/login/no-error/fullName"; + protected static final String RM_AUDIT_DATA_LOGIN_ERROR = "/RM/login/error/value"; + + /* Provide Backward compatibility with DOD5015 Audit Events RM-904*/ + protected static final String DOD5015_AUDIT_APPLICATION_NAME = "DOD5015"; + protected static final String DOD5015_AUDIT_PATH_ROOT = "/DOD5015"; + protected static final String DOD5015_AUDIT_SNIPPET_EVENT = "/event"; + protected static final String DOD5015_AUDIT_SNIPPET_PERSON = "/person"; + protected static final String DOD5015_AUDIT_SNIPPET_NAME = "/name"; + protected static final String DOD5015_AUDIT_SNIPPET_NODE = "/node"; + protected static final String DOD5015_AUDIT_SNIPPET_CHANGES = "/changes"; + protected static final String DOD5015_AUDIT_SNIPPET_BEFORE = "/before"; + protected static final String DOD5015_AUDIT_SNIPPET_AFTER = "/after"; + + protected static final String DOD5015_AUDIT_DATA_PERSON_FULLNAME = "/DOD5015/event/person/fullName"; + protected static final String DOD5015_AUDIT_DATA_PERSON_ROLES = "/DOD5015/event/person/roles"; + protected static final String DOD5015_AUDIT_DATA_EVENT_NAME = "/DOD5015/event/name/value"; + protected static final String DOD5015_AUDIT_DATA_NODE_NODEREF = "/DOD5015/event/node/noderef"; + protected static final String DOD5015_AUDIT_DATA_NODE_NAME = "/DOD5015/event/node/name"; + protected static final String DOD5015_AUDIT_DATA_NODE_TYPE = "/DOD5015/event/node/type"; + protected static final String DOD5015_AUDIT_DATA_NODE_IDENTIFIER = "/DOD5015/event/node/identifier"; + protected static final String DOD5015_AUDIT_DATA_NODE_NAMEPATH = "/DOD5015/event/node/namePath"; + protected static final String DOD5015_AUDIT_DATA_NODE_CHANGES_BEFORE = "/DOD5015/event/node/changes/before/value"; + protected static final String DOD5015_AUDIT_DATA_NODE_CHANGES_AFTER = "/DOD5015/event/node/changes/after/value"; + + protected static final String DOD5015_AUDIT_DATA_LOGIN_USERNAME = "/DOD5015/login/args/userName/value"; + protected static final String DOD5015_AUDIT_DATA_LOGIN_FULLNAME = "/DOD5015/login/no-error/fullName"; + protected static final String DOD5015_AUDIT_DATA_LOGIN_ERROR = "/DOD5015/login/error/value"; + /* End Backward compatibility with DOD5015 Audit Events */ + + protected static final String AUDIT_TRAIL_FILE_PREFIX = "audit_"; + protected static final String AUDIT_TRAIL_JSON_FILE_SUFFIX = ".json"; + protected static final String AUDIT_TRAIL_HTML_FILE_SUFFIX = ".html"; + + /** Audit auditing events */ + private static final String AUDIT_EVENT_START = "audit.start"; + private static final String MSG_AUDIT_START = "rm.audit.audit-start"; + private static final String AUDIT_EVENT_STOP = "audit.stop"; + private static final String MSG_AUDIT_STOP = "rm.audit.audit-stop"; + private static final String AUDIT_EVENT_CLEAR = "audit.clear"; + private static final String MSG_AUDIT_CLEAR = "rm.audit.audit-clear"; + private static final String AUDIT_EVENT_VIEW = "audit.view"; + private static final String MSG_AUDIT_VIEW = "rm.audit.audit-view"; + + private PolicyComponent policyComponent; + private DictionaryService dictionaryService; + private TransactionService transactionService; + private NodeService nodeService; + private ContentService contentService; + private AuditComponent auditComponent; + private AuditService auditService; + private RecordsManagementActionService rmActionService; + private FilePlanService filePlanService; + private NamespaceService namespaceService; + protected CapabilityService capabilityService; + + private boolean shutdown = false; + + private List ignoredAuditProperties; + + private List propertiesToBeRemoved = new ArrayList(); + + private RMAuditTxnListener txnListener = new RMAuditTxnListener(); + + /** Registered and initialised records management auditEvents */ + private Map auditEvents = new HashMap(); + + /** + * Set the component used to bind to behaviour callbacks + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + /** + * Provides user-readable names for types + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * Set the component used to start new transactions + */ + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + /** + * Sets the NodeService instance + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Sets the ContentService instance + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * The component to create audit events + */ + public void setAuditComponent(AuditComponent auditComponent) + { + this.auditComponent = auditComponent; + } + + /** + * Sets the AuditService instance + */ + public void setAuditService(AuditService auditService) + { + this.auditService = auditService; + } + + /** + * Sets the RecordsManagementActionService instance + */ + public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) + { + this.rmActionService = rmActionService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + + + + /** + * @param ignoredAuditProperties + */ + public void setIgnoredAuditProperties(List ignoredAuditProperties) + { + this.ignoredAuditProperties = ignoredAuditProperties; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#registerAuditEvent(java.lang.String, java.lang.String) + */ + @Override + public void registerAuditEvent(String name, String label) + { + registerAuditEvent(new AuditEvent(name, label)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#registerAuditEvent(org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent) + */ + @Override + public void registerAuditEvent(AuditEvent auditEvent) + { + if (logger.isDebugEnabled()) + { + logger.debug("Registering audit event " + auditEvent.getName()); + } + + this.auditEvents.put(auditEvent.getName(), auditEvent); + } + + /** + * Checks that all necessary properties have been set. + */ + public void init() + { + PropertyCheck.mandatory(this, "policyComponent", policyComponent); + PropertyCheck.mandatory(this, "transactionService", transactionService); + PropertyCheck.mandatory(this, "nodeService", nodeService); + PropertyCheck.mandatory(this, "contentService", contentService); + PropertyCheck.mandatory(this, "auditComponent", auditComponent); + PropertyCheck.mandatory(this, "auditService", auditService); + PropertyCheck.mandatory(this, "rmActionService", rmActionService); + PropertyCheck.mandatory(this, "dictionaryService", dictionaryService); + PropertyCheck.mandatory(this, "filePlanService", filePlanService); + + // register audit auditing events + registerAuditEvent(AUDIT_EVENT_CLEAR, MSG_AUDIT_CLEAR); + registerAuditEvent(AUDIT_EVENT_START, MSG_AUDIT_START); + registerAuditEvent(AUDIT_EVENT_STOP, MSG_AUDIT_STOP); + registerAuditEvent(AUDIT_EVENT_VIEW, MSG_AUDIT_VIEW); + + // properties to be ignored by audit + for (String qname : ignoredAuditProperties) + { + this.propertiesToBeRemoved.add(QName.createQName(qname, this.namespaceService)); + } + } + + /** + * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent) + */ + @Override + protected void onBootstrap(ApplicationEvent event) + { + shutdown = false; + } + + /** + * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent) + */ + @Override + protected void onShutdown(ApplicationEvent event) + { + shutdown = true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#isAuditLogEnabled(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean isAuditLogEnabled(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + // TODO use file plan to scope audit log + + return auditService.isAuditEnabled( + RM_AUDIT_APPLICATION_NAME, + RM_AUDIT_PATH_ROOT); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#startAuditLog(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void startAuditLog(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + // TODO use file plan to scope audit log + + auditService.enableAudit( + RM_AUDIT_APPLICATION_NAME, + RM_AUDIT_PATH_ROOT); + + if (logger.isInfoEnabled()) + { + logger.info("Started Records Management auditing"); + } + + auditEvent(filePlan, AUDIT_EVENT_START, null, null, true); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#stopAuditLog(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void stopAuditLog(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + // TODO use file plan to scope audit log + + auditEvent(filePlan, AUDIT_EVENT_STOP, null, null, true); + + auditService.disableAudit( + RM_AUDIT_APPLICATION_NAME, + RM_AUDIT_PATH_ROOT); + + if (logger.isInfoEnabled()) + { + logger.info("Stopped Records Management auditing"); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#clearAuditLog(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void clearAuditLog(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + // TODO use file plan to scope audit log + + auditService.clearAudit(RM_AUDIT_APPLICATION_NAME, null, null); + if (logger.isInfoEnabled()) + { + logger.debug("Records Management audit log has been cleared"); + } + + auditEvent(filePlan, AUDIT_EVENT_CLEAR, null, null, true); + } + + /** + * {@inheritDoc} + */ + @Override + public Date getDateAuditLogLastStarted(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + // TODO use file plan to scope audit log + + // TODO: return proper date, for now it's today's date + return getStartOfDay(new Date()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#getDateAuditLogLastStopped(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Date getDateAuditLogLastStopped(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + // TODO use file plan to scope audit log + + // TODO: return proper date, for now it's today's date + return getEndOfDay(new Date()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public void auditEvent(NodeRef nodeRef, String eventName) + { + auditEvent(nodeRef, eventName, null, null, false, false); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map) + */ + @Override + public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after) + { + auditEvent(nodeRef, eventName, before, after, false, false); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map, boolean) + */ + @Override + public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after, boolean immediate) + { + auditEvent(nodeRef, eventName, before, after, immediate, false); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService#auditEvent(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map, java.util.Map, boolean) + */ + @Override + public void auditEvent(NodeRef nodeRef, String eventName, Map before, Map after, boolean immediate, boolean removeIfNoPropertyChanged) + { + // deal with immediate auditing if required + if (immediate) + { + Map auditMap = buildAuditMap(nodeRef, eventName, before, after, removeIfNoPropertyChanged); + auditComponent.recordAuditValues(RM_AUDIT_PATH_ROOT, auditMap); + } + else + { + Set auditDetails = TransactionalResourceHelper.getSet(KEY_RM_AUDIT_NODE_RECORDS); + AlfrescoTransactionSupport.bindListener(txnListener); + + // RM-936: Eliminate multiple audit maps from being generated when events with the same name are required to be fired multiple times in the same transaction. + // Check if auditDetails already contains an auditedNode with the same combination of nodeRef and eventName. + boolean auditNodeAlreadyExists = false; + for (RMAuditNode existingRMAuditNode : auditDetails) + { + if (existingRMAuditNode.getNodeRef().equals(nodeRef) && existingRMAuditNode.getEventName().equals(eventName)) + { + // If there exists such an auditNode, update its 'after' properties with the latest set of properties and leave its 'before' properties unchanged so that it + // retains the original set of properties. The first 'before' and last 'after' will be diff'ed when comes to building the auditMap later when the transaction + // commits. + existingRMAuditNode.setNodePropertiesAfter(after); + auditNodeAlreadyExists = true; + break; + } + } + + if (!auditNodeAlreadyExists) + { + // Create a new auditNode if it doesn't already exist + RMAuditNode auditedNode = new RMAuditNode(); + auditedNode.setNodeRef(nodeRef); + auditedNode.setEventName(eventName); + auditedNode.setNodePropertiesBefore(before); + auditedNode.setNodePropertiesAfter(after); + auditedNode.setRemoveIfNoPropertyChanged(removeIfNoPropertyChanged); + + auditDetails.add(auditedNode); + } + } + } + + /** + * Helper method to build audit map + * + * @param nodeRef + * @param eventName + * @return + * @since 2.0.3 + */ + private Map buildAuditMap(NodeRef nodeRef, String eventName, Map propertiesBefore, Map propertiesAfter, boolean removeOnNoPropertyChange) + { + Map auditMap = new HashMap(13); + auditMap.put( + AuditApplication.buildPath( + RM_AUDIT_SNIPPET_EVENT, + RM_AUDIT_SNIPPET_NAME), + eventName); + + if (nodeRef != null) + { + auditMap.put( + AuditApplication.buildPath( + RM_AUDIT_SNIPPET_EVENT, + RM_AUDIT_SNIPPET_NODE), + nodeRef); + } + + // Filter out any properties to be audited if specified in the Spring configuration. + if (!ignoredAuditProperties.isEmpty()) + { + removeAuditProperties(propertiesBefore, propertiesAfter); + } + + // Property changes + Pair, Map> deltaPair = PropertyMap.getBeforeAndAfterMapsForChanges(propertiesBefore, propertiesAfter); + + // If both the first and second Map in the deltaPair are empty and removeOnNoPropertyChange is true, the entire auditMap is discarded so it won't be audited. + if (deltaPair.getFirst().isEmpty() && deltaPair.getSecond().isEmpty() && removeOnNoPropertyChange) + { + auditMap.clear(); + } + else + { + auditMap.put( + AuditApplication.buildPath( + RM_AUDIT_SNIPPET_EVENT, + RM_AUDIT_SNIPPET_NODE, + RM_AUDIT_SNIPPET_CHANGES, + RM_AUDIT_SNIPPET_BEFORE), + (Serializable) deltaPair.getFirst()); + auditMap.put( + AuditApplication.buildPath( + RM_AUDIT_SNIPPET_EVENT, + RM_AUDIT_SNIPPET_NODE, + RM_AUDIT_SNIPPET_CHANGES, + RM_AUDIT_SNIPPET_AFTER), + (Serializable) deltaPair.getSecond()); + } + return auditMap; + } + + /** + * Helper method to remove system properties from maps + * + * @param properties + */ + private void removeAuditProperties(Map before, Map after) + { + if (before != null) + { + before.keySet().removeAll(this.propertiesToBeRemoved); + } + if (after != null) + { + after.keySet().removeAll(this.propertiesToBeRemoved); + } + } + + /** + * A stateless transaction listener for RM auditing. This component picks up the data of modified nodes and generates the audit information. + *

+ * This class is not static so that the instances will have access to the action's implementation. + * + * @author Derek Hulley + * @since 3.2 + */ + private class RMAuditTxnListener extends TransactionListenerAdapter + { + private final Log logger = LogFactory.getLog(RecordsManagementAuditServiceImpl.class); + + /* + * Equality and hashcode generation are left unimplemented; we expect to only have a single + * instance of this class per action. + */ + + /** + * Get the action parameters from the transaction and audit them. + */ + @Override + public void afterCommit() + { + final Set auditedNodes = TransactionalResourceHelper.getSet(KEY_RM_AUDIT_NODE_RECORDS); + + // Start a *new* read-write transaction to audit in + RetryingTransactionCallback auditCallback = new RetryingTransactionCallback() + { + @Override + public Void execute() throws Throwable + { + auditInTxn(auditedNodes); + return null; + } + }; + transactionService.getRetryingTransactionHelper().doInTransaction(auditCallback, false, true); + } + + /** + * Do the actual auditing, assuming the presence of a viable transaction + * + * @param auditedNodes details of the nodes that were modified + */ + private void auditInTxn(Set auditedNodes) throws Throwable + { + // Go through all the audit information and audit it + boolean auditedSomething = false; + for (RMAuditNode auditedNode : auditedNodes) + { + NodeRef nodeRef = auditedNode.getNodeRef(); + + // If the node is gone, then do nothing + if (nodeRef != null && !nodeService.exists(nodeRef)) + { + continue; + } + + // build the audit map + Map auditMap = buildAuditMap(nodeRef, + auditedNode.getEventName(), + auditedNode.getNodePropertiesBefore(), + auditedNode.getNodePropertiesAfter(), + auditedNode.getRemoveIfNoPropertyChanged()); + // Audit it + if (logger.isDebugEnabled()) + { + logger.debug("RM Audit: Auditing values: \n" + auditMap); + } + auditMap = auditComponent.recordAuditValues(RM_AUDIT_PATH_ROOT, auditMap); + if (auditMap.isEmpty()) + { + if (logger.isDebugEnabled()) + { + logger.debug("RM Audit: Nothing was audited."); + } + } + else + { + if (logger.isDebugEnabled()) + { + logger.debug("RM Audit: Audited values: \n" + auditMap); + } + // We must commit the transaction to get the values in + auditedSomething = true; + } + } + // Check if anything was audited + if (!auditedSomething) + { + // Nothing was audited, so do nothing + RetryingTransactionHelper.getActiveUserTransaction().setRollbackOnly(); + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public File getAuditTrailFile(RecordsManagementAuditQueryParameters params, ReportFormat format) + { + ParameterCheck.mandatory("params", params); + + Writer fileWriter = null; + try + { + File auditTrailFile = TempFileProvider.createTempFile(AUDIT_TRAIL_FILE_PREFIX, + format == ReportFormat.HTML ? AUDIT_TRAIL_HTML_FILE_SUFFIX : AUDIT_TRAIL_JSON_FILE_SUFFIX); + fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(auditTrailFile),"UTF8")); + // Get the results, dumping to file + getAuditTrailImpl(params, null, fileWriter, format); + // Done + return auditTrailFile; + } + catch (IOException e) + { + throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, e); + } + finally + { + // close the writer + if (fileWriter != null) + { + try { fileWriter.close(); } catch (IOException closeEx) {} + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public List getAuditTrail(RecordsManagementAuditQueryParameters params) + { + ParameterCheck.mandatory("params", params); + + List entries = new ArrayList(50); + try + { + getAuditTrailImpl(params, entries, null, null); + // Done + return entries; + } + catch (IOException e) + { + // Should be + throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, e); + } + } + + /** + * Get the audit trail, optionally dumping the results the the given writer dumping to a list. + * + * @param params the search parameters + * @param results the list to which individual results will be dumped + * @param writer Writer to write the audit trail + * @param reportFormat Format to write the audit trail in, ignored if writer is null + */ + private void getAuditTrailImpl( + final RecordsManagementAuditQueryParameters params, + final List results, + final Writer writer, + final ReportFormat reportFormat) + throws IOException + { + if (logger.isDebugEnabled()) + { + logger.debug("Retrieving audit trail in '" + reportFormat + "' format using parameters: " + params); + } + + // define the callback + AuditQueryCallback callback = new AuditQueryCallback() + { + private boolean firstEntry = true; + + + @Override + public boolean valuesRequired() + { + return true; + } + + /** + * Just log the error, but continue + */ + @Override + public boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error) + { + logger.warn(errorMsg, error); + return true; + } + + @Override + @SuppressWarnings("unchecked") + public boolean handleAuditEntry( + Long entryId, + String applicationName, + String user, + long time, + Map values) + { + // Check for context shutdown + if (shutdown) + { + return false; + } + + + Date timestamp = new Date(time); + String eventName = null; + String fullName = null; + String userRoles = null; + NodeRef nodeRef = null; + String nodeName = null; + String nodeType = null; + String nodeIdentifier = null; + String namePath = null; + Map beforeProperties = null; + Map afterProperties = null; + + if (values.containsKey(RM_AUDIT_DATA_EVENT_NAME)) + { + // This data is /RM/event/... + eventName = (String) values.get(RM_AUDIT_DATA_EVENT_NAME); + fullName = (String) values.get(RM_AUDIT_DATA_PERSON_FULLNAME); + userRoles = (String) values.get(RM_AUDIT_DATA_PERSON_ROLES); + nodeRef = (NodeRef) values.get(RM_AUDIT_DATA_NODE_NODEREF); + nodeName = (String) values.get(RM_AUDIT_DATA_NODE_NAME); + QName nodeTypeQname = (QName) values.get(RM_AUDIT_DATA_NODE_TYPE); + nodeIdentifier = (String) values.get(RM_AUDIT_DATA_NODE_IDENTIFIER); + namePath = (String) values.get(RM_AUDIT_DATA_NODE_NAMEPATH); + beforeProperties = (Map) values.get(RM_AUDIT_DATA_NODE_CHANGES_BEFORE); + afterProperties = (Map) values.get(RM_AUDIT_DATA_NODE_CHANGES_AFTER); + + // Convert some of the values to recognizable forms + nodeType = null; + if (nodeTypeQname != null) + { + TypeDefinition typeDef = dictionaryService.getType(nodeTypeQname); + nodeType = (typeDef != null) ? typeDef.getTitle(dictionaryService) : null; + } + } + else if (values.containsKey(DOD5015_AUDIT_DATA_EVENT_NAME)) + { + // This data is /RM/event/... + eventName = (String) values.get(DOD5015_AUDIT_DATA_EVENT_NAME); + fullName = (String) values.get(DOD5015_AUDIT_DATA_PERSON_FULLNAME); + userRoles = (String) values.get(DOD5015_AUDIT_DATA_PERSON_ROLES); + nodeRef = (NodeRef) values.get(DOD5015_AUDIT_DATA_NODE_NODEREF); + nodeName = (String) values.get(DOD5015_AUDIT_DATA_NODE_NAME); + QName nodeTypeQname = (QName) values.get(DOD5015_AUDIT_DATA_NODE_TYPE); + nodeIdentifier = (String) values.get(DOD5015_AUDIT_DATA_NODE_IDENTIFIER); + namePath = (String) values.get(DOD5015_AUDIT_DATA_NODE_NAMEPATH); + beforeProperties = (Map) values.get( DOD5015_AUDIT_DATA_NODE_CHANGES_BEFORE); + afterProperties = (Map) values.get(DOD5015_AUDIT_DATA_NODE_CHANGES_AFTER); + + // Convert some of the values to recognizable forms + nodeType = null; + if (nodeTypeQname != null) + { + TypeDefinition typeDef = dictionaryService.getType(nodeTypeQname); + nodeType = (typeDef != null) ? typeDef.getTitle(dictionaryService) : null; + } + } + else if (values.containsKey(RM_AUDIT_DATA_LOGIN_USERNAME)) + { + user = (String) values.get(RM_AUDIT_DATA_LOGIN_USERNAME); + if (values.containsKey(RM_AUDIT_DATA_LOGIN_ERROR)) + { + eventName = RM_AUDIT_EVENT_LOGIN_FAILURE; + // The user didn't log in + fullName = user; + } + else + { + eventName = RM_AUDIT_EVENT_LOGIN_SUCCESS; + fullName = (String) values.get(RM_AUDIT_DATA_LOGIN_FULLNAME); + } + } + else if (values.containsKey(DOD5015_AUDIT_DATA_LOGIN_USERNAME)) + { + user = (String) values.get(DOD5015_AUDIT_DATA_LOGIN_USERNAME); + if (values.containsKey(DOD5015_AUDIT_DATA_LOGIN_ERROR)) + { + eventName = RM_AUDIT_EVENT_LOGIN_FAILURE; + // The user didn't log in + fullName = user; + } + else + { + eventName = RM_AUDIT_EVENT_LOGIN_SUCCESS; + fullName = (String) values.get(DOD5015_AUDIT_DATA_LOGIN_FULLNAME); + } + } + else + { + // This is not recognisable data + logger.warn( + "Unable to process audit entry for RM. Unexpected data: \n" + + " Entry: " + entryId + "\n" + + " Data: " + values); + // Skip it + return true; + } + + if(nodeRef != null && nodeService.exists(nodeRef) && + !AccessStatus.ALLOWED.equals( + capabilityService.getCapabilityAccessState(nodeRef, ACCESS_AUDIT_CAPABILITY))) + { + return true; + } + + // TODO: Refactor this to use the builder pattern + RecordsManagementAuditEntry entry = new RecordsManagementAuditEntry( + timestamp, + user, + fullName, + // A concatenated string of roles + userRoles, + nodeRef, + nodeName, + nodeType, + eventName, + nodeIdentifier, + namePath, + beforeProperties, + afterProperties); + + // write out the entry to the file in requested format + writeEntryToFile(entry); + + if (results != null) + { + results.add(entry); + } + + if (logger.isDebugEnabled()) + { + logger.debug(" " + entry); + } + + // Keep going + return true; + } + + private void writeEntryToFile(RecordsManagementAuditEntry entry) + { + if (writer == null) + { + return; + } + try + { + if (!firstEntry) + { + if (reportFormat == ReportFormat.HTML) + { + writer.write("\n"); + } + else + { + writer.write(","); + } + } + else + { + firstEntry = false; + } + + // write the entry to the file + if (reportFormat == ReportFormat.JSON) + { + writer.write("\n\t\t"); + } + + writeAuditTrailEntry(writer, entry, reportFormat); + } + catch (IOException ioe) + { + throw new AlfrescoRuntimeException(MSG_TRAIL_FILE_FAIL, ioe); + } + } + }; + + String user = params.getUser(); + Long fromTime = getFromDateTime(params.getDateFrom()); + Long toTime = getToDateTime(params.getDateTo()); + NodeRef nodeRef = params.getNodeRef(); + int maxEntries = params.getMaxEntries(); + // Reverse order if the results are limited + boolean forward = maxEntries > 0 ? false : true; + + // start the audit trail report + writeAuditTrailHeader(writer, params, reportFormat); + + if (logger.isDebugEnabled()) + { + logger.debug("RM Audit: Issuing query: " + params); + } + + // Build audit query parameters + AuditQueryParameters dod5015AuditQueryParams = new AuditQueryParameters(); + dod5015AuditQueryParams.setForward(forward); + dod5015AuditQueryParams.setApplicationName(DOD5015_AUDIT_APPLICATION_NAME); + dod5015AuditQueryParams.setUser(user); + dod5015AuditQueryParams.setFromTime(fromTime); + dod5015AuditQueryParams.setToTime(toTime); + if (nodeRef != null) + { + dod5015AuditQueryParams.addSearchKey(DOD5015_AUDIT_DATA_NODE_NODEREF, nodeRef); + } + + // + AuditQueryParameters auditQueryParams = new AuditQueryParameters(); + auditQueryParams.setForward(forward); + auditQueryParams.setApplicationName(RM_AUDIT_APPLICATION_NAME); + auditQueryParams.setUser(user); + auditQueryParams.setFromTime(fromTime); + auditQueryParams.setToTime(toTime); + if (nodeRef != null) + { + auditQueryParams.addSearchKey(RM_AUDIT_DATA_NODE_NODEREF, nodeRef); + } + else if (params.getEvent() != null) + { + auditQueryParams.addSearchKey(RM_AUDIT_DATA_EVENT_NAME, params.getEvent()); + } + + // Get audit entries + auditService.auditQuery(callback, dod5015AuditQueryParams, maxEntries); + auditService.auditQuery(callback, auditQueryParams, maxEntries); + + // finish off the audit trail report + writeAuditTrailFooter(writer, reportFormat); + + // audit that the audit has been view'ed + if (nodeRef == null) + { + // grab the default file plan, but don't fail if it can't be found! + nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + } + auditEvent(nodeRef, AUDIT_EVENT_VIEW, null, null, true); + } + + /** + * Calculates the start of the given date. + * For example, if you had the date time of 12 Aug 2013 12:10:15.158 + * the result would be 12 Aug 2013 00:00:00.000. + * + * @param date The date for which the start should be calculated. + * @return Returns the start of the given date. + */ + private Date getStartOfDay(Date date) + { + return DateUtils.truncate(date == null ? new Date() : date, Calendar.DATE); + } + + /** + * Gets the start of the from date + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl.getStartOfDay() + * + * @param date The date for which the start should be retrieved. + * @return Returns null if the given date is null, otherwise the start of the given day. + */ + private Date getFromDate(Date date) + { + return date == null ? null : getStartOfDay(date); + } + + /** + * Returns the number of milliseconds for the "from date". + * + * @param date The date for which the number of milliseconds should retrieved. + * @return Returns null if the given date is null, otherwise the number of milliseconds for the given date. + */ + private Long getFromDateTime(Date date) + { + Long fromDateTime = null; + Date fromDate = getFromDate(date); + if (fromDate != null) + { + fromDateTime = Long.valueOf(fromDate.getTime()); + } + return fromDateTime; + } + + /** + * Calculates the end of the given date. + * For example, if you had the date time of 12 Aug 2013 12:10:15.158 + * the result would be 12 Aug 2013 23:59:59.999. + * + * @param date The date for which the end should be calculated. + * @return Returns the end of the given date. + */ + private Date getEndOfDay(Date date) + { + return DateUtils.addMilliseconds(DateUtils.ceiling(date == null ? new Date() : date, Calendar.DATE), -1); + } + + /** + * Gets the end of the from date + * @see org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditServiceImpl.getEndOfDay() + * + * @param date The date for which the end should be retrieved. + * @return Returns null if the given date is null, otherwise the end of the given day. + */ + private Date getToDate(Date date) + { + return date == null ? null : getEndOfDay(date); + } + + /** + * Returns the number of milliseconds for the "to date". + * + * @param date The date for which the number of milliseconds should retrieved. + * @return Returns null if the given date is null, otherwise the number of milliseconds for the given date. + */ + private Long getToDateTime(Date date) + { + Long toDateTime = null; + Date toDate = getToDate(date); + if (toDate != null) + { + toDateTime = Long.valueOf(toDate.getTime()); + } + return toDateTime; + } + + /** + * {@inheritDoc} + */ + @Override + public NodeRef fileAuditTrailAsRecord(RecordsManagementAuditQueryParameters params, + NodeRef destination, ReportFormat format) + { + ParameterCheck.mandatory("params", params); + ParameterCheck.mandatory("destination", destination); + + // NOTE: the underlying RM services will check all the remaining pre-conditions + + NodeRef record = null; + + // get the audit trail for the provided parameters + File auditTrail = this.getAuditTrailFile(params, format); + + if (logger.isDebugEnabled()) + { + logger.debug("Filing audit trail in file " + auditTrail.getAbsolutePath() + + " as a record in record folder: " + destination); + } + + try + { + Map properties = new HashMap(1); + properties.put(ContentModel.PROP_NAME, auditTrail.getName()); + + // file the audit log as an undeclared record + record = this.nodeService.createNode(destination, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, + QName.createValidLocalName(auditTrail.getName())), + ContentModel.TYPE_CONTENT, properties).getChildRef(); + + // Set the content + ContentWriter writer = this.contentService.getWriter(record, ContentModel.PROP_CONTENT, true); + writer.setMimetype(format == ReportFormat.HTML ? MimetypeMap.MIMETYPE_HTML : MimetypeMap.MIMETYPE_JSON); + writer.setEncoding("UTF-8"); + writer.putContent(auditTrail); + } + finally + { + if (logger.isDebugEnabled()) + { + logger.debug("Audit trail report saved to temporary file: " + auditTrail.getAbsolutePath()); + } + else + { + auditTrail.delete(); + } + } + + return record; + } + + /** + * {@inheritDoc} + */ + @Override + public List getAuditEvents() + { + List listAuditEvents = new ArrayList(this.auditEvents.size()); + listAuditEvents.addAll(this.auditEvents.values()); + Collections.sort(listAuditEvents); + return listAuditEvents; + } + + /** + * Writes the start of the audit trail stream to the given writer + * + * @param writer The writer to write to + * @params params The parameters being used + * @param reportFormat The format to write the header in + * @throws IOException + */ + private void writeAuditTrailHeader(Writer writer, + RecordsManagementAuditQueryParameters params, + ReportFormat reportFormat) throws IOException + { + if (writer == null) + { + return; + } + + if (reportFormat == ReportFormat.HTML) + { + // write header as HTML + writer.write("\n"); + writer.write("\n\n"); + writer.write(""); + writer.write(I18NUtil.getMessage(MSG_AUDIT_REPORT)); + writer.write("\n"); + writer.write("\n"); + writer.write("\n

"); + writer.write(I18NUtil.getMessage(MSG_AUDIT_REPORT)); + writer.write("

\n"); + writer.write("
\n"); + + writer.write("From:"); + writer.write(""); + Date from = params.getDateFrom(); + writer.write(from == null ? "<Not Set>" : StringEscapeUtils.escapeHtml(from.toString())); + writer.write(""); + + writer.write("To:"); + writer.write(""); + Date to = params.getDateTo(); + writer.write(to == null ? "<Not Set>" : StringEscapeUtils.escapeHtml(to.toString())); + writer.write(""); + + writer.write("Property:"); + writer.write(""); + QName prop = params.getProperty(); + writer.write(prop == null ? "All" : StringEscapeUtils.escapeHtml(getPropertyLabel(prop))); + writer.write(""); + + writer.write("User:"); + writer.write(""); + writer.write(params.getUser() == null ? "All" : StringEscapeUtils.escapeHtml(params.getUser())); + writer.write(""); + + writer.write("Event:"); + writer.write(""); + writer.write(params.getEvent() == null ? "All" : StringEscapeUtils.escapeHtml(getAuditEventLabel(params.getEvent()))); + writer.write("\n"); + + writer.write("
\n"); + } + else + { + // write header as JSON + writer.write("{\n\t\"data\":\n\t{"); + writer.write("\n\t\t\"started\": \""); + writer.write(ISO8601DateFormat.format(getStartOfDay(params.getDateFrom()))); + writer.write("\",\n\t\t\"stopped\": \""); + writer.write(ISO8601DateFormat.format(getEndOfDay(params.getDateTo()))); + writer.write("\",\n\t\t\"enabled\": "); + writer.write(Boolean.toString(isEnabled())); + writer.write(",\n\t\t\"entries\":["); + } + } + + /** + * Writes an audit trail entry to the given writer + * + * @param writer The writer to write to + * @param entry The entry to write + * @param reportFormat The format to write the header in + * @throws IOException + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void writeAuditTrailEntry(Writer writer, RecordsManagementAuditEntry entry, + ReportFormat reportFormat) throws IOException + { + if (writer == null) + { + return; + } + + if (reportFormat == ReportFormat.HTML) + { + writer.write("
\n"); + writer.write("
"); + writer.write("Timestamp:"); + writer.write(""); + writer.write(StringEscapeUtils.escapeHtml(entry.getTimestamp().toString())); + writer.write(""); + writer.write("User:"); + writer.write(""); + writer.write(entry.getFullName() != null ? + StringEscapeUtils.escapeHtml(entry.getFullName()) : + StringEscapeUtils.escapeHtml(entry.getUserName())); + writer.write(""); + if (entry.getUserRole() != null && entry.getUserRole().length() > 0) + { + writer.write("Role:"); + writer.write(""); + writer.write(StringEscapeUtils.escapeHtml(entry.getUserRole())); + writer.write(""); + } + if (entry.getEvent() != null && entry.getEvent().length() > 0) + { + writer.write("Event:"); + writer.write(""); + writer.write(StringEscapeUtils.escapeHtml(getAuditEventLabel(entry.getEvent()))); + writer.write("\n"); + } + writer.write("
\n"); + writer.write("
"); + if (entry.getIdentifier() != null && entry.getIdentifier().length() > 0) + { + writer.write("Identifier:"); + writer.write(""); + writer.write(StringEscapeUtils.escapeHtml(entry.getIdentifier())); + writer.write(""); + } + if (entry.getNodeType() != null && entry.getNodeType().length() > 0) + { + writer.write("Type:"); + writer.write(""); + writer.write(StringEscapeUtils.escapeHtml(entry.getNodeType())); + writer.write(""); + } + if (entry.getPath() != null && entry.getPath().length() > 0) + { + // we need to strip off the first part of the path + String path = entry.getPath(); + String displayPath = path; + int idx = path.indexOf('/', 1); + if (idx != -1) + { + displayPath = "/File Plan" + path.substring(idx); + } + + writer.write("Location:"); + writer.write(""); + writer.write(StringEscapeUtils.escapeHtml(displayPath)); + writer.write(""); + } + writer.write("
\n"); + + if (entry.getChangedProperties() != null) + { + writer.write(""); + writer.write(""); + + // create an entry for each property that changed + for (QName valueName : entry.getChangedProperties().keySet()) + { + Pair values = entry.getChangedProperties().get(valueName); + writer.write(""); + } + + writer.write("
PropertyPrevious ValueNew Value
"); + writer.write(getPropertyLabel(valueName)); + writer.write(""); + + // inspect the property to determine it's data type + QName propDataType = DataTypeDefinition.TEXT; + PropertyDefinition propDef = dictionaryService.getProperty(valueName); + if (propDef != null) + { + propDataType = propDef.getDataType().getName(); + } + + if(DataTypeDefinition.MLTEXT.equals(propDataType)) + { + writer.write(values.getFirst() == null ? "<none>" : StringEscapeUtils.escapeHtml(convertToMlText((Map)values.getFirst()).getDefaultValue())); + writer.write(""); + writer.write(values.getSecond() == null ? "<none>" : StringEscapeUtils.escapeHtml(convertToMlText((Map)values.getSecond()).getDefaultValue())); + } + else + { + Serializable oldValue = values.getFirst(); + writer.write(oldValue == null ? "<none>" : StringEscapeUtils.escapeHtml(oldValue.toString())); + writer.write(""); + Serializable newValue = values.getSecond(); + writer.write(newValue == null ? "<none>" : StringEscapeUtils.escapeHtml(newValue.toString())); + } + + writer.write("
\n"); + } + + writer.write("
"); + } + else + { + try + { + JSONObject json = new JSONObject(); + + json.put("timestamp", entry.getTimestampString()); + json.put("userName", entry.getUserName()); + json.put("userRole", entry.getUserRole() == null ? "": entry.getUserRole()); + json.put("fullName", entry.getFullName() == null ? "": entry.getFullName()); + json.put("nodeRef", entry.getNodeRef() == null ? "": entry.getNodeRef()); + + // TODO: Find another way for checking the event + if (entry.getEvent().equals("Create Person") && entry.getNodeRef() != null) + { + NodeRef nodeRef = entry.getNodeRef(); + String userName = null; + if(nodeService.exists(nodeRef)) + { + userName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME); + } + json.put("nodeName", userName == null ? "": userName); + json.put("createPerson", true); + } + else + { + json.put("nodeName", entry.getNodeName() == null ? "": entry.getNodeName()); + } + + // TODO: Find another way for checking the event + if (entry.getEvent().equals("Delete RM Object")) + { + json.put("deleteObject", true); + } + + json.put("nodeType", entry.getNodeType() == null ? "": entry.getNodeType()); + json.put("event", entry.getEvent() == null ? "": getAuditEventLabel(entry.getEvent())); + json.put("identifier", entry.getIdentifier() == null ? "": entry.getIdentifier()); + json.put("path", entry.getPath() == null ? "": entry.getPath()); + + JSONArray changedValues = new JSONArray(); + + if (entry.getChangedProperties() != null) + { + // create an entry for each property that changed + for (QName valueName : entry.getChangedProperties().keySet()) + { + Pair values = entry.getChangedProperties().get(valueName); + + JSONObject changedValue = new JSONObject(); + changedValue.put("name", getPropertyLabel(valueName)); + + // inspect the property to determine it's data type + QName propDataType = DataTypeDefinition.TEXT; + PropertyDefinition propDef = dictionaryService.getProperty(valueName); + if (propDef != null) + { + propDataType = propDef.getDataType().getName(); + } + + // handle output of mltext properties + if(DataTypeDefinition.MLTEXT.equals(propDataType)) + { + changedValue.put("previous", values.getFirst() == null ? "" : convertToMlText((Map)values.getFirst()).getDefaultValue()); + changedValue.put("new", values.getSecond() == null ? "" : convertToMlText((Map)values.getSecond()).getDefaultValue()); + } + else + { + changedValue.put("previous", values.getFirst() == null ? "" : values.getFirst().toString()); + changedValue.put("new", values.getSecond() == null ? "" : values.getSecond().toString()); + } + + changedValues.put(changedValue); + } + } + + json.put("changedValues", changedValues); + + writer.write(json.toString()); + } + catch (JSONException je) + { + writer.write("{}"); + } + } + } + + /** + * Helper method to convert value to MLText + * + * @param map map of locale's and values + * @return {@link MLText} multilingual text value + */ + private MLText convertToMlText(Map map) + { + MLText mlText = new MLText(); + mlText.putAll(map); + return mlText; + } + + /** + * Writes the end of the audit trail stream to the given writer + * + * @param writer The writer to write to + * @param reportFormat The format to write the footer in + * @throws IOException + */ + private void writeAuditTrailFooter(Writer writer, ReportFormat reportFormat) throws IOException + { + if (writer == null) + { + return; + } + + if (reportFormat == ReportFormat.HTML) + { + // write footer as HTML + writer.write("\n"); + } + else + { + // write footer as JSON + writer.write("\n\t\t]\n\t}\n}"); + } + } + + /** + * Returns the display label for a property QName + * + * @param property The property to get label for + * @param ddService DictionaryService instance + * @param namespaceService NamespaceService instance + * @return The label + */ + private String getPropertyLabel(QName property) + { + String label = null; + + PropertyDefinition propDef = this.dictionaryService.getProperty(property); + if (propDef != null) + { + label = propDef.getTitle(dictionaryService); + } + + if (label == null) + { + label = property.getLocalName(); + } + + return label; + } + + /** + * Returns the display label for the given audit event key + * + * @param eventKey The audit event key + * @return The display label or null if the key does not exist + */ + private String getAuditEventLabel(String eventKey) + { + String label = eventKey; + + AuditEvent event = this.auditEvents.get(eventKey); + if (event != null) + { + label = event.getLabel(); + } + + return label; + } + + /** + * A class to carry audit information through the transaction. + * + * @author Derek Hulley + * @since 3.2 + */ + private static class RMAuditNode + { + private NodeRef nodeRef; + private String eventName; + private Map nodePropertiesBefore; + private Map nodePropertiesAfter; + private boolean removeIfNoPropertyChanged = false; + + public NodeRef getNodeRef() + { + return nodeRef; + } + + public void setNodeRef(NodeRef nodeRef) + { + this.nodeRef = nodeRef; + } + + public String getEventName() + { + return eventName; + } + + public void setEventName(String eventName) + { + this.eventName = eventName; + } + + public Map getNodePropertiesBefore() + { + return nodePropertiesBefore; + } + + public void setNodePropertiesBefore(Map nodePropertiesBefore) + { + this.nodePropertiesBefore = nodePropertiesBefore; + } + + public Map getNodePropertiesAfter() + { + return nodePropertiesAfter; + } + + public void setNodePropertiesAfter(Map nodePropertiesAfter) + { + this.nodePropertiesAfter = nodePropertiesAfter; + } + + public boolean getRemoveIfNoPropertyChanged() + { + return removeIfNoPropertyChanged; + } + + public void setRemoveIfNoPropertyChanged(boolean removeIfNoPropertyChanged) + { + this.removeIfNoPropertyChanged = removeIfNoPropertyChanged; + } + } + + /** Deprecated Method Implementations **/ + + /** + * Helper method to get the default file plan + * + * @return NodRef default file plan + */ + private NodeRef getDefaultFilePlan() + { + NodeRef defaultFilePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (defaultFilePlan == null) + { + throw new AlfrescoRuntimeException("Default file plan could not be found."); + } + return defaultFilePlan; + } + + /** + * {@inheritDoc} + */ + @Override + @Deprecated + public boolean isEnabled() + { + return isAuditLogEnabled(getDefaultFilePlan()); + } + + /** + * {@inheritDoc} + */ + @Deprecated + public void start() + { + startAuditLog(getDefaultFilePlan()); + } + + /** + * {@inheritDoc} + */ + @Override + @Deprecated + public void stop() + { + stopAuditLog(getDefaultFilePlan()); + } + + /** + * {@inheritDoc} + */ + @Override + @Deprecated + public Date getDateLastStarted() + { + return getDateAuditLogLastStarted(getDefaultFilePlan()); + } + + /** + * {@inheritDoc} + */ + @Override + @Deprecated + public Date getDateLastStopped() + { + return getDateAuditLogLastStopped(getDefaultFilePlan()); + } + + /** + * {@inheritDoc} + */ + @Override + @Deprecated + public void clear() + { + clearAuditLog(getDefaultFilePlan()); + } + + /** + * {@inheritDoc} + * @since 3.2 + * @deprecated since 2.1 + */ + @Override + @Deprecated + public void auditRMAction( + RecordsManagementAction action, + NodeRef nodeRef, + Map parameters) + { + auditEvent(nodeRef, action.getName()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AuditEvent.java index 93d83b2e12..125d1b4586 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/AuditEvent.java @@ -1,146 +1,146 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Class to represent an audit event - * - * @author Gavin Cornwell - * @author Roy Wetherall - * @since 1.0 - */ -@AlfrescoPublicApi -public class AuditEvent implements RecordsManagementModel, Comparable -{ - /** Name */ - private String name; - - /** Label */ - private String label; - - /** Records management audit service */ - protected RecordsManagementAuditService recordsManagementAuditService; - - /** - * @param recordsManagementAuditService records management audit service - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * Init method - */ - public void init() - { - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("label", label); - - recordsManagementAuditService.registerAuditEvent(this); - } - - /** - * Default constructor. - */ - public AuditEvent() - { - // do nothing - } - - /** - * Default constructor. - * - * @param name audit event name - * @param label audit event label (can be actual label or I18N lookup key) - */ - public AuditEvent(String name, String label) - { - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("label", label); - - setName(name); - setLabel(label); - } - - /** - * @return audit event name - */ - public String getName() - { - return this.name; - } - - /** - * @param name audit event name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @return audit event label - */ - public String getLabel() - { - String lookup = I18NUtil.getMessage(label); - if (StringUtils.isBlank(lookup)) - { - lookup = label; - } - return lookup; - } - - /** - * @param label audit event label - */ - public void setLabel(String label) - { - this.label = label; - } - - /** - * Compare by label. - * - * @param compare compare to audit event - * @return int - */ - @Override - public int compareTo(AuditEvent compare) - { - return getLabel().compareTo(compare.getLabel()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Class to represent an audit event + * + * @author Gavin Cornwell + * @author Roy Wetherall + * @since 1.0 + */ +@AlfrescoPublicApi +public class AuditEvent implements RecordsManagementModel, Comparable +{ + /** Name */ + private String name; + + /** Label */ + private String label; + + /** Records management audit service */ + protected RecordsManagementAuditService recordsManagementAuditService; + + /** + * @param recordsManagementAuditService records management audit service + */ + public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) + { + this.recordsManagementAuditService = recordsManagementAuditService; + } + + /** + * Init method + */ + public void init() + { + ParameterCheck.mandatory("name", name); + ParameterCheck.mandatory("label", label); + + recordsManagementAuditService.registerAuditEvent(this); + } + + /** + * Default constructor. + */ + public AuditEvent() + { + // do nothing + } + + /** + * Default constructor. + * + * @param name audit event name + * @param label audit event label (can be actual label or I18N lookup key) + */ + public AuditEvent(String name, String label) + { + ParameterCheck.mandatory("name", name); + ParameterCheck.mandatory("label", label); + + setName(name); + setLabel(label); + } + + /** + * @return audit event name + */ + public String getName() + { + return this.name; + } + + /** + * @param name audit event name + */ + public void setName(String name) + { + this.name = name; + } + + /** + * @return audit event label + */ + public String getLabel() + { + String lookup = I18NUtil.getMessage(label); + if (StringUtils.isBlank(lookup)) + { + lookup = label; + } + return lookup; + } + + /** + * @param label audit event label + */ + public void setLabel(String label) + { + this.label = label; + } + + /** + * Compare by label. + * + * @param compare compare to audit event + * @return int + */ + @Override + public int compareTo(AuditEvent compare) + { + return getLabel().compareTo(compare.getLabel()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyToAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyToAuditEvent.java index 9856f1afab..b5af88c9dc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyToAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyToAuditEvent.java @@ -1,70 +1,70 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import java.util.Map; - -import org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy; -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.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Copy audit event. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class CopyToAuditEvent extends AuditEvent implements OnCopyCompletePolicy -{ - /** - * Audit copy of file plan components - * - * @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy#onCopyComplete(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent" - ) - public void onCopyComplete(QName classRef, - NodeRef sourceNodeRef, - NodeRef targetNodeRef, - boolean copyToNewNode, - Map copyMap) - { - if (copyToNewNode) - { - recordsManagementAuditService.auditEvent(targetNodeRef, getName()); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import java.util.Map; + +import org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy; +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.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Copy audit event. + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class CopyToAuditEvent extends AuditEvent implements OnCopyCompletePolicy +{ + /** + * Audit copy of file plan components + * + * @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy#onCopyComplete(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:filePlanComponent" + ) + public void onCopyComplete(QName classRef, + NodeRef sourceNodeRef, + NodeRef targetNodeRef, + boolean copyToNewNode, + Map copyMap) + { + if (copyToNewNode) + { + recordsManagementAuditService.auditEvent(targetNodeRef, getName()); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateObjectAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateObjectAuditEvent.java index 42938bada7..af6a987b04 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateObjectAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreateObjectAuditEvent.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy; -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.cmr.repository.ChildAssociationRef; - -/** - * Audits the creation of file plan component objects - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class CreateObjectAuditEvent extends AuditEvent implements OnCreateNodePolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent" - ) - public void onCreateNode(ChildAssociationRef childAssocRef) - { - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy; +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.cmr.repository.ChildAssociationRef; + +/** + * Audits the creation of file plan component objects + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class CreateObjectAuditEvent extends AuditEvent implements OnCreateNodePolicy +{ + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:filePlanComponent" + ) + public void onCreateNode(ChildAssociationRef childAssocRef) + { + recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreatePersonAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreatePersonAuditEvent.java index 9fcc9ba8f4..537dd63bd5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreatePersonAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CreatePersonAuditEvent.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy; -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.cmr.repository.ChildAssociationRef; - -/** - * Audits person creation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class CreatePersonAuditEvent extends AuditEvent implements OnCreateNodePolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "cm:person" - ) - public void onCreateNode(ChildAssociationRef childAssocRef) - { - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy; +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.cmr.repository.ChildAssociationRef; + +/** + * Audits person creation. + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class CreatePersonAuditEvent extends AuditEvent implements OnCreateNodePolicy +{ + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "cm:person" + ) + public void onCreateNode(ChildAssociationRef childAssocRef) + { + recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteObjectAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteObjectAuditEvent.java index 30de4ff8e6..5321d7208a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteObjectAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/DeleteObjectAuditEvent.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy; -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.cmr.repository.NodeRef; - -/** - * Audits file plan component delete - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class DeleteObjectAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent" - ) - public void beforeDeleteNode(NodeRef nodeRef) - { - recordsManagementAuditService.auditEvent(nodeRef, getName(), null, null, true, false); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy; +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.cmr.repository.NodeRef; + +/** + * Audits file plan component delete + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class DeleteObjectAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy +{ + /** + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:filePlanComponent" + ) + public void beforeDeleteNode(NodeRef nodeRef) + { + recordsManagementAuditService.auditEvent(nodeRef, getName(), null, null, true, false); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/FileToAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/FileToAuditEvent.java index 175357923f..677be824ff 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/FileToAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/FileToAuditEvent.java @@ -1,66 +1,66 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; -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.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * File audit event. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class FileToAuditEvent extends AuditEvent implements OnUpdatePropertiesPolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:record" - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (before.get(PROP_DATE_FILED) == null && after.get(PROP_DATE_FILED) != null) - { - // then we can assume that the record has just been filed - recordsManagementAuditService.auditEvent(nodeRef, getName()); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; +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.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * File audit event. + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class FileToAuditEvent extends AuditEvent implements OnUpdatePropertiesPolicy +{ + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:record" + ) + public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) + { + if (before.get(PROP_DATE_FILED) == null && after.get(PROP_DATE_FILED) != null) + { + // then we can assume that the record has just been filed + recordsManagementAuditService.auditEvent(nodeRef, getName()); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/LinkToAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/LinkToAuditEvent.java index e37cb9779f..16f86627a6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/LinkToAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/LinkToAuditEvent.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy; -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.cmr.repository.ChildAssociationRef; - -/** - * Link to audit event. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class LinkToAuditEvent extends AuditEvent implements OnCreateChildAssociationPolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - type = "rma:filePlanComponent" - ) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) - { - // only care about linking child associations - if (!childAssocRef.isPrimary()) - { - // TODO - // add some dummy properties to indicate the details of the link? - recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName()); - } - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy; +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.cmr.repository.ChildAssociationRef; + +/** + * Link to audit event. + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class LinkToAuditEvent extends AuditEvent implements OnCreateChildAssociationPolicy +{ + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION, + type = "rma:filePlanComponent" + ) + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) + { + // only care about linking child associations + if (!childAssocRef.isPrimary()) + { + // TODO + // add some dummy properties to indicate the details of the link? + recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName()); + } + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/MoveToAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/MoveToAuditEvent.java index 734d5864e1..4fdf0e2ef9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/MoveToAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/MoveToAuditEvent.java @@ -1,59 +1,59 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy; -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.cmr.repository.ChildAssociationRef; - -/** - * Move to audit event. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class MoveToAuditEvent extends AuditEvent implements OnMoveNodePolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent" - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - recordsManagementAuditService.auditEvent(newChildAssocRef.getChildRef(), getName()); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy; +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.cmr.repository.ChildAssociationRef; + +/** + * Move to audit event. + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class MoveToAuditEvent extends AuditEvent implements OnMoveNodePolicy +{ + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:filePlanComponent" + ) + public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) + { + recordsManagementAuditService.auditEvent(newChildAssocRef.getChildRef(), getName()); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java index 519906a38a..6c0e2f5673 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java @@ -1,67 +1,67 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; -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.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Audits recordable version policy property updates - * - * @author Tuna Aksoy - * @since 2.3 - */ -@BehaviourBean -public class RecordableVersionPolicyAuditEvent extends AuditEvent implements OnUpdatePropertiesPolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "cm:cmobject" - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (before.get(PROP_RECORDABLE_VERSION_POLICY) != after.get(PROP_RECORDABLE_VERSION_POLICY)) - { - recordsManagementAuditService.auditEvent(nodeRef, getName(), before, after, true, true); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; +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.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Audits recordable version policy property updates + * + * @author Tuna Aksoy + * @since 2.3 + */ +@BehaviourBean +public class RecordableVersionPolicyAuditEvent extends AuditEvent implements OnUpdatePropertiesPolicy +{ + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "cm:cmobject" + ) + public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) + { + if (before.get(PROP_RECORDABLE_VERSION_POLICY) != after.get(PROP_RECORDABLE_VERSION_POLICY)) + { + recordsManagementAuditService.auditEvent(nodeRef, getName(), before, after, true, true); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UpdateObjectAuditEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UpdateObjectAuditEvent.java index 0d375bbaf6..bef09bfa6c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UpdateObjectAuditEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/UpdateObjectAuditEvent.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.event; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; -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.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Audits file plan component property updates - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class UpdateObjectAuditEvent extends AuditEvent implements OnUpdatePropertiesPolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent" - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - recordsManagementAuditService.auditEvent(nodeRef, getName(), before, after, false, true); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.event; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; +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.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Audits file plan component property updates + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class UpdateObjectAuditEvent extends AuditEvent implements OnUpdatePropertiesPolicy +{ + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:filePlanComponent" + ) + public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) + { + recordsManagementAuditService.auditEvent(nodeRef, getName(), before, after, false, true); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java index c689566406..4112fbc345 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java @@ -1,127 +1,127 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.extractor; - -import java.io.Serializable; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.audit.extractor.AbstractDataExtractor; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * An extractor that uses a node context to determine the currently-authenticated - * user's RM roles. This is not a data generator because it can only function in - * the context of a give node. - * - * @author Derek Hulley - * @since 3.2 - */ -public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtractor -{ - private NodeService nodeService; - private FilePlanService filePlanService; - private FilePlanRoleService filePlanRoleService; - - /** - * Used to check that the node in the context is a fileplan component - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @return Returns true if the data is a NodeRef and it represents - * a fileplan component - */ - public boolean isSupported(Serializable data) - { - if (!(data instanceof NodeRef)) - { - return false; - } - return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - } - - /** - * @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable) - */ - public Serializable extractData(Serializable value) - { - NodeRef nodeRef = (NodeRef) value; - String user = AuthenticationUtil.getFullyAuthenticatedUser(); - if (user == null) - { - // No-one is authenticated - return null; - } - - StringBuilder sb = new StringBuilder(100); - - // Get the rm root - NodeRef rmRootNodeRef = filePlanService.getFilePlan(nodeRef); - - if (rmRootNodeRef != null) - { - Set roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user); - for (Role role : roles) - { - if (sb.length() > 0) - { - sb.append(", "); - } - sb.append(role.getDisplayLabel()); - } - } - - // Done - return sb.toString(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.extractor; + +import java.io.Serializable; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.repo.audit.extractor.AbstractDataExtractor; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; + +/** + * An extractor that uses a node context to determine the currently-authenticated + * user's RM roles. This is not a data generator because it can only function in + * the context of a give node. + * + * @author Derek Hulley + * @since 3.2 + */ +public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtractor +{ + private NodeService nodeService; + private FilePlanService filePlanService; + private FilePlanRoleService filePlanRoleService; + + /** + * Used to check that the node in the context is a fileplan component + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @return Returns true if the data is a NodeRef and it represents + * a fileplan component + */ + public boolean isSupported(Serializable data) + { + if (!(data instanceof NodeRef)) + { + return false; + } + return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); + } + + /** + * @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable) + */ + public Serializable extractData(Serializable value) + { + NodeRef nodeRef = (NodeRef) value; + String user = AuthenticationUtil.getFullyAuthenticatedUser(); + if (user == null) + { + // No-one is authenticated + return null; + } + + StringBuilder sb = new StringBuilder(100); + + // Get the rm root + NodeRef rmRootNodeRef = filePlanService.getFilePlan(nodeRef); + + if (rmRootNodeRef != null) + { + Set roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user); + for (Role role : roles) + { + if (sb.length() > 0) + { + sb.append(", "); + } + sb.append(role.getDisplayLabel()); + } + } + + // Done + return sb.toString(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java index b4f148c317..35cf620da3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanIdentifierDataExtractor.java @@ -1,79 +1,79 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.extractor; - -import java.io.Serializable; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.audit.extractor.AbstractDataExtractor; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * An extractor that gets a node's {@link RecordsManagementModel#PROP_IDENTIFIER identifier} property. - * This will only extract data if the node is a - * {@link RecordsManagementModel#ASPECT_RECORD_COMPONENT_ID Record component identifier}. - * - * @author Derek Hulley - * @since 3.2 - */ -public final class FilePlanIdentifierDataExtractor extends AbstractDataExtractor -{ - private NodeService nodeService; - - /** - * Used to check that the node in the context is a fileplan component - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @return Returns true if the data is a NodeRef and it represents - * a fileplan component - */ - public boolean isSupported(Serializable data) - { - if (!(data instanceof NodeRef)) - { - return false; - } - return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_RECORD_COMPONENT_ID); - } - - public Serializable extractData(Serializable value) - { - NodeRef nodeRef = (NodeRef) value; - - String identifier = (String) nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER); - - // Done - return identifier; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.extractor; + +import java.io.Serializable; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.audit.extractor.AbstractDataExtractor; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; + +/** + * An extractor that gets a node's {@link RecordsManagementModel#PROP_IDENTIFIER identifier} property. + * This will only extract data if the node is a + * {@link RecordsManagementModel#ASPECT_RECORD_COMPONENT_ID Record component identifier}. + * + * @author Derek Hulley + * @since 3.2 + */ +public final class FilePlanIdentifierDataExtractor extends AbstractDataExtractor +{ + private NodeService nodeService; + + /** + * Used to check that the node in the context is a fileplan component + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @return Returns true if the data is a NodeRef and it represents + * a fileplan component + */ + public boolean isSupported(Serializable data) + { + if (!(data instanceof NodeRef)) + { + return false; + } + return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_RECORD_COMPONENT_ID); + } + + public Serializable extractData(Serializable value) + { + NodeRef nodeRef = (NodeRef) value; + + String identifier = (String) nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER); + + // Done + return identifier; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java index 09f2ad7f87..95cbc9d9d1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java @@ -1,129 +1,129 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.extractor; - -import java.io.Serializable; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.audit.extractor.AbstractDataExtractor; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.rule.RuleService; - -/** - * An extractor that extracts the cm:name path from the RM root down to - * - and including - the node's own name. This will only extract data if the - * node is a {@link RecordsManagementModel#ASPECT_FILE_PLAN_COMPONENT fileplan component}. - * - * @see FilePlanService#getNodeRefPath(NodeRef) - * - * @author Derek Hulley - * @since 3.2 - */ -public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor -{ - private NodeService nodeService; - private FilePlanService filePlanService; - private RuleService ruleService; - - /** - * Used to check that the node in the context is a fileplan component - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param ruleService the ruleService to set - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @return Returns true if the data is a NodeRef and it represents - * a fileplan component - */ - public boolean isSupported(Serializable data) - { - if (!(data instanceof NodeRef)) - { - return false; - } - return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - } - - /** - * @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable) - */ - public Serializable extractData(Serializable value) - { - String extractedData = null; - - ruleService.disableRules(); - try - { - NodeRef nodeRef = (NodeRef) value; - StringBuilder sb = new StringBuilder(128); - - if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - // Get path from the RM root - List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); - - for (NodeRef pathNodeRef : nodeRefPath) - { - String name = (String)nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME); - sb.append("/").append(name); - } - } - - // Done - extractedData = sb.toString(); - } - finally - { - ruleService.enableRules(); - } - - return extractedData; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.extractor; + +import java.io.Serializable; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.audit.extractor.AbstractDataExtractor; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.rule.RuleService; + +/** + * An extractor that extracts the cm:name path from the RM root down to + * - and including - the node's own name. This will only extract data if the + * node is a {@link RecordsManagementModel#ASPECT_FILE_PLAN_COMPONENT fileplan component}. + * + * @see FilePlanService#getNodeRefPath(NodeRef) + * + * @author Derek Hulley + * @since 3.2 + */ +public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor +{ + private NodeService nodeService; + private FilePlanService filePlanService; + private RuleService ruleService; + + /** + * Used to check that the node in the context is a fileplan component + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param ruleService the ruleService to set + */ + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + + /** + * @return Returns true if the data is a NodeRef and it represents + * a fileplan component + */ + public boolean isSupported(Serializable data) + { + if (!(data instanceof NodeRef)) + { + return false; + } + return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); + } + + /** + * @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable) + */ + public Serializable extractData(Serializable value) + { + String extractedData = null; + + ruleService.disableRules(); + try + { + NodeRef nodeRef = (NodeRef) value; + StringBuilder sb = new StringBuilder(128); + + if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) + { + // Get path from the RM root + List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); + + for (NodeRef pathNodeRef : nodeRefPath) + { + String name = (String)nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME); + sb.append("/").append(name); + } + } + + // Done + extractedData = sb.toString(); + } + finally + { + ruleService.enableRules(); + } + + return extractedData; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java index 3c5cafe959..5d7041264e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java @@ -1,115 +1,115 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.audit.extractor; - -import java.io.Serializable; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.audit.extractor.AbstractDataExtractor; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.rule.RuleService; - -/** - * An extractor that extracts the NodeRef path from the RM root down to - * - and including - the node itself. This will only extract data if the - * node is a {@link RecordsManagementModel#ASPECT_FILE_PLAN_COMPONENT fileplan component}. - * - * @see FilePlanService#getNodeRefPath(NodeRef) - * - * @author Derek Hulley - * @since 1.0 - */ -public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtractor -{ - private NodeService nodeService; - private FilePlanService filePlanService; - private RuleService ruleService; - - /** - * Used to check that the node in the context is a fileplan component - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param ruleService the ruleService to set - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @return Returns true if the data is a NodeRef and it represents - * a fileplan component - */ - public boolean isSupported(Serializable data) - { - if (!(data instanceof NodeRef)) - { - return false; - } - return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - } - - public Serializable extractData(Serializable value) - { - Serializable extractedData = null; - - ruleService.disableRules(); - try - { - NodeRef nodeRef = (NodeRef) value; - - // Get path from the RM root - List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); - - // Done - extractedData = (Serializable) nodeRefPath; - } - finally - { - ruleService.enableRules(); - } - - return extractedData; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.audit.extractor; + +import java.io.Serializable; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.audit.extractor.AbstractDataExtractor; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.rule.RuleService; + +/** + * An extractor that extracts the NodeRef path from the RM root down to + * - and including - the node itself. This will only extract data if the + * node is a {@link RecordsManagementModel#ASPECT_FILE_PLAN_COMPONENT fileplan component}. + * + * @see FilePlanService#getNodeRefPath(NodeRef) + * + * @author Derek Hulley + * @since 1.0 + */ +public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtractor +{ + private NodeService nodeService; + private FilePlanService filePlanService; + private RuleService ruleService; + + /** + * Used to check that the node in the context is a fileplan component + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param ruleService the ruleService to set + */ + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + + /** + * @return Returns true if the data is a NodeRef and it represents + * a fileplan component + */ + public boolean isSupported(Serializable data) + { + if (!(data instanceof NodeRef)) + { + return false; + } + return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); + } + + public Serializable extractData(Serializable value) + { + Serializable extractedData = null; + + ruleService.disableRules(); + try + { + NodeRef nodeRef = (NodeRef) value; + + // Get path from the RM root + List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); + + // Done + extractedData = (Serializable) nodeRefPath; + } + finally + { + ruleService.enableRules(); + } + + return extractedData; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java index aa073690b4..8f09c430d4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java @@ -1,100 +1,100 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bootstrap; - -import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter; -import org.alfresco.repo.module.ImporterModuleComponent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; - -/** - * Custom implementation of module component importer - * - * @author Roy Wetherall - * @since 2.0 - */ -public class BootstrapImporterModuleComponent extends ImporterModuleComponent -{ - /** rm config folder name */ - private static final String CONFIG_NODEID = "rm_config_folder"; - - /** node service */ - private NodeService nodeService; - - /** module patch executer */ - private ModulePatchExecuter modulePatchExecuter; - - /** record contributors group bootstrap component */ - private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param modulePatchExecuter module patch executer - */ - public void setModulePatchExecuter(ModulePatchExecuter modulePatchExecuter) - { - this.modulePatchExecuter = modulePatchExecuter; - } - - /** - * @param recordContributorsGroupBootstrapComponent record contributors group bootstrap component - */ - public void setRecordContributorsGroupBootstrapComponent(RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent) - { - this.recordContributorsGroupBootstrapComponent = recordContributorsGroupBootstrapComponent; - } - - /** - * Need to check whether this module has already been executed. - * - * @see org.alfresco.repo.module.ImporterModuleComponent#executeInternal() - */ - @Override - protected void executeInternal() throws Throwable - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); - if (!nodeService.exists(nodeRef)) - { - super.executeInternal(); - - // Bootstrap creation of initial data. - recordContributorsGroupBootstrapComponent.createRecordContributorsGroup(); - - // init module schema number - modulePatchExecuter.initSchemaVersion(); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bootstrap; + +import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter; +import org.alfresco.repo.module.ImporterModuleComponent; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; + +/** + * Custom implementation of module component importer + * + * @author Roy Wetherall + * @since 2.0 + */ +public class BootstrapImporterModuleComponent extends ImporterModuleComponent +{ + /** rm config folder name */ + private static final String CONFIG_NODEID = "rm_config_folder"; + + /** node service */ + private NodeService nodeService; + + /** module patch executer */ + private ModulePatchExecuter modulePatchExecuter; + + /** record contributors group bootstrap component */ + private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param modulePatchExecuter module patch executer + */ + public void setModulePatchExecuter(ModulePatchExecuter modulePatchExecuter) + { + this.modulePatchExecuter = modulePatchExecuter; + } + + /** + * @param recordContributorsGroupBootstrapComponent record contributors group bootstrap component + */ + public void setRecordContributorsGroupBootstrapComponent(RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent) + { + this.recordContributorsGroupBootstrapComponent = recordContributorsGroupBootstrapComponent; + } + + /** + * Need to check whether this module has already been executed. + * + * @see org.alfresco.repo.module.ImporterModuleComponent#executeInternal() + */ + @Override + protected void executeInternal() throws Throwable + { + NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); + if (!nodeService.exists(nodeRef)) + { + super.executeInternal(); + + // Bootstrap creation of initial data. + recordContributorsGroupBootstrapComponent.createRecordContributorsGroup(); + + // init module schema number + modulePatchExecuter.initSchemaVersion(); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponent.java index 100e29ae77..7453e3f661 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponent.java @@ -1,154 +1,154 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bootstrap; - -import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode; -import org.alfresco.service.cmr.module.ModuleService; -import org.alfresco.service.descriptor.DescriptorService; -import org.alfresco.service.license.LicenseDescriptor; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationListener; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * Module compatibility component. - *

- * Checks that the currently installed RM AMP licence mode matches that of the - * underlying repository. - * - * @author Roy Wetherall - * @since 2.4 - */ -public class ModuleCompatibilityComponent implements ApplicationListener -{ - /** Logger */ - private static Log logger = LogFactory.getLog(ModuleCompatibilityComponent.class); - - // TODO get this from somewhere - private static final String RM_ENT_MODULE_ID = "alfresco-rm-enterprise-repo"; - - /** descriptor service */ - private DescriptorService descriptorService; - - /** module service */ - private ModuleService moduleService; - - /** - * @param descriptorService descriptor service - */ - public void setDescriptorService(DescriptorService descriptorService) - { - this.descriptorService = descriptorService; - } - - /** - * @param moduleService module service - */ - public void setModuleService(ModuleService moduleService) - { - this.moduleService = moduleService; - } - - /** - * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) - */ - @Override - public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) - { - // license mode - LicenseMode licenseMode = LicenseMode.UNKNOWN; - - // grab the application context - ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext(); - - // get the license mode - LicenseDescriptor license = descriptorService.getLicenseDescriptor(); - if (license != null) - { - licenseMode = license.getLicenseMode(); - } - - // determine whether RM Enterprise is installed or not - boolean isRMEnterprise = isRMEnterprise(); - - // debug log - if (logger.isDebugEnabled()) - { - logger.debug("Module compatibility information:"); - logger.debug(" Repository licence mode = " + licenseMode.toString()); - logger.debug(" RM Enterprise installed = " + isRMEnterprise); - } - - if (LicenseMode.ENTERPRISE.equals(licenseMode) && !isRMEnterprise) - { - // running enterprise rm on community core so close application - // context - closeApplicationContext(applicationContext, - "Running Community Records Management Module on Enterprise Alfresco One is not a supported configuration."); - - } - else if (!LicenseMode.ENTERPRISE.equals(licenseMode) && isRMEnterprise) - { - // running community rm on enterprise core so close application - // context - closeApplicationContext(applicationContext, - "Running Enterprise Records Management module on Community Alfresco One is not a supported configuration."); - } - } - - /** - * Indicates whether RM Enterprise module is installed or not. - * - * @return boolean true if RM Enterprise is installed, false otherwise - */ - private boolean isRMEnterprise() - { - return (moduleService.getModule(RM_ENT_MODULE_ID) != null); - } - - /** - * Close application context, logging message. - * - * @param applicationContext application context - * @param message closure message - */ - private void closeApplicationContext(ApplicationContext applicationContext, String message) - { - // log closure message - if (logger.isErrorEnabled()) - { - logger.error(message); - } - - // close the application context! - ((ConfigurableApplicationContext) applicationContext).close(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bootstrap; + +import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode; +import org.alfresco.service.cmr.module.ModuleService; +import org.alfresco.service.descriptor.DescriptorService; +import org.alfresco.service.license.LicenseDescriptor; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationListener; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.event.ContextRefreshedEvent; + +/** + * Module compatibility component. + *

+ * Checks that the currently installed RM AMP licence mode matches that of the + * underlying repository. + * + * @author Roy Wetherall + * @since 2.4 + */ +public class ModuleCompatibilityComponent implements ApplicationListener +{ + /** Logger */ + private static Log logger = LogFactory.getLog(ModuleCompatibilityComponent.class); + + // TODO get this from somewhere + private static final String RM_ENT_MODULE_ID = "alfresco-rm-enterprise-repo"; + + /** descriptor service */ + private DescriptorService descriptorService; + + /** module service */ + private ModuleService moduleService; + + /** + * @param descriptorService descriptor service + */ + public void setDescriptorService(DescriptorService descriptorService) + { + this.descriptorService = descriptorService; + } + + /** + * @param moduleService module service + */ + public void setModuleService(ModuleService moduleService) + { + this.moduleService = moduleService; + } + + /** + * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) + */ + @Override + public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) + { + // license mode + LicenseMode licenseMode = LicenseMode.UNKNOWN; + + // grab the application context + ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext(); + + // get the license mode + LicenseDescriptor license = descriptorService.getLicenseDescriptor(); + if (license != null) + { + licenseMode = license.getLicenseMode(); + } + + // determine whether RM Enterprise is installed or not + boolean isRMEnterprise = isRMEnterprise(); + + // debug log + if (logger.isDebugEnabled()) + { + logger.debug("Module compatibility information:"); + logger.debug(" Repository licence mode = " + licenseMode.toString()); + logger.debug(" RM Enterprise installed = " + isRMEnterprise); + } + + if (LicenseMode.ENTERPRISE.equals(licenseMode) && !isRMEnterprise) + { + // running enterprise rm on community core so close application + // context + closeApplicationContext(applicationContext, + "Running Community Records Management Module on Enterprise Alfresco One is not a supported configuration."); + + } + else if (!LicenseMode.ENTERPRISE.equals(licenseMode) && isRMEnterprise) + { + // running community rm on enterprise core so close application + // context + closeApplicationContext(applicationContext, + "Running Enterprise Records Management module on Community Alfresco One is not a supported configuration."); + } + } + + /** + * Indicates whether RM Enterprise module is installed or not. + * + * @return boolean true if RM Enterprise is installed, false otherwise + */ + private boolean isRMEnterprise() + { + return (moduleService.getModule(RM_ENT_MODULE_ID) != null); + } + + /** + * Close application context, logging message. + * + * @param applicationContext application context + * @param message closure message + */ + private void closeApplicationContext(ApplicationContext applicationContext, String message) + { + // log closure message + if (logger.isErrorEnabled()) + { + logger.error(message); + } + + // close the application context! + ((ConfigurableApplicationContext) applicationContext).close(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java index 10d117f035..3540bb2af5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java @@ -1,82 +1,82 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bootstrap; - -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; - -/** - * Record contributors group bootstrap component - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordContributorsGroupBootstrapComponent -{ - // default record contributors group - public static final String RECORD_CONTRIBUTORS = "RECORD_CONTRIBUTORS"; - public static final String GROUP_RECORD_CONTRIBUTORS = "GROUP_" + RECORD_CONTRIBUTORS; - - /** authority service */ - private AuthorityService authorityService; - - /** authentication utils */ - private AuthenticationUtil authenticationUtil; - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * Create record contributor group - */ - public void createRecordContributorsGroup() - { - if (!authorityService.authorityExists(GROUP_RECORD_CONTRIBUTORS)) - { - // create record contributors group - authorityService.createAuthority(AuthorityType.GROUP, RECORD_CONTRIBUTORS); - - // add the admin user - authorityService.addAuthority(GROUP_RECORD_CONTRIBUTORS, authenticationUtil.getAdminUserName()); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bootstrap; + +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; + +/** + * Record contributors group bootstrap component + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RecordContributorsGroupBootstrapComponent +{ + // default record contributors group + public static final String RECORD_CONTRIBUTORS = "RECORD_CONTRIBUTORS"; + public static final String GROUP_RECORD_CONTRIBUTORS = "GROUP_" + RECORD_CONTRIBUTORS; + + /** authority service */ + private AuthorityService authorityService; + + /** authentication utils */ + private AuthenticationUtil authenticationUtil; + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @param authenticationUtil authentication util + */ + public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) + { + this.authenticationUtil = authenticationUtil; + } + + /** + * Create record contributor group + */ + public void createRecordContributorsGroup() + { + if (!authorityService.authorityExists(GROUP_RECORD_CONTRIBUTORS)) + { + // create record contributors group + authorityService.createAuthority(AuthorityType.GROUP, RECORD_CONTRIBUTORS); + + // add the admin user + authorityService.addAuthority(GROUP_RECORD_CONTRIBUTORS, authenticationUtil.getAdminUserName()); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java index 2c59e2f155..9681bac731 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java @@ -1,123 +1,123 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bootstrap; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.SplitEmailAction; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.alfresco.repo.action.parameter.NodeParameterSuggesterBootstrap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.context.ApplicationEvent; -import org.springframework.extensions.surf.util.AbstractLifecycleBean; - - -/** - * RM module bootstrap - * - * @author janv - */ -public class RecordsManagementBootstrap extends AbstractLifecycleBean -{ - private TransactionService transactionService; - private RMCaveatConfigService caveatConfigService; - private CustomEmailMappingService customEmailMappingService; - private NodeParameterSuggesterBootstrap suggesterBootstrap; - - public NodeParameterSuggesterBootstrap getSuggesterBootstrap() - { - return suggesterBootstrap; - } - - public void setSuggesterBootstrap(NodeParameterSuggesterBootstrap suggesterBootstrap) - { - this.suggesterBootstrap = suggesterBootstrap; - } - - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) - { - this.caveatConfigService = caveatConfigService; - } - - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - public CustomEmailMappingService getCustomEmailMappingService() - { - return customEmailMappingService; - } - - @Override - protected void onBootstrap(ApplicationEvent event) - { - // run as System on bootstrap - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - // initialise caveat config - caveatConfigService.init(); - - // Initialize the suggester after the model - // in case it contains namespaces from custom models - suggesterBootstrap.init(); - - // Initialise the SplitEmailAction - SplitEmailAction action = (SplitEmailAction)getApplicationContext().getBean("splitEmail"); - action.bootstrap(); - - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - @Override - protected void onShutdown(ApplicationEvent event) - { - // NOOP - } -} - +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bootstrap; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.SplitEmailAction; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; +import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; +import org.alfresco.repo.action.parameter.NodeParameterSuggesterBootstrap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.transaction.TransactionService; +import org.springframework.context.ApplicationEvent; +import org.springframework.extensions.surf.util.AbstractLifecycleBean; + + +/** + * RM module bootstrap + * + * @author janv + */ +public class RecordsManagementBootstrap extends AbstractLifecycleBean +{ + private TransactionService transactionService; + private RMCaveatConfigService caveatConfigService; + private CustomEmailMappingService customEmailMappingService; + private NodeParameterSuggesterBootstrap suggesterBootstrap; + + public NodeParameterSuggesterBootstrap getSuggesterBootstrap() + { + return suggesterBootstrap; + } + + public void setSuggesterBootstrap(NodeParameterSuggesterBootstrap suggesterBootstrap) + { + this.suggesterBootstrap = suggesterBootstrap; + } + + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) + { + this.caveatConfigService = caveatConfigService; + } + + public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) + { + this.customEmailMappingService = customEmailMappingService; + } + + public CustomEmailMappingService getCustomEmailMappingService() + { + return customEmailMappingService; + } + + @Override + protected void onBootstrap(ApplicationEvent event) + { + // run as System on bootstrap + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + RetryingTransactionCallback callback = new RetryingTransactionCallback() + { + public Void execute() + { + // initialise caveat config + caveatConfigService.init(); + + // Initialize the suggester after the model + // in case it contains namespaces from custom models + suggesterBootstrap.init(); + + // Initialise the SplitEmailAction + SplitEmailAction action = (SplitEmailAction)getApplicationContext().getBean("splitEmail"); + action.bootstrap(); + + return null; + } + }; + transactionService.getRetryingTransactionHelper().doInTransaction(callback); + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + @Override + protected void onShutdown(ApplicationEvent event) + { + // NOOP + } +} + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java index 84cfdc4f52..b4b6faffa9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java @@ -1,319 +1,319 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Abstract capability implementation. - * - * @author Andy Hind - * @author Roy Wetherall - */ -public abstract class AbstractCapability extends RMSecurityCommon - implements Capability, RecordsManagementModel, RMPermissionModel -{ - /** Capability service */ - protected CapabilityService capabilityService; - - /** Capability name */ - protected String name; - - /** Capability title and description */ - protected String title; - protected String description; - - /** Capability group */ - protected Group group; - - /** Capability index */ - protected int index; - - /** Indicates whether this is a private capability or not */ - protected boolean isPrivate = false; - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * Init method - */ - public void init() - { - capabilityService.registerCapability(this); - } - - /** - * @param name capability name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getName() - */ - @Override - public String getName() - { - return name; - } - - /** - * @param title capability title - */ - public void setTitle(String title) - { - this.title = title; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getTitle() - */ - @Override - public String getTitle() - { - String title = this.title; - if (StringUtils.isBlank(title)) - { - title = I18NUtil.getMessage("capability." + getName() + ".title"); - if (StringUtils.isBlank(title)) - { - title = getName(); - } - - } - return title; - } - - /** - * @param description capability description - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @param descriptionId message id - */ - public void setDescriptionId(String descriptionId) - { - this.description = I18NUtil.getMessage(descriptionId); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getDescription() - */ - @Override - public String getDescription() - { - return description; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#isPrivate() - */ - public boolean isPrivate() - { - return isPrivate; - } - - /** - * @param isPrivate indicates whether the capability is private or not - */ - public void setPrivate(boolean isPrivate) - { - this.isPrivate = isPrivate; - } - - /** - * Translates the vote to an AccessStatus - * - * @param vote - * @return - */ - private AccessStatus translate(int vote) - { - switch (vote) - { - case AccessDecisionVoter.ACCESS_ABSTAIN: - return AccessStatus.UNDETERMINED; - case AccessDecisionVoter.ACCESS_GRANTED: - return AccessStatus.ALLOWED; - case AccessDecisionVoter.ACCESS_DENIED: - return AccessStatus.DENIED; - default: - return AccessStatus.UNDETERMINED; - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#hasPermission(org.alfresco.service.cmr.repository.NodeRef) - */ - public AccessStatus hasPermission(NodeRef nodeRef) - { - return translate(hasPermissionRaw(nodeRef)); - } - - /** - * Determines whether the current user has permission on this capability. - *

- * Returns the raw permission value. - * - * @param nodeRef node reference - * @return raw permission value - */ - public int hasPermissionRaw(NodeRef nodeRef) - { - String prefix = "hasPermissionRaw" + getName(); - int result = getTransactionCache(prefix, nodeRef); - if (result == NOSET_VALUE) - { - if (checkRmRead(nodeRef) == AccessDecisionVoter.ACCESS_DENIED) - { - result = AccessDecisionVoter.ACCESS_DENIED; - } - else - { - result = hasPermissionImpl(nodeRef); - } - - result = setTransactionCache(prefix, nodeRef, result); - } - - // Log information about evaluated capability - RMMethodSecurityInterceptor.reportCapabilityStatus(getName(), result); - - return result; - } - - /** - * Default implementation. Override if different behaviour required. - * - * @param nodeRef - * @return - */ - protected int hasPermissionImpl(NodeRef nodeRef) - { - return evaluate(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - public int evaluate(NodeRef source, NodeRef target) - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getGroup() - */ - public Group getGroup() - { - return this.group; - } - - public void setGroup(Group group) - { - this.group = group; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getIndex() - */ - public int getIndex() - { - return this.index; - } - - public void setIndex(int index) - { - this.index = index; - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); - return result; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) - { - return false; - } - final AbstractCapability other = (AbstractCapability) obj; - if (getName() == null) - { - if (other.getName() != null) - { - return false; - } - } - else if (!getName().equals(other.getName())) - { - return false; - } - return true; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Abstract capability implementation. + * + * @author Andy Hind + * @author Roy Wetherall + */ +public abstract class AbstractCapability extends RMSecurityCommon + implements Capability, RecordsManagementModel, RMPermissionModel +{ + /** Capability service */ + protected CapabilityService capabilityService; + + /** Capability name */ + protected String name; + + /** Capability title and description */ + protected String title; + protected String description; + + /** Capability group */ + protected Group group; + + /** Capability index */ + protected int index; + + /** Indicates whether this is a private capability or not */ + protected boolean isPrivate = false; + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * Init method + */ + public void init() + { + capabilityService.registerCapability(this); + } + + /** + * @param name capability name + */ + public void setName(String name) + { + this.name = name; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getName() + */ + @Override + public String getName() + { + return name; + } + + /** + * @param title capability title + */ + public void setTitle(String title) + { + this.title = title; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getTitle() + */ + @Override + public String getTitle() + { + String title = this.title; + if (StringUtils.isBlank(title)) + { + title = I18NUtil.getMessage("capability." + getName() + ".title"); + if (StringUtils.isBlank(title)) + { + title = getName(); + } + + } + return title; + } + + /** + * @param description capability description + */ + public void setDescription(String description) + { + this.description = description; + } + + /** + * @param descriptionId message id + */ + public void setDescriptionId(String descriptionId) + { + this.description = I18NUtil.getMessage(descriptionId); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getDescription() + */ + @Override + public String getDescription() + { + return description; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#isPrivate() + */ + public boolean isPrivate() + { + return isPrivate; + } + + /** + * @param isPrivate indicates whether the capability is private or not + */ + public void setPrivate(boolean isPrivate) + { + this.isPrivate = isPrivate; + } + + /** + * Translates the vote to an AccessStatus + * + * @param vote + * @return + */ + private AccessStatus translate(int vote) + { + switch (vote) + { + case AccessDecisionVoter.ACCESS_ABSTAIN: + return AccessStatus.UNDETERMINED; + case AccessDecisionVoter.ACCESS_GRANTED: + return AccessStatus.ALLOWED; + case AccessDecisionVoter.ACCESS_DENIED: + return AccessStatus.DENIED; + default: + return AccessStatus.UNDETERMINED; + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#hasPermission(org.alfresco.service.cmr.repository.NodeRef) + */ + public AccessStatus hasPermission(NodeRef nodeRef) + { + return translate(hasPermissionRaw(nodeRef)); + } + + /** + * Determines whether the current user has permission on this capability. + *

+ * Returns the raw permission value. + * + * @param nodeRef node reference + * @return raw permission value + */ + public int hasPermissionRaw(NodeRef nodeRef) + { + String prefix = "hasPermissionRaw" + getName(); + int result = getTransactionCache(prefix, nodeRef); + if (result == NOSET_VALUE) + { + if (checkRmRead(nodeRef) == AccessDecisionVoter.ACCESS_DENIED) + { + result = AccessDecisionVoter.ACCESS_DENIED; + } + else + { + result = hasPermissionImpl(nodeRef); + } + + result = setTransactionCache(prefix, nodeRef, result); + } + + // Log information about evaluated capability + RMMethodSecurityInterceptor.reportCapabilityStatus(getName(), result); + + return result; + } + + /** + * Default implementation. Override if different behaviour required. + * + * @param nodeRef + * @return + */ + protected int hasPermissionImpl(NodeRef nodeRef) + { + return evaluate(nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + public int evaluate(NodeRef source, NodeRef target) + { + return AccessDecisionVoter.ACCESS_ABSTAIN; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getGroup() + */ + public Group getGroup() + { + return this.group; + } + + public void setGroup(Group group) + { + this.group = group; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#getIndex() + */ + public int getIndex() + { + return this.index; + } + + public void setIndex(int index) + { + this.index = index; + } + + /** + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + return result; + } + + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + final AbstractCapability other = (AbstractCapability) obj; + if (getName() == null) + { + if (other.getName() != null) + { + return false; + } + } + else if (!getName().equals(other.getName())) + { + return false; + } + return true; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Capability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Capability.java index 7eb4280dde..8a5b06247e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Capability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Capability.java @@ -1,116 +1,116 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Capability Interface. - * - * @author andyh - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface Capability -{ - /** - * Does this capability apply to this nodeRef? - * @param nodeRef - * @return - */ - AccessStatus hasPermission(NodeRef nodeRef); - - /** - * - * @param nodeRef - * @return - */ - int hasPermissionRaw(NodeRef nodeRef); - - /** - * Evaluates the capability. - * - * @param nodeRef - * @return - */ - int evaluate(NodeRef nodeRef); - - /** - * Evaluates the capability, taking into account a target. - * - * @param source source node reference - * @param target target node reference - * @return int permission value - */ - int evaluate(NodeRef source, NodeRef target); - - /** - * Indicates whether this is a private capability or not. Private capabilities are used internally, otherwise - * they are made available to the user to assign to roles. - * - * @return boolean true if private, false otherwise - */ - boolean isPrivate(); - - /** - * Get the name of the capability - * - * @return String capability name - */ - String getName(); - - /** - * Get the title of the capability - * - * @return String capability title - */ - String getTitle(); - - /** - * Get the description of the capability - * - * @return String capability description - */ - String getDescription(); - - /** - * Gets the group of a capability - * - * @return Group capability group - */ - Group getGroup(); - - /** - * Gets the index of a capability - * - * @return int capability index - */ - int getIndex(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; + +/** + * Capability Interface. + * + * @author andyh + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface Capability +{ + /** + * Does this capability apply to this nodeRef? + * @param nodeRef + * @return + */ + AccessStatus hasPermission(NodeRef nodeRef); + + /** + * + * @param nodeRef + * @return + */ + int hasPermissionRaw(NodeRef nodeRef); + + /** + * Evaluates the capability. + * + * @param nodeRef + * @return + */ + int evaluate(NodeRef nodeRef); + + /** + * Evaluates the capability, taking into account a target. + * + * @param source source node reference + * @param target target node reference + * @return int permission value + */ + int evaluate(NodeRef source, NodeRef target); + + /** + * Indicates whether this is a private capability or not. Private capabilities are used internally, otherwise + * they are made available to the user to assign to roles. + * + * @return boolean true if private, false otherwise + */ + boolean isPrivate(); + + /** + * Get the name of the capability + * + * @return String capability name + */ + String getName(); + + /** + * Get the title of the capability + * + * @return String capability title + */ + String getTitle(); + + /** + * Get the description of the capability + * + * @return String capability description + */ + String getDescription(); + + /** + * Gets the group of a capability + * + * @return Group capability group + */ + Group getGroup(); + + /** + * Gets the index of a capability + * + * @return int capability index + */ + int getIndex(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java index a6fe9e3d1d..9d53731d0b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityService.java @@ -1,154 +1,154 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Capability service implementation - * - * @author Roy Wetherall - * @since 2.0 - */ -@AlfrescoPublicApi -public interface CapabilityService -{ - /** - * Register a capability - * - * @param capability capability - */ - void registerCapability(Capability capability); - - /** - * Get a named capability. - * - * @param name capability name - * @return {@link Capability} capability or null if not found - */ - Capability getCapability(String name); - - /** - * Get a list of all the assignable capabilities. - * - * @return {@link Set}<{@link Capability}> set of all the assignable capabilities - */ - Set getCapabilities(); - - /** - * Get a list of all the capabilities, optionally including those that are non-assignable. - * - * @param includePrivate indicates that the private, or non-assignable capabilities are included in the result - * @return {@link Set}<{@link Capability}> set of capabilities - */ - Set getCapabilities(boolean includePrivate); - - /** - * Get all the capabilities access state based on the current user for the assignable capabilities. - * - * @param nodeRef node reference - * @return - */ - Map getCapabilitiesAccessState(NodeRef nodeRef); - - /** - * Get all the capabilities access state based on the current user. - * - * @param nodeRef node reference - * @return - */ - Map getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate); - - /** - * - * @param nodeRef - * @param capabilityNames - * @return - */ - Map getCapabilitiesAccessState(NodeRef nodeRef, List capabilityNames); - - /** - * Helper method to get the access state for a single capability. - * - * @param nodeRef - * @param capabilityName - * @return - */ - AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName); - - /** - * Gets the list of all the capability groups (in index order) - * - * @return {@link List}<{@link Group}> List of all the capability groups (in index order) - */ - List getGroups(); - - /** - * Gets a list of capabilities for the given group id - * - * @param groupId The id of a group for which the list of capabilities should be retrieved - * @return {@link List}<{@link Capability}> List of capabilities for the given group - */ - List getCapabilitiesByGroupId(String groupId); - - /** - * Get a list of capabilities for the given group - * - * @param group The group for which the list of capabilities should be retrieved - * @return {@link List}<{@link Capability}> List of capabilities for the given group - */ - List getCapabilitiesByGroup(Group group); - - /** - * Gets a group from it's id - * - * @param groupId The id of the group which should be retrieved - * @return Group The group with the id groupId - */ - Group getGroup(String groupId); - - /** - * Adds a group to the list of groups - * - * @param group The group which should be added - */ - void addGroup(Group group); - - /** - * Removes a group from the list of groups - * - * @param group The group which should be removed - */ - void removeGroup(Group group); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; + +/** + * Capability service implementation + * + * @author Roy Wetherall + * @since 2.0 + */ +@AlfrescoPublicApi +public interface CapabilityService +{ + /** + * Register a capability + * + * @param capability capability + */ + void registerCapability(Capability capability); + + /** + * Get a named capability. + * + * @param name capability name + * @return {@link Capability} capability or null if not found + */ + Capability getCapability(String name); + + /** + * Get a list of all the assignable capabilities. + * + * @return {@link Set}<{@link Capability}> set of all the assignable capabilities + */ + Set getCapabilities(); + + /** + * Get a list of all the capabilities, optionally including those that are non-assignable. + * + * @param includePrivate indicates that the private, or non-assignable capabilities are included in the result + * @return {@link Set}<{@link Capability}> set of capabilities + */ + Set getCapabilities(boolean includePrivate); + + /** + * Get all the capabilities access state based on the current user for the assignable capabilities. + * + * @param nodeRef node reference + * @return + */ + Map getCapabilitiesAccessState(NodeRef nodeRef); + + /** + * Get all the capabilities access state based on the current user. + * + * @param nodeRef node reference + * @return + */ + Map getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate); + + /** + * + * @param nodeRef + * @param capabilityNames + * @return + */ + Map getCapabilitiesAccessState(NodeRef nodeRef, List capabilityNames); + + /** + * Helper method to get the access state for a single capability. + * + * @param nodeRef + * @param capabilityName + * @return + */ + AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName); + + /** + * Gets the list of all the capability groups (in index order) + * + * @return {@link List}<{@link Group}> List of all the capability groups (in index order) + */ + List getGroups(); + + /** + * Gets a list of capabilities for the given group id + * + * @param groupId The id of a group for which the list of capabilities should be retrieved + * @return {@link List}<{@link Capability}> List of capabilities for the given group + */ + List getCapabilitiesByGroupId(String groupId); + + /** + * Get a list of capabilities for the given group + * + * @param group The group for which the list of capabilities should be retrieved + * @return {@link List}<{@link Capability}> List of capabilities for the given group + */ + List getCapabilitiesByGroup(Group group); + + /** + * Gets a group from it's id + * + * @param groupId The id of the group which should be retrieved + * @return Group The group with the id groupId + */ + Group getGroup(String groupId); + + /** + * Adds a group to the list of groups + * + * @param group The group which should be added + */ + void addGroup(Group group); + + /** + * Removes a group from the list of groups + * + * @param group The group which should be removed + */ + void removeGroup(Group group); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java index 71331dd0c2..5c03258c1f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java @@ -1,285 +1,285 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.util.ParameterCheck; - -/** - * @author Roy Wetherall - * @since 2.0 - */ -public class CapabilityServiceImpl implements CapabilityService -{ - /** Capabilities */ - private Map capabilities = new HashMap(57); - - /** Groups */ - private Map groups = new HashMap(13); - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapability(java.lang.String) - */ - @Override - public Capability getCapability(String name) - { - ParameterCheck.mandatoryString("name", name); - - return capabilities.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#registerCapability(org.alfresco.module.org_alfresco_module_rm.capability.Capability) - */ - @Override - public void registerCapability(Capability capability) - { - ParameterCheck.mandatory("capability", capability); - - capabilities.put(capability.getName(), capability); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities() - */ - @Override - public Set getCapabilities() - { - return getCapabilities(true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities(boolean) - */ - @Override - public Set getCapabilities(boolean includePrivate) - { - Set result = null; - if (includePrivate) - { - result = new HashSet(capabilities.values()); - } - else - { - result = new HashSet(capabilities.size()); - for (Capability capability : capabilities.values()) - { - if (!capability.isPrivate()) - { - result.add(capability); - } - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef) - */ - public Map getCapabilitiesAccessState(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return getCapabilitiesAccessState(nodeRef, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public Map getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Set listOfCapabilites = getCapabilities(includePrivate); - HashMap answer = new HashMap(); - for (Capability capability : listOfCapabilites) - { - AccessStatus status = capability.hasPermission(nodeRef); - if (answer.put(capability, status) != null) - { - throw new IllegalStateException(); - } - } - return answer; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef, java.util.List) - */ - public Map getCapabilitiesAccessState(NodeRef nodeRef, List capabilityNames) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("capabilityNames", capabilityNames); - - HashMap answer = new HashMap(); - for (String capabilityName : capabilityNames) - { - Capability capability = capabilities.get(capabilityName); - if (capability != null) - { - AccessStatus status = capability.hasPermission(nodeRef); - if (answer.put(capability, status) != null) - { - throw new IllegalStateException(); - } - } - } - return answer; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilityAccessState(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("capabilityName", capabilityName); - - AccessStatus result = AccessStatus.UNDETERMINED; - Capability capability = getCapability(capabilityName); - if (capability != null) - { - List list = Collections.singletonList(capabilityName); - Map map = getCapabilitiesAccessState(nodeRef, list); - result = map.get(capability); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getGroups() - */ - @Override - public List getGroups() - { - List groups = new ArrayList(); - for (Map.Entry entry : this.groups.entrySet()) - { - groups.add(entry.getValue()); - } - - Collections.sort(groups, new Comparator() - { - @Override - public int compare(Group g1, Group g2) - { - return g1.getIndex() - g2.getIndex(); - } - }); - - return groups; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesByGroupId(java.lang.String) - */ - @Override - public List getCapabilitiesByGroupId(String groupId) - { - ParameterCheck.mandatoryString("groupId", groupId); - - String id = this.groups.get(groupId).getId(); - - List capabilities = new ArrayList(); - for (Capability capability : getCapabilities()) - { - Group group = capability.getGroup(); - if (group != null && group.getId().equalsIgnoreCase(id)) - { - capabilities.add(capability); - } - } - - Collections.sort(capabilities, new Comparator() - { - @Override - public int compare(Capability c1, Capability c2) - { - return c1.getIndex() - c2.getIndex(); - } - }); - - return capabilities; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesByGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) - */ - @Override - public List getCapabilitiesByGroup(Group group) - { - ParameterCheck.mandatory("group", group); - - return getCapabilitiesByGroupId(group.getId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getGroup(java.lang.String) - */ - @Override - public Group getGroup(String groupId) - { - ParameterCheck.mandatoryString("groupId", groupId); - - return this.groups.get(groupId); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#addGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) - */ - @Override - public void addGroup(Group group) - { - ParameterCheck.mandatory("group", group); - - groups.put(group.getId(), group); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#removeGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) - */ - @Override - public void removeGroup(Group group) - { - ParameterCheck.mandatory("group", group); - - groups.remove(group.getId()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.util.ParameterCheck; + +/** + * @author Roy Wetherall + * @since 2.0 + */ +public class CapabilityServiceImpl implements CapabilityService +{ + /** Capabilities */ + private Map capabilities = new HashMap(57); + + /** Groups */ + private Map groups = new HashMap(13); + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapability(java.lang.String) + */ + @Override + public Capability getCapability(String name) + { + ParameterCheck.mandatoryString("name", name); + + return capabilities.get(name); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#registerCapability(org.alfresco.module.org_alfresco_module_rm.capability.Capability) + */ + @Override + public void registerCapability(Capability capability) + { + ParameterCheck.mandatory("capability", capability); + + capabilities.put(capability.getName(), capability); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities() + */ + @Override + public Set getCapabilities() + { + return getCapabilities(true); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilities(boolean) + */ + @Override + public Set getCapabilities(boolean includePrivate) + { + Set result = null; + if (includePrivate) + { + result = new HashSet(capabilities.values()); + } + else + { + result = new HashSet(capabilities.size()); + for (Capability capability : capabilities.values()) + { + if (!capability.isPrivate()) + { + result.add(capability); + } + } + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef) + */ + public Map getCapabilitiesAccessState(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + return getCapabilitiesAccessState(nodeRef, false); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + @Override + public Map getCapabilitiesAccessState(NodeRef nodeRef, boolean includePrivate) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + Set listOfCapabilites = getCapabilities(includePrivate); + HashMap answer = new HashMap(); + for (Capability capability : listOfCapabilites) + { + AccessStatus status = capability.hasPermission(nodeRef); + if (answer.put(capability, status) != null) + { + throw new IllegalStateException(); + } + } + return answer; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesAccessState(org.alfresco.service.cmr.repository.NodeRef, java.util.List) + */ + public Map getCapabilitiesAccessState(NodeRef nodeRef, List capabilityNames) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("capabilityNames", capabilityNames); + + HashMap answer = new HashMap(); + for (String capabilityName : capabilityNames) + { + Capability capability = capabilities.get(capabilityName); + if (capability != null) + { + AccessStatus status = capability.hasPermission(nodeRef); + if (answer.put(capability, status) != null) + { + throw new IllegalStateException(); + } + } + } + return answer; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilityAccessState(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public AccessStatus getCapabilityAccessState(NodeRef nodeRef, String capabilityName) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("capabilityName", capabilityName); + + AccessStatus result = AccessStatus.UNDETERMINED; + Capability capability = getCapability(capabilityName); + if (capability != null) + { + List list = Collections.singletonList(capabilityName); + Map map = getCapabilitiesAccessState(nodeRef, list); + result = map.get(capability); + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getGroups() + */ + @Override + public List getGroups() + { + List groups = new ArrayList(); + for (Map.Entry entry : this.groups.entrySet()) + { + groups.add(entry.getValue()); + } + + Collections.sort(groups, new Comparator() + { + @Override + public int compare(Group g1, Group g2) + { + return g1.getIndex() - g2.getIndex(); + } + }); + + return groups; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesByGroupId(java.lang.String) + */ + @Override + public List getCapabilitiesByGroupId(String groupId) + { + ParameterCheck.mandatoryString("groupId", groupId); + + String id = this.groups.get(groupId).getId(); + + List capabilities = new ArrayList(); + for (Capability capability : getCapabilities()) + { + Group group = capability.getGroup(); + if (group != null && group.getId().equalsIgnoreCase(id)) + { + capabilities.add(capability); + } + } + + Collections.sort(capabilities, new Comparator() + { + @Override + public int compare(Capability c1, Capability c2) + { + return c1.getIndex() - c2.getIndex(); + } + }); + + return capabilities; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getCapabilitiesByGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) + */ + @Override + public List getCapabilitiesByGroup(Group group) + { + ParameterCheck.mandatory("group", group); + + return getCapabilitiesByGroupId(group.getId()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#getGroup(java.lang.String) + */ + @Override + public Group getGroup(String groupId) + { + ParameterCheck.mandatoryString("groupId", groupId); + + return this.groups.get(groupId); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#addGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) + */ + @Override + public void addGroup(Group group) + { + ParameterCheck.mandatory("group", group); + + groups.put(group.getId(), group); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService#removeGroup(org.alfresco.module.org_alfresco_module_rm.capability.Group) + */ + @Override + public void removeGroup(Group group) + { + ParameterCheck.mandatory("group", group); + + groups.remove(group.getId()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java index c1f60d7d68..3b298af394 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CompositeCapability.java @@ -1,46 +1,46 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import java.util.Set; - -/** - * Composite capability Interface. - * - * @author Roy Wetherall - * @since 2.2 - */ -public interface CompositeCapability extends Capability -{ - /** - * Get set of child capabilities. - * - * @return {@link Set}<{@link Capability}> set of child capabilities. - */ - Set getCapabilities(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import java.util.Set; + +/** + * Composite capability Interface. + * + * @author Roy Wetherall + * @since 2.2 + */ +public interface CompositeCapability extends Capability +{ + /** + * Get set of child capabilities. + * + * @return {@link Set}<{@link Capability}> set of child capabilities. + */ + Set getCapabilities(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Group.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Group.java index a63e643da4..855eb023d7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Group.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/Group.java @@ -1,61 +1,61 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Group interface - * - * @author Tuna Aksoy - * @since 2.1 - */ -@AlfrescoPublicApi -public interface Group -{ - /** - * Gets the id of a group (Get the id of the group) - * - * @return String the group id - */ - String getId(); - - /** - * Gets the title of a group - * - * @return String the group title - */ - String getTitle(); - - /** - * Gets the index of a group - * - * @return int the group index - */ - int getIndex(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Group interface + * + * @author Tuna Aksoy + * @since 2.1 + */ +@AlfrescoPublicApi +public interface Group +{ + /** + * Gets the id of a group (Get the id of the group) + * + * @return String the group id + */ + String getId(); + + /** + * Gets the title of a group + * + * @return String the group title + */ + String getTitle(); + + /** + * Gets the index of a group + * + * @return int the group index + */ + int getIndex(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/GroupImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/GroupImpl.java index d9b99fa351..eb9209da2c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/GroupImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/GroupImpl.java @@ -1,114 +1,114 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Group implementation - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class GroupImpl implements Group -{ - /** The group id */ - private String id; - - /** The group title */ - private String title; - - /** The group index */ - private int index; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * Sets the capability service - * - * @param capabilityService the capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - public void init() - { - this.capabilityService.addGroup(this); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getId() - */ - @Override - public String getId() - { - return this.id; - } - - public void setId(String id) - { - this.id = id; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getTitle() - */ - @Override - public String getTitle() - { - String title = this.title; - if (StringUtils.isBlank(title)) - { - title = I18NUtil.getMessage("capability.group." + getId() + ".title"); - } - return title; - } - - public void setTitle(String title) - { - this.title = title; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getIndex() - */ - @Override - public int getIndex() - { - return this.index; - } - - public void setIndex(int index) - { - this.index = index; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Group implementation + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class GroupImpl implements Group +{ + /** The group id */ + private String id; + + /** The group title */ + private String title; + + /** The group index */ + private int index; + + /** Capability service */ + private CapabilityService capabilityService; + + /** + * Sets the capability service + * + * @param capabilityService the capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + public void init() + { + this.capabilityService.addGroup(this); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getId() + */ + @Override + public String getId() + { + return this.id; + } + + public void setId(String id) + { + this.id = id; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getTitle() + */ + @Override + public String getTitle() + { + String title = this.title; + if (StringUtils.isBlank(title)) + { + title = I18NUtil.getMessage("capability.group." + getId() + ".title"); + } + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Group#getIndex() + */ + @Override + public int getIndex() + { + return this.index; + } + + public void setIndex(int index) + { + this.index = index; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java index d5f8743e9d..1aea537958 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java @@ -1,38 +1,38 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; - -/** - * @author Roy Wetherall - */ -public interface PolicyRegister -{ - void registerPolicy(Policy policy); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; + +/** + * @author Roy Wetherall + */ +public interface PolicyRegister +{ + void registerPolicy(Policy policy); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java index 9b7ffb7255..5faa74bf55 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMActionProxyFactoryBean.java @@ -1,124 +1,124 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.repo.action.RuntimeActionService; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.transaction.TransactionService; -import org.springframework.aop.framework.ProxyFactoryBean; - -/** - * RM action proxy factory bean. - * - * @author Roy Wetherall - */ -public class RMActionProxyFactoryBean extends ProxyFactoryBean -{ - private static final long serialVersionUID = 539749542853266449L; - - /** Runtime action service */ - protected RuntimeActionService runtimeActionService; - - /** Records management action service */ - protected RecordsManagementActionService recordsManagementActionService; - - /** Records management audit service */ - protected RecordsManagementAuditService recordsManagementAuditService; - - /** transaction service */ - private TransactionService transactionService; - - /** - * Set action service - * - * @param actionService - */ - public void setRuntimeActionService(RuntimeActionService runtimeActionService) - { - this.runtimeActionService = runtimeActionService; - } - - /** - * Set records management service - * - * @param recordsManagementActionService - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * Set records management service - * - * @param recordsManagementAuditService - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * @param transactionService transaction service - * @since 2.4.a - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Register the action - */ - public void registerAction() - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - RecordsManagementAction action = (RecordsManagementAction)getObject(); - recordsManagementActionService.register(action); - - return null; - } - }); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.repo.action.RuntimeActionService; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.transaction.TransactionService; +import org.springframework.aop.framework.ProxyFactoryBean; + +/** + * RM action proxy factory bean. + * + * @author Roy Wetherall + */ +public class RMActionProxyFactoryBean extends ProxyFactoryBean +{ + private static final long serialVersionUID = 539749542853266449L; + + /** Runtime action service */ + protected RuntimeActionService runtimeActionService; + + /** Records management action service */ + protected RecordsManagementActionService recordsManagementActionService; + + /** Records management audit service */ + protected RecordsManagementAuditService recordsManagementAuditService; + + /** transaction service */ + private TransactionService transactionService; + + /** + * Set action service + * + * @param actionService + */ + public void setRuntimeActionService(RuntimeActionService runtimeActionService) + { + this.runtimeActionService = runtimeActionService; + } + + /** + * Set records management service + * + * @param recordsManagementActionService + */ + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * Set records management service + * + * @param recordsManagementAuditService + */ + public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) + { + this.recordsManagementAuditService = recordsManagementAuditService; + } + + /** + * @param transactionService transaction service + * @since 2.4.a + */ + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + /** + * Register the action + */ + public void registerAction() + { + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() + { + transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + RecordsManagementAction action = (RecordsManagementAction)getObject(); + recordsManagementActionService.register(action); + + return null; + } + }); + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java index 010363c7a3..1773448d4b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java @@ -1,971 +1,971 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import java.util.ArrayList; -import java.util.BitSet; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.StringTokenizer; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.search.SimpleResultSetMetaData; -import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet; -import org.alfresco.repo.search.impl.querymodel.QueryEngineResults; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.PermissionCheckCollection; -import org.alfresco.repo.security.permissions.PermissionCheckValue; -import org.alfresco.repo.security.permissions.PermissionCheckedCollection.PermissionCheckedCollectionMixin; -import org.alfresco.repo.security.permissions.PermissionCheckedValue; -import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; -import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSet; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.LimitBy; -import org.alfresco.service.cmr.search.PermissionEvaluationMode; -import org.alfresco.service.cmr.search.ResultSet; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.InitializingBean; - -import net.sf.acegisecurity.AccessDeniedException; -import net.sf.acegisecurity.Authentication; -import net.sf.acegisecurity.ConfigAttribute; -import net.sf.acegisecurity.ConfigAttributeDefinition; -import net.sf.acegisecurity.afterinvocation.AfterInvocationProvider; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * RM After Invocation Provider - */ -@SuppressWarnings("unused") -public class RMAfterInvocationProvider extends RMSecurityCommon - implements AfterInvocationProvider, InitializingBean -{ - private static Log logger = LogFactory.getLog(RMAfterInvocationProvider.class); - - private static final String AFTER_RM = "AFTER_RM"; - - private int maxPermissionChecks; - - private long maxPermissionCheckTimeMillis; - - public boolean supports(ConfigAttribute configAttribute) - { - String attribute = configAttribute.getAttribute(); - return (StringUtils.isNotBlank(attribute) && attribute.startsWith(AFTER_RM)); - } - - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) - { - return (MethodInvocation.class.isAssignableFrom(clazz)); - } - - public void afterPropertiesSet() - { - } - - /** - * Default constructor - */ - public RMAfterInvocationProvider() - { - super(); - maxPermissionChecks = Integer.MAX_VALUE; - maxPermissionCheckTimeMillis = Long.MAX_VALUE; - } - - /** - * Set the max number of permission checks - * - * @param maxPermissionChecks - */ - public void setMaxPermissionChecks(int maxPermissionChecks) - { - this.maxPermissionChecks = maxPermissionChecks; - } - - /** - * Set the max time for permission checks - * - * @param maxPermissionCheckTimeMillis - */ - public void setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis) - { - this.maxPermissionCheckTimeMillis = maxPermissionCheckTimeMillis; - } - - @SuppressWarnings("rawtypes") - public Object decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object returnedObject) - { - if (logger.isDebugEnabled()) - { - MethodInvocation mi = (MethodInvocation) object; - if (mi == null) - { - logger.debug("Method is null."); - } - else - { - logger.debug("Method: " + mi.getMethod().toString()); - } - } - try - { - if (AuthenticationUtil.isRunAsUserTheSystemUser()) - { - if (logger.isDebugEnabled()) - { - logger.debug("Allowing system user access"); - } - return returnedObject; - } - else if (returnedObject == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Allowing null object access"); - } - return null; - } - else if (PermissionCheckedValue.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (PermissionCheckedValue) returnedObject); - } - else if (PermissionCheckValue.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (PermissionCheckValue) returnedObject); - } - else if (StoreRef.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, nodeService.getRootNode((StoreRef) returnedObject)).getStoreRef(); - } - else if (NodeRef.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (NodeRef) returnedObject); - } - else if (ChildAssociationRef.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (ChildAssociationRef) returnedObject); - } - else if (AssociationRef.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (AssociationRef) returnedObject); - } - else if (ResultSet.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (ResultSet) returnedObject); - } - else if (PagingLuceneResultSet.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (PagingLuceneResultSet) returnedObject); - } - else if (QueryEngineResults.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (QueryEngineResults) returnedObject); - } - else if (Collection.class.isAssignableFrom(returnedObject.getClass())) - { - return decide(authentication, object, config, (Collection) returnedObject); - } - else if (returnedObject.getClass().isArray()) - { - return decide(authentication, object, config, (Object[]) returnedObject); - } - else - { - if (logger.isDebugEnabled()) - { - logger.debug("Uncontrolled object - access allowed for " + object.getClass().getName()); - } - return returnedObject; - } - } - catch (AccessDeniedException ade) - { - if (logger.isDebugEnabled()) - { - logger.debug("Access denied: " + ade.getMessage()); - } - throw ade; - } - catch (RuntimeException re) - { - if (logger.isDebugEnabled()) - { - logger.debug("Access denied by runtime exception: " + re.getMessage()); - } - throw re; - } - - } - - private PermissionCheckedValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckedValue returnedObject) - { - // This passes as it has already been filtered - // TODO: Get the filter that was applied and double-check - return returnedObject; - } - - private PermissionCheckValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckValue returnedObject) - { - // Get the wrapped value - NodeRef nodeRef = returnedObject.getNodeRef(); - decide(authentication, object, config, nodeRef); - // This passes - return returnedObject; - } - - private NodeRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, NodeRef returnedObject) - { - if (returnedObject == null) - { - return null; - } - - if (isUnfiltered(returnedObject)) - { - return returnedObject; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - int parentResult = checkRead(nodeService.getPrimaryParent(returnedObject).getParentRef()); - int childResult = checkRead(returnedObject); - checkSupportedDefinitions(supportedDefinitions, parentResult, childResult); - - return returnedObject; - } - - private void checkSupportedDefinitions(List supportedDefinitions, int parentResult, int childResult) - { - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - if (cad.parent && parentResult == AccessDecisionVoter.ACCESS_DENIED) - { - throw new AccessDeniedException("Access Denied"); - } - else if (!cad.parent && childResult == AccessDecisionVoter.ACCESS_DENIED) - { - throw new AccessDeniedException("Access Denied"); - } - } - } - - private boolean isUnfiltered(NodeRef nodeRef) - { - return !nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - - } - - @SuppressWarnings("rawtypes") - private List extractSupportedDefinitions(ConfigAttributeDefinition config) - { - List definitions = new ArrayList<>(); - Iterator iter = config.getConfigAttributes(); - - while (iter.hasNext()) - { - ConfigAttribute attr = (ConfigAttribute) iter.next(); - - if (this.supports(attr)) - { - definitions.add(new ConfigAttributeDefintion(attr)); - } - - } - return definitions; - } - - private ChildAssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ChildAssociationRef returnedObject) - { - if (returnedObject == null) - { - return null; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - int parentReadCheck = checkRead(returnedObject.getParentRef()); - int childReadCheck = checkRead(returnedObject.getChildRef()); - - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - NodeRef testNodeRef = null; - - if (cad.parent) - { - testNodeRef = returnedObject.getParentRef(); - } - else - { - testNodeRef = returnedObject.getChildRef(); - } - - // Enforce Read Policy - - if (isUnfiltered(testNodeRef)) - { - continue; - } - - if (cad.parent && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED) - { - throw new AccessDeniedException("Access Denied"); - } - else if (childReadCheck != AccessDecisionVoter.ACCESS_GRANTED) - { - throw new AccessDeniedException("Access Denied"); - } - } - - return returnedObject; - } - - private AssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, AssociationRef returnedObject) - { - if (returnedObject == null) - { - return null; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - NodeRef testNodeRef = null; - - if (cad.parent) - { - testNodeRef = returnedObject.getSourceRef(); - } - else - { - testNodeRef = returnedObject.getTargetRef(); - } - - if (isUnfiltered(testNodeRef)) - { - continue; - } - - if (checkRead(testNodeRef) != AccessDecisionVoter.ACCESS_GRANTED) - { - throw new AccessDeniedException("Access Denied"); - } - - } - - return returnedObject; - } - - private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PagingLuceneResultSet returnedObject) - { - ResultSet raw = returnedObject.getWrapped(); - ResultSet filteredForPermissions = decide(authentication, object, config, raw); - return new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService); - } - - private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ResultSet returnedObject) - { - if (returnedObject == null) - { - return null; - } - - class RMFilteringResultSet extends FilteringResultSet - { - private long numberFound; - - public RMFilteringResultSet(ResultSet unfiltered, BitSet inclusionMask) - { - super(unfiltered, inclusionMask); - } - - @Override - public long getNumberFound() - { - return numberFound; - } - - private void setNumberFound(long numberFound) - { - this.numberFound = numberFound; - } - } - - BitSet inclusionMask = new BitSet(returnedObject.length()); - RMFilteringResultSet filteringResultSet = new RMFilteringResultSet(returnedObject, inclusionMask); - - List supportedDefinitions = extractSupportedDefinitions(config); - - Integer maxSize = null; - if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems() >= 0) - { - maxSize = Integer.valueOf(returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems()); - } - if ((maxSize == null) && (returnedObject.getResultSetMetaData().getSearchParameters().getLimitBy() == LimitBy.FINAL_SIZE)) - { - maxSize = Integer.valueOf(returnedObject.getResultSetMetaData().getSearchParameters().getLimit()); - } - // Allow for skip - if ((maxSize != null) && (returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount() >= 0)) - { - maxSize = Integer.valueOf(maxSize + returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount()); - } - - if (supportedDefinitions.size() == 0) - { - if (maxSize == null) - { - return returnedObject; - } - else if (returnedObject.length() > maxSize.intValue()) - { - for (int i = 0; i < maxSize.intValue(); i++) - { - inclusionMask.set(i, true); - } - filteringResultSet.setResultSetMetaData( - new SimpleResultSetMetaData( - returnedObject.getResultSetMetaData().getLimitedBy(), - PermissionEvaluationMode.EAGER, - returnedObject.getResultSetMetaData().getSearchParameters())); - return filteringResultSet; - } - else - { - for (int i = 0; i < returnedObject.length(); i++) - { - inclusionMask.set(i, true); - } - filteringResultSet.setResultSetMetaData( - new SimpleResultSetMetaData( - returnedObject.getResultSetMetaData().getLimitedBy(), - PermissionEvaluationMode.EAGER, - returnedObject.getResultSetMetaData().getSearchParameters())); - return filteringResultSet; - } - } - - // record the start time - long startTimeMillis = System.currentTimeMillis(); - - // set the default, unlimited resultset type - filteringResultSet.setResultSetMetaData( - new SimpleResultSetMetaData( - returnedObject.getResultSetMetaData().getLimitedBy(), - PermissionEvaluationMode.EAGER, - returnedObject.getResultSetMetaData().getSearchParameters())); - - for (int i = 0; i < returnedObject.length(); i++) - { - long currentTimeMillis = System.currentTimeMillis(); - - // All permission checks must pass - inclusionMask.set(i, true); - - if (!nodeService.exists(returnedObject.getNodeRef(i))) - { - inclusionMask.set(i, false); - } - else - { - int parentCheckRead = checkRead(returnedObject.getChildAssocRef(i).getParentRef()); - int childCheckRead = checkRead(returnedObject.getNodeRef(i)); - - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - NodeRef testNodeRef = returnedObject.getNodeRef(i); - int checkRead = childCheckRead; - if (cad.parent) - { - testNodeRef = returnedObject.getChildAssocRef(i).getParentRef(); - checkRead = parentCheckRead; - } - - if (isUnfiltered(testNodeRef)) - { - continue; - } - - if (inclusionMask.get(i) && (testNodeRef != null) && (checkRead != AccessDecisionVoter.ACCESS_GRANTED)) - { - inclusionMask.set(i, false); - } - } - } - - // Bug out if we are limiting by size - if ((maxSize != null) && (filteringResultSet.length() > maxSize.intValue())) - { - // Remove the last match to fix the correct size - inclusionMask.set(i, false); - filteringResultSet.setResultSetMetaData(new SimpleResultSetMetaData(LimitBy.FINAL_SIZE, PermissionEvaluationMode.EAGER, returnedObject.getResultSetMetaData() - .getSearchParameters())); - break; - } - } - - filteringResultSet.setNumberFound(returnedObject.getNumberFound()); - - return filteringResultSet; - } - - private QueryEngineResults decide(Authentication authentication, Object object, ConfigAttributeDefinition config, QueryEngineResults returnedObject) - { - Map, ResultSet> map = returnedObject.getResults(); - Map, ResultSet> answer = new HashMap, ResultSet>(map.size(), 1.0f); - - for (Map.Entry, ResultSet> entry : map.entrySet()) - { - ResultSet raw = entry.getValue(); - ResultSet permed; - if (PagingLuceneResultSet.class.isAssignableFrom(raw.getClass())) - { - permed = decide(authentication, object, config, (PagingLuceneResultSet) raw); - } - else - { - permed = decide(authentication, object, config, raw); - } - answer.put(entry.getKey(), permed); - } - - return new QueryEngineResults(answer); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private Collection decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Collection returnedObject) - { - if (returnedObject == null) - { - return null; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - if (logger.isDebugEnabled()) - { - logger.debug("Entries are " + supportedDefinitions); - } - - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - // Default to the system-wide values and we'll see if they need to be reduced - long targetResultCount = returnedObject.size(); - int maxPermissionChecks = Integer.MAX_VALUE; - long maxPermissionCheckTimeMillis = this.maxPermissionCheckTimeMillis; - if (returnedObject instanceof PermissionCheckCollection) - { - PermissionCheckCollection permissionCheckCollection = (PermissionCheckCollection) returnedObject; - // Get values - targetResultCount = permissionCheckCollection.getTargetResultCount(); - if (permissionCheckCollection.getCutOffAfterCount() > 0) - { - maxPermissionChecks = permissionCheckCollection.getCutOffAfterCount(); - } - if (permissionCheckCollection.getCutOffAfterTimeMs() > 0) - { - maxPermissionCheckTimeMillis = permissionCheckCollection.getCutOffAfterTimeMs(); - } - } - - // Start timer and counter for cut-off - boolean cutoff = false; - long startTimeMillis = System.currentTimeMillis(); - int count = 0; - - // Keep values explicitly - List keepValues = new ArrayList(returnedObject.size()); - - for (Object nextObject : returnedObject) - { - // if the maximum result size or time has been exceeded, then we have to remove only - long currentTimeMillis = System.currentTimeMillis(); - - // NOTE: for reference - the "maxPermissionChecks" has never been honoured by this loop (since previously the count was not being incremented) - if (count >= targetResultCount) - { - // We have enough results. We stop without cutoff. - break; - } - else if (count >= maxPermissionChecks) - { - // We have been cut off by count - cutoff = true; - if (logger.isDebugEnabled()) - { - logger.debug("decide (collection) cut-off: " + count + " checks exceeded " + maxPermissionChecks + " checks"); - } - break; - } - else if ((currentTimeMillis - startTimeMillis) > maxPermissionCheckTimeMillis) - { - // We have been cut off by time - cutoff = true; - if (logger.isDebugEnabled()) - { - logger.debug("decide (collection) cut-off: " + (currentTimeMillis - startTimeMillis) + "ms exceeded " + maxPermissionCheckTimeMillis + "ms"); - } - break; - } - - boolean allowed = true; - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - if (cad.mode.equalsIgnoreCase("FilterNode")) - { - NodeRef testNodeRef = null; - if (cad.parent) - { - if (StoreRef.class.isAssignableFrom(nextObject.getClass())) - { - // Will be allowed - testNodeRef = null; - } - else if (NodeRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = nodeService.getPrimaryParent((NodeRef) nextObject).getParentRef(); - } - else if (ChildAssociationRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((ChildAssociationRef) nextObject).getParentRef(); - } - else if (AssociationRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((AssociationRef) nextObject).getSourceRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(nextObject.getClass())) - { - NodeRef nodeRef = ((PermissionCheckValue) nextObject).getNodeRef(); - testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - } - else - { - throw new ACLEntryVoterException("The specified parameter is recognized: " + nextObject.getClass()); - } - } - else - { - if (StoreRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = nodeService.getRootNode((StoreRef) nextObject); - } - else if (NodeRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = (NodeRef) nextObject; - } - else if (ChildAssociationRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((ChildAssociationRef) nextObject).getChildRef(); - } - else if (AssociationRef.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((AssociationRef) nextObject).getTargetRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(nextObject.getClass())) - { - testNodeRef = ((PermissionCheckValue) nextObject).getNodeRef(); - } - else - { - throw new ACLEntryVoterException("The specified parameter is recognized: " + nextObject.getClass()); - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("\t" + cad.typeString + " test on " + testNodeRef + " from " + nextObject.getClass().getName()); - } - - // Null allows - if (isUnfiltered(testNodeRef)) - { - // Continue to next ConfigAttributeDefintion - continue; - } - - if (allowed && - testNodeRef != null && - checkRead(testNodeRef) != AccessDecisionVoter.ACCESS_GRANTED) - { - allowed = false; - // No point evaluating more ConfigAttributeDefintions - break; - } - } - } - - // Failure or success, increase the count - count++; - - if (allowed) - { - keepValues.add(nextObject); - } - } - // Work out how many were left unchecked (for whatever reason) - int sizeOriginal = returnedObject.size(); - int checksRemaining = sizeOriginal - count; - // Note: There are use-cases where unmodifiable collections are passing through. - // So make sure that the collection needs modification at all - if (keepValues.size() < sizeOriginal) - { - // There are values that need to be removed. We have to modify the collection. - try - { - returnedObject.clear(); - returnedObject.addAll(keepValues); - } - catch (UnsupportedOperationException e) - { - throw new AccessDeniedException("Permission-checked list must be modifiable", e); - } - } - - // Attach the extra permission-check data to the collection - return PermissionCheckedCollectionMixin.create(returnedObject, cutoff, checksRemaining, sizeOriginal); - } - - private Object[] decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object[] returnedObject) - { - // Assumption: value is not null - BitSet incudedSet = new BitSet(returnedObject.length); - - List supportedDefinitions = extractSupportedDefinitions(config); - - if (supportedDefinitions.size() == 0) - { - return returnedObject; - } - - for (int i = 0, l = returnedObject.length; i < l; i++) - { - Object current = returnedObject[i]; - - int parentReadCheck = checkRead(getParentReadCheckNode(current)); - int childReadChek = checkRead(getChildReadCheckNode(current)); - - for (ConfigAttributeDefintion cad : supportedDefinitions) - { - incudedSet.set(i, true); - NodeRef testNodeRef = null; - if (cad.parent) - { - if (StoreRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = null; - } - else if (NodeRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = nodeService.getPrimaryParent((NodeRef) current).getParentRef(); - } - else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((ChildAssociationRef) current).getParentRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) - { - NodeRef nodeRef = ((PermissionCheckValue) current).getNodeRef(); - testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - } - else - { - throw new ACLEntryVoterException("The specified parameter is recognized: " + current.getClass()); - } - } - else - { - if (StoreRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = nodeService.getRootNode((StoreRef) current); - } - else if (NodeRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = (NodeRef) current; - } - else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((ChildAssociationRef) current).getChildRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((PermissionCheckValue) current).getNodeRef(); - } - else - { - throw new ACLEntryVoterException("The specified parameter is recognized: " + current.getClass()); - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("\t" + cad.typeString + " test on " + testNodeRef + " from " + current.getClass().getName()); - } - - if (isUnfiltered(testNodeRef)) - { - continue; - } - - int readCheck = childReadChek; - if (cad.parent) - { - readCheck = parentReadCheck; - } - - if (incudedSet.get(i) && (testNodeRef != null) && (readCheck != AccessDecisionVoter.ACCESS_GRANTED)) - { - incudedSet.set(i, false); - } - - } - } - - if (incudedSet.cardinality() == returnedObject.length) - { - return returnedObject; - } - else - { - Object[] answer = new Object[incudedSet.cardinality()]; - for (int i = incudedSet.nextSetBit(0), p = 0; i >= 0; i = incudedSet.nextSetBit(++i), p++) - { - answer[p] = returnedObject[i]; - } - return answer; - } - } - - private NodeRef getParentReadCheckNode(Object current) - { - NodeRef testNodeRef = null; - if (StoreRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = null; - } - else if (NodeRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = nodeService.getPrimaryParent((NodeRef) current).getParentRef(); - } - else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((ChildAssociationRef) current).getParentRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) - { - NodeRef nodeRef = ((PermissionCheckValue) current).getNodeRef(); - testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - } - else - { - throw new ACLEntryVoterException("The specified array is not of NodeRef or ChildAssociationRef"); - } - return testNodeRef; - } - - private NodeRef getChildReadCheckNode(Object current) - { - NodeRef testNodeRef = null; - if (StoreRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = nodeService.getRootNode((StoreRef) current); - } - else if (NodeRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = (NodeRef) current; - } - else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((ChildAssociationRef) current).getChildRef(); - } - else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) - { - testNodeRef = ((PermissionCheckValue) current).getNodeRef(); - } - else - { - throw new ACLEntryVoterException("The specified array is not of NodeRef or ChildAssociationRef"); - } - return testNodeRef; - } - - private class ConfigAttributeDefintion - { - - String typeString; - - String mode; - - boolean parent = false; - - ConfigAttributeDefintion(ConfigAttribute attr) - { - - StringTokenizer st = new StringTokenizer(attr.getAttribute(), ".", false); - typeString = st.nextToken(); - if (!(typeString.equals(AFTER_RM))) - { - throw new ACLEntryVoterException("Invalid type: must be AFTER_RM"); - } - mode = st.nextToken(); - - if (st.hasMoreElements()) - { - parent = true; - } - } - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.search.SimpleResultSetMetaData; +import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet; +import org.alfresco.repo.search.impl.querymodel.QueryEngineResults; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.permissions.PermissionCheckCollection; +import org.alfresco.repo.security.permissions.PermissionCheckValue; +import org.alfresco.repo.security.permissions.PermissionCheckedCollection.PermissionCheckedCollectionMixin; +import org.alfresco.repo.security.permissions.PermissionCheckedValue; +import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; +import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSet; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.LimitBy; +import org.alfresco.service.cmr.search.PermissionEvaluationMode; +import org.alfresco.service.cmr.search.ResultSet; +import org.aopalliance.intercept.MethodInvocation; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.InitializingBean; + +import net.sf.acegisecurity.AccessDeniedException; +import net.sf.acegisecurity.Authentication; +import net.sf.acegisecurity.ConfigAttribute; +import net.sf.acegisecurity.ConfigAttributeDefinition; +import net.sf.acegisecurity.afterinvocation.AfterInvocationProvider; +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * RM After Invocation Provider + */ +@SuppressWarnings("unused") +public class RMAfterInvocationProvider extends RMSecurityCommon + implements AfterInvocationProvider, InitializingBean +{ + private static Log logger = LogFactory.getLog(RMAfterInvocationProvider.class); + + private static final String AFTER_RM = "AFTER_RM"; + + private int maxPermissionChecks; + + private long maxPermissionCheckTimeMillis; + + public boolean supports(ConfigAttribute configAttribute) + { + String attribute = configAttribute.getAttribute(); + return (StringUtils.isNotBlank(attribute) && attribute.startsWith(AFTER_RM)); + } + + @SuppressWarnings("rawtypes") + public boolean supports(Class clazz) + { + return (MethodInvocation.class.isAssignableFrom(clazz)); + } + + public void afterPropertiesSet() + { + } + + /** + * Default constructor + */ + public RMAfterInvocationProvider() + { + super(); + maxPermissionChecks = Integer.MAX_VALUE; + maxPermissionCheckTimeMillis = Long.MAX_VALUE; + } + + /** + * Set the max number of permission checks + * + * @param maxPermissionChecks + */ + public void setMaxPermissionChecks(int maxPermissionChecks) + { + this.maxPermissionChecks = maxPermissionChecks; + } + + /** + * Set the max time for permission checks + * + * @param maxPermissionCheckTimeMillis + */ + public void setMaxPermissionCheckTimeMillis(long maxPermissionCheckTimeMillis) + { + this.maxPermissionCheckTimeMillis = maxPermissionCheckTimeMillis; + } + + @SuppressWarnings("rawtypes") + public Object decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object returnedObject) + { + if (logger.isDebugEnabled()) + { + MethodInvocation mi = (MethodInvocation) object; + if (mi == null) + { + logger.debug("Method is null."); + } + else + { + logger.debug("Method: " + mi.getMethod().toString()); + } + } + try + { + if (AuthenticationUtil.isRunAsUserTheSystemUser()) + { + if (logger.isDebugEnabled()) + { + logger.debug("Allowing system user access"); + } + return returnedObject; + } + else if (returnedObject == null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Allowing null object access"); + } + return null; + } + else if (PermissionCheckedValue.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (PermissionCheckedValue) returnedObject); + } + else if (PermissionCheckValue.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (PermissionCheckValue) returnedObject); + } + else if (StoreRef.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, nodeService.getRootNode((StoreRef) returnedObject)).getStoreRef(); + } + else if (NodeRef.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (NodeRef) returnedObject); + } + else if (ChildAssociationRef.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (ChildAssociationRef) returnedObject); + } + else if (AssociationRef.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (AssociationRef) returnedObject); + } + else if (ResultSet.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (ResultSet) returnedObject); + } + else if (PagingLuceneResultSet.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (PagingLuceneResultSet) returnedObject); + } + else if (QueryEngineResults.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (QueryEngineResults) returnedObject); + } + else if (Collection.class.isAssignableFrom(returnedObject.getClass())) + { + return decide(authentication, object, config, (Collection) returnedObject); + } + else if (returnedObject.getClass().isArray()) + { + return decide(authentication, object, config, (Object[]) returnedObject); + } + else + { + if (logger.isDebugEnabled()) + { + logger.debug("Uncontrolled object - access allowed for " + object.getClass().getName()); + } + return returnedObject; + } + } + catch (AccessDeniedException ade) + { + if (logger.isDebugEnabled()) + { + logger.debug("Access denied: " + ade.getMessage()); + } + throw ade; + } + catch (RuntimeException re) + { + if (logger.isDebugEnabled()) + { + logger.debug("Access denied by runtime exception: " + re.getMessage()); + } + throw re; + } + + } + + private PermissionCheckedValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckedValue returnedObject) + { + // This passes as it has already been filtered + // TODO: Get the filter that was applied and double-check + return returnedObject; + } + + private PermissionCheckValue decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PermissionCheckValue returnedObject) + { + // Get the wrapped value + NodeRef nodeRef = returnedObject.getNodeRef(); + decide(authentication, object, config, nodeRef); + // This passes + return returnedObject; + } + + private NodeRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, NodeRef returnedObject) + { + if (returnedObject == null) + { + return null; + } + + if (isUnfiltered(returnedObject)) + { + return returnedObject; + } + + List supportedDefinitions = extractSupportedDefinitions(config); + if (supportedDefinitions.size() == 0) + { + return returnedObject; + } + + int parentResult = checkRead(nodeService.getPrimaryParent(returnedObject).getParentRef()); + int childResult = checkRead(returnedObject); + checkSupportedDefinitions(supportedDefinitions, parentResult, childResult); + + return returnedObject; + } + + private void checkSupportedDefinitions(List supportedDefinitions, int parentResult, int childResult) + { + for (ConfigAttributeDefintion cad : supportedDefinitions) + { + if (cad.parent && parentResult == AccessDecisionVoter.ACCESS_DENIED) + { + throw new AccessDeniedException("Access Denied"); + } + else if (!cad.parent && childResult == AccessDecisionVoter.ACCESS_DENIED) + { + throw new AccessDeniedException("Access Denied"); + } + } + } + + private boolean isUnfiltered(NodeRef nodeRef) + { + return !nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); + + } + + @SuppressWarnings("rawtypes") + private List extractSupportedDefinitions(ConfigAttributeDefinition config) + { + List definitions = new ArrayList<>(); + Iterator iter = config.getConfigAttributes(); + + while (iter.hasNext()) + { + ConfigAttribute attr = (ConfigAttribute) iter.next(); + + if (this.supports(attr)) + { + definitions.add(new ConfigAttributeDefintion(attr)); + } + + } + return definitions; + } + + private ChildAssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ChildAssociationRef returnedObject) + { + if (returnedObject == null) + { + return null; + } + + List supportedDefinitions = extractSupportedDefinitions(config); + + if (supportedDefinitions.size() == 0) + { + return returnedObject; + } + + int parentReadCheck = checkRead(returnedObject.getParentRef()); + int childReadCheck = checkRead(returnedObject.getChildRef()); + + for (ConfigAttributeDefintion cad : supportedDefinitions) + { + NodeRef testNodeRef = null; + + if (cad.parent) + { + testNodeRef = returnedObject.getParentRef(); + } + else + { + testNodeRef = returnedObject.getChildRef(); + } + + // Enforce Read Policy + + if (isUnfiltered(testNodeRef)) + { + continue; + } + + if (cad.parent && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED) + { + throw new AccessDeniedException("Access Denied"); + } + else if (childReadCheck != AccessDecisionVoter.ACCESS_GRANTED) + { + throw new AccessDeniedException("Access Denied"); + } + } + + return returnedObject; + } + + private AssociationRef decide(Authentication authentication, Object object, ConfigAttributeDefinition config, AssociationRef returnedObject) + { + if (returnedObject == null) + { + return null; + } + + List supportedDefinitions = extractSupportedDefinitions(config); + + if (supportedDefinitions.size() == 0) + { + return returnedObject; + } + + for (ConfigAttributeDefintion cad : supportedDefinitions) + { + NodeRef testNodeRef = null; + + if (cad.parent) + { + testNodeRef = returnedObject.getSourceRef(); + } + else + { + testNodeRef = returnedObject.getTargetRef(); + } + + if (isUnfiltered(testNodeRef)) + { + continue; + } + + if (checkRead(testNodeRef) != AccessDecisionVoter.ACCESS_GRANTED) + { + throw new AccessDeniedException("Access Denied"); + } + + } + + return returnedObject; + } + + private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, PagingLuceneResultSet returnedObject) + { + ResultSet raw = returnedObject.getWrapped(); + ResultSet filteredForPermissions = decide(authentication, object, config, raw); + return new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService); + } + + private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ResultSet returnedObject) + { + if (returnedObject == null) + { + return null; + } + + class RMFilteringResultSet extends FilteringResultSet + { + private long numberFound; + + public RMFilteringResultSet(ResultSet unfiltered, BitSet inclusionMask) + { + super(unfiltered, inclusionMask); + } + + @Override + public long getNumberFound() + { + return numberFound; + } + + private void setNumberFound(long numberFound) + { + this.numberFound = numberFound; + } + } + + BitSet inclusionMask = new BitSet(returnedObject.length()); + RMFilteringResultSet filteringResultSet = new RMFilteringResultSet(returnedObject, inclusionMask); + + List supportedDefinitions = extractSupportedDefinitions(config); + + Integer maxSize = null; + if (returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems() >= 0) + { + maxSize = Integer.valueOf(returnedObject.getResultSetMetaData().getSearchParameters().getMaxItems()); + } + if ((maxSize == null) && (returnedObject.getResultSetMetaData().getSearchParameters().getLimitBy() == LimitBy.FINAL_SIZE)) + { + maxSize = Integer.valueOf(returnedObject.getResultSetMetaData().getSearchParameters().getLimit()); + } + // Allow for skip + if ((maxSize != null) && (returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount() >= 0)) + { + maxSize = Integer.valueOf(maxSize + returnedObject.getResultSetMetaData().getSearchParameters().getSkipCount()); + } + + if (supportedDefinitions.size() == 0) + { + if (maxSize == null) + { + return returnedObject; + } + else if (returnedObject.length() > maxSize.intValue()) + { + for (int i = 0; i < maxSize.intValue(); i++) + { + inclusionMask.set(i, true); + } + filteringResultSet.setResultSetMetaData( + new SimpleResultSetMetaData( + returnedObject.getResultSetMetaData().getLimitedBy(), + PermissionEvaluationMode.EAGER, + returnedObject.getResultSetMetaData().getSearchParameters())); + return filteringResultSet; + } + else + { + for (int i = 0; i < returnedObject.length(); i++) + { + inclusionMask.set(i, true); + } + filteringResultSet.setResultSetMetaData( + new SimpleResultSetMetaData( + returnedObject.getResultSetMetaData().getLimitedBy(), + PermissionEvaluationMode.EAGER, + returnedObject.getResultSetMetaData().getSearchParameters())); + return filteringResultSet; + } + } + + // record the start time + long startTimeMillis = System.currentTimeMillis(); + + // set the default, unlimited resultset type + filteringResultSet.setResultSetMetaData( + new SimpleResultSetMetaData( + returnedObject.getResultSetMetaData().getLimitedBy(), + PermissionEvaluationMode.EAGER, + returnedObject.getResultSetMetaData().getSearchParameters())); + + for (int i = 0; i < returnedObject.length(); i++) + { + long currentTimeMillis = System.currentTimeMillis(); + + // All permission checks must pass + inclusionMask.set(i, true); + + if (!nodeService.exists(returnedObject.getNodeRef(i))) + { + inclusionMask.set(i, false); + } + else + { + int parentCheckRead = checkRead(returnedObject.getChildAssocRef(i).getParentRef()); + int childCheckRead = checkRead(returnedObject.getNodeRef(i)); + + for (ConfigAttributeDefintion cad : supportedDefinitions) + { + NodeRef testNodeRef = returnedObject.getNodeRef(i); + int checkRead = childCheckRead; + if (cad.parent) + { + testNodeRef = returnedObject.getChildAssocRef(i).getParentRef(); + checkRead = parentCheckRead; + } + + if (isUnfiltered(testNodeRef)) + { + continue; + } + + if (inclusionMask.get(i) && (testNodeRef != null) && (checkRead != AccessDecisionVoter.ACCESS_GRANTED)) + { + inclusionMask.set(i, false); + } + } + } + + // Bug out if we are limiting by size + if ((maxSize != null) && (filteringResultSet.length() > maxSize.intValue())) + { + // Remove the last match to fix the correct size + inclusionMask.set(i, false); + filteringResultSet.setResultSetMetaData(new SimpleResultSetMetaData(LimitBy.FINAL_SIZE, PermissionEvaluationMode.EAGER, returnedObject.getResultSetMetaData() + .getSearchParameters())); + break; + } + } + + filteringResultSet.setNumberFound(returnedObject.getNumberFound()); + + return filteringResultSet; + } + + private QueryEngineResults decide(Authentication authentication, Object object, ConfigAttributeDefinition config, QueryEngineResults returnedObject) + { + Map, ResultSet> map = returnedObject.getResults(); + Map, ResultSet> answer = new HashMap, ResultSet>(map.size(), 1.0f); + + for (Map.Entry, ResultSet> entry : map.entrySet()) + { + ResultSet raw = entry.getValue(); + ResultSet permed; + if (PagingLuceneResultSet.class.isAssignableFrom(raw.getClass())) + { + permed = decide(authentication, object, config, (PagingLuceneResultSet) raw); + } + else + { + permed = decide(authentication, object, config, raw); + } + answer.put(entry.getKey(), permed); + } + + return new QueryEngineResults(answer); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private Collection decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Collection returnedObject) + { + if (returnedObject == null) + { + return null; + } + + List supportedDefinitions = extractSupportedDefinitions(config); + if (logger.isDebugEnabled()) + { + logger.debug("Entries are " + supportedDefinitions); + } + + if (supportedDefinitions.size() == 0) + { + return returnedObject; + } + + // Default to the system-wide values and we'll see if they need to be reduced + long targetResultCount = returnedObject.size(); + int maxPermissionChecks = Integer.MAX_VALUE; + long maxPermissionCheckTimeMillis = this.maxPermissionCheckTimeMillis; + if (returnedObject instanceof PermissionCheckCollection) + { + PermissionCheckCollection permissionCheckCollection = (PermissionCheckCollection) returnedObject; + // Get values + targetResultCount = permissionCheckCollection.getTargetResultCount(); + if (permissionCheckCollection.getCutOffAfterCount() > 0) + { + maxPermissionChecks = permissionCheckCollection.getCutOffAfterCount(); + } + if (permissionCheckCollection.getCutOffAfterTimeMs() > 0) + { + maxPermissionCheckTimeMillis = permissionCheckCollection.getCutOffAfterTimeMs(); + } + } + + // Start timer and counter for cut-off + boolean cutoff = false; + long startTimeMillis = System.currentTimeMillis(); + int count = 0; + + // Keep values explicitly + List keepValues = new ArrayList(returnedObject.size()); + + for (Object nextObject : returnedObject) + { + // if the maximum result size or time has been exceeded, then we have to remove only + long currentTimeMillis = System.currentTimeMillis(); + + // NOTE: for reference - the "maxPermissionChecks" has never been honoured by this loop (since previously the count was not being incremented) + if (count >= targetResultCount) + { + // We have enough results. We stop without cutoff. + break; + } + else if (count >= maxPermissionChecks) + { + // We have been cut off by count + cutoff = true; + if (logger.isDebugEnabled()) + { + logger.debug("decide (collection) cut-off: " + count + " checks exceeded " + maxPermissionChecks + " checks"); + } + break; + } + else if ((currentTimeMillis - startTimeMillis) > maxPermissionCheckTimeMillis) + { + // We have been cut off by time + cutoff = true; + if (logger.isDebugEnabled()) + { + logger.debug("decide (collection) cut-off: " + (currentTimeMillis - startTimeMillis) + "ms exceeded " + maxPermissionCheckTimeMillis + "ms"); + } + break; + } + + boolean allowed = true; + for (ConfigAttributeDefintion cad : supportedDefinitions) + { + if (cad.mode.equalsIgnoreCase("FilterNode")) + { + NodeRef testNodeRef = null; + if (cad.parent) + { + if (StoreRef.class.isAssignableFrom(nextObject.getClass())) + { + // Will be allowed + testNodeRef = null; + } + else if (NodeRef.class.isAssignableFrom(nextObject.getClass())) + { + testNodeRef = nodeService.getPrimaryParent((NodeRef) nextObject).getParentRef(); + } + else if (ChildAssociationRef.class.isAssignableFrom(nextObject.getClass())) + { + testNodeRef = ((ChildAssociationRef) nextObject).getParentRef(); + } + else if (AssociationRef.class.isAssignableFrom(nextObject.getClass())) + { + testNodeRef = ((AssociationRef) nextObject).getSourceRef(); + } + else if (PermissionCheckValue.class.isAssignableFrom(nextObject.getClass())) + { + NodeRef nodeRef = ((PermissionCheckValue) nextObject).getNodeRef(); + testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); + } + else + { + throw new ACLEntryVoterException("The specified parameter is recognized: " + nextObject.getClass()); + } + } + else + { + if (StoreRef.class.isAssignableFrom(nextObject.getClass())) + { + testNodeRef = nodeService.getRootNode((StoreRef) nextObject); + } + else if (NodeRef.class.isAssignableFrom(nextObject.getClass())) + { + testNodeRef = (NodeRef) nextObject; + } + else if (ChildAssociationRef.class.isAssignableFrom(nextObject.getClass())) + { + testNodeRef = ((ChildAssociationRef) nextObject).getChildRef(); + } + else if (AssociationRef.class.isAssignableFrom(nextObject.getClass())) + { + testNodeRef = ((AssociationRef) nextObject).getTargetRef(); + } + else if (PermissionCheckValue.class.isAssignableFrom(nextObject.getClass())) + { + testNodeRef = ((PermissionCheckValue) nextObject).getNodeRef(); + } + else + { + throw new ACLEntryVoterException("The specified parameter is recognized: " + nextObject.getClass()); + } + } + + if (logger.isDebugEnabled()) + { + logger.debug("\t" + cad.typeString + " test on " + testNodeRef + " from " + nextObject.getClass().getName()); + } + + // Null allows + if (isUnfiltered(testNodeRef)) + { + // Continue to next ConfigAttributeDefintion + continue; + } + + if (allowed && + testNodeRef != null && + checkRead(testNodeRef) != AccessDecisionVoter.ACCESS_GRANTED) + { + allowed = false; + // No point evaluating more ConfigAttributeDefintions + break; + } + } + } + + // Failure or success, increase the count + count++; + + if (allowed) + { + keepValues.add(nextObject); + } + } + // Work out how many were left unchecked (for whatever reason) + int sizeOriginal = returnedObject.size(); + int checksRemaining = sizeOriginal - count; + // Note: There are use-cases where unmodifiable collections are passing through. + // So make sure that the collection needs modification at all + if (keepValues.size() < sizeOriginal) + { + // There are values that need to be removed. We have to modify the collection. + try + { + returnedObject.clear(); + returnedObject.addAll(keepValues); + } + catch (UnsupportedOperationException e) + { + throw new AccessDeniedException("Permission-checked list must be modifiable", e); + } + } + + // Attach the extra permission-check data to the collection + return PermissionCheckedCollectionMixin.create(returnedObject, cutoff, checksRemaining, sizeOriginal); + } + + private Object[] decide(Authentication authentication, Object object, ConfigAttributeDefinition config, Object[] returnedObject) + { + // Assumption: value is not null + BitSet incudedSet = new BitSet(returnedObject.length); + + List supportedDefinitions = extractSupportedDefinitions(config); + + if (supportedDefinitions.size() == 0) + { + return returnedObject; + } + + for (int i = 0, l = returnedObject.length; i < l; i++) + { + Object current = returnedObject[i]; + + int parentReadCheck = checkRead(getParentReadCheckNode(current)); + int childReadChek = checkRead(getChildReadCheckNode(current)); + + for (ConfigAttributeDefintion cad : supportedDefinitions) + { + incudedSet.set(i, true); + NodeRef testNodeRef = null; + if (cad.parent) + { + if (StoreRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = null; + } + else if (NodeRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = nodeService.getPrimaryParent((NodeRef) current).getParentRef(); + } + else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = ((ChildAssociationRef) current).getParentRef(); + } + else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) + { + NodeRef nodeRef = ((PermissionCheckValue) current).getNodeRef(); + testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); + } + else + { + throw new ACLEntryVoterException("The specified parameter is recognized: " + current.getClass()); + } + } + else + { + if (StoreRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = nodeService.getRootNode((StoreRef) current); + } + else if (NodeRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = (NodeRef) current; + } + else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = ((ChildAssociationRef) current).getChildRef(); + } + else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) + { + testNodeRef = ((PermissionCheckValue) current).getNodeRef(); + } + else + { + throw new ACLEntryVoterException("The specified parameter is recognized: " + current.getClass()); + } + } + + if (logger.isDebugEnabled()) + { + logger.debug("\t" + cad.typeString + " test on " + testNodeRef + " from " + current.getClass().getName()); + } + + if (isUnfiltered(testNodeRef)) + { + continue; + } + + int readCheck = childReadChek; + if (cad.parent) + { + readCheck = parentReadCheck; + } + + if (incudedSet.get(i) && (testNodeRef != null) && (readCheck != AccessDecisionVoter.ACCESS_GRANTED)) + { + incudedSet.set(i, false); + } + + } + } + + if (incudedSet.cardinality() == returnedObject.length) + { + return returnedObject; + } + else + { + Object[] answer = new Object[incudedSet.cardinality()]; + for (int i = incudedSet.nextSetBit(0), p = 0; i >= 0; i = incudedSet.nextSetBit(++i), p++) + { + answer[p] = returnedObject[i]; + } + return answer; + } + } + + private NodeRef getParentReadCheckNode(Object current) + { + NodeRef testNodeRef = null; + if (StoreRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = null; + } + else if (NodeRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = nodeService.getPrimaryParent((NodeRef) current).getParentRef(); + } + else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = ((ChildAssociationRef) current).getParentRef(); + } + else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) + { + NodeRef nodeRef = ((PermissionCheckValue) current).getNodeRef(); + testNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); + } + else + { + throw new ACLEntryVoterException("The specified array is not of NodeRef or ChildAssociationRef"); + } + return testNodeRef; + } + + private NodeRef getChildReadCheckNode(Object current) + { + NodeRef testNodeRef = null; + if (StoreRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = nodeService.getRootNode((StoreRef) current); + } + else if (NodeRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = (NodeRef) current; + } + else if (ChildAssociationRef.class.isAssignableFrom(current.getClass())) + { + testNodeRef = ((ChildAssociationRef) current).getChildRef(); + } + else if (PermissionCheckValue.class.isAssignableFrom(current.getClass())) + { + testNodeRef = ((PermissionCheckValue) current).getNodeRef(); + } + else + { + throw new ACLEntryVoterException("The specified array is not of NodeRef or ChildAssociationRef"); + } + return testNodeRef; + } + + private class ConfigAttributeDefintion + { + + String typeString; + + String mode; + + boolean parent = false; + + ConfigAttributeDefintion(ConfigAttribute attr) + { + + StringTokenizer st = new StringTokenizer(attr.getAttribute(), ".", false); + typeString = st.nextToken(); + if (!(typeString.equals(AFTER_RM))) + { + throw new ACLEntryVoterException("Invalid type: must be AFTER_RM"); + } + mode = st.nextToken(); + + if (st.hasMoreElements()) + { + parent = true; + } + } + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java index d4ba417fc0..b351e0605e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java @@ -1,413 +1,413 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.policy.ConfigAttributeDefinition; -import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; -import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; -import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespacePrefixResolver; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.InitializingBean; - -import net.sf.acegisecurity.Authentication; -import net.sf.acegisecurity.ConfigAttribute; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Records managment entry voter. - * - * @author Roy Wetherall, Andy Hind - */ -public class RMEntryVoter extends RMSecurityCommon - implements AccessDecisionVoter, InitializingBean, PolicyRegister -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RMEntryVoter.class); - - /** Namespace resolver */ - private NamespacePrefixResolver nspr; - - /** Capability Service */ - private CapabilityService capabilityService; - - /** Transactional Resource Helper */ - private TransactionalResourceHelper transactionalResourceHelper; - - /** Alfresco transaction support */ - private AlfrescoTransactionSupport alfrescoTransactionSupport; - - /** authentication util */ - private AuthenticationUtil authenticationUtil; - - /** Policy map */ - private Map policies = new HashMap(); - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param nspr namespace prefix resolver - */ - public void setNamespacePrefixResolver(NamespacePrefixResolver nspr) - { - this.nspr = nspr; - } - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - /** - * @param alfrescoTransactionSupport alfresco transaction support helper - */ - public void setAlfrescoTransactionSupport(AlfrescoTransactionSupport alfrescoTransactionSupport) - { - this.alfrescoTransactionSupport = alfrescoTransactionSupport; - } - - /** - * @param authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * Register a policy the voter - * - * @param policy policy - */ - public void registerPolicy(Policy policy) - { - policies.put(policy.getName(), policy); - } - - /** - * @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(net.sf.acegisecurity.ConfigAttribute) - */ - @Override - public boolean supports(ConfigAttribute configAttribute) - { - boolean supports = false; - String attribute = configAttribute.getAttribute(); - if (StringUtils.isNotBlank(attribute) && - (attribute.equals(ConfigAttributeDefinition.RM_ABSTAIN) || - attribute.equals(ConfigAttributeDefinition.RM_QUERY) || - attribute.equals(ConfigAttributeDefinition.RM_ALLOW) || - attribute.equals(ConfigAttributeDefinition.RM_DENY) || - attribute.startsWith(ConfigAttributeDefinition.RM_CAP) || - attribute.startsWith(ConfigAttributeDefinition.RM))) - { - supports = true; - } - return supports; - } - - /** - * @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(java.lang.Class) - */ - @SuppressWarnings("rawtypes") - public boolean supports(Class clazz) - { - return (MethodInvocation.class.isAssignableFrom(clazz)); - } - - /** - * @see net.sf.acegisecurity.vote.AccessDecisionVoter#vote(net.sf.acegisecurity.Authentication, java.lang.Object, net.sf.acegisecurity.ConfigAttributeDefinition) - */ - @SuppressWarnings("rawtypes") - public int vote(Authentication authentication, Object object, net.sf.acegisecurity.ConfigAttributeDefinition config) - { - // logging - RMMethodSecurityInterceptor.isRMSecurityChecked(true); - - MethodInvocation mi = (MethodInvocation)object; - - if (transactionalResourceHelper.isResourcePresent("voting")) - { - if (logger.isDebugEnabled()) - { - logger.debug(" .. grant access already voting: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName()); - } - return AccessDecisionVoter.ACCESS_GRANTED; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Method: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName()); - } - - alfrescoTransactionSupport.bindResource("voting", true); - try - { - // The system user can do anything - if (authenticationUtil.isRunAsUserTheSystemUser()) - { - if (logger.isDebugEnabled()) - { - logger.debug("Access granted for the system user"); - } - return AccessDecisionVoter.ACCESS_GRANTED; - } - - List supportedDefinitions = extractSupportedDefinitions(config); - - // No RM definitions so we do not vote - if (supportedDefinitions.size() == 0) - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - - // check we have an instance of a method invocation - if (!(object instanceof MethodInvocation)) - { - // we expect a method invocation - throw new AlfrescoRuntimeException("Passed object is not an instance of MethodInvocation as expected."); - } - - // get information about the method - MethodInvocation invocation = (MethodInvocation) object; - Method method = invocation.getMethod(); - Class[] params = method.getParameterTypes(); - - // If there are only capability (RM_CAP) and policy (RM) entries non must deny - // If any abstain we deny - // All present must vote to allow unless an explicit direction comes first (e.g. RM_ALLOW) - - for (ConfigAttributeDefinition cad : supportedDefinitions) - { - // Whatever is found first takes precedence - if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_DENY)) - { - // log message - RMMethodSecurityInterceptor.addMessage("RM_DENY: check that a security policy has been set for this method"); - - return AccessDecisionVoter.ACCESS_DENIED; - } - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ABSTAIN)) - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ALLOW)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - // RM_QUERY is a special case - the entry is allowed and filtering sorts out the results - // It is distinguished from RM_ALLOW so query may have additional behaviour in the future - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_QUERY)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - // Ignore config that references method arguments that do not exist - // Arguably we should deny here but that requires a full impact analysis - // These entries effectively abstain - else if (((cad.getParameters().get(0) != null) && (cad.getParameters().get(0) >= invocation.getArguments().length)) || - ((cad.getParameters().get(1) != null) && (cad.getParameters().get(1) >= invocation.getArguments().length))) - { - continue; - } - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_CAP)) - { - switch(checkCapability(invocation, params, cad)) - { - case AccessDecisionVoter.ACCESS_DENIED: - { - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_ABSTAIN: - { - if(logger.isDebugEnabled()) - { - if(logger.isTraceEnabled()) - { - logger.trace("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod(), new IllegalStateException()); - } - else - { - logger.debug("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod()); - } - } - // abstain denies - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_GRANTED: - { - break; - } - } - } - else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM)) - { - switch(checkPolicy(invocation, params, cad)) - { - case AccessDecisionVoter.ACCESS_DENIED: - { - // log message - RMMethodSecurityInterceptor.addMessage("Policy " + cad.getPolicyName() + " denied."); - - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_ABSTAIN: - { - if(logger.isDebugEnabled()) - { - if(logger.isTraceEnabled()) - { - logger.trace("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod(), new IllegalStateException()); - } - else - { - logger.debug("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod()); - } - } - // abstain denies - return AccessDecisionVoter.ACCESS_DENIED; - } - case AccessDecisionVoter.ACCESS_GRANTED: - { - break; - } - } - } - } - } - finally - { - alfrescoTransactionSupport.unbindResource("voting"); - } - - // all voted to allow - return AccessDecisionVoter.ACCESS_GRANTED; - } - - /** - * Check the capability - * - * @param invocation method invocation - * @param params parameters - * @param cad config definition - * @return int evaluation result - */ - @SuppressWarnings("rawtypes") - private int checkCapability(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad) - { - NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - if (testNodeRef == null) - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - Capability capability = capabilityService.getCapability(cad.getRequired().getName()); - if (capability == null) - { - throw new AlfrescoRuntimeException("The capability '" + cad.getRequired().getName() + "' set on method '" + invocation.getMethod().getName() + "' does not exist."); - } - return capability.hasPermissionRaw(testNodeRef); - - } - - /** - * Evaluate policy to determine access - * - * @param invocation invocation information - * @param params parameters - * @param cad configuration attribute definition - * @return int policy evaluation - */ - @SuppressWarnings("rawtypes") - private int checkPolicy(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad) - { - // try to get the policy - Policy policy = policies.get(cad.getPolicyName()); - if (policy == null) - { - // throw an exception if the policy is invalid - throw new AlfrescoRuntimeException("The policy '" + cad.getPolicyName() + "' set on the method '" + invocation.getMethod().getName() + "' does not exist."); - } - else - { - // evaluate the policy - return policy.evaluate(invocation, params, cad); - } - } - - /** - * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() - */ - public void afterPropertiesSet() - { - } - - /** - * - * @param config - * @return - */ - @SuppressWarnings("rawtypes") - private List extractSupportedDefinitions(net.sf.acegisecurity.ConfigAttributeDefinition config) - { - List definitions = new ArrayList(2); - Iterator iter = config.getConfigAttributes(); - - while (iter.hasNext()) - { - ConfigAttribute attr = (ConfigAttribute) iter.next(); - - if (this.supports(attr)) - { - definitions.add(new ConfigAttributeDefinition(attr, nspr)); - } - - } - return definitions; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.capability.policy.ConfigAttributeDefinition; +import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; +import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; +import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespacePrefixResolver; +import org.aopalliance.intercept.MethodInvocation; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.InitializingBean; + +import net.sf.acegisecurity.Authentication; +import net.sf.acegisecurity.ConfigAttribute; +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Records managment entry voter. + * + * @author Roy Wetherall, Andy Hind + */ +public class RMEntryVoter extends RMSecurityCommon + implements AccessDecisionVoter, InitializingBean, PolicyRegister +{ + /** Logger */ + private static Log logger = LogFactory.getLog(RMEntryVoter.class); + + /** Namespace resolver */ + private NamespacePrefixResolver nspr; + + /** Capability Service */ + private CapabilityService capabilityService; + + /** Transactional Resource Helper */ + private TransactionalResourceHelper transactionalResourceHelper; + + /** Alfresco transaction support */ + private AlfrescoTransactionSupport alfrescoTransactionSupport; + + /** authentication util */ + private AuthenticationUtil authenticationUtil; + + /** Policy map */ + private Map policies = new HashMap(); + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param nspr namespace prefix resolver + */ + public void setNamespacePrefixResolver(NamespacePrefixResolver nspr) + { + this.nspr = nspr; + } + + /** + * @param transactionalResourceHelper transactional resource helper + */ + public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) + { + this.transactionalResourceHelper = transactionalResourceHelper; + } + + /** + * @param alfrescoTransactionSupport alfresco transaction support helper + */ + public void setAlfrescoTransactionSupport(AlfrescoTransactionSupport alfrescoTransactionSupport) + { + this.alfrescoTransactionSupport = alfrescoTransactionSupport; + } + + /** + * @param authenticationUtil authentication util + */ + public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) + { + this.authenticationUtil = authenticationUtil; + } + + /** + * Register a policy the voter + * + * @param policy policy + */ + public void registerPolicy(Policy policy) + { + policies.put(policy.getName(), policy); + } + + /** + * @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(net.sf.acegisecurity.ConfigAttribute) + */ + @Override + public boolean supports(ConfigAttribute configAttribute) + { + boolean supports = false; + String attribute = configAttribute.getAttribute(); + if (StringUtils.isNotBlank(attribute) && + (attribute.equals(ConfigAttributeDefinition.RM_ABSTAIN) || + attribute.equals(ConfigAttributeDefinition.RM_QUERY) || + attribute.equals(ConfigAttributeDefinition.RM_ALLOW) || + attribute.equals(ConfigAttributeDefinition.RM_DENY) || + attribute.startsWith(ConfigAttributeDefinition.RM_CAP) || + attribute.startsWith(ConfigAttributeDefinition.RM))) + { + supports = true; + } + return supports; + } + + /** + * @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(java.lang.Class) + */ + @SuppressWarnings("rawtypes") + public boolean supports(Class clazz) + { + return (MethodInvocation.class.isAssignableFrom(clazz)); + } + + /** + * @see net.sf.acegisecurity.vote.AccessDecisionVoter#vote(net.sf.acegisecurity.Authentication, java.lang.Object, net.sf.acegisecurity.ConfigAttributeDefinition) + */ + @SuppressWarnings("rawtypes") + public int vote(Authentication authentication, Object object, net.sf.acegisecurity.ConfigAttributeDefinition config) + { + // logging + RMMethodSecurityInterceptor.isRMSecurityChecked(true); + + MethodInvocation mi = (MethodInvocation)object; + + if (transactionalResourceHelper.isResourcePresent("voting")) + { + if (logger.isDebugEnabled()) + { + logger.debug(" .. grant access already voting: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName()); + } + return AccessDecisionVoter.ACCESS_GRANTED; + } + + if (logger.isDebugEnabled()) + { + logger.debug("Method: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName()); + } + + alfrescoTransactionSupport.bindResource("voting", true); + try + { + // The system user can do anything + if (authenticationUtil.isRunAsUserTheSystemUser()) + { + if (logger.isDebugEnabled()) + { + logger.debug("Access granted for the system user"); + } + return AccessDecisionVoter.ACCESS_GRANTED; + } + + List supportedDefinitions = extractSupportedDefinitions(config); + + // No RM definitions so we do not vote + if (supportedDefinitions.size() == 0) + { + return AccessDecisionVoter.ACCESS_ABSTAIN; + } + + // check we have an instance of a method invocation + if (!(object instanceof MethodInvocation)) + { + // we expect a method invocation + throw new AlfrescoRuntimeException("Passed object is not an instance of MethodInvocation as expected."); + } + + // get information about the method + MethodInvocation invocation = (MethodInvocation) object; + Method method = invocation.getMethod(); + Class[] params = method.getParameterTypes(); + + // If there are only capability (RM_CAP) and policy (RM) entries non must deny + // If any abstain we deny + // All present must vote to allow unless an explicit direction comes first (e.g. RM_ALLOW) + + for (ConfigAttributeDefinition cad : supportedDefinitions) + { + // Whatever is found first takes precedence + if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_DENY)) + { + // log message + RMMethodSecurityInterceptor.addMessage("RM_DENY: check that a security policy has been set for this method"); + + return AccessDecisionVoter.ACCESS_DENIED; + } + else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ABSTAIN)) + { + return AccessDecisionVoter.ACCESS_ABSTAIN; + } + else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ALLOW)) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + // RM_QUERY is a special case - the entry is allowed and filtering sorts out the results + // It is distinguished from RM_ALLOW so query may have additional behaviour in the future + else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_QUERY)) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + // Ignore config that references method arguments that do not exist + // Arguably we should deny here but that requires a full impact analysis + // These entries effectively abstain + else if (((cad.getParameters().get(0) != null) && (cad.getParameters().get(0) >= invocation.getArguments().length)) || + ((cad.getParameters().get(1) != null) && (cad.getParameters().get(1) >= invocation.getArguments().length))) + { + continue; + } + else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_CAP)) + { + switch(checkCapability(invocation, params, cad)) + { + case AccessDecisionVoter.ACCESS_DENIED: + { + return AccessDecisionVoter.ACCESS_DENIED; + } + case AccessDecisionVoter.ACCESS_ABSTAIN: + { + if(logger.isDebugEnabled()) + { + if(logger.isTraceEnabled()) + { + logger.trace("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod(), new IllegalStateException()); + } + else + { + logger.debug("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod()); + } + } + // abstain denies + return AccessDecisionVoter.ACCESS_DENIED; + } + case AccessDecisionVoter.ACCESS_GRANTED: + { + break; + } + } + } + else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM)) + { + switch(checkPolicy(invocation, params, cad)) + { + case AccessDecisionVoter.ACCESS_DENIED: + { + // log message + RMMethodSecurityInterceptor.addMessage("Policy " + cad.getPolicyName() + " denied."); + + return AccessDecisionVoter.ACCESS_DENIED; + } + case AccessDecisionVoter.ACCESS_ABSTAIN: + { + if(logger.isDebugEnabled()) + { + if(logger.isTraceEnabled()) + { + logger.trace("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod(), new IllegalStateException()); + } + else + { + logger.debug("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod()); + } + } + // abstain denies + return AccessDecisionVoter.ACCESS_DENIED; + } + case AccessDecisionVoter.ACCESS_GRANTED: + { + break; + } + } + } + } + } + finally + { + alfrescoTransactionSupport.unbindResource("voting"); + } + + // all voted to allow + return AccessDecisionVoter.ACCESS_GRANTED; + } + + /** + * Check the capability + * + * @param invocation method invocation + * @param params parameters + * @param cad config definition + * @return int evaluation result + */ + @SuppressWarnings("rawtypes") + private int checkCapability(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad) + { + NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + if (testNodeRef == null) + { + return AccessDecisionVoter.ACCESS_ABSTAIN; + } + Capability capability = capabilityService.getCapability(cad.getRequired().getName()); + if (capability == null) + { + throw new AlfrescoRuntimeException("The capability '" + cad.getRequired().getName() + "' set on method '" + invocation.getMethod().getName() + "' does not exist."); + } + return capability.hasPermissionRaw(testNodeRef); + + } + + /** + * Evaluate policy to determine access + * + * @param invocation invocation information + * @param params parameters + * @param cad configuration attribute definition + * @return int policy evaluation + */ + @SuppressWarnings("rawtypes") + private int checkPolicy(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad) + { + // try to get the policy + Policy policy = policies.get(cad.getPolicyName()); + if (policy == null) + { + // throw an exception if the policy is invalid + throw new AlfrescoRuntimeException("The policy '" + cad.getPolicyName() + "' set on the method '" + invocation.getMethod().getName() + "' does not exist."); + } + else + { + // evaluate the policy + return policy.evaluate(invocation, params, cad); + } + } + + /** + * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() + */ + public void afterPropertiesSet() + { + } + + /** + * + * @param config + * @return + */ + @SuppressWarnings("rawtypes") + private List extractSupportedDefinitions(net.sf.acegisecurity.ConfigAttributeDefinition config) + { + List definitions = new ArrayList(2); + Iterator iter = config.getConfigAttributes(); + + while (iter.hasNext()) + { + ConfigAttribute attr = (ConfigAttribute) iter.next(); + + if (this.supports(attr)) + { + definitions.add(new ConfigAttributeDefinition(attr, nspr)); + } + + } + return definitions; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java index 8cf3b0cccf..32d3bd6033 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java @@ -1,137 +1,137 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; - -/** - * Capability constants for the RM Permission Model - * - * @author andyh - */ -public interface RMPermissionModel -{ - // Assignment of Filing - String FILING = "Filing"; - String READ_RECORDS = "ReadRecords"; - String FILE_RECORDS = "FileRecords"; - - // Roles - /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_USER} instead - */ - @Deprecated - String ROLE_NAME_USER = FilePlanRoleService.ROLE_USER; - /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_POWER_USER} instead - */ - @Deprecated - String ROLE_NAME_POWER_USER = FilePlanRoleService.ROLE_POWER_USER; - /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_SECURITY_OFFICER} instead - */ - @Deprecated - String ROLE_NAME_SECURITY_OFFICER = FilePlanRoleService.ROLE_SECURITY_OFFICER; - /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_RECORDS_MANAGER} instead - */ - @Deprecated - String ROLE_NAME_RECORDS_MANAGER = FilePlanRoleService.ROLE_RECORDS_MANAGER; - /** - * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_ADMIN} instead - */ - @Deprecated - String ROLE_NAME_ADMINISTRATOR = FilePlanRoleService.ROLE_ADMIN; - String ROLE_ADMINISTRATOR = SimplePermissionReference.getPermissionReference(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT, FilePlanRoleService.ROLE_ADMIN).toString(); - - // Capability permissions - String DECLARE_RECORDS = "DeclareRecords"; - String VIEW_RECORDS = "ViewRecords"; - String CREATE_RECORDS = "CreateRecords"; - String CREATE_MODIFY_DESTROY_FOLDERS = "CreateModifyDestroyFolders"; - String EDIT_RECORD_METADATA = "EditRecordMetadata"; - String EDIT_NON_RECORD_METADATA = "EditNonRecordMetadata"; - String ADD_MODIFY_EVENT_DATES = "AddModifyEventDates"; - String CLOSE_FOLDERS = "CloseFolders"; - String DECLARE_RECORDS_IN_CLOSED_FOLDERS = "DeclareRecordsInClosedFolders"; - String RE_OPEN_FOLDERS = "ReOpenFolders"; - String CYCLE_VITAL_RECORDS = "CycleVitalRecords"; - String PLANNING_REVIEW_CYCLES = "PlanningReviewCycles"; - String UPDATE_TRIGGER_DATES = "UpdateTriggerDates"; - String CREATE_MODIFY_DESTROY_EVENTS = "CreateModifyDestroyEvents"; - String MANAGE_ACCESS_RIGHTS = "ManageAccessRights"; - String MOVE_RECORDS = "MoveRecords"; - String CHANGE_OR_DELETE_REFERENCES = "ChangeOrDeleteReferences"; - String DELETE_LINKS = "DeleteLinks"; - String EDIT_DECLARED_RECORD_METADATA = "EditDeclaredRecordMetadata"; - String MANUALLY_CHANGE_DISPOSITION_DATES = "ManuallyChangeDispositionDates"; - String APPROVE_RECORDS_SCHEDULED_FOR_CUTOFF = "ApproveRecordsScheduledForCutoff"; - String CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS = "CreateModifyRecordsInCutoffFolders"; - String EXTEND_RETENTION_PERIOD_OR_FREEZE = "ExtendRetentionPeriodOrFreeze"; - String UNFREEZE = "Unfreeze"; - String VIEW_UPDATE_REASONS_FOR_FREEZE = "ViewUpdateReasonsForFreeze"; - String DESTROY_RECORDS_SCHEDULED_FOR_DESTRUCTION = "DestroyRecordsScheduledForDestruction"; - String DESTROY_RECORDS = "DestroyRecords"; - String UPDATE_VITAL_RECORD_CYCLE_INFORMATION = "UpdateVitalRecordCycleInformation"; - String UNDECLARE_RECORDS = "UndeclareRecords"; - String DECLARE_AUDIT_AS_RECORD = "DeclareAuditAsRecord"; - String DELETE_AUDIT = "DeleteAudit"; - String CREATE_MODIFY_DESTROY_TIMEFRAMES = "CreateModifyDestroyTimeframes"; - String AUTHORIZE_NOMINATED_TRANSFERS = "AuthorizeNominatedTransfers"; - String EDIT_SELECTION_LISTS = "EditSelectionLists"; - String AUTHORIZE_ALL_TRANSFERS = "AuthorizeAllTransfers"; - String CREATE_MODIFY_DESTROY_FILEPLAN_METADATA = "CreateModifyDestroyFileplanMetadata"; - String CREATE_AND_ASSOCIATE_SELECTION_LISTS = "CreateAndAssociateSelectionLists"; - String ATTACH_RULES_TO_METADATA_PROPERTIES = "AttachRulesToMetadataProperties"; - String CREATE_MODIFY_DESTROY_FILEPLAN_TYPES = "CreateModifyDestroyFileplanTypes"; - String CREATE_MODIFY_DESTROY_RECORD_TYPES = "CreateModifyDestroyRecordTypes"; - String MAKE_OPTIONAL_PARAMETERS_MANDATORY = "MakeOptionalParametersMandatory"; - String MAP_EMAIL_METADATA = "MapEmailMetadata"; - String DELETE_RECORDS = "DeleteRecords"; - String TRIGGER_AN_EVENT = "TriggerAnEvent"; - String CREATE_MODIFY_DESTROY_ROLES = "CreateModifyDestroyRoles"; - String CREATE_MODIFY_DESTROY_USERS_AND_GROUPS = "CreateModifyDestroyUsersAndGroups"; - String PASSWORD_CONTROL = "PasswordControl"; - String ENABLE_DISABLE_AUDIT_BY_TYPES = "EnableDisableAuditByTypes"; - String SELECT_AUDIT_METADATA = "SelectAuditMetadata"; - String DISPLAY_RIGHTS_REPORT = "DisplayRightsReport"; - String ACCESS_AUDIT = "AccessAudit"; - String EXPORT_AUDIT = "ExportAudit"; - String CREATE_MODIFY_DESTROY_REFERENCE_TYPES = "CreateModifyDestroyReferenceTypes"; - String UPDATE_CLASSIFICATION_DATES = "UpdateClassificationDates"; - String CREATE_MODIFY_DESTROY_CLASSIFICATION_GUIDES = "CreateModifyDestroyClassificationGuides"; - String UPGRADE_DOWNGRADE_AND_DECLASSIFY_RECORDS = "UpgradeDowngradeAndDeclassifyRecords"; - String UPDATE_EXEMPTION_CATEGORIES = "UpdateExemptionCategories"; - String MAP_CLASSIFICATION_GUIDE_METADATA = "MapClassificationGuideMetadata"; - String MANAGE_ACCESS_CONTROLS = "ManageAccessControls"; - String CREATE_HOLD = "CreateHold"; - String ADD_TO_HOLD = "AddToHold"; - String REMOVE_FROM_HOLD = "RemoveFromHold"; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; + +/** + * Capability constants for the RM Permission Model + * + * @author andyh + */ +public interface RMPermissionModel +{ + // Assignment of Filing + String FILING = "Filing"; + String READ_RECORDS = "ReadRecords"; + String FILE_RECORDS = "FileRecords"; + + // Roles + /** + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_USER} instead + */ + @Deprecated + String ROLE_NAME_USER = FilePlanRoleService.ROLE_USER; + /** + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_POWER_USER} instead + */ + @Deprecated + String ROLE_NAME_POWER_USER = FilePlanRoleService.ROLE_POWER_USER; + /** + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_SECURITY_OFFICER} instead + */ + @Deprecated + String ROLE_NAME_SECURITY_OFFICER = FilePlanRoleService.ROLE_SECURITY_OFFICER; + /** + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_RECORDS_MANAGER} instead + */ + @Deprecated + String ROLE_NAME_RECORDS_MANAGER = FilePlanRoleService.ROLE_RECORDS_MANAGER; + /** + * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_ADMIN} instead + */ + @Deprecated + String ROLE_NAME_ADMINISTRATOR = FilePlanRoleService.ROLE_ADMIN; + String ROLE_ADMINISTRATOR = SimplePermissionReference.getPermissionReference(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT, FilePlanRoleService.ROLE_ADMIN).toString(); + + // Capability permissions + String DECLARE_RECORDS = "DeclareRecords"; + String VIEW_RECORDS = "ViewRecords"; + String CREATE_RECORDS = "CreateRecords"; + String CREATE_MODIFY_DESTROY_FOLDERS = "CreateModifyDestroyFolders"; + String EDIT_RECORD_METADATA = "EditRecordMetadata"; + String EDIT_NON_RECORD_METADATA = "EditNonRecordMetadata"; + String ADD_MODIFY_EVENT_DATES = "AddModifyEventDates"; + String CLOSE_FOLDERS = "CloseFolders"; + String DECLARE_RECORDS_IN_CLOSED_FOLDERS = "DeclareRecordsInClosedFolders"; + String RE_OPEN_FOLDERS = "ReOpenFolders"; + String CYCLE_VITAL_RECORDS = "CycleVitalRecords"; + String PLANNING_REVIEW_CYCLES = "PlanningReviewCycles"; + String UPDATE_TRIGGER_DATES = "UpdateTriggerDates"; + String CREATE_MODIFY_DESTROY_EVENTS = "CreateModifyDestroyEvents"; + String MANAGE_ACCESS_RIGHTS = "ManageAccessRights"; + String MOVE_RECORDS = "MoveRecords"; + String CHANGE_OR_DELETE_REFERENCES = "ChangeOrDeleteReferences"; + String DELETE_LINKS = "DeleteLinks"; + String EDIT_DECLARED_RECORD_METADATA = "EditDeclaredRecordMetadata"; + String MANUALLY_CHANGE_DISPOSITION_DATES = "ManuallyChangeDispositionDates"; + String APPROVE_RECORDS_SCHEDULED_FOR_CUTOFF = "ApproveRecordsScheduledForCutoff"; + String CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS = "CreateModifyRecordsInCutoffFolders"; + String EXTEND_RETENTION_PERIOD_OR_FREEZE = "ExtendRetentionPeriodOrFreeze"; + String UNFREEZE = "Unfreeze"; + String VIEW_UPDATE_REASONS_FOR_FREEZE = "ViewUpdateReasonsForFreeze"; + String DESTROY_RECORDS_SCHEDULED_FOR_DESTRUCTION = "DestroyRecordsScheduledForDestruction"; + String DESTROY_RECORDS = "DestroyRecords"; + String UPDATE_VITAL_RECORD_CYCLE_INFORMATION = "UpdateVitalRecordCycleInformation"; + String UNDECLARE_RECORDS = "UndeclareRecords"; + String DECLARE_AUDIT_AS_RECORD = "DeclareAuditAsRecord"; + String DELETE_AUDIT = "DeleteAudit"; + String CREATE_MODIFY_DESTROY_TIMEFRAMES = "CreateModifyDestroyTimeframes"; + String AUTHORIZE_NOMINATED_TRANSFERS = "AuthorizeNominatedTransfers"; + String EDIT_SELECTION_LISTS = "EditSelectionLists"; + String AUTHORIZE_ALL_TRANSFERS = "AuthorizeAllTransfers"; + String CREATE_MODIFY_DESTROY_FILEPLAN_METADATA = "CreateModifyDestroyFileplanMetadata"; + String CREATE_AND_ASSOCIATE_SELECTION_LISTS = "CreateAndAssociateSelectionLists"; + String ATTACH_RULES_TO_METADATA_PROPERTIES = "AttachRulesToMetadataProperties"; + String CREATE_MODIFY_DESTROY_FILEPLAN_TYPES = "CreateModifyDestroyFileplanTypes"; + String CREATE_MODIFY_DESTROY_RECORD_TYPES = "CreateModifyDestroyRecordTypes"; + String MAKE_OPTIONAL_PARAMETERS_MANDATORY = "MakeOptionalParametersMandatory"; + String MAP_EMAIL_METADATA = "MapEmailMetadata"; + String DELETE_RECORDS = "DeleteRecords"; + String TRIGGER_AN_EVENT = "TriggerAnEvent"; + String CREATE_MODIFY_DESTROY_ROLES = "CreateModifyDestroyRoles"; + String CREATE_MODIFY_DESTROY_USERS_AND_GROUPS = "CreateModifyDestroyUsersAndGroups"; + String PASSWORD_CONTROL = "PasswordControl"; + String ENABLE_DISABLE_AUDIT_BY_TYPES = "EnableDisableAuditByTypes"; + String SELECT_AUDIT_METADATA = "SelectAuditMetadata"; + String DISPLAY_RIGHTS_REPORT = "DisplayRightsReport"; + String ACCESS_AUDIT = "AccessAudit"; + String EXPORT_AUDIT = "ExportAudit"; + String CREATE_MODIFY_DESTROY_REFERENCE_TYPES = "CreateModifyDestroyReferenceTypes"; + String UPDATE_CLASSIFICATION_DATES = "UpdateClassificationDates"; + String CREATE_MODIFY_DESTROY_CLASSIFICATION_GUIDES = "CreateModifyDestroyClassificationGuides"; + String UPGRADE_DOWNGRADE_AND_DECLASSIFY_RECORDS = "UpgradeDowngradeAndDeclassifyRecords"; + String UPDATE_EXEMPTION_CATEGORIES = "UpdateExemptionCategories"; + String MAP_CLASSIFICATION_GUIDE_METADATA = "MapClassificationGuideMetadata"; + String MANAGE_ACCESS_CONTROLS = "ManageAccessControls"; + String CREATE_HOLD = "CreateHold"; + String ADD_TO_HOLD = "AddToHold"; + String REMOVE_FROM_HOLD = "RemoveFromHold"; +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java index fc5593c6fa..8bfc3f6483 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java @@ -1,406 +1,406 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponent; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.AlfrescoTransactionSupport; -import org.alfresco.repo.transaction.TransactionalResourceHelper; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.Pair; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - - -/** - * Common security functions. - * - * TODO move methods to the appropriate services - * - * @author Roy Wetherall - * @since 2.0 - */ -public class RMSecurityCommon implements ApplicationContextAware -{ - /** No set value */ - protected static final int NOSET_VALUE = -100; - - /** Logger */ - private static Log logger = LogFactory.getLog(RMSecurityCommon.class); - - /** Services */ - //This is the internal NodeService -- no permission checks - protected NodeService nodeService; - protected PermissionService permissionService; - protected RMCaveatConfigComponent caveatConfigComponent; - private FilePlanService filePlanService; - - /** Application context */ - protected ApplicationContext applicationContext; - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param caveatConfigComponent caveat config service - */ - public void setCaveatConfigComponent(RMCaveatConfigComponent caveatConfigComponent) - { - this.caveatConfigComponent = caveatConfigComponent; - } - - /** - * @return FilePlanService file plan service - */ - protected FilePlanService getFilePlanService() - { - if (filePlanService == null) - { - filePlanService = (FilePlanService)applicationContext.getBean("filePlanService"); - } - return filePlanService; - } - - /** - * Sets a value into the transaction cache - * - * @param prefix - * @param nodeRef - * @param value - * @return - */ - protected int setTransactionCache(String prefix, NodeRef nodeRef, int value) - { - String user = AuthenticationUtil.getRunAsUser(); - AlfrescoTransactionSupport.bindResource(prefix + nodeRef.toString() + user, Integer.valueOf(value)); - return value; - } - - /** - * Gets a value from the transaction cache - * - * @param prefix - * @param nodeRef - * @return - */ - protected int getTransactionCache(String prefix, NodeRef nodeRef) - { - int result = NOSET_VALUE; - String user = AuthenticationUtil.getRunAsUser(); - Integer value = (Integer)AlfrescoTransactionSupport.getResource(prefix + nodeRef.toString() + user); - if (value != null) - { - result = value.intValue(); - } - return result; - } - - /** - * Check for RM read - * - * @param nodeRef - * @return - */ - public int checkRead(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - if (nodeRef != null) - { - // now we know the node - we can abstain for certain types and aspects (eg, rm) - result = checkRead(nodeRef, false); - } - - return result; - } - - /** - * Check for RM read - * - * @param nodeRef - * @param allowDMRead - * @return - */ - public int checkRead(NodeRef nodeRef, boolean allowDMRead) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - - if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - result = checkRmRead(nodeRef); - } - else if (allowDMRead) - { - // Check DM read for copy etc - // DM does not grant - it can only deny - if (permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.DENIED) - { - if (logger.isDebugEnabled()) - { - logger.debug("\t\tPermission is denied"); - Thread.dumpStack(); - } - result = AccessDecisionVoter.ACCESS_DENIED; - } - else - { - result = AccessDecisionVoter.ACCESS_GRANTED; - } - } - - return result; - } - - /** - * Core RM read check - * - * @param nodeRef node reference - * @return int see {@link AccessDecisionVoter} - */ - public int checkRmRead(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - - Map, Integer> transactionCache = TransactionalResourceHelper.getMap("rm.security.checkRMRead"); - Pair key = new Pair(AuthenticationUtil.getRunAsUser(), nodeRef); - - if (transactionCache.containsKey(key)) - { - result = transactionCache.get(key); - } - else - { - if (permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS) == AccessStatus.DENIED) - { - if (logger.isDebugEnabled()) - { - logger.debug("\t\tUser does not have read record permission on node, access denied. (nodeRef=" + nodeRef.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")"); - } - result = AccessDecisionVoter.ACCESS_DENIED; - } - else - { - // Get the file plan for the node - NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); - if (filePlan != null && - hasViewCapability(filePlan) == AccessStatus.DENIED) - { - if (logger.isDebugEnabled()) - { - logger.debug("\t\tUser does not have view records capability permission on node, access denied. (filePlan=" + filePlan.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")"); - } - result = AccessDecisionVoter.ACCESS_DENIED; - } - else if (!caveatConfigComponent.hasAccess(nodeRef)) - { - result = AccessDecisionVoter.ACCESS_DENIED; - } - else - { - result = AccessDecisionVoter.ACCESS_GRANTED; - } - } - - // cache result - transactionCache.put(key, result); - } - - return result; - } - - /** - * Helper method to determine whether the current user has view capability on the file plan - * - * @param filePlan file plan - * @return {@link AccessStatus} - */ - private AccessStatus hasViewCapability(NodeRef filePlan) - { - Map, AccessStatus> transactionCache = TransactionalResourceHelper.getMap("rm.security.hasViewCapability"); - Pair key = new Pair(AuthenticationUtil.getRunAsUser(), filePlan); - - if (transactionCache.containsKey(key)) - { - return transactionCache.get(key); - } - else - { - AccessStatus result = permissionService.hasPermission(filePlan, ViewRecordsCapability.NAME); - transactionCache.put(key, result); - return result; - } - } - - @SuppressWarnings("rawtypes") - protected NodeRef getTestNode(MethodInvocation invocation, Class[] params, int position, boolean parent) - { - NodeRef testNodeRef = null; - if (position < 0) - { - if (logger.isDebugEnabled()) - { - logger.debug("\tNothing to test permission against."); - } - testNodeRef = null; - } - else if (StoreRef.class.isAssignableFrom(params[position])) - { - if (invocation.getArguments()[position] != null) - { - if (logger.isDebugEnabled()) - { - logger.debug("\tPermission test against the store - using permissions on the root node"); - } - StoreRef storeRef = (StoreRef) invocation.getArguments()[position]; - if (nodeService.exists(storeRef)) - { - testNodeRef = nodeService.getRootNode(storeRef); - } - } - } - else if (NodeRef.class.isAssignableFrom(params[position])) - { - testNodeRef = (NodeRef) invocation.getArguments()[position]; - if (parent) - { - testNodeRef = nodeService.getPrimaryParent(testNodeRef).getParentRef(); - if (logger.isDebugEnabled()) - { - if (nodeService.exists(testNodeRef)) - { - logger.debug("\tPermission test for parent on node " + nodeService.getPath(testNodeRef)); - } - else - { - logger.debug("\tPermission test for parent on non-existing node " + testNodeRef); - } - logger.debug("\tPermission test for parent on node " + nodeService.getPath(testNodeRef)); - } - } - else - { - if (logger.isDebugEnabled()) - { - if (nodeService.exists(testNodeRef)) - { - logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); - } - else - { - logger.debug("\tPermission test on non-existing node " + testNodeRef); - } - } - } - } - else if (ChildAssociationRef.class.isAssignableFrom(params[position])) - { - if (invocation.getArguments()[position] != null) - { - if (parent) - { - testNodeRef = ((ChildAssociationRef) invocation.getArguments()[position]).getParentRef(); - } - else - { - testNodeRef = ((ChildAssociationRef) invocation.getArguments()[position]).getChildRef(); - } - if (logger.isDebugEnabled()) - { - if (nodeService.exists(testNodeRef)) - { - logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); - } - else - { - logger.debug("\tPermission test on non-existing node " + testNodeRef); - } - } - } - } - else if (AssociationRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - if (parent) - { - testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getSourceRef(); - } - else - { - testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getTargetRef(); - } - if (logger.isDebugEnabled()) - { - if (nodeService.exists(testNodeRef)) - { - logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); - } - else - { - logger.debug("\tPermission test on non-existing node " + testNodeRef); - } - } - } - return testNodeRef; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponent; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.AlfrescoTransactionSupport; +import org.alfresco.repo.transaction.TransactionalResourceHelper; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.util.Pair; +import org.aopalliance.intercept.MethodInvocation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + + +/** + * Common security functions. + * + * TODO move methods to the appropriate services + * + * @author Roy Wetherall + * @since 2.0 + */ +public class RMSecurityCommon implements ApplicationContextAware +{ + /** No set value */ + protected static final int NOSET_VALUE = -100; + + /** Logger */ + private static Log logger = LogFactory.getLog(RMSecurityCommon.class); + + /** Services */ + //This is the internal NodeService -- no permission checks + protected NodeService nodeService; + protected PermissionService permissionService; + protected RMCaveatConfigComponent caveatConfigComponent; + private FilePlanService filePlanService; + + /** Application context */ + protected ApplicationContext applicationContext; + + /** + * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) + { + this.applicationContext = applicationContext; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param caveatConfigComponent caveat config service + */ + public void setCaveatConfigComponent(RMCaveatConfigComponent caveatConfigComponent) + { + this.caveatConfigComponent = caveatConfigComponent; + } + + /** + * @return FilePlanService file plan service + */ + protected FilePlanService getFilePlanService() + { + if (filePlanService == null) + { + filePlanService = (FilePlanService)applicationContext.getBean("filePlanService"); + } + return filePlanService; + } + + /** + * Sets a value into the transaction cache + * + * @param prefix + * @param nodeRef + * @param value + * @return + */ + protected int setTransactionCache(String prefix, NodeRef nodeRef, int value) + { + String user = AuthenticationUtil.getRunAsUser(); + AlfrescoTransactionSupport.bindResource(prefix + nodeRef.toString() + user, Integer.valueOf(value)); + return value; + } + + /** + * Gets a value from the transaction cache + * + * @param prefix + * @param nodeRef + * @return + */ + protected int getTransactionCache(String prefix, NodeRef nodeRef) + { + int result = NOSET_VALUE; + String user = AuthenticationUtil.getRunAsUser(); + Integer value = (Integer)AlfrescoTransactionSupport.getResource(prefix + nodeRef.toString() + user); + if (value != null) + { + result = value.intValue(); + } + return result; + } + + /** + * Check for RM read + * + * @param nodeRef + * @return + */ + public int checkRead(NodeRef nodeRef) + { + int result = AccessDecisionVoter.ACCESS_ABSTAIN; + if (nodeRef != null) + { + // now we know the node - we can abstain for certain types and aspects (eg, rm) + result = checkRead(nodeRef, false); + } + + return result; + } + + /** + * Check for RM read + * + * @param nodeRef + * @param allowDMRead + * @return + */ + public int checkRead(NodeRef nodeRef, boolean allowDMRead) + { + int result = AccessDecisionVoter.ACCESS_ABSTAIN; + + if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) + { + result = checkRmRead(nodeRef); + } + else if (allowDMRead) + { + // Check DM read for copy etc + // DM does not grant - it can only deny + if (permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.DENIED) + { + if (logger.isDebugEnabled()) + { + logger.debug("\t\tPermission is denied"); + Thread.dumpStack(); + } + result = AccessDecisionVoter.ACCESS_DENIED; + } + else + { + result = AccessDecisionVoter.ACCESS_GRANTED; + } + } + + return result; + } + + /** + * Core RM read check + * + * @param nodeRef node reference + * @return int see {@link AccessDecisionVoter} + */ + public int checkRmRead(NodeRef nodeRef) + { + int result = AccessDecisionVoter.ACCESS_ABSTAIN; + + Map, Integer> transactionCache = TransactionalResourceHelper.getMap("rm.security.checkRMRead"); + Pair key = new Pair(AuthenticationUtil.getRunAsUser(), nodeRef); + + if (transactionCache.containsKey(key)) + { + result = transactionCache.get(key); + } + else + { + if (permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS) == AccessStatus.DENIED) + { + if (logger.isDebugEnabled()) + { + logger.debug("\t\tUser does not have read record permission on node, access denied. (nodeRef=" + nodeRef.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")"); + } + result = AccessDecisionVoter.ACCESS_DENIED; + } + else + { + // Get the file plan for the node + NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); + if (filePlan != null && + hasViewCapability(filePlan) == AccessStatus.DENIED) + { + if (logger.isDebugEnabled()) + { + logger.debug("\t\tUser does not have view records capability permission on node, access denied. (filePlan=" + filePlan.toString() + ", user=" + AuthenticationUtil.getRunAsUser() + ")"); + } + result = AccessDecisionVoter.ACCESS_DENIED; + } + else if (!caveatConfigComponent.hasAccess(nodeRef)) + { + result = AccessDecisionVoter.ACCESS_DENIED; + } + else + { + result = AccessDecisionVoter.ACCESS_GRANTED; + } + } + + // cache result + transactionCache.put(key, result); + } + + return result; + } + + /** + * Helper method to determine whether the current user has view capability on the file plan + * + * @param filePlan file plan + * @return {@link AccessStatus} + */ + private AccessStatus hasViewCapability(NodeRef filePlan) + { + Map, AccessStatus> transactionCache = TransactionalResourceHelper.getMap("rm.security.hasViewCapability"); + Pair key = new Pair(AuthenticationUtil.getRunAsUser(), filePlan); + + if (transactionCache.containsKey(key)) + { + return transactionCache.get(key); + } + else + { + AccessStatus result = permissionService.hasPermission(filePlan, ViewRecordsCapability.NAME); + transactionCache.put(key, result); + return result; + } + } + + @SuppressWarnings("rawtypes") + protected NodeRef getTestNode(MethodInvocation invocation, Class[] params, int position, boolean parent) + { + NodeRef testNodeRef = null; + if (position < 0) + { + if (logger.isDebugEnabled()) + { + logger.debug("\tNothing to test permission against."); + } + testNodeRef = null; + } + else if (StoreRef.class.isAssignableFrom(params[position])) + { + if (invocation.getArguments()[position] != null) + { + if (logger.isDebugEnabled()) + { + logger.debug("\tPermission test against the store - using permissions on the root node"); + } + StoreRef storeRef = (StoreRef) invocation.getArguments()[position]; + if (nodeService.exists(storeRef)) + { + testNodeRef = nodeService.getRootNode(storeRef); + } + } + } + else if (NodeRef.class.isAssignableFrom(params[position])) + { + testNodeRef = (NodeRef) invocation.getArguments()[position]; + if (parent) + { + testNodeRef = nodeService.getPrimaryParent(testNodeRef).getParentRef(); + if (logger.isDebugEnabled()) + { + if (nodeService.exists(testNodeRef)) + { + logger.debug("\tPermission test for parent on node " + nodeService.getPath(testNodeRef)); + } + else + { + logger.debug("\tPermission test for parent on non-existing node " + testNodeRef); + } + logger.debug("\tPermission test for parent on node " + nodeService.getPath(testNodeRef)); + } + } + else + { + if (logger.isDebugEnabled()) + { + if (nodeService.exists(testNodeRef)) + { + logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); + } + else + { + logger.debug("\tPermission test on non-existing node " + testNodeRef); + } + } + } + } + else if (ChildAssociationRef.class.isAssignableFrom(params[position])) + { + if (invocation.getArguments()[position] != null) + { + if (parent) + { + testNodeRef = ((ChildAssociationRef) invocation.getArguments()[position]).getParentRef(); + } + else + { + testNodeRef = ((ChildAssociationRef) invocation.getArguments()[position]).getChildRef(); + } + if (logger.isDebugEnabled()) + { + if (nodeService.exists(testNodeRef)) + { + logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); + } + else + { + logger.debug("\tPermission test on non-existing node " + testNodeRef); + } + } + } + } + else if (AssociationRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) + { + if (parent) + { + testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getSourceRef(); + } + else + { + testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getTargetRef(); + } + if (logger.isDebugEnabled()) + { + if (nodeService.exists(testNodeRef)) + { + logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef)); + } + else + { + logger.debug("\tPermission test on non-existing node " + testNodeRef); + } + } + } + return testNodeRef; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java index 4a46c795ca..2eaad9646f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java @@ -1,179 +1,179 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.PermissionService; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Abstract capability condition. - * - * @author Roy Wetherall - */ -public abstract class AbstractCapabilityCondition implements CapabilityCondition, - BeanNameAware, - RecordsManagementModel -{ - /** transaction cache key */ - private static final String KEY_EVALUATE = "rm.transaction.evaluate"; - - /** Capability condition name */ - protected String name; - - /** Services */ - protected RecordService recordService; - protected PermissionService permissionService; - protected NodeService nodeService; - protected FreezeService freezeService; - protected FilePlanService filePlanService; - protected DispositionService dispositionService; - protected RecordFolderService recordFolderService; - - /** transaction resource helper */ - private TransactionalResourceHelper transactionalResourceHelper; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#getName() - */ - @Override - public String getName() - { - return name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluate(NodeRef nodeRef) - { - boolean result = false; - - // check transaction cache - Map map = transactionalResourceHelper.getMap(KEY_EVALUATE); - String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser(); - if (map.containsKey(key)) - { - result = map.get(key); - } - else - { - result = evaluateImpl(nodeRef); - map.put(key, result); - } - - return result; - } - - public abstract boolean evaluateImpl(NodeRef nodeRef); - - /** - * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) - */ - @Override - public void setBeanName(String name) - { - this.name = name; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative; + +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.PermissionService; +import org.springframework.beans.factory.BeanNameAware; + +/** + * Abstract capability condition. + * + * @author Roy Wetherall + */ +public abstract class AbstractCapabilityCondition implements CapabilityCondition, + BeanNameAware, + RecordsManagementModel +{ + /** transaction cache key */ + private static final String KEY_EVALUATE = "rm.transaction.evaluate"; + + /** Capability condition name */ + protected String name; + + /** Services */ + protected RecordService recordService; + protected PermissionService permissionService; + protected NodeService nodeService; + protected FreezeService freezeService; + protected FilePlanService filePlanService; + protected DispositionService dispositionService; + protected RecordFolderService recordFolderService; + + /** transaction resource helper */ + private TransactionalResourceHelper transactionalResourceHelper; + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param freezeService freeze service + */ + public void setFreezeService(FreezeService freezeService) + { + this.freezeService = freezeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param transactionalResourceHelper transactional resource helper + */ + public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) + { + this.transactionalResourceHelper = transactionalResourceHelper; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#getName() + */ + @Override + public String getName() + { + return name; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluate(NodeRef nodeRef) + { + boolean result = false; + + // check transaction cache + Map map = transactionalResourceHelper.getMap(KEY_EVALUATE); + String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser(); + if (map.containsKey(key)) + { + result = map.get(key); + } + else + { + result = evaluateImpl(nodeRef); + map.put(key, result); + } + + return result; + } + + public abstract boolean evaluateImpl(NodeRef nodeRef); + + /** + * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) + */ + @Override + public void setBeanName(String name) + { + this.name = name; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/CapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/CapabilityCondition.java index c08431879a..e5c27e0360 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/CapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/CapabilityCondition.java @@ -1,54 +1,54 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Capability condition. - * - * @author Roy Wetherall - * @since 2.0 - */ -public interface CapabilityCondition -{ - /** - * Get capability condition name - * - * @return {@link String} capability condition name - */ - String getName(); - - /** - * Evaluates capability condition. - * - * @param nodeRef node reference - * @return boolean true if evaluate success, false otherwise - */ - boolean evaluate(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Capability condition. + * + * @author Roy Wetherall + * @since 2.0 + */ +public interface CapabilityCondition +{ + /** + * Get capability condition name + * + * @return {@link String} capability condition name + */ + String getName(); + + /** + * Evaluates capability condition. + * + * @param nodeRef node reference + * @return boolean true if evaluate success, false otherwise + */ + boolean evaluate(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java index df09f18bb1..35be14562e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java @@ -1,388 +1,388 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.TransactionalResourceHelper; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Declarative capability implementation. - * - * @author Roy Wetherall - */ -public class DeclarativeCapability extends AbstractCapability -{ - /** Logger */ - protected static final Log LOGGER = LogFactory.getLog(DeclarativeCapability.class); - - /** Required permissions */ - protected List permissions; - - /** Map of conditions and expected evaluation result */ - protected Map conditions; - - /** List of file plan component kinds one of which must be satisfied */ - protected List kinds; - - /** Capability to be evaluated against the target node reference */ - protected Capability targetCapability; - - /** Indicates whether to return an undetermined result */ - protected boolean isUndetermined = false; - - /** - * @param permissions permissions - */ - public void setPermissions(List permissions) - { - this.permissions = permissions; - } - - /** - * @param conditions conditions and expected values - */ - public void setConditions(Map conditions) - { - this.conditions = conditions; - } - - /** - * @return {@link Map} conditions and expected values - */ - public Map getConditions() - { - return conditions; - } - - /** - * @param kinds list of file plan component kinds - */ - public void setKinds(List kinds) - { - this.kinds = kinds; - } - - /** - * @return {@link List}<@link String> list of expected file plan component kinds - */ - public List getKinds() - { - return kinds; - } - - /** - * Helper method to set a single kind. - * - * @param kind file plan component kind - */ - public void setKind(String kind) - { - this.kinds = Collections.singletonList(kind); - } - - /** - * Sets whether the capability will return an undetermined result when evaluating permissions - * for a single node reference or not. The default is to return grant. - * - * @param isUndetermined true if undetermined result, false otherwise - */ - public void setUndetermined(boolean isUndetermined) - { - this.isUndetermined = isUndetermined; - } - - /** - * @return - */ - public boolean isUndetermined() - { - return isUndetermined; - } - - /** - * Helper @see #setPermissions(List) - * - * @param permission permission - */ - public void setPermission(String permission) - { - List permissions = new ArrayList(1); - permissions.add(permission); - this.permissions = permissions; - } - - /** - * @param targetCapability target capability - */ - public void setTargetCapability(Capability targetCapability) - { - this.targetCapability = targetCapability; - } - - /** - * Check the permissions passed. - * - * @param nodeRef node reference - * @return boolean true if the permissions are present, false otherwise - */ - protected boolean checkPermissionsImpl(NodeRef nodeRef, String ... permissions) - { - boolean result = true; - NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); - - if(filePlan == null) - { - return result; - } - - for (String permission : permissions) - { - if (permissionService.hasPermission(filePlan, permission) != AccessStatus.ALLOWED) - { - result = false; - break; - } - } - - return result; - } - - /** - * Checks the permissions required for the capability. - * - * @param nodeRef - * @return - */ - protected boolean checkPermissions(NodeRef nodeRef) - { - boolean result = true; - if (permissions != null && !permissions.isEmpty()) - { - result = checkPermissionsImpl(nodeRef, (String[])permissions.toArray(new String[permissions.size()])); - } - return result; - } - - /** - * Checks the passed conditions. - * - * @param nodeRef - * @return - */ - protected boolean checkConditions(NodeRef nodeRef, Map conditions) - { - boolean result = true; - if (conditions != null) - { - for (Map.Entry entry : conditions.entrySet()) - { - boolean expected = entry.getValue().booleanValue(); - String conditionName = entry.getKey(); - - CapabilityCondition condition = (CapabilityCondition)applicationContext.getBean(conditionName); - if (condition == null) - { - throw new AlfrescoRuntimeException("Capability condition " + conditionName + " does not exist. Check the configuration of the capability " + name + "."); - } - - // determine the actual value - boolean actual = condition.evaluate(nodeRef); - - // report information about condition (for exception reporting) - RMMethodSecurityInterceptor.reportCapabilityCondition(getName(), condition.getName(), expected, actual); - - if (expected != actual) - { - result = false; - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("FAIL: Condition " + condition.getName() + " failed for capability " + getName() + " on nodeRef " + nodeRef.toString()); - } - - break; - } - } - } - return result; - } - - /** - * Checks the set conditions. - * - * @param nodeRef node reference - * @return boolean true if conditions satisfied, false otherwise - */ - protected boolean checkConditions(NodeRef nodeRef) - { - return checkConditions(nodeRef, conditions); - } - - /** - * Checks that the node ref is of the expected kind - * - * @param nodeRef - * @return - */ - protected boolean checkKinds(NodeRef nodeRef) - { - boolean result = false; - - FilePlanComponentKind actualKind = getFilePlanService().getFilePlanComponentKind(nodeRef); - - if (actualKind != null) - { - if (kinds != null && !kinds.isEmpty()) - { - // need to check the actual file plan kind is in the list specified - for (String kindString : kinds) - { - FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString); - if (actualKind.equals(kind)) - { - result = true; - break; - } - } - } - else - { - // we don't have any specific kinds to check, so we pass since we have a file - // plan component in our hands - result = true; - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluate(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - - // check transaction cache - Map map = TransactionalResourceHelper.getMap("rm.declarativeCapability"); - String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser(); - if (map.containsKey(key)) - { - result = map.get(key); - } - else - { - // Check we are dealing with a file plan component - if (getFilePlanService().isFilePlanComponent(nodeRef)) - { - // Check the kind of the object, the permissions and the conditions - if (checkKinds(nodeRef) && checkPermissions(nodeRef) && checkConditions(nodeRef)) - { - // Opportunity for child implementations to extend - result = evaluateImpl(nodeRef); - } - else - { - result = AccessDecisionVoter.ACCESS_DENIED; - } - } - - // Last chance for child implementations to veto/change the result - result = onEvaluate(nodeRef, result); - - // log access denied to help with debug - if (LOGGER.isDebugEnabled() && AccessDecisionVoter.ACCESS_DENIED == result) - { - LOGGER.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString()); - } - - map.put(key, result); - } - - return result; - } - - @Override - public int evaluate(NodeRef source, NodeRef target) - { - int result = evaluate(source); - if (targetCapability != null && result != AccessDecisionVoter.ACCESS_DENIED) - { - result = targetCapability.evaluate(target); - } - return result; - } - - /** - * Default implementation. Given extending classes a hook point for further checks. - * - * @param nodeRef node reference - * @return - */ - protected int evaluateImpl(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_GRANTED; - if (isUndetermined) - { - result = AccessDecisionVoter.ACCESS_ABSTAIN; - } - return result; - } - - /** - * Default implementation. - * - * Called before evaluate completes. The result returned overwrites the already discovered result. - * Provides a hook point for child implementations that wish to veto the result. - * - * @param nodeRef - * @param result - * @return - */ - protected int onEvaluate(NodeRef nodeRef, int result) - { - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.TransactionalResourceHelper; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Declarative capability implementation. + * + * @author Roy Wetherall + */ +public class DeclarativeCapability extends AbstractCapability +{ + /** Logger */ + protected static final Log LOGGER = LogFactory.getLog(DeclarativeCapability.class); + + /** Required permissions */ + protected List permissions; + + /** Map of conditions and expected evaluation result */ + protected Map conditions; + + /** List of file plan component kinds one of which must be satisfied */ + protected List kinds; + + /** Capability to be evaluated against the target node reference */ + protected Capability targetCapability; + + /** Indicates whether to return an undetermined result */ + protected boolean isUndetermined = false; + + /** + * @param permissions permissions + */ + public void setPermissions(List permissions) + { + this.permissions = permissions; + } + + /** + * @param conditions conditions and expected values + */ + public void setConditions(Map conditions) + { + this.conditions = conditions; + } + + /** + * @return {@link Map} conditions and expected values + */ + public Map getConditions() + { + return conditions; + } + + /** + * @param kinds list of file plan component kinds + */ + public void setKinds(List kinds) + { + this.kinds = kinds; + } + + /** + * @return {@link List}<@link String> list of expected file plan component kinds + */ + public List getKinds() + { + return kinds; + } + + /** + * Helper method to set a single kind. + * + * @param kind file plan component kind + */ + public void setKind(String kind) + { + this.kinds = Collections.singletonList(kind); + } + + /** + * Sets whether the capability will return an undetermined result when evaluating permissions + * for a single node reference or not. The default is to return grant. + * + * @param isUndetermined true if undetermined result, false otherwise + */ + public void setUndetermined(boolean isUndetermined) + { + this.isUndetermined = isUndetermined; + } + + /** + * @return + */ + public boolean isUndetermined() + { + return isUndetermined; + } + + /** + * Helper @see #setPermissions(List) + * + * @param permission permission + */ + public void setPermission(String permission) + { + List permissions = new ArrayList(1); + permissions.add(permission); + this.permissions = permissions; + } + + /** + * @param targetCapability target capability + */ + public void setTargetCapability(Capability targetCapability) + { + this.targetCapability = targetCapability; + } + + /** + * Check the permissions passed. + * + * @param nodeRef node reference + * @return boolean true if the permissions are present, false otherwise + */ + protected boolean checkPermissionsImpl(NodeRef nodeRef, String ... permissions) + { + boolean result = true; + NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); + + if(filePlan == null) + { + return result; + } + + for (String permission : permissions) + { + if (permissionService.hasPermission(filePlan, permission) != AccessStatus.ALLOWED) + { + result = false; + break; + } + } + + return result; + } + + /** + * Checks the permissions required for the capability. + * + * @param nodeRef + * @return + */ + protected boolean checkPermissions(NodeRef nodeRef) + { + boolean result = true; + if (permissions != null && !permissions.isEmpty()) + { + result = checkPermissionsImpl(nodeRef, (String[])permissions.toArray(new String[permissions.size()])); + } + return result; + } + + /** + * Checks the passed conditions. + * + * @param nodeRef + * @return + */ + protected boolean checkConditions(NodeRef nodeRef, Map conditions) + { + boolean result = true; + if (conditions != null) + { + for (Map.Entry entry : conditions.entrySet()) + { + boolean expected = entry.getValue().booleanValue(); + String conditionName = entry.getKey(); + + CapabilityCondition condition = (CapabilityCondition)applicationContext.getBean(conditionName); + if (condition == null) + { + throw new AlfrescoRuntimeException("Capability condition " + conditionName + " does not exist. Check the configuration of the capability " + name + "."); + } + + // determine the actual value + boolean actual = condition.evaluate(nodeRef); + + // report information about condition (for exception reporting) + RMMethodSecurityInterceptor.reportCapabilityCondition(getName(), condition.getName(), expected, actual); + + if (expected != actual) + { + result = false; + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("FAIL: Condition " + condition.getName() + " failed for capability " + getName() + " on nodeRef " + nodeRef.toString()); + } + + break; + } + } + } + return result; + } + + /** + * Checks the set conditions. + * + * @param nodeRef node reference + * @return boolean true if conditions satisfied, false otherwise + */ + protected boolean checkConditions(NodeRef nodeRef) + { + return checkConditions(nodeRef, conditions); + } + + /** + * Checks that the node ref is of the expected kind + * + * @param nodeRef + * @return + */ + protected boolean checkKinds(NodeRef nodeRef) + { + boolean result = false; + + FilePlanComponentKind actualKind = getFilePlanService().getFilePlanComponentKind(nodeRef); + + if (actualKind != null) + { + if (kinds != null && !kinds.isEmpty()) + { + // need to check the actual file plan kind is in the list specified + for (String kindString : kinds) + { + FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString); + if (actualKind.equals(kind)) + { + result = true; + break; + } + } + } + else + { + // we don't have any specific kinds to check, so we pass since we have a file + // plan component in our hands + result = true; + } + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public int evaluate(NodeRef nodeRef) + { + int result = AccessDecisionVoter.ACCESS_ABSTAIN; + + // check transaction cache + Map map = TransactionalResourceHelper.getMap("rm.declarativeCapability"); + String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser(); + if (map.containsKey(key)) + { + result = map.get(key); + } + else + { + // Check we are dealing with a file plan component + if (getFilePlanService().isFilePlanComponent(nodeRef)) + { + // Check the kind of the object, the permissions and the conditions + if (checkKinds(nodeRef) && checkPermissions(nodeRef) && checkConditions(nodeRef)) + { + // Opportunity for child implementations to extend + result = evaluateImpl(nodeRef); + } + else + { + result = AccessDecisionVoter.ACCESS_DENIED; + } + } + + // Last chance for child implementations to veto/change the result + result = onEvaluate(nodeRef, result); + + // log access denied to help with debug + if (LOGGER.isDebugEnabled() && AccessDecisionVoter.ACCESS_DENIED == result) + { + LOGGER.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString()); + } + + map.put(key, result); + } + + return result; + } + + @Override + public int evaluate(NodeRef source, NodeRef target) + { + int result = evaluate(source); + if (targetCapability != null && result != AccessDecisionVoter.ACCESS_DENIED) + { + result = targetCapability.evaluate(target); + } + return result; + } + + /** + * Default implementation. Given extending classes a hook point for further checks. + * + * @param nodeRef node reference + * @return + */ + protected int evaluateImpl(NodeRef nodeRef) + { + int result = AccessDecisionVoter.ACCESS_GRANTED; + if (isUndetermined) + { + result = AccessDecisionVoter.ACCESS_ABSTAIN; + } + return result; + } + + /** + * Default implementation. + * + * Called before evaluate completes. The result returned overwrites the already discovered result. + * Provides a hook point for child implementations that wish to veto the result. + * + * @param nodeRef + * @param result + * @return + */ + protected int onEvaluate(NodeRef nodeRef, int result) + { + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java index f13e7201d9..45cc362007 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java @@ -1,148 +1,148 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Generic implementation of a composite capability - * - * @author Roy Wetherall - */ -public class DeclarativeCompositeCapability extends DeclarativeCapability - implements CompositeCapability -{ - /** set of capabilities */ - private Set capabilities; - - /** - * @param capabilites set of capabilities - */ - public void setCapabilities(Set capabilities) - { - this.capabilities = capabilities; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability#getCapabilities() - */ - @Override - public Set getCapabilities() - { - return this.capabilities; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluateImpl(NodeRef nodeRef) - { - int result = AccessDecisionVoter.ACCESS_DENIED; - - // Check each capability using 'OR' logic - for (Capability capability : capabilities) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Evaluating child capability " + capability.getName() + " on nodeRef " + nodeRef.toString() + " for composite capability " + name); - } - - int capabilityResult = capability.evaluate(nodeRef); - if (capabilityResult != AccessDecisionVoter.ACCESS_DENIED) - { - result = AccessDecisionVoter.ACCESS_ABSTAIN; - if (!isUndetermined() && capabilityResult == AccessDecisionVoter.ACCESS_GRANTED) - { - result = AccessDecisionVoter.ACCESS_GRANTED; - } - break; - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Access denied for child capability " + capability.getName() + " on nodeRef " + nodeRef.toString() + " for composite capability " + name); - } - } - } - - return result; - } - - /** - * If a target capability is specified then we evaluate that. Otherwise we combine the results of the provided capabilities. - * - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluate(NodeRef source, NodeRef target) - { - int result = AccessDecisionVoter.ACCESS_ABSTAIN; - - // Check we are dealing with a file plan component - if (getFilePlanService().isFilePlanComponent(source) && - getFilePlanService().isFilePlanComponent(target)) - { - // Check the kind of the object, the permissions and the conditions - if (checkKinds(source) && checkPermissions(source) && checkConditions(source)) - { - if (targetCapability != null) - { - result = targetCapability.evaluate(target); - } - - if (AccessDecisionVoter.ACCESS_DENIED != result) - { - // Check each capability using 'OR' logic - for (Capability capability : capabilities) - { - result = capability.evaluate(source, target); - if (result == AccessDecisionVoter.ACCESS_GRANTED) - { - break; - } - } - - } - } - else - { - result = AccessDecisionVoter.ACCESS_DENIED; - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability; +import org.alfresco.service.cmr.repository.NodeRef; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Generic implementation of a composite capability + * + * @author Roy Wetherall + */ +public class DeclarativeCompositeCapability extends DeclarativeCapability + implements CompositeCapability +{ + /** set of capabilities */ + private Set capabilities; + + /** + * @param capabilites set of capabilities + */ + public void setCapabilities(Set capabilities) + { + this.capabilities = capabilities; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability#getCapabilities() + */ + @Override + public Set getCapabilities() + { + return this.capabilities; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public int evaluateImpl(NodeRef nodeRef) + { + int result = AccessDecisionVoter.ACCESS_DENIED; + + // Check each capability using 'OR' logic + for (Capability capability : capabilities) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Evaluating child capability " + capability.getName() + " on nodeRef " + nodeRef.toString() + " for composite capability " + name); + } + + int capabilityResult = capability.evaluate(nodeRef); + if (capabilityResult != AccessDecisionVoter.ACCESS_DENIED) + { + result = AccessDecisionVoter.ACCESS_ABSTAIN; + if (!isUndetermined() && capabilityResult == AccessDecisionVoter.ACCESS_GRANTED) + { + result = AccessDecisionVoter.ACCESS_GRANTED; + } + break; + } + else + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Access denied for child capability " + capability.getName() + " on nodeRef " + nodeRef.toString() + " for composite capability " + name); + } + } + } + + return result; + } + + /** + * If a target capability is specified then we evaluate that. Otherwise we combine the results of the provided capabilities. + * + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public int evaluate(NodeRef source, NodeRef target) + { + int result = AccessDecisionVoter.ACCESS_ABSTAIN; + + // Check we are dealing with a file plan component + if (getFilePlanService().isFilePlanComponent(source) && + getFilePlanService().isFilePlanComponent(target)) + { + // Check the kind of the object, the permissions and the conditions + if (checkKinds(source) && checkPermissions(source) && checkConditions(source)) + { + if (targetCapability != null) + { + result = targetCapability.evaluate(target); + } + + if (AccessDecisionVoter.ACCESS_DENIED != result) + { + // Check each capability using 'OR' logic + for (Capability capability : capabilities) + { + result = capability.evaluate(source, target); + if (result == AccessDecisionVoter.ACCESS_GRANTED) + { + break; + } + } + + } + } + else + { + result = AccessDecisionVoter.ACCESS_DENIED; + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java index 8cc95aebba..883ac64e8e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java @@ -1,88 +1,88 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Composite capability condition implementation that required at least one of the - * capability conditions to be true. - * - * @author Roy Wetherall - */ -public class AtLeastOneCondition extends AbstractCapabilityCondition -{ - /** capability conditions */ - private List conditions; - - /** - * @param conditions capability conditions - */ - public void setConditions(List conditions) - { - this.conditions = conditions; - } - - /** - * Don't use the transaction cache for the composite condition - * - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluate(NodeRef nodeRef) - { - return evaluateImpl(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - if (conditions != null) - { - for (CapabilityCondition condition : conditions) - { - if (condition.evaluate(nodeRef)) - { - result = true; - break; - } - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Composite capability condition implementation that required at least one of the + * capability conditions to be true. + * + * @author Roy Wetherall + */ +public class AtLeastOneCondition extends AbstractCapabilityCondition +{ + /** capability conditions */ + private List conditions; + + /** + * @param conditions capability conditions + */ + public void setConditions(List conditions) + { + this.conditions = conditions; + } + + /** + * Don't use the transaction cache for the composite condition + * + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluate(NodeRef nodeRef) + { + return evaluateImpl(nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + if (conditions != null) + { + for (CapabilityCondition condition : conditions) + { + if (condition.evaluate(nodeRef)) + { + result = true; + break; + } + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java index 9439ea40b0..02a2037824 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java @@ -1,81 +1,81 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -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.RegexQNamePattern; - -/** - * @author Roy Wetherall - */ -public class ClosedCapabilityCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - if (recordFolderService.isRecordFolder(nodeRef)) - { - result = recordFolderService.isRecordFolderClosed(nodeRef); - } - else if (recordService.isRecord(nodeRef)) - { - final List assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - - result = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Boolean doWork() - { - for (ChildAssociationRef assoc : assocs) - { - NodeRef parent = assoc.getParentRef(); - if (recordFolderService.isRecordFolder(parent) && recordFolderService.isRecordFolderClosed(parent)) - { - return true; - } - } - return false; - } - }); - - } - return result; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +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.RegexQNamePattern; + +/** + * @author Roy Wetherall + */ +public class ClosedCapabilityCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + if (recordFolderService.isRecordFolder(nodeRef)) + { + result = recordFolderService.isRecordFolderClosed(nodeRef); + } + else if (recordService.isRecord(nodeRef)) + { + final List assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + + result = AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Boolean doWork() + { + for (ChildAssociationRef assoc : assocs) + { + NodeRef parent = assoc.getParentRef(); + if (recordFolderService.isRecordFolder(parent) && recordFolderService.isRecordFolderClosed(parent)) + { + return true; + } + } + return false; + } + }); + + } + return result; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CutoffCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CutoffCapabilityCondition.java index 054472d8cc..ccb5d00f2f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CutoffCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CutoffCapabilityCondition.java @@ -1,50 +1,50 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Cut off capability condition. - * - * @author Roy Wetherall - */ -public class CutoffCapabilityCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - // determine whether the item is already cutt off - return dispositionService.isDisposableItemCutoff(nodeRef); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Cut off capability condition. + * + * @author Roy Wetherall + */ +public class CutoffCapabilityCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + // determine whether the item is already cutt off + return dispositionService.isDisposableItemCutoff(nodeRef); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java index ab5712b694..1c8dde760b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class DeclaredCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - if (FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef))) - { - result = recordService.isDeclared(nodeRef); - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * @author Roy Wetherall + */ +public class DeclaredCapabilityCondition extends AbstractCapabilityCondition +{ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + if (FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef))) + { + result = recordService.isDeclared(nodeRef); + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DestroyedCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DestroyedCapabilityCondition.java index c352917981..55f0001a2d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DestroyedCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DestroyedCapabilityCondition.java @@ -1,45 +1,45 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Destroyed capability condition. - * - * @author Roy Wetherall - */ -public class DestroyedCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - return nodeService.hasAspect(nodeRef, ASPECT_GHOSTED); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Destroyed capability condition. + * + * @author Roy Wetherall + */ +public class DestroyedCapabilityCondition extends AbstractCapabilityCondition +{ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + return nodeService.hasAspect(nodeRef, ASPECT_GHOSTED); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FailCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FailCapabilityCondition.java index 7d65a02042..c13cc914e2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FailCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FailCapabilityCondition.java @@ -1,46 +1,46 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Helper condition that always fails. Useful for deprecation of - * old capabilities. - * - * @author Roy Wetherall - */ -public class FailCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - return false; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Helper condition that always fails. Useful for deprecation of + * old capabilities. + * + * @author Roy Wetherall + */ +public class FailCapabilityCondition extends AbstractCapabilityCondition +{ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + return false; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FileableCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FileableCapabilityCondition.java index 578aad6889..047638f346 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FileableCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FileableCapabilityCondition.java @@ -1,67 +1,67 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Fileable capability condition. Indicates whether a node is 'fileable', namely if it extends cm:content - * or extends rma:nonElectronicDocument - * - * @author Roy Wetherall - */ -public class FileableCapabilityCondition extends AbstractCapabilityCondition -{ - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - QName type = nodeService.getType(nodeRef); - // TODO and not already a record? - return (dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) || - dictionaryService.isSubClass(type, TYPE_NON_ELECTRONIC_DOCUMENT)); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Fileable capability condition. Indicates whether a node is 'fileable', namely if it extends cm:content + * or extends rma:nonElectronicDocument + * + * @author Roy Wetherall + */ +public class FileableCapabilityCondition extends AbstractCapabilityCondition +{ + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + QName type = nodeService.getType(nodeRef); + // TODO and not already a record? + return (dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) || + dictionaryService.isSubClass(type, TYPE_NON_ELECTRONIC_DOCUMENT)); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingCapabilityCondition.java index 219f5f425c..cebbe6913c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingCapabilityCondition.java @@ -1,57 +1,57 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Filling capability condition. - * - * @author Roy Wetherall - */ -public class FillingCapabilityCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS) != AccessStatus.DENIED) - { - result = true; - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; + +/** + * Filling capability condition. + * + * @author Roy Wetherall + */ +public class FillingCapabilityCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS) != AccessStatus.DENIED) + { + result = true; + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java index 9ee25e540b..f284f922f0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java @@ -1,69 +1,69 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Filling capability for hold condition. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class FillingOnHoldContainerCapabilityCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - NodeRef holdContainer = nodeRef; - - // if we have a file plan, go get the hold container - if (filePlanService.isFilePlan(nodeRef) == true) - { - holdContainer = filePlanService.getHoldContainer(nodeRef); - } - - // ensure we are dealing with a hold container - if (TYPE_HOLD_CONTAINER.equals(nodeService.getType(holdContainer))) - { - if (permissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS) != AccessStatus.DENIED) - { - result = true; - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; + +/** + * Filling capability for hold condition. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class FillingOnHoldContainerCapabilityCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + NodeRef holdContainer = nodeRef; + + // if we have a file plan, go get the hold container + if (filePlanService.isFilePlan(nodeRef) == true) + { + holdContainer = filePlanService.getHoldContainer(nodeRef); + } + + // ensure we are dealing with a hold container + if (TYPE_HOLD_CONTAINER.equals(nodeService.getType(holdContainer))) + { + if (permissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS) != AccessStatus.DENIED) + { + result = true; + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java index db76c96280..0e63582720 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java @@ -1,86 +1,86 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether an item is held or not. - *

- * A hold object is by definition considered to be held. - * - * @author Roy Wetherall - */ -public class FrozenCapabilityCondition extends AbstractCapabilityCondition -{ - /** indicates whether children should be checked */ - private boolean checkChildren = false; - - /** hold service */ - private HoldService holdService; - - /** - * @param checkChildren true to check children, false otherwise - */ - public void setCheckChildren(boolean checkChildren) - { - this.checkChildren = checkChildren; - } - - /** - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - // check whether we are working with a hold or not - if (holdService.isHold(nodeRef)) - { - result = true; - } - else - { - result = freezeService.isFrozen(nodeRef); - if (!result && checkChildren) - { - result = freezeService.hasFrozenChildren(nodeRef); - } - } - return result; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Indicates whether an item is held or not. + *

+ * A hold object is by definition considered to be held. + * + * @author Roy Wetherall + */ +public class FrozenCapabilityCondition extends AbstractCapabilityCondition +{ + /** indicates whether children should be checked */ + private boolean checkChildren = false; + + /** hold service */ + private HoldService holdService; + + /** + * @param checkChildren true to check children, false otherwise + */ + public void setCheckChildren(boolean checkChildren) + { + this.checkChildren = checkChildren; + } + + /** + * @param holdService hold service + */ + public void setHoldService(HoldService holdService) + { + this.holdService = holdService; + } + + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + // check whether we are working with a hold or not + if (holdService.isHold(nodeRef)) + { + result = true; + } + else + { + result = freezeService.isFrozen(nodeRef); + if (!result && checkChildren) + { + result = freezeService.hasFrozenChildren(nodeRef); + } + } + return result; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java index 65552eb133..141e8f1dd3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether the node is either frozen or is a hold object - * - * @author Roy Wetherall - */ -public class FrozenOrHoldCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - return (freezeService.isFrozen(nodeRef) || - (kind != null && kind.equals(FilePlanComponentKind.HOLD))); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Indicates whether the node is either frozen or is a hold object + * + * @author Roy Wetherall + */ +public class FrozenOrHoldCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); + return (freezeService.isFrozen(nodeRef) || + (kind != null && kind.equals(FilePlanComponentKind.HOLD))); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasAspectCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasAspectCapabilityCondition.java index 4179cf78b1..85933c754d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasAspectCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasAspectCapabilityCondition.java @@ -1,70 +1,70 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - */ -public class HasAspectCapabilityCondition extends AbstractCapabilityCondition -{ - private String aspectName; - - private NamespaceService namespaceService; - - public void setAspectName(String aspectName) - { - this.aspectName = aspectName; - } - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - if (aspectName != null) - { - QName aspect = QName.createQName(aspectName, namespaceService); - result = nodeService.hasAspect(nodeRef, aspect); - } - - return result; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * @author Roy Wetherall + */ +public class HasAspectCapabilityCondition extends AbstractCapabilityCondition +{ + private String aspectName; + + private NamespaceService namespaceService; + + public void setAspectName(String aspectName) + { + this.aspectName = aspectName; + } + + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + if (aspectName != null) + { + QName aspect = QName.createQName(aspectName, namespaceService); + result = nodeService.hasAspect(nodeRef, aspect); + } + + return result; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java index 27b0e7c7ec..8af1522414 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasDispositionDateCapabilityCondition.java @@ -1,76 +1,76 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether a disposable item currently has a disposition date or not. - * - * @author Roy Wetherall - */ -public class HasDispositionDateCapabilityCondition extends AbstractCapabilityCondition -{ - /** Disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); - if (dispositionAction != null) - { - if (dispositionAction.getAsOfDate() != null) - { - result = true; - } - } - else if (filePlanService.isFilePlanComponent(nodeRef) && nodeService.getProperty(nodeRef, PROP_DISPOSITION_AS_OF) != null) - { - result = true; - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Indicates whether a disposable item currently has a disposition date or not. + * + * @author Roy Wetherall + */ +public class HasDispositionDateCapabilityCondition extends AbstractCapabilityCondition +{ + /** Disposition service */ + private DispositionService dispositionService; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); + if (dispositionAction != null) + { + if (dispositionAction.getAsOfDate() != null) + { + result = true; + } + } + else if (filePlanService.isFilePlanComponent(nodeRef) && nodeService.getProperty(nodeRef, PROP_DISPOSITION_AS_OF) != null) + { + result = true; + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java index f34f685d13..19bd3bccda 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java @@ -1,72 +1,72 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether a scheduled record or folder has events or not. - * - * @author Roy Wetherall - */ -public class HasEventsCapabilityCondition extends AbstractCapabilityCondition -{ - /** Disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - if (dispositionService.isDisposableItem(nodeRef)) - { - DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); - if (da != null) - { - result = (!da.getEventCompletionDetails().isEmpty()); - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Indicates whether a scheduled record or folder has events or not. + * + * @author Roy Wetherall + */ +public class HasEventsCapabilityCondition extends AbstractCapabilityCondition +{ + /** Disposition service */ + private DispositionService dispositionService; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + if (dispositionService.isDisposableItem(nodeRef)) + { + DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); + if (da != null) + { + result = (!da.getEventCompletionDetails().isEmpty()); + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java index c3daff6cac..5e43b230ae 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java @@ -1,94 +1,94 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Add to hold evaluator. - *

- * Determines whether the current user has access to any holds. - * - * @author Roy Wetherall - */ -public class HoldCapabilityCondition extends AbstractCapabilityCondition -{ - /** indicates whether to evaluate holds that the node is within or not within */ - private boolean includedInHold = false;; - - /** hold service */ - private HoldService holdService; - - /** - * @param includedInHold true if holds node within, false otherwise - */ - public void setIncludedInHold(boolean includedInHold) - { - this.includedInHold = includedInHold; - } - - /** - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - if (holdService.isHold(nodeRef)) - { - result = AccessStatus.ALLOWED.equals(permissionService.hasPermission(nodeRef, RMPermissionModel.FILING)); - } - else - { - List holds = holdService.heldBy(nodeRef, includedInHold); - for (NodeRef hold : holds) - { - // return true as soon as we find one hold we have filling permission on - if (AccessStatus.ALLOWED.equals(permissionService.hasPermission(hold, RMPermissionModel.FILING))) - { - result = true; - break; - } - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; + +/** + * Add to hold evaluator. + *

+ * Determines whether the current user has access to any holds. + * + * @author Roy Wetherall + */ +public class HoldCapabilityCondition extends AbstractCapabilityCondition +{ + /** indicates whether to evaluate holds that the node is within or not within */ + private boolean includedInHold = false;; + + /** hold service */ + private HoldService holdService; + + /** + * @param includedInHold true if holds node within, false otherwise + */ + public void setIncludedInHold(boolean includedInHold) + { + this.includedInHold = includedInHold; + } + + /** + * @param holdService hold service + */ + public void setHoldService(HoldService holdService) + { + this.holdService = holdService; + } + + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + if (holdService.isHold(nodeRef)) + { + result = AccessStatus.ALLOWED.equals(permissionService.hasPermission(nodeRef, RMPermissionModel.FILING)); + } + else + { + List holds = holdService.heldBy(nodeRef, includedInHold); + for (NodeRef hold : holds) + { + // return true as soon as we find one hold we have filling permission on + if (AccessStatus.ALLOWED.equals(permissionService.hasPermission(hold, RMPermissionModel.FILING))) + { + result = true; + break; + } + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java index 8326a1b677..72e1e58bda 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsClassifiedCapabilityCondition.java @@ -1,69 +1,69 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether the given node has an associated disposition schedule - * - * @author Craig Tan - * @since 2.1 - */ -public class IsClassifiedCapabilityCondition extends AbstractCapabilityCondition -{ - /** Disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef); - if (dispositionSchedule != null) - { - result = true; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Indicates whether the given node has an associated disposition schedule + * + * @author Craig Tan + * @since 2.1 + */ +public class IsClassifiedCapabilityCondition extends AbstractCapabilityCondition +{ + /** Disposition service */ + private DispositionService dispositionService; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef); + if (dispositionSchedule != null) + { + result = true; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsPropertySetCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsPropertySetCondition.java index 6dc0bc178d..1adf22b52a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsPropertySetCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsPropertySetCondition.java @@ -1,97 +1,97 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Indicates whether a property is set or not. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class IsPropertySetCondition extends AbstractCapabilityCondition -{ - /** property name (eg: rma:location) */ - private String propertyName; - private QName propertyQName; - - /** namespace service */ - private NamespaceService namespaceService; - - /** - * @param propertyName property name (eg: rma:location) - */ - public void setPropertyName(String propertyName) - { - this.propertyName = propertyName; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @return QName property qname - */ - protected QName getPropertyQName() - { - if (propertyQName == null) - { - propertyQName = QName.createQName(propertyName, namespaceService); - } - return propertyQName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - boolean result = false; - - if (nodeService.getProperty(nodeRef, getPropertyQName()) != null) - { - result = true; - } - - return result; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; + +/** + * Indicates whether a property is set or not. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class IsPropertySetCondition extends AbstractCapabilityCondition +{ + /** property name (eg: rma:location) */ + private String propertyName; + private QName propertyQName; + + /** namespace service */ + private NamespaceService namespaceService; + + /** + * @param propertyName property name (eg: rma:location) + */ + public void setPropertyName(String propertyName) + { + this.propertyName = propertyName; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @return QName property qname + */ + protected QName getPropertyQName() + { + if (propertyQName == null) + { + propertyQName = QName.createQName(propertyName, namespaceService); + } + return propertyQName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + boolean result = false; + + if (nodeService.getProperty(nodeRef, getPropertyQName()) != null) + { + result = true; + } + + return result; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java index bf2657555f..f786645c37 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java @@ -1,53 +1,53 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Indicates whether the given node is a record category or not. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class IsRecordCategoryCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return filePlanService.isRecordCategory(nodeRef); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.ParameterCheck; + +/** + * Indicates whether the given node is a record category or not. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class IsRecordCategoryCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + return filePlanService.isRecordCategory(nodeRef); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCondition.java index ac9ae7ff83..c54991d98b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCondition.java @@ -1,53 +1,53 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Indicates whether the given node is a record or not. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class IsRecordCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return recordService.isRecord(nodeRef); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.ParameterCheck; + +/** + * Indicates whether the given node is a record or not. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class IsRecordCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + return recordService.isRecord(nodeRef); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordFolderCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordFolderCondition.java index 5a84c5d8cb..3c118c436f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordFolderCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordFolderCondition.java @@ -1,53 +1,53 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; - -/** - * Indicates whether the given node is a record folder or not. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class IsRecordFolderCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return recordFolderService.isRecordFolder(nodeRef); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.ParameterCheck; + +/** + * Indicates whether the given node is a record folder or not. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class IsRecordFolderCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + return recordFolderService.isRecordFolder(nodeRef); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java index bd071567e7..2c687d7426 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java @@ -1,86 +1,86 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether the given disposition action is scheduled next - * - * @author Roy Wetherall - */ -public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition -{ - /** Disposition action */ - private String dispositionAction; - - /** Disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionAction disposition action - */ - public void setDispositionAction(String dispositionAction) - { - this.dispositionAction = dispositionAction; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - DispositionAction nextDispositionAction = dispositionService.getNextDispositionAction(nodeRef); - if (nextDispositionAction != null) - { - // Get the disposition actions name - String actionName = nextDispositionAction.getName(); - if (actionName.equals(dispositionAction) && - dispositionService.isNextDispositionActionEligible(nodeRef)) - { - result = true; - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Indicates whether the given disposition action is scheduled next + * + * @author Roy Wetherall + */ +public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition +{ + /** Disposition action */ + private String dispositionAction; + + /** Disposition service */ + private DispositionService dispositionService; + + /** + * @param dispositionAction disposition action + */ + public void setDispositionAction(String dispositionAction) + { + this.dispositionAction = dispositionAction; + } + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + DispositionAction nextDispositionAction = dispositionService.getNextDispositionAction(nodeRef); + if (nextDispositionAction != null) + { + // Get the disposition actions name + String actionName = nextDispositionAction.getName(); + if (actionName.equals(dispositionAction) && + dispositionService.isNextDispositionActionEligible(nodeRef)) + { + result = true; + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java index e4a55faf5e..8bdfca186e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java @@ -1,59 +1,59 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class IsTransferAccessionCapabilityCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (FilePlanComponentKind.TRANSFER.equals(kind)) - { - Boolean value = (Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR); - if (value != null) - { - result = value.booleanValue(); - } - } - return result; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * @author Roy Wetherall + */ +public class IsTransferAccessionCapabilityCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); + if (FilePlanComponentKind.TRANSFER.equals(kind)) + { + Boolean value = (Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR); + if (value != null) + { + result = value.booleanValue(); + } + } + return result; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java index d33238a8c0..a68392232c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java @@ -1,71 +1,71 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Last disposition action condition. - * - * @author Roy Wetherall - */ -public class LastDispositionActionCondition extends AbstractCapabilityCondition -{ - private DispositionService dispositionService; - - private String dispositionActionName; - - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - public void setDispositionActionName(String dispositionActionName) - { - this.dispositionActionName = dispositionActionName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - DispositionAction dispositionAction = dispositionService.getLastCompletedDispostionAction(nodeRef); - if (dispositionAction != null && - dispositionActionName.equals(dispositionAction.getName())) - { - result = true; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Last disposition action condition. + * + * @author Roy Wetherall + */ +public class LastDispositionActionCondition extends AbstractCapabilityCondition +{ + private DispositionService dispositionService; + + private String dispositionActionName; + + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + public void setDispositionActionName(String dispositionActionName) + { + this.dispositionActionName = dispositionActionName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + DispositionAction dispositionAction = dispositionService.getLastCompletedDispostionAction(nodeRef); + if (dispositionAction != null && + dispositionActionName.equals(dispositionAction.getName())) + { + result = true; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java index 0de4d0184d..51cf53c884 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MayBeScheduledCapabilityCondition.java @@ -1,110 +1,110 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether the given disposition action 'may' be scheduled in the future - * - * @author Roy Wetherall - */ -public class MayBeScheduledCapabilityCondition extends AbstractCapabilityCondition -{ - /** Disposition action */ - private String dispositionAction; - - /** Disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionAction disposition action - */ - public void setDispositionAction(String dispositionAction) - { - this.dispositionAction = dispositionAction; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef); - if (dispositionSchedule != null && checkDispositionLevel(nodeRef, dispositionSchedule)) - { - for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions()) - { - if (dispositionActionDefinition.getName().equals(dispositionAction)) - { - result = true; - break; - } - } - } - return result; - } - - /** - * Checks the disposition level - * - * @param nodeRef - * @param dispositionSchedule - * @return - */ - private boolean checkDispositionLevel(NodeRef nodeRef, DispositionSchedule dispositionSchedule) - { - boolean result = false; - boolean isRecordLevelDisposition = dispositionSchedule.isRecordLevelDisposition(); - if (recordService.isRecord(nodeRef) && isRecordLevelDisposition) - { - result = true; - } - else if (recordFolderService.isRecordFolder(nodeRef) && !isRecordLevelDisposition) - - { - result = true; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Indicates whether the given disposition action 'may' be scheduled in the future + * + * @author Roy Wetherall + */ +public class MayBeScheduledCapabilityCondition extends AbstractCapabilityCondition +{ + /** Disposition action */ + private String dispositionAction; + + /** Disposition service */ + private DispositionService dispositionService; + + /** + * @param dispositionAction disposition action + */ + public void setDispositionAction(String dispositionAction) + { + this.dispositionAction = dispositionAction; + } + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef); + if (dispositionSchedule != null && checkDispositionLevel(nodeRef, dispositionSchedule)) + { + for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions()) + { + if (dispositionActionDefinition.getName().equals(dispositionAction)) + { + result = true; + break; + } + } + } + return result; + } + + /** + * Checks the disposition level + * + * @param nodeRef + * @param dispositionSchedule + * @return + */ + private boolean checkDispositionLevel(NodeRef nodeRef, DispositionSchedule dispositionSchedule) + { + boolean result = false; + boolean isRecordLevelDisposition = dispositionSchedule.isRecordLevelDisposition(); + if (recordService.isRecord(nodeRef) && isRecordLevelDisposition) + { + result = true; + } + else if (recordFolderService.isRecordFolder(nodeRef) && !isRecordLevelDisposition) + + { + result = true; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MovableCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MovableCapabilityCondition.java index 99aebc7f29..95636bd56a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MovableCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/MovableCapabilityCondition.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Movable capability condition. - * - * @author Roxana Dina - * @since 2.4.1 - * - */ -public class MovableCapabilityCondition extends AbstractCapabilityCondition -{ - - /** - * A record folder should not be moved when it is cut off, but it should be possible to move it when it is destroyed. - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - if (nodeService.hasAspect(nodeRef, ASPECT_GHOSTED) && dispositionService.isDisposableItemCutoff(nodeRef)) - return true; - return !dispositionService.isDisposableItemCutoff(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Movable capability condition. + * + * @author Roxana Dina + * @since 2.4.1 + * + */ +public class MovableCapabilityCondition extends AbstractCapabilityCondition +{ + + /** + * A record folder should not be moved when it is cut off, but it should be possible to move it when it is destroyed. + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + if (nodeService.hasAspect(nodeRef, ASPECT_GHOSTED) && dispositionService.isDisposableItemCutoff(nodeRef)) + return true; + return !dispositionService.isDisposableItemCutoff(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/RecordFiledCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/RecordFiledCapabilityCondition.java index d7ea6ea512..650826c2f7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/RecordFiledCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/RecordFiledCapabilityCondition.java @@ -1,50 +1,50 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Indicates whether a record is unfiled or not. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordFiledCapabilityCondition extends AbstractCapabilityCondition -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - return recordService.isFiled(nodeRef); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Indicates whether a record is unfiled or not. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RecordFiledCapabilityCondition extends AbstractCapabilityCondition +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + return recordService.isFiled(nodeRef); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/TransferredCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/TransferredCapabilityCondition.java index 161c12a489..fa2c38fcb4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/TransferredCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/TransferredCapabilityCondition.java @@ -1,44 +1,44 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class TransferredCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - return nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_TRANSFERRED); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * @author Roy Wetherall + */ +public class TransferredCapabilityCondition extends AbstractCapabilityCondition +{ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + return nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_TRANSFERRED); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java index f789769b2e..d6279aa350 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java @@ -1,61 +1,61 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class VitalRecordOrFolderCapabilityCondition extends AbstractCapabilityCondition -{ - @Override - public boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - if (recordService.isRecord(nodeRef)) - { - // Check the record for the vital record aspect - result = nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD); - } - else if (recordFolderService.isRecordFolder(nodeRef)) - { - // Check the folder for the vital record indicator - Boolean value = (Boolean)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_VITAL_RECORD_INDICATOR); - if (value != null) - { - result = value.booleanValue(); - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * @author Roy Wetherall + */ +public class VitalRecordOrFolderCapabilityCondition extends AbstractCapabilityCondition +{ + @Override + public boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + if (recordService.isRecord(nodeRef)) + { + // Check the record for the vital record aspect + result = nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD); + } + else if (recordFolderService.isRecordFolder(nodeRef)) + { + // Check the folder for the vital record indicator + Boolean value = (Boolean)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_VITAL_RECORD_INDICATOR); + if (value != null) + { + result = value.booleanValue(); + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java index 4597ab3de1..c51a5a1261 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java @@ -1,76 +1,76 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.impl; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Change or delete references capability - * - * @author Roy Wetherall - */ -public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - public int evaluate(NodeRef source, NodeRef target) - { - if (getFilePlanService().isFilePlanComponent(source)) - { - if (target != null) - { - if (getFilePlanService().isFilePlanComponent(target) && - checkConditions(source) && - checkConditions(target) && - checkPermissions(source) && - checkPermissions(target)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - else - { - if (checkConditions(source) && - checkPermissions(source)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - - return AccessDecisionVoter.ACCESS_DENIED; - } - else - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.impl; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; +import org.alfresco.service.cmr.repository.NodeRef; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Change or delete references capability + * + * @author Roy Wetherall + */ +public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + public int evaluate(NodeRef source, NodeRef target) + { + if (getFilePlanService().isFilePlanComponent(source)) + { + if (target != null) + { + if (getFilePlanService().isFilePlanComponent(target) && + checkConditions(source) && + checkConditions(target) && + checkPermissions(source) && + checkPermissions(target)) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + } + else + { + if (checkConditions(source) && + checkPermissions(source)) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + } + + return AccessDecisionVoter.ACCESS_DENIED; + } + else + { + return AccessDecisionVoter.ACCESS_ABSTAIN; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java index 5193ee6e3d..ed34edc184 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java @@ -1,190 +1,190 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.impl; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Create group capability implementation - * - * @author Andy Hind - */ -public class CreateCapability extends DeclarativeCapability -{ - /** record service */ - private RecordService recordService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluate(NodeRef nodeRef) - { - return evaluate(nodeRef, null, null); - } - - /** - * Evaluate capability. - * - * @param destination destination node reference - * @param linkee linkee node reference, can be null - * @param assocType association type, can be null - * @return - */ - public int evaluate(NodeRef destination, NodeRef linkee, QName assocType) - { - if (linkee != null) - { - int state = checkRead(linkee, true); - if (state != AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_DENIED; - } - } - if (getFilePlanService().isFilePlanComponent(destination)) - { - if ((assocType == null) || !assocType.equals(ContentModel.ASSOC_CONTAINS)) - { - if (linkee == null) - { - if (recordService.isRecord(destination) && - !recordService.isDeclared(destination) && - permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - else - { - if (recordService.isRecord(linkee) && - recordService.isRecord(destination) && - !recordService.isDeclared(destination) && - permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - - } - - // Build the conditions map - Map conditions = new HashMap(5); - conditions.put("capabilityCondition.filling", Boolean.TRUE); - conditions.put("capabilityCondition.frozen", Boolean.FALSE); - conditions.put("capabilityCondition.closed", Boolean.FALSE); - conditions.put("capabilityCondition.cutoff", Boolean.FALSE); - - // if the destination folder is not a record folder and the user has filling capability on it, grant access to create the record - if (checkConditions(destination, conditions) && - !recordFolderService.isRecordFolder(destination) ) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - - if (checkConditions(destination, conditions) && - recordFolderService.isRecordFolder(destination) && - permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - - conditions.put("capabilityCondition.closed", Boolean.TRUE); - if (checkConditions(destination, conditions) && - recordFolderService.isRecordFolder(destination) && - permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - - conditions.remove("capabilityCondition.closed"); - conditions.put("capabilityCondition.cutoff", Boolean.TRUE); - if (checkConditions(destination, conditions) && - recordFolderService.isRecordFolder(destination) && - permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS) == AccessStatus.ALLOWED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - } - if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_DESTROY_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (capabilityService.getCapability(RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_DESTROY_FILEPLAN_METADATA).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (capabilityService.getCapability(RMPermissionModel.CREATE_HOLD).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (((ChangeOrDeleteReferencesCapability)capabilityService.getCapability(RMPermissionModel.CHANGE_OR_DELETE_REFERENCES)).evaluate(destination, linkee) == AccessDecisionVoter.ACCESS_GRANTED) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - return AccessDecisionVoter.ACCESS_DENIED; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.impl; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.QName; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Create group capability implementation + * + * @author Andy Hind + */ +public class CreateCapability extends DeclarativeCapability +{ + /** record service */ + private RecordService recordService; + + /** record folder service */ + private RecordFolderService recordFolderService; + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public int evaluate(NodeRef nodeRef) + { + return evaluate(nodeRef, null, null); + } + + /** + * Evaluate capability. + * + * @param destination destination node reference + * @param linkee linkee node reference, can be null + * @param assocType association type, can be null + * @return + */ + public int evaluate(NodeRef destination, NodeRef linkee, QName assocType) + { + if (linkee != null) + { + int state = checkRead(linkee, true); + if (state != AccessDecisionVoter.ACCESS_GRANTED) + { + return AccessDecisionVoter.ACCESS_DENIED; + } + } + if (getFilePlanService().isFilePlanComponent(destination)) + { + if ((assocType == null) || !assocType.equals(ContentModel.ASSOC_CONTAINS)) + { + if (linkee == null) + { + if (recordService.isRecord(destination) && + !recordService.isDeclared(destination) && + permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + } + else + { + if (recordService.isRecord(linkee) && + recordService.isRecord(destination) && + !recordService.isDeclared(destination) && + permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + } + + } + + // Build the conditions map + Map conditions = new HashMap(5); + conditions.put("capabilityCondition.filling", Boolean.TRUE); + conditions.put("capabilityCondition.frozen", Boolean.FALSE); + conditions.put("capabilityCondition.closed", Boolean.FALSE); + conditions.put("capabilityCondition.cutoff", Boolean.FALSE); + + // if the destination folder is not a record folder and the user has filling capability on it, grant access to create the record + if (checkConditions(destination, conditions) && + !recordFolderService.isRecordFolder(destination) ) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + + if (checkConditions(destination, conditions) && + recordFolderService.isRecordFolder(destination) && + permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + + conditions.put("capabilityCondition.closed", Boolean.TRUE); + if (checkConditions(destination, conditions) && + recordFolderService.isRecordFolder(destination) && + permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + + conditions.remove("capabilityCondition.closed"); + conditions.put("capabilityCondition.cutoff", Boolean.TRUE); + if (checkConditions(destination, conditions) && + recordFolderService.isRecordFolder(destination) && + permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS) == AccessStatus.ALLOWED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + } + if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_DESTROY_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + if (capabilityService.getCapability(RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_DESTROY_FILEPLAN_METADATA).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + if (capabilityService.getCapability(RMPermissionModel.CREATE_HOLD).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + if (((ChangeOrDeleteReferencesCapability)capabilityService.getCapability(RMPermissionModel.CHANGE_OR_DELETE_REFERENCES)).evaluate(destination, linkee) == AccessDecisionVoter.ACCESS_GRANTED) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + return AccessDecisionVoter.ACCESS_DENIED; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java index 138dd17a48..e147836ec6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.impl; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Delete links capability. - * - * @author Roy Wetherall - */ -public class DeleteLinksCapability extends DeclarativeCapability -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public int evaluate(NodeRef nodeRef) - { - // no way to know ... - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - public int evaluate(NodeRef source, NodeRef target) - { - if (getFilePlanService().isFilePlanComponent(source) && - getFilePlanService().isFilePlanComponent(target)) - { - if (checkConditions(source) && - checkConditions(target) && - checkPermissions(source) && - checkPermissions(target)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - return AccessDecisionVoter.ACCESS_DENIED; - } - else - { - return AccessDecisionVoter.ACCESS_ABSTAIN; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.impl; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; +import org.alfresco.service.cmr.repository.NodeRef; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Delete links capability. + * + * @author Roy Wetherall + */ +public class DeleteLinksCapability extends DeclarativeCapability +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public int evaluate(NodeRef nodeRef) + { + // no way to know ... + return AccessDecisionVoter.ACCESS_ABSTAIN; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + public int evaluate(NodeRef source, NodeRef target) + { + if (getFilePlanService().isFilePlanComponent(source) && + getFilePlanService().isFilePlanComponent(target)) + { + if (checkConditions(source) && + checkConditions(target) && + checkPermissions(source) && + checkPermissions(target)) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + return AccessDecisionVoter.ACCESS_DENIED; + } + else + { + return AccessDecisionVoter.ACCESS_ABSTAIN; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java index f9782f3ab6..82624de3d2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java @@ -1,72 +1,72 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.impl; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Edit non record metadata capability - * - * @author Roy Wetherall - * @since 2.3 - */ -public class EditNonRecordMetadataCapability extends DeclarativeCapability -{ - /** transaction resource helper */ - private TransactionalResourceHelper transactionalResourceHelper; - - /** - * @param transactionalResourceHelper transaction resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - @Override - public int evaluate(NodeRef nodeRef) - { - // check if this node is a new record - if (transactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS).contains(nodeRef)) - { - // since this is a new record created within this transaction, ignore the usual capability check - // under the assumption that the user has CreateRecord - // @see https://issues.alfresco.com/jira/browse/RM-1956 - return AccessDecisionVoter.ACCESS_GRANTED; - } - - return super.evaluate(nodeRef); - } - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.impl; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; +import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl; +import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; +import org.alfresco.service.cmr.repository.NodeRef; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Edit non record metadata capability + * + * @author Roy Wetherall + * @since 2.3 + */ +public class EditNonRecordMetadataCapability extends DeclarativeCapability +{ + /** transaction resource helper */ + private TransactionalResourceHelper transactionalResourceHelper; + + /** + * @param transactionalResourceHelper transaction resource helper + */ + public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) + { + this.transactionalResourceHelper = transactionalResourceHelper; + } + + @Override + public int evaluate(NodeRef nodeRef) + { + // check if this node is a new record + if (transactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS).contains(nodeRef)) + { + // since this is a new record created within this transaction, ignore the usual capability check + // under the assumption that the user has CreateRecord + // @see https://issues.alfresco.com/jira/browse/RM-1956 + return AccessDecisionVoter.ACCESS_GRANTED; + } + + return super.evaluate(nodeRef); + } + + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/UpdateCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/UpdateCapability.java index 5fc9f589f9..e709521a8d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/UpdateCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/UpdateCapability.java @@ -1,56 +1,56 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.impl; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCompositeCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Update capability implementation. - * - * @author andyh - */ -public class UpdateCapability extends DeclarativeCompositeCapability -{ - /** - * Evaluate capability - * - * @param nodeRef node reference - * @param aspectQName aspect qname - * @param properties property values - * @return - */ - public int evaluate(NodeRef nodeRef, QName aspectQName, Map properties) - { - return evaluate(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.impl; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCompositeCapability; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Update capability implementation. + * + * @author andyh + */ +public class UpdateCapability extends DeclarativeCompositeCapability +{ + /** + * Evaluate capability + * + * @param nodeRef node reference + * @param aspectQName aspect qname + * @param properties property values + * @return + */ + public int evaluate(NodeRef nodeRef, QName aspectQName, Map properties) + { + return evaluate(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java index e4660ecc1e..eda1dc0748 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.impl; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -public final class ViewRecordsCapability extends DeclarativeCapability -{ - /** capability name */ - public static final String NAME = "ViewRecords"; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef) - */ - public int evaluate(NodeRef nodeRef) - { - if (nodeRef != null) - { - if (getFilePlanService().isFilePlanComponent(nodeRef)) - { - return checkRmRead(nodeRef); - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("View Records capability abstains, because node is not a file plan component. (nodeRef=" + nodeRef.toString() + ")"); - } - } - } - - return AccessDecisionVoter.ACCESS_ABSTAIN; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.impl; + +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; +import org.alfresco.service.cmr.repository.NodeRef; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +public final class ViewRecordsCapability extends DeclarativeCapability +{ + /** capability name */ + public static final String NAME = "ViewRecords"; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef) + */ + public int evaluate(NodeRef nodeRef) + { + if (nodeRef != null) + { + if (getFilePlanService().isFilePlanComponent(nodeRef)) + { + return checkRmRead(nodeRef); + } + else + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("View Records capability abstains, because node is not a file plan component. (nodeRef=" + nodeRef.toString() + ")"); + } + } + } + + return AccessDecisionVoter.ACCESS_ABSTAIN; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java index 78780b8970..865981dd35 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java @@ -1,201 +1,201 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.PolicyRegister; -import org.alfresco.module.org_alfresco_module_rm.capability.RMSecurityCommon; -import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.aopalliance.intercept.MethodInvocation; - -/** - * Abstract base policy implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class AbstractBasePolicy extends RMSecurityCommon - implements Policy -{ - /** Capability service */ - private CapabilityService capabilityService; - - /** Policy register */ - private PolicyRegister policyRegister; - - /** Policy name */ - private String name; - - /** - * @param name policy name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy#getName() - */ - @Override - public String getName() - { - return name; - } - - /** - * @return Capability service - */ - protected CapabilityService getCapabilityService() - { - return this.capabilityService; - } - - /** - * @return Policy register - */ - protected PolicyRegister getPolicyRegister() - { - return this.policyRegister; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param policyRegister policy register - */ - public void setPolicyRegister(PolicyRegister policyRegister) - { - this.policyRegister = policyRegister; - } - - /** - * Init method - */ - public void init() - { - getPolicyRegister().registerPolicy(this); - } - - /** - * - * @param invocation - * @param params - * @param position - * @param parent - * @return - */ - @SuppressWarnings("rawtypes") - protected QName getType(MethodInvocation invocation, Class[] params, int position, boolean parent) - { - if (QName.class.isAssignableFrom(params[position])) - { - if (invocation.getArguments()[position] != null) - { - return (QName) invocation.getArguments()[position]; - } - } - else if (NodeRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - NodeRef nodeRef = (NodeRef) invocation.getArguments()[position]; - return nodeService.getType(nodeRef); - } - - return null; - } - - /** - * - * @param invocation - * @param params - * @param position - * @return - */ - @SuppressWarnings("rawtypes") - protected QName getQName(MethodInvocation invocation, Class[] params, int position) - { - if (QName.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - return (QName) invocation.getArguments()[position]; - } - throw new ACLEntryVoterException("Unknown type"); - } - - /** - * - * @param invocation - * @param params - * @param position - * @return - */ - @SuppressWarnings("rawtypes") - protected Serializable getProperty(MethodInvocation invocation, Class[] params, int position) - { - if (invocation.getArguments()[position] == null) - { - return null; - } - if (Serializable.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - return (Serializable) invocation.getArguments()[position]; - } - throw new ACLEntryVoterException("Unknown type"); - } - - /** - * - * @param invocation - * @param params - * @param position - * @return - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected Map getProperties(MethodInvocation invocation, Class[] params, int position) - { - if (invocation.getArguments()[position] == null) - { - return null; - } - if (Map.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) - { - return (Map) invocation.getArguments()[position]; - } - throw new ACLEntryVoterException("Unknown type"); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.capability.PolicyRegister; +import org.alfresco.module.org_alfresco_module_rm.capability.RMSecurityCommon; +import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.aopalliance.intercept.MethodInvocation; + +/** + * Abstract base policy implementation + * + * @author Roy Wetherall + * @since 2.1 + */ +public abstract class AbstractBasePolicy extends RMSecurityCommon + implements Policy +{ + /** Capability service */ + private CapabilityService capabilityService; + + /** Policy register */ + private PolicyRegister policyRegister; + + /** Policy name */ + private String name; + + /** + * @param name policy name + */ + public void setName(String name) + { + this.name = name; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy#getName() + */ + @Override + public String getName() + { + return name; + } + + /** + * @return Capability service + */ + protected CapabilityService getCapabilityService() + { + return this.capabilityService; + } + + /** + * @return Policy register + */ + protected PolicyRegister getPolicyRegister() + { + return this.policyRegister; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param policyRegister policy register + */ + public void setPolicyRegister(PolicyRegister policyRegister) + { + this.policyRegister = policyRegister; + } + + /** + * Init method + */ + public void init() + { + getPolicyRegister().registerPolicy(this); + } + + /** + * + * @param invocation + * @param params + * @param position + * @param parent + * @return + */ + @SuppressWarnings("rawtypes") + protected QName getType(MethodInvocation invocation, Class[] params, int position, boolean parent) + { + if (QName.class.isAssignableFrom(params[position])) + { + if (invocation.getArguments()[position] != null) + { + return (QName) invocation.getArguments()[position]; + } + } + else if (NodeRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) + { + NodeRef nodeRef = (NodeRef) invocation.getArguments()[position]; + return nodeService.getType(nodeRef); + } + + return null; + } + + /** + * + * @param invocation + * @param params + * @param position + * @return + */ + @SuppressWarnings("rawtypes") + protected QName getQName(MethodInvocation invocation, Class[] params, int position) + { + if (QName.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) + { + return (QName) invocation.getArguments()[position]; + } + throw new ACLEntryVoterException("Unknown type"); + } + + /** + * + * @param invocation + * @param params + * @param position + * @return + */ + @SuppressWarnings("rawtypes") + protected Serializable getProperty(MethodInvocation invocation, Class[] params, int position) + { + if (invocation.getArguments()[position] == null) + { + return null; + } + if (Serializable.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) + { + return (Serializable) invocation.getArguments()[position]; + } + throw new ACLEntryVoterException("Unknown type"); + } + + /** + * + * @param invocation + * @param params + * @param position + * @return + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected Map getProperties(MethodInvocation invocation, Class[] params, int position) + { + if (invocation.getArguments()[position] == null) + { + return null; + } + if (Map.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null) + { + return (Map) invocation.getArguments()[position]; + } + throw new ACLEntryVoterException("Unknown type"); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java index 9c154ca7ee..5c3dce8af7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java @@ -1,47 +1,47 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -public class AssocPolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; +import org.alfresco.service.cmr.repository.NodeRef; +import org.aopalliance.intercept.MethodInvocation; + +public class AssocPolicy extends AbstractBasePolicy +{ + + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ConfigAttributeDefinition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ConfigAttributeDefinition.java index eb74e29b6d..0513c747cc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ConfigAttributeDefinition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ConfigAttributeDefinition.java @@ -1,155 +1,155 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import java.util.HashMap; -import java.util.Map; -import java.util.StringTokenizer; - -import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; -import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; -import org.alfresco.service.namespace.NamespacePrefixResolver; -import org.alfresco.service.namespace.QName; - -import net.sf.acegisecurity.ConfigAttribute; - -/** - * RM security configuration definition. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ConfigAttributeDefinition -{ - /** allowable RM security configurations */ - public static final String RM = "RM"; - public static final String RM_ALLOW = "RM_ALLOW"; - public static final String RM_DENY = "RM_DENY"; - public static final String RM_CAP = "RM_CAP"; - public static final String RM_ABSTAIN = "RM_ABSTAIN"; - public static final String RM_QUERY = "RM_QUERY"; - - /** security type */ - private String typeString; - - /** policy name */ - private String policyName; - - /** simple permission reference */ - private SimplePermissionReference required; - - /** parameter position map */ - private Map parameters = new HashMap(2, 1.0f); - - /** is parent */ - private boolean parent = false; - - /** - * Default constructor - * - * @param attr configuration attribute instance - * @param namespacePrefixResolver namespace prefix resolver - */ - public ConfigAttributeDefinition(ConfigAttribute attr, NamespacePrefixResolver namespacePrefixResolver) - { - // tokenize configuration string - StringTokenizer st = new StringTokenizer(attr.getAttribute(), ".", false); - if (st.countTokens() < 1) - { - throw new ACLEntryVoterException("There must be at least one token in a config attribute"); - } - typeString = st.nextToken(); - - // check that the configuration is valid - if (!(typeString.equals(RM) || - typeString.equals(RM_ALLOW) || - typeString.equals(RM_CAP) || - typeString.equals(RM_DENY) || - typeString.equals(RM_QUERY) || - typeString.equals(RM_ABSTAIN))) - { - throw new ACLEntryVoterException("Invalid type: must be ACL_NODE, ACL_PARENT or ACL_ALLOW"); - } - - if (typeString.equals(RM)) - { - policyName = st.nextToken(); - int position = 0; - while (st.hasMoreElements()) - { - String numberString = st.nextToken(); - Integer value = Integer.parseInt(numberString); - parameters.put(position, value); - position++; - } - } - else if (typeString.equals(RM_CAP)) - { - String numberString = st.nextToken(); - String qNameString = st.nextToken(); - String permissionString = st.nextToken(); - - Integer value = Integer.parseInt(numberString); - parameters.put(0, value); - - QName qName = QName.createQName(qNameString, namespacePrefixResolver); - - required = SimplePermissionReference.getPermissionReference(qName, permissionString); - - if (st.hasMoreElements()) - { - parent = true; - } - } - } - - public String getTypeString() - { - return typeString; - } - - public String getPolicyName() - { - return policyName; - } - - public SimplePermissionReference getRequired() - { - return required; - } - - public Map getParameters() - { - return parameters; - } - - public boolean isParent() - { - return parent; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; + +import org.alfresco.repo.security.permissions.impl.SimplePermissionReference; +import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; +import org.alfresco.service.namespace.NamespacePrefixResolver; +import org.alfresco.service.namespace.QName; + +import net.sf.acegisecurity.ConfigAttribute; + +/** + * RM security configuration definition. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ConfigAttributeDefinition +{ + /** allowable RM security configurations */ + public static final String RM = "RM"; + public static final String RM_ALLOW = "RM_ALLOW"; + public static final String RM_DENY = "RM_DENY"; + public static final String RM_CAP = "RM_CAP"; + public static final String RM_ABSTAIN = "RM_ABSTAIN"; + public static final String RM_QUERY = "RM_QUERY"; + + /** security type */ + private String typeString; + + /** policy name */ + private String policyName; + + /** simple permission reference */ + private SimplePermissionReference required; + + /** parameter position map */ + private Map parameters = new HashMap(2, 1.0f); + + /** is parent */ + private boolean parent = false; + + /** + * Default constructor + * + * @param attr configuration attribute instance + * @param namespacePrefixResolver namespace prefix resolver + */ + public ConfigAttributeDefinition(ConfigAttribute attr, NamespacePrefixResolver namespacePrefixResolver) + { + // tokenize configuration string + StringTokenizer st = new StringTokenizer(attr.getAttribute(), ".", false); + if (st.countTokens() < 1) + { + throw new ACLEntryVoterException("There must be at least one token in a config attribute"); + } + typeString = st.nextToken(); + + // check that the configuration is valid + if (!(typeString.equals(RM) || + typeString.equals(RM_ALLOW) || + typeString.equals(RM_CAP) || + typeString.equals(RM_DENY) || + typeString.equals(RM_QUERY) || + typeString.equals(RM_ABSTAIN))) + { + throw new ACLEntryVoterException("Invalid type: must be ACL_NODE, ACL_PARENT or ACL_ALLOW"); + } + + if (typeString.equals(RM)) + { + policyName = st.nextToken(); + int position = 0; + while (st.hasMoreElements()) + { + String numberString = st.nextToken(); + Integer value = Integer.parseInt(numberString); + parameters.put(position, value); + position++; + } + } + else if (typeString.equals(RM_CAP)) + { + String numberString = st.nextToken(); + String qNameString = st.nextToken(); + String permissionString = st.nextToken(); + + Integer value = Integer.parseInt(numberString); + parameters.put(0, value); + + QName qName = QName.createQName(qNameString, namespacePrefixResolver); + + required = SimplePermissionReference.getPermissionReference(qName, permissionString); + + if (st.hasMoreElements()) + { + parent = true; + } + } + } + + public String getTypeString() + { + return typeString; + } + + public String getPolicyName() + { + return policyName; + } + + public SimplePermissionReference getRequired() + { + return required; + } + + public Map getParameters() + { + return parameters; + } + + public boolean isParent() + { + return parent; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/CreatePolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/CreatePolicy.java index 0145054d37..1cbdbeabef 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/CreatePolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/CreatePolicy.java @@ -1,64 +1,64 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.alfresco.module.org_alfresco_module_rm.capability.impl.CreateCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.aopalliance.intercept.MethodInvocation; - -public class CreatePolicy extends AbstractBasePolicy -{ - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef linkee = null; - QName assocType = null; - - // get the destination node - NodeRef destination = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - - if (cad.getParameters().size() > 1) - { - // get the linkee when present - linkee = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent()); - - // get the assoc type - if(cad.getParameters().size() > 2) - { - assocType = getType(invocation, params, cad.getParameters().get(2), cad.isParent()); - } - } - - return ((CreateCapability) getCapabilityService().getCapability("Create")).evaluate(destination, linkee, assocType); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.alfresco.module.org_alfresco_module_rm.capability.impl.CreateCapability; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.aopalliance.intercept.MethodInvocation; + +public class CreatePolicy extends AbstractBasePolicy +{ + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + NodeRef linkee = null; + QName assocType = null; + + // get the destination node + NodeRef destination = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + + if (cad.getParameters().size() > 1) + { + // get the linkee when present + linkee = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent()); + + // get the assoc type + if(cad.getParameters().size() > 2) + { + assocType = getType(invocation, params, cad.getParameters().get(2), cad.isParent()); + } + } + + return ((CreateCapability) getCapabilityService().getCapability("Create")).evaluate(destination, linkee, assocType); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeclarePolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeclarePolicy.java index 4fe971731f..43e0ca12cd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeclarePolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeclarePolicy.java @@ -1,46 +1,46 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -public class DeclarePolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef declaree = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability("Declare").evaluate(declaree); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.aopalliance.intercept.MethodInvocation; + +public class DeclarePolicy extends AbstractBasePolicy +{ + + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + NodeRef declaree = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + return getCapabilityService().getCapability("Declare").evaluate(declaree); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeletePolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeletePolicy.java index 402ca30902..0269dba286 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeletePolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/DeletePolicy.java @@ -1,61 +1,61 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -public class DeletePolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef deletee = null; - if (cad.getParameters().get(0) > -1) - { - deletee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - } - if (deletee != null) - { - - return getCapabilityService().getCapability("Delete").evaluate(deletee); - - } - else - { - return AccessDecisionVoter.ACCESS_DENIED; - } - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.aopalliance.intercept.MethodInvocation; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +public class DeletePolicy extends AbstractBasePolicy +{ + + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + NodeRef deletee = null; + if (cad.getParameters().get(0) > -1) + { + deletee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + } + if (deletee != null) + { + + return getCapabilityService().getCapability("Delete").evaluate(deletee); + + } + else + { + return AccessDecisionVoter.ACCESS_DENIED; + } + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/MovePolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/MovePolicy.java index b7e61ed53d..c09e5726cc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/MovePolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/MovePolicy.java @@ -1,86 +1,86 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.aopalliance.intercept.MethodInvocation; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -public class MovePolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - - NodeRef movee = null; - if (cad.getParameters().get(0) > -1) - { - movee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - } - - NodeRef destination = null; - if (cad.getParameters().get(1) > -1) - { - destination = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent()); - } - - if ((movee != null) && (destination != null)) - { - // check that we aren't trying to move something from the DM into RM - if (nodeService.hasAspect(movee, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - return getCapabilityService().getCapability("Move").evaluate(movee, destination); - } - else - { - if (nodeService.hasAspect(destination, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && - permissionService.hasPermission(destination, RMPermissionModel.FILING).equals(AccessStatus.ALLOWED)) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - else - { - return AccessDecisionVoter.ACCESS_DENIED; - } - } - } - else - { - return AccessDecisionVoter.ACCESS_DENIED; - } - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.aopalliance.intercept.MethodInvocation; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +public class MovePolicy extends AbstractBasePolicy +{ + + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + + NodeRef movee = null; + if (cad.getParameters().get(0) > -1) + { + movee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + } + + NodeRef destination = null; + if (cad.getParameters().get(1) > -1) + { + destination = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent()); + } + + if ((movee != null) && (destination != null)) + { + // check that we aren't trying to move something from the DM into RM + if (nodeService.hasAspect(movee, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) + { + return getCapabilityService().getCapability("Move").evaluate(movee, destination); + } + else + { + if (nodeService.hasAspect(destination, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && + permissionService.hasPermission(destination, RMPermissionModel.FILING).equals(AccessStatus.ALLOWED)) + { + return AccessDecisionVoter.ACCESS_GRANTED; + } + else + { + return AccessDecisionVoter.ACCESS_DENIED; + } + } + } + else + { + return AccessDecisionVoter.ACCESS_DENIED; + } + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/Policy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/Policy.java index d78a1b5709..c10fe50e13 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/Policy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/Policy.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.aopalliance.intercept.MethodInvocation; - -/** - * Policy interface - * - * @author Roy Wetherall - * @since 2.1 - */ -public interface Policy -{ - /** - * @return policy name - */ - String getName(); - - /** - * Evaluate the policy - * - * @param invocation - * @param params - * @param cad - * @return - */ - @SuppressWarnings("rawtypes") - int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.aopalliance.intercept.MethodInvocation; + +/** + * Policy interface + * + * @author Roy Wetherall + * @since 2.1 + */ +public interface Policy +{ + /** + * @return policy name + */ + String getName(); + + /** + * Evaluate the policy + * + * @param invocation + * @param params + * @param cad + * @return + */ + @SuppressWarnings("rawtypes") + int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java index eeabc8ff30..c4fdd8fc4b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -/** - * Read method security policy. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ReadPolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; +import org.alfresco.service.cmr.repository.NodeRef; +import org.aopalliance.intercept.MethodInvocation; + +/** + * Read method security policy. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ReadPolicy extends AbstractBasePolicy +{ + + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePolicy.java index 879a1f06d8..ae980f869d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePolicy.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.impl.UpdateCapability; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.aopalliance.intercept.MethodInvocation; - -public class UpdatePolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - QName aspectQName = null; - if (cad.getParameters().size() > 1 && cad.getParameters().get(1) > -1) - { - aspectQName = getQName(invocation, params, cad.getParameters().get(1)); - } - Map properties = null; - if (cad.getParameters().size() > 2 && cad.getParameters().get(2) > -1) - { - properties = getProperties(invocation, params, cad.getParameters().get(2)); - } - - UpdateCapability updateCapability = (UpdateCapability) getCapabilityService().getCapability("Update"); - return updateCapability.evaluate(updatee, aspectQName, properties); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.capability.impl.UpdateCapability; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.aopalliance.intercept.MethodInvocation; + +public class UpdatePolicy extends AbstractBasePolicy +{ + + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + QName aspectQName = null; + if (cad.getParameters().size() > 1 && cad.getParameters().get(1) > -1) + { + aspectQName = getQName(invocation, params, cad.getParameters().get(1)); + } + Map properties = null; + if (cad.getParameters().size() > 2 && cad.getParameters().get(2) > -1) + { + properties = getProperties(invocation, params, cad.getParameters().get(2)); + } + + UpdateCapability updateCapability = (UpdateCapability) getCapabilityService().getCapability("Update"); + return updateCapability.evaluate(updatee, aspectQName, properties); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java index 696556dbb8..8cffbabd0a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java @@ -1,44 +1,44 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -public class UpdatePropertiesPolicy extends AbstractBasePolicy -{ - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability("UpdateProperties").evaluate(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.aopalliance.intercept.MethodInvocation; + +public class UpdatePropertiesPolicy extends AbstractBasePolicy +{ + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + return getCapabilityService().getCapability("UpdateProperties").evaluate(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/WriteContentPolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/WriteContentPolicy.java index cf56d5ab02..e6cab0b9ba 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/WriteContentPolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/WriteContentPolicy.java @@ -1,46 +1,46 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.policy; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; - -public class WriteContentPolicy extends AbstractBasePolicy -{ - - @SuppressWarnings("rawtypes") - public int evaluate( - MethodInvocation invocation, - Class[] params, - ConfigAttributeDefinition cad) - { - NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability("WriteContent").evaluate(updatee); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.policy; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.aopalliance.intercept.MethodInvocation; + +public class WriteContentPolicy extends AbstractBasePolicy +{ + + @SuppressWarnings("rawtypes") + public int evaluate( + MethodInvocation invocation, + Class[] params, + ConfigAttributeDefinition cad) + { + NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); + return getCapabilityService().getCapability("WriteContent").evaluate(updatee); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/ContentDestructionComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/ContentDestructionComponent.java index 50d29e5765..440f50712f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/ContentDestructionComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/ContentDestructionComponent.java @@ -1,246 +1,246 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.content; - -import java.io.Serializable; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.RenditionModel; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Content destruction component. - * - * @author Roy Wetherall - * @since 2.4.a - */ -@BehaviourBean -public class ContentDestructionComponent -{ - /** eager content store cleaner */ - private EagerContentStoreCleaner eagerContentStoreCleaner; - - /** dictionary service */ - private DictionaryService dictionaryService; - - /** node service */ - private NodeService nodeService; - - /** behaviour filter */ - private BehaviourFilter behaviourFilter; - - /** indicates whether cleansing is enabled or not */ - private boolean cleansingEnabled = false; - - /** - * @return the eagerContentStoreCleaner - */ - protected EagerContentStoreCleaner getEagerContentStoreCleaner() - { - return this.eagerContentStoreCleaner; - } - - /** - * @return the dictionaryService - */ - protected DictionaryService getDictionaryService() - { - return this.dictionaryService; - } - - /** - * @return the nodeService - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * @return the behaviourFilter - */ - protected BehaviourFilter getBehaviourFilter() - { - return this.behaviourFilter; - } - - /** - * @return true if cleansing is enabled, false otherwise - */ - public boolean isCleansingEnabled() - { - return cleansingEnabled; - } - - /** - * @param eagerContentStoreCleaner eager content store cleaner - */ - public void setEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner) - { - this.eagerContentStoreCleaner = eagerContentStoreCleaner; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param behaviourFilter behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @param cleansingEnabled true if cleansing enabled, false otherwise - */ - public void setCleansingEnabled(boolean cleansingEnabled) - { - this.cleansingEnabled = cleansingEnabled; - } - - /** - * Destroy content - * - * @param nodeRef - */ - public void destroyContent(NodeRef nodeRef) - { - destroyContent(nodeRef, true); - } - - /** - * Destroy content - * - * @param nodeRef - * @param includeRenditions - */ - @SuppressWarnings("deprecation") - public void destroyContent(NodeRef nodeRef, boolean includeRenditions) - { - // destroy the nodes content properties - registerAllContentForDestruction(nodeRef, true); - - // Remove the renditioned aspect (and its properties and associations) if it is present. - // - // From Alfresco 3.3 it is the rn:renditioned aspect which defines the - // child-association being considered in this method. - // Note also that the cm:thumbnailed aspect extends the rn:renditioned aspect. - // - // We want to remove the rn:renditioned aspect, but due to the possibility - // that there is Alfresco 3.2-era data with the cm:thumbnailed aspect - // applied, we must consider removing it too. - if (includeRenditions - && (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED) - || getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED))) - { - // get the rendition assoc types - Set childAssocTypes = dictionaryService.getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet(); - for (ChildAssociationRef child : getNodeService().getChildAssocs(nodeRef)) - { - if (childAssocTypes.contains(child.getTypeQName())) - { - // destroy renditions content - destroyContent(child.getChildRef(), false); - - //delete the rendition node - getNodeService().deleteNode(child.getChildRef()); - } - } - } - } - - /** - * Registers all content on the given node for destruction. - * - * @param nodeRef node reference - * @param clearContentProperty if true then clear content property, otherwise false - */ - protected void registerAllContentForDestruction(NodeRef nodeRef, boolean clearContentProperty) - { - Map properties = getNodeService().getProperties(nodeRef); - - for (Map.Entry entry : properties.entrySet()) - { - if (entry.getValue() instanceof ContentData) - { - // get content data - ContentData dataContent = (ContentData)entry.getValue(); - - // if enabled cleanse content - if (isCleansingEnabled()) - { - // register for cleanse then immediate destruction - getEagerContentStoreCleaner().registerOrphanedContentUrlForCleansing(dataContent.getContentUrl()); - } - else - { - // register for immediate destruction - getEagerContentStoreCleaner().registerOrphanedContentUrl(dataContent.getContentUrl(), true); - } - - // clear the property - if (clearContentProperty) - { - // disable behaviours to ensure no side effects - behaviourFilter.disableBehaviour(); - try - { - getNodeService().removeProperty(nodeRef, entry.getKey()); - } - finally - { - behaviourFilter.enableBehaviour(); - } - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.content; + +import java.io.Serializable; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.model.RenditionModel; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; + +/** + * Content destruction component. + * + * @author Roy Wetherall + * @since 2.4.a + */ +@BehaviourBean +public class ContentDestructionComponent +{ + /** eager content store cleaner */ + private EagerContentStoreCleaner eagerContentStoreCleaner; + + /** dictionary service */ + private DictionaryService dictionaryService; + + /** node service */ + private NodeService nodeService; + + /** behaviour filter */ + private BehaviourFilter behaviourFilter; + + /** indicates whether cleansing is enabled or not */ + private boolean cleansingEnabled = false; + + /** + * @return the eagerContentStoreCleaner + */ + protected EagerContentStoreCleaner getEagerContentStoreCleaner() + { + return this.eagerContentStoreCleaner; + } + + /** + * @return the dictionaryService + */ + protected DictionaryService getDictionaryService() + { + return this.dictionaryService; + } + + /** + * @return the nodeService + */ + protected NodeService getNodeService() + { + return this.nodeService; + } + + /** + * @return the behaviourFilter + */ + protected BehaviourFilter getBehaviourFilter() + { + return this.behaviourFilter; + } + + /** + * @return true if cleansing is enabled, false otherwise + */ + public boolean isCleansingEnabled() + { + return cleansingEnabled; + } + + /** + * @param eagerContentStoreCleaner eager content store cleaner + */ + public void setEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner) + { + this.eagerContentStoreCleaner = eagerContentStoreCleaner; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param behaviourFilter behaviour filter + */ + public void setBehaviourFilter(BehaviourFilter behaviourFilter) + { + this.behaviourFilter = behaviourFilter; + } + + /** + * @param cleansingEnabled true if cleansing enabled, false otherwise + */ + public void setCleansingEnabled(boolean cleansingEnabled) + { + this.cleansingEnabled = cleansingEnabled; + } + + /** + * Destroy content + * + * @param nodeRef + */ + public void destroyContent(NodeRef nodeRef) + { + destroyContent(nodeRef, true); + } + + /** + * Destroy content + * + * @param nodeRef + * @param includeRenditions + */ + @SuppressWarnings("deprecation") + public void destroyContent(NodeRef nodeRef, boolean includeRenditions) + { + // destroy the nodes content properties + registerAllContentForDestruction(nodeRef, true); + + // Remove the renditioned aspect (and its properties and associations) if it is present. + // + // From Alfresco 3.3 it is the rn:renditioned aspect which defines the + // child-association being considered in this method. + // Note also that the cm:thumbnailed aspect extends the rn:renditioned aspect. + // + // We want to remove the rn:renditioned aspect, but due to the possibility + // that there is Alfresco 3.2-era data with the cm:thumbnailed aspect + // applied, we must consider removing it too. + if (includeRenditions + && (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED) + || getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED))) + { + // get the rendition assoc types + Set childAssocTypes = dictionaryService.getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet(); + for (ChildAssociationRef child : getNodeService().getChildAssocs(nodeRef)) + { + if (childAssocTypes.contains(child.getTypeQName())) + { + // destroy renditions content + destroyContent(child.getChildRef(), false); + + //delete the rendition node + getNodeService().deleteNode(child.getChildRef()); + } + } + } + } + + /** + * Registers all content on the given node for destruction. + * + * @param nodeRef node reference + * @param clearContentProperty if true then clear content property, otherwise false + */ + protected void registerAllContentForDestruction(NodeRef nodeRef, boolean clearContentProperty) + { + Map properties = getNodeService().getProperties(nodeRef); + + for (Map.Entry entry : properties.entrySet()) + { + if (entry.getValue() instanceof ContentData) + { + // get content data + ContentData dataContent = (ContentData)entry.getValue(); + + // if enabled cleanse content + if (isCleansingEnabled()) + { + // register for cleanse then immediate destruction + getEagerContentStoreCleaner().registerOrphanedContentUrlForCleansing(dataContent.getContentUrl()); + } + else + { + // register for immediate destruction + getEagerContentStoreCleaner().registerOrphanedContentUrl(dataContent.getContentUrl(), true); + } + + // clear the property + if (clearContentProperty) + { + // disable behaviours to ensure no side effects + behaviourFilter.disableBehaviour(); + try + { + getNodeService().removeProperty(nodeRef, entry.getKey()); + } + finally + { + behaviourFilter.enableBehaviour(); + } + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java index 7af130d8c0..23b0a128b5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleaner.java @@ -1,172 +1,172 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.content; - -import java.io.File; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.repo.content.ContentStore; -import org.alfresco.repo.content.filestore.FileContentReader; -import org.alfresco.service.cmr.repository.ContentReader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Eager content store cleaner that allows content to be registered for cleansing before - * destruction. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class EagerContentStoreCleaner extends org.alfresco.repo.content.cleanup.EagerContentStoreCleaner -{ - /** transaction resource key */ - protected static final String KEY_POST_COMMIT_CLEANSING_URLS = "postCommitCleansingUrls"; - - /** logger */ - private static Log logger = LogFactory.getLog(EagerContentStoreCleaner.class); - - /** transactional resource helper */ - private TransactionalResourceHelper transactionalResourceHelper; - - /** content cleanser */ - private ContentCleanser contentCleanser; - - /** - * @param transactionResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - /** - * @param contentCleanser content cleanser - */ - public void setContentCleanser(ContentCleanser contentCleanser) - { - this.contentCleanser = contentCleanser; - } - - /** - * Registers orphaned content URLs for cleansing - * - * @param contentUrl content url - */ - public void registerOrphanedContentUrlForCleansing(String contentUrl) - { - // make note of content that needs cleansing - Set cleansingUrls = transactionalResourceHelper.getSet(KEY_POST_COMMIT_CLEANSING_URLS); - cleansingUrls.add(contentUrl); - - // register as usual - registerOrphanedContentUrl(contentUrl, true); - } - - /** - * @see org.alfresco.repo.content.cleanup.EagerContentStoreCleaner#deleteFromStore(java.lang.String, org.alfresco.repo.content.ContentStore) - */ - @Override - protected boolean deleteFromStore(String contentUrl, ContentStore store) - { - // determine if the content requires cleansing or not - Set cleansingUrls = transactionalResourceHelper.getSet(KEY_POST_COMMIT_CLEANSING_URLS); - if (cleansingUrls.contains(contentUrl)) - { - // cleanse content before delete - cleanseContent(contentUrl, store); - } - - // delete from store - return super.deleteFromStore(contentUrl, store); - } - - /** - * Cleanse content - * - * @param contentUrl content url - * @param store content store - */ - private void cleanseContent(String contentUrl, ContentStore store) - { - if (contentCleanser == null) - { - logger.error( - "No content cleanser specified. Unable to cleanse: \n" + - " URL: " + contentUrl + "\n" + - " Source: " + store); - } - else - { - // First check if the content is present at all - ContentReader reader = store.getReader(contentUrl); - if (reader != null && reader.exists()) - { - // Call to implementation's shred - if (logger.isDebugEnabled()) - { - logger.debug( - "About to cleanse: \n" + - " URL: " + contentUrl + "\n" + - " Source: " + store); - } - try - { - if (reader instanceof FileContentReader) - { - // get file content - FileContentReader fileReader = (FileContentReader) reader; - File file = fileReader.getFile(); - - // cleanse content - contentCleanser.cleanse(file); - } - } - catch (Exception e) - { - logger.error( - "Content cleansing failed: \n" + - " URL: " + contentUrl + "\n" + - " Source: " + store + "\n" + - " Reader: " + reader, - e); - } - } - else - { - logger.error( - "Content no longer exists. Unable to cleanse: \n" + - " URL: " + contentUrl + "\n" + - " Source: " + store); - } - } - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.content; + +import java.io.File; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser; +import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; +import org.alfresco.repo.content.ContentStore; +import org.alfresco.repo.content.filestore.FileContentReader; +import org.alfresco.service.cmr.repository.ContentReader; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Eager content store cleaner that allows content to be registered for cleansing before + * destruction. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class EagerContentStoreCleaner extends org.alfresco.repo.content.cleanup.EagerContentStoreCleaner +{ + /** transaction resource key */ + protected static final String KEY_POST_COMMIT_CLEANSING_URLS = "postCommitCleansingUrls"; + + /** logger */ + private static Log logger = LogFactory.getLog(EagerContentStoreCleaner.class); + + /** transactional resource helper */ + private TransactionalResourceHelper transactionalResourceHelper; + + /** content cleanser */ + private ContentCleanser contentCleanser; + + /** + * @param transactionResourceHelper transactional resource helper + */ + public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) + { + this.transactionalResourceHelper = transactionalResourceHelper; + } + + /** + * @param contentCleanser content cleanser + */ + public void setContentCleanser(ContentCleanser contentCleanser) + { + this.contentCleanser = contentCleanser; + } + + /** + * Registers orphaned content URLs for cleansing + * + * @param contentUrl content url + */ + public void registerOrphanedContentUrlForCleansing(String contentUrl) + { + // make note of content that needs cleansing + Set cleansingUrls = transactionalResourceHelper.getSet(KEY_POST_COMMIT_CLEANSING_URLS); + cleansingUrls.add(contentUrl); + + // register as usual + registerOrphanedContentUrl(contentUrl, true); + } + + /** + * @see org.alfresco.repo.content.cleanup.EagerContentStoreCleaner#deleteFromStore(java.lang.String, org.alfresco.repo.content.ContentStore) + */ + @Override + protected boolean deleteFromStore(String contentUrl, ContentStore store) + { + // determine if the content requires cleansing or not + Set cleansingUrls = transactionalResourceHelper.getSet(KEY_POST_COMMIT_CLEANSING_URLS); + if (cleansingUrls.contains(contentUrl)) + { + // cleanse content before delete + cleanseContent(contentUrl, store); + } + + // delete from store + return super.deleteFromStore(contentUrl, store); + } + + /** + * Cleanse content + * + * @param contentUrl content url + * @param store content store + */ + private void cleanseContent(String contentUrl, ContentStore store) + { + if (contentCleanser == null) + { + logger.error( + "No content cleanser specified. Unable to cleanse: \n" + + " URL: " + contentUrl + "\n" + + " Source: " + store); + } + else + { + // First check if the content is present at all + ContentReader reader = store.getReader(contentUrl); + if (reader != null && reader.exists()) + { + // Call to implementation's shred + if (logger.isDebugEnabled()) + { + logger.debug( + "About to cleanse: \n" + + " URL: " + contentUrl + "\n" + + " Source: " + store); + } + try + { + if (reader instanceof FileContentReader) + { + // get file content + FileContentReader fileReader = (FileContentReader) reader; + File file = fileReader.getFile(); + + // cleanse content + contentCleanser.cleanse(file); + } + } + catch (Exception e) + { + logger.error( + "Content cleansing failed: \n" + + " URL: " + contentUrl + "\n" + + " Source: " + store + "\n" + + " Reader: " + reader, + e); + } + } + else + { + logger.error( + "Content no longer exists. Unable to cleanse: \n" + + " URL: " + contentUrl + "\n" + + " Source: " + store); + } + } + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser.java index d58456e886..a62e1778dd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser.java @@ -1,125 +1,125 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.content.cleanser; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Random; - -/** - * Content cleanser base implementation. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public abstract class ContentCleanser -{ - /** - * Cleanse file - * - * @param file file to cleanse - */ - public abstract void cleanse(File file); - - /** - * Overwrite files bytes with provided overwrite operation - * - * @param file file - * @param overwriteOperation overwrite operation - */ - protected void overwrite(File file, OverwriteOperation overwriteOperation) - { - // get the number of bytes - long bytes = file.length(); - try - { - // get an output stream - try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) - { - for (int i = 0; i < bytes; i++) - { - // overwrite byte - overwriteOperation.operation(os); - } - } - } - catch (IOException ioException) - { - // re-throw - throw new RuntimeException("Unable to overwrite file", ioException); - } - } - - /** - * Overwrite operation - */ - protected abstract class OverwriteOperation - { - public abstract void operation(OutputStream os) throws IOException; - } - - /** - * Overwrite with zeros operation - */ - protected OverwriteOperation overwriteZeros = new OverwriteOperation() - { - public void operation(OutputStream os) throws IOException - { - os.write(0); - } - }; - - /** - * Overwrite with ones operation - */ - protected OverwriteOperation overwriteOnes = new OverwriteOperation() - { - public void operation(OutputStream os) throws IOException - { - os.write(0xff); - } - }; - - /** - * Overwrite with random operation - */ - protected OverwriteOperation overwriteRandom = new OverwriteOperation() - { - private Random random = new Random(); - - public void operation(OutputStream os) throws IOException - { - byte[] randomByte = new byte[1]; - random.nextBytes(randomByte); - os.write(randomByte[0]); - } - }; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.content.cleanser; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Random; + +/** + * Content cleanser base implementation. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public abstract class ContentCleanser +{ + /** + * Cleanse file + * + * @param file file to cleanse + */ + public abstract void cleanse(File file); + + /** + * Overwrite files bytes with provided overwrite operation + * + * @param file file + * @param overwriteOperation overwrite operation + */ + protected void overwrite(File file, OverwriteOperation overwriteOperation) + { + // get the number of bytes + long bytes = file.length(); + try + { + // get an output stream + try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) + { + for (int i = 0; i < bytes; i++) + { + // overwrite byte + overwriteOperation.operation(os); + } + } + } + catch (IOException ioException) + { + // re-throw + throw new RuntimeException("Unable to overwrite file", ioException); + } + } + + /** + * Overwrite operation + */ + protected abstract class OverwriteOperation + { + public abstract void operation(OutputStream os) throws IOException; + } + + /** + * Overwrite with zeros operation + */ + protected OverwriteOperation overwriteZeros = new OverwriteOperation() + { + public void operation(OutputStream os) throws IOException + { + os.write(0); + } + }; + + /** + * Overwrite with ones operation + */ + protected OverwriteOperation overwriteOnes = new OverwriteOperation() + { + public void operation(OutputStream os) throws IOException + { + os.write(0xff); + } + }; + + /** + * Overwrite with random operation + */ + protected OverwriteOperation overwriteRandom = new OverwriteOperation() + { + private Random random = new Random(); + + public void operation(OutputStream os) throws IOException + { + byte[] randomByte = new byte[1]; + random.nextBytes(randomByte); + os.write(randomByte[0]); + } + }; +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022M.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022M.java index 1e720a27f6..da9380c7b1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022M.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022M.java @@ -1,59 +1,59 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.content.cleanser; - -import java.io.File; - -import org.alfresco.service.cmr.repository.ContentIOException; - -/** - * DoD 5220-22M data cleansing implementation. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class ContentCleanser522022M extends ContentCleanser -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) - */ - @Override - public void cleanse(File file) - { - // Double check - if (!file.exists() || !file.canWrite()) - { - throw new ContentIOException("Unable to write to file: " + file); - } - - // Overwite file - overwrite(file, overwriteOnes); - overwrite(file, overwriteZeros); - overwrite(file, overwriteRandom); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.content.cleanser; + +import java.io.File; + +import org.alfresco.service.cmr.repository.ContentIOException; + +/** + * DoD 5220-22M data cleansing implementation. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class ContentCleanser522022M extends ContentCleanser +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) + */ + @Override + public void cleanse(File file) + { + // Double check + if (!file.exists() || !file.canWrite()) + { + throw new ContentIOException("Unable to write to file: " + file); + } + + // Overwite file + overwrite(file, overwriteOnes); + overwrite(file, overwriteZeros); + overwrite(file, overwriteRandom); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSet.java index 4549ba796e..8e807d8789 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSet.java @@ -1,54 +1,54 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.dataset; - -public interface DataSet -{ - - /** - * Gets the label of the data set - * - * @return String the label of the data set - */ - String getLabel(); - - /** - * Gets the id of the data set - * - * @return String the id of the data set - */ - String getId(); - - /** - * Gets the path of the data set - * - * @return String the path of the data set - */ - String getPath(); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.dataset; + +public interface DataSet +{ + + /** + * Gets the label of the data set + * + * @return String the label of the data set + */ + String getLabel(); + + /** + * Gets the id of the data set + * + * @return String the id of the data set + */ + String getId(); + + /** + * Gets the path of the data set + * + * @return String the path of the data set + */ + String getPath(); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetBase.java index df541f7cc3..3d7c0653eb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetBase.java @@ -1,130 +1,130 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.dataset; - -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -public class DataSetBase implements DataSet -{ - - /** Data set service */ - private DataSetService dataSetService; - - /** Data set label */ - private String label; - - /** Data set id */ - private String id; - - /** Data set path */ - private String path; - - /** - * Sets the data set service - * - * @param dataSetService the data set service - */ - public void setDataSetService(DataSetService dataSetService) - { - this.dataSetService = dataSetService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getLabel() - */ - public String getLabel() - { - String label = this.label; - if (StringUtils.isBlank(label)) - { - String propertyKey = "dataset." + getId() + ".label"; - label = I18NUtil.getMessage(propertyKey); - if (StringUtils.isBlank(label)) - { - label = propertyKey; - } - } - return label; - } - - /** - * Sets the label of the data set service - * - * @param label the label - */ - public void setLabel(String label) - { - this.label = label; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getId() - */ - public String getId() - { - return this.id; - } - - /** - * Sets the id of the data set service - * - * @param id the id - */ - public void setId(String id) - { - this.id = id; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getPath() - */ - public String getPath() - { - return this.path; - } - - /** - * Sets the path of the data set service - * - * @param path the path - */ - public void setPath(String path) - { - this.path = path; - } - - /** - * Registers the data set implementation with the data set service. - */ - public void register() - { - this.dataSetService.register(this); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.dataset; + +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +public class DataSetBase implements DataSet +{ + + /** Data set service */ + private DataSetService dataSetService; + + /** Data set label */ + private String label; + + /** Data set id */ + private String id; + + /** Data set path */ + private String path; + + /** + * Sets the data set service + * + * @param dataSetService the data set service + */ + public void setDataSetService(DataSetService dataSetService) + { + this.dataSetService = dataSetService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getLabel() + */ + public String getLabel() + { + String label = this.label; + if (StringUtils.isBlank(label)) + { + String propertyKey = "dataset." + getId() + ".label"; + label = I18NUtil.getMessage(propertyKey); + if (StringUtils.isBlank(label)) + { + label = propertyKey; + } + } + return label; + } + + /** + * Sets the label of the data set service + * + * @param label the label + */ + public void setLabel(String label) + { + this.label = label; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getId() + */ + public String getId() + { + return this.id; + } + + /** + * Sets the id of the data set service + * + * @param id the id + */ + public void setId(String id) + { + this.id = id; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSet#getPath() + */ + public String getPath() + { + return this.path; + } + + /** + * Sets the path of the data set service + * + * @param path the path + */ + public void setPath(String path) + { + this.path = path; + } + + /** + * Registers the data set implementation with the data set service. + */ + public void register() + { + this.dataSetService.register(this); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java index a54e0fbce8..6734cbea76 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetService.java @@ -1,103 +1,103 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.dataset; - -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; - -public interface DataSetService -{ - - /** - * Register a data set implementation with the service - * - * @param dataSet the data set - */ - void register(DataSet dataSet); - - /** - * Gets the details of all available data sets. - * - * @return Map details of all available data sets - */ - Map getDataSets(); - - /** - * Gets the details of all available data sets for a file plan depending on - * the parameter "excludeLoaded". - * - * @param filePlan the file plan for which the details should be retrieved - * @param excludeLoaded if true only data sets will be retrieved which has - * not been loaded - * @return Map details of the available data sets for a - * specified file plan depending on the parameter "excludeLoaded". - * The result could also be an empty map - */ - Map getDataSets(NodeRef filePlan, boolean excludeLoaded); - - /** - * Gets the details of all loaded data sets for a specified file plan - * - * @param filePlan the file plan for which the loaded data sets should be - * retrieved - * @return Map details of all loaded data sets or an empty - * map if there has not been any data sets loaded for the specified - * file plan - */ - Map getLoadedDataSets(NodeRef filePlan); - - /** - * Loads the data set with the specified id into the specified file plan - * - * @param filePlan the file plan which the data set will load into - * @param dataSetId the id of the data set which will be imported - */ - void loadDataSet(NodeRef filePlan, String dataSetId); - - /** - * Checks if a data set exists with the given data set id - * - * @param dataSetId the id of the data set which will be checked - * @return true if the data set exists, false otherwise - */ - boolean existsDataSet(String dataSetId); - - /** - * Checks if a data set with the id "dataSetId" has been loaded into the - * specified file plan - * - * @param filePlan the file plan for which the check should be done - * @param dataSetId the id of the data set which should be checked if it has - * been loaded to the file plan - * @return true if the data set with the specified id has been loaded into - * the specified file plan, false otherwise - */ - boolean isLoadedDataSet(NodeRef filePlan, String dataSetId); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.dataset; + +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; + +public interface DataSetService +{ + + /** + * Register a data set implementation with the service + * + * @param dataSet the data set + */ + void register(DataSet dataSet); + + /** + * Gets the details of all available data sets. + * + * @return Map details of all available data sets + */ + Map getDataSets(); + + /** + * Gets the details of all available data sets for a file plan depending on + * the parameter "excludeLoaded". + * + * @param filePlan the file plan for which the details should be retrieved + * @param excludeLoaded if true only data sets will be retrieved which has + * not been loaded + * @return Map details of the available data sets for a + * specified file plan depending on the parameter "excludeLoaded". + * The result could also be an empty map + */ + Map getDataSets(NodeRef filePlan, boolean excludeLoaded); + + /** + * Gets the details of all loaded data sets for a specified file plan + * + * @param filePlan the file plan for which the loaded data sets should be + * retrieved + * @return Map details of all loaded data sets or an empty + * map if there has not been any data sets loaded for the specified + * file plan + */ + Map getLoadedDataSets(NodeRef filePlan); + + /** + * Loads the data set with the specified id into the specified file plan + * + * @param filePlan the file plan which the data set will load into + * @param dataSetId the id of the data set which will be imported + */ + void loadDataSet(NodeRef filePlan, String dataSetId); + + /** + * Checks if a data set exists with the given data set id + * + * @param dataSetId the id of the data set which will be checked + * @return true if the data set exists, false otherwise + */ + boolean existsDataSet(String dataSetId); + + /** + * Checks if a data set with the id "dataSetId" has been loaded into the + * specified file plan + * + * @param filePlan the file plan for which the check should be done + * @param dataSetId the id of the data set which should be checked if it has + * been loaded to the file plan + * @return true if the data set with the specified id has been loaded into + * the specified file plan, false otherwise + */ + boolean isLoadedDataSet(NodeRef filePlan, String dataSetId); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java index 2d7fe762f6..126cb34c3f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java @@ -1,524 +1,524 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.dataset; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.view.ImporterService; -import org.alfresco.service.cmr.view.Location; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class DataSetServiceImpl implements DataSetService, RecordsManagementModel -{ - - /** Logger */ - private static Log logger = LogFactory.getLog(DataSetServiceImpl.class); - - /** Registered data set implementations */ - private Map dataSets = new HashMap(); - - /** Spaces store */ - private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - /** Charset name */ - private static final String CHARSET_NAME = "UTF-8"; - - /** Importer service */ - private ImporterService importerService; - - /** Search service */ - private SearchService searchService; - - /** Node service */ - private NodeService nodeService; - - /** File plan service service */ - private FilePlanService filePlanService; - - /** Permission service */ - private PermissionService permissionService; - - /** Authority service */ - private AuthorityService authorityService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** Records management search behaviour */ - private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** - * Set importer service - * - * @param importerService the importer service - */ - public void setImporterService(ImporterService importerService) - { - this.importerService = importerService; - } - - /** - * Set search service - * - * @param searchService the search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * Set node service - * - * @param nodeService the node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set file plan service - * - * @param filePlanService the file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Set permission service - * - * @param permissionService the permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * Set authority service - * - * @param authorityService the authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * Set records management search behaviour - * - * @param recordsManagementSearchBehaviour the records management search - * behaviour - */ - public void setRecordsManagementSearchBehaviour(RecordsManagementSearchBehaviour recordsManagementSearchBehaviour) - { - this.recordsManagementSearchBehaviour = recordsManagementSearchBehaviour; - } - - /** - * Set disposition service - * - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Set record folder service - * - * @param recordFolderService the record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#register(org.alfresco.module.org_alfresco_module_rm.dataset.DataSet) - */ - @Override - public void register(DataSet dataSet) - { - ParameterCheck.mandatory("dataSet", dataSet); - - this.dataSets.put(dataSet.getId(), dataSet); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getDataSets() - */ - @Override - public Map getDataSets() - { - return this.dataSets; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getDataSets(NodeRef, - * boolean) - */ - @Override - public Map getDataSets(NodeRef filePlan, boolean excludeLoaded) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("excludeLoaded", excludeLoaded); - - // Get the list of all available data sets - Map dataSets = new HashMap(getDataSets()); - - // Should the list of unloaded data sets be retrieved - if (excludeLoaded) - { - dataSets.keySet().removeAll(getLoadedDataSets(filePlan).keySet()); - } - - // Return the (filtered) list of data sets - return dataSets; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#loadDataSet(java.lang.String, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void loadDataSet(NodeRef filePlan, String dataSetId) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatoryString("dataSetId", dataSetId); - - // Get the data set - DataSet dataSet = getDataSets().get(dataSetId); - - // Import the RM test data ACP into the the provided file plan node - // reference - InputStream is = null; - try - { - is = getClass().getClassLoader().getResourceAsStream(dataSet.getPath()); - if (is == null) { throw new AlfrescoRuntimeException("The '" + dataSet.getLabel() - + "' import file could not be found!"); } - - // Import view - Reader viewReader = new InputStreamReader(is, CHARSET_NAME); - Location location = new Location(filePlan); - importerService.importView(viewReader, location, null, null); - - // Patch data - patchLoadedData(); - - // Set the data set id into the file plan's custom aspect - setDataSetIdIntoFilePlan(dataSetId, filePlan); - } - catch (Exception ex) - { - throw new RuntimeException("Unexpected exception thrown. Please refer to the log files for details.", ex); - } - finally - { - if (is != null) - { - try - { - is.close(); - is = null; - } - catch (IOException ex) - { - throw new RuntimeException("Failed to close the input stream!", ex); - } - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#existsDataSet(java.lang.String) - */ - @Override - public boolean existsDataSet(String dataSetId) - { - ParameterCheck.mandatoryString("dataSetId", dataSetId); - - return getDataSets().containsKey(dataSetId); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getLoadedDataSets(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Map getLoadedDataSets(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - - // Get the list of available data sets - Map availableDataSets = new HashMap(getDataSets()); - - // Get the property value of the aspect - Serializable dataSetIds = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); - // Check if any data has been loaded before - if (dataSetIds != null) - { - // Filter the data sets which have already been loaded - @SuppressWarnings("unchecked") - ArrayList loadedDataSetIds = (ArrayList) dataSetIds; - Iterator> iterator = availableDataSets.entrySet().iterator(); - while (iterator.hasNext()) - { - Entry entry = iterator.next(); - String key = entry.getKey(); - if (!loadedDataSetIds.contains(key)) - { - iterator.remove(); - } - } - return availableDataSets; - } - - return new HashMap(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#isLoadedDataSet(org.alfresco.service.cmr.repository.NodeRef, - * java.lang.String) - */ - @Override - public boolean isLoadedDataSet(NodeRef filePlan, String dataSetId) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("dataSetId", dataSetId); - - return getLoadedDataSets(filePlan).containsKey(dataSetId); - } - - /** - * Temp method to patch AMP'ed data - */ - private void patchLoadedData() - { - AuthenticationUtil.RunAsWork runAsWork = new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - Set rmRoots = filePlanService.getFilePlans(); - logger.info("Bootstraping " + rmRoots.size() + " rm roots ..."); - for (NodeRef rmRoot : rmRoots) - { - if (permissionService.getInheritParentPermissions(rmRoot)) - { - logger.info("Updating permissions for rm root: " + rmRoot); - permissionService.setInheritParentPermissions(rmRoot, false); - } - - String allRoleShortName = RMAuthority.ALL_ROLES_PREFIX + rmRoot.getId(); - String allRoleGroupName = authorityService.getName(AuthorityType.GROUP, allRoleShortName); - - if (!authorityService.authorityExists(allRoleGroupName)) - { - logger.info("Creating all roles group for root node: " + rmRoot.toString()); - - // Create "all" role group for root node - String allRoles = authorityService.createAuthority(AuthorityType.GROUP, allRoleShortName, - RMAuthority.ALL_ROLES_DISPLAY_NAME, new HashSet(Arrays.asList(RMAuthority.ZONE_APP_RM))); - - // Put all the role groups in it - Set roles = filePlanRoleService.getRoles(rmRoot); - for (Role role : roles) - { - logger.info(" - adding role group " + role.getRoleGroupName() + " to all roles group"); - authorityService.addAuthority(allRoles, role.getRoleGroupName()); - } - - // Set the permissions - permissionService.setPermission(rmRoot, allRoles, RMPermissionModel.READ_RECORDS, true); - } - } - - // Make sure all the containers do not inherit permissions - ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, - "TYPE:\"rma:recordsManagementContainer\""); - try - { - logger.info("Bootstraping " + rs.length() + " record containers ..."); - - for (NodeRef container : rs.getNodeRefs()) - { - String containerName = (String) nodeService.getProperty(container, ContentModel.PROP_NAME); - - // Set permissions - if (permissionService.getInheritParentPermissions(container)) - { - logger.info("Updating permissions for record container: " + containerName); - permissionService.setInheritParentPermissions(container, false); - } - } - } - finally - { - rs.close(); - } - - // fix up the test dataset to fire initial events for - // disposition - // schedules - rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordFolder\""); - try - { - logger.info("Bootstraping " + rs.length() + " record folders ..."); - - for (NodeRef recordFolder : rs.getNodeRefs()) - { - String folderName = (String) nodeService.getProperty(recordFolder, ContentModel.PROP_NAME); - - // Set permissions - if (permissionService.getInheritParentPermissions(recordFolder)) - { - logger.info("Updating permissions for record folder: " + folderName); - permissionService.setInheritParentPermissions(recordFolder, false); - } - - if (!nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)) - { - // See if the folder has a disposition schedule that - // needs - // to be applied - DispositionSchedule ds = dispositionService.getDispositionSchedule(recordFolder); - if (ds != null) - { - // Fire action to "set-up" the folder correctly - logger.info("Setting up bootstraped record folder: " + folderName); - recordFolderService.setupRecordFolder(recordFolder); - } - } - - // fixup the search behaviour aspect for the record - // folder - logger.info("Setting up search aspect for record folder: " + folderName); - recordsManagementSearchBehaviour.fixupSearchAspect(recordFolder); - } - } - finally - { - rs.close(); - } - - return null; - } - }; - - AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); - - } - - /** - * Helper method for setting the id of the imported data set into the file - * plan's aspect - * - * @param dataSetId The id of the imported data set - * @param filePlan The file plan into which the data set has been imported - */ - @SuppressWarnings("unchecked") - private void setDataSetIdIntoFilePlan(String dataSetId, NodeRef filePlan) - { - ArrayList loadedDataSetIds; - Serializable dataSetIds = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); - - // Check if any data set has been imported - if (dataSetIds == null) - { - Map aspectProperties = new HashMap(1); - aspectProperties.put(PROP_LOADED_DATA_SET_IDS, (Serializable) new ArrayList()); - nodeService.addAspect(filePlan, ASPECT_LOADED_DATA_SET_ID, aspectProperties); - loadedDataSetIds = (ArrayList) nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); - } - else - { - loadedDataSetIds = (ArrayList) dataSetIds; - } - - // Add the new loaded data set id - loadedDataSetIds.add(dataSetId); - Map aspectProperties = new HashMap(1); - aspectProperties.put(PROP_LOADED_DATA_SET_IDS, (Serializable) loadedDataSetIds); - nodeService.addAspect(filePlan, ASPECT_LOADED_DATA_SET_ID, aspectProperties); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.dataset; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authority.RMAuthority; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.view.ImporterService; +import org.alfresco.service.cmr.view.Location; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class DataSetServiceImpl implements DataSetService, RecordsManagementModel +{ + + /** Logger */ + private static Log logger = LogFactory.getLog(DataSetServiceImpl.class); + + /** Registered data set implementations */ + private Map dataSets = new HashMap(); + + /** Spaces store */ + private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); + + /** Charset name */ + private static final String CHARSET_NAME = "UTF-8"; + + /** Importer service */ + private ImporterService importerService; + + /** Search service */ + private SearchService searchService; + + /** Node service */ + private NodeService nodeService; + + /** File plan service service */ + private FilePlanService filePlanService; + + /** Permission service */ + private PermissionService permissionService; + + /** Authority service */ + private AuthorityService authorityService; + + /** File plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** Records management search behaviour */ + private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour; + + /** Disposition service */ + private DispositionService dispositionService; + + /** Record folder service */ + private RecordFolderService recordFolderService; + + /** + * Set importer service + * + * @param importerService the importer service + */ + public void setImporterService(ImporterService importerService) + { + this.importerService = importerService; + } + + /** + * Set search service + * + * @param searchService the search service + */ + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + /** + * Set node service + * + * @param nodeService the node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set file plan service + * + * @param filePlanService the file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Set permission service + * + * @param permissionService the permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * Set authority service + * + * @param authorityService the authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * Set records management search behaviour + * + * @param recordsManagementSearchBehaviour the records management search + * behaviour + */ + public void setRecordsManagementSearchBehaviour(RecordsManagementSearchBehaviour recordsManagementSearchBehaviour) + { + this.recordsManagementSearchBehaviour = recordsManagementSearchBehaviour; + } + + /** + * Set disposition service + * + * @param dispositionService the disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Set record folder service + * + * @param recordFolderService the record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#register(org.alfresco.module.org_alfresco_module_rm.dataset.DataSet) + */ + @Override + public void register(DataSet dataSet) + { + ParameterCheck.mandatory("dataSet", dataSet); + + this.dataSets.put(dataSet.getId(), dataSet); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getDataSets() + */ + @Override + public Map getDataSets() + { + return this.dataSets; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getDataSets(NodeRef, + * boolean) + */ + @Override + public Map getDataSets(NodeRef filePlan, boolean excludeLoaded) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("excludeLoaded", excludeLoaded); + + // Get the list of all available data sets + Map dataSets = new HashMap(getDataSets()); + + // Should the list of unloaded data sets be retrieved + if (excludeLoaded) + { + dataSets.keySet().removeAll(getLoadedDataSets(filePlan).keySet()); + } + + // Return the (filtered) list of data sets + return dataSets; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#loadDataSet(java.lang.String, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void loadDataSet(NodeRef filePlan, String dataSetId) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatoryString("dataSetId", dataSetId); + + // Get the data set + DataSet dataSet = getDataSets().get(dataSetId); + + // Import the RM test data ACP into the the provided file plan node + // reference + InputStream is = null; + try + { + is = getClass().getClassLoader().getResourceAsStream(dataSet.getPath()); + if (is == null) { throw new AlfrescoRuntimeException("The '" + dataSet.getLabel() + + "' import file could not be found!"); } + + // Import view + Reader viewReader = new InputStreamReader(is, CHARSET_NAME); + Location location = new Location(filePlan); + importerService.importView(viewReader, location, null, null); + + // Patch data + patchLoadedData(); + + // Set the data set id into the file plan's custom aspect + setDataSetIdIntoFilePlan(dataSetId, filePlan); + } + catch (Exception ex) + { + throw new RuntimeException("Unexpected exception thrown. Please refer to the log files for details.", ex); + } + finally + { + if (is != null) + { + try + { + is.close(); + is = null; + } + catch (IOException ex) + { + throw new RuntimeException("Failed to close the input stream!", ex); + } + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#existsDataSet(java.lang.String) + */ + @Override + public boolean existsDataSet(String dataSetId) + { + ParameterCheck.mandatoryString("dataSetId", dataSetId); + + return getDataSets().containsKey(dataSetId); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getLoadedDataSets(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Map getLoadedDataSets(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + + // Get the list of available data sets + Map availableDataSets = new HashMap(getDataSets()); + + // Get the property value of the aspect + Serializable dataSetIds = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); + // Check if any data has been loaded before + if (dataSetIds != null) + { + // Filter the data sets which have already been loaded + @SuppressWarnings("unchecked") + ArrayList loadedDataSetIds = (ArrayList) dataSetIds; + Iterator> iterator = availableDataSets.entrySet().iterator(); + while (iterator.hasNext()) + { + Entry entry = iterator.next(); + String key = entry.getKey(); + if (!loadedDataSetIds.contains(key)) + { + iterator.remove(); + } + } + return availableDataSets; + } + + return new HashMap(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#isLoadedDataSet(org.alfresco.service.cmr.repository.NodeRef, + * java.lang.String) + */ + @Override + public boolean isLoadedDataSet(NodeRef filePlan, String dataSetId) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("dataSetId", dataSetId); + + return getLoadedDataSets(filePlan).containsKey(dataSetId); + } + + /** + * Temp method to patch AMP'ed data + */ + private void patchLoadedData() + { + AuthenticationUtil.RunAsWork runAsWork = new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + Set rmRoots = filePlanService.getFilePlans(); + logger.info("Bootstraping " + rmRoots.size() + " rm roots ..."); + for (NodeRef rmRoot : rmRoots) + { + if (permissionService.getInheritParentPermissions(rmRoot)) + { + logger.info("Updating permissions for rm root: " + rmRoot); + permissionService.setInheritParentPermissions(rmRoot, false); + } + + String allRoleShortName = RMAuthority.ALL_ROLES_PREFIX + rmRoot.getId(); + String allRoleGroupName = authorityService.getName(AuthorityType.GROUP, allRoleShortName); + + if (!authorityService.authorityExists(allRoleGroupName)) + { + logger.info("Creating all roles group for root node: " + rmRoot.toString()); + + // Create "all" role group for root node + String allRoles = authorityService.createAuthority(AuthorityType.GROUP, allRoleShortName, + RMAuthority.ALL_ROLES_DISPLAY_NAME, new HashSet(Arrays.asList(RMAuthority.ZONE_APP_RM))); + + // Put all the role groups in it + Set roles = filePlanRoleService.getRoles(rmRoot); + for (Role role : roles) + { + logger.info(" - adding role group " + role.getRoleGroupName() + " to all roles group"); + authorityService.addAuthority(allRoles, role.getRoleGroupName()); + } + + // Set the permissions + permissionService.setPermission(rmRoot, allRoles, RMPermissionModel.READ_RECORDS, true); + } + } + + // Make sure all the containers do not inherit permissions + ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, + "TYPE:\"rma:recordsManagementContainer\""); + try + { + logger.info("Bootstraping " + rs.length() + " record containers ..."); + + for (NodeRef container : rs.getNodeRefs()) + { + String containerName = (String) nodeService.getProperty(container, ContentModel.PROP_NAME); + + // Set permissions + if (permissionService.getInheritParentPermissions(container)) + { + logger.info("Updating permissions for record container: " + containerName); + permissionService.setInheritParentPermissions(container, false); + } + } + } + finally + { + rs.close(); + } + + // fix up the test dataset to fire initial events for + // disposition + // schedules + rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordFolder\""); + try + { + logger.info("Bootstraping " + rs.length() + " record folders ..."); + + for (NodeRef recordFolder : rs.getNodeRefs()) + { + String folderName = (String) nodeService.getProperty(recordFolder, ContentModel.PROP_NAME); + + // Set permissions + if (permissionService.getInheritParentPermissions(recordFolder)) + { + logger.info("Updating permissions for record folder: " + folderName); + permissionService.setInheritParentPermissions(recordFolder, false); + } + + if (!nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)) + { + // See if the folder has a disposition schedule that + // needs + // to be applied + DispositionSchedule ds = dispositionService.getDispositionSchedule(recordFolder); + if (ds != null) + { + // Fire action to "set-up" the folder correctly + logger.info("Setting up bootstraped record folder: " + folderName); + recordFolderService.setupRecordFolder(recordFolder); + } + } + + // fixup the search behaviour aspect for the record + // folder + logger.info("Setting up search aspect for record folder: " + folderName); + recordsManagementSearchBehaviour.fixupSearchAspect(recordFolder); + } + } + finally + { + rs.close(); + } + + return null; + } + }; + + AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); + + } + + /** + * Helper method for setting the id of the imported data set into the file + * plan's aspect + * + * @param dataSetId The id of the imported data set + * @param filePlan The file plan into which the data set has been imported + */ + @SuppressWarnings("unchecked") + private void setDataSetIdIntoFilePlan(String dataSetId, NodeRef filePlan) + { + ArrayList loadedDataSetIds; + Serializable dataSetIds = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); + + // Check if any data set has been imported + if (dataSetIds == null) + { + Map aspectProperties = new HashMap(1); + aspectProperties.put(PROP_LOADED_DATA_SET_IDS, (Serializable) new ArrayList()); + nodeService.addAspect(filePlan, ASPECT_LOADED_DATA_SET_ID, aspectProperties); + loadedDataSetIds = (ArrayList) nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); + } + else + { + loadedDataSetIds = (ArrayList) dataSetIds; + } + + // Add the new loaded data set id + loadedDataSetIds.add(dataSetId); + Map aspectProperties = new HashMap(1); + aspectProperties.put(PROP_LOADED_DATA_SET_IDS, (Serializable) loadedDataSetIds); + nodeService.addAspect(filePlan, ASPECT_LOADED_DATA_SET_ID, aspectProperties); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionAction.java index 88e7b107e5..12847c532b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionAction.java @@ -1,153 +1,153 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.util.Date; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Disposition action interface. - * - * @author Roy Wetherall - * @since 1.0 - */ -public interface DispositionAction -{ - /** - * @return the node reference - */ - NodeRef getNodeRef(); - - /** - * @return the disposition action definition - */ - DispositionActionDefinition getDispositionActionDefinition(); - - /** - * @return the id of the action - */ - String getId(); - - /** - * @return the name of the action - */ - String getName(); - - /** - * @return the display label for the action - */ - String getLabel(); - - /** - * @return the dispostion action as of eligibility date - */ - Date getAsOfDate(); - - /** - * @return true if the events are complete (ie: enough events have been completed to make the disposition - * action - */ - boolean isEventsEligible(); - - /** - * @return the user that started the action - */ - String getStartedBy(); - - /** - * @return when the action was started - */ - Date getStartedAt(); - - /** - * @return the user that completed the action - */ - String getCompletedBy(); - - /** - * @return when the action was completed - */ - Date getCompletedAt(); - - /** - * @return List of events that need to be completed for the action - */ - List getEventCompletionDetails(); - - /** - * Get the event completion details for a named event. - * - * @param eventName event name - * @return {@link EventCompletionDetails} event completion details - * @since 2.2 - */ - EventCompletionDetails getEventCompletionDetails(String eventName); - - /** - * Add new completion details to the disposition action based on the provided - * event. - * - * @param event records management event - * @since 2.2 - */ - void addEventCompletionDetails(RecordsManagementEvent event); - - /** - * Complete an event. - *

- * If null is provided, the complete at date will be take as 'now' and the completed by user - * as the fully authenticated user. - * - * @param eventName event name - * @param completedAt completed at 'date', now if null - * @param completedBy completed by user, authenticated user if null - * @since 2.2 - */ - void completeEvent(String eventName, Date completedAt, String completedBy); - - /** - * Undo the completion of an event. - * - * @param eventName event name - * @since 2.2 - */ - void undoEvent(String eventName); - - /** - * Refresh events against current disposition action definition. - *

- * Called when disposition action definition has changed. - * - * @since 2.2 - */ - void refreshEvents(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.util.Date; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Disposition action interface. + * + * @author Roy Wetherall + * @since 1.0 + */ +public interface DispositionAction +{ + /** + * @return the node reference + */ + NodeRef getNodeRef(); + + /** + * @return the disposition action definition + */ + DispositionActionDefinition getDispositionActionDefinition(); + + /** + * @return the id of the action + */ + String getId(); + + /** + * @return the name of the action + */ + String getName(); + + /** + * @return the display label for the action + */ + String getLabel(); + + /** + * @return the dispostion action as of eligibility date + */ + Date getAsOfDate(); + + /** + * @return true if the events are complete (ie: enough events have been completed to make the disposition + * action + */ + boolean isEventsEligible(); + + /** + * @return the user that started the action + */ + String getStartedBy(); + + /** + * @return when the action was started + */ + Date getStartedAt(); + + /** + * @return the user that completed the action + */ + String getCompletedBy(); + + /** + * @return when the action was completed + */ + Date getCompletedAt(); + + /** + * @return List of events that need to be completed for the action + */ + List getEventCompletionDetails(); + + /** + * Get the event completion details for a named event. + * + * @param eventName event name + * @return {@link EventCompletionDetails} event completion details + * @since 2.2 + */ + EventCompletionDetails getEventCompletionDetails(String eventName); + + /** + * Add new completion details to the disposition action based on the provided + * event. + * + * @param event records management event + * @since 2.2 + */ + void addEventCompletionDetails(RecordsManagementEvent event); + + /** + * Complete an event. + *

+ * If null is provided, the complete at date will be take as 'now' and the completed by user + * as the fully authenticated user. + * + * @param eventName event name + * @param completedAt completed at 'date', now if null + * @param completedBy completed by user, authenticated user if null + * @since 2.2 + */ + void completeEvent(String eventName, Date completedAt, String completedBy); + + /** + * Undo the completion of an event. + * + * @param eventName event name + * @since 2.2 + */ + void undoEvent(String eventName); + + /** + * Refresh events against current disposition action definition. + *

+ * Called when disposition action definition has changed. + * + * @since 2.2 + */ + void refreshEvents(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinition.java index 894ef2b1d8..97d6ac417d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinition.java @@ -1,134 +1,134 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.util.List; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.QName; - -/** - * Disposition action interface - * - * @author Roy Wetherall - */ -// Not @AlfrescoPublicApi because it depends on Period which is not part of the public API. -public interface DispositionActionDefinition -{ - /** - * Get the NodeRef that represents the disposition action definition - * - * @return NodeRef of disposition action definition - */ - NodeRef getNodeRef(); - - /** - * Get disposition action id - * - * @return String id - */ - String getId(); - - /** - * Get the index of the action within the disposition instructions - * - * @return int disposition action index - */ - int getIndex(); - - /** - * Get the name of disposition action - * - * @return String name - */ - String getName(); - - /** - * Get the display label of the disposition action - * - * @return String name's display label - */ - String getLabel(); - - /** - * Get the description of the disposition action - * - * @return String description - */ - String getDescription(); - - /** - * Get the period for the disposition action - * - * @return Period disposition period - */ - Period getPeriod(); - - /** - * Property to which the period is relative to - * - * @return QName property name - */ - QName getPeriodProperty(); - - /** - * List of events for the disposition - * - * @return List list of events - */ - List getEvents(); - - /** - * Indicates whether the disposition action is eligible when the earliest - * event is complete, otherwise all events must be complete before - * eligibility. - * - * @return boolean true if eligible on first action complete, false - * otherwise - */ - boolean eligibleOnFirstCompleteEvent(); - - /** - * Get the location of the disposition (can be null) - * - * @return String disposition location - */ - String getLocation(); - - /** - * Get the ghost on destroy from the disposition - * - * @return boolean the gost on destroy flag (on applicable to destroy - * actions) - */ - String getGhostOnDestroy(); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.util.List; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.namespace.QName; + +/** + * Disposition action interface + * + * @author Roy Wetherall + */ +// Not @AlfrescoPublicApi because it depends on Period which is not part of the public API. +public interface DispositionActionDefinition +{ + /** + * Get the NodeRef that represents the disposition action definition + * + * @return NodeRef of disposition action definition + */ + NodeRef getNodeRef(); + + /** + * Get disposition action id + * + * @return String id + */ + String getId(); + + /** + * Get the index of the action within the disposition instructions + * + * @return int disposition action index + */ + int getIndex(); + + /** + * Get the name of disposition action + * + * @return String name + */ + String getName(); + + /** + * Get the display label of the disposition action + * + * @return String name's display label + */ + String getLabel(); + + /** + * Get the description of the disposition action + * + * @return String description + */ + String getDescription(); + + /** + * Get the period for the disposition action + * + * @return Period disposition period + */ + Period getPeriod(); + + /** + * Property to which the period is relative to + * + * @return QName property name + */ + QName getPeriodProperty(); + + /** + * List of events for the disposition + * + * @return List list of events + */ + List getEvents(); + + /** + * Indicates whether the disposition action is eligible when the earliest + * event is complete, otherwise all events must be complete before + * eligibility. + * + * @return boolean true if eligible on first action complete, false + * otherwise + */ + boolean eligibleOnFirstCompleteEvent(); + + /** + * Get the location of the disposition (can be null) + * + * @return String disposition location + */ + String getLocation(); + + /** + * Get the ghost on destroy from the disposition + * + * @return boolean the gost on destroy flag (on applicable to destroy + * actions) + */ + String getGhostOnDestroy(); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java index 48fae033a8..ba0048c9ec 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java @@ -1,255 +1,255 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.QName; - -/** - * Disposition action implementation - * - * @author Roy Wetherall - */ -public class DispositionActionDefinitionImpl implements DispositionActionDefinition, RecordsManagementModel -{ - /** Name */ - private String name; - - /** Description */ - private String description; - - /** Label */ - private String label; - - /** Node service */ - private NodeService nodeService; - - /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** Records management event service */ - private RecordsManagementEventService recordsManagementEventService; - - /** Disposition action node reference */ - private NodeRef dispositionActionNodeRef; - - /** Action index */ - private int index; - - /** Ghost on detroy */ - private String ghostOnDestroy; - - /** - * Constructor - * - * @param services service registry - * @param nodeRef disposition action node reference - * @param index index of disposition action - */ - public DispositionActionDefinitionImpl(RecordsManagementEventService recordsManagementEventService, RecordsManagementActionService recordsManagementActionService, NodeService nodeService, NodeRef nodeRef, int index) - { - this.recordsManagementEventService = recordsManagementEventService; - this.recordsManagementActionService = recordsManagementActionService; - this.nodeService = nodeService; - this.dispositionActionNodeRef = nodeRef; - this.index = index; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getNodeRef() - */ - @Override - public NodeRef getNodeRef() - { - return this.dispositionActionNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getIndex() - */ - @Override - public int getIndex() - { - return this.index; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getId() - */ - @Override - public String getId() - { - return this.dispositionActionNodeRef.getId(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getDescription() - */ - @Override - public String getDescription() - { - if (description == null) - { - description = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_DESCRIPTION); - } - return description; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getName() - */ - @Override - public String getName() - { - if (name == null) - { - name = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_ACTION_NAME); - } - return name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLabel() - */ - @Override - public String getLabel() - { - if (label == null) - { - String name = getName(); - label = name; - - // get the disposition action from the RM action service - RecordsManagementAction action = recordsManagementActionService.getDispositionAction(name); - if (action != null) - { - label = action.getLabel(); - } - } - - return label; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getPeriod() - */ - @Override - public Period getPeriod() - { - return (Period)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getPeriodProperty() - */ - @Override - public QName getPeriodProperty() - { - QName result = null; - String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD_PROPERTY); - if (value != null) - { - result = QName.createQName(value); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getEvents() - */ - @Override - @SuppressWarnings("unchecked") - public List getEvents() - { - List events = null; - Collection eventNames = (Collection)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT); - if (eventNames != null) - { - events = new ArrayList(eventNames.size()); - for (String eventName : eventNames) - { - RecordsManagementEvent event = recordsManagementEventService.getEvent(eventName); - events.add(event); - } - } - else - { - events = java.util.Collections.EMPTY_LIST; - } - return events; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#eligibleOnFirstCompleteEvent() - */ - @Override - public boolean eligibleOnFirstCompleteEvent() - { - boolean result = true; - String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT_COMBINATION); - if (value != null && value.equals("and")) - { - result = false; - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLocation() - */ - @Override - public String getLocation() - { - return (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_LOCATION); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getGhostOnDestroy() - */ - @Override - public String getGhostOnDestroy() - { - if (ghostOnDestroy == null) - { - ghostOnDestroy = (String) nodeService.getProperty(this.dispositionActionNodeRef, - PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY); - } - return ghostOnDestroy; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.namespace.QName; + +/** + * Disposition action implementation + * + * @author Roy Wetherall + */ +public class DispositionActionDefinitionImpl implements DispositionActionDefinition, RecordsManagementModel +{ + /** Name */ + private String name; + + /** Description */ + private String description; + + /** Label */ + private String label; + + /** Node service */ + private NodeService nodeService; + + /** Records management action service */ + private RecordsManagementActionService recordsManagementActionService; + + /** Records management event service */ + private RecordsManagementEventService recordsManagementEventService; + + /** Disposition action node reference */ + private NodeRef dispositionActionNodeRef; + + /** Action index */ + private int index; + + /** Ghost on detroy */ + private String ghostOnDestroy; + + /** + * Constructor + * + * @param services service registry + * @param nodeRef disposition action node reference + * @param index index of disposition action + */ + public DispositionActionDefinitionImpl(RecordsManagementEventService recordsManagementEventService, RecordsManagementActionService recordsManagementActionService, NodeService nodeService, NodeRef nodeRef, int index) + { + this.recordsManagementEventService = recordsManagementEventService; + this.recordsManagementActionService = recordsManagementActionService; + this.nodeService = nodeService; + this.dispositionActionNodeRef = nodeRef; + this.index = index; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getNodeRef() + */ + @Override + public NodeRef getNodeRef() + { + return this.dispositionActionNodeRef; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getIndex() + */ + @Override + public int getIndex() + { + return this.index; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getId() + */ + @Override + public String getId() + { + return this.dispositionActionNodeRef.getId(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getDescription() + */ + @Override + public String getDescription() + { + if (description == null) + { + description = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_DESCRIPTION); + } + return description; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getName() + */ + @Override + public String getName() + { + if (name == null) + { + name = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_ACTION_NAME); + } + return name; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLabel() + */ + @Override + public String getLabel() + { + if (label == null) + { + String name = getName(); + label = name; + + // get the disposition action from the RM action service + RecordsManagementAction action = recordsManagementActionService.getDispositionAction(name); + if (action != null) + { + label = action.getLabel(); + } + } + + return label; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getPeriod() + */ + @Override + public Period getPeriod() + { + return (Period)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getPeriodProperty() + */ + @Override + public QName getPeriodProperty() + { + QName result = null; + String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_PERIOD_PROPERTY); + if (value != null) + { + result = QName.createQName(value); + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getEvents() + */ + @Override + @SuppressWarnings("unchecked") + public List getEvents() + { + List events = null; + Collection eventNames = (Collection)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT); + if (eventNames != null) + { + events = new ArrayList(eventNames.size()); + for (String eventName : eventNames) + { + RecordsManagementEvent event = recordsManagementEventService.getEvent(eventName); + events.add(event); + } + } + else + { + events = java.util.Collections.EMPTY_LIST; + } + return events; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#eligibleOnFirstCompleteEvent() + */ + @Override + public boolean eligibleOnFirstCompleteEvent() + { + boolean result = true; + String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT_COMBINATION); + if (value != null && value.equals("and")) + { + result = false; + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLocation() + */ + @Override + public String getLocation() + { + return (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_LOCATION); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getGhostOnDestroy() + */ + @Override + public String getGhostOnDestroy() + { + if (ghostOnDestroy == null) + { + ghostOnDestroy = (String) nodeService.getProperty(this.dispositionActionNodeRef, + PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY); + } + return ghostOnDestroy; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java index ed737ca6cd..d26d6ee204 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionImpl.java @@ -1,521 +1,521 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -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; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Disposition action implementation. - * - * @author Roy Wetherall - * @since 1.0 - */ -public class DispositionActionImpl implements DispositionAction, - RecordsManagementModel -{ - /** logger */ - private static Log logger = LogFactory.getLog(DispositionActionImpl.class); - - /** records management service registry */ - private RecordsManagementServiceRegistry services; - - /** disposition node reference */ - private NodeRef dispositionNodeRef; - - /** disposition action definition */ - private DispositionActionDefinition dispositionActionDefinition; - - /** - * Constructor - * - * @param services records management service registry - * @param dispositionActionNodeRef disposition action node reference - */ - public DispositionActionImpl(RecordsManagementServiceRegistry services, NodeRef dispositionActionNodeRef) - { - this.services = services; - this.dispositionNodeRef = dispositionActionNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getDispositionActionDefinition() - */ - public DispositionActionDefinition getDispositionActionDefinition() - { - if (dispositionActionDefinition == null) - { - // Get the current action - String id = (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID); - - // Get the disposition instructions for the owning node - NodeRef recordNodeRef = services.getNodeService().getPrimaryParent(this.dispositionNodeRef).getParentRef(); - if (recordNodeRef != null) - { - DispositionSchedule ds = services.getDispositionService().getDispositionSchedule(recordNodeRef); - - if (ds != null) - { - // Get the disposition action definition - dispositionActionDefinition = ds.getDispositionActionDefinition(id); - } - } - } - - return dispositionActionDefinition; - - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getNodeRef() - */ - public NodeRef getNodeRef() - { - return this.dispositionNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getLabel() - */ - public String getLabel() - { - String name = getName(); - String label = name; - - // get the disposition action from the RM action service - RecordsManagementAction action = services.getRecordsManagementActionService().getDispositionAction(name); - if (action != null) - { - label = action.getLabel(); - } - - return label; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getId() - */ - public String getId() - { - return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getName() - */ - public String getName() - { - return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getAsOfDate() - */ - public Date getAsOfDate() - { - return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_AS_OF); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#isEventsEligible() - */ - public boolean isEventsEligible() - { - return ((Boolean)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_EVENTS_ELIGIBLE)).booleanValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getCompletedAt() - */ - public Date getCompletedAt() - { - return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getCompletedBy() - */ - public String getCompletedBy() - { - return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.DispositionAction#getStartedAt() - */ - public Date getStartedAt() - { - return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.DispositionAction#getStartedBy() - */ - public String getStartedBy() - { - return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getEventCompletionDetails() - */ - public List getEventCompletionDetails() - { - List assocs = services.getNodeService().getChildAssocs( - this.dispositionNodeRef, - ASSOC_EVENT_EXECUTIONS, - RegexQNamePattern.MATCH_ALL); - List result = new ArrayList(assocs.size()); - for (ChildAssociationRef assoc : assocs) - { - result.add(getEventCompletionDetailsFromNodeRef(assoc.getChildRef())); - } - - return result; - } - - /** - * Helper method to create object representation of event completed details from - * node reference. - * - * @param nodeRef node reference - * @return {@link EventCompletionDetails} event completion details - */ - private EventCompletionDetails getEventCompletionDetailsFromNodeRef(NodeRef nodeRef) - { - // get the properties - Map props = this.services.getNodeService().getProperties(nodeRef); - - // get the event name - String eventName = (String)props.get(PROP_EVENT_EXECUTION_NAME); - - // create event completion details - EventCompletionDetails ecd = new EventCompletionDetails( - nodeRef, - eventName, - services.getRecordsManagementEventService().getEvent(eventName).getDisplayLabel(), - getBooleanValue(props.get(PROP_EVENT_EXECUTION_AUTOMATIC), false), - getBooleanValue(props.get(PROP_EVENT_EXECUTION_COMPLETE), false), - (Date)props.get(PROP_EVENT_EXECUTION_COMPLETED_AT), - (String)props.get(PROP_EVENT_EXECUTION_COMPLETED_BY)); - - return ecd; - } - - /** - * Helper method to deal with boolean values - * - * @param value - * @param defaultValue - * @return - */ - private boolean getBooleanValue(Object value, boolean defaultValue) - { - boolean result = defaultValue; - if (value instanceof Boolean) - { - result = ((Boolean)value).booleanValue(); - } - return result; - } - - /** - * Gets the event completion details for the named event. - *

- * Returns null if event can not be found. - * - * @param eventName name of the event - * @return {@link EventCompletionDetails} event completion details for named event, null otherwise - * - * @since 2.2 - */ - @Override - public EventCompletionDetails getEventCompletionDetails(String eventName) - { - EventCompletionDetails result = null; - List assocs = services.getNodeService().getChildAssocsByPropertyValue(dispositionNodeRef, PROP_EVENT_EXECUTION_NAME, eventName); - - if (!assocs.isEmpty()) - { - if (assocs.size() != 1) - { - throw new AlfrescoRuntimeException("Unable to get event completion details, because more than one child was found for event " + eventName); - } - - result = getEventCompletionDetailsFromNodeRef(assocs.get(0).getChildRef()); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#completeEvent(java.lang.String, java.util.Date, java.lang.String) - */ - @Override - public void completeEvent(final String eventName, final Date completedAt, final String completedBy) - { - final EventCompletionDetails event = getEventCompletionDetails(eventName); - if (event != null && !event.isEventComplete()) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // use "now" if no completed date set - Date completedAtValue = completedAt; - if (completedAt == null) - { - completedAtValue = new Date(); - } - - // use the currently authenticated user if none set - String completedByValue = completedBy; - if (completedBy == null) - { - completedByValue = AuthenticationUtil.getFullyAuthenticatedUser(); - } - - // Update the event so that it is complete - NodeRef eventNodeRef = event.getNodeRef(); - Map props = services.getNodeService().getProperties(eventNodeRef); - props.put(PROP_EVENT_EXECUTION_COMPLETE, true); - props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, completedAtValue); - props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, completedByValue); - services.getNodeService().setProperties(eventNodeRef, props); - - // Check to see if the events eligible property needs to be updated - updateEventEligible(); - - return null; - } - }); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#undoEvent(java.lang.String) - */ - @Override - public void undoEvent(final String eventName) - { - final EventCompletionDetails event = getEventCompletionDetails(eventName); - if (event != null && event.isEventComplete()) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Update the event so that it is undone - NodeRef eventNodeRef = event.getNodeRef(); - Map props = services.getNodeService().getProperties(eventNodeRef); - props.put(PROP_EVENT_EXECUTION_COMPLETE, false); - props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, null); - props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, null); - services.getNodeService().setProperties(eventNodeRef, props); - - // Check to see if the events eligible property needs to be updated - updateEventEligible(); - - return null; - } - }); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#refreshEvents() - */ - @SuppressWarnings("unchecked") - @Override - public void refreshEvents() - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // go through the current events on the next action and remove any that are not present any more - List stepEvents = (List) services.getNodeService().getProperty(getDispositionActionDefinition().getNodeRef(), PROP_DISPOSITION_EVENT); - - List eventsList = getEventCompletionDetails(); - List nextActionEvents = new ArrayList(eventsList.size()); - - for (EventCompletionDetails event : eventsList) - { - // take note of the event names present on the next action - String eventName = event.getEventName(); - nextActionEvents.add(eventName); - - // if the event has been removed delete from next action - if (stepEvents != null && !stepEvents.contains(event.getEventName())) - { - // remove the child association representing the event - services.getNodeService().removeChild(getNodeRef(), event.getNodeRef()); - - if (logger.isDebugEnabled()) - { - logger.debug("Removed '" + eventName + "' from next action '" + getName() + - "' (" + getNodeRef() + ")"); - } - } - } - - // go through the disposition action definition step events and add any new ones - if (stepEvents != null) - { - for (String eventName : stepEvents) - { - if (!nextActionEvents.contains(eventName)) - { - // add the details of the new event - addEventCompletionDetails(services.getRecordsManagementEventService().getEvent(eventName)); - - if (logger.isDebugEnabled()) - { - logger.debug("Added '" + eventName + "' to next action '" + getName() + - "' (" + getNodeRef() + ")"); - } - } - } - } - - // NOTE: eventsList contains all the events that have been updated! - // TODO: manually update the search properties for the parent node! - - // finally since events may have changed re-calculate the events eligible flag - boolean eligible = updateEventEligible(); - - if (logger.isDebugEnabled()) - { - logger.debug("Set events eligible flag to '" + eligible + "' for next action '" + getName() + - "' (" + getNodeRef() + ")"); - } - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#addEventCompletionDetails(org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent) - */ - @Override - public void addEventCompletionDetails(RecordsManagementEvent event) - { - Map eventProps = new HashMap(7); - eventProps.put(PROP_EVENT_EXECUTION_NAME, event.getName()); - // TODO display label - eventProps.put(PROP_EVENT_EXECUTION_AUTOMATIC, event.getRecordsManagementEventType().isAutomaticEvent()); - eventProps.put(PROP_EVENT_EXECUTION_COMPLETE, false); - - // Create the event execution object - services.getNodeService().createNode(getNodeRef(), - ASSOC_EVENT_EXECUTIONS, - ASSOC_EVENT_EXECUTIONS, - TYPE_EVENT_EXECUTION, - eventProps); - } - - - /** - * Calculates and updates the rma:dispositionEventsEligible - * property for the given next disposition action. - * - * @param nextAction The next disposition action - * @return The result of calculation - * - * @since 2.2 - */ - private boolean updateEventEligible() - { - boolean eligible = false; - - // get the events for the next disposition action - List events = getEventCompletionDetails(); - - if (!events.isEmpty()) - { - // get the disposition action definition - DispositionActionDefinition dispositionActionDefinition = getDispositionActionDefinition(); - if (dispositionActionDefinition != null) - { - if (!dispositionActionDefinition.eligibleOnFirstCompleteEvent()) - { - // if one event is complete then the disposition action is eligible - eligible = true; - for (EventCompletionDetails event : events) - { - if (!event.isEventComplete()) - { - eligible = false; - break; - } - } - } - else - { - // all events must be complete for the disposition action to be eligible - for (EventCompletionDetails event : events) - { - if (event.isEventComplete()) - { - eligible = true; - break; - } - } - } - } - } - - // Update the property with the eligible value - services.getNodeService().setProperty(getNodeRef(), PROP_DISPOSITION_EVENTS_ELIGIBLE, eligible); - - return eligible; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +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; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Disposition action implementation. + * + * @author Roy Wetherall + * @since 1.0 + */ +public class DispositionActionImpl implements DispositionAction, + RecordsManagementModel +{ + /** logger */ + private static Log logger = LogFactory.getLog(DispositionActionImpl.class); + + /** records management service registry */ + private RecordsManagementServiceRegistry services; + + /** disposition node reference */ + private NodeRef dispositionNodeRef; + + /** disposition action definition */ + private DispositionActionDefinition dispositionActionDefinition; + + /** + * Constructor + * + * @param services records management service registry + * @param dispositionActionNodeRef disposition action node reference + */ + public DispositionActionImpl(RecordsManagementServiceRegistry services, NodeRef dispositionActionNodeRef) + { + this.services = services; + this.dispositionNodeRef = dispositionActionNodeRef; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getDispositionActionDefinition() + */ + public DispositionActionDefinition getDispositionActionDefinition() + { + if (dispositionActionDefinition == null) + { + // Get the current action + String id = (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID); + + // Get the disposition instructions for the owning node + NodeRef recordNodeRef = services.getNodeService().getPrimaryParent(this.dispositionNodeRef).getParentRef(); + if (recordNodeRef != null) + { + DispositionSchedule ds = services.getDispositionService().getDispositionSchedule(recordNodeRef); + + if (ds != null) + { + // Get the disposition action definition + dispositionActionDefinition = ds.getDispositionActionDefinition(id); + } + } + } + + return dispositionActionDefinition; + + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getNodeRef() + */ + public NodeRef getNodeRef() + { + return this.dispositionNodeRef; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getLabel() + */ + public String getLabel() + { + String name = getName(); + String label = name; + + // get the disposition action from the RM action service + RecordsManagementAction action = services.getRecordsManagementActionService().getDispositionAction(name); + if (action != null) + { + label = action.getLabel(); + } + + return label; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getId() + */ + public String getId() + { + return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_ID); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getName() + */ + public String getName() + { + return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getAsOfDate() + */ + public Date getAsOfDate() + { + return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_AS_OF); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#isEventsEligible() + */ + public boolean isEventsEligible() + { + return ((Boolean)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_EVENTS_ELIGIBLE)).booleanValue(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getCompletedAt() + */ + public Date getCompletedAt() + { + return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getCompletedBy() + */ + public String getCompletedBy() + { + return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.DispositionAction#getStartedAt() + */ + public Date getStartedAt() + { + return (Date)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.DispositionAction#getStartedBy() + */ + public String getStartedBy() + { + return (String)services.getNodeService().getProperty(this.dispositionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#getEventCompletionDetails() + */ + public List getEventCompletionDetails() + { + List assocs = services.getNodeService().getChildAssocs( + this.dispositionNodeRef, + ASSOC_EVENT_EXECUTIONS, + RegexQNamePattern.MATCH_ALL); + List result = new ArrayList(assocs.size()); + for (ChildAssociationRef assoc : assocs) + { + result.add(getEventCompletionDetailsFromNodeRef(assoc.getChildRef())); + } + + return result; + } + + /** + * Helper method to create object representation of event completed details from + * node reference. + * + * @param nodeRef node reference + * @return {@link EventCompletionDetails} event completion details + */ + private EventCompletionDetails getEventCompletionDetailsFromNodeRef(NodeRef nodeRef) + { + // get the properties + Map props = this.services.getNodeService().getProperties(nodeRef); + + // get the event name + String eventName = (String)props.get(PROP_EVENT_EXECUTION_NAME); + + // create event completion details + EventCompletionDetails ecd = new EventCompletionDetails( + nodeRef, + eventName, + services.getRecordsManagementEventService().getEvent(eventName).getDisplayLabel(), + getBooleanValue(props.get(PROP_EVENT_EXECUTION_AUTOMATIC), false), + getBooleanValue(props.get(PROP_EVENT_EXECUTION_COMPLETE), false), + (Date)props.get(PROP_EVENT_EXECUTION_COMPLETED_AT), + (String)props.get(PROP_EVENT_EXECUTION_COMPLETED_BY)); + + return ecd; + } + + /** + * Helper method to deal with boolean values + * + * @param value + * @param defaultValue + * @return + */ + private boolean getBooleanValue(Object value, boolean defaultValue) + { + boolean result = defaultValue; + if (value instanceof Boolean) + { + result = ((Boolean)value).booleanValue(); + } + return result; + } + + /** + * Gets the event completion details for the named event. + *

+ * Returns null if event can not be found. + * + * @param eventName name of the event + * @return {@link EventCompletionDetails} event completion details for named event, null otherwise + * + * @since 2.2 + */ + @Override + public EventCompletionDetails getEventCompletionDetails(String eventName) + { + EventCompletionDetails result = null; + List assocs = services.getNodeService().getChildAssocsByPropertyValue(dispositionNodeRef, PROP_EVENT_EXECUTION_NAME, eventName); + + if (!assocs.isEmpty()) + { + if (assocs.size() != 1) + { + throw new AlfrescoRuntimeException("Unable to get event completion details, because more than one child was found for event " + eventName); + } + + result = getEventCompletionDetailsFromNodeRef(assocs.get(0).getChildRef()); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#completeEvent(java.lang.String, java.util.Date, java.lang.String) + */ + @Override + public void completeEvent(final String eventName, final Date completedAt, final String completedBy) + { + final EventCompletionDetails event = getEventCompletionDetails(eventName); + if (event != null && !event.isEventComplete()) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // use "now" if no completed date set + Date completedAtValue = completedAt; + if (completedAt == null) + { + completedAtValue = new Date(); + } + + // use the currently authenticated user if none set + String completedByValue = completedBy; + if (completedBy == null) + { + completedByValue = AuthenticationUtil.getFullyAuthenticatedUser(); + } + + // Update the event so that it is complete + NodeRef eventNodeRef = event.getNodeRef(); + Map props = services.getNodeService().getProperties(eventNodeRef); + props.put(PROP_EVENT_EXECUTION_COMPLETE, true); + props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, completedAtValue); + props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, completedByValue); + services.getNodeService().setProperties(eventNodeRef, props); + + // Check to see if the events eligible property needs to be updated + updateEventEligible(); + + return null; + } + }); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#undoEvent(java.lang.String) + */ + @Override + public void undoEvent(final String eventName) + { + final EventCompletionDetails event = getEventCompletionDetails(eventName); + if (event != null && event.isEventComplete()) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // Update the event so that it is undone + NodeRef eventNodeRef = event.getNodeRef(); + Map props = services.getNodeService().getProperties(eventNodeRef); + props.put(PROP_EVENT_EXECUTION_COMPLETE, false); + props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, null); + props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, null); + services.getNodeService().setProperties(eventNodeRef, props); + + // Check to see if the events eligible property needs to be updated + updateEventEligible(); + + return null; + } + }); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#refreshEvents() + */ + @SuppressWarnings("unchecked") + @Override + public void refreshEvents() + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // go through the current events on the next action and remove any that are not present any more + List stepEvents = (List) services.getNodeService().getProperty(getDispositionActionDefinition().getNodeRef(), PROP_DISPOSITION_EVENT); + + List eventsList = getEventCompletionDetails(); + List nextActionEvents = new ArrayList(eventsList.size()); + + for (EventCompletionDetails event : eventsList) + { + // take note of the event names present on the next action + String eventName = event.getEventName(); + nextActionEvents.add(eventName); + + // if the event has been removed delete from next action + if (stepEvents != null && !stepEvents.contains(event.getEventName())) + { + // remove the child association representing the event + services.getNodeService().removeChild(getNodeRef(), event.getNodeRef()); + + if (logger.isDebugEnabled()) + { + logger.debug("Removed '" + eventName + "' from next action '" + getName() + + "' (" + getNodeRef() + ")"); + } + } + } + + // go through the disposition action definition step events and add any new ones + if (stepEvents != null) + { + for (String eventName : stepEvents) + { + if (!nextActionEvents.contains(eventName)) + { + // add the details of the new event + addEventCompletionDetails(services.getRecordsManagementEventService().getEvent(eventName)); + + if (logger.isDebugEnabled()) + { + logger.debug("Added '" + eventName + "' to next action '" + getName() + + "' (" + getNodeRef() + ")"); + } + } + } + } + + // NOTE: eventsList contains all the events that have been updated! + // TODO: manually update the search properties for the parent node! + + // finally since events may have changed re-calculate the events eligible flag + boolean eligible = updateEventEligible(); + + if (logger.isDebugEnabled()) + { + logger.debug("Set events eligible flag to '" + eligible + "' for next action '" + getName() + + "' (" + getNodeRef() + ")"); + } + + return null; + } + }); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction#addEventCompletionDetails(org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent) + */ + @Override + public void addEventCompletionDetails(RecordsManagementEvent event) + { + Map eventProps = new HashMap(7); + eventProps.put(PROP_EVENT_EXECUTION_NAME, event.getName()); + // TODO display label + eventProps.put(PROP_EVENT_EXECUTION_AUTOMATIC, event.getRecordsManagementEventType().isAutomaticEvent()); + eventProps.put(PROP_EVENT_EXECUTION_COMPLETE, false); + + // Create the event execution object + services.getNodeService().createNode(getNodeRef(), + ASSOC_EVENT_EXECUTIONS, + ASSOC_EVENT_EXECUTIONS, + TYPE_EVENT_EXECUTION, + eventProps); + } + + + /** + * Calculates and updates the rma:dispositionEventsEligible + * property for the given next disposition action. + * + * @param nextAction The next disposition action + * @return The result of calculation + * + * @since 2.2 + */ + private boolean updateEventEligible() + { + boolean eligible = false; + + // get the events for the next disposition action + List events = getEventCompletionDetails(); + + if (!events.isEmpty()) + { + // get the disposition action definition + DispositionActionDefinition dispositionActionDefinition = getDispositionActionDefinition(); + if (dispositionActionDefinition != null) + { + if (!dispositionActionDefinition.eligibleOnFirstCompleteEvent()) + { + // if one event is complete then the disposition action is eligible + eligible = true; + for (EventCompletionDetails event : events) + { + if (!event.isEventComplete()) + { + eligible = false; + break; + } + } + } + else + { + // all events must be complete for the disposition action to be eligible + for (EventCompletionDetails event : events) + { + if (event.isEventComplete()) + { + eligible = true; + break; + } + } + } + } + } + + // Update the property with the eligible value + services.getNodeService().setProperty(getNodeRef(), PROP_DISPOSITION_EVENTS_ELIGIBLE, eligible); + + return eligible; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java index dce5a8c527..9eb9e68225 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSchedule.java @@ -1,92 +1,92 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Disposition schedule interface - * - * @author Roy Wetherall - */ -// Not @AlfrescoPublicApi because it depends on DispositionActionDefinition which is not part of the public API. -public interface DispositionSchedule -{ - /** - * Get the NodeRef that represents the disposition schedule - * - * @return {@link NodeRef} of disposition schedule - */ - NodeRef getNodeRef(); - - /** - * Get the disposition authority - * - * @return {@link String} disposition authority - */ - String getDispositionAuthority(); - - /** - * Get the disposition instructions - * - * @return {@link String} disposition instructions - */ - String getDispositionInstructions(); - - /** - * Indicates whether the disposal occurs at record level or not - * - * @return boolean true if at record level, false otherwise - */ - boolean isRecordLevelDisposition(); - - /** - * Gets all the disposition action definitions for the schedule - * - * @return List<{@link DispositionActionDefinition}> disposition action definitions - */ - List getDispositionActionDefinitions(); - - /** - * Get the disposition action definition - * - * @param id the action definition id - * @return {@link DispositionActionDefinition} disposition action definition - */ - DispositionActionDefinition getDispositionActionDefinition(String id); - - /** - * Get the disposition action definition by the name of the disposition action - * - * @param name disposition action name - * @return {@link DispositionActionDefinition} disposition action definition, null if none - */ - DispositionActionDefinition getDispositionActionDefinitionByName(String name); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.util.List; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Disposition schedule interface + * + * @author Roy Wetherall + */ +// Not @AlfrescoPublicApi because it depends on DispositionActionDefinition which is not part of the public API. +public interface DispositionSchedule +{ + /** + * Get the NodeRef that represents the disposition schedule + * + * @return {@link NodeRef} of disposition schedule + */ + NodeRef getNodeRef(); + + /** + * Get the disposition authority + * + * @return {@link String} disposition authority + */ + String getDispositionAuthority(); + + /** + * Get the disposition instructions + * + * @return {@link String} disposition instructions + */ + String getDispositionInstructions(); + + /** + * Indicates whether the disposal occurs at record level or not + * + * @return boolean true if at record level, false otherwise + */ + boolean isRecordLevelDisposition(); + + /** + * Gets all the disposition action definitions for the schedule + * + * @return List<{@link DispositionActionDefinition}> disposition action definitions + */ + List getDispositionActionDefinitions(); + + /** + * Get the disposition action definition + * + * @param id the action definition id + * @return {@link DispositionActionDefinition} disposition action definition + */ + DispositionActionDefinition getDispositionActionDefinition(String id); + + /** + * Get the disposition action definition by the name of the disposition action + * + * @param name disposition action name + * @return {@link DispositionActionDefinition} disposition action definition, null if none + */ + DispositionActionDefinition getDispositionActionDefinitionByName(String name); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java index 7aeeb4c8dc..b3319b1572 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionScheduleImpl.java @@ -1,194 +1,194 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.RegexQNamePattern; - -/** - * Disposition instructions implementation - * - * @author Roy Wetherall - */ -public class DispositionScheduleImpl implements DispositionSchedule, - RecordsManagementModel -{ - private NodeService nodeService; - private RecordsManagementServiceRegistry services; - private NodeRef dispositionDefinitionNodeRef; - - private List actions; - private Map actionsById; - - //If name is not the same as node-uuid, then action will be stored here too - //Fix for ALF-2588 - private Map actionsByName; - - /** Map of disposition definitions by disposition action name */ - private Map actionsByDispositionActionName; - - public DispositionScheduleImpl(RecordsManagementServiceRegistry services, NodeService nodeService, NodeRef nodeRef) - { - // TODO check that we have a disposition definition node reference - - this.dispositionDefinitionNodeRef = nodeRef; - this.nodeService = nodeService; - this.services = services; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getNodeRef() - */ - public NodeRef getNodeRef() - { - return this.dispositionDefinitionNodeRef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionAuthority() - */ - public String getDispositionAuthority() - { - return (String)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_AUTHORITY); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionInstructions() - */ - public String getDispositionInstructions() - { - return (String)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_INSTRUCTIONS); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#isRecordLevelDisposition() - */ - public boolean isRecordLevelDisposition() - { - boolean result = false; - Boolean value = (Boolean)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_RECORD_LEVEL_DISPOSITION); - if (value != null) - { - result = value.booleanValue(); - } - return result; - } - - /** - * Get disposition action definition - * - * @param id action definition identifier - * @return DispositionActionDefinition disposition action definition - */ - public DispositionActionDefinition getDispositionActionDefinition(String id) - { - if (this.actions == null) - { - getDispositionActionsImpl(); - } - - DispositionActionDefinition actionDef = this.actionsById.get(id); - if (actionDef == null) - { - actionDef = this.actionsByName.get(id); - } - return actionDef; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionActionDefinitionByName(java.lang.String) - */ - @Override - public DispositionActionDefinition getDispositionActionDefinitionByName(String name) - { - if (this.actionsByDispositionActionName == null) - { - getDispositionActionsImpl(); - } - return actionsByDispositionActionName.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionActionDefinitions() - */ - public List getDispositionActionDefinitions() - { - if (this.actions == null) - { - getDispositionActionsImpl(); - } - - return this.actions; - } - - /** - * Get the disposition actions into the local cache - */ - private void getDispositionActionsImpl() - { - List assocs = this.nodeService.getChildAssocs( - this.dispositionDefinitionNodeRef, - ASSOC_DISPOSITION_ACTION_DEFINITIONS, - RegexQNamePattern.MATCH_ALL); - this.actions = new ArrayList(assocs.size()); - this.actionsById = new HashMap(assocs.size()); - this.actionsByName = new HashMap(assocs.size()); - this.actionsByDispositionActionName = new HashMap(assocs.size()); - int index = 0; - for (ChildAssociationRef assoc : assocs) - { - DispositionActionDefinition da = new DispositionActionDefinitionImpl(services.getRecordsManagementEventService(), services.getRecordsManagementActionService(), nodeService, assoc.getChildRef(), index); - actions.add(da); - actionsById.put(da.getId(), da); - index++; - - String actionNodeName = (String) nodeService.getProperty(assoc.getChildRef(), ContentModel.PROP_NAME); - if (!actionNodeName.equals(da.getId())) - { - //It was imported and now has new ID. Old ID may present in old files. - actionsByName.put(actionNodeName, da); - } - - String actionDefintionName = (String)nodeService.getProperty(assoc.getChildRef(), PROP_DISPOSITION_ACTION_NAME); - if (actionDefintionName != null) - { - actionsByDispositionActionName.put(actionDefintionName, da); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.RegexQNamePattern; + +/** + * Disposition instructions implementation + * + * @author Roy Wetherall + */ +public class DispositionScheduleImpl implements DispositionSchedule, + RecordsManagementModel +{ + private NodeService nodeService; + private RecordsManagementServiceRegistry services; + private NodeRef dispositionDefinitionNodeRef; + + private List actions; + private Map actionsById; + + //If name is not the same as node-uuid, then action will be stored here too + //Fix for ALF-2588 + private Map actionsByName; + + /** Map of disposition definitions by disposition action name */ + private Map actionsByDispositionActionName; + + public DispositionScheduleImpl(RecordsManagementServiceRegistry services, NodeService nodeService, NodeRef nodeRef) + { + // TODO check that we have a disposition definition node reference + + this.dispositionDefinitionNodeRef = nodeRef; + this.nodeService = nodeService; + this.services = services; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getNodeRef() + */ + public NodeRef getNodeRef() + { + return this.dispositionDefinitionNodeRef; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionAuthority() + */ + public String getDispositionAuthority() + { + return (String)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_AUTHORITY); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionInstructions() + */ + public String getDispositionInstructions() + { + return (String)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_DISPOSITION_INSTRUCTIONS); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#isRecordLevelDisposition() + */ + public boolean isRecordLevelDisposition() + { + boolean result = false; + Boolean value = (Boolean)this.nodeService.getProperty(this.dispositionDefinitionNodeRef, PROP_RECORD_LEVEL_DISPOSITION); + if (value != null) + { + result = value.booleanValue(); + } + return result; + } + + /** + * Get disposition action definition + * + * @param id action definition identifier + * @return DispositionActionDefinition disposition action definition + */ + public DispositionActionDefinition getDispositionActionDefinition(String id) + { + if (this.actions == null) + { + getDispositionActionsImpl(); + } + + DispositionActionDefinition actionDef = this.actionsById.get(id); + if (actionDef == null) + { + actionDef = this.actionsByName.get(id); + } + return actionDef; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionActionDefinitionByName(java.lang.String) + */ + @Override + public DispositionActionDefinition getDispositionActionDefinitionByName(String name) + { + if (this.actionsByDispositionActionName == null) + { + getDispositionActionsImpl(); + } + return actionsByDispositionActionName.get(name); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule#getDispositionActionDefinitions() + */ + public List getDispositionActionDefinitions() + { + if (this.actions == null) + { + getDispositionActionsImpl(); + } + + return this.actions; + } + + /** + * Get the disposition actions into the local cache + */ + private void getDispositionActionsImpl() + { + List assocs = this.nodeService.getChildAssocs( + this.dispositionDefinitionNodeRef, + ASSOC_DISPOSITION_ACTION_DEFINITIONS, + RegexQNamePattern.MATCH_ALL); + this.actions = new ArrayList(assocs.size()); + this.actionsById = new HashMap(assocs.size()); + this.actionsByName = new HashMap(assocs.size()); + this.actionsByDispositionActionName = new HashMap(assocs.size()); + int index = 0; + for (ChildAssociationRef assoc : assocs) + { + DispositionActionDefinition da = new DispositionActionDefinitionImpl(services.getRecordsManagementEventService(), services.getRecordsManagementActionService(), nodeService, assoc.getChildRef(), index); + actions.add(da); + actionsById.put(da.getId(), da); + index++; + + String actionNodeName = (String) nodeService.getProperty(assoc.getChildRef(), ContentModel.PROP_NAME); + if (!actionNodeName.equals(da.getId())) + { + //It was imported and now has new ID. Old ID may present in old files. + actionsByName.put(actionNodeName, da); + } + + String actionDefintionName = (String)nodeService.getProperty(assoc.getChildRef(), PROP_DISPOSITION_ACTION_NAME); + if (actionDefintionName != null) + { + actionsByDispositionActionName.put(actionDefintionName, da); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java index fd793cc058..b23ee4268e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java @@ -1,208 +1,208 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * This class offers the default implementation of a strategy for selection of - * disposition schedule for a record when there is more than one which is applicable. - * An example of where this strategy might be used would be in the case of a record - * which was multiply filed. - * - * @author neilm - */ -public class DispositionSelectionStrategy implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(DispositionSelectionStrategy.class); - - /** Disposition service */ - private DispositionService dispositionService; - - /** - * Set the disposition service - * - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Select the disposition schedule to use given there is more than one - * - * @param recordFolders - * @return - */ - public NodeRef selectDispositionScheduleFrom(List recordFolders) - { - if (recordFolders == null || recordFolders.isEmpty()) - { - return null; - } - else - { - // 46 CHAPTER 2 - // Records assigned more than 1 disposition must be retained and linked to the record folder (category) with the longest - // retention period. - - // Assumption: an event-based disposition action has a longer retention - // period than a time-based one - as we cannot know when an event will occur - // TODO Automatic events? - - NodeRef recordFolder = null; - if (recordFolders.size() == 1) - { - recordFolder = recordFolders.get(0); - } - else - { - SortedSet sortedFolders = new TreeSet(new DispositionableNodeRefComparator()); - sortedFolders.addAll(recordFolders); - recordFolder = sortedFolders.first(); - } - - DispositionSchedule dispSchedule = dispositionService.getDispositionSchedule(recordFolder); - - if (logger.isDebugEnabled()) - { - logger.debug("Selected retention schedule: " + dispSchedule); - } - - NodeRef result = null; - if (dispSchedule != null) - { - result = dispSchedule.getNodeRef(); - } - return result; - } - } - - /** - * This class defines a natural comparison order between NodeRefs that have - * the dispositionLifecycle aspect applied. - * This order has the following meaning: NodeRefs with a 'lesser' value are considered - * to have a shorter retention period, although the actual retention period may - * not be straightforwardly determined in all cases. - */ - class DispositionableNodeRefComparator implements Comparator - { - public int compare(final NodeRef f1, final NodeRef f2) - { - // Run as admin user - return AuthenticationUtil.runAs(new RunAsWork() - { - public Integer doWork() - { - return compareImpl(f1, f2); - } - }, AuthenticationUtil.getAdminUserName()); - } - - private int compareImpl(NodeRef f1, NodeRef f2) - { - // quick check to see if the node references are the same - if (f1.equals(f2)) - { - return 0; - } - - // get the disposition schedules for the folders - DispositionSchedule ds1 = dispositionService.getDispositionSchedule(f1); - DispositionSchedule ds2 = dispositionService.getDispositionSchedule(f2); - - // make sure each folder has a disposition schedule - if (ds1 == null && ds2 != null) - { - return 1; - } - else if (ds1 != null && ds2 == null) - { - return -1; - } - else if (ds1 == null && ds2 == null) - { - return 0; - } - - // TODO this won't work correctly if we are trying to compare schedules that are record based!! - DispositionAction da1 = dispositionService.getNextDispositionAction(f1); - DispositionAction da2 = dispositionService.getNextDispositionAction(f2); - - if (da1 != null && da2 != null) - { - Date asOfDate1 = da1.getAsOfDate(); - Date asOfDate2 = da2.getAsOfDate(); - // If both record(Folder)s have asOfDates, then use these to compare - if (asOfDate1 != null && asOfDate2 != null) - { - return asOfDate1.compareTo(asOfDate2); - } - // If one has a date and the other doesn't, the one with the date is "less". - // (Defined date is 'shorter' than undefined date as an undefined date means it may be retained forever - theoretically) - else if (asOfDate1 != null || asOfDate2 != null) - { - return asOfDate1 == null ? +1 : -1; - } - else - { - // Neither has an asOfDate. (Somewhat arbitrarily) we'll use the number of events to compare now. - DispositionActionDefinition dad1 = da1.getDispositionActionDefinition(); - DispositionActionDefinition dad2 = da2.getDispositionActionDefinition(); - int eventsCount1 = 0; - int eventsCount2 = 0; - - if (dad1 != null) - { - eventsCount1 = dad1.getEvents().size(); - } - if (dad2 != null) - { - eventsCount2 = dad2.getEvents().size(); - } - return Integer.valueOf(eventsCount1).compareTo(eventsCount2); - } - } - - return 0; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This class offers the default implementation of a strategy for selection of + * disposition schedule for a record when there is more than one which is applicable. + * An example of where this strategy might be used would be in the case of a record + * which was multiply filed. + * + * @author neilm + */ +public class DispositionSelectionStrategy implements RecordsManagementModel +{ + /** Logger */ + private static Log logger = LogFactory.getLog(DispositionSelectionStrategy.class); + + /** Disposition service */ + private DispositionService dispositionService; + + /** + * Set the disposition service + * + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Select the disposition schedule to use given there is more than one + * + * @param recordFolders + * @return + */ + public NodeRef selectDispositionScheduleFrom(List recordFolders) + { + if (recordFolders == null || recordFolders.isEmpty()) + { + return null; + } + else + { + // 46 CHAPTER 2 + // Records assigned more than 1 disposition must be retained and linked to the record folder (category) with the longest + // retention period. + + // Assumption: an event-based disposition action has a longer retention + // period than a time-based one - as we cannot know when an event will occur + // TODO Automatic events? + + NodeRef recordFolder = null; + if (recordFolders.size() == 1) + { + recordFolder = recordFolders.get(0); + } + else + { + SortedSet sortedFolders = new TreeSet(new DispositionableNodeRefComparator()); + sortedFolders.addAll(recordFolders); + recordFolder = sortedFolders.first(); + } + + DispositionSchedule dispSchedule = dispositionService.getDispositionSchedule(recordFolder); + + if (logger.isDebugEnabled()) + { + logger.debug("Selected retention schedule: " + dispSchedule); + } + + NodeRef result = null; + if (dispSchedule != null) + { + result = dispSchedule.getNodeRef(); + } + return result; + } + } + + /** + * This class defines a natural comparison order between NodeRefs that have + * the dispositionLifecycle aspect applied. + * This order has the following meaning: NodeRefs with a 'lesser' value are considered + * to have a shorter retention period, although the actual retention period may + * not be straightforwardly determined in all cases. + */ + class DispositionableNodeRefComparator implements Comparator + { + public int compare(final NodeRef f1, final NodeRef f2) + { + // Run as admin user + return AuthenticationUtil.runAs(new RunAsWork() + { + public Integer doWork() + { + return compareImpl(f1, f2); + } + }, AuthenticationUtil.getAdminUserName()); + } + + private int compareImpl(NodeRef f1, NodeRef f2) + { + // quick check to see if the node references are the same + if (f1.equals(f2)) + { + return 0; + } + + // get the disposition schedules for the folders + DispositionSchedule ds1 = dispositionService.getDispositionSchedule(f1); + DispositionSchedule ds2 = dispositionService.getDispositionSchedule(f2); + + // make sure each folder has a disposition schedule + if (ds1 == null && ds2 != null) + { + return 1; + } + else if (ds1 != null && ds2 == null) + { + return -1; + } + else if (ds1 == null && ds2 == null) + { + return 0; + } + + // TODO this won't work correctly if we are trying to compare schedules that are record based!! + DispositionAction da1 = dispositionService.getNextDispositionAction(f1); + DispositionAction da2 = dispositionService.getNextDispositionAction(f2); + + if (da1 != null && da2 != null) + { + Date asOfDate1 = da1.getAsOfDate(); + Date asOfDate2 = da2.getAsOfDate(); + // If both record(Folder)s have asOfDates, then use these to compare + if (asOfDate1 != null && asOfDate2 != null) + { + return asOfDate1.compareTo(asOfDate2); + } + // If one has a date and the other doesn't, the one with the date is "less". + // (Defined date is 'shorter' than undefined date as an undefined date means it may be retained forever - theoretically) + else if (asOfDate1 != null || asOfDate2 != null) + { + return asOfDate1 == null ? +1 : -1; + } + else + { + // Neither has an asOfDate. (Somewhat arbitrarily) we'll use the number of events to compare now. + DispositionActionDefinition dad1 = da1.getDispositionActionDefinition(); + DispositionActionDefinition dad2 = da2.getDispositionActionDefinition(); + int eventsCount1 = 0; + int eventsCount2 = 0; + + if (dad1 != null) + { + eventsCount1 = dad1.getEvents().size(); + } + if (dad2 != null) + { + eventsCount2 = dad2.getEvents().size(); + } + return Integer.valueOf(eventsCount1).compareTo(eventsCount2); + } + } + + return 0; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java index f5e649fd0d..f14ab2e6d4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionService.java @@ -1,245 +1,245 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.io.Serializable; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Disposition service interface. - * - * @author Roy Wetherall - * @since 2.0 - */ -// Not @AlfrescoPublicApi because it depends on DispositionSchedule which is not part of the public API. -public interface DispositionService -{ - /** ========= Disposition Property Methods ========= */ - - /** - * Register a disposition property. - * - * @param dispositionProperty disposition property - */ - void registerDispositionProperty(DispositionProperty dispositionProperty); - - /** - * Returns the list of disposition period properties that apply given the context provided. - * - * @return filtered list of disposition period properties - */ - Collection getDispositionProperties(boolean isRecordLevel, String dispositionAction); - Collection getDispositionProperties(); - - - /** ========= Disposition Schedule Methods ========= */ - - /** - * Get the disposition schedule for a given record management node. Traverses the hierarchy to - * find the first disposition schedule in the primary hierarchy. - * - * @param nodeRef node reference to record category, record folder or record - * @return {@link DispositionSchedule} disposition schedule - */ - DispositionSchedule getDispositionSchedule(NodeRef nodeRef); - - // Gets all the disposition schedules, not just the first in the primary parent path. - // TODO List getAllDispositionSchedules(NodeRef nodeRef); - - /** - * Get the disposition schedule directly associated with the node specified. Returns - * null if none. - * - * @param nodeRef node reference - * @return {@link DispositionSchedule} disposition schedule directly associated with the node reference, null if none - */ - DispositionSchedule getAssociatedDispositionSchedule(NodeRef nodeRef); - - /** - * Gets the records management container that is directly associated with the disposition schedule. - * - * @param dispositionSchedule disposition schedule - * @return {@link NodeRef} node reference of the associated container - */ - NodeRef getAssociatedRecordsManagementContainer(DispositionSchedule dispositionSchedule); - - /** - * Indicates whether a disposition schedule has any disposable items under its management - * - * @param dispositionSchdule disposition schedule - * @return boolean true if there are disposable items being managed by, false otherwise - */ - boolean hasDisposableItems(DispositionSchedule dispositionSchdule); - - /** - * Gets a list of all the disposable items (records, record folders) that are under the control of - * the disposition schedule. - * - * @param dispositionSchedule disposition schedule - * @return {@link List}<{@link NodeRef}> list of disposable items - */ - List getDisposableItems(DispositionSchedule dispositionSchedule); - - /** - * Indicates whether the node is a disposable item or not (ie is under the control of a disposition schedule) - * - * @param nodeRef node reference - * @return boolean true if node is a disposable item, false otherwise - */ - boolean isDisposableItem(NodeRef nodeRef); - - /** - * Creates a disposition schedule on the given record category. - * - * @param recordCategory - * @param props - * @return {@link DispositionSchedule} - */ - DispositionSchedule createDispositionSchedule(NodeRef recordCategory, Map props); - - // TODO DispositionSchedule updateDispositionSchedule(DispositionScedule, Map props) - - // TODO void removeDispositionSchedule(NodeRef nodeRef); - can only remove if no disposition items - - /** ========= Disposition Action Definition Methods ========= */ - - /** - * Adds a new disposition action definition to the given disposition schedule. - * - * @param schedule The DispositionSchedule to add to - * @param actionDefinitionParams Map of parameters to use to create the action definition - */ - DispositionActionDefinition addDispositionActionDefinition( - DispositionSchedule schedule, - Map actionDefinitionParams); - - /** - * Removes the given disposition action definition from the given disposition - * schedule. - * - * @param schedule The DispositionSchedule to remove from - * @param actionDefinition The DispositionActionDefinition to remove - */ - void removeDispositionActionDefinition( - DispositionSchedule schedule, - DispositionActionDefinition actionDefinition); - - /** - * Updates the given disposition action definition belonging to the given disposition - * schedule. - * - * @param actionDefinition The DispositionActionDefinition to update - * @param actionDefinitionParams Map of parameters to use to update the action definition - * @return The updated DispositionActionDefinition - */ - DispositionActionDefinition updateDispositionActionDefinition( - DispositionActionDefinition actionDefinition, - Map actionDefinitionParams); - - - /** ========= Disposition Action Methods ========= */ - - /** - * Indicates whether the next disposition action is eligible or not. - * - * @param nodeRef node reference to disposable item - * @return boolean true if next disposition action is eligible, false otherwise - */ - boolean isNextDispositionActionEligible(NodeRef nodeRef); - - /** - * Gets the next disposition action for a given node - * - * @param nodeRef node reference to disposable item - * @return DispositionAction next disposition action, null if none - */ - DispositionAction getNextDispositionAction(NodeRef nodeRef); - - // TODO void startNextDispositionAction(NodeRef nodeRef); - - // TODO void completeNextDispositionAction(NodeRef nodeRef); - - - /** ========= Disposition Action History Methods ========= */ - - /** - * Gets a list of all the completed disposition action in the order they occured. - * - * @param nodeRef record/record folder - * @return List list of completed disposition actions - */ - List getCompletedDispositionActions(NodeRef nodeRef); - - /** - * Helper method to get the last completed disposition action. Returns null - * if there is none. - * - * @param nodeRef record/record folder - * @return DispositionAction last completed disposition action, null if none - */ - DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef); - - /** - * Indicates whether the disposable item (records, record folders) is cutoff or not. - * - * @param nodeRef node reference - * @return boolean true if the disposable item is cutoff, false otherwise - * - * @since 2.0 - */ - boolean isDisposableItemCutoff(NodeRef nodeRef); - - /** - * Marks the disposable item (record or record folder) as cut off, calculating the cut off date - * - * @param nodeRef node reference - * - * @since 2.2 - */ - void cutoffDisposableItem(NodeRef nodeRef); - - /** - * Updates the next disposition action - * - * @param nodeRef node reference - */ - void updateNextDispositionAction(NodeRef nodeRef); - - /** - * Refreshes the disposition action details of the given node. - * - * @param nodeRef node reference - */ - void refreshDispositionAction(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Disposition service interface. + * + * @author Roy Wetherall + * @since 2.0 + */ +// Not @AlfrescoPublicApi because it depends on DispositionSchedule which is not part of the public API. +public interface DispositionService +{ + /** ========= Disposition Property Methods ========= */ + + /** + * Register a disposition property. + * + * @param dispositionProperty disposition property + */ + void registerDispositionProperty(DispositionProperty dispositionProperty); + + /** + * Returns the list of disposition period properties that apply given the context provided. + * + * @return filtered list of disposition period properties + */ + Collection getDispositionProperties(boolean isRecordLevel, String dispositionAction); + Collection getDispositionProperties(); + + + /** ========= Disposition Schedule Methods ========= */ + + /** + * Get the disposition schedule for a given record management node. Traverses the hierarchy to + * find the first disposition schedule in the primary hierarchy. + * + * @param nodeRef node reference to record category, record folder or record + * @return {@link DispositionSchedule} disposition schedule + */ + DispositionSchedule getDispositionSchedule(NodeRef nodeRef); + + // Gets all the disposition schedules, not just the first in the primary parent path. + // TODO List getAllDispositionSchedules(NodeRef nodeRef); + + /** + * Get the disposition schedule directly associated with the node specified. Returns + * null if none. + * + * @param nodeRef node reference + * @return {@link DispositionSchedule} disposition schedule directly associated with the node reference, null if none + */ + DispositionSchedule getAssociatedDispositionSchedule(NodeRef nodeRef); + + /** + * Gets the records management container that is directly associated with the disposition schedule. + * + * @param dispositionSchedule disposition schedule + * @return {@link NodeRef} node reference of the associated container + */ + NodeRef getAssociatedRecordsManagementContainer(DispositionSchedule dispositionSchedule); + + /** + * Indicates whether a disposition schedule has any disposable items under its management + * + * @param dispositionSchdule disposition schedule + * @return boolean true if there are disposable items being managed by, false otherwise + */ + boolean hasDisposableItems(DispositionSchedule dispositionSchdule); + + /** + * Gets a list of all the disposable items (records, record folders) that are under the control of + * the disposition schedule. + * + * @param dispositionSchedule disposition schedule + * @return {@link List}<{@link NodeRef}> list of disposable items + */ + List getDisposableItems(DispositionSchedule dispositionSchedule); + + /** + * Indicates whether the node is a disposable item or not (ie is under the control of a disposition schedule) + * + * @param nodeRef node reference + * @return boolean true if node is a disposable item, false otherwise + */ + boolean isDisposableItem(NodeRef nodeRef); + + /** + * Creates a disposition schedule on the given record category. + * + * @param recordCategory + * @param props + * @return {@link DispositionSchedule} + */ + DispositionSchedule createDispositionSchedule(NodeRef recordCategory, Map props); + + // TODO DispositionSchedule updateDispositionSchedule(DispositionScedule, Map props) + + // TODO void removeDispositionSchedule(NodeRef nodeRef); - can only remove if no disposition items + + /** ========= Disposition Action Definition Methods ========= */ + + /** + * Adds a new disposition action definition to the given disposition schedule. + * + * @param schedule The DispositionSchedule to add to + * @param actionDefinitionParams Map of parameters to use to create the action definition + */ + DispositionActionDefinition addDispositionActionDefinition( + DispositionSchedule schedule, + Map actionDefinitionParams); + + /** + * Removes the given disposition action definition from the given disposition + * schedule. + * + * @param schedule The DispositionSchedule to remove from + * @param actionDefinition The DispositionActionDefinition to remove + */ + void removeDispositionActionDefinition( + DispositionSchedule schedule, + DispositionActionDefinition actionDefinition); + + /** + * Updates the given disposition action definition belonging to the given disposition + * schedule. + * + * @param actionDefinition The DispositionActionDefinition to update + * @param actionDefinitionParams Map of parameters to use to update the action definition + * @return The updated DispositionActionDefinition + */ + DispositionActionDefinition updateDispositionActionDefinition( + DispositionActionDefinition actionDefinition, + Map actionDefinitionParams); + + + /** ========= Disposition Action Methods ========= */ + + /** + * Indicates whether the next disposition action is eligible or not. + * + * @param nodeRef node reference to disposable item + * @return boolean true if next disposition action is eligible, false otherwise + */ + boolean isNextDispositionActionEligible(NodeRef nodeRef); + + /** + * Gets the next disposition action for a given node + * + * @param nodeRef node reference to disposable item + * @return DispositionAction next disposition action, null if none + */ + DispositionAction getNextDispositionAction(NodeRef nodeRef); + + // TODO void startNextDispositionAction(NodeRef nodeRef); + + // TODO void completeNextDispositionAction(NodeRef nodeRef); + + + /** ========= Disposition Action History Methods ========= */ + + /** + * Gets a list of all the completed disposition action in the order they occured. + * + * @param nodeRef record/record folder + * @return List list of completed disposition actions + */ + List getCompletedDispositionActions(NodeRef nodeRef); + + /** + * Helper method to get the last completed disposition action. Returns null + * if there is none. + * + * @param nodeRef record/record folder + * @return DispositionAction last completed disposition action, null if none + */ + DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef); + + /** + * Indicates whether the disposable item (records, record folders) is cutoff or not. + * + * @param nodeRef node reference + * @return boolean true if the disposable item is cutoff, false otherwise + * + * @since 2.0 + */ + boolean isDisposableItemCutoff(NodeRef nodeRef); + + /** + * Marks the disposable item (record or record folder) as cut off, calculating the cut off date + * + * @param nodeRef node reference + * + * @since 2.2 + */ + void cutoffDisposableItem(NodeRef nodeRef); + + /** + * Updates the next disposition action + * + * @param nodeRef node reference + */ + void updateNextDispositionAction(NodeRef nodeRef); + + /** + * Refreshes the disposition action details of the given node. + * + * @param nodeRef node reference + */ + void refreshDispositionAction(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java index e7432abf28..caf28eb129 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java @@ -1,1089 +1,1089 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Disposition service implementation. - * - * @author Roy Wetherall - */ -@BehaviourBean -public class DispositionServiceImpl extends ServiceBaseImpl - implements DispositionService, - RecordsManagementModel, - RecordsManagementPolicies.OnFileRecord -{ - /** Logger */ - private static Log logger = LogFactory.getLog(DispositionServiceImpl.class); - - /** Behaviour filter */ - private BehaviourFilter behaviourFilter; - - /** Records management service registry */ - private RecordsManagementServiceRegistry serviceRegistry; - - /** Disposition selection strategy */ - private DispositionSelectionStrategy dispositionSelectionStrategy; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Record Folder Service */ - private RecordFolderService recordFolderService; - - /** Record Service */ - private RecordService recordService; - - /** Freeze Service */ - private FreezeService freezeService; - - /** Disposition properties */ - private Map dispositionProperties = new HashMap(4); - - /** - * Set node service - * - * @param nodeService the node service - */ - @Override - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the dictionary service - * - * @param dictionaryServic the dictionary service - */ - @Override - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Set the behaviour filter. - * - * @param behaviourFilter the behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * Set the records management service registry - * - * @param serviceRegistry records management registry service - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry) - { - this.serviceRegistry = serviceRegistry; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * Set the dispositionSelectionStrategy bean. - * - * @param dispositionSelectionStrategy - */ - public void setDispositionSelectionStrategy(DispositionSelectionStrategy dispositionSelectionStrategy) - { - this.dispositionSelectionStrategy = dispositionSelectionStrategy; - } - - /** - * Behavior to initialize the disposition schedule of a newly filed record. - * - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord#onFileRecord(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour(kind=BehaviourKind.CLASS, type="rma:record") - public void onFileRecord(NodeRef nodeRef) - { - // initialise disposition details - if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - DispositionSchedule di = getDispositionSchedule(nodeRef); - if (di != null && di.isRecordLevelDisposition()) - { - nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); - } - } - }; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#refreshDispositionAction(NodeRef) - */ - @Override - public void refreshDispositionAction(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // get this disposition instructions for the node - DispositionSchedule di = getDispositionSchedule(nodeRef); - if (di != null) - { - List dispositionActionDefinitions = di.getDispositionActionDefinitions(); - if (!dispositionActionDefinitions.isEmpty()) - { - // get the first disposition action definition - DispositionActionDefinition nextDispositionActionDefinition = dispositionActionDefinitions.get(0); - - // initialise the details of the next disposition action - initialiseDispositionAction(nodeRef, nextDispositionActionDefinition); - } - } - } - - /** ========= Disposition Property Methods ========= */ - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#registerDispositionProperty(org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty) - */ - @Override - public void registerDispositionProperty(DispositionProperty dispositionProperty) - { - dispositionProperties.put(dispositionProperty.getQName(), dispositionProperty); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties(boolean, java.lang.String) - */ - @Override - public Collection getDispositionProperties(boolean isRecordLevel, String dispositionAction) - { - Collection values = dispositionProperties.values(); - List result = new ArrayList(values.size()); - for (DispositionProperty dispositionProperty : values) - { - boolean test = dispositionProperty.applies(isRecordLevel, dispositionAction); - if (test) - { - result.add(dispositionProperty); - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties() - */ - @Override - public Collection getDispositionProperties() - { - return dispositionProperties.values(); - } - - /** ========= Disposition Schedule Methods ========= */ - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public DispositionSchedule getDispositionSchedule(NodeRef nodeRef) - { - DispositionSchedule di = null; - NodeRef diNodeRef = null; - if (isRecord(nodeRef)) - { - // Get the record folders for the record - List recordFolders = recordFolderService.getRecordFolders(nodeRef); - // At this point, we may have disposition instruction objects from 1..n folders. - diNodeRef = dispositionSelectionStrategy.selectDispositionScheduleFrom(recordFolders); - } - else - { - // Get the disposition instructions for the node reference provided - diNodeRef = getDispositionScheduleImpl(nodeRef); - } - - if (diNodeRef != null) - { - di = new DispositionScheduleImpl(serviceRegistry, nodeService, diNodeRef); - } - - return di; - } - - /** - * This method returns a NodeRef - * Gets the disposition instructions - * - * @param nodeRef - * @return - */ - private NodeRef getDispositionScheduleImpl(NodeRef nodeRef) - { - NodeRef result = getAssociatedDispositionScheduleImpl(nodeRef); - - if (result == null) - { - NodeRef parent = this.nodeService.getPrimaryParent(nodeRef).getParentRef(); - if (parent != null && filePlanService.isRecordCategory(parent)) - { - result = getDispositionScheduleImpl(parent); - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getAssociatedDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public DispositionSchedule getAssociatedDispositionSchedule(NodeRef nodeRef) - { - DispositionSchedule ds = null; - - // Check the noderef parameter - ParameterCheck.mandatory("nodeRef", nodeRef); - if (nodeService.exists(nodeRef)) - { - // Get the associated disposition schedule node reference - NodeRef dsNodeRef = getAssociatedDispositionScheduleImpl(nodeRef); - if (dsNodeRef != null) - { - // Cerate disposition schedule object - ds = new DispositionScheduleImpl(serviceRegistry, nodeService, dsNodeRef); - } - } - - return ds; - } - - /** - * Gets the node reference of the disposition schedule associated with the container. - * - * @param nodeRef node reference of the container - * @return {@link NodeRef} node reference of the disposition schedule, null if none - */ - private NodeRef getAssociatedDispositionScheduleImpl(NodeRef nodeRef) - { - NodeRef result = null; - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Make sure we are dealing with an RM node - if (!filePlanService.isFilePlanComponent(nodeRef)) - { - throw new AlfrescoRuntimeException("Can not find the associated retention schedule for a non records management component. (nodeRef=" + nodeRef.toString() + ")"); - } - - if (this.nodeService.hasAspect(nodeRef, ASPECT_SCHEDULED)) - { - List childAssocs = this.nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); - if (childAssocs.size() != 0) - { - ChildAssociationRef firstChildAssocRef = childAssocs.get(0); - result = firstChildAssocRef.getChildRef(); - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getAssociatedRecordsManagementContainer(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) - */ - @Override - public NodeRef getAssociatedRecordsManagementContainer(DispositionSchedule dispositionSchedule) - { - ParameterCheck.mandatory("dispositionSchedule", dispositionSchedule); - NodeRef result = null; - - NodeRef dsNodeRef = dispositionSchedule.getNodeRef(); - if (nodeService.exists(dsNodeRef)) - { - List assocs = this.nodeService.getParentAssocs(dsNodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); - if (assocs.size() != 0) - { - if (assocs.size() != 1) - { - // TODO in the future we should be able to support disposition schedule reuse, but for now just warn that - // only the first disposition schedule will be considered - if (logger.isWarnEnabled()) - { - logger.warn("Retention schedule has more than one associated records management container. " + - "This is not currently supported so only the first container will be considered. " + - "(dispositionScheduleNodeRef=" + dispositionSchedule.getNodeRef().toString() + ")"); - } - } - - // Get the container reference - ChildAssociationRef assoc = assocs.get(0); - result = assoc.getParentRef(); - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#hasDisposableItems(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) - */ - @Override - public boolean hasDisposableItems(DispositionSchedule dispositionSchdule) - { - return !getDisposableItems(dispositionSchdule).isEmpty(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDisposableItems(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) - */ - @Override - public List getDisposableItems(DispositionSchedule dispositionSchedule) - { - ParameterCheck.mandatory("dispositionSchedule", dispositionSchedule); - - // Get the associated container - NodeRef rmContainer = getAssociatedRecordsManagementContainer(dispositionSchedule); - - // Return the disposable items - return getDisposableItemsImpl(dispositionSchedule.isRecordLevelDisposition(), rmContainer); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isDisposableItem(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isDisposableItem(NodeRef nodeRef) - { - return nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE); - } - - /** - * - * @param isRecordLevelDisposition - * @param rmContainer - * @param root - * @return - */ - private List getDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer) - { - List items = filePlanService.getAllContained(rmContainer); - List result = new ArrayList(items.size()); - for (NodeRef item : items) - { - if (recordFolderService.isRecordFolder(item)) - { - if (isRecordLevelDisposition) - { - result.addAll(recordService.getRecords(item)); - } - else - { - result.add(item); - } - } - else if (filePlanService.isRecordCategory(item) && getAssociatedDispositionScheduleImpl(item) == null) - { - result.addAll(getDisposableItemsImpl(isRecordLevelDisposition, item)); - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#createDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef, java.util.Map) - */ - @Override - public DispositionSchedule createDispositionSchedule(NodeRef nodeRef, Map props) - { - NodeRef dsNodeRef = null; - - // Check mandatory parameters - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Check exists - if (!nodeService.exists(nodeRef)) - { - throw new AlfrescoRuntimeException("Unable to create retention schedule, because node does not exist. (nodeRef=" + nodeRef.toString() + ")"); - } - - // Check is sub-type of rm:recordCategory - QName nodeRefType = nodeService.getType(nodeRef); - if (!TYPE_RECORD_CATEGORY.equals(nodeRefType) && - !dictionaryService.isSubClass(nodeRefType, TYPE_RECORD_CATEGORY)) - { - throw new AlfrescoRuntimeException("Unable to create retention schedule on a node that is not a records management container."); - } - - behaviourFilter.disableBehaviour(nodeRef, ASPECT_SCHEDULED); - try - { - // Add the schedules aspect if required - if (!nodeService.hasAspect(nodeRef, ASPECT_SCHEDULED)) - { - nodeService.addAspect(nodeRef, ASPECT_SCHEDULED, null); - } - - // Check whether there is already a disposition schedule object present - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); - if (assocs.size() == 0) - { - DispositionSchedule currentDispositionSchdule = getDispositionSchedule(nodeRef); - if (currentDispositionSchdule != null) - { - List items = getDisposableItemsImpl(currentDispositionSchdule.isRecordLevelDisposition(), nodeRef); - if (items.size() != 0) - { - throw new AlfrescoRuntimeException("Can not create a retention schedule if there are disposable items already under the control of an other retention schedule"); - } - } - - // Create the disposition schedule object - dsNodeRef = nodeService.createNode( - nodeRef, - ASSOC_DISPOSITION_SCHEDULE, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("dispositionSchedule")), - TYPE_DISPOSITION_SCHEDULE, - props).getChildRef(); - } - else - { - // Error since the node already has a disposition schedule set - throw new AlfrescoRuntimeException("Unable to create retention schedule on node that already has a retention schedule."); - } - } - finally - { - behaviourFilter.enableBehaviour(nodeRef, ASPECT_SCHEDULED); - } - - // Create the return object - return new DispositionScheduleImpl(serviceRegistry, nodeService, dsNodeRef); - } - - /** ========= Disposition Action Definition Methods ========= */ - - /** - * - */ - @Override - public DispositionActionDefinition addDispositionActionDefinition( - DispositionSchedule schedule, - Map actionDefinitionParams) - { - // make sure at least a name has been defined - String name = (String)actionDefinitionParams.get(PROP_DISPOSITION_ACTION_NAME); - if (name == null || name.length() == 0) - { - throw new IllegalArgumentException("'name' parameter is mandatory when creating a disposition action definition"); - } - - // TODO: also check the action name is valid? - - // create the child association from the schedule to the action definition - NodeRef actionNodeRef = this.nodeService.createNode(schedule.getNodeRef(), - RecordsManagementModel.ASSOC_DISPOSITION_ACTION_DEFINITIONS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(name)), - RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION, actionDefinitionParams).getChildRef(); - - // get the updated disposition schedule and retrieve the new action definition - NodeRef scheduleParent = this.nodeService.getPrimaryParent(schedule.getNodeRef()).getParentRef(); - DispositionSchedule updatedSchedule = this.getDispositionSchedule(scheduleParent); - return updatedSchedule.getDispositionActionDefinition(actionNodeRef.getId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#removeDispositionActionDefinition(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule, org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition) - */ - @Override - public void removeDispositionActionDefinition(DispositionSchedule schedule, DispositionActionDefinition actionDefinition) - { - // check first whether action definitions can be removed - if (hasDisposableItems(schedule)) - { - throw new AlfrescoRuntimeException("Can not remove action definitions from schedule '" + - schedule.getNodeRef() + "' as one or more record or record folders are present."); - } - - // remove the child node representing the action definition - this.nodeService.removeChild(schedule.getNodeRef(), actionDefinition.getNodeRef()); - } - - /** - * Updates the given disposition action definition belonging to the given disposition - * schedule. - * - * @param schedule The DispositionSchedule the action belongs to - * @param actionDefinition The DispositionActionDefinition to update - * @param actionDefinitionParams Map of parameters to use to update the action definition - * @return The updated DispositionActionDefinition - */ - @Override - public DispositionActionDefinition updateDispositionActionDefinition( - DispositionActionDefinition actionDefinition, - Map actionDefinitionParams) - { - // update the node with properties - this.nodeService.addProperties(actionDefinition.getNodeRef(), actionDefinitionParams); - - // get the updated disposition schedule and retrieve the updated action definition - NodeRef ds = this.nodeService.getPrimaryParent(actionDefinition.getNodeRef()).getParentRef(); - DispositionSchedule updatedSchedule = new DispositionScheduleImpl(serviceRegistry, nodeService, ds); - return updatedSchedule.getDispositionActionDefinition(actionDefinition.getId()); - } - - /** ========= Disposition Action Methods ========= */ - - /** - * Initialises the details of the next disposition action based on the details of a disposition - * action definition. - * - * @param nodeRef node reference - * @param dispositionActionDefinition disposition action definition - */ - private void initialiseDispositionAction(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition) - { - // Create the properties - Map props = new HashMap(10); - - // Calculate the asOf date - Date asOfDate = null; - Period period = dispositionActionDefinition.getPeriod(); - if (period != null) - { - Date contextDate = null; - - // Get the period properties value - QName periodProperty = dispositionActionDefinition.getPeriodProperty(); - if (periodProperty != null) - { - // doesn't matter if the period property isn't set ... the asOfDate will get updated later - // when the value of the period property is set - contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty); - } - else - { - // for now use 'NOW' as the default context date - // TODO set the default period property ... cut off date or last disposition date depending on context - contextDate = new Date(); - } - - // Calculate the as of date - if (contextDate != null) - { - asOfDate = period.getNextDate(contextDate); - } - } - - // Set the property values - props.put(PROP_DISPOSITION_ACTION_ID, dispositionActionDefinition.getId()); - props.put(PROP_DISPOSITION_ACTION, dispositionActionDefinition.getName()); - if (asOfDate != null) - { - props.put(PROP_DISPOSITION_AS_OF, asOfDate); - } - - // Create a new disposition action object - NodeRef dispositionActionNodeRef = this.nodeService.createNode( - nodeRef, - ASSOC_NEXT_DISPOSITION_ACTION, - ASSOC_NEXT_DISPOSITION_ACTION, - TYPE_DISPOSITION_ACTION, - props).getChildRef(); - DispositionAction da = new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef); - - // Create the events - List events = dispositionActionDefinition.getEvents(); - for (RecordsManagementEvent event : events) - { - // For every event create an entry on the action - da.addEventCompletionDetails(event); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isNextDispositionActionEligible(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isNextDispositionActionEligible(NodeRef nodeRef) - { - boolean result = false; - - // Get the disposition instructions - DispositionSchedule di = getDispositionSchedule(nodeRef); - NodeRef nextDa = getNextDispositionActionNodeRef(nodeRef); - if (di != null && - this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) && - nextDa != null) - { - // If it has an asOf date and it is greater than now the action is eligible - Date asOf = (Date)this.nodeService.getProperty(nextDa, PROP_DISPOSITION_AS_OF); - if (asOf != null && - asOf.before(new Date())) - { - result = true; - } - - if (!result) - { - DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa); - DispositionActionDefinition dad = da.getDispositionActionDefinition(); - if (dad != null) - { - boolean firstComplete = dad.eligibleOnFirstCompleteEvent(); - - List assocs = this.nodeService.getChildAssocs(nextDa, ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef eventExecution = assoc.getChildRef(); - Boolean isCompleteValue = (Boolean)this.nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_COMPLETE); - boolean isComplete = false; - if (isCompleteValue != null) - { - isComplete = isCompleteValue.booleanValue(); - - // implement AND and OR combination of event completions - if (isComplete) - { - result = true; - if (firstComplete) - { - break; - } - } - else - { - result = false; - if (!firstComplete) - { - break; - } - } - } - } - } - } - } - - return result; - } - - /** - * Get the next disposition action node. Null if none present. - * - * @param nodeRef the disposable node reference - * @return NodeRef the next disposition action, null if none - */ - private NodeRef getNextDispositionActionNodeRef(NodeRef nodeRef) - { - NodeRef result = null; - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION, 1, true); - if (assocs.size() != 0) - { - result = assocs.get(0).getChildRef(); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getNextDispositionAction(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public DispositionAction getNextDispositionAction(NodeRef nodeRef) - { - DispositionAction result = null; - NodeRef dispositionActionNodeRef = getNextDispositionActionNodeRef(nodeRef); - - if (dispositionActionNodeRef != null) - { - result = new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef); - } - return result; - } - - - /** ========= Disposition Action History Methods ========= */ - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getCompletedDispositionActions(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getCompletedDispositionActions(NodeRef nodeRef) - { - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_ACTION_HISTORY, RegexQNamePattern.MATCH_ALL); - List result = new ArrayList(assocs.size()); - for (ChildAssociationRef assoc : assocs) - { - NodeRef dispositionActionNodeRef = assoc.getChildRef(); - result.add(new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef)); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getLastCompletedDispostionAction(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef) - { - DispositionAction result = null; - List list = getCompletedDispositionActions(nodeRef); - if (!list.isEmpty()) - { - // Get the last disposition action in the list - result = list.get(list.size()-1); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isDisposableItemCutoff(NodeRef) - */ - @Override - public boolean isDisposableItemCutoff(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - return nodeService.hasAspect(nodeRef, ASPECT_CUT_OFF); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#updateNextDispositionAction(NodeRef) - */ - @Override - public void updateNextDispositionAction(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - RunAsWork runAsWork = new RunAsWork() - { - /** - * @see org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork#doWork() - */ - @Override - public Void doWork() - { - // Get this disposition instructions for the node - DispositionSchedule di = getDispositionSchedule(nodeRef); - if (di != null) - { - // Get the current action node - NodeRef currentDispositionAction = null; - if (nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); - if (assocs.size() > 0) - { - currentDispositionAction = assocs.get(0).getChildRef(); - } - } - - if (currentDispositionAction != null) - { - // Move it to the history association - nodeService.moveNode(currentDispositionAction, nodeRef, ASSOC_DISPOSITION_ACTION_HISTORY, ASSOC_DISPOSITION_ACTION_HISTORY); - } - - List dispositionActionDefinitions = di.getDispositionActionDefinitions(); - DispositionActionDefinition currentDispositionActionDefinition = null; - DispositionActionDefinition nextDispositionActionDefinition = null; - - if (currentDispositionAction == null) - { - if (!dispositionActionDefinitions.isEmpty()) - { - // The next disposition action is the first action - nextDispositionActionDefinition = dispositionActionDefinitions.get(0); - } - } - else - { - // Get the current action - String currentADId = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION_ID); - currentDispositionActionDefinition = di.getDispositionActionDefinition(currentADId); - // When the record has multiple disposition schedules the current disposition action may not be found by id - // In this case it will be searched by name - if(currentDispositionActionDefinition == null) - { - String currentADName = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION); - currentDispositionActionDefinition = di.getDispositionActionDefinitionByName(currentADName); - } - - // Get the next disposition action - int index = currentDispositionActionDefinition.getIndex(); - index++; - if (index < dispositionActionDefinitions.size()) - { - nextDispositionActionDefinition = dispositionActionDefinitions.get(index); - } - } - - if (nextDispositionActionDefinition != null) - { - if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - // Add the disposition life cycle aspect - nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); - } - - // Create the properties - Map props = new HashMap(10); - - // Calculate the asOf date - Date asOfDate = null; - Period period = nextDispositionActionDefinition.getPeriod(); - if (period != null) - { - Date contextDate = null; - - // Get the period properties value - QName periodProperty = nextDispositionActionDefinition.getPeriodProperty(); - if (periodProperty != null && - !RecordsManagementModel.PROP_DISPOSITION_AS_OF.equals(periodProperty)) - { - // doesn't matter if the period property isn't set ... the asOfDate will get updated later - // when the value of the period property is set - contextDate = (Date) nodeService.getProperty(nodeRef, periodProperty); - } - else - { - // for now use 'NOW' as the default context date - // TODO set the default period property ... cut off date or last disposition date depending on context - contextDate = new Date(); - } - - // Calculate the as of date - if (contextDate != null) - { - asOfDate = period.getNextDate(contextDate); - } - } - - // Set the property values - props.put(PROP_DISPOSITION_ACTION_ID, nextDispositionActionDefinition.getId()); - props.put(PROP_DISPOSITION_ACTION, nextDispositionActionDefinition.getName()); - if (asOfDate != null) - { - props.put(PROP_DISPOSITION_AS_OF, asOfDate); - } - - // Create a new disposition action object - NodeRef dispositionActionNodeRef = nodeService.createNode( - nodeRef, - ASSOC_NEXT_DISPOSITION_ACTION, - ASSOC_NEXT_DISPOSITION_ACTION, - TYPE_DISPOSITION_ACTION, - props).getChildRef(); - DispositionAction da = new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef); - - // Create the events - List events = nextDispositionActionDefinition.getEvents(); - for (RecordsManagementEvent event : events) - { - // For every event create an entry on the action - da.addEventCompletionDetails(event); - } - } - } - - return null; - } - }; - - AuthenticationUtil.runAsSystem(runAsWork); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#cutoffDisposableItem(NodeRef) - */ - @Override - public void cutoffDisposableItem(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // check that the node ref is a filed record or record folder - if (FilePlanComponentKind.RECORD_FOLDER.equals(filePlanService.getFilePlanComponentKind(nodeRef)) || - FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef))) - { - if (!isDisposableItemCutoff(nodeRef) && !isFrozenOrHasFrozenChildren(nodeRef)) - { - if (recordFolderService.isRecordFolder(nodeRef)) - { - // cut off all the children first - for (NodeRef record : recordService.getRecords(nodeRef)) - { - applyCutoff(record); - } - } - - // apply cut off - applyCutoff(nodeRef); - - // remove uncut off aspect if applied - if(nodeService.hasAspect(nodeRef, ASPECT_UNCUT_OFF)) - { - nodeService.removeAspect(nodeRef, ASPECT_UNCUT_OFF); - } - - // close the record folder if it isn't already closed! - if (recordFolderService.isRecordFolder(nodeRef) && - !recordFolderService.isRecordFolderClosed(nodeRef)) - { - // runAs system so that we can close a record that has already been cutoff - authenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - recordFolderService.closeRecordFolder(nodeRef); - return null; - } - }); - } - } - else - { - throw new AlfrescoRuntimeException("unable to perform cutoff, because node is frozen or has frozen children"); - } - } - else - { - throw new AlfrescoRuntimeException("Unable to peform cutoff, because node is not a disposible item. (nodeRef=" + nodeRef.toString() + ")"); - } - } - - /** - * Helper method to determine if a node is frozen or has frozen children - * - * @param nodeRef Node to be checked - * @return true if the node is frozen or has frozen children, false otherwise - */ - private boolean isFrozenOrHasFrozenChildren(NodeRef nodeRef) - { - boolean result = false; - - if (recordFolderService.isRecordFolder(nodeRef)) - { - result = freezeService.isFrozen(nodeRef) || freezeService.hasFrozenChildren(nodeRef); - } - else if (recordService.isRecord(nodeRef)) - { - result = freezeService.isFrozen(nodeRef); - } - else - { - throw new AlfrescoRuntimeException("The nodeRef '" + nodeRef + "' is neither a record nor a record folder."); - } - - return result; - } - - /** - * Helper method to apply the cut off - * - * @param nodeRef node to cut off - */ - private void applyCutoff(final NodeRef nodeRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Apply the cut off aspect and set cut off date - Map cutOffProps = new HashMap(1); - cutOffProps.put(PROP_CUT_OFF_DATE, new Date()); - nodeService.addAspect(nodeRef, ASPECT_CUT_OFF, cutOffProps); - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; +import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Disposition service implementation. + * + * @author Roy Wetherall + */ +@BehaviourBean +public class DispositionServiceImpl extends ServiceBaseImpl + implements DispositionService, + RecordsManagementModel, + RecordsManagementPolicies.OnFileRecord +{ + /** Logger */ + private static Log logger = LogFactory.getLog(DispositionServiceImpl.class); + + /** Behaviour filter */ + private BehaviourFilter behaviourFilter; + + /** Records management service registry */ + private RecordsManagementServiceRegistry serviceRegistry; + + /** Disposition selection strategy */ + private DispositionSelectionStrategy dispositionSelectionStrategy; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Record Folder Service */ + private RecordFolderService recordFolderService; + + /** Record Service */ + private RecordService recordService; + + /** Freeze Service */ + private FreezeService freezeService; + + /** Disposition properties */ + private Map dispositionProperties = new HashMap(4); + + /** + * Set node service + * + * @param nodeService the node service + */ + @Override + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set the dictionary service + * + * @param dictionaryServic the dictionary service + */ + @Override + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * Set the behaviour filter. + * + * @param behaviourFilter the behaviour filter + */ + public void setBehaviourFilter(BehaviourFilter behaviourFilter) + { + this.behaviourFilter = behaviourFilter; + } + + /** + * Set the records management service registry + * + * @param serviceRegistry records management registry service + */ + public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry serviceRegistry) + { + this.serviceRegistry = serviceRegistry; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param freezeService freeze service + */ + public void setFreezeService(FreezeService freezeService) + { + this.freezeService = freezeService; + } + + /** + * Set the dispositionSelectionStrategy bean. + * + * @param dispositionSelectionStrategy + */ + public void setDispositionSelectionStrategy(DispositionSelectionStrategy dispositionSelectionStrategy) + { + this.dispositionSelectionStrategy = dispositionSelectionStrategy; + } + + /** + * Behavior to initialize the disposition schedule of a newly filed record. + * + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord#onFileRecord(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Behaviour(kind=BehaviourKind.CLASS, type="rma:record") + public void onFileRecord(NodeRef nodeRef) + { + // initialise disposition details + if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + { + DispositionSchedule di = getDispositionSchedule(nodeRef); + if (di != null && di.isRecordLevelDisposition()) + { + nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); + } + } + }; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#refreshDispositionAction(NodeRef) + */ + @Override + public void refreshDispositionAction(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + // get this disposition instructions for the node + DispositionSchedule di = getDispositionSchedule(nodeRef); + if (di != null) + { + List dispositionActionDefinitions = di.getDispositionActionDefinitions(); + if (!dispositionActionDefinitions.isEmpty()) + { + // get the first disposition action definition + DispositionActionDefinition nextDispositionActionDefinition = dispositionActionDefinitions.get(0); + + // initialise the details of the next disposition action + initialiseDispositionAction(nodeRef, nextDispositionActionDefinition); + } + } + } + + /** ========= Disposition Property Methods ========= */ + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#registerDispositionProperty(org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty) + */ + @Override + public void registerDispositionProperty(DispositionProperty dispositionProperty) + { + dispositionProperties.put(dispositionProperty.getQName(), dispositionProperty); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties(boolean, java.lang.String) + */ + @Override + public Collection getDispositionProperties(boolean isRecordLevel, String dispositionAction) + { + Collection values = dispositionProperties.values(); + List result = new ArrayList(values.size()); + for (DispositionProperty dispositionProperty : values) + { + boolean test = dispositionProperty.applies(isRecordLevel, dispositionAction); + if (test) + { + result.add(dispositionProperty); + } + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties() + */ + @Override + public Collection getDispositionProperties() + { + return dispositionProperties.values(); + } + + /** ========= Disposition Schedule Methods ========= */ + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public DispositionSchedule getDispositionSchedule(NodeRef nodeRef) + { + DispositionSchedule di = null; + NodeRef diNodeRef = null; + if (isRecord(nodeRef)) + { + // Get the record folders for the record + List recordFolders = recordFolderService.getRecordFolders(nodeRef); + // At this point, we may have disposition instruction objects from 1..n folders. + diNodeRef = dispositionSelectionStrategy.selectDispositionScheduleFrom(recordFolders); + } + else + { + // Get the disposition instructions for the node reference provided + diNodeRef = getDispositionScheduleImpl(nodeRef); + } + + if (diNodeRef != null) + { + di = new DispositionScheduleImpl(serviceRegistry, nodeService, diNodeRef); + } + + return di; + } + + /** + * This method returns a NodeRef + * Gets the disposition instructions + * + * @param nodeRef + * @return + */ + private NodeRef getDispositionScheduleImpl(NodeRef nodeRef) + { + NodeRef result = getAssociatedDispositionScheduleImpl(nodeRef); + + if (result == null) + { + NodeRef parent = this.nodeService.getPrimaryParent(nodeRef).getParentRef(); + if (parent != null && filePlanService.isRecordCategory(parent)) + { + result = getDispositionScheduleImpl(parent); + } + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getAssociatedDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public DispositionSchedule getAssociatedDispositionSchedule(NodeRef nodeRef) + { + DispositionSchedule ds = null; + + // Check the noderef parameter + ParameterCheck.mandatory("nodeRef", nodeRef); + if (nodeService.exists(nodeRef)) + { + // Get the associated disposition schedule node reference + NodeRef dsNodeRef = getAssociatedDispositionScheduleImpl(nodeRef); + if (dsNodeRef != null) + { + // Cerate disposition schedule object + ds = new DispositionScheduleImpl(serviceRegistry, nodeService, dsNodeRef); + } + } + + return ds; + } + + /** + * Gets the node reference of the disposition schedule associated with the container. + * + * @param nodeRef node reference of the container + * @return {@link NodeRef} node reference of the disposition schedule, null if none + */ + private NodeRef getAssociatedDispositionScheduleImpl(NodeRef nodeRef) + { + NodeRef result = null; + ParameterCheck.mandatory("nodeRef", nodeRef); + + // Make sure we are dealing with an RM node + if (!filePlanService.isFilePlanComponent(nodeRef)) + { + throw new AlfrescoRuntimeException("Can not find the associated retention schedule for a non records management component. (nodeRef=" + nodeRef.toString() + ")"); + } + + if (this.nodeService.hasAspect(nodeRef, ASPECT_SCHEDULED)) + { + List childAssocs = this.nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); + if (childAssocs.size() != 0) + { + ChildAssociationRef firstChildAssocRef = childAssocs.get(0); + result = firstChildAssocRef.getChildRef(); + } + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getAssociatedRecordsManagementContainer(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) + */ + @Override + public NodeRef getAssociatedRecordsManagementContainer(DispositionSchedule dispositionSchedule) + { + ParameterCheck.mandatory("dispositionSchedule", dispositionSchedule); + NodeRef result = null; + + NodeRef dsNodeRef = dispositionSchedule.getNodeRef(); + if (nodeService.exists(dsNodeRef)) + { + List assocs = this.nodeService.getParentAssocs(dsNodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); + if (assocs.size() != 0) + { + if (assocs.size() != 1) + { + // TODO in the future we should be able to support disposition schedule reuse, but for now just warn that + // only the first disposition schedule will be considered + if (logger.isWarnEnabled()) + { + logger.warn("Retention schedule has more than one associated records management container. " + + "This is not currently supported so only the first container will be considered. " + + "(dispositionScheduleNodeRef=" + dispositionSchedule.getNodeRef().toString() + ")"); + } + } + + // Get the container reference + ChildAssociationRef assoc = assocs.get(0); + result = assoc.getParentRef(); + } + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#hasDisposableItems(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) + */ + @Override + public boolean hasDisposableItems(DispositionSchedule dispositionSchdule) + { + return !getDisposableItems(dispositionSchdule).isEmpty(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDisposableItems(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule) + */ + @Override + public List getDisposableItems(DispositionSchedule dispositionSchedule) + { + ParameterCheck.mandatory("dispositionSchedule", dispositionSchedule); + + // Get the associated container + NodeRef rmContainer = getAssociatedRecordsManagementContainer(dispositionSchedule); + + // Return the disposable items + return getDisposableItemsImpl(dispositionSchedule.isRecordLevelDisposition(), rmContainer); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isDisposableItem(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean isDisposableItem(NodeRef nodeRef) + { + return nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE); + } + + /** + * + * @param isRecordLevelDisposition + * @param rmContainer + * @param root + * @return + */ + private List getDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer) + { + List items = filePlanService.getAllContained(rmContainer); + List result = new ArrayList(items.size()); + for (NodeRef item : items) + { + if (recordFolderService.isRecordFolder(item)) + { + if (isRecordLevelDisposition) + { + result.addAll(recordService.getRecords(item)); + } + else + { + result.add(item); + } + } + else if (filePlanService.isRecordCategory(item) && getAssociatedDispositionScheduleImpl(item) == null) + { + result.addAll(getDisposableItemsImpl(isRecordLevelDisposition, item)); + } + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#createDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef, java.util.Map) + */ + @Override + public DispositionSchedule createDispositionSchedule(NodeRef nodeRef, Map props) + { + NodeRef dsNodeRef = null; + + // Check mandatory parameters + ParameterCheck.mandatory("nodeRef", nodeRef); + + // Check exists + if (!nodeService.exists(nodeRef)) + { + throw new AlfrescoRuntimeException("Unable to create retention schedule, because node does not exist. (nodeRef=" + nodeRef.toString() + ")"); + } + + // Check is sub-type of rm:recordCategory + QName nodeRefType = nodeService.getType(nodeRef); + if (!TYPE_RECORD_CATEGORY.equals(nodeRefType) && + !dictionaryService.isSubClass(nodeRefType, TYPE_RECORD_CATEGORY)) + { + throw new AlfrescoRuntimeException("Unable to create retention schedule on a node that is not a records management container."); + } + + behaviourFilter.disableBehaviour(nodeRef, ASPECT_SCHEDULED); + try + { + // Add the schedules aspect if required + if (!nodeService.hasAspect(nodeRef, ASPECT_SCHEDULED)) + { + nodeService.addAspect(nodeRef, ASPECT_SCHEDULED, null); + } + + // Check whether there is already a disposition schedule object present + List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL); + if (assocs.size() == 0) + { + DispositionSchedule currentDispositionSchdule = getDispositionSchedule(nodeRef); + if (currentDispositionSchdule != null) + { + List items = getDisposableItemsImpl(currentDispositionSchdule.isRecordLevelDisposition(), nodeRef); + if (items.size() != 0) + { + throw new AlfrescoRuntimeException("Can not create a retention schedule if there are disposable items already under the control of an other retention schedule"); + } + } + + // Create the disposition schedule object + dsNodeRef = nodeService.createNode( + nodeRef, + ASSOC_DISPOSITION_SCHEDULE, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("dispositionSchedule")), + TYPE_DISPOSITION_SCHEDULE, + props).getChildRef(); + } + else + { + // Error since the node already has a disposition schedule set + throw new AlfrescoRuntimeException("Unable to create retention schedule on node that already has a retention schedule."); + } + } + finally + { + behaviourFilter.enableBehaviour(nodeRef, ASPECT_SCHEDULED); + } + + // Create the return object + return new DispositionScheduleImpl(serviceRegistry, nodeService, dsNodeRef); + } + + /** ========= Disposition Action Definition Methods ========= */ + + /** + * + */ + @Override + public DispositionActionDefinition addDispositionActionDefinition( + DispositionSchedule schedule, + Map actionDefinitionParams) + { + // make sure at least a name has been defined + String name = (String)actionDefinitionParams.get(PROP_DISPOSITION_ACTION_NAME); + if (name == null || name.length() == 0) + { + throw new IllegalArgumentException("'name' parameter is mandatory when creating a disposition action definition"); + } + + // TODO: also check the action name is valid? + + // create the child association from the schedule to the action definition + NodeRef actionNodeRef = this.nodeService.createNode(schedule.getNodeRef(), + RecordsManagementModel.ASSOC_DISPOSITION_ACTION_DEFINITIONS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, + QName.createValidLocalName(name)), + RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION, actionDefinitionParams).getChildRef(); + + // get the updated disposition schedule and retrieve the new action definition + NodeRef scheduleParent = this.nodeService.getPrimaryParent(schedule.getNodeRef()).getParentRef(); + DispositionSchedule updatedSchedule = this.getDispositionSchedule(scheduleParent); + return updatedSchedule.getDispositionActionDefinition(actionNodeRef.getId()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#removeDispositionActionDefinition(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule, org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition) + */ + @Override + public void removeDispositionActionDefinition(DispositionSchedule schedule, DispositionActionDefinition actionDefinition) + { + // check first whether action definitions can be removed + if (hasDisposableItems(schedule)) + { + throw new AlfrescoRuntimeException("Can not remove action definitions from schedule '" + + schedule.getNodeRef() + "' as one or more record or record folders are present."); + } + + // remove the child node representing the action definition + this.nodeService.removeChild(schedule.getNodeRef(), actionDefinition.getNodeRef()); + } + + /** + * Updates the given disposition action definition belonging to the given disposition + * schedule. + * + * @param schedule The DispositionSchedule the action belongs to + * @param actionDefinition The DispositionActionDefinition to update + * @param actionDefinitionParams Map of parameters to use to update the action definition + * @return The updated DispositionActionDefinition + */ + @Override + public DispositionActionDefinition updateDispositionActionDefinition( + DispositionActionDefinition actionDefinition, + Map actionDefinitionParams) + { + // update the node with properties + this.nodeService.addProperties(actionDefinition.getNodeRef(), actionDefinitionParams); + + // get the updated disposition schedule and retrieve the updated action definition + NodeRef ds = this.nodeService.getPrimaryParent(actionDefinition.getNodeRef()).getParentRef(); + DispositionSchedule updatedSchedule = new DispositionScheduleImpl(serviceRegistry, nodeService, ds); + return updatedSchedule.getDispositionActionDefinition(actionDefinition.getId()); + } + + /** ========= Disposition Action Methods ========= */ + + /** + * Initialises the details of the next disposition action based on the details of a disposition + * action definition. + * + * @param nodeRef node reference + * @param dispositionActionDefinition disposition action definition + */ + private void initialiseDispositionAction(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition) + { + // Create the properties + Map props = new HashMap(10); + + // Calculate the asOf date + Date asOfDate = null; + Period period = dispositionActionDefinition.getPeriod(); + if (period != null) + { + Date contextDate = null; + + // Get the period properties value + QName periodProperty = dispositionActionDefinition.getPeriodProperty(); + if (periodProperty != null) + { + // doesn't matter if the period property isn't set ... the asOfDate will get updated later + // when the value of the period property is set + contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty); + } + else + { + // for now use 'NOW' as the default context date + // TODO set the default period property ... cut off date or last disposition date depending on context + contextDate = new Date(); + } + + // Calculate the as of date + if (contextDate != null) + { + asOfDate = period.getNextDate(contextDate); + } + } + + // Set the property values + props.put(PROP_DISPOSITION_ACTION_ID, dispositionActionDefinition.getId()); + props.put(PROP_DISPOSITION_ACTION, dispositionActionDefinition.getName()); + if (asOfDate != null) + { + props.put(PROP_DISPOSITION_AS_OF, asOfDate); + } + + // Create a new disposition action object + NodeRef dispositionActionNodeRef = this.nodeService.createNode( + nodeRef, + ASSOC_NEXT_DISPOSITION_ACTION, + ASSOC_NEXT_DISPOSITION_ACTION, + TYPE_DISPOSITION_ACTION, + props).getChildRef(); + DispositionAction da = new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef); + + // Create the events + List events = dispositionActionDefinition.getEvents(); + for (RecordsManagementEvent event : events) + { + // For every event create an entry on the action + da.addEventCompletionDetails(event); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isNextDispositionActionEligible(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean isNextDispositionActionEligible(NodeRef nodeRef) + { + boolean result = false; + + // Get the disposition instructions + DispositionSchedule di = getDispositionSchedule(nodeRef); + NodeRef nextDa = getNextDispositionActionNodeRef(nodeRef); + if (di != null && + this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) && + nextDa != null) + { + // If it has an asOf date and it is greater than now the action is eligible + Date asOf = (Date)this.nodeService.getProperty(nextDa, PROP_DISPOSITION_AS_OF); + if (asOf != null && + asOf.before(new Date())) + { + result = true; + } + + if (!result) + { + DispositionAction da = new DispositionActionImpl(serviceRegistry, nextDa); + DispositionActionDefinition dad = da.getDispositionActionDefinition(); + if (dad != null) + { + boolean firstComplete = dad.eligibleOnFirstCompleteEvent(); + + List assocs = this.nodeService.getChildAssocs(nextDa, ASSOC_EVENT_EXECUTIONS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + NodeRef eventExecution = assoc.getChildRef(); + Boolean isCompleteValue = (Boolean)this.nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_COMPLETE); + boolean isComplete = false; + if (isCompleteValue != null) + { + isComplete = isCompleteValue.booleanValue(); + + // implement AND and OR combination of event completions + if (isComplete) + { + result = true; + if (firstComplete) + { + break; + } + } + else + { + result = false; + if (!firstComplete) + { + break; + } + } + } + } + } + } + } + + return result; + } + + /** + * Get the next disposition action node. Null if none present. + * + * @param nodeRef the disposable node reference + * @return NodeRef the next disposition action, null if none + */ + private NodeRef getNextDispositionActionNodeRef(NodeRef nodeRef) + { + NodeRef result = null; + List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION, 1, true); + if (assocs.size() != 0) + { + result = assocs.get(0).getChildRef(); + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getNextDispositionAction(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public DispositionAction getNextDispositionAction(NodeRef nodeRef) + { + DispositionAction result = null; + NodeRef dispositionActionNodeRef = getNextDispositionActionNodeRef(nodeRef); + + if (dispositionActionNodeRef != null) + { + result = new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef); + } + return result; + } + + + /** ========= Disposition Action History Methods ========= */ + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getCompletedDispositionActions(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getCompletedDispositionActions(NodeRef nodeRef) + { + List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_ACTION_HISTORY, RegexQNamePattern.MATCH_ALL); + List result = new ArrayList(assocs.size()); + for (ChildAssociationRef assoc : assocs) + { + NodeRef dispositionActionNodeRef = assoc.getChildRef(); + result.add(new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef)); + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getLastCompletedDispostionAction(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef) + { + DispositionAction result = null; + List list = getCompletedDispositionActions(nodeRef); + if (!list.isEmpty()) + { + // Get the last disposition action in the list + result = list.get(list.size()-1); + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isDisposableItemCutoff(NodeRef) + */ + @Override + public boolean isDisposableItemCutoff(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + return nodeService.hasAspect(nodeRef, ASPECT_CUT_OFF); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#updateNextDispositionAction(NodeRef) + */ + @Override + public void updateNextDispositionAction(final NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + RunAsWork runAsWork = new RunAsWork() + { + /** + * @see org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork#doWork() + */ + @Override + public Void doWork() + { + // Get this disposition instructions for the node + DispositionSchedule di = getDispositionSchedule(nodeRef); + if (di != null) + { + // Get the current action node + NodeRef currentDispositionAction = null; + if (nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + { + List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); + if (assocs.size() > 0) + { + currentDispositionAction = assocs.get(0).getChildRef(); + } + } + + if (currentDispositionAction != null) + { + // Move it to the history association + nodeService.moveNode(currentDispositionAction, nodeRef, ASSOC_DISPOSITION_ACTION_HISTORY, ASSOC_DISPOSITION_ACTION_HISTORY); + } + + List dispositionActionDefinitions = di.getDispositionActionDefinitions(); + DispositionActionDefinition currentDispositionActionDefinition = null; + DispositionActionDefinition nextDispositionActionDefinition = null; + + if (currentDispositionAction == null) + { + if (!dispositionActionDefinitions.isEmpty()) + { + // The next disposition action is the first action + nextDispositionActionDefinition = dispositionActionDefinitions.get(0); + } + } + else + { + // Get the current action + String currentADId = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION_ID); + currentDispositionActionDefinition = di.getDispositionActionDefinition(currentADId); + // When the record has multiple disposition schedules the current disposition action may not be found by id + // In this case it will be searched by name + if(currentDispositionActionDefinition == null) + { + String currentADName = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION); + currentDispositionActionDefinition = di.getDispositionActionDefinitionByName(currentADName); + } + + // Get the next disposition action + int index = currentDispositionActionDefinition.getIndex(); + index++; + if (index < dispositionActionDefinitions.size()) + { + nextDispositionActionDefinition = dispositionActionDefinitions.get(index); + } + } + + if (nextDispositionActionDefinition != null) + { + if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + { + // Add the disposition life cycle aspect + nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); + } + + // Create the properties + Map props = new HashMap(10); + + // Calculate the asOf date + Date asOfDate = null; + Period period = nextDispositionActionDefinition.getPeriod(); + if (period != null) + { + Date contextDate = null; + + // Get the period properties value + QName periodProperty = nextDispositionActionDefinition.getPeriodProperty(); + if (periodProperty != null && + !RecordsManagementModel.PROP_DISPOSITION_AS_OF.equals(periodProperty)) + { + // doesn't matter if the period property isn't set ... the asOfDate will get updated later + // when the value of the period property is set + contextDate = (Date) nodeService.getProperty(nodeRef, periodProperty); + } + else + { + // for now use 'NOW' as the default context date + // TODO set the default period property ... cut off date or last disposition date depending on context + contextDate = new Date(); + } + + // Calculate the as of date + if (contextDate != null) + { + asOfDate = period.getNextDate(contextDate); + } + } + + // Set the property values + props.put(PROP_DISPOSITION_ACTION_ID, nextDispositionActionDefinition.getId()); + props.put(PROP_DISPOSITION_ACTION, nextDispositionActionDefinition.getName()); + if (asOfDate != null) + { + props.put(PROP_DISPOSITION_AS_OF, asOfDate); + } + + // Create a new disposition action object + NodeRef dispositionActionNodeRef = nodeService.createNode( + nodeRef, + ASSOC_NEXT_DISPOSITION_ACTION, + ASSOC_NEXT_DISPOSITION_ACTION, + TYPE_DISPOSITION_ACTION, + props).getChildRef(); + DispositionAction da = new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef); + + // Create the events + List events = nextDispositionActionDefinition.getEvents(); + for (RecordsManagementEvent event : events) + { + // For every event create an entry on the action + da.addEventCompletionDetails(event); + } + } + } + + return null; + } + }; + + AuthenticationUtil.runAsSystem(runAsWork); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#cutoffDisposableItem(NodeRef) + */ + @Override + public void cutoffDisposableItem(final NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + // check that the node ref is a filed record or record folder + if (FilePlanComponentKind.RECORD_FOLDER.equals(filePlanService.getFilePlanComponentKind(nodeRef)) || + FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef))) + { + if (!isDisposableItemCutoff(nodeRef) && !isFrozenOrHasFrozenChildren(nodeRef)) + { + if (recordFolderService.isRecordFolder(nodeRef)) + { + // cut off all the children first + for (NodeRef record : recordService.getRecords(nodeRef)) + { + applyCutoff(record); + } + } + + // apply cut off + applyCutoff(nodeRef); + + // remove uncut off aspect if applied + if(nodeService.hasAspect(nodeRef, ASPECT_UNCUT_OFF)) + { + nodeService.removeAspect(nodeRef, ASPECT_UNCUT_OFF); + } + + // close the record folder if it isn't already closed! + if (recordFolderService.isRecordFolder(nodeRef) && + !recordFolderService.isRecordFolderClosed(nodeRef)) + { + // runAs system so that we can close a record that has already been cutoff + authenticationUtil.runAsSystem(new RunAsWork() + { + public Void doWork() throws Exception + { + recordFolderService.closeRecordFolder(nodeRef); + return null; + } + }); + } + } + else + { + throw new AlfrescoRuntimeException("unable to perform cutoff, because node is frozen or has frozen children"); + } + } + else + { + throw new AlfrescoRuntimeException("Unable to peform cutoff, because node is not a disposible item. (nodeRef=" + nodeRef.toString() + ")"); + } + } + + /** + * Helper method to determine if a node is frozen or has frozen children + * + * @param nodeRef Node to be checked + * @return true if the node is frozen or has frozen children, false otherwise + */ + private boolean isFrozenOrHasFrozenChildren(NodeRef nodeRef) + { + boolean result = false; + + if (recordFolderService.isRecordFolder(nodeRef)) + { + result = freezeService.isFrozen(nodeRef) || freezeService.hasFrozenChildren(nodeRef); + } + else if (recordService.isRecord(nodeRef)) + { + result = freezeService.isFrozen(nodeRef); + } + else + { + throw new AlfrescoRuntimeException("The nodeRef '" + nodeRef + "' is neither a record nor a record folder."); + } + + return result; + } + + /** + * Helper method to apply the cut off + * + * @param nodeRef node to cut off + */ + private void applyCutoff(final NodeRef nodeRef) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // Apply the cut off aspect and set cut off date + Map cutOffProps = new HashMap(1); + cutOffProps.put(PROP_CUT_OFF_DATE, new Date()); + nodeService.addAspect(nodeRef, ASPECT_CUT_OFF, cutOffProps); + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java index 9ae27e4852..310486d130 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java @@ -1,276 +1,276 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.disposition.property; - -import java.io.Serializable; -import java.util.Date; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Disposition property implementation bean. - * - * @author Roy Wetherall - */ -@BehaviourBean -public class DispositionProperty extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** Property QName */ - private QName propertyName; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Indicates whether this disposition property applies to a folder level disposition */ - private boolean appliesToFolderLevel = true; - - /** Indicates whether this disposition property applies to a record level disposition */ - private boolean appliesToRecordLevel = true; - - /** Set of disposition actions this property does not apply to */ - private Set excludedDispositionActions; - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param propertyName property name (as string) - */ - public void setName(String propertyName) - { - this.propertyName = QName.createQName(propertyName, namespaceService); - } - - /** - * @return property QName - */ - public QName getQName() - { - return this.propertyName; - } - - /** - * @return property definition - */ - public PropertyDefinition getPropertyDefinition() - { - return dictionaryService.getProperty(propertyName); - } - - /** - * @param excludedDispositionActions list of excluded disposition actions - */ - public void setExcludedDispositionActions(Set excludedDispositionActions) - { - this.excludedDispositionActions = excludedDispositionActions; - } - - /** - * @param appliesToFolderLevel - */ - public void setAppliesToFolderLevel(boolean appliesToFolderLevel) - { - this.appliesToFolderLevel = appliesToFolderLevel; - } - - /** - * @param appliesToRecordLevel - */ - public void setAppliesToRecordLevel(boolean appliesToRecordLevel) - { - this.appliesToRecordLevel = appliesToRecordLevel; - } - - /** - * Bean initialisation method - */ - public void init() - { - // register with disposition service - dispositionService.registerDispositionProperty(this); - } - - /** - * Indicates whether the disposition property applies given the context. - * - * @param isRecordLevel true if record level disposition schedule, false otherwise - * @param dispositionAction disposition action name - * @return boolean true if applies, false otherwise - */ - public boolean applies(boolean isRecordLevel, String dispositionAction) - { - boolean result = false; - - if ((isRecordLevel && appliesToRecordLevel) || - (!isRecordLevel && appliesToFolderLevel)) - { - if (excludedDispositionActions != null && excludedDispositionActions.size() != 0) - { - if (!excludedDispositionActions.contains(dispositionAction)) - { - result = true; - } - } - else - { - result = true; - } - } - - return result; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:dispositionLifecycle", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onUpdateProperties( - final NodeRef nodeRef, - final Map before, - final Map after) - { - if (nodeService.exists(nodeRef)) - { - // has the property we care about changed? - if (isPropertyUpdated(before, after)) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - Date updatedDateValue = (Date)after.get(propertyName); - if (updatedDateValue != null) - { - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); - if (dispositionAction != null) - { - DispositionActionDefinition daDefinition = dispositionAction.getDispositionActionDefinition(); - // check whether the next disposition action matches this disposition property - if (daDefinition != null && propertyName.equals(daDefinition.getPeriodProperty())) - { - Period period = daDefinition.getPeriod(); - Date updatedAsOf = period.getNextDate(updatedDateValue); - - // update asOf date on the disposition action based on the new property value - NodeRef daNodeRef = dispositionAction.getNodeRef(); - nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf); - } - } - } - else - { - // throw an exception if the property is being 'cleared' - if (before.get(propertyName) != null) - { - throw new AlfrescoRuntimeException( - "Error updating property " + propertyName.toPrefixString(namespaceService) + - " to null, because property is being used to determine a disposition date."); - } - } - - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - } - } - } - - /** - * Indicates whether the property has been updated or not. - * - * @param before - * @param after - * @return - */ - private boolean isPropertyUpdated(Map before, Map after) - { - boolean result = false; - - Serializable beforeValue = before.get(propertyName); - Serializable afterValue = after.get(propertyName); - - if (beforeValue == null && afterValue != null) - { - result = true; - } - else if (beforeValue != null && afterValue == null) - { - result = true; - } - else if (beforeValue != null && afterValue != null && - !beforeValue.equals(afterValue)) - { - result = true; - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.disposition.property; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Disposition property implementation bean. + * + * @author Roy Wetherall + */ +@BehaviourBean +public class DispositionProperty extends BaseBehaviourBean + implements NodeServicePolicies.OnUpdatePropertiesPolicy +{ + /** Property QName */ + private QName propertyName; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** Disposition service */ + private DispositionService dispositionService; + + /** Indicates whether this disposition property applies to a folder level disposition */ + private boolean appliesToFolderLevel = true; + + /** Indicates whether this disposition property applies to a record level disposition */ + private boolean appliesToRecordLevel = true; + + /** Set of disposition actions this property does not apply to */ + private Set excludedDispositionActions; + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param propertyName property name (as string) + */ + public void setName(String propertyName) + { + this.propertyName = QName.createQName(propertyName, namespaceService); + } + + /** + * @return property QName + */ + public QName getQName() + { + return this.propertyName; + } + + /** + * @return property definition + */ + public PropertyDefinition getPropertyDefinition() + { + return dictionaryService.getProperty(propertyName); + } + + /** + * @param excludedDispositionActions list of excluded disposition actions + */ + public void setExcludedDispositionActions(Set excludedDispositionActions) + { + this.excludedDispositionActions = excludedDispositionActions; + } + + /** + * @param appliesToFolderLevel + */ + public void setAppliesToFolderLevel(boolean appliesToFolderLevel) + { + this.appliesToFolderLevel = appliesToFolderLevel; + } + + /** + * @param appliesToRecordLevel + */ + public void setAppliesToRecordLevel(boolean appliesToRecordLevel) + { + this.appliesToRecordLevel = appliesToRecordLevel; + } + + /** + * Bean initialisation method + */ + public void init() + { + // register with disposition service + dispositionService.registerDispositionProperty(this); + } + + /** + * Indicates whether the disposition property applies given the context. + * + * @param isRecordLevel true if record level disposition schedule, false otherwise + * @param dispositionAction disposition action name + * @return boolean true if applies, false otherwise + */ + public boolean applies(boolean isRecordLevel, String dispositionAction) + { + boolean result = false; + + if ((isRecordLevel && appliesToRecordLevel) || + (!isRecordLevel && appliesToFolderLevel)) + { + if (excludedDispositionActions != null && excludedDispositionActions.size() != 0) + { + if (!excludedDispositionActions.contains(dispositionAction)) + { + result = true; + } + } + else + { + result = true; + } + } + + return result; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:dispositionLifecycle", + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onUpdateProperties( + final NodeRef nodeRef, + final Map before, + final Map after) + { + if (nodeService.exists(nodeRef)) + { + // has the property we care about changed? + if (isPropertyUpdated(before, after)) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + Date updatedDateValue = (Date)after.get(propertyName); + if (updatedDateValue != null) + { + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); + if (dispositionAction != null) + { + DispositionActionDefinition daDefinition = dispositionAction.getDispositionActionDefinition(); + // check whether the next disposition action matches this disposition property + if (daDefinition != null && propertyName.equals(daDefinition.getPeriodProperty())) + { + Period period = daDefinition.getPeriod(); + Date updatedAsOf = period.getNextDate(updatedDateValue); + + // update asOf date on the disposition action based on the new property value + NodeRef daNodeRef = dispositionAction.getNodeRef(); + nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf); + } + } + } + else + { + // throw an exception if the property is being 'cleared' + if (before.get(propertyName) != null) + { + throw new AlfrescoRuntimeException( + "Error updating property " + propertyName.toPrefixString(namespaceService) + + " to null, because property is being used to determine a disposition date."); + } + } + + return null; + } + + }, AuthenticationUtil.getSystemUserName()); + } + } + } + + /** + * Indicates whether the property has been updated or not. + * + * @param before + * @param after + * @return + */ + private boolean isPropertyUpdated(Map before, Map after) + { + boolean result = false; + + Serializable beforeValue = before.get(propertyName); + Serializable afterValue = after.get(propertyName); + + if (beforeValue == null && afterValue != null) + { + result = true; + } + else if (beforeValue != null && afterValue == null) + { + result = true; + } + else if (beforeValue != null && afterValue != null && + !beforeValue.equals(afterValue)) + { + result = true; + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015FilePlanTypeBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015FilePlanTypeBootstrap.java index 17e32d8329..7472cc29d4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015FilePlanTypeBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015FilePlanTypeBootstrap.java @@ -1,60 +1,60 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.dod5015; - -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; - -/** - * Bootstrap bean that registers the dod:filePlan for creation when - * a dod:site is created. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DOD5015FilePlanTypeBootstrap implements DOD5015Model -{ - /** RM site type bean */ - private RmSiteType rmSiteType; - - /** - * @param rmSiteType RM site type bean - */ - public void setRmSiteType(RmSiteType rmSiteType) - { - this.rmSiteType = rmSiteType; - } - - /** - * Init method - */ - public void init() - { - // register dod file plan type for the dod site type - rmSiteType.registerFilePlanType(TYPE_DOD_5015_SITE, TYPE_DOD_5015_FILE_PLAN); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.dod5015; + +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; + +/** + * Bootstrap bean that registers the dod:filePlan for creation when + * a dod:site is created. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class DOD5015FilePlanTypeBootstrap implements DOD5015Model +{ + /** RM site type bean */ + private RmSiteType rmSiteType; + + /** + * @param rmSiteType RM site type bean + */ + public void setRmSiteType(RmSiteType rmSiteType) + { + this.rmSiteType = rmSiteType; + } + + /** + * Init method + */ + public void init() + { + // register dod file plan type for the dod site type + rmSiteType.registerFilePlanType(TYPE_DOD_5015_SITE, TYPE_DOD_5015_FILE_PLAN); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015Model.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015Model.java index 7b6980a325..758d4a4d01 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015Model.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/DOD5015Model.java @@ -1,100 +1,100 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.dod5015; - -import org.alfresco.service.namespace.QName; - - -/** - * Helper class containing DOD 5015 model qualified names - * - * @author Roy Wetherall - */ -public interface DOD5015Model -{ - // Namespace details - String DOD_URI = "http://www.alfresco.org/model/dod5015/1.0"; - String DOD_PREFIX = "dod"; - - // DOD Site - QName TYPE_DOD_5015_SITE = QName.createQName(DOD_URI, "site"); - - // DOD File Plan - QName TYPE_DOD_5015_FILE_PLAN = QName.createQName(DOD_URI, "filePlan"); - - // DOD Record - QName ASPECT_DOD_5015_RECORD = QName.createQName(DOD_URI, "dod5015record"); - QName PROP_ORIGINATOR = QName.createQName(DOD_URI, "originator"); - QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(DOD_URI, "originatingOrganization"); - QName PROP_PUBLICATION_DATE = QName.createQName(DOD_URI, "publicationDate"); - QName PROP_MEDIA_TYPE = QName.createQName(DOD_URI, "mediaType"); - QName PROP_FORMAT = QName.createQName(DOD_URI, "format"); - QName PROP_DATE_RECEIVED = QName.createQName(DOD_URI, "dateReceived"); - QName PROP_ADDRESS = QName.createQName(DOD_URI, "address"); - QName PROP_OTHER_ADDRESS = QName.createQName(DOD_URI, "otherAddress"); - - // Scanned Record - QName ASPECT_SCANNED_RECORD = QName.createQName(DOD_URI, "scannedRecord"); - QName PROP_SCANNED_FORMAT = QName.createQName(DOD_URI, "scannedFormat"); - QName PROP_SCANNED_FORMAT_VERSION = QName.createQName(DOD_URI, "scannedFormatVersion"); - QName PROP_RESOLUTION_X = QName.createQName(DOD_URI, "resolutionX"); - QName PROP_RESOLUTION_Y = QName.createQName(DOD_URI, "resolutionY"); - QName PROP_SCANNED_BIT_DEPTH = QName.createQName(DOD_URI, "scannedBitDepth"); - - // PDF Record - QName ASPECT_PDF_RECORD = QName.createQName(DOD_URI, "pdfRecord"); - QName PROP_PRODUCING_APPLICATION = QName.createQName(DOD_URI, "producingApplication"); - QName PROP_PRODUCING_APPLICATION_VERSION = QName.createQName(DOD_URI, "producingApplicationVersion"); - QName PROP_PDF_VERSION = QName.createQName(DOD_URI, "pdfVersion"); - QName PROP_CREATING_APPLICATION = QName.createQName(DOD_URI, "creatingApplication"); - QName PROP_DOCUMENT_SECURITY_SETTINGS = QName.createQName(DOD_URI, "documentSecuritySettings"); - - // Digital Photograph Record - QName ASPECT_DIGITAL_PHOTOGRAPH_RECORD = QName.createQName(DOD_URI, "digitalPhotographRecord"); - QName PROP_CAPTION = QName.createQName(DOD_URI, "caption"); - QName PROP_PHOTOGRAPHER = QName.createQName(DOD_URI, "photographer"); - QName PROP_COPYRIGHT = QName.createQName(DOD_URI, "copyright"); - QName PROP_BIT_DEPTH = QName.createQName(DOD_URI, "bitDepth"); - QName PROP_IMAGE_SIZE_X = QName.createQName(DOD_URI, "imageSizeX"); - QName PROP_IMAGE_SIZE_Y = QName.createQName(DOD_URI, "imageSizeY"); - QName PROP_IMAGE_SOURCE = QName.createQName(DOD_URI, "imageSource"); - QName PROP_COMPRESSION = QName.createQName(DOD_URI, "compression"); - QName PROP_ICC_ICM_PROFILE = QName.createQName(DOD_URI, "iccIcmProfile"); - QName PROP_EXIF_INFORMATION = QName.createQName(DOD_URI, "exifInformation"); - - // Web Record - QName ASPECT_WEB_RECORD = QName.createQName(DOD_URI, "webRecord"); - QName PROP_WEB_FILE_NAME = QName.createQName(DOD_URI, "webFileName"); - QName PROP_WEB_PLATFORM = QName.createQName(DOD_URI, "webPlatform"); - QName PROP_WEBSITE_NAME = QName.createQName(DOD_URI, "webSiteName"); - QName PROP_WEB_SITE_URL = QName.createQName(DOD_URI, "webSiteURL"); - QName PROP_CAPTURE_METHOD = QName.createQName(DOD_URI, "captureMethod"); - QName PROP_CAPTURE_DATE = QName.createQName(DOD_URI, "captureDate"); - QName PROP_CONTACT = QName.createQName(DOD_URI, "contact"); - QName PROP_CONTENT_MANAGEMENT_SYSTEM = QName.createQName(DOD_URI, "contentManagementSystem"); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.dod5015; + +import org.alfresco.service.namespace.QName; + + +/** + * Helper class containing DOD 5015 model qualified names + * + * @author Roy Wetherall + */ +public interface DOD5015Model +{ + // Namespace details + String DOD_URI = "http://www.alfresco.org/model/dod5015/1.0"; + String DOD_PREFIX = "dod"; + + // DOD Site + QName TYPE_DOD_5015_SITE = QName.createQName(DOD_URI, "site"); + + // DOD File Plan + QName TYPE_DOD_5015_FILE_PLAN = QName.createQName(DOD_URI, "filePlan"); + + // DOD Record + QName ASPECT_DOD_5015_RECORD = QName.createQName(DOD_URI, "dod5015record"); + QName PROP_ORIGINATOR = QName.createQName(DOD_URI, "originator"); + QName PROP_ORIGINATING_ORGANIZATION = QName.createQName(DOD_URI, "originatingOrganization"); + QName PROP_PUBLICATION_DATE = QName.createQName(DOD_URI, "publicationDate"); + QName PROP_MEDIA_TYPE = QName.createQName(DOD_URI, "mediaType"); + QName PROP_FORMAT = QName.createQName(DOD_URI, "format"); + QName PROP_DATE_RECEIVED = QName.createQName(DOD_URI, "dateReceived"); + QName PROP_ADDRESS = QName.createQName(DOD_URI, "address"); + QName PROP_OTHER_ADDRESS = QName.createQName(DOD_URI, "otherAddress"); + + // Scanned Record + QName ASPECT_SCANNED_RECORD = QName.createQName(DOD_URI, "scannedRecord"); + QName PROP_SCANNED_FORMAT = QName.createQName(DOD_URI, "scannedFormat"); + QName PROP_SCANNED_FORMAT_VERSION = QName.createQName(DOD_URI, "scannedFormatVersion"); + QName PROP_RESOLUTION_X = QName.createQName(DOD_URI, "resolutionX"); + QName PROP_RESOLUTION_Y = QName.createQName(DOD_URI, "resolutionY"); + QName PROP_SCANNED_BIT_DEPTH = QName.createQName(DOD_URI, "scannedBitDepth"); + + // PDF Record + QName ASPECT_PDF_RECORD = QName.createQName(DOD_URI, "pdfRecord"); + QName PROP_PRODUCING_APPLICATION = QName.createQName(DOD_URI, "producingApplication"); + QName PROP_PRODUCING_APPLICATION_VERSION = QName.createQName(DOD_URI, "producingApplicationVersion"); + QName PROP_PDF_VERSION = QName.createQName(DOD_URI, "pdfVersion"); + QName PROP_CREATING_APPLICATION = QName.createQName(DOD_URI, "creatingApplication"); + QName PROP_DOCUMENT_SECURITY_SETTINGS = QName.createQName(DOD_URI, "documentSecuritySettings"); + + // Digital Photograph Record + QName ASPECT_DIGITAL_PHOTOGRAPH_RECORD = QName.createQName(DOD_URI, "digitalPhotographRecord"); + QName PROP_CAPTION = QName.createQName(DOD_URI, "caption"); + QName PROP_PHOTOGRAPHER = QName.createQName(DOD_URI, "photographer"); + QName PROP_COPYRIGHT = QName.createQName(DOD_URI, "copyright"); + QName PROP_BIT_DEPTH = QName.createQName(DOD_URI, "bitDepth"); + QName PROP_IMAGE_SIZE_X = QName.createQName(DOD_URI, "imageSizeX"); + QName PROP_IMAGE_SIZE_Y = QName.createQName(DOD_URI, "imageSizeY"); + QName PROP_IMAGE_SOURCE = QName.createQName(DOD_URI, "imageSource"); + QName PROP_COMPRESSION = QName.createQName(DOD_URI, "compression"); + QName PROP_ICC_ICM_PROFILE = QName.createQName(DOD_URI, "iccIcmProfile"); + QName PROP_EXIF_INFORMATION = QName.createQName(DOD_URI, "exifInformation"); + + // Web Record + QName ASPECT_WEB_RECORD = QName.createQName(DOD_URI, "webRecord"); + QName PROP_WEB_FILE_NAME = QName.createQName(DOD_URI, "webFileName"); + QName PROP_WEB_PLATFORM = QName.createQName(DOD_URI, "webPlatform"); + QName PROP_WEBSITE_NAME = QName.createQName(DOD_URI, "webSiteName"); + QName PROP_WEB_SITE_URL = QName.createQName(DOD_URI, "webSiteURL"); + QName PROP_CAPTURE_METHOD = QName.createQName(DOD_URI, "captureMethod"); + QName PROP_CAPTURE_DATE = QName.createQName(DOD_URI, "captureDate"); + QName PROP_CONTACT = QName.createQName(DOD_URI, "contact"); + QName PROP_CONTENT_MANAGEMENT_SYSTEM = QName.createQName(DOD_URI, "contentManagementSystem"); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java index 9e40cc961f..cc788aa650 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java @@ -1,103 +1,103 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.dod5015.model.dod.aspect; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * dod:dod5015record behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -public class DOD5015RecordAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnAddAspectPolicy, - DOD5015Model -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Ensure that the DOD record aspect meta-data is applied. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Behaviour - ( - kind=BehaviourKind.CLASS, - type="rma:record", - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - @Override - public void onAddAspect(NodeRef nodeRef, QName aspect) - { - if (nodeService.exists(nodeRef) && - !nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) && - isDODFilePlan(nodeRef)) - { - nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null); - } - } - - /** - * Helper method to indicate whether the records file plan is a DOD one or not. - * - * @param record record node reference - * @return boolean true if in DOD file plan, false otherwise - */ - private boolean isDODFilePlan(NodeRef record) - { - boolean result = false; - - NodeRef filePlan = filePlanService.getFilePlan(record); - if (filePlan != null && nodeService.exists(filePlan)) - { - result = TYPE_DOD_5015_FILE_PLAN.equals(nodeService.getType(filePlan)); - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.dod5015.model.dod.aspect; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +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.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * dod:dod5015record behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +public class DOD5015RecordAspect extends BaseBehaviourBean + implements NodeServicePolicies.OnAddAspectPolicy, + DOD5015Model +{ + /** file plan service */ + private FilePlanService filePlanService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Ensure that the DOD record aspect meta-data is applied. + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Behaviour + ( + kind=BehaviourKind.CLASS, + type="rma:record", + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + @Override + public void onAddAspect(NodeRef nodeRef, QName aspect) + { + if (nodeService.exists(nodeRef) && + !nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) && + isDODFilePlan(nodeRef)) + { + nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null); + } + } + + /** + * Helper method to indicate whether the records file plan is a DOD one or not. + * + * @param record record node reference + * @return boolean true if in DOD file plan, false otherwise + */ + private boolean isDODFilePlan(NodeRef record) + { + boolean result = false; + + NodeRef filePlan = filePlanService.getFilePlan(record); + if (filePlan != null && nodeService.exists(filePlan)) + { + result = TYPE_DOD_5015_FILE_PLAN.equals(nodeService.getType(filePlan)); + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java index 7ef98fb654..bd4b39c3d5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingService.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.email; - -import java.util.List; -import java.util.Set; - -/** - * Custom EMail Mapping Service - */ -public interface CustomEmailMappingService -{ - /** - * Get the list of custom mappings - * - * @return {@link Set}<{@link CustomMapping}> - */ - Set getCustomMappings(); - - /** - * Add custom mapping - * - * @param from - * @param to - */ - void addCustomMapping(String from, String to); - - /** - * Delete custom mapping - * - * @param from - * @param to - */ - void deleteCustomMapping(String from, String to); - - /** - * Gets the list of email mapping keys - * - * @return Email mapping keys - */ - List getEmailMappingKeys(); - - /** - * Registers an email mapping key with the existing list of email mapping keys - * - * @param emailMappingKey emailMappingKey to register - */ - void registerEMailMappingKey(String emailMappingKey); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.email; + +import java.util.List; +import java.util.Set; + +/** + * Custom EMail Mapping Service + */ +public interface CustomEmailMappingService +{ + /** + * Get the list of custom mappings + * + * @return {@link Set}<{@link CustomMapping}> + */ + Set getCustomMappings(); + + /** + * Add custom mapping + * + * @param from + * @param to + */ + void addCustomMapping(String from, String to); + + /** + * Delete custom mapping + * + * @param from + * @param to + */ + void deleteCustomMapping(String from, String to); + + /** + * Gets the list of email mapping keys + * + * @return Email mapping keys + */ + List getEmailMappingKeys(); + + /** + * Registers an email mapping key with the existing list of email mapping keys + * + * @param emailMappingKey emailMappingKey to register + */ + void registerEMailMappingKey(String emailMappingKey); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java index 3f2f417cbf..da07b6195c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java @@ -1,495 +1,495 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.email; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.content.metadata.RFC822MetadataExtracter; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -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.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespacePrefixResolver; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.context.ApplicationEvent; -import org.springframework.extensions.surf.util.AbstractLifecycleBean; - -/** - * Custom Email Mapping Service - */ -public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean implements CustomEmailMappingService -{ - /** Logger */ - private static Log logger = LogFactory.getLog(CustomEmailMappingServiceImpl.class); - - /** Node reference's to configuration elements */ - private static final NodeRef CONFIG_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_emailmapping_config"); - private static final NodeRef CONFIG_FOLDER_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); - - /** Config file name */ - private static final String CONFIG_NAME = "imapConfig.json"; - - /** Default custom mappings (TODO move to spring config) */ - private static final CustomMapping[] DEFAULT_MAPPINGS = - { - new CustomMapping("Date", "dod:dateReceived"), - new CustomMapping("messageTo", "dod:address"), - new CustomMapping("messageFrom", "dod:originator"), - new CustomMapping("messageSent", "dod:publicationDate"), - new CustomMapping("messageCc", "dod:otherAddress") - }; - - /** Extractor */ - private RFC822MetadataExtracter extracter; - - /** Services */ - private NodeService nodeService; - private NamespacePrefixResolver nspr; - private ContentService contentService; - private TransactionService transactionService; - - /** Transient set of custom mappings */ - private Set customMappings; - - /** List of email mapping keys */ - private List emailMappingKeys; - - /** - * @param nspr namespace service - */ - public void setNamespacePrefixResolver(NamespacePrefixResolver nspr) - { - this.nspr = nspr; - } - - /** - * @param extractor extractor component - */ - public void setExtracter(RFC822MetadataExtracter extractor) - { - this.extracter = extractor; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * @param emailMappingKeys email mapping keys - */ - public void setEmailMappingKeys(List emailMappingKeys) - { - this.emailMappingKeys = emailMappingKeys; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#getCustomMappings() - */ - public Set getCustomMappings() - { - if (customMappings == null) - { - // if we have a config file - if (nodeService.exists(CONFIG_NODE_REF)) - { - // load the contents of the config file - customMappings = loadConfig(); - } - else - { - customMappings = new HashSet(); - - // load the contents of the extractors property file - Map> currentMapping = extracter.getCurrentMapping(); - for (Map.Entry> entry : currentMapping.entrySet()) - { - Set set = entry.getValue(); - - for (QName qname : set) - { - CustomMapping value = new CustomMapping(); - value.setFrom(entry.getKey()); - QName resolvedQname = qname.getPrefixedQName(nspr); - value.setTo(resolvedQname.toPrefixString()); - customMappings.add(value); - } - } - - // if we have an old config file - NodeRef oldConfigNode = getOldConfigNode(); - if (oldConfigNode != null) - { - // load the contents of the old config file - Set oldMappings = readOldConfig(oldConfigNode); - customMappings.addAll(oldMappings); - } - - // load the hard coded mappings - for(CustomMapping mapping : DEFAULT_MAPPINGS) - { - customMappings.add(mapping); - } - - // create the config file - saveConfig(customMappings); - } - } - - return customMappings; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#addCustomMapping(java.lang.String, java.lang.String) - */ - public void addCustomMapping(String from, String to) - { - if (StringUtils.isBlank(from) || StringUtils.isBlank(to)) - { - throw new AlfrescoRuntimeException("Invalid values for from/to."); - } - - // create custom mapping - CustomMapping customMapping = new CustomMapping(from, to); - - // check whether we already have this mapping or not - Set customMappings = getCustomMappings(); - if (customMappings.contains(customMapping)) - { - throw new AlfrescoRuntimeException("Can not add custom email mapping, because duplicate mapping already exists."); - } - - // else add the custom mapping (since we have already called getCustomMapping we can be sure - // the member variable is populated) - customMappings.add(customMapping); - - // save the changes into the config file - saveConfig(customMappings); - - // update the extractors configuration - updateExtractor(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#deleteCustomMapping(java.lang.String, java.lang.String) - */ - public void deleteCustomMapping(String from, String to) - { - if (StringUtils.isBlank(from) || StringUtils.isBlank(to)) - { - throw new AlfrescoRuntimeException("Invalid values for from/to."); - } - - // create custom mapping - CustomMapping customMapping = new CustomMapping(from, to); - - // check whether we already have this mapping or not - Set customMappings = getCustomMappings(); - if (customMappings.contains(customMapping)) - { - // else remove the custom mapping (since we have already called getCustomMapping we can be sure - // the member variable is populated) - customMappings.remove(customMapping); - - // save the changes into the config file - saveConfig(customMappings); - - // update the extractors configuration - updateExtractor(); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#getEmailMappingKeys() - */ - @Override - public List getEmailMappingKeys() - { - return emailMappingKeys; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.email.EmailMappingKeyService#registerEMailMappingKey(java.lang.String) - */ - @Override - public void registerEMailMappingKey(String emailMappingKey) - { - ParameterCheck.mandatoryString("emailMappingKey", emailMappingKey); - - emailMappingKeys.add(emailMappingKey); - } - - /** - * Updates the extractor with the custom configuration. - */ - private void updateExtractor() - { - // convert the mapping information into the form understood by the extractor - Map> newMapping = new HashMap>(17); - for(CustomMapping mapping : getCustomMappings()) - { - QName newQName = QName.createQName(mapping.getTo(), nspr); - Set values = newMapping.get(mapping.getFrom()); - if(values == null) - { - values = new HashSet(); - newMapping.put(mapping.getFrom(), values); - } - values.add(newQName); - } - - // update the metadata extracter - extracter.setMapping(newMapping); - } - - /** - * Loads the custom mappings from the configuration file. - * - * @return - */ - private Set loadConfig() - { - Set result = new HashSet(); - ContentReader cr = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT); - if (cr != null) - { - String text = cr.getContentString(); - - try - { - JSONArray jsonArray = new JSONArray(new JSONTokener(text)); - for(int i = 0 ; i < jsonArray.length(); i++) - { - JSONObject obj = jsonArray.getJSONObject(i); - CustomMapping mapping = new CustomMapping(); - mapping.setFrom(obj.getString("from")); - mapping.setTo(obj.getString("to")); - result.add(mapping); - } - } - catch (JSONException je) - { - throw new AlfrescoRuntimeException("Unable to read custom email configuration", je); - } - } - - return result; - } - - /** - * - * @param customMappingsToSave - */ - private void saveConfig(Set customMappingsToSave) - { - if (!nodeService.exists(CONFIG_NODE_REF)) - { - // create the config node - Map properties = new HashMap(2); - properties.put(ContentModel.PROP_NAME, CONFIG_NAME); - properties.put(ContentModel.PROP_NODE_UUID, CONFIG_NODE_REF.getId()); - nodeService.createNode( - CONFIG_FOLDER_NODE_REF, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, CONFIG_NAME), - ContentModel.TYPE_CONTENT, - properties); - } - - // build JSON array of mappings - JSONArray jsonMappings = new JSONArray(); - try - { - for(CustomMapping mapping : customMappingsToSave) - { - JSONObject obj = new JSONObject(); - obj.put("from", mapping.getFrom()); - obj.put("to", mapping.getTo()); - jsonMappings.put(obj); - } - } - catch (JSONException je) - { - throw new AlfrescoRuntimeException("Unable to create JSON email mapping configuration during save.", je); - } - - // update the content - ContentWriter writer = this.contentService.getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(jsonMappings.toString()); - } - - /** - * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onBootstrap(ApplicationEvent event) - { - // run as System on bootstrap - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() - { - try - { - // update the extractor with the custom mappings - updateExtractor(); - } - catch (RuntimeException e) - { - // log a warning - if (logger.isWarnEnabled()) - { - logger.warn(e.getMessage()); - } - - // reset the mappings - customMappings = null; - - // rethrow - throw e; - } - return null; - } - }; - transactionService.getRetryingTransactionHelper().doInTransaction(callback); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onShutdown(ApplicationEvent arg0) - { - // No implementation - } - - /** - * Helper method to get the old configuration node. This is used during the migration - * from 1.0 to 2.0. - *

- * Returns null if it does not exist. - * - * @return {@link NodeRef} node reference of the old configuration node, null otherwise - */ - private NodeRef getOldConfigNode() - { - NodeRef rootNode = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_EMAIL_CONFIG, CONFIG_NAME); - } - - /** - * Reads the old configuration node. This is used during the migration from 1.0 to 2.0. - * - * @param nodeRef the old configuration node reference - * @return {@link Set}<{@link CustomMapping}> set of the custom mappings stored in the old configuration - */ - private Set readOldConfig(NodeRef nodeRef) - { - Set newMappings = new HashSet(); - - ContentReader cr = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); - if (cr != null) - { - String text = cr.getContentString(); - - try - { - JSONArray jsonArray = new JSONArray(new JSONTokener(text)); - for(int i = 0 ; i < jsonArray.length(); i++) - { - JSONObject obj = jsonArray.getJSONObject(i); - CustomMapping mapping = new CustomMapping(); - mapping.setFrom(obj.getString("from")); - mapping.setTo(obj.getString("to")); - newMappings.add(mapping); - } - return newMappings; - } - catch (JSONException je) - { - logger.warn("unable to read custom email configuration", je); - return newMappings; - } - - } - return newMappings; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.email; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.content.metadata.RFC822MetadataExtracter; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +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.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespacePrefixResolver; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.context.ApplicationEvent; +import org.springframework.extensions.surf.util.AbstractLifecycleBean; + +/** + * Custom Email Mapping Service + */ +public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean implements CustomEmailMappingService +{ + /** Logger */ + private static Log logger = LogFactory.getLog(CustomEmailMappingServiceImpl.class); + + /** Node reference's to configuration elements */ + private static final NodeRef CONFIG_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_emailmapping_config"); + private static final NodeRef CONFIG_FOLDER_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); + + /** Config file name */ + private static final String CONFIG_NAME = "imapConfig.json"; + + /** Default custom mappings (TODO move to spring config) */ + private static final CustomMapping[] DEFAULT_MAPPINGS = + { + new CustomMapping("Date", "dod:dateReceived"), + new CustomMapping("messageTo", "dod:address"), + new CustomMapping("messageFrom", "dod:originator"), + new CustomMapping("messageSent", "dod:publicationDate"), + new CustomMapping("messageCc", "dod:otherAddress") + }; + + /** Extractor */ + private RFC822MetadataExtracter extracter; + + /** Services */ + private NodeService nodeService; + private NamespacePrefixResolver nspr; + private ContentService contentService; + private TransactionService transactionService; + + /** Transient set of custom mappings */ + private Set customMappings; + + /** List of email mapping keys */ + private List emailMappingKeys; + + /** + * @param nspr namespace service + */ + public void setNamespacePrefixResolver(NamespacePrefixResolver nspr) + { + this.nspr = nspr; + } + + /** + * @param extractor extractor component + */ + public void setExtracter(RFC822MetadataExtracter extractor) + { + this.extracter = extractor; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * @param transactionService transaction service + */ + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + /** + * @param emailMappingKeys email mapping keys + */ + public void setEmailMappingKeys(List emailMappingKeys) + { + this.emailMappingKeys = emailMappingKeys; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#getCustomMappings() + */ + public Set getCustomMappings() + { + if (customMappings == null) + { + // if we have a config file + if (nodeService.exists(CONFIG_NODE_REF)) + { + // load the contents of the config file + customMappings = loadConfig(); + } + else + { + customMappings = new HashSet(); + + // load the contents of the extractors property file + Map> currentMapping = extracter.getCurrentMapping(); + for (Map.Entry> entry : currentMapping.entrySet()) + { + Set set = entry.getValue(); + + for (QName qname : set) + { + CustomMapping value = new CustomMapping(); + value.setFrom(entry.getKey()); + QName resolvedQname = qname.getPrefixedQName(nspr); + value.setTo(resolvedQname.toPrefixString()); + customMappings.add(value); + } + } + + // if we have an old config file + NodeRef oldConfigNode = getOldConfigNode(); + if (oldConfigNode != null) + { + // load the contents of the old config file + Set oldMappings = readOldConfig(oldConfigNode); + customMappings.addAll(oldMappings); + } + + // load the hard coded mappings + for(CustomMapping mapping : DEFAULT_MAPPINGS) + { + customMappings.add(mapping); + } + + // create the config file + saveConfig(customMappings); + } + } + + return customMappings; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#addCustomMapping(java.lang.String, java.lang.String) + */ + public void addCustomMapping(String from, String to) + { + if (StringUtils.isBlank(from) || StringUtils.isBlank(to)) + { + throw new AlfrescoRuntimeException("Invalid values for from/to."); + } + + // create custom mapping + CustomMapping customMapping = new CustomMapping(from, to); + + // check whether we already have this mapping or not + Set customMappings = getCustomMappings(); + if (customMappings.contains(customMapping)) + { + throw new AlfrescoRuntimeException("Can not add custom email mapping, because duplicate mapping already exists."); + } + + // else add the custom mapping (since we have already called getCustomMapping we can be sure + // the member variable is populated) + customMappings.add(customMapping); + + // save the changes into the config file + saveConfig(customMappings); + + // update the extractors configuration + updateExtractor(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#deleteCustomMapping(java.lang.String, java.lang.String) + */ + public void deleteCustomMapping(String from, String to) + { + if (StringUtils.isBlank(from) || StringUtils.isBlank(to)) + { + throw new AlfrescoRuntimeException("Invalid values for from/to."); + } + + // create custom mapping + CustomMapping customMapping = new CustomMapping(from, to); + + // check whether we already have this mapping or not + Set customMappings = getCustomMappings(); + if (customMappings.contains(customMapping)) + { + // else remove the custom mapping (since we have already called getCustomMapping we can be sure + // the member variable is populated) + customMappings.remove(customMapping); + + // save the changes into the config file + saveConfig(customMappings); + + // update the extractors configuration + updateExtractor(); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService#getEmailMappingKeys() + */ + @Override + public List getEmailMappingKeys() + { + return emailMappingKeys; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.email.EmailMappingKeyService#registerEMailMappingKey(java.lang.String) + */ + @Override + public void registerEMailMappingKey(String emailMappingKey) + { + ParameterCheck.mandatoryString("emailMappingKey", emailMappingKey); + + emailMappingKeys.add(emailMappingKey); + } + + /** + * Updates the extractor with the custom configuration. + */ + private void updateExtractor() + { + // convert the mapping information into the form understood by the extractor + Map> newMapping = new HashMap>(17); + for(CustomMapping mapping : getCustomMappings()) + { + QName newQName = QName.createQName(mapping.getTo(), nspr); + Set values = newMapping.get(mapping.getFrom()); + if(values == null) + { + values = new HashSet(); + newMapping.put(mapping.getFrom(), values); + } + values.add(newQName); + } + + // update the metadata extracter + extracter.setMapping(newMapping); + } + + /** + * Loads the custom mappings from the configuration file. + * + * @return + */ + private Set loadConfig() + { + Set result = new HashSet(); + ContentReader cr = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT); + if (cr != null) + { + String text = cr.getContentString(); + + try + { + JSONArray jsonArray = new JSONArray(new JSONTokener(text)); + for(int i = 0 ; i < jsonArray.length(); i++) + { + JSONObject obj = jsonArray.getJSONObject(i); + CustomMapping mapping = new CustomMapping(); + mapping.setFrom(obj.getString("from")); + mapping.setTo(obj.getString("to")); + result.add(mapping); + } + } + catch (JSONException je) + { + throw new AlfrescoRuntimeException("Unable to read custom email configuration", je); + } + } + + return result; + } + + /** + * + * @param customMappingsToSave + */ + private void saveConfig(Set customMappingsToSave) + { + if (!nodeService.exists(CONFIG_NODE_REF)) + { + // create the config node + Map properties = new HashMap(2); + properties.put(ContentModel.PROP_NAME, CONFIG_NAME); + properties.put(ContentModel.PROP_NODE_UUID, CONFIG_NODE_REF.getId()); + nodeService.createNode( + CONFIG_FOLDER_NODE_REF, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, CONFIG_NAME), + ContentModel.TYPE_CONTENT, + properties); + } + + // build JSON array of mappings + JSONArray jsonMappings = new JSONArray(); + try + { + for(CustomMapping mapping : customMappingsToSave) + { + JSONObject obj = new JSONObject(); + obj.put("from", mapping.getFrom()); + obj.put("to", mapping.getTo()); + jsonMappings.put(obj); + } + } + catch (JSONException je) + { + throw new AlfrescoRuntimeException("Unable to create JSON email mapping configuration during save.", je); + } + + // update the content + ContentWriter writer = this.contentService.getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.setEncoding("UTF-8"); + writer.putContent(jsonMappings.toString()); + } + + /** + * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onBootstrap(org.springframework.context.ApplicationEvent) + */ + @Override + protected void onBootstrap(ApplicationEvent event) + { + // run as System on bootstrap + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + RetryingTransactionCallback callback = new RetryingTransactionCallback() + { + public Void execute() + { + try + { + // update the extractor with the custom mappings + updateExtractor(); + } + catch (RuntimeException e) + { + // log a warning + if (logger.isWarnEnabled()) + { + logger.warn(e.getMessage()); + } + + // reset the mappings + customMappings = null; + + // rethrow + throw e; + } + return null; + } + }; + transactionService.getRetryingTransactionHelper().doInTransaction(callback); + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.springframework.extensions.surf.util.AbstractLifecycleBean#onShutdown(org.springframework.context.ApplicationEvent) + */ + @Override + protected void onShutdown(ApplicationEvent arg0) + { + // No implementation + } + + /** + * Helper method to get the old configuration node. This is used during the migration + * from 1.0 to 2.0. + *

+ * Returns null if it does not exist. + * + * @return {@link NodeRef} node reference of the old configuration node, null otherwise + */ + private NodeRef getOldConfigNode() + { + NodeRef rootNode = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); + return nodeService.getChildByName(rootNode, RecordsManagementModel.ASSOC_EMAIL_CONFIG, CONFIG_NAME); + } + + /** + * Reads the old configuration node. This is used during the migration from 1.0 to 2.0. + * + * @param nodeRef the old configuration node reference + * @return {@link Set}<{@link CustomMapping}> set of the custom mappings stored in the old configuration + */ + private Set readOldConfig(NodeRef nodeRef) + { + Set newMappings = new HashSet(); + + ContentReader cr = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); + if (cr != null) + { + String text = cr.getContentString(); + + try + { + JSONArray jsonArray = new JSONArray(new JSONTokener(text)); + for(int i = 0 ; i < jsonArray.length(); i++) + { + JSONObject obj = jsonArray.getJSONObject(i); + CustomMapping mapping = new CustomMapping(); + mapping.setFrom(obj.getString("from")); + mapping.setTo(obj.getString("to")); + newMappings.add(mapping); + } + return newMappings; + } + catch (JSONException je) + { + logger.warn("unable to read custom email configuration", je); + return newMappings; + } + + } + return newMappings; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomMapping.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomMapping.java index ec347337ad..0c1de8e93c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomMapping.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomMapping.java @@ -1,120 +1,120 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.email; - -/** - * Custom EMail Mapping - */ -public class CustomMapping -{ - private String from; - private String to; - - /** - * Default constructor. - */ - public CustomMapping() - { - } - - /** - * Default constructor. - * @param from - * @param to - */ - public CustomMapping(String from, String to) - { - this.from = from; - this.to = to; - } - - public void setFrom(String from) - { - this.from = from; - } - - public String getFrom() - { - return from; - } - - public void setTo(String to) - { - this.to = to; - } - - public String getTo() - { - return to; - } - - public int hashCode() - { - if(from != null && to != null) - { - return (from + to).hashCode(); - } - else - { - return 1; - } - } - - /* - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) - { - return false; - } - - final CustomMapping other = (CustomMapping) obj; - - if (!from.equals(other.getFrom())) - { - return false; - } - if (!to.equals(other.getTo())) - { - return false; - } - return true; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.email; + +/** + * Custom EMail Mapping + */ +public class CustomMapping +{ + private String from; + private String to; + + /** + * Default constructor. + */ + public CustomMapping() + { + } + + /** + * Default constructor. + * @param from + * @param to + */ + public CustomMapping(String from, String to) + { + this.from = from; + this.to = to; + } + + public void setFrom(String from) + { + this.from = from; + } + + public String getFrom() + { + return from; + } + + public void setTo(String to) + { + this.to = to; + } + + public String getTo() + { + return to; + } + + public int hashCode() + { + if(from != null && to != null) + { + return (from + to).hashCode(); + } + else + { + return 1; + } + } + + /* + * (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj == null) + { + return false; + } + if (getClass() != obj.getClass()) + { + return false; + } + + final CustomMapping other = (CustomMapping) obj; + + if (!from.equals(other.getFrom())) + { + return false; + } + if (!to.equals(other.getTo())) + { + return false; + } + return true; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java index 2a8f4600f3..7a02219f29 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomisableEmailMappingKeyBootstrap.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.email; - -import java.util.List; - -/** - * Bootstrap bean that indicates that the specified mappings are customisable - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class CustomisableEmailMappingKeyBootstrap -{ - /** List of mappings to register as customisable */ - private List customisable; - - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * @param customizable list of mappings to register as customisable - */ - public void setCustomisable(List customisable) - { - this.customisable = customisable; - } - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - /** - * Bean initialisation method - */ - public void init() - { - for (String customEmailMappingKey : customisable) - { - customEmailMappingService.registerEMailMappingKey(customEmailMappingKey); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.email; + +import java.util.List; + +/** + * Bootstrap bean that indicates that the specified mappings are customisable + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class CustomisableEmailMappingKeyBootstrap +{ + /** List of mappings to register as customisable */ + private List customisable; + + /** Custom email mapping service */ + private CustomEmailMappingService customEmailMappingService; + + /** + * @param customizable list of mappings to register as customisable + */ + public void setCustomisable(List customisable) + { + this.customisable = customisable; + } + + /** + * Custom email mapping service + * + * @param customEmailMappingService the custom email mapping service + */ + public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) + { + this.customEmailMappingService = customEmailMappingService; + } + + /** + * Bean initialisation method + */ + public void init() + { + for (String customEmailMappingKey : customisable) + { + customEmailMappingService.registerEMailMappingKey(customEmailMappingKey); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java index 116a3aea6f..476c749617 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java @@ -1,120 +1,120 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.email; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; - -/** - * Extended RFC822 Metadata Extractor that is sensitive to whether we are in a RM - * site or not. - * - * @author Roy Wetherall - */ -public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.RFC822MetadataExtracter -{ - /** Reference to default properties */ - private static final String PROPERTIES_URL = "alfresco/metadata/RFC822MetadataExtracter.properties"; - - /** Node service */ - private NodeService nodeService; - - /** - * Sets the node service - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter#filterSystemProperties(java.util.Map, java.util.Map) - */ - @Override - protected void filterSystemProperties(Map systemProperties, Map targetProperties) - { - NodeRef nodeRef = getNodeRef(targetProperties); - if (nodeRef == null || !nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) - { - // Remove all rm namespace properties from the system map - Map clone = new HashMap(systemProperties); - for (QName propName : clone.keySet()) - { - if (RecordsManagementModel.RM_URI.equals(propName.getNamespaceURI())) - { - systemProperties.remove(propName); - } - } - } - } - - /** - * @see org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter#getDefaultMapping() - */ - protected Map> getDefaultMapping() - { - // Attempt to load the properties - return readMappingProperties(PROPERTIES_URL); - } - - /** - * Given a set of properties, try and retrieve the node reference - * @param properties node properties - * @return NodeRef null if none, otherwise valid node reference - */ - private NodeRef getNodeRef(Map properties) - { - NodeRef result = null; - - // Get the elements of the node reference - String storeProto = (String)properties.get(ContentModel.PROP_STORE_PROTOCOL); - String storeId = (String)properties.get(ContentModel.PROP_STORE_IDENTIFIER); - String nodeId = (String)properties.get(ContentModel.PROP_NODE_UUID); - - if (storeProto != null && storeProto.length() != 0 && - storeId != null && storeId.length() != 0 && - nodeId != null && nodeId.length() != 0) - - { - // Create the node reference - result = new NodeRef(new StoreRef(storeProto, storeId), nodeId); - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.email; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.QName; + +/** + * Extended RFC822 Metadata Extractor that is sensitive to whether we are in a RM + * site or not. + * + * @author Roy Wetherall + */ +public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.RFC822MetadataExtracter +{ + /** Reference to default properties */ + private static final String PROPERTIES_URL = "alfresco/metadata/RFC822MetadataExtracter.properties"; + + /** Node service */ + private NodeService nodeService; + + /** + * Sets the node service + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @see org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter#filterSystemProperties(java.util.Map, java.util.Map) + */ + @Override + protected void filterSystemProperties(Map systemProperties, Map targetProperties) + { + NodeRef nodeRef = getNodeRef(targetProperties); + if (nodeRef == null || !nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) + { + // Remove all rm namespace properties from the system map + Map clone = new HashMap(systemProperties); + for (QName propName : clone.keySet()) + { + if (RecordsManagementModel.RM_URI.equals(propName.getNamespaceURI())) + { + systemProperties.remove(propName); + } + } + } + } + + /** + * @see org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter#getDefaultMapping() + */ + protected Map> getDefaultMapping() + { + // Attempt to load the properties + return readMappingProperties(PROPERTIES_URL); + } + + /** + * Given a set of properties, try and retrieve the node reference + * @param properties node properties + * @return NodeRef null if none, otherwise valid node reference + */ + private NodeRef getNodeRef(Map properties) + { + NodeRef result = null; + + // Get the elements of the node reference + String storeProto = (String)properties.get(ContentModel.PROP_STORE_PROTOCOL); + String storeId = (String)properties.get(ContentModel.PROP_STORE_IDENTIFIER); + String nodeId = (String)properties.get(ContentModel.PROP_NODE_UUID); + + if (storeProto != null && storeProto.length() != 0 && + storeId != null && storeId.length() != 0 && + nodeId != null && nodeId.length() != 0) + + { + // Create the node reference + result = new NodeRef(new StoreRef(storeProto, storeId), nodeId); + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/EventCompletionDetails.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/EventCompletionDetails.java index eb4224d429..e0415d8f5e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/EventCompletionDetails.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/EventCompletionDetails.java @@ -1,176 +1,176 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.event; - -import java.util.Date; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Event completion details - * - * @author Roy Wetherall - */ -public class EventCompletionDetails -{ - /** node reference */ - private NodeRef nodeRef; - - /** event name */ - private String eventName; - private String eventLabel; - private boolean eventExecutionAutomatic; - private boolean eventComplete; - private Date eventCompletedAt; - private String eventCompletedBy; - - - /** - * Constructor - * - * @param nodeRef node reference - * @param eventName event name - * @param eventLabel event label - * @param eventExecutionAutomatic indicates whether the event is executed automatically or not - * @param eventComplete indicates whether the event is complete or not - * @param eventCompletedAt when the event was completed - * @param eventCompletedBy who completed the event - */ - public EventCompletionDetails( NodeRef nodeRef, - String eventName, - String eventLabel, - boolean eventExecutionAutomatic, - boolean eventComplete, - Date eventCompletedAt, - String eventCompletedBy) - { - this.nodeRef = nodeRef; - this.eventName = eventName; - this.eventLabel = eventLabel; - this.eventExecutionAutomatic = eventExecutionAutomatic; - this.eventComplete = eventComplete; - this.eventCompletedAt = eventCompletedAt; - this.eventCompletedBy = eventCompletedBy; - } - - /** - * @return the node reference - */ - public NodeRef getNodeRef() - { - return nodeRef; - } - - /** - * @return the eventName - */ - public String getEventName() - { - return eventName; - } - - /** - * @param eventName the eventName to set - */ - public void setEventName(String eventName) - { - this.eventName = eventName; - } - - /** - * @return The display label of the event - */ - public String getEventLabel() - { - return this.eventLabel; - } - - /** - * @return the eventExecutionAutomatic - */ - public boolean isEventExecutionAutomatic() - { - return eventExecutionAutomatic; - } - - /** - * @param eventExecutionAutomatic the eventExecutionAutomatic to set - */ - public void setEventExecutionAutomatic(boolean eventExecutionAutomatic) - { - this.eventExecutionAutomatic = eventExecutionAutomatic; - } - - /** - * @return the eventComplete - */ - public boolean isEventComplete() - { - return eventComplete; - } - - /** - * @param eventComplete the eventComplete to set - */ - public void setEventComplete(boolean eventComplete) - { - this.eventComplete = eventComplete; - } - - /** - * @return the eventCompletedAt - */ - public Date getEventCompletedAt() - { - return eventCompletedAt; - } - - /** - * @param eventCompletedAt the eventCompletedAt to set - */ - public void setEventCompletedAt(Date eventCompletedAt) - { - this.eventCompletedAt = eventCompletedAt; - } - - /** - * @return the eventCompletedBy - */ - public String getEventCompletedBy() - { - return eventCompletedBy; - } - - /** - * @param eventCompletedBy the eventCompletedBy to set - */ - public void setEventCompletedBy(String eventCompletedBy) - { - this.eventCompletedBy = eventCompletedBy; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.event; + +import java.util.Date; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Event completion details + * + * @author Roy Wetherall + */ +public class EventCompletionDetails +{ + /** node reference */ + private NodeRef nodeRef; + + /** event name */ + private String eventName; + private String eventLabel; + private boolean eventExecutionAutomatic; + private boolean eventComplete; + private Date eventCompletedAt; + private String eventCompletedBy; + + + /** + * Constructor + * + * @param nodeRef node reference + * @param eventName event name + * @param eventLabel event label + * @param eventExecutionAutomatic indicates whether the event is executed automatically or not + * @param eventComplete indicates whether the event is complete or not + * @param eventCompletedAt when the event was completed + * @param eventCompletedBy who completed the event + */ + public EventCompletionDetails( NodeRef nodeRef, + String eventName, + String eventLabel, + boolean eventExecutionAutomatic, + boolean eventComplete, + Date eventCompletedAt, + String eventCompletedBy) + { + this.nodeRef = nodeRef; + this.eventName = eventName; + this.eventLabel = eventLabel; + this.eventExecutionAutomatic = eventExecutionAutomatic; + this.eventComplete = eventComplete; + this.eventCompletedAt = eventCompletedAt; + this.eventCompletedBy = eventCompletedBy; + } + + /** + * @return the node reference + */ + public NodeRef getNodeRef() + { + return nodeRef; + } + + /** + * @return the eventName + */ + public String getEventName() + { + return eventName; + } + + /** + * @param eventName the eventName to set + */ + public void setEventName(String eventName) + { + this.eventName = eventName; + } + + /** + * @return The display label of the event + */ + public String getEventLabel() + { + return this.eventLabel; + } + + /** + * @return the eventExecutionAutomatic + */ + public boolean isEventExecutionAutomatic() + { + return eventExecutionAutomatic; + } + + /** + * @param eventExecutionAutomatic the eventExecutionAutomatic to set + */ + public void setEventExecutionAutomatic(boolean eventExecutionAutomatic) + { + this.eventExecutionAutomatic = eventExecutionAutomatic; + } + + /** + * @return the eventComplete + */ + public boolean isEventComplete() + { + return eventComplete; + } + + /** + * @param eventComplete the eventComplete to set + */ + public void setEventComplete(boolean eventComplete) + { + this.eventComplete = eventComplete; + } + + /** + * @return the eventCompletedAt + */ + public Date getEventCompletedAt() + { + return eventCompletedAt; + } + + /** + * @param eventCompletedAt the eventCompletedAt to set + */ + public void setEventCompletedAt(Date eventCompletedAt) + { + this.eventCompletedAt = eventCompletedAt; + } + + /** + * @return the eventCompletedBy + */ + public String getEventCompletedBy() + { + return eventCompletedBy; + } + + /** + * @param eventCompletedBy the eventCompletedBy to set + */ + public void setEventCompletedBy(String eventCompletedBy) + { + this.eventCompletedBy = eventCompletedBy; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java index 25a754bbd6..5a730aebe7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java @@ -1,153 +1,153 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.event; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * On reference create event type - * - * @author Roy Wetherall - */ -@BehaviourBean -public class OnReferenceCreateEventType extends SimpleRecordsManagementEventTypeImpl - implements RecordsManagementModel, - OnCreateReference -{ - /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Reference */ - private QName reference; - - /** - * @param dispositionService the disposition service to set - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordsManagementActionService the recordsManagementActionService to set - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * Set the reference - * - * @param reference - */ - public void setReferenceName(String reference) - { - this.reference = QName.createQName(reference); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.SimpleRecordsManagementEventTypeImpl#isAutomaticEvent() - */ - @Override - public boolean isAutomaticEvent() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference#onCreateReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:record", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateReference(final NodeRef fromNodeRef, final NodeRef toNodeRef, final QName reference) - { - AuthenticationUtil.RunAsWork work = new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - // Check whether it is the reference type we care about - if (reference.equals(OnReferenceCreateEventType.this.reference)) - { - DispositionAction da = dispositionService.getNextDispositionAction(toNodeRef); - if (da != null) - { - List events = da.getEventCompletionDetails(); - for (EventCompletionDetails event : events) - { - RecordsManagementEvent rmEvent = getRecordsManagementEventService().getEvent(event.getEventName()); - if (!event.isEventComplete() && - rmEvent.getType().equals(getName())) - { - // Complete the event - Map params = new HashMap(3); - params.put(CompleteEventAction.PARAM_EVENT_NAME, event.getEventName()); - params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_BY, AuthenticationUtil.getFullyAuthenticatedUser()); - params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_AT, new Date()); - recordsManagementActionService.executeRecordsManagementAction(toNodeRef, "completeEvent", params); - - break; - } - } - } - } - - return null; - } - }; - - AuthenticationUtil.runAs(work, AuthenticationUtil.getAdminUserName()); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.event; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * On reference create event type + * + * @author Roy Wetherall + */ +@BehaviourBean +public class OnReferenceCreateEventType extends SimpleRecordsManagementEventTypeImpl + implements RecordsManagementModel, + OnCreateReference +{ + /** Records management action service */ + private RecordsManagementActionService recordsManagementActionService; + + /** Disposition service */ + private DispositionService dispositionService; + + /** Reference */ + private QName reference; + + /** + * @param dispositionService the disposition service to set + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param recordsManagementActionService the recordsManagementActionService to set + */ + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * Set the reference + * + * @param reference + */ + public void setReferenceName(String reference) + { + this.reference = QName.createQName(reference); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.SimpleRecordsManagementEventTypeImpl#isAutomaticEvent() + */ + @Override + public boolean isAutomaticEvent() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference#onCreateReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:record", + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onCreateReference(final NodeRef fromNodeRef, final NodeRef toNodeRef, final QName reference) + { + AuthenticationUtil.RunAsWork work = new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + // Check whether it is the reference type we care about + if (reference.equals(OnReferenceCreateEventType.this.reference)) + { + DispositionAction da = dispositionService.getNextDispositionAction(toNodeRef); + if (da != null) + { + List events = da.getEventCompletionDetails(); + for (EventCompletionDetails event : events) + { + RecordsManagementEvent rmEvent = getRecordsManagementEventService().getEvent(event.getEventName()); + if (!event.isEventComplete() && + rmEvent.getType().equals(getName())) + { + // Complete the event + Map params = new HashMap(3); + params.put(CompleteEventAction.PARAM_EVENT_NAME, event.getEventName()); + params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_BY, AuthenticationUtil.getFullyAuthenticatedUser()); + params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_AT, new Date()); + recordsManagementActionService.executeRecordsManagementAction(toNodeRef, "completeEvent", params); + + break; + } + } + } + } + + return null; + } + }; + + AuthenticationUtil.runAs(work, AuthenticationUtil.getAdminUserName()); + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java index a0f5c6e612..036ed51c7c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java @@ -1,260 +1,260 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.event; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; - -/** - * Behaviour executed when a references record is actioned upon. - * - * @author Roy Wetherall - */ -@BehaviourBean -public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEventTypeImpl - implements RecordsManagementModel, - BeforeRMActionExecution - -{ - /** Disposition service */ - private DispositionService dispositionService; - - /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** Node service */ - private NodeService nodeService; - - /** Record service */ - private RecordService recordService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Action name */ - private String actionName; - - /** Reference */ - private QName reference; - - /** - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordsManagementActionService the recordsManagementActionService to set - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param reference reference name - */ - public void setReferenceName(String reference) - { - this.reference = QName.createQName(reference); - } - - /** - * @param actionName action name - */ - public void setActionName(String actionName) - { - this.actionName = actionName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.SimpleRecordsManagementEventTypeImpl#isAutomaticEvent() - */ - @Override - public boolean isAutomaticEvent() - { - return true; - } - - /** - * Before action exeuction behaviour. - * - * @param nodeRef - * @param name - * @param parameters - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:filePlanComponent", - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void beforeRMActionExecution(final NodeRef nodeRef, final String name, final Map parameters) - { - AuthenticationUtil.RunAsWork work = new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - if (nodeService.exists(nodeRef) && name.equals(actionName)) - { - QName type = nodeService.getType(nodeRef); - if (TYPE_TRANSFER.equals(type)) - { - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - processRecordFolder(assoc.getChildRef()); - } - } - else - { - processRecordFolder(nodeRef); - } - } - - return null; - } - }; - - AuthenticationUtil.runAs(work, AuthenticationUtil.getAdminUserName()); - - } - - private void processRecordFolder(NodeRef recordFolder) - { - if (recordService.isRecord(recordFolder)) - { - processRecord(recordFolder); - } - else if (recordFolderService.isRecordFolder(recordFolder)) - { - for (NodeRef record : recordService.getRecords(recordFolder)) - { - processRecord(record); - } - } - } - - private void processRecord(NodeRef record) - { - List fromAssocs = nodeService.getTargetAssocs(record, RegexQNamePattern.MATCH_ALL); - for (AssociationRef fromAssoc : fromAssocs) - { - if (reference.equals(fromAssoc.getTypeQName())) - { - NodeRef nodeRef = fromAssoc.getTargetRef(); - doEventComplete(nodeRef); - } - } - - List toAssocs = nodeService.getSourceAssocs(record, RegexQNamePattern.MATCH_ALL); - for (AssociationRef toAssoc : toAssocs) - { - if (reference.equals(toAssoc.getTypeQName())) - { - NodeRef nodeRef = toAssoc.getSourceRef(); - doEventComplete(nodeRef); - } - } - } - - private void doEventComplete(NodeRef nodeRef) - { - DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); - if (da != null) - { - List events = da.getEventCompletionDetails(); - for (EventCompletionDetails event : events) - { - RecordsManagementEvent rmEvent = getRecordsManagementEventService().getEvent(event.getEventName()); - if (!event.isEventComplete() && - rmEvent.getType().equals(getName())) - { - // Complete the event - Map params = new HashMap(3); - params.put(CompleteEventAction.PARAM_EVENT_NAME, event.getEventName()); - params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_BY, AuthenticationUtil.getFullyAuthenticatedUser()); - params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_AT, new Date()); - recordsManagementActionService.executeRecordsManagementAction(nodeRef, "completeEvent", params); - - break; - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.event; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; + +/** + * Behaviour executed when a references record is actioned upon. + * + * @author Roy Wetherall + */ +@BehaviourBean +public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEventTypeImpl + implements RecordsManagementModel, + BeforeRMActionExecution + +{ + /** Disposition service */ + private DispositionService dispositionService; + + /** Records management action service */ + private RecordsManagementActionService recordsManagementActionService; + + /** Node service */ + private NodeService nodeService; + + /** Record service */ + private RecordService recordService; + + /** Record folder service */ + private RecordFolderService recordFolderService; + + /** Action name */ + private String actionName; + + /** Reference */ + private QName reference; + + /** + * @param dispositionService the disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param recordsManagementActionService the recordsManagementActionService to set + */ + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param reference reference name + */ + public void setReferenceName(String reference) + { + this.reference = QName.createQName(reference); + } + + /** + * @param actionName action name + */ + public void setActionName(String actionName) + { + this.actionName = actionName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.SimpleRecordsManagementEventTypeImpl#isAutomaticEvent() + */ + @Override + public boolean isAutomaticEvent() + { + return true; + } + + /** + * Before action exeuction behaviour. + * + * @param nodeRef + * @param name + * @param parameters + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "rma:filePlanComponent", + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void beforeRMActionExecution(final NodeRef nodeRef, final String name, final Map parameters) + { + AuthenticationUtil.RunAsWork work = new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + if (nodeService.exists(nodeRef) && name.equals(actionName)) + { + QName type = nodeService.getType(nodeRef); + if (TYPE_TRANSFER.equals(type)) + { + List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + processRecordFolder(assoc.getChildRef()); + } + } + else + { + processRecordFolder(nodeRef); + } + } + + return null; + } + }; + + AuthenticationUtil.runAs(work, AuthenticationUtil.getAdminUserName()); + + } + + private void processRecordFolder(NodeRef recordFolder) + { + if (recordService.isRecord(recordFolder)) + { + processRecord(recordFolder); + } + else if (recordFolderService.isRecordFolder(recordFolder)) + { + for (NodeRef record : recordService.getRecords(recordFolder)) + { + processRecord(record); + } + } + } + + private void processRecord(NodeRef record) + { + List fromAssocs = nodeService.getTargetAssocs(record, RegexQNamePattern.MATCH_ALL); + for (AssociationRef fromAssoc : fromAssocs) + { + if (reference.equals(fromAssoc.getTypeQName())) + { + NodeRef nodeRef = fromAssoc.getTargetRef(); + doEventComplete(nodeRef); + } + } + + List toAssocs = nodeService.getSourceAssocs(record, RegexQNamePattern.MATCH_ALL); + for (AssociationRef toAssoc : toAssocs) + { + if (reference.equals(toAssoc.getTypeQName())) + { + NodeRef nodeRef = toAssoc.getSourceRef(); + doEventComplete(nodeRef); + } + } + } + + private void doEventComplete(NodeRef nodeRef) + { + DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); + if (da != null) + { + List events = da.getEventCompletionDetails(); + for (EventCompletionDetails event : events) + { + RecordsManagementEvent rmEvent = getRecordsManagementEventService().getEvent(event.getEventName()); + if (!event.isEventComplete() && + rmEvent.getType().equals(getName())) + { + // Complete the event + Map params = new HashMap(3); + params.put(CompleteEventAction.PARAM_EVENT_NAME, event.getEventName()); + params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_BY, AuthenticationUtil.getFullyAuthenticatedUser()); + params.put(CompleteEventAction.PARAM_EVENT_COMPLETED_AT, new Date()); + recordsManagementActionService.executeRecordsManagementAction(nodeRef, "completeEvent", params); + + break; + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEvent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEvent.java index a033023a7f..dfbe03de44 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEvent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEvent.java @@ -1,109 +1,109 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.event; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.util.ParameterCheck; - -/** - * Records management event - * - * @author Roy Wetherall - * @since 1.0 - */ -@AlfrescoPublicApi -public class RecordsManagementEvent -{ - /** Records management event type */ - private RecordsManagementEventType type; - - /** Records management event name */ - private String name; - - /** Records management display label */ - private String displayLabel; - - /** - * Constructor - * - * @param type event type - * @param name event name - * @param displayLabel event display label - */ - public RecordsManagementEvent(RecordsManagementEventType type, String name, String displayLabel) - { - ParameterCheck.mandatory("type", type); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("displayLabel", displayLabel); - - this.type = type; - this.name = name; - this.displayLabel = displayLabel; - } - - /** - * Get records management type name - * - * @return String records management event type name - */ - public String getType() - { - return type.getName(); - } - - /** - * Get the records management event type. - * - * @return {@link RecordsManagementEventType} records management event type - * - * @since 2.2 - */ - public RecordsManagementEventType getRecordsManagementEventType() - { - return type; - } - - /** - * Event name - * - * @return String event name - */ - public String getName() - { - return this.name; - } - - /** - * - * @return - */ - public String getDisplayLabel() - { - return displayLabel; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.event; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.util.ParameterCheck; + +/** + * Records management event + * + * @author Roy Wetherall + * @since 1.0 + */ +@AlfrescoPublicApi +public class RecordsManagementEvent +{ + /** Records management event type */ + private RecordsManagementEventType type; + + /** Records management event name */ + private String name; + + /** Records management display label */ + private String displayLabel; + + /** + * Constructor + * + * @param type event type + * @param name event name + * @param displayLabel event display label + */ + public RecordsManagementEvent(RecordsManagementEventType type, String name, String displayLabel) + { + ParameterCheck.mandatory("type", type); + ParameterCheck.mandatory("name", name); + ParameterCheck.mandatory("displayLabel", displayLabel); + + this.type = type; + this.name = name; + this.displayLabel = displayLabel; + } + + /** + * Get records management type name + * + * @return String records management event type name + */ + public String getType() + { + return type.getName(); + } + + /** + * Get the records management event type. + * + * @return {@link RecordsManagementEventType} records management event type + * + * @since 2.2 + */ + public RecordsManagementEventType getRecordsManagementEventType() + { + return type; + } + + /** + * Event name + * + * @return String event name + */ + public String getName() + { + return this.name; + } + + /** + * + * @return + */ + public String getDisplayLabel() + { + return displayLabel; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java index aa67d83d27..c4636a1ca6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventService.java @@ -1,123 +1,123 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.event; - -import java.util.List; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Records management event service interface - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementEventService -{ - /** - * Register an event type - * - * @param eventType event type - */ - void registerEventType(RecordsManagementEventType eventType); - - /** - * Get a list of the event types - * - * @return List list of the event types - */ - List getEventTypes(); - - /** - * Get the records management event type - * - * @param eventType name - * @return RecordsManagementEventType event type - */ - RecordsManagementEventType getEventType(String eventTypeName); - - /** - * Get the list of available events - * - * @return List list of events - */ - List getEvents(); - - /** - * Get a records management event given its name. Returns null if the event name is not - * recognised. - * - * @param eventName event name - * @return RecordsManagementEvent event - */ - RecordsManagementEvent getEvent(String eventName); - - /** - * Indicates whether a particular event exists. Returns true if it does, false otherwise. - * - * @param eventName event name - * @return boolean true if event exists, false otherwise - */ - boolean existsEvent(String eventName); - - /** - * Indicates whether a particular event can be created. Returns true if it is possible, false otherwise. - * - * @param eventDisplayLabel event display label - * @param eventName event name - * @return true if the event can be created, false otherwise - */ - boolean canCreateEvent(String eventDisplayLabel, String eventName); - - /** - * Indicates whether a particular event can be edited. Returns true if it is possible, false otherwise. - * - * @param eventDisplayLabel event display label - * @param eventName event name - * @param eventType event type - * @return true if the event can be edited, false otherwise - */ - boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType); - - /** - * Add an event - * - * @param eventType event type - * @param eventName event name - * @param eventDisplayLabel event display label - */ - RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel); - - /** - * Remove an event - * - * @param eventName event name - */ - void removeEvent(String eventName); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.event; + +import java.util.List; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Records management event service interface + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface RecordsManagementEventService +{ + /** + * Register an event type + * + * @param eventType event type + */ + void registerEventType(RecordsManagementEventType eventType); + + /** + * Get a list of the event types + * + * @return List list of the event types + */ + List getEventTypes(); + + /** + * Get the records management event type + * + * @param eventType name + * @return RecordsManagementEventType event type + */ + RecordsManagementEventType getEventType(String eventTypeName); + + /** + * Get the list of available events + * + * @return List list of events + */ + List getEvents(); + + /** + * Get a records management event given its name. Returns null if the event name is not + * recognised. + * + * @param eventName event name + * @return RecordsManagementEvent event + */ + RecordsManagementEvent getEvent(String eventName); + + /** + * Indicates whether a particular event exists. Returns true if it does, false otherwise. + * + * @param eventName event name + * @return boolean true if event exists, false otherwise + */ + boolean existsEvent(String eventName); + + /** + * Indicates whether a particular event can be created. Returns true if it is possible, false otherwise. + * + * @param eventDisplayLabel event display label + * @param eventName event name + * @return true if the event can be created, false otherwise + */ + boolean canCreateEvent(String eventDisplayLabel, String eventName); + + /** + * Indicates whether a particular event can be edited. Returns true if it is possible, false otherwise. + * + * @param eventDisplayLabel event display label + * @param eventName event name + * @param eventType event type + * @return true if the event can be edited, false otherwise + */ + boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType); + + /** + * Add an event + * + * @param eventType event type + * @param eventName event name + * @param eventDisplayLabel event display label + */ + RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel); + + /** + * Remove an event + * + * @param eventName event name + */ + void removeEvent(String eventName); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java index 00d7370e8f..b52ff1a401 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java @@ -1,388 +1,388 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.event; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -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.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.util.ParameterCheck; -import org.json.JSONArray; -import org.json.JSONObject; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Records management event service implementation - * - * @author Roy Wetherall - */ -public class RecordsManagementEventServiceImpl implements RecordsManagementEventService -{ - /** Reference to the rm event config node */ - private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private static final NodeRef CONFIG_NODE_REF = new NodeRef(SPACES_STORE, "rm_event_config"); - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** Registered event types */ - private Map eventTypes = new HashMap(7); - - /** Available events */ - private Map events; - - /** - * Set the node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the content service - * - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#registerEventType(org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType) - */ - public void registerEventType(RecordsManagementEventType eventType) - { - this.eventTypes.put(eventType.getName(), eventType); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEventTypes() - */ - public List getEventTypes() - { - return new ArrayList(this.eventTypes.values()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEvents() - */ - public List getEvents() - { - return new ArrayList(this.getEventMap().values()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEvent(java.lang.String) - */ - public RecordsManagementEvent getEvent(String eventName) - { - if (!getEventMap().containsKey(eventName)) { throw new AlfrescoRuntimeException("The event " - + eventName + " does not exist."); } - return getEventMap().get(eventName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEvent(java.lang.String) - */ - public boolean existsEvent(String eventName) - { - return getEventMap().containsKey(eventName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEventDisplayLabel(java.lang.String) - */ - public boolean existsEventDisplayLabel(String eventDisplayLabel) - { - for (RecordsManagementEvent recordsManagementEvent : getEventMap().values()) - { - if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) { return true; } - } - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#canCreateEvent(java.lang.String, java.lang.String) - */ - @SuppressWarnings("rawtypes") - public boolean canCreateEvent(String eventDisplayLabel, String eventName) - { - ParameterCheck.mandatoryString("eventDisplayLabel", eventDisplayLabel); - ParameterCheck.mandatoryString("eventName", eventName); - - boolean canCreateEvent = true; - - if (existsEvent(eventName)) - { - canCreateEvent = false; - } - - if (canCreateEvent) - { - for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();) - { - RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next(); - if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) - { - canCreateEvent = false; - break; - } - } - } - - return canCreateEvent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#canEditEvent(java.lang.String, java.lang.String, java.lang.String) - */ - @SuppressWarnings("rawtypes") - public boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType) - { - ParameterCheck.mandatoryString("eventDisplayLabel", eventDisplayLabel); - ParameterCheck.mandatoryString("eventName", eventName); - ParameterCheck.mandatoryString("eventType", eventType); - - boolean canEditEvent = true; - - if (!existsEvent(eventName)) - { - throw new AlfrescoRuntimeException("The event '" + eventName + "' does not exist."); - } - - for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();) - { - RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next(); - if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) - { - if (recordsManagementEvent.getName().equalsIgnoreCase(eventName)) - { - if (!recordsManagementEvent.getType().equalsIgnoreCase(eventType)) - { - canEditEvent = true; - } - else - { - canEditEvent = false; - } - } - else - { - throw new AlfrescoRuntimeException("Cannot edit event. An event with the display label '" - + eventDisplayLabel + "' already exist."); - } - break; - } - } - - return canEditEvent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#addEvent(java.lang.String, java.lang.String, java.lang.String) - */ - public RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel) - { - // Check that the eventType is valid - if (!eventTypes.containsKey(eventType)) - { - throw new AlfrescoRuntimeException( - "Can not add event because event " + - eventName + - " has an undefined eventType. (" - + eventType + ")"); - } - - // Create event and add to map - RecordsManagementEvent event = new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); - getEventMap().put(event.getName(), event); - - // Persist the changes to the event list - saveEvents(); - - return new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#removeEvent(java.lang.String) - */ - public void removeEvent(String eventName) - { - // Remove the event from the map - getEventMap().remove(eventName); - - // Persist the changes to the event list - saveEvents(); - } - - /** - * Helper method to get the event map. Loads initial instance from persisted - * configuration file. - * - * @return Map map of available events by - * event name - */ - private Map getEventMap() - { - if (this.events == null) - { - loadEvents(); - } - return this.events; - } - - /** - * Load the events from the persistant storage - */ - private void loadEvents() - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() throws Exception - { - // Get the event config node - if (!nodeService.exists(CONFIG_NODE_REF)) - { - throw new AlfrescoRuntimeException("Unable to find records management event configuration node."); - } - - // Read content from config node - ContentReader reader = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT); - String jsonString = reader.getContentString(); - - JSONObject configJSON = new JSONObject(jsonString); - JSONArray eventsJSON = configJSON.getJSONArray("events"); - - events = new HashMap(eventsJSON.length()); - - for (int i = 0; i < eventsJSON.length(); i++) - { - // Get the JSON object that represents the event - JSONObject eventJSON = eventsJSON.getJSONObject(i); - - // Get the details of the event - String eventType = eventJSON.getString("eventType"); - String eventName = eventJSON.getString("eventName"); - - String eventDisplayLabel = eventJSON.getString("eventDisplayLabel"); - String translated = I18NUtil.getMessage(eventDisplayLabel); - if (translated != null) - { - eventDisplayLabel = translated; - } - - - // Check that the eventType is valid - if (!eventTypes.containsKey(eventType)) - { - throw new AlfrescoRuntimeException( - "Can not load rm event configuration because event " + - eventName + - " has an undefined eventType. (" - + eventType + ")"); - } - - // Create event and add to map - RecordsManagementEvent event = new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); - events.put(event.getName(), event); - } - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Save the events to the peristant storage - */ - private void saveEvents() - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() throws Exception - { - // Get the event config node - if (!nodeService.exists(CONFIG_NODE_REF)) - { - throw new AlfrescoRuntimeException("Unable to find records management event configuration node."); - } - - JSONObject configJSON = new JSONObject(); - JSONArray eventsJSON = new JSONArray(); - - int index = 0; - for (RecordsManagementEvent event : events.values()) - { - JSONObject eventJSON = new JSONObject(); - eventJSON.put("eventType", event.getType()); - eventJSON.put("eventName", event.getName()); - eventJSON.put("eventDisplayLabel", event.getDisplayLabel()); - - eventsJSON.put(index, eventJSON); - index++; - } - configJSON.put("events", eventsJSON); - - // Get content writer - ContentWriter contentWriter = contentService - .getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true); - contentWriter.putContent(configJSON.toString()); - - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEventType(java.lang.String) - */ - public RecordsManagementEventType getEventType(String eventTypeName) - { - return this.eventTypes.get(eventTypeName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.event; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +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.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.util.ParameterCheck; +import org.json.JSONArray; +import org.json.JSONObject; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Records management event service implementation + * + * @author Roy Wetherall + */ +public class RecordsManagementEventServiceImpl implements RecordsManagementEventService +{ + /** Reference to the rm event config node */ + private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); + + private static final NodeRef CONFIG_NODE_REF = new NodeRef(SPACES_STORE, "rm_event_config"); + + /** Node service */ + private NodeService nodeService; + + /** Content service */ + private ContentService contentService; + + /** Registered event types */ + private Map eventTypes = new HashMap(7); + + /** Available events */ + private Map events; + + /** + * Set the node service + * + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set the content service + * + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#registerEventType(org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType) + */ + public void registerEventType(RecordsManagementEventType eventType) + { + this.eventTypes.put(eventType.getName(), eventType); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEventTypes() + */ + public List getEventTypes() + { + return new ArrayList(this.eventTypes.values()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEvents() + */ + public List getEvents() + { + return new ArrayList(this.getEventMap().values()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEvent(java.lang.String) + */ + public RecordsManagementEvent getEvent(String eventName) + { + if (!getEventMap().containsKey(eventName)) { throw new AlfrescoRuntimeException("The event " + + eventName + " does not exist."); } + return getEventMap().get(eventName); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEvent(java.lang.String) + */ + public boolean existsEvent(String eventName) + { + return getEventMap().containsKey(eventName); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEventDisplayLabel(java.lang.String) + */ + public boolean existsEventDisplayLabel(String eventDisplayLabel) + { + for (RecordsManagementEvent recordsManagementEvent : getEventMap().values()) + { + if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) { return true; } + } + return false; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#canCreateEvent(java.lang.String, java.lang.String) + */ + @SuppressWarnings("rawtypes") + public boolean canCreateEvent(String eventDisplayLabel, String eventName) + { + ParameterCheck.mandatoryString("eventDisplayLabel", eventDisplayLabel); + ParameterCheck.mandatoryString("eventName", eventName); + + boolean canCreateEvent = true; + + if (existsEvent(eventName)) + { + canCreateEvent = false; + } + + if (canCreateEvent) + { + for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();) + { + RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next(); + if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) + { + canCreateEvent = false; + break; + } + } + } + + return canCreateEvent; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#canEditEvent(java.lang.String, java.lang.String, java.lang.String) + */ + @SuppressWarnings("rawtypes") + public boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType) + { + ParameterCheck.mandatoryString("eventDisplayLabel", eventDisplayLabel); + ParameterCheck.mandatoryString("eventName", eventName); + ParameterCheck.mandatoryString("eventType", eventType); + + boolean canEditEvent = true; + + if (!existsEvent(eventName)) + { + throw new AlfrescoRuntimeException("The event '" + eventName + "' does not exist."); + } + + for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();) + { + RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next(); + if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) + { + if (recordsManagementEvent.getName().equalsIgnoreCase(eventName)) + { + if (!recordsManagementEvent.getType().equalsIgnoreCase(eventType)) + { + canEditEvent = true; + } + else + { + canEditEvent = false; + } + } + else + { + throw new AlfrescoRuntimeException("Cannot edit event. An event with the display label '" + + eventDisplayLabel + "' already exist."); + } + break; + } + } + + return canEditEvent; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#addEvent(java.lang.String, java.lang.String, java.lang.String) + */ + public RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel) + { + // Check that the eventType is valid + if (!eventTypes.containsKey(eventType)) + { + throw new AlfrescoRuntimeException( + "Can not add event because event " + + eventName + + " has an undefined eventType. (" + + eventType + ")"); + } + + // Create event and add to map + RecordsManagementEvent event = new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); + getEventMap().put(event.getName(), event); + + // Persist the changes to the event list + saveEvents(); + + return new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#removeEvent(java.lang.String) + */ + public void removeEvent(String eventName) + { + // Remove the event from the map + getEventMap().remove(eventName); + + // Persist the changes to the event list + saveEvents(); + } + + /** + * Helper method to get the event map. Loads initial instance from persisted + * configuration file. + * + * @return Map map of available events by + * event name + */ + private Map getEventMap() + { + if (this.events == null) + { + loadEvents(); + } + return this.events; + } + + /** + * Load the events from the persistant storage + */ + private void loadEvents() + { + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Object doWork() throws Exception + { + // Get the event config node + if (!nodeService.exists(CONFIG_NODE_REF)) + { + throw new AlfrescoRuntimeException("Unable to find records management event configuration node."); + } + + // Read content from config node + ContentReader reader = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT); + String jsonString = reader.getContentString(); + + JSONObject configJSON = new JSONObject(jsonString); + JSONArray eventsJSON = configJSON.getJSONArray("events"); + + events = new HashMap(eventsJSON.length()); + + for (int i = 0; i < eventsJSON.length(); i++) + { + // Get the JSON object that represents the event + JSONObject eventJSON = eventsJSON.getJSONObject(i); + + // Get the details of the event + String eventType = eventJSON.getString("eventType"); + String eventName = eventJSON.getString("eventName"); + + String eventDisplayLabel = eventJSON.getString("eventDisplayLabel"); + String translated = I18NUtil.getMessage(eventDisplayLabel); + if (translated != null) + { + eventDisplayLabel = translated; + } + + + // Check that the eventType is valid + if (!eventTypes.containsKey(eventType)) + { + throw new AlfrescoRuntimeException( + "Can not load rm event configuration because event " + + eventName + + " has an undefined eventType. (" + + eventType + ")"); + } + + // Create event and add to map + RecordsManagementEvent event = new RecordsManagementEvent(eventTypes.get(eventType), eventName, eventDisplayLabel); + events.put(event.getName(), event); + } + return null; + } + + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Save the events to the peristant storage + */ + private void saveEvents() + { + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Object doWork() throws Exception + { + // Get the event config node + if (!nodeService.exists(CONFIG_NODE_REF)) + { + throw new AlfrescoRuntimeException("Unable to find records management event configuration node."); + } + + JSONObject configJSON = new JSONObject(); + JSONArray eventsJSON = new JSONArray(); + + int index = 0; + for (RecordsManagementEvent event : events.values()) + { + JSONObject eventJSON = new JSONObject(); + eventJSON.put("eventType", event.getType()); + eventJSON.put("eventName", event.getName()); + eventJSON.put("eventDisplayLabel", event.getDisplayLabel()); + + eventsJSON.put(index, eventJSON); + index++; + } + configJSON.put("events", eventsJSON); + + // Get content writer + ContentWriter contentWriter = contentService + .getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true); + contentWriter.putContent(configJSON.toString()); + + return null; + } + + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEventType(java.lang.String) + */ + public RecordsManagementEventType getEventType(String eventTypeName) + { + return this.eventTypes.get(eventTypeName); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventType.java index c49a013ebe..0ba3bd5f20 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventType.java @@ -1,60 +1,60 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.event; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Records management event type interface - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementEventType -{ - /** - * Get the name of the records management event type - * - * @return String event type name - */ - String getName(); - - /** - * Gets the display label of the event type - * - * @return String display label - */ - String getDisplayLabel(); - - /** - * Indicates whether the event is automatic or not - * - * @return boolean true if automatic, false otherwise - */ - boolean isAutomaticEvent(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.event; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Records management event type interface + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface RecordsManagementEventType +{ + /** + * Get the name of the records management event type + * + * @return String event type name + */ + String getName(); + + /** + * Gets the display label of the event type + * + * @return String display label + */ + String getDisplayLabel(); + + /** + * Indicates whether the event is automatic or not + * + * @return boolean true if automatic, false otherwise + */ + boolean isAutomaticEvent(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/SimpleRecordsManagementEventTypeImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/SimpleRecordsManagementEventTypeImpl.java index eb626ce272..5cf61a5839 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/SimpleRecordsManagementEventTypeImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/event/SimpleRecordsManagementEventTypeImpl.java @@ -1,109 +1,109 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.event; - -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Simple records management event type implementation - * - * @author Roy Wetherall - */ -public class SimpleRecordsManagementEventTypeImpl implements RecordsManagementEventType, BeanNameAware -{ - /** Display label lookup prefix */ - protected static final String LOOKUP_PREFIX = "rmeventservice."; - - /** Name */ - public static final String NAME = "rmEventType.simple"; - - /** Records management event service */ - private RecordsManagementEventService recordsManagementEventService; - - /** Name */ - private String name; - - /** - * @return Records management event service - */ - protected RecordsManagementEventService getRecordsManagementEventService() - { - return this.recordsManagementEventService; - } - - /** - * Set the records management event service - * - * @param recordsManagementEventService records management service - */ - public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) - { - this.recordsManagementEventService = recordsManagementEventService; - } - - /** - * Initialisation method - */ - public void init() - { - getRecordsManagementEventService().registerEventType(this); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#isAutomaticEvent() - */ - public boolean isAutomaticEvent() - { - return false; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#getName() - */ - public String getName() - { - return this.name; - } - - /** - * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) - */ - public void setBeanName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#getDisplayLabel() - */ - public String getDisplayLabel() - { - return I18NUtil.getMessage(LOOKUP_PREFIX + getName()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.event; + +import org.springframework.beans.factory.BeanNameAware; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Simple records management event type implementation + * + * @author Roy Wetherall + */ +public class SimpleRecordsManagementEventTypeImpl implements RecordsManagementEventType, BeanNameAware +{ + /** Display label lookup prefix */ + protected static final String LOOKUP_PREFIX = "rmeventservice."; + + /** Name */ + public static final String NAME = "rmEventType.simple"; + + /** Records management event service */ + private RecordsManagementEventService recordsManagementEventService; + + /** Name */ + private String name; + + /** + * @return Records management event service + */ + protected RecordsManagementEventService getRecordsManagementEventService() + { + return this.recordsManagementEventService; + } + + /** + * Set the records management event service + * + * @param recordsManagementEventService records management service + */ + public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) + { + this.recordsManagementEventService = recordsManagementEventService; + } + + /** + * Initialisation method + */ + public void init() + { + getRecordsManagementEventService().registerEventType(this); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#isAutomaticEvent() + */ + public boolean isAutomaticEvent() + { + return false; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#getName() + */ + public String getName() + { + return this.name; + } + + /** + * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) + */ + public void setBeanName(String name) + { + this.name = name; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType#getDisplayLabel() + */ + public String getDisplayLabel() + { + return I18NUtil.getMessage(LOOKUP_PREFIX + getName()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java index 97117c1f95..dd82c2751d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java @@ -1,55 +1,55 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.fileplan; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * File plan component kind enumeration class. - *
- * Helpful when trying to determine the characteristics of a kind - * of file plan component. - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public enum FilePlanComponentKind -{ - FILE_PLAN_COMPONENT, - FILE_PLAN, - RECORD_CATEGORY, - RECORD_FOLDER, - RECORD, - TRANSFER, - TRANSFER_CONTAINER, - HOLD, - HOLD_CONTAINER, - DISPOSITION_SCHEDULE, - UNFILED_RECORD_CONTAINER, - UNFILED_RECORD_FOLDER; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.fileplan; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * File plan component kind enumeration class. + *
+ * Helpful when trying to determine the characteristics of a kind + * of file plan component. + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public enum FilePlanComponentKind +{ + FILE_PLAN_COMPONENT, + FILE_PLAN, + RECORD_CATEGORY, + RECORD_FOLDER, + RECORD, + TRANSFER, + TRANSFER_CONTAINER, + HOLD, + HOLD_CONTAINER, + DISPOSITION_SCHEDULE, + UNFILED_RECORD_CONTAINER, + UNFILED_RECORD_FOLDER; +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java index 8c35df5210..9694b46981 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java @@ -1,349 +1,349 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.fileplan; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; - -/** - * File plan service interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface FilePlanService -{ - /** - * Default RM site id. - * Can be used with {@link FilePlanService#getFilePlanBySiteId(String)} to get the file plan node. - * */ - String DEFAULT_RM_SITE_ID = "rm"; - - /** - * Indicates whether the given node is a file plan component or not. - * - * @param nodeRef node reference - * @return boolean true if a file plan component, false otherwise - */ - boolean isFilePlanComponent(NodeRef nodeRef); - - /** - * Returns the 'kind' of file plan component the node reference is. - *

- * Returns null if the given node reference is not a - * file plan component. - * - * @param nodeRef node reference - * @return FilePlanComponentKind the kind of file plan component the node is - */ - FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef); - - /** - * Returns the file plan component 'kind' that relates to the passed - * content type. - *

- * Returns null if the type does not relate to a file plan component. - * - * @param type qualified name of content type - * @return FilePlanComponentKind the kind relating to the passed type - */ - FilePlanComponentKind getFilePlanComponentKindFromType(QName type); - - /** - * Indicates whether the given node is file plan node or not. - * - * @param nodeRef node reference - * @return boolean true if node is a file plan node - */ - boolean isFilePlan(NodeRef nodeRef); - - /** - * Gets all the file plan nodes. - * Looks in the SpacesStore by default. - * - * @return Set set of file plan nodes - */ - Set getFilePlans(); - - /** - * Getse all the file plan nodes in a store. - * - * @param storeRef store reference - * @return Set set of file plan nodes - */ - Set getFilePlans(StoreRef storeRef); - - /** - * Gets the file plan the node is in. - * - * @return {@link NodeRef} file node reference, null if none - */ - NodeRef getFilePlan(NodeRef nodeRef); - - /** - * Gets a file plan by site id. Assumes the site is a RM site and that the file plan node, ie - * the document library container, has been already created. Otherwise returns null. - * - * @param siteId records management site id - * @return NodeRef file plan, null if can't be found - */ - NodeRef getFilePlanBySiteId(String siteId); - - /** - * Indicates whether the unfiled container exists for a given file plan or not. - * - * @param filePlan file plan - * @return boolean true if unfiled container exists, false otherwise - */ - boolean existsUnfiledContainer(NodeRef filePlan); - - /** - * Gets the unfiled container for a given file plan. Returns null if - * none. - * - * @param filePlan file plan - * @return {@link NodeRef} unfiled container, null if none - */ - NodeRef getUnfiledContainer(NodeRef filePlan); - - /** - * Creates, and returns, a unfiled container for a given file plan. - * - * @param filePlan file plan - * @return {@link Node} unfiled container - */ - NodeRef createUnfiledContainer(NodeRef filePlan); - - /** - * Gets the hold container for a given file plan. Returns - * null if none. - * - * @param filePlan - * @return - */ - NodeRef getHoldContainer(NodeRef filePlan); - - /** - * - * @param filePlan - * @return - */ - NodeRef createHoldContainer(NodeRef filePlan); - - /** - * - * @param filePlan - * @return - */ - NodeRef getTransferContainer(NodeRef filePlan); - - /** - * - * @param filePlan - * @return - */ - NodeRef createTransferContainer(NodeRef filePlan); - - /** - * Creates a file plan as a child of the given parent node, with the name - * provided. - * - * @param parent parent node reference - * @param name file plan name - * @param type type, must be rma:filePlan or sub-type of - * @return NodeRef file plan node reference - */ - NodeRef createFilePlan(NodeRef parent, String name, QName type); - - /** - * Specifies the properties to be set on the created file plan. - * - * @see #createFilePlan(NodeRef, String, QName) - * - * @param parent parent node reference - * @param name file plan name - * @param type type, must be rma:filePlan or sub-type of - * @param properties file plan properties - * @return NodeRef file plan node reference - */ - NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties); - - /** - * Creates a file plan with the default type. - * - * @see #createFilePlan(NodeRef, String, QName) - * - * @param parent parent node reference - * @param name file plan name - * @return NodeRef file plan node reference - */ - NodeRef createFilePlan(NodeRef parent, String name); - - /** - * Creates a file plan with the default type, specifying properties. - * - * @see #createFilePlan(NodeRef, String, QName) - * - * @param parent parent node reference - * @param name file plan name - * @param properties file plan properties - * @return NodeRef file plan node reference - */ - NodeRef createFilePlan(NodeRef parent, String name, Map properties); - - // TODO deleteFilePlan - - /** - * Gets the NodeRef sequence from the {@link #getFilePlan(NodeRef) root} - * down to the fileplan component given. The array will start with the NodeRef of the root - * and end with the name of the fileplan component node given. - * - * @param nodeRef a fileplan component - * @return Returns a NodeRef path starting with the file plan - */ - List getNodeRefPath(NodeRef nodeRef); - - /** - * Indicates whether the given node is a file plan container or not. - *

- * This includes file plan and record category nodes. - * - * @param nodeRef node reference - * @return boolean true if node is a file plan container, false otherwise. - */ - boolean isFilePlanContainer(NodeRef nodeRef); - - /** - * Indicates whether the given node is a record category or not. - * - * @param nodeRef node reference - * @return boolean true if records category, false otherwise - */ - boolean isRecordCategory(NodeRef nodeRef); - - /** - * Get all the items contained within a container. This will include record folders and other record categories. - * - * @param recordCategory record category node reference - * @param deep if true then return all children including sub-categories and their children in turn, if false then just - * return the immediate children - * @return {@link List}<{@link NodeRef>} list of contained node references - */ - List getAllContained(NodeRef recordCategory, boolean deep); - - /** - * Only return the immediate children. - * - * @param recordCategory record category node reference - * @return {@link List}<{@link NodeRef>} list of contained node references - */ - List getAllContained(NodeRef recordCategory); - - /** - * Get all the record categories within a record category. - * - * @param recordCategory record category node reference - * @param deep if true then return all children including sub-categories and their children in turn, if false then just - * return the immediate children - * @return {@link List}<{@link NodeRef>} list of container node references - */ - List getContainedRecordCategories(NodeRef recordCategory, boolean deep); - - /** - * Only return immediate children. - * - * @param recordCategory container node reference - * @return {@link List}<{@link NodeRef>} list of container node references - */ - List getContainedRecordCategories(NodeRef recordCategory); - - /** - * Get all the record folders contained within a container - * - * @param container container node reference - * @param deep if true then return all children including sub-containers and their children in turn, if false then just - * return the immediate children - * @return {@link List}<{@link NodeRef>} list of record folder node references - */ - List getContainedRecordFolders(NodeRef container, boolean deep); - - /** - * Only return immediate children. - * - * @param container container node reference - * @return {@link List}<{@link NodeRef>} list of record folder node references - */ - List getContainedRecordFolders(NodeRef container); - - /** - * Create a record category. - * - * @param parent parent node reference, must be a record category or file plan. - * @param name name of the new record category - * @param type type of container to create, must be a sub-type of rm:recordCategory - * @return NodeRef node reference of the created record category - */ - NodeRef createRecordCategory(NodeRef parent, String name, QName type); - - /** - * - * @param parent - * @param name - * @param type - * @param properties - * @return - */ - NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties); - - /** - * Creates a record category of type rma:recordCategory - * - * @param parent parent node reference, must be a record category or file plan. - * @param name name of the record category - * @return NodeRef node reference of the created record category - */ - NodeRef createRecordCategory(NodeRef parent, String name); - - /** - * - * @param parent - * @param name - * @param properties - * @return - */ - NodeRef createRecordCategory(NodeRef parent, String name, Map properties); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.fileplan; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.QName; + +/** + * File plan service interface. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface FilePlanService +{ + /** + * Default RM site id. + * Can be used with {@link FilePlanService#getFilePlanBySiteId(String)} to get the file plan node. + * */ + String DEFAULT_RM_SITE_ID = "rm"; + + /** + * Indicates whether the given node is a file plan component or not. + * + * @param nodeRef node reference + * @return boolean true if a file plan component, false otherwise + */ + boolean isFilePlanComponent(NodeRef nodeRef); + + /** + * Returns the 'kind' of file plan component the node reference is. + *

+ * Returns null if the given node reference is not a + * file plan component. + * + * @param nodeRef node reference + * @return FilePlanComponentKind the kind of file plan component the node is + */ + FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef); + + /** + * Returns the file plan component 'kind' that relates to the passed + * content type. + *

+ * Returns null if the type does not relate to a file plan component. + * + * @param type qualified name of content type + * @return FilePlanComponentKind the kind relating to the passed type + */ + FilePlanComponentKind getFilePlanComponentKindFromType(QName type); + + /** + * Indicates whether the given node is file plan node or not. + * + * @param nodeRef node reference + * @return boolean true if node is a file plan node + */ + boolean isFilePlan(NodeRef nodeRef); + + /** + * Gets all the file plan nodes. + * Looks in the SpacesStore by default. + * + * @return Set set of file plan nodes + */ + Set getFilePlans(); + + /** + * Getse all the file plan nodes in a store. + * + * @param storeRef store reference + * @return Set set of file plan nodes + */ + Set getFilePlans(StoreRef storeRef); + + /** + * Gets the file plan the node is in. + * + * @return {@link NodeRef} file node reference, null if none + */ + NodeRef getFilePlan(NodeRef nodeRef); + + /** + * Gets a file plan by site id. Assumes the site is a RM site and that the file plan node, ie + * the document library container, has been already created. Otherwise returns null. + * + * @param siteId records management site id + * @return NodeRef file plan, null if can't be found + */ + NodeRef getFilePlanBySiteId(String siteId); + + /** + * Indicates whether the unfiled container exists for a given file plan or not. + * + * @param filePlan file plan + * @return boolean true if unfiled container exists, false otherwise + */ + boolean existsUnfiledContainer(NodeRef filePlan); + + /** + * Gets the unfiled container for a given file plan. Returns null if + * none. + * + * @param filePlan file plan + * @return {@link NodeRef} unfiled container, null if none + */ + NodeRef getUnfiledContainer(NodeRef filePlan); + + /** + * Creates, and returns, a unfiled container for a given file plan. + * + * @param filePlan file plan + * @return {@link Node} unfiled container + */ + NodeRef createUnfiledContainer(NodeRef filePlan); + + /** + * Gets the hold container for a given file plan. Returns + * null if none. + * + * @param filePlan + * @return + */ + NodeRef getHoldContainer(NodeRef filePlan); + + /** + * + * @param filePlan + * @return + */ + NodeRef createHoldContainer(NodeRef filePlan); + + /** + * + * @param filePlan + * @return + */ + NodeRef getTransferContainer(NodeRef filePlan); + + /** + * + * @param filePlan + * @return + */ + NodeRef createTransferContainer(NodeRef filePlan); + + /** + * Creates a file plan as a child of the given parent node, with the name + * provided. + * + * @param parent parent node reference + * @param name file plan name + * @param type type, must be rma:filePlan or sub-type of + * @return NodeRef file plan node reference + */ + NodeRef createFilePlan(NodeRef parent, String name, QName type); + + /** + * Specifies the properties to be set on the created file plan. + * + * @see #createFilePlan(NodeRef, String, QName) + * + * @param parent parent node reference + * @param name file plan name + * @param type type, must be rma:filePlan or sub-type of + * @param properties file plan properties + * @return NodeRef file plan node reference + */ + NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties); + + /** + * Creates a file plan with the default type. + * + * @see #createFilePlan(NodeRef, String, QName) + * + * @param parent parent node reference + * @param name file plan name + * @return NodeRef file plan node reference + */ + NodeRef createFilePlan(NodeRef parent, String name); + + /** + * Creates a file plan with the default type, specifying properties. + * + * @see #createFilePlan(NodeRef, String, QName) + * + * @param parent parent node reference + * @param name file plan name + * @param properties file plan properties + * @return NodeRef file plan node reference + */ + NodeRef createFilePlan(NodeRef parent, String name, Map properties); + + // TODO deleteFilePlan + + /** + * Gets the NodeRef sequence from the {@link #getFilePlan(NodeRef) root} + * down to the fileplan component given. The array will start with the NodeRef of the root + * and end with the name of the fileplan component node given. + * + * @param nodeRef a fileplan component + * @return Returns a NodeRef path starting with the file plan + */ + List getNodeRefPath(NodeRef nodeRef); + + /** + * Indicates whether the given node is a file plan container or not. + *

+ * This includes file plan and record category nodes. + * + * @param nodeRef node reference + * @return boolean true if node is a file plan container, false otherwise. + */ + boolean isFilePlanContainer(NodeRef nodeRef); + + /** + * Indicates whether the given node is a record category or not. + * + * @param nodeRef node reference + * @return boolean true if records category, false otherwise + */ + boolean isRecordCategory(NodeRef nodeRef); + + /** + * Get all the items contained within a container. This will include record folders and other record categories. + * + * @param recordCategory record category node reference + * @param deep if true then return all children including sub-categories and their children in turn, if false then just + * return the immediate children + * @return {@link List}<{@link NodeRef>} list of contained node references + */ + List getAllContained(NodeRef recordCategory, boolean deep); + + /** + * Only return the immediate children. + * + * @param recordCategory record category node reference + * @return {@link List}<{@link NodeRef>} list of contained node references + */ + List getAllContained(NodeRef recordCategory); + + /** + * Get all the record categories within a record category. + * + * @param recordCategory record category node reference + * @param deep if true then return all children including sub-categories and their children in turn, if false then just + * return the immediate children + * @return {@link List}<{@link NodeRef>} list of container node references + */ + List getContainedRecordCategories(NodeRef recordCategory, boolean deep); + + /** + * Only return immediate children. + * + * @param recordCategory container node reference + * @return {@link List}<{@link NodeRef>} list of container node references + */ + List getContainedRecordCategories(NodeRef recordCategory); + + /** + * Get all the record folders contained within a container + * + * @param container container node reference + * @param deep if true then return all children including sub-containers and their children in turn, if false then just + * return the immediate children + * @return {@link List}<{@link NodeRef>} list of record folder node references + */ + List getContainedRecordFolders(NodeRef container, boolean deep); + + /** + * Only return immediate children. + * + * @param container container node reference + * @return {@link List}<{@link NodeRef>} list of record folder node references + */ + List getContainedRecordFolders(NodeRef container); + + /** + * Create a record category. + * + * @param parent parent node reference, must be a record category or file plan. + * @param name name of the new record category + * @param type type of container to create, must be a sub-type of rm:recordCategory + * @return NodeRef node reference of the created record category + */ + NodeRef createRecordCategory(NodeRef parent, String name, QName type); + + /** + * + * @param parent + * @param name + * @param type + * @param properties + * @return + */ + NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties); + + /** + * Creates a record category of type rma:recordCategory + * + * @param parent parent node reference, must be a record category or file plan. + * @param name name of the record category + * @return NodeRef node reference of the created record category + */ + NodeRef createRecordCategory(NodeRef parent, String name); + + /** + * + * @param parent + * @param name + * @param properties + * @return + */ + NodeRef createRecordCategory(NodeRef parent, String name, Map properties); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java index a8429536ba..dc5a013256 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java @@ -1,639 +1,639 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.fileplan; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Deque; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.rule.RuleModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * File plan service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanServiceImpl extends ServiceBaseImpl - implements FilePlanService, - RecordsManagementModel -{ - /** I18N */ - private static final String MSG_DUP_ROOT = "rm.service.dup-root"; - private static final String MSG_ROOT_TYPE = "rm.service.root-type"; - private static final String MSG_PATH_NODE = "rm.service.path-node"; - private static final String MSG_NO_ROOT = "rm.service.no-root"; - private static final String MSG_CONTAINER_PARENT_TYPE= "rm.service.container-parent-type"; - private static final String MSG_CONTAINER_TYPE = "rm.service.container-type"; - private static final String MSG_CONTAINER_EXPECTED = "rm.service.container-expected"; - - /** File plan containers */ - private static final String NAME_UNFILED_CONTAINER = "Unfiled Records"; - private static final String NAME_HOLD_CONTAINER = "Holds"; - private static final String NAME_TRANSFER_CONTAINER = "Transfers"; - - /** RM site file plan container */ - private static final String FILE_PLAN_CONTAINER = "documentLibrary"; - - /** root container cache */ - private SimpleCache, NodeRef> rootContainerCache; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** Permission service */ - private PermissionService permissionService; - - /** Node DAO */ - private NodeDAO nodeDAO; - - /** Site service */ - private SiteService siteService; - - /** - * Gets the file plan role service - * - * @return The file plan role service - */ - public FilePlanRoleService getFilePlanRoleService() - { - if (filePlanRoleService == null) - { - filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService"); - } - return filePlanRoleService; - } - - /** - * Gets the permission service - * - * @return The permission service - */ - public PermissionService getPermissionService() - { - if (permissionService == null) - { - permissionService = (PermissionService) applicationContext.getBean("permissionService"); - } - return permissionService; - } - - /** - * Gets the node DAO - * - * @return The node DAO - */ - public NodeDAO getNodeDAO() - { - if (nodeDAO == null) - { - nodeDAO = (NodeDAO) applicationContext.getBean("nodeDAO"); - } - return nodeDAO; - } - - /** - * Gets the site service - * - * @return The site service - */ - public SiteService getSiteService() - { - if (siteService == null) - { - siteService = (SiteService) applicationContext.getBean("SiteService"); - } - return siteService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans() - */ - @Override - public Set getFilePlans() - { - return getFilePlans(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - } - - /** - * @param rootContainerCache root container cache - */ - public void setRootContainerCache(SimpleCache, NodeRef> rootContainerCache) - { - this.rootContainerCache = rootContainerCache; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans(org.alfresco.service.cmr.repository.StoreRef) - */ - @Override - public Set getFilePlans(final StoreRef storeRef) - { - ParameterCheck.mandatory("storeRef", storeRef); - - final Set results = new HashSet(); - Set aspects = new HashSet(1); - aspects.add(ASPECT_RECORDS_MANAGEMENT_ROOT); - getNodeDAO().getNodesWithAspects(aspects, Long.MIN_VALUE, Long.MAX_VALUE, new NodeDAO.NodeRefQueryCallback() - { - @Override - public boolean handle(Pair nodePair) - { - NodeRef nodeRef = nodePair.getSecond(); - if (storeRef.equals(nodeRef.getStoreRef())) - { - results.add(nodeRef); - } - - return true; - } - }); - return results; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlanBySiteId(java.lang.String) - */ - @Override - public NodeRef getFilePlanBySiteId(String siteId) - { - NodeRef filePlan = null; - - SiteInfo siteInfo = getSiteService().getSite(siteId); - if (siteInfo != null && getSiteService().hasContainer(siteId, FILE_PLAN_CONTAINER)) - { - NodeRef nodeRef = getSiteService().getContainer(siteId, FILE_PLAN_CONTAINER); - if (instanceOf(nodeRef, TYPE_FILE_PLAN)) - { - filePlan = nodeRef; - } - } - - return filePlan; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#existsUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean existsUnfiledContainer(NodeRef filePlan) - { - return (getUnfiledContainer(filePlan) != null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef getUnfiledContainer(NodeRef filePlan) - { - return getFilePlanRootContainer(filePlan, NAME_UNFILED_CONTAINER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getHoldContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef getHoldContainer(NodeRef filePlan) - { - return getFilePlanRootContainer(filePlan, NAME_HOLD_CONTAINER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getTransferContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef getTransferContainer(NodeRef filePlan) - { - return getFilePlanRootContainer(filePlan, NAME_TRANSFER_CONTAINER); - } - - /** - * Get the file root container for the given type. - * - * @param filePlan file plan - * @param containerName container type - * @return {@link NodeRef} file plan container - */ - private NodeRef getFilePlanRootContainer(NodeRef filePlan, String containerName) - { - ParameterCheck.mandatory("filePlan", filePlan); - if (!isFilePlan(filePlan)) - { - throw new AlfrescoRuntimeException("Unable to get the container " + containerName + ", because passed node is not a file plan."); - } - - NodeRef result = null; - Pair key = new Pair(filePlan, containerName); - - if (!rootContainerCache.contains(key)) - { - // try and get the unfiled record container - List assocs = nodeService.getChildAssocs(filePlan, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, containerName)); - if (assocs.size() > 1) - { - throw new AlfrescoRuntimeException("Unable to get unfiled conatiner " + containerName + "."); - } - else if (assocs.size() == 1) - { - result = assocs.get(0).getChildRef(); - rootContainerCache.put(key, result); - } - } - else - { - result = rootContainerCache.get(key); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - public NodeRef createUnfiledContainer(NodeRef filePlan) - { - return createFilePlanRootContainer(filePlan, TYPE_UNFILED_RECORD_CONTAINER, NAME_UNFILED_CONTAINER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createHoldContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef createHoldContainer(NodeRef filePlan) - { - return createFilePlanRootContainer(filePlan, TYPE_HOLD_CONTAINER, NAME_HOLD_CONTAINER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createTransferContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef createTransferContainer(NodeRef filePlan) - { - return createFilePlanRootContainer(filePlan, TYPE_TRANSFER_CONTAINER, NAME_TRANSFER_CONTAINER); - } - - /** - * - * @param filePlan - * @param containerType - * @param containerName - * @param inheritPermissions - * @return - */ - private NodeRef createFilePlanRootContainer(NodeRef filePlan, QName containerType, String containerName) - { - ParameterCheck.mandatory("filePlan", filePlan); - if (!isFilePlan(filePlan)) - { - throw new AlfrescoRuntimeException("Unable to create file plan root container, because passed node is not a file plan."); - } - - String allRoles = getFilePlanRoleService().getAllRolesContainerGroup(filePlan); - - // create the properties map - Map properties = new HashMap(1); - properties.put(ContentModel.PROP_NAME, containerName); - - // create the unfiled container - NodeRef container = nodeService.createNode( - filePlan, - ContentModel.ASSOC_CONTAINS, - QName.createQName(RM_URI, containerName), - containerType, - properties).getChildRef(); - - // set inheritance to false - getPermissionService().setInheritParentPermissions(container, false); - getPermissionService().setPermission(container, allRoles, RMPermissionModel.READ_RECORDS, true); - - // prevent inheritance of rules - nodeService.addAspect(container, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - - return container; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map) - */ - public NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties) - { - ParameterCheck.mandatory("parent", parent); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("type", type); - - // Check the parent is not already an RM component node - // ie: you can't create a rm root in an existing rm hierarchy - if (isFilePlanComponent(parent)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DUP_ROOT)); - } - - // Check that the passed type is a sub-type of rma:filePlan - if (!TYPE_FILE_PLAN.equals(type) && - !dictionaryService.isSubClass(type, TYPE_FILE_PLAN)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ROOT_TYPE, type.toString())); - } - - // Build map of properties - Map rmRootProps = new HashMap(1); - if (properties != null && properties.size() != 0) - { - rmRootProps.putAll(properties); - } - rmRootProps.put(ContentModel.PROP_NAME, name); - - // Create the root - ChildAssociationRef assocRef = nodeService.createNode( - parent, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), - type, - rmRootProps); - - // TODO do we need to create role and security groups or is this done automatically? - - return assocRef.getChildRef(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) - */ - public NodeRef createFilePlan(NodeRef parent, String name, Map properties) - { - return createFilePlan(parent, name, TYPE_FILE_PLAN, properties); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public NodeRef createFilePlan(NodeRef parent, String name) - { - return createFilePlan(parent, name, TYPE_FILE_PLAN, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName) - */ - @Override - public NodeRef createFilePlan(NodeRef parent, String name, QName type) - { - return createFilePlan(parent, name, type, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getNodeRefPath(org.alfresco.service.cmr.repository.NodeRef) - */ - public List getNodeRefPath(NodeRef nodeRef) - { - LinkedList nodeRefPath = new LinkedList(); - try - { - getNodeRefPathRecursive(nodeRef, nodeRefPath); - } - catch (RuntimeException e) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PATH_NODE, nodeRef), e); - } - return nodeRefPath; - } - - /** - * Helper method to build a NodeRef path from the node to the RM root - */ - private void getNodeRefPathRecursive(NodeRef nodeRef, Deque nodeRefPath) - { - if (isFilePlanComponent(nodeRef)) - { - // Prepend it to the path - nodeRefPath.addFirst(nodeRef); - // Are we not at the root - if (!isFilePlan(nodeRef)) - { - ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); - if (assocRef == null) - { - // We hit the top of the store - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_ROOT)); - } - // Recurse - nodeRef = assocRef.getParentRef(); - getNodeRefPathRecursive(nodeRef, nodeRefPath); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map) - */ - public NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties) - { - ParameterCheck.mandatory("parent", parent); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("type", type); - - // Check that the parent is a container - QName parentType = nodeService.getType(parent); - if (!TYPE_RECORDS_MANAGEMENT_CONTAINER.equals(parentType) && - !dictionaryService.isSubClass(parentType, TYPE_RECORDS_MANAGEMENT_CONTAINER)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_PARENT_TYPE, parentType.toString())); - } - - // Check that the the provided type is a sub-type of rm:recordCategory - if (!TYPE_RECORD_CATEGORY.equals(type) && - !dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_TYPE, type.toString())); - } - - // Set the properties for the record category - Map props = new HashMap(1); - if (properties != null && properties.size() != 0) - { - props.putAll(properties); - } - props.put(ContentModel.PROP_NAME, name); - - return nodeService.createNode( - parent, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, (name.length() > QName.MAX_LENGTH ? name.substring(0, QName.MAX_LENGTH) : name)), - type, - props).getChildRef(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public NodeRef createRecordCategory(NodeRef parent, String name) - { - return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) - */ - public NodeRef createRecordCategory(NodeRef parent, String name, Map properties) - { - return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY, properties); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName) - */ - public NodeRef createRecordCategory(NodeRef parent, String name, QName type) - { - return createRecordCategory(parent, name, type, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getAllContained(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getAllContained(NodeRef container) - { - return getAllContained(container, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getAllContained(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public List getAllContained(NodeRef container, boolean deep) - { - return getContained(container, null, deep); - } - - /** - * Get contained nodes of a particular type. If null return all. - * - * @param container container node reference - * @param typeFilter type filter, null if none - * @return {@link List}<{@link NodeRef> list of contained node references - */ - private List getContained(NodeRef container, QName typeFilter, boolean deep) - { - // Parameter check - ParameterCheck.mandatory("container", container); - - // Check we have a container in our hands - if (!isRecordCategory(container)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_EXPECTED)); - } - - List result = new ArrayList(1); - List assocs = this.nodeService.getChildAssocs(container, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef child = assoc.getChildRef(); - QName childType = nodeService.getType(child); - if (typeFilter == null || - typeFilter.equals(childType) || - dictionaryService.isSubClass(childType, typeFilter)) - { - result.add(child); - } - - // Inspect the containers and add children if deep - if (deep && - (TYPE_RECORD_CATEGORY.equals(childType) || - dictionaryService.isSubClass(childType, TYPE_RECORD_CATEGORY))) - { - result.addAll(getContained(child, typeFilter, deep)); - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getContainedRecordCategories(NodeRef container) - { - return getContainedRecordCategories(container, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public List getContainedRecordCategories(NodeRef container, boolean deep) - { - return getContained(container, TYPE_RECORD_CATEGORY, deep); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getContainedRecordFolders(NodeRef container) - { - return getContainedRecordFolders(container, false); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public List getContainedRecordFolders(NodeRef container, boolean deep) - { - return getContained(container, TYPE_RECORD_FOLDER, deep); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.fileplan; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Deque; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.repo.cache.SimpleCache; +import org.alfresco.repo.domain.node.NodeDAO; +import org.alfresco.repo.rule.RuleModel; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.Pair; +import org.alfresco.util.ParameterCheck; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * File plan service implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class FilePlanServiceImpl extends ServiceBaseImpl + implements FilePlanService, + RecordsManagementModel +{ + /** I18N */ + private static final String MSG_DUP_ROOT = "rm.service.dup-root"; + private static final String MSG_ROOT_TYPE = "rm.service.root-type"; + private static final String MSG_PATH_NODE = "rm.service.path-node"; + private static final String MSG_NO_ROOT = "rm.service.no-root"; + private static final String MSG_CONTAINER_PARENT_TYPE= "rm.service.container-parent-type"; + private static final String MSG_CONTAINER_TYPE = "rm.service.container-type"; + private static final String MSG_CONTAINER_EXPECTED = "rm.service.container-expected"; + + /** File plan containers */ + private static final String NAME_UNFILED_CONTAINER = "Unfiled Records"; + private static final String NAME_HOLD_CONTAINER = "Holds"; + private static final String NAME_TRANSFER_CONTAINER = "Transfers"; + + /** RM site file plan container */ + private static final String FILE_PLAN_CONTAINER = "documentLibrary"; + + /** root container cache */ + private SimpleCache, NodeRef> rootContainerCache; + + /** File plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** Permission service */ + private PermissionService permissionService; + + /** Node DAO */ + private NodeDAO nodeDAO; + + /** Site service */ + private SiteService siteService; + + /** + * Gets the file plan role service + * + * @return The file plan role service + */ + public FilePlanRoleService getFilePlanRoleService() + { + if (filePlanRoleService == null) + { + filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService"); + } + return filePlanRoleService; + } + + /** + * Gets the permission service + * + * @return The permission service + */ + public PermissionService getPermissionService() + { + if (permissionService == null) + { + permissionService = (PermissionService) applicationContext.getBean("permissionService"); + } + return permissionService; + } + + /** + * Gets the node DAO + * + * @return The node DAO + */ + public NodeDAO getNodeDAO() + { + if (nodeDAO == null) + { + nodeDAO = (NodeDAO) applicationContext.getBean("nodeDAO"); + } + return nodeDAO; + } + + /** + * Gets the site service + * + * @return The site service + */ + public SiteService getSiteService() + { + if (siteService == null) + { + siteService = (SiteService) applicationContext.getBean("SiteService"); + } + return siteService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans() + */ + @Override + public Set getFilePlans() + { + return getFilePlans(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); + } + + /** + * @param rootContainerCache root container cache + */ + public void setRootContainerCache(SimpleCache, NodeRef> rootContainerCache) + { + this.rootContainerCache = rootContainerCache; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlans(org.alfresco.service.cmr.repository.StoreRef) + */ + @Override + public Set getFilePlans(final StoreRef storeRef) + { + ParameterCheck.mandatory("storeRef", storeRef); + + final Set results = new HashSet(); + Set aspects = new HashSet(1); + aspects.add(ASPECT_RECORDS_MANAGEMENT_ROOT); + getNodeDAO().getNodesWithAspects(aspects, Long.MIN_VALUE, Long.MAX_VALUE, new NodeDAO.NodeRefQueryCallback() + { + @Override + public boolean handle(Pair nodePair) + { + NodeRef nodeRef = nodePair.getSecond(); + if (storeRef.equals(nodeRef.getStoreRef())) + { + results.add(nodeRef); + } + + return true; + } + }); + return results; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlanBySiteId(java.lang.String) + */ + @Override + public NodeRef getFilePlanBySiteId(String siteId) + { + NodeRef filePlan = null; + + SiteInfo siteInfo = getSiteService().getSite(siteId); + if (siteInfo != null && getSiteService().hasContainer(siteId, FILE_PLAN_CONTAINER)) + { + NodeRef nodeRef = getSiteService().getContainer(siteId, FILE_PLAN_CONTAINER); + if (instanceOf(nodeRef, TYPE_FILE_PLAN)) + { + filePlan = nodeRef; + } + } + + return filePlan; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#existsUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean existsUnfiledContainer(NodeRef filePlan) + { + return (getUnfiledContainer(filePlan) != null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public NodeRef getUnfiledContainer(NodeRef filePlan) + { + return getFilePlanRootContainer(filePlan, NAME_UNFILED_CONTAINER); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getHoldContainer(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public NodeRef getHoldContainer(NodeRef filePlan) + { + return getFilePlanRootContainer(filePlan, NAME_HOLD_CONTAINER); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getTransferContainer(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public NodeRef getTransferContainer(NodeRef filePlan) + { + return getFilePlanRootContainer(filePlan, NAME_TRANSFER_CONTAINER); + } + + /** + * Get the file root container for the given type. + * + * @param filePlan file plan + * @param containerName container type + * @return {@link NodeRef} file plan container + */ + private NodeRef getFilePlanRootContainer(NodeRef filePlan, String containerName) + { + ParameterCheck.mandatory("filePlan", filePlan); + if (!isFilePlan(filePlan)) + { + throw new AlfrescoRuntimeException("Unable to get the container " + containerName + ", because passed node is not a file plan."); + } + + NodeRef result = null; + Pair key = new Pair(filePlan, containerName); + + if (!rootContainerCache.contains(key)) + { + // try and get the unfiled record container + List assocs = nodeService.getChildAssocs(filePlan, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, containerName)); + if (assocs.size() > 1) + { + throw new AlfrescoRuntimeException("Unable to get unfiled conatiner " + containerName + "."); + } + else if (assocs.size() == 1) + { + result = assocs.get(0).getChildRef(); + rootContainerCache.put(key, result); + } + } + else + { + result = rootContainerCache.get(key); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef) + */ + public NodeRef createUnfiledContainer(NodeRef filePlan) + { + return createFilePlanRootContainer(filePlan, TYPE_UNFILED_RECORD_CONTAINER, NAME_UNFILED_CONTAINER); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createHoldContainer(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public NodeRef createHoldContainer(NodeRef filePlan) + { + return createFilePlanRootContainer(filePlan, TYPE_HOLD_CONTAINER, NAME_HOLD_CONTAINER); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createTransferContainer(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public NodeRef createTransferContainer(NodeRef filePlan) + { + return createFilePlanRootContainer(filePlan, TYPE_TRANSFER_CONTAINER, NAME_TRANSFER_CONTAINER); + } + + /** + * + * @param filePlan + * @param containerType + * @param containerName + * @param inheritPermissions + * @return + */ + private NodeRef createFilePlanRootContainer(NodeRef filePlan, QName containerType, String containerName) + { + ParameterCheck.mandatory("filePlan", filePlan); + if (!isFilePlan(filePlan)) + { + throw new AlfrescoRuntimeException("Unable to create file plan root container, because passed node is not a file plan."); + } + + String allRoles = getFilePlanRoleService().getAllRolesContainerGroup(filePlan); + + // create the properties map + Map properties = new HashMap(1); + properties.put(ContentModel.PROP_NAME, containerName); + + // create the unfiled container + NodeRef container = nodeService.createNode( + filePlan, + ContentModel.ASSOC_CONTAINS, + QName.createQName(RM_URI, containerName), + containerType, + properties).getChildRef(); + + // set inheritance to false + getPermissionService().setInheritParentPermissions(container, false); + getPermissionService().setPermission(container, allRoles, RMPermissionModel.READ_RECORDS, true); + + // prevent inheritance of rules + nodeService.addAspect(container, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + + return container; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map) + */ + public NodeRef createFilePlan(NodeRef parent, String name, QName type, Map properties) + { + ParameterCheck.mandatory("parent", parent); + ParameterCheck.mandatory("name", name); + ParameterCheck.mandatory("type", type); + + // Check the parent is not already an RM component node + // ie: you can't create a rm root in an existing rm hierarchy + if (isFilePlanComponent(parent)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DUP_ROOT)); + } + + // Check that the passed type is a sub-type of rma:filePlan + if (!TYPE_FILE_PLAN.equals(type) && + !dictionaryService.isSubClass(type, TYPE_FILE_PLAN)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ROOT_TYPE, type.toString())); + } + + // Build map of properties + Map rmRootProps = new HashMap(1); + if (properties != null && properties.size() != 0) + { + rmRootProps.putAll(properties); + } + rmRootProps.put(ContentModel.PROP_NAME, name); + + // Create the root + ChildAssociationRef assocRef = nodeService.createNode( + parent, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), + type, + rmRootProps); + + // TODO do we need to create role and security groups or is this done automatically? + + return assocRef.getChildRef(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) + */ + public NodeRef createFilePlan(NodeRef parent, String name, Map properties) + { + return createFilePlan(parent, name, TYPE_FILE_PLAN, properties); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + public NodeRef createFilePlan(NodeRef parent, String name) + { + return createFilePlan(parent, name, TYPE_FILE_PLAN, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName) + */ + @Override + public NodeRef createFilePlan(NodeRef parent, String name, QName type) + { + return createFilePlan(parent, name, type, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getNodeRefPath(org.alfresco.service.cmr.repository.NodeRef) + */ + public List getNodeRefPath(NodeRef nodeRef) + { + LinkedList nodeRefPath = new LinkedList(); + try + { + getNodeRefPathRecursive(nodeRef, nodeRefPath); + } + catch (RuntimeException e) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PATH_NODE, nodeRef), e); + } + return nodeRefPath; + } + + /** + * Helper method to build a NodeRef path from the node to the RM root + */ + private void getNodeRefPathRecursive(NodeRef nodeRef, Deque nodeRefPath) + { + if (isFilePlanComponent(nodeRef)) + { + // Prepend it to the path + nodeRefPath.addFirst(nodeRef); + // Are we not at the root + if (!isFilePlan(nodeRef)) + { + ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); + if (assocRef == null) + { + // We hit the top of the store + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_ROOT)); + } + // Recurse + nodeRef = assocRef.getParentRef(); + getNodeRefPathRecursive(nodeRef, nodeRefPath); + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map) + */ + public NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map properties) + { + ParameterCheck.mandatory("parent", parent); + ParameterCheck.mandatory("name", name); + ParameterCheck.mandatory("type", type); + + // Check that the parent is a container + QName parentType = nodeService.getType(parent); + if (!TYPE_RECORDS_MANAGEMENT_CONTAINER.equals(parentType) && + !dictionaryService.isSubClass(parentType, TYPE_RECORDS_MANAGEMENT_CONTAINER)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_PARENT_TYPE, parentType.toString())); + } + + // Check that the the provided type is a sub-type of rm:recordCategory + if (!TYPE_RECORD_CATEGORY.equals(type) && + !dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_TYPE, type.toString())); + } + + // Set the properties for the record category + Map props = new HashMap(1); + if (properties != null && properties.size() != 0) + { + props.putAll(properties); + } + props.put(ContentModel.PROP_NAME, name); + + return nodeService.createNode( + parent, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, (name.length() > QName.MAX_LENGTH ? name.substring(0, QName.MAX_LENGTH) : name)), + type, + props).getChildRef(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + public NodeRef createRecordCategory(NodeRef parent, String name) + { + return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) + */ + public NodeRef createRecordCategory(NodeRef parent, String name, Map properties) + { + return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY, properties); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName) + */ + public NodeRef createRecordCategory(NodeRef parent, String name, QName type) + { + return createRecordCategory(parent, name, type, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getAllContained(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getAllContained(NodeRef container) + { + return getAllContained(container, false); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getAllContained(org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + @Override + public List getAllContained(NodeRef container, boolean deep) + { + return getContained(container, null, deep); + } + + /** + * Get contained nodes of a particular type. If null return all. + * + * @param container container node reference + * @param typeFilter type filter, null if none + * @return {@link List}<{@link NodeRef> list of contained node references + */ + private List getContained(NodeRef container, QName typeFilter, boolean deep) + { + // Parameter check + ParameterCheck.mandatory("container", container); + + // Check we have a container in our hands + if (!isRecordCategory(container)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_EXPECTED)); + } + + List result = new ArrayList(1); + List assocs = this.nodeService.getChildAssocs(container, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + NodeRef child = assoc.getChildRef(); + QName childType = nodeService.getType(child); + if (typeFilter == null || + typeFilter.equals(childType) || + dictionaryService.isSubClass(childType, typeFilter)) + { + result.add(child); + } + + // Inspect the containers and add children if deep + if (deep && + (TYPE_RECORD_CATEGORY.equals(childType) || + dictionaryService.isSubClass(childType, TYPE_RECORD_CATEGORY))) + { + result.addAll(getContained(child, typeFilter, deep)); + } + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getContainedRecordCategories(NodeRef container) + { + return getContainedRecordCategories(container, false); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + @Override + public List getContainedRecordCategories(NodeRef container, boolean deep) + { + return getContained(container, TYPE_RECORD_CATEGORY, deep); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getContainedRecordFolders(NodeRef container) + { + return getContainedRecordFolders(container, false); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + @Override + public List getContainedRecordFolders(NodeRef container, boolean deep) + { + return getContained(container, TYPE_RECORD_FOLDER, deep); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java index 1834b27b8b..33dfe0c427 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java @@ -1,193 +1,193 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.forms; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.forms.Field; -import org.alfresco.repo.forms.FieldGroup; -import org.alfresco.repo.forms.Form; -import org.alfresco.repo.forms.FormData; -import org.alfresco.repo.forms.processor.AbstractFilter; -import org.alfresco.repo.forms.processor.node.FieldUtils; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Abstract base class for records management related form filter - * implementations. - * - * @author Gavin Cornwell - */ -public abstract class RecordsManagementFormFilter extends AbstractFilter -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementFormFilter.class); - - public static final String CUSTOM_RM_FIELD_GROUP_ID = "rm-custom"; - public static final String RM_METADATA_PREFIX = "rm-metadata-"; - - protected NamespaceService namespaceService; - protected NodeService nodeService; - protected RecordsManagementServiceRegistry rmServiceRegistry; - protected RecordsManagementAdminService rmAdminService; - protected RecordService recordService; - protected DictionaryService dictionaryService; - - /** - * Sets the NamespaceService instance - * - * @param namespaceService The NamespaceService instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Sets the node service - * - * @param nodeService The NodeService instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Sets the RecordsManagementServiceRegistry instance - * - * @param rmServiceRegistry The RecordsManagementServiceRegistry instance - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry rmServiceRegistry) - { - this.rmServiceRegistry = rmServiceRegistry; - } - - /** - * Sets the RecordsManagementAdminService instance - * - * @param rmAdminService The RecordsManagementAdminService instance - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Add property fields to group - * - * @param form - * @param props - * @param setId - */ - protected void addPropertyFieldsToGroup(Form form, Map props, String setId, String setLabel) - { - if (props != null) - { - for (Map.Entry entry : props.entrySet()) - { - PropertyDefinition prop = entry.getValue(); - - String id = form.getItem().getId(); - id = id.replaceFirst("/", "://"); - NodeRef nodeRef = new NodeRef(id); - Serializable value = nodeService.getProperty(nodeRef, entry.getKey()); - - FieldGroup group = new FieldGroup(setId, setLabel, false, false, null); - Field field = FieldUtils.makePropertyField(prop, value, group, namespaceService, dictionaryService); - - form.addField(field); - - if (logger.isDebugEnabled()) - { - logger.debug("Adding custom property .. " + prop.getName().toString() + " .. with value " + value + ".. to group .. " + setId); - } - } - } - } - - /** - * @see - * org.alfresco.repo.forms.processor.Filter#beforePersist(java.lang.Object, - * org.alfresco.repo.forms.FormData) - */ - public void beforePersist(ItemType item, FormData data) - { - // ignored - } - - /** - * @see - * org.alfresco.repo.forms.processor.Filter#beforeGenerate(java.lang.Object, - * java.util.List, java.util.List, org.alfresco.repo.forms.Form, - * java.util.Map) - */ - public void beforeGenerate(ItemType item, List fields, List forcedFields, Form form, - Map context) - { - // ignored - } - - /** - * @see - * org.alfresco.repo.forms.processor.Filter#afterPersist(java.lang.Object, - * org.alfresco.repo.forms.FormData, java.lang.Object) - */ - public void afterPersist(ItemType item, FormData data, NodeRef persistedObject) - { - // ignored - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.forms; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.repo.forms.Field; +import org.alfresco.repo.forms.FieldGroup; +import org.alfresco.repo.forms.Form; +import org.alfresco.repo.forms.FormData; +import org.alfresco.repo.forms.processor.AbstractFilter; +import org.alfresco.repo.forms.processor.node.FieldUtils; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Abstract base class for records management related form filter + * implementations. + * + * @author Gavin Cornwell + */ +public abstract class RecordsManagementFormFilter extends AbstractFilter +{ + /** Logger */ + private static Log logger = LogFactory.getLog(RecordsManagementFormFilter.class); + + public static final String CUSTOM_RM_FIELD_GROUP_ID = "rm-custom"; + public static final String RM_METADATA_PREFIX = "rm-metadata-"; + + protected NamespaceService namespaceService; + protected NodeService nodeService; + protected RecordsManagementServiceRegistry rmServiceRegistry; + protected RecordsManagementAdminService rmAdminService; + protected RecordService recordService; + protected DictionaryService dictionaryService; + + /** + * Sets the NamespaceService instance + * + * @param namespaceService The NamespaceService instance + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * Sets the node service + * + * @param nodeService The NodeService instance + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Sets the RecordsManagementServiceRegistry instance + * + * @param rmServiceRegistry The RecordsManagementServiceRegistry instance + */ + public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry rmServiceRegistry) + { + this.rmServiceRegistry = rmServiceRegistry; + } + + /** + * Sets the RecordsManagementAdminService instance + * + * @param rmAdminService The RecordsManagementAdminService instance + */ + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * Add property fields to group + * + * @param form + * @param props + * @param setId + */ + protected void addPropertyFieldsToGroup(Form form, Map props, String setId, String setLabel) + { + if (props != null) + { + for (Map.Entry entry : props.entrySet()) + { + PropertyDefinition prop = entry.getValue(); + + String id = form.getItem().getId(); + id = id.replaceFirst("/", "://"); + NodeRef nodeRef = new NodeRef(id); + Serializable value = nodeService.getProperty(nodeRef, entry.getKey()); + + FieldGroup group = new FieldGroup(setId, setLabel, false, false, null); + Field field = FieldUtils.makePropertyField(prop, value, group, namespaceService, dictionaryService); + + form.addField(field); + + if (logger.isDebugEnabled()) + { + logger.debug("Adding custom property .. " + prop.getName().toString() + " .. with value " + value + ".. to group .. " + setId); + } + } + } + } + + /** + * @see + * org.alfresco.repo.forms.processor.Filter#beforePersist(java.lang.Object, + * org.alfresco.repo.forms.FormData) + */ + public void beforePersist(ItemType item, FormData data) + { + // ignored + } + + /** + * @see + * org.alfresco.repo.forms.processor.Filter#beforeGenerate(java.lang.Object, + * java.util.List, java.util.List, org.alfresco.repo.forms.Form, + * java.util.Map) + */ + public void beforeGenerate(ItemType item, List fields, List forcedFields, Form form, + Map context) + { + // ignored + } + + /** + * @see + * org.alfresco.repo.forms.processor.Filter#afterPersist(java.lang.Object, + * org.alfresco.repo.forms.FormData, java.lang.Object) + */ + public void afterPersist(ItemType item, FormData data, NodeRef persistedObject) + { + // ignored + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java index e7f18a5d4c..fcc65ed9a8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java @@ -1,433 +1,433 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.forms; - -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ImapModel; -import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.forms.Field; -import org.alfresco.repo.forms.FieldDefinition; -import org.alfresco.repo.forms.Form; -import org.alfresco.repo.forms.PropertyFieldDefinition; -import org.alfresco.repo.forms.processor.node.FieldUtils; -import org.alfresco.repo.forms.processor.node.FormFieldConstants; -import org.alfresco.repo.i18n.StaticMessageLookup; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Implementation of a form processor Filter. - *

- * The filter ensures that any custom properties defined for the records - * management type are provided as part of the Form and also assigned to the - * same field group. - *

- * - * @author Gavin Cornwell - */ -public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter implements RecordsManagementModel, DOD5015Model -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementNodeFormFilter.class); - - protected static final String TRANSIENT_DECLARED = "rmDeclared"; - protected static final String TRANSIENT_CATEGORY_ID = "rmCategoryIdentifier"; - protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions"; - - /** Disposition service */ - private DispositionService dispositionService; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** - * Returns the disposition service - * - * @return Disposition service - */ - protected DispositionService getDispositionService() - { - return this.dispositionService; - } - - /** - * Returns the file plan service - * - * @return File plan service - */ - protected FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * Sets the disposition service - * - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, java.util.List, java.util.List, org.alfresco.repo.forms.Form, java.util.Map) - */ - @Override - public void afterGenerate( - NodeRef nodeRef, - List fields, - List forcedFields, - Form form, - Map context) - { - if (getFilePlanService().isFilePlanComponent(nodeRef)) - { - // add all the custom properties - addCustomPropertyFieldsToGroup(form, nodeRef); - - FilePlanComponentKind kind = getFilePlanService().getFilePlanComponentKind(nodeRef); - if (FilePlanComponentKind.RECORD.equals(kind)) - { - // add all the record meta-data aspect properties - addRecordMetadataPropertyFieldsToGroup(form, nodeRef); - - // add required transient properties - addTransientProperties(form, nodeRef); - - // add the supplemental marking list property - forceSupplementalMarkingListProperty(form, nodeRef); - - // protect uneditable properties - protectRecordProperties(form, nodeRef); - - // if the record is the result of an email we need to 'protect' some fields - if (this.nodeService.hasAspect(nodeRef, ImapModel.ASPECT_IMAP_CONTENT)) - { - protectEmailExtractedFields(form, nodeRef); - } - } - else if (FilePlanComponentKind.RECORD_FOLDER.equals(kind)) - { - // add the supplemental marking list property - forceSupplementalMarkingListProperty(form, nodeRef); - - // add required transient properties - addTransientProperties(form, nodeRef); - } - else if (FilePlanComponentKind.DISPOSITION_SCHEDULE.equals(kind)) - { - // use the same mechanism used to determine whether steps can be removed from the - // schedule to determine whether the disposition level can be changed i.e. record - // level or folder level. - DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef); - if (getDispositionService().hasDisposableItems(schedule)) - { - protectRecordLevelDispositionPropertyField(form); - } - } - } - } - - /** - * - * @param form - * @param nodeRef - */ - protected void addCustomPropertyFieldsToGroup(Form form, NodeRef nodeRef) - { - Set customisables = rmAdminService.getCustomisable(nodeRef); - - // Compatibility support: don't show category properties if node of type series - QName type = nodeService.getType(nodeRef); - if (CompatibilityModel.TYPE_RECORD_SERIES.equals(type)) - { - // remove record category from the list of customisable types to apply to the form - customisables.remove(TYPE_RECORD_CATEGORY); - } - - for (QName customisable : customisables) - { - addPropertyFieldsToGroup(form, rmAdminService.getCustomPropertyDefinitions(customisable), CUSTOM_RM_FIELD_GROUP_ID, null); - } - } - - /** - * - * @param form - * @param nodeRef - */ - protected void addRecordMetadataPropertyFieldsToGroup(Form form, NodeRef nodeRef) - { - Set aspects = recordService.getRecordMetadataAspects(nodeRef); - - for (QName aspect : aspects) - { - if (nodeService.hasAspect(nodeRef, aspect)) - { - String aspectName = aspect.getPrefixedQName(namespaceService).toPrefixString().replace(":", "-"); - String setId = RM_METADATA_PREFIX + aspectName; - - String setLabel = null; - AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect); - if (aspectDefinition != null) - { - setLabel = aspectDefinition.getTitle(new StaticMessageLookup()); - } - - addPropertyFieldsToGroup(form, dictionaryService.getPropertyDefs(aspect), setId, setLabel); - } - } - } - - /** - * Forces the "rmc:supplementalMarkingList" property to be present, if it is - * already on the given node this method does nothing, otherwise a property - * field definition is generated for the property. - * - * @param form The Form instance to add the property to - * @param nodeRef The node the form is being generated for - */ - protected void forceSupplementalMarkingListProperty(Form form, NodeRef nodeRef) - { - if (!this.nodeService.hasAspect(nodeRef, - RecordsManagementCustomModel.ASPECT_SUPPLEMENTAL_MARKING_LIST)) - { - PropertyDefinition propDef = this.dictionaryService.getProperty( - RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST); - - if (propDef != null) - { - Field field = FieldUtils.makePropertyField(propDef, null, null, namespaceService, dictionaryService); - form.addField(field); - } - else if (logger.isWarnEnabled()) - { - logger.warn("Could not add " + - RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST.getLocalName() + - " property as it's definition could not be found"); - } - } - } - - /** - * - * @param form - * @param nodeRef - */ - protected void addTransientProperties(final Form form, final NodeRef nodeRef) - { - if (recordService.isRecord(nodeRef)) - { - addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef)); - } - - // Need to get the disposition schedule as the system user. See RM-1727. - //Need to run all block as the system user, needed for disposition instructions, recordCategory and categoryId. See RM-3077. - runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - DispositionSchedule ds = getDispositionService().getDispositionSchedule(nodeRef); - - if (ds != null) - { - String instructions = ds.getDispositionInstructions(); - if (instructions != null) - { - addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT, - instructions); - } - - NodeRef recordCategory = getDispositionService().getAssociatedRecordsManagementContainer(ds); - if (recordCategory != null) - { - String categoryId = (String) nodeService.getProperty(recordCategory, PROP_IDENTIFIER); - if (categoryId != null) - { - addTransientPropertyField(form, TRANSIENT_CATEGORY_ID, DataTypeDefinition.TEXT, categoryId); - } - } - } - return null; - } - }); - } - - /** - * - * @param form - * @param name - * @param type - * @param value - */ - protected void addTransientPropertyField(Form form, String name, QName type, Object value) - { - String dataKeyName = FormFieldConstants.PROP_DATA_PREFIX + name; - PropertyFieldDefinition declaredField = new PropertyFieldDefinition(name, type.getLocalName()); - declaredField.setLabel(name); - declaredField.setDescription(name); - declaredField.setProtectedField(true); - declaredField.setDataKeyName(dataKeyName); - form.addFieldDefinition(declaredField); - form.addData(dataKeyName, value); - } - - /** - * - * @param form - * @param nodeRef - */ - protected void protectRecordProperties(Form form, NodeRef nodeRef) - { - List fieldDefs = form.getFieldDefinitions(); - for (FieldDefinition fieldDef : fieldDefs) - { - if (!fieldDef.isProtectedField()) - { - String name = fieldDef.getName(); - String prefixName = null; - if ("size".equals(name) || "mimetype".equals(name) || "encoding".equals(name)) - { - prefixName = "cm:content"; - } - else - { - prefixName = fieldDef.getName(); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Checking property " + prefixName + " is editable by user " + AuthenticationUtil.getFullyAuthenticatedUser()); - } - - QName qname = QName.createQName(prefixName, namespaceService); - if (!recordService.isPropertyEditable(nodeRef, qname)) - { - if (logger.isDebugEnabled()) - { - logger.debug(" ... protected property"); - } - fieldDef.setProtectedField(true); - } - } - } - } - - /** - * Marks all the fields that contain data extracted from an email - * as protected fields. - * - * @param form The Form instance to add the property to - * @param nodeRef The node the form is being generated for - */ - protected void protectEmailExtractedFields(Form form, NodeRef nodeRef) - { - // iterate round existing fields and set email fields as protected - List fieldDefs = form.getFieldDefinitions(); - for (FieldDefinition fieldDef : fieldDefs) - { - String prefixName = fieldDef.getName(); - - // check the value of the property, if empty then do not mark property - // as read only - QName qname = QName.createQName(prefixName, namespaceService); - Serializable value = nodeService.getProperty(nodeRef, qname); - if (value != null && - (prefixName.equals("cm:title") || - prefixName.equals("cm:author") || - prefixName.equals("dod:originator") || - prefixName.equals("dod:publicationDate") || - prefixName.equals("dod:dateReceived") || - prefixName.equals("dod:address") || - prefixName.equals("dod:otherAddress"))) - { - fieldDef.setProtectedField(true); - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("Set email related fields to be protected"); - } - } - - /** - * Marks the recordLevelDisposition property as protected to disable editing - * - * @param form The Form instance - */ - protected void protectRecordLevelDispositionPropertyField(Form form) - { - List fieldDefs = form.getFieldDefinitions(); - for (FieldDefinition fieldDef : fieldDefs) - { - if (fieldDef.getName().equals(RecordsManagementModel.PROP_RECORD_LEVEL_DISPOSITION.toPrefixString( - this.namespaceService))) - { - fieldDef.setProtectedField(true); - break; - } - } - - if (logger.isDebugEnabled()) - { - logger.debug("Set 'rma:recordLevelDisposition' field to be protected as record folders or records are present"); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.forms; + +import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ImapModel; +import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.forms.Field; +import org.alfresco.repo.forms.FieldDefinition; +import org.alfresco.repo.forms.Form; +import org.alfresco.repo.forms.PropertyFieldDefinition; +import org.alfresco.repo.forms.processor.node.FieldUtils; +import org.alfresco.repo.forms.processor.node.FormFieldConstants; +import org.alfresco.repo.i18n.StaticMessageLookup; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Implementation of a form processor Filter. + *

+ * The filter ensures that any custom properties defined for the records + * management type are provided as part of the Form and also assigned to the + * same field group. + *

+ * + * @author Gavin Cornwell + */ +public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter implements RecordsManagementModel, DOD5015Model +{ + /** Logger */ + private static Log logger = LogFactory.getLog(RecordsManagementNodeFormFilter.class); + + protected static final String TRANSIENT_DECLARED = "rmDeclared"; + protected static final String TRANSIENT_CATEGORY_ID = "rmCategoryIdentifier"; + protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions"; + + /** Disposition service */ + private DispositionService dispositionService; + + /** File Plan Service */ + private FilePlanService filePlanService; + + /** + * Returns the disposition service + * + * @return Disposition service + */ + protected DispositionService getDispositionService() + { + return this.dispositionService; + } + + /** + * Returns the file plan service + * + * @return File plan service + */ + protected FilePlanService getFilePlanService() + { + return this.filePlanService; + } + + /** + * Sets the disposition service + * + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, java.util.List, java.util.List, org.alfresco.repo.forms.Form, java.util.Map) + */ + @Override + public void afterGenerate( + NodeRef nodeRef, + List fields, + List forcedFields, + Form form, + Map context) + { + if (getFilePlanService().isFilePlanComponent(nodeRef)) + { + // add all the custom properties + addCustomPropertyFieldsToGroup(form, nodeRef); + + FilePlanComponentKind kind = getFilePlanService().getFilePlanComponentKind(nodeRef); + if (FilePlanComponentKind.RECORD.equals(kind)) + { + // add all the record meta-data aspect properties + addRecordMetadataPropertyFieldsToGroup(form, nodeRef); + + // add required transient properties + addTransientProperties(form, nodeRef); + + // add the supplemental marking list property + forceSupplementalMarkingListProperty(form, nodeRef); + + // protect uneditable properties + protectRecordProperties(form, nodeRef); + + // if the record is the result of an email we need to 'protect' some fields + if (this.nodeService.hasAspect(nodeRef, ImapModel.ASPECT_IMAP_CONTENT)) + { + protectEmailExtractedFields(form, nodeRef); + } + } + else if (FilePlanComponentKind.RECORD_FOLDER.equals(kind)) + { + // add the supplemental marking list property + forceSupplementalMarkingListProperty(form, nodeRef); + + // add required transient properties + addTransientProperties(form, nodeRef); + } + else if (FilePlanComponentKind.DISPOSITION_SCHEDULE.equals(kind)) + { + // use the same mechanism used to determine whether steps can be removed from the + // schedule to determine whether the disposition level can be changed i.e. record + // level or folder level. + DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef); + if (getDispositionService().hasDisposableItems(schedule)) + { + protectRecordLevelDispositionPropertyField(form); + } + } + } + } + + /** + * + * @param form + * @param nodeRef + */ + protected void addCustomPropertyFieldsToGroup(Form form, NodeRef nodeRef) + { + Set customisables = rmAdminService.getCustomisable(nodeRef); + + // Compatibility support: don't show category properties if node of type series + QName type = nodeService.getType(nodeRef); + if (CompatibilityModel.TYPE_RECORD_SERIES.equals(type)) + { + // remove record category from the list of customisable types to apply to the form + customisables.remove(TYPE_RECORD_CATEGORY); + } + + for (QName customisable : customisables) + { + addPropertyFieldsToGroup(form, rmAdminService.getCustomPropertyDefinitions(customisable), CUSTOM_RM_FIELD_GROUP_ID, null); + } + } + + /** + * + * @param form + * @param nodeRef + */ + protected void addRecordMetadataPropertyFieldsToGroup(Form form, NodeRef nodeRef) + { + Set aspects = recordService.getRecordMetadataAspects(nodeRef); + + for (QName aspect : aspects) + { + if (nodeService.hasAspect(nodeRef, aspect)) + { + String aspectName = aspect.getPrefixedQName(namespaceService).toPrefixString().replace(":", "-"); + String setId = RM_METADATA_PREFIX + aspectName; + + String setLabel = null; + AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect); + if (aspectDefinition != null) + { + setLabel = aspectDefinition.getTitle(new StaticMessageLookup()); + } + + addPropertyFieldsToGroup(form, dictionaryService.getPropertyDefs(aspect), setId, setLabel); + } + } + } + + /** + * Forces the "rmc:supplementalMarkingList" property to be present, if it is + * already on the given node this method does nothing, otherwise a property + * field definition is generated for the property. + * + * @param form The Form instance to add the property to + * @param nodeRef The node the form is being generated for + */ + protected void forceSupplementalMarkingListProperty(Form form, NodeRef nodeRef) + { + if (!this.nodeService.hasAspect(nodeRef, + RecordsManagementCustomModel.ASPECT_SUPPLEMENTAL_MARKING_LIST)) + { + PropertyDefinition propDef = this.dictionaryService.getProperty( + RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST); + + if (propDef != null) + { + Field field = FieldUtils.makePropertyField(propDef, null, null, namespaceService, dictionaryService); + form.addField(field); + } + else if (logger.isWarnEnabled()) + { + logger.warn("Could not add " + + RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST.getLocalName() + + " property as it's definition could not be found"); + } + } + } + + /** + * + * @param form + * @param nodeRef + */ + protected void addTransientProperties(final Form form, final NodeRef nodeRef) + { + if (recordService.isRecord(nodeRef)) + { + addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef)); + } + + // Need to get the disposition schedule as the system user. See RM-1727. + //Need to run all block as the system user, needed for disposition instructions, recordCategory and categoryId. See RM-3077. + runAsSystem(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + DispositionSchedule ds = getDispositionService().getDispositionSchedule(nodeRef); + + if (ds != null) + { + String instructions = ds.getDispositionInstructions(); + if (instructions != null) + { + addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT, + instructions); + } + + NodeRef recordCategory = getDispositionService().getAssociatedRecordsManagementContainer(ds); + if (recordCategory != null) + { + String categoryId = (String) nodeService.getProperty(recordCategory, PROP_IDENTIFIER); + if (categoryId != null) + { + addTransientPropertyField(form, TRANSIENT_CATEGORY_ID, DataTypeDefinition.TEXT, categoryId); + } + } + } + return null; + } + }); + } + + /** + * + * @param form + * @param name + * @param type + * @param value + */ + protected void addTransientPropertyField(Form form, String name, QName type, Object value) + { + String dataKeyName = FormFieldConstants.PROP_DATA_PREFIX + name; + PropertyFieldDefinition declaredField = new PropertyFieldDefinition(name, type.getLocalName()); + declaredField.setLabel(name); + declaredField.setDescription(name); + declaredField.setProtectedField(true); + declaredField.setDataKeyName(dataKeyName); + form.addFieldDefinition(declaredField); + form.addData(dataKeyName, value); + } + + /** + * + * @param form + * @param nodeRef + */ + protected void protectRecordProperties(Form form, NodeRef nodeRef) + { + List fieldDefs = form.getFieldDefinitions(); + for (FieldDefinition fieldDef : fieldDefs) + { + if (!fieldDef.isProtectedField()) + { + String name = fieldDef.getName(); + String prefixName = null; + if ("size".equals(name) || "mimetype".equals(name) || "encoding".equals(name)) + { + prefixName = "cm:content"; + } + else + { + prefixName = fieldDef.getName(); + } + + if (logger.isDebugEnabled()) + { + logger.debug("Checking property " + prefixName + " is editable by user " + AuthenticationUtil.getFullyAuthenticatedUser()); + } + + QName qname = QName.createQName(prefixName, namespaceService); + if (!recordService.isPropertyEditable(nodeRef, qname)) + { + if (logger.isDebugEnabled()) + { + logger.debug(" ... protected property"); + } + fieldDef.setProtectedField(true); + } + } + } + } + + /** + * Marks all the fields that contain data extracted from an email + * as protected fields. + * + * @param form The Form instance to add the property to + * @param nodeRef The node the form is being generated for + */ + protected void protectEmailExtractedFields(Form form, NodeRef nodeRef) + { + // iterate round existing fields and set email fields as protected + List fieldDefs = form.getFieldDefinitions(); + for (FieldDefinition fieldDef : fieldDefs) + { + String prefixName = fieldDef.getName(); + + // check the value of the property, if empty then do not mark property + // as read only + QName qname = QName.createQName(prefixName, namespaceService); + Serializable value = nodeService.getProperty(nodeRef, qname); + if (value != null && + (prefixName.equals("cm:title") || + prefixName.equals("cm:author") || + prefixName.equals("dod:originator") || + prefixName.equals("dod:publicationDate") || + prefixName.equals("dod:dateReceived") || + prefixName.equals("dod:address") || + prefixName.equals("dod:otherAddress"))) + { + fieldDef.setProtectedField(true); + } + } + + if (logger.isDebugEnabled()) + { + logger.debug("Set email related fields to be protected"); + } + } + + /** + * Marks the recordLevelDisposition property as protected to disable editing + * + * @param form The Form instance + */ + protected void protectRecordLevelDispositionPropertyField(Form form) + { + List fieldDefs = form.getFieldDefinitions(); + for (FieldDefinition fieldDef : fieldDefs) + { + if (fieldDef.getName().equals(RecordsManagementModel.PROP_RECORD_LEVEL_DISPOSITION.toPrefixString( + this.namespaceService))) + { + fieldDef.setProtectedField(true); + break; + } + } + + if (logger.isDebugEnabled()) + { + logger.debug("Set 'rma:recordLevelDisposition' field to be protected as record folders or records are present"); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java index 65c988a434..fb5de78a19 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java @@ -1,191 +1,191 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.forms; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.forms.Field; -import org.alfresco.repo.forms.FieldDefinition; -import org.alfresco.repo.forms.FieldGroup; -import org.alfresco.repo.forms.Form; -import org.alfresco.repo.forms.FormData; -import org.alfresco.repo.forms.processor.node.FieldUtils; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Implementation of a form processor Filter. - *

- * The filter implements the afterGenerate method to ensure a - * default unique identifier is provided for the rma:identifier - * property. - *

- *

- * The filter also ensures that any custom properties defined for the records - * management type are provided as part of the Form. - *

- * - * @author Gavin Cornwell - */ -public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordsManagementTypeFormFilter.class); - - protected static final String NAME_FIELD_GROUP_ID = "name"; - protected static final String TITLE_FIELD_GROUP_ID = "title"; - protected static final String DESC_FIELD_GROUP_ID = "description"; - protected static final String OTHER_FIELD_GROUP_ID = "other"; - - protected static final FieldGroup NAME_FIELD_GROUP = new FieldGroup(NAME_FIELD_GROUP_ID, null, false, false, null); - protected static final FieldGroup TITLE_FIELD_GROUP = new FieldGroup(TITLE_FIELD_GROUP_ID, null, false, false, null); - protected static final FieldGroup DESC_FIELD_GROUP = new FieldGroup(DESC_FIELD_GROUP_ID, null, false, false, null); - protected static final FieldGroup OTHER_FIELD_GROUP = new FieldGroup(OTHER_FIELD_GROUP_ID, null, false, false, null); - - /** Identifier service */ - protected IdentifierService identifierService; - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /* - * @see - * org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, - * java.util.List, java.util.List, org.alfresco.repo.forms.Form, - * java.util.Map) - */ - public void afterGenerate( - TypeDefinition type, - List fields, - List forcedFields, - Form form, - Map context) - { - QName typeName = type.getName(); - if (rmAdminService.isCustomisable(typeName)) - { - addCustomRMProperties(typeName, form); - } - - // What about any mandatory aspects? - Set aspects = type.getDefaultAspectNames(); - for (QName aspect : aspects) - { - if (rmAdminService.isCustomisable(aspect)) - { - addCustomRMProperties(aspect, form); - } - } - - // set the id - List fieldDefs = form.getFieldDefinitions(); - for (FieldDefinition fieldDef : fieldDefs) - { - String prefixName = fieldDef.getName(); - if (prefixName.equals("rma:identifier")) - { - String defaultId = identifierService.generateIdentifier(typeName, null); - fieldDef.setDefaultValue(defaultId); - } - // NOTE: we set these defaults in the form for backwards compatibility reasons (RM-753) - else if (prefixName.equals("rma:vitalRecordIndicator")) - { - fieldDef.setDefaultValue(Boolean.FALSE.toString()); - } - else if (prefixName.equals("rma:reviewPeriod")) - { - fieldDef.setDefaultValue("none|0"); - } - } - } - - /** - * Adds a property definition for each of the custom properties for the - * given RM type to the given form. - * - * @param rmTypeCustomAspect Enum representing the RM type to add custom - * properties for - * @param form The form to add the properties to - */ - protected void addCustomRMProperties(QName customisableType, Form form) - { - ParameterCheck.mandatory("customisableType", customisableType); - ParameterCheck.mandatory("form", form); - - Map customProps = rmAdminService.getCustomPropertyDefinitions(customisableType); - - if (customProps != null && !customProps.isEmpty()) - { - if (logger.isDebugEnabled()) - { - logger.debug("Found " + customProps.size() + " custom properties for customisable type " + customisableType); - } - - // setup field definition for each custom property - Collection properties = customProps.values(); - FieldGroup group = new FieldGroup(CUSTOM_RM_FIELD_GROUP_ID, null, false, false, null); - List fields = FieldUtils.makePropertyFields(properties, group, namespaceService, dictionaryService); - form.addFields(fields); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementFormFilter#beforePersist(java.lang.Object, org.alfresco.repo.forms.FormData) - */ - @Override - public void beforePersist(TypeDefinition item, FormData data) - { - recordService.disablePropertyEditableCheck(); - super.beforePersist(item, data); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementFormFilter#afterPersist(java.lang.Object, org.alfresco.repo.forms.FormData, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void afterPersist(TypeDefinition item, FormData data, NodeRef persistedObject) - { - super.afterPersist(item, data, persistedObject); - recordService.enablePropertyEditableCheck(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.forms; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.forms.Field; +import org.alfresco.repo.forms.FieldDefinition; +import org.alfresco.repo.forms.FieldGroup; +import org.alfresco.repo.forms.Form; +import org.alfresco.repo.forms.FormData; +import org.alfresco.repo.forms.processor.node.FieldUtils; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.dictionary.TypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.ParameterCheck; + +/** + * Implementation of a form processor Filter. + *

+ * The filter implements the afterGenerate method to ensure a + * default unique identifier is provided for the rma:identifier + * property. + *

+ *

+ * The filter also ensures that any custom properties defined for the records + * management type are provided as part of the Form. + *

+ * + * @author Gavin Cornwell + */ +public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter implements RecordsManagementModel +{ + /** Logger */ + private static Log logger = LogFactory.getLog(RecordsManagementTypeFormFilter.class); + + protected static final String NAME_FIELD_GROUP_ID = "name"; + protected static final String TITLE_FIELD_GROUP_ID = "title"; + protected static final String DESC_FIELD_GROUP_ID = "description"; + protected static final String OTHER_FIELD_GROUP_ID = "other"; + + protected static final FieldGroup NAME_FIELD_GROUP = new FieldGroup(NAME_FIELD_GROUP_ID, null, false, false, null); + protected static final FieldGroup TITLE_FIELD_GROUP = new FieldGroup(TITLE_FIELD_GROUP_ID, null, false, false, null); + protected static final FieldGroup DESC_FIELD_GROUP = new FieldGroup(DESC_FIELD_GROUP_ID, null, false, false, null); + protected static final FieldGroup OTHER_FIELD_GROUP = new FieldGroup(OTHER_FIELD_GROUP_ID, null, false, false, null); + + /** Identifier service */ + protected IdentifierService identifierService; + + /** + * @param identifierService identifier service + */ + public void setIdentifierService(IdentifierService identifierService) + { + this.identifierService = identifierService; + } + + /* + * @see + * org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, + * java.util.List, java.util.List, org.alfresco.repo.forms.Form, + * java.util.Map) + */ + public void afterGenerate( + TypeDefinition type, + List fields, + List forcedFields, + Form form, + Map context) + { + QName typeName = type.getName(); + if (rmAdminService.isCustomisable(typeName)) + { + addCustomRMProperties(typeName, form); + } + + // What about any mandatory aspects? + Set aspects = type.getDefaultAspectNames(); + for (QName aspect : aspects) + { + if (rmAdminService.isCustomisable(aspect)) + { + addCustomRMProperties(aspect, form); + } + } + + // set the id + List fieldDefs = form.getFieldDefinitions(); + for (FieldDefinition fieldDef : fieldDefs) + { + String prefixName = fieldDef.getName(); + if (prefixName.equals("rma:identifier")) + { + String defaultId = identifierService.generateIdentifier(typeName, null); + fieldDef.setDefaultValue(defaultId); + } + // NOTE: we set these defaults in the form for backwards compatibility reasons (RM-753) + else if (prefixName.equals("rma:vitalRecordIndicator")) + { + fieldDef.setDefaultValue(Boolean.FALSE.toString()); + } + else if (prefixName.equals("rma:reviewPeriod")) + { + fieldDef.setDefaultValue("none|0"); + } + } + } + + /** + * Adds a property definition for each of the custom properties for the + * given RM type to the given form. + * + * @param rmTypeCustomAspect Enum representing the RM type to add custom + * properties for + * @param form The form to add the properties to + */ + protected void addCustomRMProperties(QName customisableType, Form form) + { + ParameterCheck.mandatory("customisableType", customisableType); + ParameterCheck.mandatory("form", form); + + Map customProps = rmAdminService.getCustomPropertyDefinitions(customisableType); + + if (customProps != null && !customProps.isEmpty()) + { + if (logger.isDebugEnabled()) + { + logger.debug("Found " + customProps.size() + " custom properties for customisable type " + customisableType); + } + + // setup field definition for each custom property + Collection properties = customProps.values(); + FieldGroup group = new FieldGroup(CUSTOM_RM_FIELD_GROUP_ID, null, false, false, null); + List fields = FieldUtils.makePropertyFields(properties, group, namespaceService, dictionaryService); + form.addFields(fields); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementFormFilter#beforePersist(java.lang.Object, org.alfresco.repo.forms.FormData) + */ + @Override + public void beforePersist(TypeDefinition item, FormData data) + { + recordService.disablePropertyEditableCheck(); + super.beforePersist(item, data); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementFormFilter#afterPersist(java.lang.Object, org.alfresco.repo.forms.FormData, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void afterPersist(TypeDefinition item, FormData data, NodeRef persistedObject) + { + super.afterPersist(item, data, persistedObject); + recordService.enablePropertyEditableCheck(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java index 4b68c4eaae..5793d470bf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeService.java @@ -1,151 +1,151 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.freeze; - -import java.util.Date; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Freeze Service Interface - * - * TODO should be deprecated and methods moved to the HoldService with "hold, held, etc" style names - * - * @author Roy Wetherall - * @since 2.0 - */ -@AlfrescoPublicApi -public interface FreezeService -{ - /** - * Indicates whether the passed node reference is frozen. - * - * @param nodeRef node reference - * @return boolean true if frozen, false otherwise - */ - boolean isFrozen(NodeRef nodeRef); - - /** - * Checks whether or not the given node has frozen children - * - * @param nodeRef The nodeRef for which will be checked if it has frozen children - * @return true if the given nodeRef has frozen children, false otherwise - */ - boolean hasFrozenChildren(NodeRef nodeRef); - - /** - * Gets the date of the freeze for the given node, null if the node is not frozen - * - * @param nodeRef The nodeRef for which the date check will be performed - * @return Date The of the freeze or null - */ - Date getFreezeDate(NodeRef nodeRef); - - /** - * Gets the initiator of the freeze for the given node, null if the node is not frozen - * - * @param nodeRef The nodeRef for which the initiator check will be performed - * @return String The initiator of the freeze or null - */ - String getFreezeInitiator(NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#isHold(NodeRef)} instead. - */ - @Deprecated - boolean isHold(NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#getHeld(NodeRef)} instead. - */ - @Deprecated - Set getFrozen(NodeRef hold); - - /** - * @deprecated as of 2.2, use {@link HoldService#createHold(NodeRef, String, String, String)} and {@link HoldService#addToHold(NodeRef, NodeRef)} instead. - */ - @Deprecated - NodeRef freeze(String reason, NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#addToHold(NodeRef, NodeRef)} instead. - */ - @Deprecated - void freeze(NodeRef hold, NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#createHold(NodeRef, String, String, String)} and {@link HoldService#addToHold(NodeRef, List)} instead. - */ - @Deprecated - NodeRef freeze(String reason, Set nodeRefs); - - /** - * @deprecated as of 2.2, use {@link HoldService#addToHold(NodeRef, List)} instead. - */ - @Deprecated - void freeze(NodeRef hold, Set nodeRefs); - - /** - * @deprecated as of 2.2, use {@link HoldService#removeFromHold(NodeRef, NodeRef)} instead. - */ - @Deprecated - void unFreeze(NodeRef nodeRef); - - /** - * @deprecated as of 2.2, use {@link HoldService#removeFromHolds(java.util.List, NodeRef)} instead. - */ - @Deprecated - void unFreeze(Set nodeRefs); - - /** - * @deprecated as of 2.2, use {@link HoldService#deleteHold(NodeRef)} instead. - */ - @Deprecated - void relinquish(NodeRef hold); - - /** - * @deprecated as of 2.2, use {@link HoldService#getHoldReason(NodeRef)} instead. - */ - @Deprecated - String getReason(NodeRef hold); - - /** - * @deprecated as of 2.2, use {@link HoldService#setHoldReason(NodeRef, String)} instead. - */ - @Deprecated - void updateReason(NodeRef hold, String reason); - - /** - * @deprecated as of 2.2, use {@link HoldService#getHolds(NodeRef)} instead. - */ - @Deprecated - Set getHolds(NodeRef filePlan); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.freeze; + +import java.util.Date; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Freeze Service Interface + * + * TODO should be deprecated and methods moved to the HoldService with "hold, held, etc" style names + * + * @author Roy Wetherall + * @since 2.0 + */ +@AlfrescoPublicApi +public interface FreezeService +{ + /** + * Indicates whether the passed node reference is frozen. + * + * @param nodeRef node reference + * @return boolean true if frozen, false otherwise + */ + boolean isFrozen(NodeRef nodeRef); + + /** + * Checks whether or not the given node has frozen children + * + * @param nodeRef The nodeRef for which will be checked if it has frozen children + * @return true if the given nodeRef has frozen children, false otherwise + */ + boolean hasFrozenChildren(NodeRef nodeRef); + + /** + * Gets the date of the freeze for the given node, null if the node is not frozen + * + * @param nodeRef The nodeRef for which the date check will be performed + * @return Date The of the freeze or null + */ + Date getFreezeDate(NodeRef nodeRef); + + /** + * Gets the initiator of the freeze for the given node, null if the node is not frozen + * + * @param nodeRef The nodeRef for which the initiator check will be performed + * @return String The initiator of the freeze or null + */ + String getFreezeInitiator(NodeRef nodeRef); + + /** + * @deprecated as of 2.2, use {@link HoldService#isHold(NodeRef)} instead. + */ + @Deprecated + boolean isHold(NodeRef nodeRef); + + /** + * @deprecated as of 2.2, use {@link HoldService#getHeld(NodeRef)} instead. + */ + @Deprecated + Set getFrozen(NodeRef hold); + + /** + * @deprecated as of 2.2, use {@link HoldService#createHold(NodeRef, String, String, String)} and {@link HoldService#addToHold(NodeRef, NodeRef)} instead. + */ + @Deprecated + NodeRef freeze(String reason, NodeRef nodeRef); + + /** + * @deprecated as of 2.2, use {@link HoldService#addToHold(NodeRef, NodeRef)} instead. + */ + @Deprecated + void freeze(NodeRef hold, NodeRef nodeRef); + + /** + * @deprecated as of 2.2, use {@link HoldService#createHold(NodeRef, String, String, String)} and {@link HoldService#addToHold(NodeRef, List)} instead. + */ + @Deprecated + NodeRef freeze(String reason, Set nodeRefs); + + /** + * @deprecated as of 2.2, use {@link HoldService#addToHold(NodeRef, List)} instead. + */ + @Deprecated + void freeze(NodeRef hold, Set nodeRefs); + + /** + * @deprecated as of 2.2, use {@link HoldService#removeFromHold(NodeRef, NodeRef)} instead. + */ + @Deprecated + void unFreeze(NodeRef nodeRef); + + /** + * @deprecated as of 2.2, use {@link HoldService#removeFromHolds(java.util.List, NodeRef)} instead. + */ + @Deprecated + void unFreeze(Set nodeRefs); + + /** + * @deprecated as of 2.2, use {@link HoldService#deleteHold(NodeRef)} instead. + */ + @Deprecated + void relinquish(NodeRef hold); + + /** + * @deprecated as of 2.2, use {@link HoldService#getHoldReason(NodeRef)} instead. + */ + @Deprecated + String getReason(NodeRef hold); + + /** + * @deprecated as of 2.2, use {@link HoldService#setHoldReason(NodeRef, String)} instead. + */ + @Deprecated + void updateReason(NodeRef hold, String reason); + + /** + * @deprecated as of 2.2, use {@link HoldService#getHolds(NodeRef)} instead. + */ + @Deprecated + Set getHolds(NodeRef filePlan); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java index 0092423fe8..0ed8441726 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java @@ -1,391 +1,391 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.freeze; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Freeze Service Implementation - * - * @author Roy Wetherall - * @author Tuna Aksoy - * @since 2.1 - */ -public class FreezeServiceImpl extends ServiceBaseImpl - implements FreezeService, - RecordsManagementModel -{ - /** I18N */ - private static final String MSG_HOLD_NAME = "rm.hold.name"; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** Hold service */ - private HoldService holdService; - - /** - * @return File plan service - */ - protected FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * @return Hold service - */ - protected HoldService getHoldService() - { - return this.holdService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#isFrozen(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isFrozen(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return nodeService.hasAspect(nodeRef, ASPECT_FROZEN); - } - - /** - * Deprecated Method Implementations - */ - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFrozen(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public Set getFrozen(NodeRef hold) - { - return new HashSet(getHoldService().getHeld(hold)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public NodeRef freeze(String reason, NodeRef nodeRef) - { - NodeRef hold = createHold(nodeRef, reason); - getHoldService().addToHold(hold, nodeRef); - return hold; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public void freeze(NodeRef hold, NodeRef nodeRef) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRef", nodeRef); - - getHoldService().addToHold(hold, nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String, - * java.util.Set) - */ - @Override - @Deprecated - public NodeRef freeze(String reason, Set nodeRefs) - { - NodeRef hold = null; - if (!nodeRefs.isEmpty()) - { - List list = new ArrayList(nodeRefs); - hold = createHold(list.get(0), reason); - getHoldService().addToHold(hold, list); - } - return hold; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef, - * java.util.Set) - */ - @Override - @Deprecated - public void freeze(NodeRef hold, Set nodeRefs) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - freeze(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#unFreeze(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public void unFreeze(NodeRef nodeRef) - { - List holds = getHoldService().heldBy(nodeRef, true); - for (NodeRef hold : holds) - { - getHoldService().removeFromHold(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#unFreeze(java.util.Set) - */ - @Override - @Deprecated - public void unFreeze(Set nodeRefs) - { - ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - unFreeze(nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#relinquish(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public void relinquish(NodeRef hold) - { - getHoldService().deleteHold(hold); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getReason(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Deprecated - public String getReason(NodeRef hold) - { - return getHoldService().getHoldReason(hold); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#updateReason(org.alfresco.service.cmr.repository.NodeRef, - * java.lang.String) - */ - @Override - @Deprecated - public void updateReason(NodeRef hold, String reason) - { - getHoldService().setHoldReason(hold, reason); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getHold(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Set getHolds(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - - return new HashSet(getHoldService().getHolds(filePlan)); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#hasFrozenChildren(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean hasFrozenChildren(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - boolean result = false; - - // check that we are dealing with a record folder - if (isRecordFolder(nodeRef)) - { - int heldCount = 0; - - if (nodeService.hasAspect(nodeRef, ASPECT_HELD_CHILDREN)) - { - heldCount = (Integer)getInternalNodeService().getProperty(nodeRef, PROP_HELD_CHILDREN_COUNT); - } - else - { - final TransactionService transactionService = (TransactionService)applicationContext.getBean("transactionService"); - - heldCount = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Integer doWork() - { - return transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Integer execute() throws Throwable - { - int heldCount = 0; - - // NOTE: this process remains to 'patch' older systems to improve performance next time around - List childAssocs = getInternalNodeService().getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, null); - if (childAssocs != null && !childAssocs.isEmpty()) - { - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef record = childAssociationRef.getChildRef(); - if (childAssociationRef.isPrimary() && isRecord(record) && isFrozen(record)) - { - heldCount ++; - } - } - } - - // add aspect and set count - Map props = new HashMap(1); - props.put(PROP_HELD_CHILDREN_COUNT, heldCount); - getInternalNodeService().addAspect(nodeRef, ASPECT_HELD_CHILDREN, props); - - return heldCount; - } - }, - false, true); - } - }); - } - - // true if more than one child held - result = (heldCount > 0); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeDate(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Date getFreezeDate(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (isFrozen(nodeRef)) - { - Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_AT); - if (property != null) { return (Date) property; } - } - - return null; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeInitiator(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String getFreezeInitiator(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (isFrozen(nodeRef)) - { - Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_BY); - if (property != null) { return (String) property; } - } - - return null; - } - - /** - * Helper Methods - */ - - /** - * Creates a hold using the given nodeRef and reason - * - * @param nodeRef the nodeRef which will be frozen - * @param reason the reason why the record will be frozen - * @return NodeRef of the created hold - */ - private NodeRef createHold(NodeRef nodeRef, String reason) - { - // get the hold container - final NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); - NodeRef holdContainer = getFilePlanService().getHoldContainer(filePlan); - - // calculate the hold name - int nextCount = getNextCount(holdContainer); - String holdName = I18NUtil.getMessage(MSG_HOLD_NAME) + " " + StringUtils.leftPad(Integer.toString(nextCount), 10, "0"); - - // create hold - return getHoldService().createHold(filePlan, holdName, reason, null); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.freeze; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Freeze Service Implementation + * + * @author Roy Wetherall + * @author Tuna Aksoy + * @since 2.1 + */ +public class FreezeServiceImpl extends ServiceBaseImpl + implements FreezeService, + RecordsManagementModel +{ + /** I18N */ + private static final String MSG_HOLD_NAME = "rm.hold.name"; + + /** File Plan Service */ + private FilePlanService filePlanService; + + /** Hold service */ + private HoldService holdService; + + /** + * @return File plan service + */ + protected FilePlanService getFilePlanService() + { + return this.filePlanService; + } + + /** + * @return Hold service + */ + protected HoldService getHoldService() + { + return this.holdService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param holdService hold service + */ + public void setHoldService(HoldService holdService) + { + this.holdService = holdService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#isFrozen(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean isFrozen(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + return nodeService.hasAspect(nodeRef, ASPECT_FROZEN); + } + + /** + * Deprecated Method Implementations + */ + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFrozen(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Deprecated + public Set getFrozen(NodeRef hold) + { + return new HashSet(getHoldService().getHeld(hold)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Deprecated + public NodeRef freeze(String reason, NodeRef nodeRef) + { + NodeRef hold = createHold(nodeRef, reason); + getHoldService().addToHold(hold, nodeRef); + return hold; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Deprecated + public void freeze(NodeRef hold, NodeRef nodeRef) + { + ParameterCheck.mandatory("hold", hold); + ParameterCheck.mandatory("nodeRef", nodeRef); + + getHoldService().addToHold(hold, nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String, + * java.util.Set) + */ + @Override + @Deprecated + public NodeRef freeze(String reason, Set nodeRefs) + { + NodeRef hold = null; + if (!nodeRefs.isEmpty()) + { + List list = new ArrayList(nodeRefs); + hold = createHold(list.get(0), reason); + getHoldService().addToHold(hold, list); + } + return hold; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef, + * java.util.Set) + */ + @Override + @Deprecated + public void freeze(NodeRef hold, Set nodeRefs) + { + ParameterCheck.mandatory("hold", hold); + ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); + + for (NodeRef nodeRef : nodeRefs) + { + freeze(hold, nodeRef); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#unFreeze(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Deprecated + public void unFreeze(NodeRef nodeRef) + { + List holds = getHoldService().heldBy(nodeRef, true); + for (NodeRef hold : holds) + { + getHoldService().removeFromHold(hold, nodeRef); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#unFreeze(java.util.Set) + */ + @Override + @Deprecated + public void unFreeze(Set nodeRefs) + { + ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); + + for (NodeRef nodeRef : nodeRefs) + { + unFreeze(nodeRef); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#relinquish(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Deprecated + public void relinquish(NodeRef hold) + { + getHoldService().deleteHold(hold); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getReason(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Deprecated + public String getReason(NodeRef hold) + { + return getHoldService().getHoldReason(hold); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#updateReason(org.alfresco.service.cmr.repository.NodeRef, + * java.lang.String) + */ + @Override + @Deprecated + public void updateReason(NodeRef hold, String reason) + { + getHoldService().setHoldReason(hold, reason); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getHold(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Set getHolds(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + + return new HashSet(getHoldService().getHolds(filePlan)); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#hasFrozenChildren(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean hasFrozenChildren(final NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + boolean result = false; + + // check that we are dealing with a record folder + if (isRecordFolder(nodeRef)) + { + int heldCount = 0; + + if (nodeService.hasAspect(nodeRef, ASPECT_HELD_CHILDREN)) + { + heldCount = (Integer)getInternalNodeService().getProperty(nodeRef, PROP_HELD_CHILDREN_COUNT); + } + else + { + final TransactionService transactionService = (TransactionService)applicationContext.getBean("transactionService"); + + heldCount = AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Integer doWork() + { + return transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() + { + public Integer execute() throws Throwable + { + int heldCount = 0; + + // NOTE: this process remains to 'patch' older systems to improve performance next time around + List childAssocs = getInternalNodeService().getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, null); + if (childAssocs != null && !childAssocs.isEmpty()) + { + for (ChildAssociationRef childAssociationRef : childAssocs) + { + NodeRef record = childAssociationRef.getChildRef(); + if (childAssociationRef.isPrimary() && isRecord(record) && isFrozen(record)) + { + heldCount ++; + } + } + } + + // add aspect and set count + Map props = new HashMap(1); + props.put(PROP_HELD_CHILDREN_COUNT, heldCount); + getInternalNodeService().addAspect(nodeRef, ASPECT_HELD_CHILDREN, props); + + return heldCount; + } + }, + false, true); + } + }); + } + + // true if more than one child held + result = (heldCount > 0); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeDate(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Date getFreezeDate(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + if (isFrozen(nodeRef)) + { + Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_AT); + if (property != null) { return (Date) property; } + } + + return null; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeInitiator(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public String getFreezeInitiator(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + if (isFrozen(nodeRef)) + { + Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_BY); + if (property != null) { return (String) property; } + } + + return null; + } + + /** + * Helper Methods + */ + + /** + * Creates a hold using the given nodeRef and reason + * + * @param nodeRef the nodeRef which will be frozen + * @param reason the reason why the record will be frozen + * @return NodeRef of the created hold + */ + private NodeRef createHold(NodeRef nodeRef, String reason) + { + // get the hold container + final NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); + NodeRef holdContainer = getFilePlanService().getHoldContainer(filePlan); + + // calculate the hold name + int nextCount = getNextCount(holdContainer); + String holdName = I18NUtil.getMessage(MSG_HOLD_NAME) + " " + StringUtils.leftPad(Integer.toString(nextCount), 10, "0"); + + // create hold + return getHoldService().createHold(filePlan, holdName, reason, null); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java index abdf523ebb..800836759a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java @@ -1,198 +1,198 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.hold; - -import java.util.List; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Hold service interface. - * - * @author Tuna Aksoy - * @since 2.2 - */ -@AlfrescoPublicApi -public interface HoldService -{ - /** - * Indicates whether the passed node reference is a hold. A hold is a container for a group of frozen object and contains the freeze - * reason. - * - * @param nodeRef hold node reference - * @return boolean true if hold, false otherwise - */ - boolean isHold(NodeRef nodeRef); - - /** - * Gets the list of all the holds within the holds container in the given file plan - * - * @param filePlan The {@link NodeRef} of the file plan - * @return List of hold node references - */ - List getHolds(NodeRef filePlan); - - /** - * Gets the node reference for the hold with the given name in the given file plan - * - * @param name {@link String} The name of the hold - * @return {@link NodeRef} of the hold with the given name - */ - NodeRef getHold(NodeRef filePlan, String name); - - /** - * Gets the list of all the holds within the holds container for the given node reference - * - * @param nodeRef The {@link NodeRef} of the record / record folder - * @param includedInHold true to retrieve the list of hold node references which will include the node reference - * false to get a list of node references which will not have the given node reference - * @return List of hold node references - */ - List heldBy(NodeRef nodeRef, boolean includedInHold); - - /** - * Gets the list of item node references which are in the given hold - * - * @param hold {@link NodeRef} of the hold - * @return Lost of item {@link NodeRef}s which are in the given hold - */ - List getHeld(NodeRef hold); - - /** - * Creates a hold with the given name, reason and description for the given file plan - * - * @param filePlan The {@link NodeRef} of the file plan - * @param name {@link String} The name of the hold - * @param reason {@link String} The reason of the hold - * @param description {@link String} The description of the hold - * @return The {@link NodeRef} of the created hold - */ - NodeRef createHold(NodeRef filePlan, String name, String reason, String description); - - /** - * Gets the hold reason for the given hold node reference - * - * @param hold The {@link NodeRef} of the hold - * @return {@link String} The reason of the hold - */ - String getHoldReason(NodeRef hold); - - /** - * Sets the hold reason - * - * @param hold The {@link NodeRef} of the hold - * @param reason {@link String} The reason for the hold - */ - void setHoldReason(NodeRef hold, String reason); - - /** - * Deletes the hold - * - * @param hold The {@link NodeRef} of the hold - */ - void deleteHold(NodeRef hold); - - /** - * Adds the record to the given hold - * - * @param hold The {@link NodeRef} of the hold - * @param nodeRef The {@link NodeRef} of the record / record folder which will be added to the given hold - */ - void addToHold(NodeRef hold, NodeRef nodeRef); - - /** - * Adds the items to the the given hold - * - * @param hold The {@link NodeRef} of the hold to which the items will be added - * @param nodeRefs The item {@link NodeRef}s which will be added to the hold - */ - void addToHold(NodeRef hold, List nodeRefs); - - /** - * Adds the record to the given list of holds - * - * @param holds The list of {@link NodeRef}s of the holds - * @param nodeRef The {@link NodeRef} of the record / record folder which will be added to the given holds - */ - void addToHolds(List holds, NodeRef nodeRef); - - /** - * Adds the given items to the given list of holds - * - * @param holds List of holds to which the given items will be added - * @param nodeRefs The list of items which will be added to the given holds - */ - void addToHolds(List holds, List nodeRefs); - - /** - * Removes the record from the given hold - * - * @param hold The {@link NodeRef} of the hold - * @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given hold - */ - void removeFromHold(NodeRef hold, NodeRef nodeRef); - - /** - * Removes the given items from the given hold - * - * @param hold The hold {@link NodeRef} from which the given items will be removed - * @param nodeRefs The list of items which will be removed from the given holds - */ - void removeFromHold(NodeRef hold, List nodeRefs); - - /** - * Removes the item from the given list of hold - * - * @param holds The list {@link NodeRef}s of the holds - * @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given holds - */ - void removeFromHolds(List holds, NodeRef nodeRef); - - /** - * Removes the items from the given holds - * - * @param holds List of hold {@link NodeRef}s from which the items will be removed - * @param nodeRefs List of item {@link NodeRef}s which will be removed from the given holds - */ - void removeFromHolds(List holds, List nodeRefs); - - /** - * Removes the given {@link NodeRef} from all the holds - * - * @param nodeRef The {@link NodeRef} of item which will be removed from all the holds - */ - void removeFromAllHolds(NodeRef nodeRef); - - /** - * Removes the given list of {@link NodeRef}s from all the holds - * - * @param nodeRefs The list of item {@link NodeRef}s which will be removed from all the holds - */ - void removeFromAllHolds(List nodeRefs); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.hold; + +import java.util.List; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Hold service interface. + * + * @author Tuna Aksoy + * @since 2.2 + */ +@AlfrescoPublicApi +public interface HoldService +{ + /** + * Indicates whether the passed node reference is a hold. A hold is a container for a group of frozen object and contains the freeze + * reason. + * + * @param nodeRef hold node reference + * @return boolean true if hold, false otherwise + */ + boolean isHold(NodeRef nodeRef); + + /** + * Gets the list of all the holds within the holds container in the given file plan + * + * @param filePlan The {@link NodeRef} of the file plan + * @return List of hold node references + */ + List getHolds(NodeRef filePlan); + + /** + * Gets the node reference for the hold with the given name in the given file plan + * + * @param name {@link String} The name of the hold + * @return {@link NodeRef} of the hold with the given name + */ + NodeRef getHold(NodeRef filePlan, String name); + + /** + * Gets the list of all the holds within the holds container for the given node reference + * + * @param nodeRef The {@link NodeRef} of the record / record folder + * @param includedInHold true to retrieve the list of hold node references which will include the node reference + * false to get a list of node references which will not have the given node reference + * @return List of hold node references + */ + List heldBy(NodeRef nodeRef, boolean includedInHold); + + /** + * Gets the list of item node references which are in the given hold + * + * @param hold {@link NodeRef} of the hold + * @return Lost of item {@link NodeRef}s which are in the given hold + */ + List getHeld(NodeRef hold); + + /** + * Creates a hold with the given name, reason and description for the given file plan + * + * @param filePlan The {@link NodeRef} of the file plan + * @param name {@link String} The name of the hold + * @param reason {@link String} The reason of the hold + * @param description {@link String} The description of the hold + * @return The {@link NodeRef} of the created hold + */ + NodeRef createHold(NodeRef filePlan, String name, String reason, String description); + + /** + * Gets the hold reason for the given hold node reference + * + * @param hold The {@link NodeRef} of the hold + * @return {@link String} The reason of the hold + */ + String getHoldReason(NodeRef hold); + + /** + * Sets the hold reason + * + * @param hold The {@link NodeRef} of the hold + * @param reason {@link String} The reason for the hold + */ + void setHoldReason(NodeRef hold, String reason); + + /** + * Deletes the hold + * + * @param hold The {@link NodeRef} of the hold + */ + void deleteHold(NodeRef hold); + + /** + * Adds the record to the given hold + * + * @param hold The {@link NodeRef} of the hold + * @param nodeRef The {@link NodeRef} of the record / record folder which will be added to the given hold + */ + void addToHold(NodeRef hold, NodeRef nodeRef); + + /** + * Adds the items to the the given hold + * + * @param hold The {@link NodeRef} of the hold to which the items will be added + * @param nodeRefs The item {@link NodeRef}s which will be added to the hold + */ + void addToHold(NodeRef hold, List nodeRefs); + + /** + * Adds the record to the given list of holds + * + * @param holds The list of {@link NodeRef}s of the holds + * @param nodeRef The {@link NodeRef} of the record / record folder which will be added to the given holds + */ + void addToHolds(List holds, NodeRef nodeRef); + + /** + * Adds the given items to the given list of holds + * + * @param holds List of holds to which the given items will be added + * @param nodeRefs The list of items which will be added to the given holds + */ + void addToHolds(List holds, List nodeRefs); + + /** + * Removes the record from the given hold + * + * @param hold The {@link NodeRef} of the hold + * @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given hold + */ + void removeFromHold(NodeRef hold, NodeRef nodeRef); + + /** + * Removes the given items from the given hold + * + * @param hold The hold {@link NodeRef} from which the given items will be removed + * @param nodeRefs The list of items which will be removed from the given holds + */ + void removeFromHold(NodeRef hold, List nodeRefs); + + /** + * Removes the item from the given list of hold + * + * @param holds The list {@link NodeRef}s of the holds + * @param nodeRef The {@link NodeRef} of the record / record folder which will be removed from the given holds + */ + void removeFromHolds(List holds, NodeRef nodeRef); + + /** + * Removes the items from the given holds + * + * @param holds List of hold {@link NodeRef}s from which the items will be removed + * @param nodeRefs List of item {@link NodeRef}s which will be removed from the given holds + */ + void removeFromHolds(List holds, List nodeRefs); + + /** + * Removes the given {@link NodeRef} from all the holds + * + * @param nodeRef The {@link NodeRef} of item which will be removed from all the holds + */ + void removeFromAllHolds(NodeRef nodeRef); + + /** + * Removes the given list of {@link NodeRef}s from all the holds + * + * @param nodeRefs The list of item {@link NodeRef}s which will be removed from all the holds + */ + void removeFromAllHolds(List nodeRefs); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java index 6224c5e4d1..5cd600edb7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java @@ -1,772 +1,772 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.hold; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.collections.ListUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Hold service implementation - * - * @author Tuna Aksoy - * @since 2.2 - */ -@BehaviourBean -public class HoldServiceImpl extends ServiceBaseImpl - implements HoldService, - NodeServicePolicies.BeforeDeleteNodePolicy, - RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(HoldServiceImpl.class); - - /** Audit event keys */ - private static final String AUDIT_ADD_TO_HOLD = "addToHold"; - private static final String AUDIT_REMOVE_FROM_HOLD = "removeFromHold"; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** Record Service */ - private RecordService recordService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Permission service */ - private PermissionService permissionService; - - /** records management audit service */ - private RecordsManagementAuditService recordsManagementAuditService; - - /** - * Set the file plan service - * - * @param filePlanService the file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Set the node service - * - * @param nodeService the node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the record service - * - * @param recordService the record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * Set the record folder service - * - * @param recordFolderService the record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * Set the permission service - * - * @param permissionService the permission services - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param recordsManagementAuditService records management audit service - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) - { - this.recordsManagementAuditService = recordsManagementAuditService; - } - - /** - * Initialise hold service - */ - public void init() - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - recordsManagementAuditService.registerAuditEvent(new AuditEvent(AUDIT_ADD_TO_HOLD, "capability.AddToHold.title")); - recordsManagementAuditService.registerAuditEvent(new AuditEvent(AUDIT_REMOVE_FROM_HOLD, "capability.RemoveFromHold.title")); - return null; - } - }); - } - - /** - * Behaviour unfreezes node's that will no longer he held after delete. - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Behaviour(kind=BehaviourKind.CLASS, type="rma:hold", notificationFrequency=NotificationFrequency.EVERY_EVENT) - @Override - public void beforeDeleteNode(final NodeRef hold) - { - if (nodeService.exists(hold) && isHold(hold)) - { - RunAsWork work = new RunAsWork() - { - @Override - public Void doWork() - { - List frozenNodes = getHeld(hold); - for (NodeRef frozenNode : frozenNodes) - { - removeFreezeAspect(frozenNode, 1); - } - - return null; - } - }; - - // run as system user - authenticationUtil.runAsSystem(work); - } - } - - /** - * Helper method removes the freeze aspect from the record and record folder if it is no longer - * in a hold. - * - * @param nodeRef - */ - private void removeFreezeAspect(NodeRef nodeRef, int index) - { - List otherHolds = heldBy(nodeRef, true); - if (otherHolds.size() == index) - { - if (nodeService.hasAspect(nodeRef, ASPECT_FROZEN)) - { - // remove the freeze aspect from the node - nodeService.removeAspect(nodeRef, ASPECT_FROZEN); - } - - if (isRecordFolder(nodeRef)) - { - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - if (nodeService.hasAspect(record, ASPECT_FROZEN)) - { - List recordsOtherHolds = heldBy(record, true); - if (recordsOtherHolds.size() == index) - { - // remove the freeze aspect from the node - nodeService.removeAspect(record, ASPECT_FROZEN); - } - } - } - } - } - - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHolds(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getHolds(NodeRef filePlan) - { - ParameterCheck.mandatory("filePlan", filePlan); - - List holds = new ArrayList(); - - // get the root hold container - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - - if (holdContainer != null) - { - // get the children of the root hold container - List holdsAssocs = nodeService.getChildAssocs(holdContainer, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef holdAssoc : holdsAssocs) - { - NodeRef hold = holdAssoc.getChildRef(); - if (isHold(hold)) - { - // add to list of holds - holds.add(hold); - } - } - } - - return holds; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#heldBy(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @SuppressWarnings("unchecked") - @Override - public List heldBy(NodeRef nodeRef, boolean includedInHold) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - List result = null; - - // get all the immediate parent holds - Set holdsNotIncludingNodeRef = getParentHolds(nodeRef); - - // check whether the record is held by vitue of it's record folder - if (isRecord(nodeRef)) - { - List recordFolders = recordFolderService.getRecordFolders(nodeRef); - for (NodeRef recordFolder : recordFolders) - { - holdsNotIncludingNodeRef.addAll(getParentHolds(recordFolder)); - } - } - - if (!includedInHold) - { - // invert list to get list of holds that do not contain this node - NodeRef filePlan = filePlanService.getFilePlan(nodeRef); - List allHolds = getHolds(filePlan); - result = ListUtils.subtract(allHolds, new ArrayList(holdsNotIncludingNodeRef)); - } - else - { - result = new ArrayList(holdsNotIncludingNodeRef); - } - - return result; - } - - /** - * Helper method to get holds that are direct parents of the given node. - * - * @param nodeRef node reference - * @return Set<{@link NodeRef}> set of parent holds - */ - private Set getParentHolds(NodeRef nodeRef) - { - List holdsAssocs = nodeService.getParentAssocs(nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - Set holds = new HashSet(holdsAssocs.size()); - for (ChildAssociationRef holdAssoc : holdsAssocs) - { - holds.add(holdAssoc.getParentRef()); - } - - return holds; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHold(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public NodeRef getHold(NodeRef filePlan, String name) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("name", name); - - // get the root hold container - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - - // get the hold by name - NodeRef hold = nodeService.getChildByName(holdContainer, ContentModel.ASSOC_CONTAINS, name); - if (hold != null && !isHold(hold)) - { - throw new AlfrescoRuntimeException("Can not get hold, because the named node reference isn't a hold."); - } - - return hold; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHeld(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getHeld(NodeRef hold) - { - ParameterCheck.mandatory("hold", hold); - List children = new ArrayList(); - - if (!isHold(hold)) - { - throw new AlfrescoRuntimeException("Can't get the node's held, because passed node reference isn't a hold. (hold=" + hold.toString() + ")"); - } - - List childAssocs = nodeService.getChildAssocs(hold, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); - if (childAssocs != null && !childAssocs.isEmpty()) - { - for (ChildAssociationRef childAssociationRef : childAssocs) - { - children.add(childAssociationRef.getChildRef()); - } - } - - return children; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#createHold(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.lang.String) - */ - @Override - public NodeRef createHold(NodeRef filePlan, String name, String reason, String description) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("reason", reason); - - // get the root hold container - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - - // create map of properties - Map properties = new HashMap(3); - properties.put(ContentModel.PROP_NAME, name); - properties.put(PROP_HOLD_REASON, reason); - if (description != null && !description.isEmpty()) - { - properties.put(ContentModel.PROP_DESCRIPTION, description); - } - - // create assoc name - QName assocName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name); - - // create hold - ChildAssociationRef childAssocRef = nodeService.createNode(holdContainer, ContentModel.ASSOC_CONTAINS, assocName, TYPE_HOLD, properties); - - return childAssocRef.getChildRef(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHoldReason(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String getHoldReason(NodeRef hold) - { - ParameterCheck.mandatory("hold", hold); - - String reason = null; - - if (nodeService.exists(hold) && isHold(hold)) - { - // get the reason - reason = (String)nodeService.getProperty(hold, PROP_HOLD_REASON); - } - - return reason; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#setHoldReason(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void setHoldReason(NodeRef hold, String reason) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("reason", reason); - - if (nodeService.exists(hold) && isHold(hold)) - { - nodeService.setProperty(hold, PROP_HOLD_REASON, reason); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#deleteHold(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void deleteHold(final NodeRef hold) - { - ParameterCheck.mandatory("hold", hold); - - if (!isHold(hold)) - { - throw new AlfrescoRuntimeException("Can't delete hold, becuase passed node is not a hold. (hold=" + hold.toString() + ")"); - } - - List held = AuthenticationUtil.runAsSystem(new RunAsWork>() - { - @Override - public List doWork() - { - return getHeld(hold); - } - }); - - List heldNames = new ArrayList(); - for (NodeRef nodeRef : held) - { - try - { - if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.DENIED) - { - heldNames.add((String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); - } - } - catch (AccessDeniedException ade) - { - throw new AlfrescoRuntimeException("Can't delete hold, because you don't have filling permissions on all the items held within the hold.", ade); - } - } - - if (heldNames.size() > 0) - { - StringBuilder sb = new StringBuilder(); - for (String name : heldNames) - { - sb.append("\n "); - sb.append("'"); - sb.append(name); - sb.append("'"); - } - throw new AlfrescoRuntimeException("Can't delete hold, because filing permissions for the following items are needed: " + sb.toString()); - } - - // delete the hold node - nodeService.deleteNode(hold); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void addToHold(NodeRef hold, NodeRef nodeRef) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRef", nodeRef); - - List holds = new ArrayList(1); - holds.add(hold); - addToHolds(Collections.unmodifiableList(holds), nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHold(org.alfresco.service.cmr.repository.NodeRef, java.util.List) - */ - @Override - public void addToHold(NodeRef hold, List nodeRefs) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - addToHold(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void addToHolds(final List holds, final NodeRef nodeRef) - { - ParameterCheck.mandatoryCollection("holds", holds); - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (!isRecord(nodeRef) && !isRecordFolder(nodeRef)) - { - String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - throw new AlfrescoRuntimeException("'" + nodeName + "' is neither a record nor a record folder. Only records or record folders can be added to a hold."); - } - - if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.DENIED) - { - String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - throw new AlfrescoRuntimeException("Filing permission on '" + nodeName + "' is needed."); - } - - for (final NodeRef hold : holds) - { - if (!isHold(hold)) - { - String holdName = (String) nodeService.getProperty(hold, ContentModel.PROP_NAME); - throw new AlfrescoRuntimeException("'" + holdName + "' is not a hold so record folders/records cannot be added."); - } - - if (permissionService.hasPermission(hold, RMPermissionModel.FILING) == AccessStatus.DENIED) - { - String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - String holdName = (String) nodeService.getProperty(hold, ContentModel.PROP_NAME); - throw new AlfrescoRuntimeException("'" + nodeName + "' can't be added to the hold container as filing permission for '" + holdName + "' is needed."); - } - - // check that the node isn't already in the hold - if (!getHeld(hold).contains(nodeRef)) - { - // run as system to ensure we have all the appropriate permissions to perform the manipulations we require - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // gather freeze properties - Map props = new HashMap(2); - props.put(PROP_FROZEN_AT, new Date()); - props.put(PROP_FROZEN_BY, AuthenticationUtil.getFullyAuthenticatedUser()); - - if (!nodeService.hasAspect(nodeRef, ASPECT_FROZEN)) - { - // add freeze aspect - nodeService.addAspect(nodeRef, ASPECT_FROZEN, props); - - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Frozen aspect applied to '").append(nodeRef).append("'."); - logger.debug(msg.toString()); - } - } - - // Link the record to the hold - nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - - // audit item being added to the hold - recordsManagementAuditService.auditEvent(nodeRef, AUDIT_ADD_TO_HOLD); - - // Mark all the folders contents as frozen - if (isRecordFolder(nodeRef)) - { - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - // no need to freeze if already frozen! - if (!nodeService.hasAspect(record, ASPECT_FROZEN)) - { - nodeService.addAspect(record, ASPECT_FROZEN, props); - - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Frozen aspect applied to '").append(record).append("'."); - logger.debug(msg.toString()); - } - } - } - } - - return null; - } - }); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, java.util.List) - */ - @Override - public void addToHolds(List holds, List nodeRefs) - { - ParameterCheck.mandatoryCollection("holds", holds); - ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - addToHolds(holds, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void removeFromHold(NodeRef hold, NodeRef nodeRef) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRef", nodeRef); - - List holds = new ArrayList(1); - holds.add(hold); - removeFromHolds(Collections.unmodifiableList(holds), nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHold(org.alfresco.service.cmr.repository.NodeRef, java.util.List) - */ - @Override - public void removeFromHold(NodeRef hold, List nodeRefs) - { - ParameterCheck.mandatory("hold", hold); - ParameterCheck.mandatory("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - removeFromHold(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHolds(java.util.List, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void removeFromHolds(List holds, final NodeRef nodeRef) - { - ParameterCheck.mandatory("holds", holds); - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (holds != null && !holds.isEmpty()) - { - for (final NodeRef hold : holds) - { - if (!instanceOf(hold, TYPE_HOLD)) - { - throw new AlfrescoRuntimeException("Can't remove from hold, because it isn't a hold. (hold=" + hold + ")"); - } - - if (getHeld(hold).contains(nodeRef)) - { - // run as system so we don't run into further permission issues - // we already know we have to have the correct capability to get here - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // remove from hold - nodeService.removeChild(hold, nodeRef); - - // audit that the node has been remove from the hold - // TODO add details of the hold that the node was removed from - recordsManagementAuditService.auditEvent(nodeRef, AUDIT_REMOVE_FROM_HOLD); - - return null; - } - }); - } - } - - // run as system as we can't be sure if have remove aspect rights on node - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - removeFreezeAspect(nodeRef, 0); - return null; - } - }); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHolds(java.util.List, java.util.List) - */ - @Override - public void removeFromHolds(List holds, List nodeRefs) - { - ParameterCheck.mandatoryCollection("holds", holds); - ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - removeFromHolds(holds, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromAllHolds(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void removeFromAllHolds(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // remove the node from all the holds it's held by - List holds = heldBy(nodeRef, true); - for (NodeRef hold : holds) - { - // remove node from hold - removeFromHold(hold, nodeRef); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromAllHolds(java.util.List) - */ - @Override - public void removeFromAllHolds(List nodeRefs) - { - ParameterCheck.mandatory("nodeRefs", nodeRefs); - - for (NodeRef nodeRef : nodeRefs) - { - removeFromAllHolds(nodeRef); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.hold; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.collections.ListUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Hold service implementation + * + * @author Tuna Aksoy + * @since 2.2 + */ +@BehaviourBean +public class HoldServiceImpl extends ServiceBaseImpl + implements HoldService, + NodeServicePolicies.BeforeDeleteNodePolicy, + RecordsManagementModel +{ + /** Logger */ + private static Log logger = LogFactory.getLog(HoldServiceImpl.class); + + /** Audit event keys */ + private static final String AUDIT_ADD_TO_HOLD = "addToHold"; + private static final String AUDIT_REMOVE_FROM_HOLD = "removeFromHold"; + + /** File Plan Service */ + private FilePlanService filePlanService; + + /** Record Service */ + private RecordService recordService; + + /** Record folder service */ + private RecordFolderService recordFolderService; + + /** Permission service */ + private PermissionService permissionService; + + /** records management audit service */ + private RecordsManagementAuditService recordsManagementAuditService; + + /** + * Set the file plan service + * + * @param filePlanService the file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Set the node service + * + * @param nodeService the node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set the record service + * + * @param recordService the record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * Set the record folder service + * + * @param recordFolderService the record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * Set the permission service + * + * @param permissionService the permission services + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param recordsManagementAuditService records management audit service + */ + public void setRecordsManagementAuditService(RecordsManagementAuditService recordsManagementAuditService) + { + this.recordsManagementAuditService = recordsManagementAuditService; + } + + /** + * Initialise hold service + */ + public void init() + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + recordsManagementAuditService.registerAuditEvent(new AuditEvent(AUDIT_ADD_TO_HOLD, "capability.AddToHold.title")); + recordsManagementAuditService.registerAuditEvent(new AuditEvent(AUDIT_REMOVE_FROM_HOLD, "capability.RemoveFromHold.title")); + return null; + } + }); + } + + /** + * Behaviour unfreezes node's that will no longer he held after delete. + * + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Behaviour(kind=BehaviourKind.CLASS, type="rma:hold", notificationFrequency=NotificationFrequency.EVERY_EVENT) + @Override + public void beforeDeleteNode(final NodeRef hold) + { + if (nodeService.exists(hold) && isHold(hold)) + { + RunAsWork work = new RunAsWork() + { + @Override + public Void doWork() + { + List frozenNodes = getHeld(hold); + for (NodeRef frozenNode : frozenNodes) + { + removeFreezeAspect(frozenNode, 1); + } + + return null; + } + }; + + // run as system user + authenticationUtil.runAsSystem(work); + } + } + + /** + * Helper method removes the freeze aspect from the record and record folder if it is no longer + * in a hold. + * + * @param nodeRef + */ + private void removeFreezeAspect(NodeRef nodeRef, int index) + { + List otherHolds = heldBy(nodeRef, true); + if (otherHolds.size() == index) + { + if (nodeService.hasAspect(nodeRef, ASPECT_FROZEN)) + { + // remove the freeze aspect from the node + nodeService.removeAspect(nodeRef, ASPECT_FROZEN); + } + + if (isRecordFolder(nodeRef)) + { + List records = recordService.getRecords(nodeRef); + for (NodeRef record : records) + { + if (nodeService.hasAspect(record, ASPECT_FROZEN)) + { + List recordsOtherHolds = heldBy(record, true); + if (recordsOtherHolds.size() == index) + { + // remove the freeze aspect from the node + nodeService.removeAspect(record, ASPECT_FROZEN); + } + } + } + } + } + + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHolds(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getHolds(NodeRef filePlan) + { + ParameterCheck.mandatory("filePlan", filePlan); + + List holds = new ArrayList(); + + // get the root hold container + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + + if (holdContainer != null) + { + // get the children of the root hold container + List holdsAssocs = nodeService.getChildAssocs(holdContainer, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef holdAssoc : holdsAssocs) + { + NodeRef hold = holdAssoc.getChildRef(); + if (isHold(hold)) + { + // add to list of holds + holds.add(hold); + } + } + } + + return holds; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#heldBy(org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + @SuppressWarnings("unchecked") + @Override + public List heldBy(NodeRef nodeRef, boolean includedInHold) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + List result = null; + + // get all the immediate parent holds + Set holdsNotIncludingNodeRef = getParentHolds(nodeRef); + + // check whether the record is held by vitue of it's record folder + if (isRecord(nodeRef)) + { + List recordFolders = recordFolderService.getRecordFolders(nodeRef); + for (NodeRef recordFolder : recordFolders) + { + holdsNotIncludingNodeRef.addAll(getParentHolds(recordFolder)); + } + } + + if (!includedInHold) + { + // invert list to get list of holds that do not contain this node + NodeRef filePlan = filePlanService.getFilePlan(nodeRef); + List allHolds = getHolds(filePlan); + result = ListUtils.subtract(allHolds, new ArrayList(holdsNotIncludingNodeRef)); + } + else + { + result = new ArrayList(holdsNotIncludingNodeRef); + } + + return result; + } + + /** + * Helper method to get holds that are direct parents of the given node. + * + * @param nodeRef node reference + * @return Set<{@link NodeRef}> set of parent holds + */ + private Set getParentHolds(NodeRef nodeRef) + { + List holdsAssocs = nodeService.getParentAssocs(nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + Set holds = new HashSet(holdsAssocs.size()); + for (ChildAssociationRef holdAssoc : holdsAssocs) + { + holds.add(holdAssoc.getParentRef()); + } + + return holds; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHold(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public NodeRef getHold(NodeRef filePlan, String name) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("name", name); + + // get the root hold container + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + + // get the hold by name + NodeRef hold = nodeService.getChildByName(holdContainer, ContentModel.ASSOC_CONTAINS, name); + if (hold != null && !isHold(hold)) + { + throw new AlfrescoRuntimeException("Can not get hold, because the named node reference isn't a hold."); + } + + return hold; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHeld(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getHeld(NodeRef hold) + { + ParameterCheck.mandatory("hold", hold); + List children = new ArrayList(); + + if (!isHold(hold)) + { + throw new AlfrescoRuntimeException("Can't get the node's held, because passed node reference isn't a hold. (hold=" + hold.toString() + ")"); + } + + List childAssocs = nodeService.getChildAssocs(hold, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); + if (childAssocs != null && !childAssocs.isEmpty()) + { + for (ChildAssociationRef childAssociationRef : childAssocs) + { + children.add(childAssociationRef.getChildRef()); + } + } + + return children; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#createHold(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public NodeRef createHold(NodeRef filePlan, String name, String reason, String description) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("name", name); + ParameterCheck.mandatory("reason", reason); + + // get the root hold container + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + + // create map of properties + Map properties = new HashMap(3); + properties.put(ContentModel.PROP_NAME, name); + properties.put(PROP_HOLD_REASON, reason); + if (description != null && !description.isEmpty()) + { + properties.put(ContentModel.PROP_DESCRIPTION, description); + } + + // create assoc name + QName assocName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name); + + // create hold + ChildAssociationRef childAssocRef = nodeService.createNode(holdContainer, ContentModel.ASSOC_CONTAINS, assocName, TYPE_HOLD, properties); + + return childAssocRef.getChildRef(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#getHoldReason(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public String getHoldReason(NodeRef hold) + { + ParameterCheck.mandatory("hold", hold); + + String reason = null; + + if (nodeService.exists(hold) && isHold(hold)) + { + // get the reason + reason = (String)nodeService.getProperty(hold, PROP_HOLD_REASON); + } + + return reason; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#setHoldReason(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public void setHoldReason(NodeRef hold, String reason) + { + ParameterCheck.mandatory("hold", hold); + ParameterCheck.mandatory("reason", reason); + + if (nodeService.exists(hold) && isHold(hold)) + { + nodeService.setProperty(hold, PROP_HOLD_REASON, reason); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#deleteHold(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void deleteHold(final NodeRef hold) + { + ParameterCheck.mandatory("hold", hold); + + if (!isHold(hold)) + { + throw new AlfrescoRuntimeException("Can't delete hold, becuase passed node is not a hold. (hold=" + hold.toString() + ")"); + } + + List held = AuthenticationUtil.runAsSystem(new RunAsWork>() + { + @Override + public List doWork() + { + return getHeld(hold); + } + }); + + List heldNames = new ArrayList(); + for (NodeRef nodeRef : held) + { + try + { + if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.DENIED) + { + heldNames.add((String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); + } + } + catch (AccessDeniedException ade) + { + throw new AlfrescoRuntimeException("Can't delete hold, because you don't have filling permissions on all the items held within the hold.", ade); + } + } + + if (heldNames.size() > 0) + { + StringBuilder sb = new StringBuilder(); + for (String name : heldNames) + { + sb.append("\n "); + sb.append("'"); + sb.append(name); + sb.append("'"); + } + throw new AlfrescoRuntimeException("Can't delete hold, because filing permissions for the following items are needed: " + sb.toString()); + } + + // delete the hold node + nodeService.deleteNode(hold); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void addToHold(NodeRef hold, NodeRef nodeRef) + { + ParameterCheck.mandatory("hold", hold); + ParameterCheck.mandatory("nodeRef", nodeRef); + + List holds = new ArrayList(1); + holds.add(hold); + addToHolds(Collections.unmodifiableList(holds), nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHold(org.alfresco.service.cmr.repository.NodeRef, java.util.List) + */ + @Override + public void addToHold(NodeRef hold, List nodeRefs) + { + ParameterCheck.mandatory("hold", hold); + ParameterCheck.mandatory("nodeRefs", nodeRefs); + + for (NodeRef nodeRef : nodeRefs) + { + addToHold(hold, nodeRef); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void addToHolds(final List holds, final NodeRef nodeRef) + { + ParameterCheck.mandatoryCollection("holds", holds); + ParameterCheck.mandatory("nodeRef", nodeRef); + + if (!isRecord(nodeRef) && !isRecordFolder(nodeRef)) + { + String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); + throw new AlfrescoRuntimeException("'" + nodeName + "' is neither a record nor a record folder. Only records or record folders can be added to a hold."); + } + + if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.DENIED) + { + String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); + throw new AlfrescoRuntimeException("Filing permission on '" + nodeName + "' is needed."); + } + + for (final NodeRef hold : holds) + { + if (!isHold(hold)) + { + String holdName = (String) nodeService.getProperty(hold, ContentModel.PROP_NAME); + throw new AlfrescoRuntimeException("'" + holdName + "' is not a hold so record folders/records cannot be added."); + } + + if (permissionService.hasPermission(hold, RMPermissionModel.FILING) == AccessStatus.DENIED) + { + String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); + String holdName = (String) nodeService.getProperty(hold, ContentModel.PROP_NAME); + throw new AlfrescoRuntimeException("'" + nodeName + "' can't be added to the hold container as filing permission for '" + holdName + "' is needed."); + } + + // check that the node isn't already in the hold + if (!getHeld(hold).contains(nodeRef)) + { + // run as system to ensure we have all the appropriate permissions to perform the manipulations we require + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // gather freeze properties + Map props = new HashMap(2); + props.put(PROP_FROZEN_AT, new Date()); + props.put(PROP_FROZEN_BY, AuthenticationUtil.getFullyAuthenticatedUser()); + + if (!nodeService.hasAspect(nodeRef, ASPECT_FROZEN)) + { + // add freeze aspect + nodeService.addAspect(nodeRef, ASPECT_FROZEN, props); + + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Frozen aspect applied to '").append(nodeRef).append("'."); + logger.debug(msg.toString()); + } + } + + // Link the record to the hold + nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + + // audit item being added to the hold + recordsManagementAuditService.auditEvent(nodeRef, AUDIT_ADD_TO_HOLD); + + // Mark all the folders contents as frozen + if (isRecordFolder(nodeRef)) + { + List records = recordService.getRecords(nodeRef); + for (NodeRef record : records) + { + // no need to freeze if already frozen! + if (!nodeService.hasAspect(record, ASPECT_FROZEN)) + { + nodeService.addAspect(record, ASPECT_FROZEN, props); + + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Frozen aspect applied to '").append(record).append("'."); + logger.debug(msg.toString()); + } + } + } + } + + return null; + } + }); + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, java.util.List) + */ + @Override + public void addToHolds(List holds, List nodeRefs) + { + ParameterCheck.mandatoryCollection("holds", holds); + ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); + + for (NodeRef nodeRef : nodeRefs) + { + addToHolds(holds, nodeRef); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHold(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void removeFromHold(NodeRef hold, NodeRef nodeRef) + { + ParameterCheck.mandatory("hold", hold); + ParameterCheck.mandatory("nodeRef", nodeRef); + + List holds = new ArrayList(1); + holds.add(hold); + removeFromHolds(Collections.unmodifiableList(holds), nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHold(org.alfresco.service.cmr.repository.NodeRef, java.util.List) + */ + @Override + public void removeFromHold(NodeRef hold, List nodeRefs) + { + ParameterCheck.mandatory("hold", hold); + ParameterCheck.mandatory("nodeRefs", nodeRefs); + + for (NodeRef nodeRef : nodeRefs) + { + removeFromHold(hold, nodeRef); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHolds(java.util.List, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void removeFromHolds(List holds, final NodeRef nodeRef) + { + ParameterCheck.mandatory("holds", holds); + ParameterCheck.mandatory("nodeRef", nodeRef); + + if (holds != null && !holds.isEmpty()) + { + for (final NodeRef hold : holds) + { + if (!instanceOf(hold, TYPE_HOLD)) + { + throw new AlfrescoRuntimeException("Can't remove from hold, because it isn't a hold. (hold=" + hold + ")"); + } + + if (getHeld(hold).contains(nodeRef)) + { + // run as system so we don't run into further permission issues + // we already know we have to have the correct capability to get here + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // remove from hold + nodeService.removeChild(hold, nodeRef); + + // audit that the node has been remove from the hold + // TODO add details of the hold that the node was removed from + recordsManagementAuditService.auditEvent(nodeRef, AUDIT_REMOVE_FROM_HOLD); + + return null; + } + }); + } + } + + // run as system as we can't be sure if have remove aspect rights on node + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + removeFreezeAspect(nodeRef, 0); + return null; + } + }); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromHolds(java.util.List, java.util.List) + */ + @Override + public void removeFromHolds(List holds, List nodeRefs) + { + ParameterCheck.mandatoryCollection("holds", holds); + ParameterCheck.mandatoryCollection("nodeRefs", nodeRefs); + + for (NodeRef nodeRef : nodeRefs) + { + removeFromHolds(holds, nodeRef); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromAllHolds(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void removeFromAllHolds(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + // remove the node from all the holds it's held by + List holds = heldBy(nodeRef, true); + for (NodeRef hold : holds) + { + // remove node from hold + removeFromHold(hold, nodeRef); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#removeFromAllHolds(java.util.List) + */ + @Override + public void removeFromAllHolds(List nodeRefs) + { + ParameterCheck.mandatory("nodeRefs", nodeRefs); + + for (NodeRef nodeRef : nodeRefs) + { + removeFromAllHolds(nodeRef); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/BasicIdentifierGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/BasicIdentifierGenerator.java index f37eb79886..9b2c28f856 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/BasicIdentifierGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/BasicIdentifierGenerator.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.identifier; - -import java.io.Serializable; -import java.util.Calendar; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Basic identifier generator implementation. - * - * @author Roy Wetherall - */ -public class BasicIdentifierGenerator extends IdentifierGeneratorBase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator#generateId(java.util.Map) - */ - @Override - public String generateId(Map context) - { - NodeRef nodeRef = (NodeRef)context.get(IdentifierService.CONTEXT_NODEREF); - Long dbId = 0l; - if (nodeRef != null) - { - dbId = (Long)nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID); - } - else - { - dbId = System.currentTimeMillis(); - } - - Calendar fileCalendar = Calendar.getInstance(); - String year = Integer.toString(fileCalendar.get(Calendar.YEAR)); - return year + "-" + padString(dbId.toString(), 10); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.identifier; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Basic identifier generator implementation. + * + * @author Roy Wetherall + */ +public class BasicIdentifierGenerator extends IdentifierGeneratorBase +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator#generateId(java.util.Map) + */ + @Override + public String generateId(Map context) + { + NodeRef nodeRef = (NodeRef)context.get(IdentifierService.CONTEXT_NODEREF); + Long dbId = 0l; + if (nodeRef != null) + { + dbId = (Long)nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID); + } + else + { + dbId = System.currentTimeMillis(); + } + + Calendar fileCalendar = Calendar.getInstance(); + String year = Integer.toString(fileCalendar.get(Calendar.YEAR)); + return year + "-" + padString(dbId.toString(), 10); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGenerator.java index 79194fb16e..8d73729dff 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGenerator.java @@ -1,56 +1,56 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.identifier; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.namespace.QName; - -/** - * Generates an identifier for a content type from a given context. - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface IdentifierGenerator -{ - /** - * The content type this generator is applicible to. - * @return QName the type - */ - QName getType(); - - /** - * Generates the next id based on the provided context. - * @param context map of context values - * @return String the next id - */ - String generateId(Map context); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.identifier; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.namespace.QName; + +/** + * Generates an identifier for a content type from a given context. + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface IdentifierGenerator +{ + /** + * The content type this generator is applicible to. + * @return QName the type + */ + QName getType(); + + /** + * Generates the next id based on the provided context. + * @param context map of context values + * @return String the next id + */ + String generateId(Map context); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java index a7e34146b7..0ac128e752 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierGeneratorBase.java @@ -1,112 +1,112 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.identifier; - -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - */ -public abstract class IdentifierGeneratorBase implements IdentifierGenerator -{ - /** Identifier service */ - private IdentifierService identifierService; - - /** Node service */ - protected NodeService nodeService; - - /** Content type */ - private QName type; - - /** - * Initialisation method - */ - public void init() - { - identifierService.register(this); - } - - /** - * Set identifier service. - * - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * Set the node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set type. - * - * @param type content type - */ - public void setTypeAsString(String type) - { - this.type = QName.createQName(type); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator#getType() - */ - @Override - public QName getType() - { - return type; - } - - /** - * Function to pad a string with zero '0' characters to the required length - * - * @param s String to pad with leading zero '0' characters - * @param len Length to pad to - * @return padded string or the original if already at >=len characters - */ - protected String padString(String s, int len) - { - String result = s; - - for (int i = 0; i < (len - s.length()); i++) - { - result = "0" + result; - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.identifier; + +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; + +/** + * @author Roy Wetherall + */ +public abstract class IdentifierGeneratorBase implements IdentifierGenerator +{ + /** Identifier service */ + private IdentifierService identifierService; + + /** Node service */ + protected NodeService nodeService; + + /** Content type */ + private QName type; + + /** + * Initialisation method + */ + public void init() + { + identifierService.register(this); + } + + /** + * Set identifier service. + * + * @param identifierService identifier service + */ + public void setIdentifierService(IdentifierService identifierService) + { + this.identifierService = identifierService; + } + + /** + * Set the node service + * + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set type. + * + * @param type content type + */ + public void setTypeAsString(String type) + { + this.type = QName.createQName(type); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator#getType() + */ + @Override + public QName getType() + { + return type; + } + + /** + * Function to pad a string with zero '0' characters to the required length + * + * @param s String to pad with leading zero '0' characters + * @param len Length to pad to + * @return padded string or the original if already at >=len characters + */ + protected String padString(String s, int len) + { + String result = s; + + for (int i = 0; i < (len - s.length()); i++) + { + result = "0" + result; + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierService.java index a66c897c97..f4b7ad21df 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierService.java @@ -1,70 +1,70 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.identifier; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Records management identifier service - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface IdentifierService -{ - /** Context value names */ - String CONTEXT_NODEREF = "noderef"; - String CONTEXT_PARENT_NODEREF = "parentndoeref"; - String CONTEXT_ORIG_TYPE = "origionaltype"; - - /** - * Register an identifier generator implementation with the service. - * - * @param identifierGenerator identifier generator implementation - */ - void register(IdentifierGenerator identifierGenerator); - - /** - * Generate an identifier for a node with the given type and parent. - * - * @param type type of the node - * @param parent parent of the ndoe - * @return String generated identifier - */ - String generateIdentifier(QName type, NodeRef parent); - - /** - * Generate an identifier for the given node. - * - * @param nodeRef node reference - * @return String generated identifier - */ - String generateIdentifier(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.identifier; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Records management identifier service + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface IdentifierService +{ + /** Context value names */ + String CONTEXT_NODEREF = "noderef"; + String CONTEXT_PARENT_NODEREF = "parentndoeref"; + String CONTEXT_ORIG_TYPE = "origionaltype"; + + /** + * Register an identifier generator implementation with the service. + * + * @param identifierGenerator identifier generator implementation + */ + void register(IdentifierGenerator identifierGenerator); + + /** + * Generate an identifier for a node with the given type and parent. + * + * @param type type of the node + * @param parent parent of the ndoe + * @return String generated identifier + */ + String generateIdentifier(QName type, NodeRef parent); + + /** + * Generate an identifier for the given node. + * + * @param nodeRef node reference + * @return String generated identifier + */ + String generateIdentifier(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java index 9ac6223f59..640d773efa 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java @@ -1,205 +1,205 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.identifier; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author Roy Wetherall - */ -public class IdentifierServiceImpl implements IdentifierService -{ - /** Logger */ - private static Log logger = LogFactory.getLog(IdentifierServiceImpl.class); - - /** Registry map */ - private Map register = new HashMap(5); - - /** Node service */ - private NodeService nodeService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** - * Set the node service - * - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the dictionary service - * - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#generateIdentifier(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String generateIdentifier(QName type, NodeRef parent) - { - ParameterCheck.mandatory("type", type); - - // Build the context - Map context = new HashMap(2); - if (parent != null) - { - context.put(CONTEXT_PARENT_NODEREF, parent); - } - context.put(CONTEXT_ORIG_TYPE, type); - - // Generate the id - return generateIdentifier(type, context); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#generateIdentifier(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String generateIdentifier(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Map context = new HashMap(3); - - // Set the original type - QName type = nodeService.getType(nodeRef); - context.put(CONTEXT_ORIG_TYPE, type); - - // Set the parent reference - ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); - if (assocRef != null && assocRef.getParentRef() != null) - { - context.put(CONTEXT_PARENT_NODEREF, assocRef.getParentRef()); - } - - // Set the node reference - context.put(CONTEXT_NODEREF, nodeRef); - - // Generate the identifier - return generateIdentifier(type, context); - - } - - /** - * Generate an identifier for a given type of object with the accompanying context. - * - * @param type content type - * @param context context - * @return String identifier - */ - private String generateIdentifier(QName type, Map context) - { - ParameterCheck.mandatory("type", type); - ParameterCheck.mandatory("context", context); - - // Get the identifier generator - IdentifierGenerator idGen = lookupGenerator(type); - if (idGen == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Unable to generate id for object of type " + type.toString() + ", because no identifier generator was found."); - } - throw new AlfrescoRuntimeException("Unable to generate id for object of type " + type.toString() + ", because no identifier generator was found."); - } - - // Generate the identifier - return idGen.generateId(context); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#register(org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator) - */ - public void register(IdentifierGenerator idGen) - { - register.put(idGen.getType(), idGen); - } - - /** - * - * @param type content type (could be aspect or type) - * @return - */ - private IdentifierGenerator lookupGenerator(QName type) - { - ParameterCheck.mandatory("type", type); - - if (logger.isDebugEnabled()) - { - logger.debug("Looking for idGenerator for type " + type.toString()); - } - - // Look for the generator related to the type - IdentifierGenerator result = register.get(type); - if (result == null) - { - // Check the parent type - ClassDefinition typeDef = dictionaryService.getClass(type); - if (typeDef != null) - { - QName parentType = typeDef.getParentName(); - if (parentType != null) - { - // Recurse to find parent type generator - result = lookupGenerator(parentType); - } - } - else - { - if (logger.isDebugEnabled()) - { - logger.debug("Unable to find type definition for " + type.toString() + " when generating identifier."); - } - } - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.identifier; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.service.cmr.dictionary.ClassDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Roy Wetherall + */ +public class IdentifierServiceImpl implements IdentifierService +{ + /** Logger */ + private static Log logger = LogFactory.getLog(IdentifierServiceImpl.class); + + /** Registry map */ + private Map register = new HashMap(5); + + /** Node service */ + private NodeService nodeService; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** + * Set the node service + * + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set the dictionary service + * + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#generateIdentifier(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public String generateIdentifier(QName type, NodeRef parent) + { + ParameterCheck.mandatory("type", type); + + // Build the context + Map context = new HashMap(2); + if (parent != null) + { + context.put(CONTEXT_PARENT_NODEREF, parent); + } + context.put(CONTEXT_ORIG_TYPE, type); + + // Generate the id + return generateIdentifier(type, context); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#generateIdentifier(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public String generateIdentifier(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + Map context = new HashMap(3); + + // Set the original type + QName type = nodeService.getType(nodeRef); + context.put(CONTEXT_ORIG_TYPE, type); + + // Set the parent reference + ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); + if (assocRef != null && assocRef.getParentRef() != null) + { + context.put(CONTEXT_PARENT_NODEREF, assocRef.getParentRef()); + } + + // Set the node reference + context.put(CONTEXT_NODEREF, nodeRef); + + // Generate the identifier + return generateIdentifier(type, context); + + } + + /** + * Generate an identifier for a given type of object with the accompanying context. + * + * @param type content type + * @param context context + * @return String identifier + */ + private String generateIdentifier(QName type, Map context) + { + ParameterCheck.mandatory("type", type); + ParameterCheck.mandatory("context", context); + + // Get the identifier generator + IdentifierGenerator idGen = lookupGenerator(type); + if (idGen == null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Unable to generate id for object of type " + type.toString() + ", because no identifier generator was found."); + } + throw new AlfrescoRuntimeException("Unable to generate id for object of type " + type.toString() + ", because no identifier generator was found."); + } + + // Generate the identifier + return idGen.generateId(context); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#register(org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierGenerator) + */ + public void register(IdentifierGenerator idGen) + { + register.put(idGen.getType(), idGen); + } + + /** + * + * @param type content type (could be aspect or type) + * @return + */ + private IdentifierGenerator lookupGenerator(QName type) + { + ParameterCheck.mandatory("type", type); + + if (logger.isDebugEnabled()) + { + logger.debug("Looking for idGenerator for type " + type.toString()); + } + + // Look for the generator related to the type + IdentifierGenerator result = register.get(type); + if (result == null) + { + // Check the parent type + ClassDefinition typeDef = dictionaryService.getClass(type); + if (typeDef != null) + { + QName parentType = typeDef.getParentName(); + if (parentType != null) + { + // Recurse to find parent type generator + result = lookupGenerator(parentType); + } + } + else + { + if (logger.isDebugEnabled()) + { + logger.debug("Unable to find type definition for " + type.toString() + " when generating identifier."); + } + } + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java index 8a972fba52..ffe1591614 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java @@ -1,253 +1,253 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.PersonService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * The Disposition Lifecycle Job Finds all disposition action nodes which are for disposition actions specified Where - * asOf > now OR dispositionEventsEligible = true; Runs the cut off or retain action for eligible records. - * - * @author mrogers - * @author Roy Wetherall - */ -public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecuter -{ - /** logger */ - private static Log logger = LogFactory.getLog(DispositionLifecycleJobExecuter.class); - - /** list of disposition actions to automatically execute */ - private List dispositionActions; - - /** query string */ - private String query; - - /** records management action service */ - private RecordsManagementActionService recordsManagementActionService; - - /** node service */ - private NodeService nodeService; - - /** search service */ - private SearchService searchService; - - /** person service */ - private PersonService personService; - - /** - * List of disposition actions to automatically execute when eligible. - * - * @param dispositionActions disposition actions - */ - public void setDispositionActions(List dispositionActions) - { - this.dispositionActions = dispositionActions; - } - - /** - * @param recordsManagementActionService records management action service - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param searchService search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * Get the search query string. - * - * @return job query string - */ - protected String getQuery() - { - if (query == null) - { - StringBuilder sb = new StringBuilder(); - - sb.append("TYPE:\"rma:dispositionAction\" + "); - sb.append("(@rma\\:dispositionAction:("); - - boolean bFirst = true; - for (String dispositionAction : dispositionActions) - { - if (bFirst) - { - bFirst = false; - } - else - { - sb.append(" OR "); - } - - sb.append("\"").append(dispositionAction).append("\""); - } - - sb.append("))"); - sb.append(" AND ISUNSET:\"rma:dispositionActionCompletedAt\" "); - sb.append(" AND ( "); - sb.append("@rma\\:dispositionEventsEligible:true "); - sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] "); - sb.append(") "); - - query = sb.toString(); - } - - return query; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute() - */ - public void executeImpl() - { - try - { - logger.debug("Job Starting"); - - if (dispositionActions != null && !dispositionActions.isEmpty()) - { - // execute search - ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, - SearchService.LANGUAGE_FTS_ALFRESCO, getQuery()); - List resultNodes = results.getNodeRefs(); - results.close(); - - if (logger.isDebugEnabled()) - { - logger.debug("Processing " + resultNodes.size() + " nodes"); - } - - // process search results - for (NodeRef node : resultNodes) - { - final NodeRef currentNode = node; - - RetryingTransactionCallback processTranCB = new RetryingTransactionCallback() - { - public Boolean execute() - { - final String dispAction = (String) nodeService.getProperty(currentNode, - RecordsManagementModel.PROP_DISPOSITION_ACTION); - - // Run disposition action - if (dispAction != null && dispositionActions.contains(dispAction)) - { - ChildAssociationRef parent = nodeService.getPrimaryParent(currentNode); - if (parent.getTypeQName().equals(RecordsManagementModel.ASSOC_NEXT_DISPOSITION_ACTION)) - { - Map props = new HashMap(1); - props.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, - Boolean.FALSE); - - try - { - // execute disposition action - recordsManagementActionService.executeRecordsManagementAction( - parent.getParentRef(), dispAction, props); - - if (logger.isDebugEnabled()) - { - logger.debug("Processed action: " + dispAction + "on" + parent); - } - } - catch (AlfrescoRuntimeException exception) - { - if (logger.isDebugEnabled()) - { - logger.debug(exception); - } - } - } - } - - return Boolean.TRUE; - } - }; - - // if exists - if (nodeService.exists(currentNode)) - { - retryingTransactionHelper.doInTransaction(processTranCB); - } - } - } - - logger.debug("Job Finished"); - } - catch (AlfrescoRuntimeException exception) - { - if (logger.isDebugEnabled()) - { - logger.debug(exception); - } - } - } - - public PersonService getPersonService() - { - return personService; - } - - public void setPersonService(PersonService personService) - { - this.personService = personService; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.PersonService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * The Disposition Lifecycle Job Finds all disposition action nodes which are for disposition actions specified Where + * asOf > now OR dispositionEventsEligible = true; Runs the cut off or retain action for eligible records. + * + * @author mrogers + * @author Roy Wetherall + */ +public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecuter +{ + /** logger */ + private static Log logger = LogFactory.getLog(DispositionLifecycleJobExecuter.class); + + /** list of disposition actions to automatically execute */ + private List dispositionActions; + + /** query string */ + private String query; + + /** records management action service */ + private RecordsManagementActionService recordsManagementActionService; + + /** node service */ + private NodeService nodeService; + + /** search service */ + private SearchService searchService; + + /** person service */ + private PersonService personService; + + /** + * List of disposition actions to automatically execute when eligible. + * + * @param dispositionActions disposition actions + */ + public void setDispositionActions(List dispositionActions) + { + this.dispositionActions = dispositionActions; + } + + /** + * @param recordsManagementActionService records management action service + */ + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param searchService search service + */ + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + /** + * Get the search query string. + * + * @return job query string + */ + protected String getQuery() + { + if (query == null) + { + StringBuilder sb = new StringBuilder(); + + sb.append("TYPE:\"rma:dispositionAction\" + "); + sb.append("(@rma\\:dispositionAction:("); + + boolean bFirst = true; + for (String dispositionAction : dispositionActions) + { + if (bFirst) + { + bFirst = false; + } + else + { + sb.append(" OR "); + } + + sb.append("\"").append(dispositionAction).append("\""); + } + + sb.append("))"); + sb.append(" AND ISUNSET:\"rma:dispositionActionCompletedAt\" "); + sb.append(" AND ( "); + sb.append("@rma\\:dispositionEventsEligible:true "); + sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] "); + sb.append(") "); + + query = sb.toString(); + } + + return query; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute() + */ + public void executeImpl() + { + try + { + logger.debug("Job Starting"); + + if (dispositionActions != null && !dispositionActions.isEmpty()) + { + // execute search + ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, + SearchService.LANGUAGE_FTS_ALFRESCO, getQuery()); + List resultNodes = results.getNodeRefs(); + results.close(); + + if (logger.isDebugEnabled()) + { + logger.debug("Processing " + resultNodes.size() + " nodes"); + } + + // process search results + for (NodeRef node : resultNodes) + { + final NodeRef currentNode = node; + + RetryingTransactionCallback processTranCB = new RetryingTransactionCallback() + { + public Boolean execute() + { + final String dispAction = (String) nodeService.getProperty(currentNode, + RecordsManagementModel.PROP_DISPOSITION_ACTION); + + // Run disposition action + if (dispAction != null && dispositionActions.contains(dispAction)) + { + ChildAssociationRef parent = nodeService.getPrimaryParent(currentNode); + if (parent.getTypeQName().equals(RecordsManagementModel.ASSOC_NEXT_DISPOSITION_ACTION)) + { + Map props = new HashMap(1); + props.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, + Boolean.FALSE); + + try + { + // execute disposition action + recordsManagementActionService.executeRecordsManagementAction( + parent.getParentRef(), dispAction, props); + + if (logger.isDebugEnabled()) + { + logger.debug("Processed action: " + dispAction + "on" + parent); + } + } + catch (AlfrescoRuntimeException exception) + { + if (logger.isDebugEnabled()) + { + logger.debug(exception); + } + } + } + } + + return Boolean.TRUE; + } + }; + + // if exists + if (nodeService.exists(currentNode)) + { + retryingTransactionHelper.doInTransaction(processTranCB); + } + } + } + + logger.debug("Job Finished"); + } + catch (AlfrescoRuntimeException exception) + { + if (logger.isDebugEnabled()) + { + logger.debug(exception); + } + } + } + + public PersonService getPersonService() + { + return personService; + } + + public void setPersonService(PersonService personService) + { + this.personService = personService; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java index b27fd17076..4a7ad4b735 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java @@ -1,162 +1,162 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * This job finds all Vital Records which are due for review, optionally - * excluding those for which notification has already been issued. - * - * @author Neil McErlean - */ -public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJobExecuter -{ - private static Log logger = LogFactory.getLog(NotifyOfRecordsDueForReviewJobExecuter.class); - - private RecordsManagementNotificationHelper recordsManagementNotificationHelper; - - private NodeService nodeService; - - private SearchService searchService; - - public void setRecordsManagementNotificationHelper( - RecordsManagementNotificationHelper recordsManagementNotificationHelper) - { - this.recordsManagementNotificationHelper = recordsManagementNotificationHelper; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute() - */ - public void executeImpl() - { - if (logger.isDebugEnabled()) - { - logger.debug("Job " + this.getClass().getSimpleName() + " starting."); - } - - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - // Query is for all records that are due for review and for which - // notification has not been sent. - StringBuilder queryBuffer = new StringBuilder(); - queryBuffer.append("+ASPECT:\"rma:vitalRecord\" "); - queryBuffer.append("+(@rma\\:reviewAsOf:[MIN TO NOW] ) "); - queryBuffer.append("+( "); - queryBuffer.append("@rma\\:notificationIssued:false "); - queryBuffer.append("OR ISNULL:\"rma:notificationIssued\" "); - queryBuffer.append(") "); - String query = queryBuffer.toString(); - - ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query); - final List resultNodes = results.getNodeRefs(); - results.close(); - - if (logger.isDebugEnabled()) - { - logger.debug("Found " + resultNodes.size() + " nodes due for review and without notification."); - } - - //If we have something to do and a template to do it with - if(resultNodes.size() != 0) - { - //Send the email message - but we must not retry since email is not transactional - RetryingTransactionCallback txCallbackSendEmail = new RetryingTransactionCallback() - { - // Set the notification issued property. - public Void execute() - { - // Send notification - recordsManagementNotificationHelper.recordsDueForReviewEmailNotification(resultNodes); - - return null; - } - }; - - RetryingTransactionCallback txUpdateNodesCallback = new RetryingTransactionCallback() - { - // Set the notification issued property. - public Boolean execute() - { - for (NodeRef node : resultNodes) - { - nodeService.setProperty(node, RecordsManagementModel.PROP_NOTIFICATION_ISSUED, "true"); - } - return Boolean.TRUE; - } - }; - - /** - * Now do the work, one action in each transaction - */ - // don't retry the send email - retryingTransactionHelper.setMaxRetries(0); - retryingTransactionHelper.doInTransaction(txCallbackSendEmail); - retryingTransactionHelper.setMaxRetries(10); - retryingTransactionHelper.doInTransaction(txUpdateNodesCallback); - } - return null; - } - - }, AuthenticationUtil.getSystemUserName()); - - if (logger.isDebugEnabled()) - { - logger.debug("Job " + this.getClass().getSimpleName() + " finished"); - } - } // end of execute method - -} - - +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This job finds all Vital Records which are due for review, optionally + * excluding those for which notification has already been issued. + * + * @author Neil McErlean + */ +public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJobExecuter +{ + private static Log logger = LogFactory.getLog(NotifyOfRecordsDueForReviewJobExecuter.class); + + private RecordsManagementNotificationHelper recordsManagementNotificationHelper; + + private NodeService nodeService; + + private SearchService searchService; + + public void setRecordsManagementNotificationHelper( + RecordsManagementNotificationHelper recordsManagementNotificationHelper) + { + this.recordsManagementNotificationHelper = recordsManagementNotificationHelper; + } + + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute() + */ + public void executeImpl() + { + if (logger.isDebugEnabled()) + { + logger.debug("Job " + this.getClass().getSimpleName() + " starting."); + } + + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + // Query is for all records that are due for review and for which + // notification has not been sent. + StringBuilder queryBuffer = new StringBuilder(); + queryBuffer.append("+ASPECT:\"rma:vitalRecord\" "); + queryBuffer.append("+(@rma\\:reviewAsOf:[MIN TO NOW] ) "); + queryBuffer.append("+( "); + queryBuffer.append("@rma\\:notificationIssued:false "); + queryBuffer.append("OR ISNULL:\"rma:notificationIssued\" "); + queryBuffer.append(") "); + String query = queryBuffer.toString(); + + ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query); + final List resultNodes = results.getNodeRefs(); + results.close(); + + if (logger.isDebugEnabled()) + { + logger.debug("Found " + resultNodes.size() + " nodes due for review and without notification."); + } + + //If we have something to do and a template to do it with + if(resultNodes.size() != 0) + { + //Send the email message - but we must not retry since email is not transactional + RetryingTransactionCallback txCallbackSendEmail = new RetryingTransactionCallback() + { + // Set the notification issued property. + public Void execute() + { + // Send notification + recordsManagementNotificationHelper.recordsDueForReviewEmailNotification(resultNodes); + + return null; + } + }; + + RetryingTransactionCallback txUpdateNodesCallback = new RetryingTransactionCallback() + { + // Set the notification issued property. + public Boolean execute() + { + for (NodeRef node : resultNodes) + { + nodeService.setProperty(node, RecordsManagementModel.PROP_NOTIFICATION_ISSUED, "true"); + } + return Boolean.TRUE; + } + }; + + /** + * Now do the work, one action in each transaction + */ + // don't retry the send email + retryingTransactionHelper.setMaxRetries(0); + retryingTransactionHelper.doInTransaction(txCallbackSendEmail); + retryingTransactionHelper.setMaxRetries(10); + retryingTransactionHelper.doInTransaction(txUpdateNodesCallback); + } + return null; + } + + }, AuthenticationUtil.getSystemUserName()); + + if (logger.isDebugEnabled()) + { + logger.debug("Job " + this.getClass().getSimpleName() + " finished"); + } + } // end of execute method + +} + + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java index a73b3d3c85..e3e7b7bf80 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java @@ -1,416 +1,416 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job; - -import java.util.Date; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor; -import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.QueryConsistency; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchParameters; -import org.alfresco.service.cmr.search.SearchService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Job to publish any pending updates on marked node references. - * - * @author Roy Wetherall - */ -public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter -{ - /** Logger */ - private static Log logger = LogFactory.getLog(PublishUpdatesJobExecuter.class); - - /** Node service */ - private NodeService nodeService; - - /** Search service */ - private SearchService searchService; - - /** Publish executor register */ - private PublishExecutorRegistry publishExecutorRegistry; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Behaviour filter */ - private BehaviourFilter behaviourFilter; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param searchService search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @param publishExecutorRegistry public executor registry - */ - public void setPublishExecutorRegistry(PublishExecutorRegistry publishExecutorRegistry) - { - this.publishExecutorRegistry = publishExecutorRegistry; - } - - /** - * @param behaviourFilter behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#executeImpl() - */ - public void executeImpl() - { - if (logger.isDebugEnabled()) - { - logger.debug("Job Starting"); - } - - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - if (rmLoaded()) - { - // Get a list of the nodes that have updates that need to be published - List nodeRefs = getUpdatedNodes(); - - // Deal with each updated disposition action in turn - for (NodeRef nodeRef : nodeRefs) - { - if (nodeService.exists(nodeRef)) - { - boolean publishing = ((Boolean)nodeService.getProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS)).booleanValue(); - if (!publishing) - { - // Mark the update node as publishing in progress - markPublishInProgress(nodeRef); - try - { - Date start = new Date(); - if (logger.isDebugEnabled()) - { - logger.debug("Starting publish of updates ..."); - logger.debug(" - for " + nodeRef.toString()); - logger.debug(" - at " + start.toString()); - } - - // Publish updates - publishUpdates(nodeRef); - - - if (logger.isDebugEnabled()) - { - Date end = new Date(); - long duration = end.getTime() - start.getTime(); - logger.debug("Completed publish of updates ..."); - logger.debug(" - for " + nodeRef.toString()); - logger.debug(" - at " + end.toString()); - logger.debug(" - duration " + Long.toString(duration)); - } - } - finally - { - // Ensure the update node has either completed the publish or is marked as no longer in progress - unmarkPublishInProgress(nodeRef); - } - } - } - } - } - return null; - }; - }, AuthenticationUtil.getSystemUserName()); - - if (logger.isDebugEnabled()) - { - logger.debug("Job Finished"); - } - } - - /** - * Helper method to determine whether the RM content model has been loaded yet. - * - * @return boolean true if RM content model loaded, false otherwise - */ - private boolean rmLoaded() - { - boolean result = false; - - // ensure that the rm content model has been loaded - if (dictionaryService != null && - dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null) - { - result = true; - } - - return result; - } - - /** - * Get a list of the nodes with updates pending publish - * @return List list of node refences with updates pending publication - */ - private List getUpdatedNodes() - { - RetryingTransactionCallback> execution = - new RetryingTransactionHelper.RetryingTransactionCallback>() - { - @Override - public List execute() - { - // Build the query string - StringBuilder sb = new StringBuilder(); - sb.append("ASPECT:\"rma:").append(ASPECT_UNPUBLISHED_UPDATE.getLocalName()).append("\""); - String query = sb.toString(); - - if (logger.isDebugEnabled()) - { - logger.debug("Executing query " + query); - } - - // Execute query to find updates awaiting publishing - List resultNodes = null; - - SearchParameters searchParameters = new SearchParameters(); - searchParameters.setQueryConsistency(QueryConsistency.TRANSACTIONAL); - searchParameters.setQuery(query); - searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); - - try - { - ResultSet results = searchService.query(searchParameters); - try - { - resultNodes = results.getNodeRefs(); - } - finally - { - results.close(); - } - } - catch (AlfrescoRuntimeException exception) - { - if (logger.isDebugEnabled()) - { - logger.debug("Error executing query, " + exception.getMessage()); - } - throw exception; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Found " + resultNodes.size() + " disposition action definitions updates awaiting publishing."); - } - - return resultNodes; - } - }; - return retryingTransactionHelper.doInTransaction(execution, true); - } - - /** - * Mark the node as publish in progress. This is often used as a marker to prevent any further updates - * to a node. - * @param nodeRef node reference - */ - private void markPublishInProgress(final NodeRef nodeRef) - { - RetryingTransactionHelper.RetryingTransactionCallback execution = - new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() - { - if (logger.isDebugEnabled()) - { - logger.debug("Marking updated node as publish in progress. (node=" + nodeRef.toString() + ")"); - } - - behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - try - { - if (nodeService.exists(nodeRef)) - { - // Mark the node as publish in progress - nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, true); - } - } - finally - { - behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - } - return null; - } - }; - retryingTransactionHelper.doInTransaction(execution); - } - - /** - * Publish the updates made to the node. - * @param nodeRef node reference - */ - private void publishUpdates(final NodeRef nodeRef) - { - RetryingTransactionHelper.RetryingTransactionCallback execution = - new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() - { - behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - try - { - // Get the update to value for the node - String updateTo = (String)nodeService.getProperty(nodeRef, PROP_UPDATE_TO); - - if (updateTo != null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Node update to " + updateTo + " (noderef=" + nodeRef.toString() + ")"); - } - - // Get the publish executor - PublishExecutor executor = publishExecutorRegistry.get(updateTo); - if (executor == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")"); - } - throw new AlfrescoRuntimeException("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")"); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Attempting to publish updates. (nodeRef=" + nodeRef.toString() + ")"); - } - - // Publish - executor.publish(nodeRef); - } - else - { - if (logger.isDebugEnabled()) - { - logger.debug("Unable to publish, because publish executor is not set."); - } - } - - // Remove the unpublished update aspect - nodeService.removeAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE); - - if (logger.isDebugEnabled()) - { - logger.debug("Publish updates complete. (nodeRef=" + nodeRef.toString() + ")"); - } - } - finally - { - behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - } - - return null; - } - }; - retryingTransactionHelper.doInTransaction(execution); - } - - /** - * Unmark node as publish in progress, assuming publish failed. - * @param nodeRef node reference - */ - private void unmarkPublishInProgress(final NodeRef nodeRef) - { - RetryingTransactionHelper.RetryingTransactionCallback execution = - new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() - { - behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - try - { - // Assuming the node still has unpublished information, then unmark it in progress - if (nodeService.exists(nodeRef) && - nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Removing publish in progress marker from updated node, because update was not successful. (node=" + nodeRef.toString() + ")"); - } - - nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, false); - } - } - finally - { - behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); - } - - return null; - } - }; - retryingTransactionHelper.doInTransaction(execution); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job; + +import java.util.Date; +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor; +import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.QueryConsistency; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchParameters; +import org.alfresco.service.cmr.search.SearchService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Job to publish any pending updates on marked node references. + * + * @author Roy Wetherall + */ +public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter +{ + /** Logger */ + private static Log logger = LogFactory.getLog(PublishUpdatesJobExecuter.class); + + /** Node service */ + private NodeService nodeService; + + /** Search service */ + private SearchService searchService; + + /** Publish executor register */ + private PublishExecutorRegistry publishExecutorRegistry; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** Behaviour filter */ + private BehaviourFilter behaviourFilter; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param searchService search service + */ + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + /** + * @param publishExecutorRegistry public executor registry + */ + public void setPublishExecutorRegistry(PublishExecutorRegistry publishExecutorRegistry) + { + this.publishExecutorRegistry = publishExecutorRegistry; + } + + /** + * @param behaviourFilter behaviour filter + */ + public void setBehaviourFilter(BehaviourFilter behaviourFilter) + { + this.behaviourFilter = behaviourFilter; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#executeImpl() + */ + public void executeImpl() + { + if (logger.isDebugEnabled()) + { + logger.debug("Job Starting"); + } + + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + if (rmLoaded()) + { + // Get a list of the nodes that have updates that need to be published + List nodeRefs = getUpdatedNodes(); + + // Deal with each updated disposition action in turn + for (NodeRef nodeRef : nodeRefs) + { + if (nodeService.exists(nodeRef)) + { + boolean publishing = ((Boolean)nodeService.getProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS)).booleanValue(); + if (!publishing) + { + // Mark the update node as publishing in progress + markPublishInProgress(nodeRef); + try + { + Date start = new Date(); + if (logger.isDebugEnabled()) + { + logger.debug("Starting publish of updates ..."); + logger.debug(" - for " + nodeRef.toString()); + logger.debug(" - at " + start.toString()); + } + + // Publish updates + publishUpdates(nodeRef); + + + if (logger.isDebugEnabled()) + { + Date end = new Date(); + long duration = end.getTime() - start.getTime(); + logger.debug("Completed publish of updates ..."); + logger.debug(" - for " + nodeRef.toString()); + logger.debug(" - at " + end.toString()); + logger.debug(" - duration " + Long.toString(duration)); + } + } + finally + { + // Ensure the update node has either completed the publish or is marked as no longer in progress + unmarkPublishInProgress(nodeRef); + } + } + } + } + } + return null; + }; + }, AuthenticationUtil.getSystemUserName()); + + if (logger.isDebugEnabled()) + { + logger.debug("Job Finished"); + } + } + + /** + * Helper method to determine whether the RM content model has been loaded yet. + * + * @return boolean true if RM content model loaded, false otherwise + */ + private boolean rmLoaded() + { + boolean result = false; + + // ensure that the rm content model has been loaded + if (dictionaryService != null && + dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null) + { + result = true; + } + + return result; + } + + /** + * Get a list of the nodes with updates pending publish + * @return List list of node refences with updates pending publication + */ + private List getUpdatedNodes() + { + RetryingTransactionCallback> execution = + new RetryingTransactionHelper.RetryingTransactionCallback>() + { + @Override + public List execute() + { + // Build the query string + StringBuilder sb = new StringBuilder(); + sb.append("ASPECT:\"rma:").append(ASPECT_UNPUBLISHED_UPDATE.getLocalName()).append("\""); + String query = sb.toString(); + + if (logger.isDebugEnabled()) + { + logger.debug("Executing query " + query); + } + + // Execute query to find updates awaiting publishing + List resultNodes = null; + + SearchParameters searchParameters = new SearchParameters(); + searchParameters.setQueryConsistency(QueryConsistency.TRANSACTIONAL); + searchParameters.setQuery(query); + searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); + searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); + + try + { + ResultSet results = searchService.query(searchParameters); + try + { + resultNodes = results.getNodeRefs(); + } + finally + { + results.close(); + } + } + catch (AlfrescoRuntimeException exception) + { + if (logger.isDebugEnabled()) + { + logger.debug("Error executing query, " + exception.getMessage()); + } + throw exception; + } + + if (logger.isDebugEnabled()) + { + logger.debug("Found " + resultNodes.size() + " disposition action definitions updates awaiting publishing."); + } + + return resultNodes; + } + }; + return retryingTransactionHelper.doInTransaction(execution, true); + } + + /** + * Mark the node as publish in progress. This is often used as a marker to prevent any further updates + * to a node. + * @param nodeRef node reference + */ + private void markPublishInProgress(final NodeRef nodeRef) + { + RetryingTransactionHelper.RetryingTransactionCallback execution = + new RetryingTransactionHelper.RetryingTransactionCallback() + { + @Override + public Void execute() + { + if (logger.isDebugEnabled()) + { + logger.debug("Marking updated node as publish in progress. (node=" + nodeRef.toString() + ")"); + } + + behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); + try + { + if (nodeService.exists(nodeRef)) + { + // Mark the node as publish in progress + nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, true); + } + } + finally + { + behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); + } + return null; + } + }; + retryingTransactionHelper.doInTransaction(execution); + } + + /** + * Publish the updates made to the node. + * @param nodeRef node reference + */ + private void publishUpdates(final NodeRef nodeRef) + { + RetryingTransactionHelper.RetryingTransactionCallback execution = + new RetryingTransactionHelper.RetryingTransactionCallback() + { + @Override + public Void execute() + { + behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); + try + { + // Get the update to value for the node + String updateTo = (String)nodeService.getProperty(nodeRef, PROP_UPDATE_TO); + + if (updateTo != null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Node update to " + updateTo + " (noderef=" + nodeRef.toString() + ")"); + } + + // Get the publish executor + PublishExecutor executor = publishExecutorRegistry.get(updateTo); + if (executor == null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")"); + } + throw new AlfrescoRuntimeException("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")"); + } + + if (logger.isDebugEnabled()) + { + logger.debug("Attempting to publish updates. (nodeRef=" + nodeRef.toString() + ")"); + } + + // Publish + executor.publish(nodeRef); + } + else + { + if (logger.isDebugEnabled()) + { + logger.debug("Unable to publish, because publish executor is not set."); + } + } + + // Remove the unpublished update aspect + nodeService.removeAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE); + + if (logger.isDebugEnabled()) + { + logger.debug("Publish updates complete. (nodeRef=" + nodeRef.toString() + ")"); + } + } + finally + { + behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); + } + + return null; + } + }; + retryingTransactionHelper.doInTransaction(execution); + } + + /** + * Unmark node as publish in progress, assuming publish failed. + * @param nodeRef node reference + */ + private void unmarkPublishInProgress(final NodeRef nodeRef) + { + RetryingTransactionHelper.RetryingTransactionCallback execution = + new RetryingTransactionHelper.RetryingTransactionCallback() + { + @Override + public Void execute() + { + behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); + try + { + // Assuming the node still has unpublished information, then unmark it in progress + if (nodeService.exists(nodeRef) && + nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE)) + { + if (logger.isDebugEnabled()) + { + logger.debug("Removing publish in progress marker from updated node, because update was not successful. (node=" + nodeRef.toString() + ")"); + } + + nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, false); + } + } + finally + { + behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION); + } + + return null; + } + }; + retryingTransactionHelper.doInTransaction(execution); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJob.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJob.java index 61f1d9caad..a4032c7886 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJob.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJob.java @@ -1,203 +1,203 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job; - -import java.util.concurrent.atomic.AtomicBoolean; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.repo.lock.JobLockService; -import org.alfresco.repo.lock.JobLockService.JobLockRefreshCallback; -import org.alfresco.repo.lock.LockAcquisitionException; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; - -/** - * Base records management job implementation. - *

- * Delegates job execution and ensures locking is enforced. - * - * @author Roy Wetherall - */ -public class RecordsManagementJob implements Job -{ - private static Log logger = LogFactory.getLog(RecordsManagementJob.class); - - /** which user should be used to log audit */ - private String runAuditAs = AuthenticationUtil.getSystemUserName(); - - private static final long DEFAULT_TIME = 30000L; - - private JobLockService jobLockService; - - private RecordsManagementJobExecuter jobExecuter = null; - - private String jobName; - - private QName getLockQName() - { - return QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, jobName); - } - - private class LockCallback implements JobLockRefreshCallback - { - final AtomicBoolean running = new AtomicBoolean(true); - - @Override - public boolean isActive() - { - return running.get(); - } - - @Override - public void lockReleased() - { - running.set(false); - } - } - - /** - * Attempts to get the lock. If the lock couldn't be taken, then null is returned. - * - * @return Returns the lock token or null - */ - private String getLock() - { - try - { - return jobLockService.getLock(getLockQName(), DEFAULT_TIME); - } - catch (LockAcquisitionException e) - { - return null; - } - } - - /** - * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) - */ - public void execute(JobExecutionContext context) throws JobExecutionException - { - - // get the job lock service - jobLockService = (JobLockService) context.getJobDetail().getJobDataMap().get("jobLockService"); - if (jobLockService == null) { throw new AlfrescoRuntimeException("Job lock service has not been specified."); } - - // get the job executer - jobExecuter = (RecordsManagementJobExecuter) context.getJobDetail().getJobDataMap().get("jobExecuter"); - if (jobExecuter == null) { throw new AlfrescoRuntimeException("Job executer has not been specified."); } - - // get the job name - jobName = (String) context.getJobDetail().getJobDataMap().get("jobName"); - - if (jobName == null) { throw new AlfrescoRuntimeException("Job name has not been specified."); } - - if (jobName.compareTo("dispositionLifecycle") == 0) - { - //RM-3293 - set user for audit - if (jobExecuter instanceof DispositionLifecycleJobExecuter) - { - String auditUser = (String) context.getJobDetail().getJobDataMap().get("runAuditAs"); - if (((DispositionLifecycleJobExecuter) jobExecuter).getPersonService().getPersonOrNull(auditUser) != null) - { - setRunAuditAs(auditUser); - } - else - { - setRunAuditAs(AuthenticationUtil.getSystemUserName()); - } - - } - - if (logger.isDebugEnabled()) - { - logger.debug("DispositionLifecycleJobExecuter() logged audit history with user: " + getRunAuditAs()); - - } - - } - - final LockCallback lockCallback = new LockCallback(); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() - { - // try and get the lock - String lockToken = getLock(); - if (lockToken != null) - { - try - { - jobLockService.refreshLock(lockToken, getLockQName(), DEFAULT_TIME, lockCallback); - // do work - jobExecuter.execute(); - } - finally - { - try - { - lockCallback.running.set(false); - jobLockService.releaseLock(lockToken, getLockQName()); - } - catch (LockAcquisitionException e) - { - // Ignore - if (logger.isDebugEnabled()) - { - logger.debug("Lock release failed: " + getLockQName() + ": " + lockToken + "(" - + e.getMessage() + ")"); - } - } - } - } - - // return - return null; - } - }, getRunAuditAs()); - } - - public String getRunAuditAs() - { - return runAuditAs; - } - - public void setRunAuditAs(String runAuditAs) - { - - this.runAuditAs = runAuditAs; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job; + +import java.util.concurrent.atomic.AtomicBoolean; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.repo.lock.JobLockService; +import org.alfresco.repo.lock.JobLockService.JobLockRefreshCallback; +import org.alfresco.repo.lock.LockAcquisitionException; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +/** + * Base records management job implementation. + *

+ * Delegates job execution and ensures locking is enforced. + * + * @author Roy Wetherall + */ +public class RecordsManagementJob implements Job +{ + private static Log logger = LogFactory.getLog(RecordsManagementJob.class); + + /** which user should be used to log audit */ + private String runAuditAs = AuthenticationUtil.getSystemUserName(); + + private static final long DEFAULT_TIME = 30000L; + + private JobLockService jobLockService; + + private RecordsManagementJobExecuter jobExecuter = null; + + private String jobName; + + private QName getLockQName() + { + return QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, jobName); + } + + private class LockCallback implements JobLockRefreshCallback + { + final AtomicBoolean running = new AtomicBoolean(true); + + @Override + public boolean isActive() + { + return running.get(); + } + + @Override + public void lockReleased() + { + running.set(false); + } + } + + /** + * Attempts to get the lock. If the lock couldn't be taken, then null is returned. + * + * @return Returns the lock token or null + */ + private String getLock() + { + try + { + return jobLockService.getLock(getLockQName(), DEFAULT_TIME); + } + catch (LockAcquisitionException e) + { + return null; + } + } + + /** + * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) + */ + public void execute(JobExecutionContext context) throws JobExecutionException + { + + // get the job lock service + jobLockService = (JobLockService) context.getJobDetail().getJobDataMap().get("jobLockService"); + if (jobLockService == null) { throw new AlfrescoRuntimeException("Job lock service has not been specified."); } + + // get the job executer + jobExecuter = (RecordsManagementJobExecuter) context.getJobDetail().getJobDataMap().get("jobExecuter"); + if (jobExecuter == null) { throw new AlfrescoRuntimeException("Job executer has not been specified."); } + + // get the job name + jobName = (String) context.getJobDetail().getJobDataMap().get("jobName"); + + if (jobName == null) { throw new AlfrescoRuntimeException("Job name has not been specified."); } + + if (jobName.compareTo("dispositionLifecycle") == 0) + { + //RM-3293 - set user for audit + if (jobExecuter instanceof DispositionLifecycleJobExecuter) + { + String auditUser = (String) context.getJobDetail().getJobDataMap().get("runAuditAs"); + if (((DispositionLifecycleJobExecuter) jobExecuter).getPersonService().getPersonOrNull(auditUser) != null) + { + setRunAuditAs(auditUser); + } + else + { + setRunAuditAs(AuthenticationUtil.getSystemUserName()); + } + + } + + if (logger.isDebugEnabled()) + { + logger.debug("DispositionLifecycleJobExecuter() logged audit history with user: " + getRunAuditAs()); + + } + + } + + final LockCallback lockCallback = new LockCallback(); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() + { + // try and get the lock + String lockToken = getLock(); + if (lockToken != null) + { + try + { + jobLockService.refreshLock(lockToken, getLockQName(), DEFAULT_TIME, lockCallback); + // do work + jobExecuter.execute(); + } + finally + { + try + { + lockCallback.running.set(false); + jobLockService.releaseLock(lockToken, getLockQName()); + } + catch (LockAcquisitionException e) + { + // Ignore + if (logger.isDebugEnabled()) + { + logger.debug("Lock release failed: " + getLockQName() + ": " + lockToken + "(" + + e.getMessage() + ")"); + } + } + } + } + + // return + return null; + } + }, getRunAuditAs()); + } + + public String getRunAuditAs() + { + return runAuditAs; + } + + public void setRunAuditAs(String runAuditAs) + { + + this.runAuditAs = runAuditAs; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJobExecuter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJobExecuter.java index e5b072fcd7..4d9ad8520d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJobExecuter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/RecordsManagementJobExecuter.java @@ -1,89 +1,89 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.admin.RepositoryState; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; - -/** - * Records management job executer base class. - * - * @author Roy Wetherall - */ -public abstract class RecordsManagementJobExecuter implements RecordsManagementModel -{ - /** Retrying transaction helper */ - protected RetryingTransactionHelper retryingTransactionHelper; - - /** Repository state helper */ - protected RepositoryState repositoryState; - - /** - * @param retryingTransactionHelper retrying transaction helper - */ - public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @param repositoryState repository state helper component - */ - public void setRepositoryState(RepositoryState repositoryState) - { - this.repositoryState = repositoryState; - } - - /** - * Executes the jobs work. - */ - public void execute() - { - // jobs not allowed to execute unless bootstrap is complete - if (!repositoryState.isBootstrapping()) - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Void execute() - { - executeImpl(); - - return null; - } - }, false, true); - } - } - - /** - * Jobs work implementation. - */ - public abstract void executeImpl(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.admin.RepositoryState; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; + +/** + * Records management job executer base class. + * + * @author Roy Wetherall + */ +public abstract class RecordsManagementJobExecuter implements RecordsManagementModel +{ + /** Retrying transaction helper */ + protected RetryingTransactionHelper retryingTransactionHelper; + + /** Repository state helper */ + protected RepositoryState repositoryState; + + /** + * @param retryingTransactionHelper retrying transaction helper + */ + public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) + { + this.retryingTransactionHelper = retryingTransactionHelper; + } + + /** + * @param repositoryState repository state helper component + */ + public void setRepositoryState(RepositoryState repositoryState) + { + this.repositoryState = repositoryState; + } + + /** + * Executes the jobs work. + */ + public void execute() + { + // jobs not allowed to execute unless bootstrap is complete + if (!repositoryState.isBootstrapping()) + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Void execute() + { + executeImpl(); + + return null; + } + }, false, true); + } + } + + /** + * Jobs work implementation. + */ + public abstract void executeImpl(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/BasePublishExecutor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/BasePublishExecutor.java index 8e5a85981a..cd0fee6f77 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/BasePublishExecutor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/BasePublishExecutor.java @@ -1,56 +1,56 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job.publish; - -/** - * Base publish executor implementation - * - * @author Roy Wetherall - */ -public abstract class BasePublishExecutor implements PublishExecutor -{ - /** Publish executor registry */ - public PublishExecutorRegistry registry; - - /** - * Set publish executor registry - * @param registry publish executor registry - */ - public void setPublishExecutorRegistry(PublishExecutorRegistry registry) - { - this.registry = registry; - } - - /** - * Init method - */ - public void init() - { - registry.register(this); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job.publish; + +/** + * Base publish executor implementation + * + * @author Roy Wetherall + */ +public abstract class BasePublishExecutor implements PublishExecutor +{ + /** Publish executor registry */ + public PublishExecutorRegistry registry; + + /** + * Set publish executor registry + * @param registry publish executor registry + */ + public void setPublishExecutorRegistry(PublishExecutorRegistry registry) + { + this.registry = registry; + } + + /** + * Init method + */ + public void init() + { + registry.register(this); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/DispositionActionDefinitionPublishExecutor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/DispositionActionDefinitionPublishExecutor.java index 07a9a81f03..c3a0a52bbc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/DispositionActionDefinitionPublishExecutor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/DispositionActionDefinitionPublishExecutor.java @@ -1,97 +1,97 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job.publish; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.action.impl.BroadcastDispositionActionDefinitionUpdateAction; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Disposition action definition publish executor - * - * @author Roy Wetherall - */ -public class DispositionActionDefinitionPublishExecutor extends BasePublishExecutor -{ - /** Node service */ - private NodeService nodeService; - - /** Records management action service */ - private RecordsManagementActionService rmActionService; - - /** - * Set node service - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set records management service - * @param rmActionService records management service - */ - public void setRmActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor#getName() - */ - @Override - public String getName() - { - return RecordsManagementModel.UPDATE_TO_DISPOSITION_ACTION_DEFINITION; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor#publish(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - public void publish(NodeRef nodeRef) - { - List updatedProps = (List)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_UPDATED_PROPERTIES); - if (updatedProps != null) - { - Map params = new HashMap(); - params.put(BroadcastDispositionActionDefinitionUpdateAction.CHANGED_PROPERTIES, (Serializable)updatedProps); - rmActionService.executeRecordsManagementAction(nodeRef, BroadcastDispositionActionDefinitionUpdateAction.NAME, params); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job.publish; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.action.impl.BroadcastDispositionActionDefinitionUpdateAction; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; + +/** + * Disposition action definition publish executor + * + * @author Roy Wetherall + */ +public class DispositionActionDefinitionPublishExecutor extends BasePublishExecutor +{ + /** Node service */ + private NodeService nodeService; + + /** Records management action service */ + private RecordsManagementActionService rmActionService; + + /** + * Set node service + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set records management service + * @param rmActionService records management service + */ + public void setRmActionService(RecordsManagementActionService rmActionService) + { + this.rmActionService = rmActionService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor#getName() + */ + @Override + public String getName() + { + return RecordsManagementModel.UPDATE_TO_DISPOSITION_ACTION_DEFINITION; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor#publish(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + @Override + public void publish(NodeRef nodeRef) + { + List updatedProps = (List)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_UPDATED_PROPERTIES); + if (updatedProps != null) + { + Map params = new HashMap(); + params.put(BroadcastDispositionActionDefinitionUpdateAction.CHANGED_PROPERTIES, (Serializable)updatedProps); + rmActionService.executeRecordsManagementAction(nodeRef, BroadcastDispositionActionDefinitionUpdateAction.NAME, params); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutor.java index 0fd93a54a7..0e4c8a381e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutor.java @@ -1,50 +1,50 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job.publish; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Publish executor interface. - * - * @author Roy Wetherall - */ -public interface PublishExecutor -{ - /** - * @return publish exector name - */ - String getName(); - - /** - * Publish changes to node. - * - * @param nodeRef node reference - */ - void publish(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job.publish; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Publish executor interface. + * + * @author Roy Wetherall + */ +public interface PublishExecutor +{ + /** + * @return publish exector name + */ + String getName(); + + /** + * Publish changes to node. + * + * @param nodeRef node reference + */ + void publish(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutorRegistry.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutorRegistry.java index 5fb9870f7c..fb9d4e47ec 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutorRegistry.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/job/publish/PublishExecutorRegistry.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job.publish; - -import java.util.HashMap; -import java.util.Map; - -/** - * Publish executor register. - * - * @author Roy Wetherall - */ -public class PublishExecutorRegistry -{ - /** Map of publish executors */ - private Map publishExectors = new HashMap(3); - - /** - * Register a publish executor - * - * @param publishExecutor publish executor - */ - public void register(PublishExecutor publishExecutor) - { - publishExectors.put(publishExecutor.getName(), publishExecutor); - } - - /** - * Get registered publish executor by name. - * - * @param name name - * @return {@link PublishExecutor}] - */ - public PublishExecutor get(String name) - { - return publishExectors.get(name); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job.publish; + +import java.util.HashMap; +import java.util.Map; + +/** + * Publish executor register. + * + * @author Roy Wetherall + */ +public class PublishExecutorRegistry +{ + /** Map of publish executors */ + private Map publishExectors = new HashMap(3); + + /** + * Register a publish executor + * + * @param publishExecutor publish executor + */ + public void register(PublishExecutor publishExecutor) + { + publishExectors.put(publishExecutor.getName(), publishExecutor); + } + + /** + * Get registered publish executor by name. + * + * @param name name + * @return {@link PublishExecutor}] + */ + public PublishExecutor get(String name) + { + return publishExectors.get(name); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptCapability.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptCapability.java index 9401649929..4e5803247b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptCapability.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptCapability.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript; - -/** - * @author Roy Wetherall - */ -public class ScriptCapability -{ - private String name; - private String displayLabel; - private String[] actions; - - /** - * @param name - * @param displayLabel - * @param actions - */ - protected ScriptCapability(String name, String displayLabel, String[] actions) - { - this.name = name; - this.displayLabel = displayLabel; - this.actions = actions.clone(); - } - - /** - * @return the name - */ - public String getName() - { - return name; - } - - /** - * @return the displayLabel - */ - public String getDisplayLabel() - { - return displayLabel; - } - - /** - * @return the actions - */ - public String[] getActions() - { - return actions; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript; + +/** + * @author Roy Wetherall + */ +public class ScriptCapability +{ + private String name; + private String displayLabel; + private String[] actions; + + /** + * @param name + * @param displayLabel + * @param actions + */ + protected ScriptCapability(String name, String displayLabel, String[] actions) + { + this.name = name; + this.displayLabel = displayLabel; + this.actions = actions.clone(); + } + + /** + * @return the name + */ + public String getName() + { + return name; + } + + /** + * @return the displayLabel + */ + public String getDisplayLabel() + { + return displayLabel; + } + + /** + * @return the actions + */ + public String[] getActions() + { + return actions; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java index 69cece8226..3fd3f65c59 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java @@ -1,87 +1,87 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript; - -import java.util.Collections; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.repo.jscript.ScriptNode; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.mozilla.javascript.Scriptable; - -/** - * Base records management script node - * - * NOTE: this could be removed, but is being kept as a place holder for future development - * - * @author Roy Wetherall - */ -public class ScriptRecordsManagmentNode extends ScriptNode -{ - private static final long serialVersionUID = 8872385533440938353L; - - private RecordsManagementServiceRegistry rmServices; - - public ScriptRecordsManagmentNode(NodeRef nodeRef, RecordsManagementServiceRegistry services, Scriptable scope) - { - super(nodeRef, services, scope); - rmServices = services; - } - - public ScriptRecordsManagmentNode(NodeRef nodeRef, RecordsManagementServiceRegistry services) - { - super(nodeRef, services); - rmServices = services; - } - - public boolean hasCapability(String capabilityName) - { - boolean result = false; - - CapabilityService capabilityService = (CapabilityService)rmServices.getCapabilityService(); - Capability capability = capabilityService.getCapability(capabilityName); - if (capability != null) - { - Map map = capabilityService.getCapabilitiesAccessState(nodeRef, Collections.singletonList(capabilityName)); - if (map.containsKey(capability)) - { - AccessStatus accessStatus = map.get(capability); - if (!accessStatus.equals(AccessStatus.DENIED)) - { - result = true; - } - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript; + +import java.util.Collections; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.repo.jscript.ScriptNode; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.mozilla.javascript.Scriptable; + +/** + * Base records management script node + * + * NOTE: this could be removed, but is being kept as a place holder for future development + * + * @author Roy Wetherall + */ +public class ScriptRecordsManagmentNode extends ScriptNode +{ + private static final long serialVersionUID = 8872385533440938353L; + + private RecordsManagementServiceRegistry rmServices; + + public ScriptRecordsManagmentNode(NodeRef nodeRef, RecordsManagementServiceRegistry services, Scriptable scope) + { + super(nodeRef, services, scope); + rmServices = services; + } + + public ScriptRecordsManagmentNode(NodeRef nodeRef, RecordsManagementServiceRegistry services) + { + super(nodeRef, services); + rmServices = services; + } + + public boolean hasCapability(String capabilityName) + { + boolean result = false; + + CapabilityService capabilityService = (CapabilityService)rmServices.getCapabilityService(); + Capability capability = capabilityService.getCapability(capabilityName); + if (capability != null) + { + Map map = capabilityService.getCapabilitiesAccessState(nodeRef, Collections.singletonList(capabilityName)); + if (map.containsKey(capability)) + { + AccessStatus accessStatus = map.get(capability); + if (!accessStatus.equals(AccessStatus.DENIED)) + { + result = true; + } + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java index 4a55ce306a..92a24c955c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java @@ -1,131 +1,131 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.repo.jscript.BaseScopableProcessorExtension; -import org.alfresco.repo.jscript.ScriptNode; -import org.alfresco.scripts.ScriptException; - -/** - * Records management service - * - * @author Roy Wetherall - */ -public class ScriptRecordsManagmentService extends BaseScopableProcessorExtension - implements RecordsManagementModel -{ - /** Records management service registry */ - private RecordsManagementServiceRegistry rmServices; - - /** Records management notification helper */ - private RecordsManagementNotificationHelper notificationHelper; - - /** - * Set records management service registry - * - * @param rmServices records management service registry - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry rmServices) - { - this.rmServices = rmServices; - } - - /** - * Sets the notification helper - * - * @param notificationHelper notification helper - */ - public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) - { - this.notificationHelper = notificationHelper; - } - - /** - * Get records management node - * - * @param node script node - * @return ScriptRecordsManagementNode records management script node - */ - public ScriptRecordsManagmentNode getRecordsManagementNode(ScriptNode node) - { - ScriptRecordsManagmentNode result = null; - - if (rmServices.getNodeService().hasAspect(node.getNodeRef(), ASPECT_FILE_PLAN_COMPONENT)) - { - // TODO .. at this point determine what type of records management node is it and - // create the appropriate sub-type - result = new ScriptRecordsManagmentNode(node.getNodeRef(), rmServices); - } - else - { - throw new ScriptException("Node is not a records management node type."); - } - - return result; - } - - /** - * Set the RM permission - * - * @param node - * @param permission - * @param authority - */ - public void setPermission(ScriptNode node, String permission, String authority) - { - FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService(); - filePlanPermissionService.setPermission(node.getNodeRef(), authority, permission); - } - - /** - * Delete the RM permission - * - * @param node - * @param permission - * @param authority - */ - public void deletePermission(ScriptNode node, String permission, String authority) - { - FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService(); - filePlanPermissionService.deletePermission(node.getNodeRef(), authority, permission); - } - - /** - * Send superseded notification - * - * @param record superseded record - */ - public void sendSupersededNotification(ScriptNode record) - { - notificationHelper.recordSupersededEmailNotification(record.getNodeRef()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript; + +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; +import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; +import org.alfresco.repo.jscript.BaseScopableProcessorExtension; +import org.alfresco.repo.jscript.ScriptNode; +import org.alfresco.scripts.ScriptException; + +/** + * Records management service + * + * @author Roy Wetherall + */ +public class ScriptRecordsManagmentService extends BaseScopableProcessorExtension + implements RecordsManagementModel +{ + /** Records management service registry */ + private RecordsManagementServiceRegistry rmServices; + + /** Records management notification helper */ + private RecordsManagementNotificationHelper notificationHelper; + + /** + * Set records management service registry + * + * @param rmServices records management service registry + */ + public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry rmServices) + { + this.rmServices = rmServices; + } + + /** + * Sets the notification helper + * + * @param notificationHelper notification helper + */ + public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) + { + this.notificationHelper = notificationHelper; + } + + /** + * Get records management node + * + * @param node script node + * @return ScriptRecordsManagementNode records management script node + */ + public ScriptRecordsManagmentNode getRecordsManagementNode(ScriptNode node) + { + ScriptRecordsManagmentNode result = null; + + if (rmServices.getNodeService().hasAspect(node.getNodeRef(), ASPECT_FILE_PLAN_COMPONENT)) + { + // TODO .. at this point determine what type of records management node is it and + // create the appropriate sub-type + result = new ScriptRecordsManagmentNode(node.getNodeRef(), rmServices); + } + else + { + throw new ScriptException("Node is not a records management node type."); + } + + return result; + } + + /** + * Set the RM permission + * + * @param node + * @param permission + * @param authority + */ + public void setPermission(ScriptNode node, String permission, String authority) + { + FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService(); + filePlanPermissionService.setPermission(node.getNodeRef(), authority, permission); + } + + /** + * Delete the RM permission + * + * @param node + * @param permission + * @param authority + */ + public void deletePermission(ScriptNode node, String permission, String authority) + { + FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService(); + filePlanPermissionService.deletePermission(node.getNodeRef(), authority, permission); + } + + /** + * Send superseded notification + * + * @param record superseded record + */ + public void sendSupersededNotification(ScriptNode record) + { + notificationHelper.recordSupersededEmailNotification(record.getNodeRef()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java index bb640663e3..94f3ef7cdd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java @@ -1,276 +1,276 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.NamespaceService; - -/** - * Base evaluator. - * - * @author Roy Wetherall - */ -public abstract class BaseEvaluator implements RecordsManagementModel -{ - /** Name */ - protected String name; - - /** JSON conversion component */ - protected JSONConversionComponent jsonConversionComponent; - - /** Record service */ - protected RecordService recordService; - - /** Node service */ - protected NodeService nodeService; - - /** Namespace service */ - protected NamespaceService namespaceService; - - /** Capability service */ - protected CapabilityService capabilityService; - - /** File plan component kinds */ - protected Set kinds; - - /** Capabilities */ - protected List capabilities; - - /** File plan service */ - protected FilePlanService filePlanService; - - /** Disposition service */ - protected DispositionService dispositionService; - - /** Record folder service */ - protected RecordFolderService recordFolderService; - - /** - * @param jsonConversionComponent json conversion component - */ - public void setJsonConversionComponent(JSONConversionComponent jsonConversionComponent) - { - this.jsonConversionComponent = jsonConversionComponent; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @return - */ - public String getName() - { - return this.name; - } - - /** - * @param kinds - */ - public void setKinds(Set kinds) - { - this.kinds = kinds; - } - - /** - * @param capabilties - */ - public void setCapabilities(List capabilties) - { - this.capabilities = capabilties; - } - - /** - * Helper method which sets on capability. - * - * @param capability capability name - */ - public void setCapability(String capability) - { - List list = new ArrayList(1); - list.add(capability); - this.capabilities = list; - } - - /** - * Registers this instance as an indicator (evaluator) - */ - public void registerIndicator() - { - jsonConversionComponent.registerIndicator(this); - } - - /** - * Registers this instance as an action (evaluator) - */ - public void registerAction() - { - jsonConversionComponent.registerAction(this); - } - - /** - * Executes the evaluation. - * - * @param nodeRef - * @return - */ - public boolean evaluate(NodeRef nodeRef) - { - boolean result = false; - - // Check that we are dealing with the correct kind of RM object - if ((kinds == null || checkKinds(nodeRef)) && - // Check we have the required capabilities - (capabilities == null || checkCapabilities(nodeRef))) - { - result = evaluateImpl(nodeRef); - } - - return result; - } - - /** - * Checks the file plan component kind. - * - * @param nodeRef - * @return - */ - private boolean checkKinds(NodeRef nodeRef) - { - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - return kinds.contains(kind); - } - - /** - * Checks the capabilities. - * - * @param nodeRef - * @return - */ - private boolean checkCapabilities(NodeRef nodeRef) - { - boolean result = true; - if (capabilities != null && !capabilities.isEmpty()) - { - Map accessStatus = capabilityService.getCapabilitiesAccessState(nodeRef, capabilities); - for (AccessStatus value : accessStatus.values()) - { - if (AccessStatus.DENIED.equals(value)) - { - result = false; - break; - } - } - } - return result; - } - - /** - * Evaluation execution implementation. - * - * @param nodeRef - * @return - */ - protected abstract boolean evaluateImpl(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.NamespaceService; + +/** + * Base evaluator. + * + * @author Roy Wetherall + */ +public abstract class BaseEvaluator implements RecordsManagementModel +{ + /** Name */ + protected String name; + + /** JSON conversion component */ + protected JSONConversionComponent jsonConversionComponent; + + /** Record service */ + protected RecordService recordService; + + /** Node service */ + protected NodeService nodeService; + + /** Namespace service */ + protected NamespaceService namespaceService; + + /** Capability service */ + protected CapabilityService capabilityService; + + /** File plan component kinds */ + protected Set kinds; + + /** Capabilities */ + protected List capabilities; + + /** File plan service */ + protected FilePlanService filePlanService; + + /** Disposition service */ + protected DispositionService dispositionService; + + /** Record folder service */ + protected RecordFolderService recordFolderService; + + /** + * @param jsonConversionComponent json conversion component + */ + public void setJsonConversionComponent(JSONConversionComponent jsonConversionComponent) + { + this.jsonConversionComponent = jsonConversionComponent; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param name + */ + public void setName(String name) + { + this.name = name; + } + + /** + * @return + */ + public String getName() + { + return this.name; + } + + /** + * @param kinds + */ + public void setKinds(Set kinds) + { + this.kinds = kinds; + } + + /** + * @param capabilties + */ + public void setCapabilities(List capabilties) + { + this.capabilities = capabilties; + } + + /** + * Helper method which sets on capability. + * + * @param capability capability name + */ + public void setCapability(String capability) + { + List list = new ArrayList(1); + list.add(capability); + this.capabilities = list; + } + + /** + * Registers this instance as an indicator (evaluator) + */ + public void registerIndicator() + { + jsonConversionComponent.registerIndicator(this); + } + + /** + * Registers this instance as an action (evaluator) + */ + public void registerAction() + { + jsonConversionComponent.registerAction(this); + } + + /** + * Executes the evaluation. + * + * @param nodeRef + * @return + */ + public boolean evaluate(NodeRef nodeRef) + { + boolean result = false; + + // Check that we are dealing with the correct kind of RM object + if ((kinds == null || checkKinds(nodeRef)) && + // Check we have the required capabilities + (capabilities == null || checkCapabilities(nodeRef))) + { + result = evaluateImpl(nodeRef); + } + + return result; + } + + /** + * Checks the file plan component kind. + * + * @param nodeRef + * @return + */ + private boolean checkKinds(NodeRef nodeRef) + { + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); + return kinds.contains(kind); + } + + /** + * Checks the capabilities. + * + * @param nodeRef + * @return + */ + private boolean checkCapabilities(NodeRef nodeRef) + { + boolean result = true; + if (capabilities != null && !capabilities.isEmpty()) + { + Map accessStatus = capabilityService.getCapabilitiesAccessState(nodeRef, capabilities); + for (AccessStatus value : accessStatus.values()) + { + if (AccessStatus.DENIED.equals(value)) + { + result = false; + break; + } + } + } + return result; + } + + /** + * Evaluation execution implementation. + * + * @param nodeRef + * @return + */ + protected abstract boolean evaluateImpl(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java index ca2c5c22c0..8c314ac861 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java @@ -1,600 +1,600 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app; - -import static org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel.READ_RECORDS; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.PathUtil; -import org.apache.commons.lang.ArrayUtils; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; - -/** - * Extend JSON conversion component to include RM specifics. - * - * @author Roy Wetherall - */ -public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONConversionComponent - implements NodeServicePolicies.OnDeleteNodePolicy, - NodeServicePolicies.OnCreateNodePolicy -{ - /** JSON values */ - private static final String IS_RM_NODE = "isRmNode"; - private static final String RM_NODE = "rmNode"; - private static final String IS_RM_SITE_CREATED = "isRmSiteCreated"; - private static final String IS_RECORD_CONTRIBUTOR_GROUP_ENABLED = "isRecordContributorGroupEnabled"; - private static final String RECORD_CONTRIBUTOR_GROUP_NAME = "recordContributorGroupName"; - - /** true if record contributor group is enabled, false otherwise */ - private boolean isRecordContributorsGroupEnabled = false; - - /** record contributors group */ - private String recordContributorsGroupName = "RECORD_CONTRIBUTORS"; - - /** Record service */ - private RecordService recordService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** dictionary service */ - private DictionaryService dictionaryService; - - /** site service */ - private SiteService siteService; - - /** Indicators */ - private List indicators = new ArrayList(); - - /** Actions */ - private List actions = new ArrayList(); - - /** The policy component */ - private PolicyComponent policyComponent; - - /** JSON conversion component cache */ - private SimpleCache jsonConversionComponentCache; - - /** Constants for checking the cache */ - private static final String RM_SITE_EXISTS = "rmSiteExists"; - - /** - * @param enabled true if enabled, false otherwise - */ - public void setRecordContributorsGroupEnabled(boolean enabled) - { - isRecordContributorsGroupEnabled = enabled; - } - - /** - * @param recordContributorsGroupName record contributors group name - */ - public void setRecordContributorsGroupName(String recordContributorsGroupName) - { - this.recordContributorsGroupName = recordContributorsGroupName; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param indicator registered indicator - */ - public void registerIndicator(BaseEvaluator indicator) - { - indicators.add(indicator); - } - - /** - * @param action registered action - */ - public void registerAction(BaseEvaluator action) - { - actions.add(action); - } - - /** - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Gets the json conversion component cache - * - * @return The json conversion component cache - */ - protected SimpleCache getJsonConversionComponentCache() - { - return this.jsonConversionComponentCache; - } - - /** - * Sets the json conversion component cache - * - * @param jsonConversionComponentCache The json conversion component cache - */ - public void setJsonConversionComponentCache(SimpleCache jsonConversionComponentCache) - { - this.jsonConversionComponentCache = jsonConversionComponentCache; - } - - /** - * The initialise method - */ - public void init() - { - policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"), - RecordsManagementModel.TYPE_RM_SITE, - new JavaBehaviour(this, "onDeleteNode")); - - policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), - RecordsManagementModel.TYPE_RM_SITE, - new JavaBehaviour(this, "onCreateNode")); - } - - /** - * @see org.alfresco.repo.jscript.app.JSONConversionComponent#setRootValues(org.alfresco.service.cmr.model.FileInfo, - * org.json.simple.JSONObject, boolean) - */ - @SuppressWarnings("unchecked") - @Override - protected void setRootValues(FileInfo nodeInfo, JSONObject rootJSONObject, boolean useShortQNames) - { - if (nodeInfo != null) - { - // Set the base root values - super.setRootValues(nodeInfo, rootJSONObject, useShortQNames); - - // check the exisitance of the RM site - checkRmSiteExistence(rootJSONObject); - - // get the record contributor information - rootJSONObject.put(IS_RECORD_CONTRIBUTOR_GROUP_ENABLED, isRecordContributorsGroupEnabled); - rootJSONObject.put(RECORD_CONTRIBUTOR_GROUP_NAME, recordContributorsGroupName); - - // Get the node reference for convenience - NodeRef nodeRef = nodeInfo.getNodeRef(); - - if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef, ViewRecordsCapability.NAME))) - { - // Indicate whether the node is a RM object or not - boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeRef); - rootJSONObject.put(IS_RM_NODE, isFilePlanComponent); - - if (isFilePlanComponent) - { - rootJSONObject.put(RM_NODE, setRmNodeValues(nodeRef, useShortQNames)); - - // FIXME: Is this the right place to add the information? - addInfo(nodeInfo, rootJSONObject); - } - } - } - } - - /** - * Checks for the existance of the RM site - * - * @param rootJSONObject the root JSON object - */ - @SuppressWarnings("unchecked") - private void checkRmSiteExistence(JSONObject rootJSONObject) - { - if (!getJsonConversionComponentCache().contains(RM_SITE_EXISTS)) - { - SiteInfo site = siteService.getSite(FilePlanService.DEFAULT_RM_SITE_ID); - if (site != null) - { - getJsonConversionComponentCache().put(RM_SITE_EXISTS, true); - rootJSONObject.put(IS_RM_SITE_CREATED, true); - } - else - { - getJsonConversionComponentCache().put(RM_SITE_EXISTS, false); - rootJSONObject.put(IS_RM_SITE_CREATED, false); - } - } - else - { - rootJSONObject.put(IS_RM_SITE_CREATED, getJsonConversionComponentCache().get(RM_SITE_EXISTS)); - } - } - - /** - * Helper method to add information about node - * - * @param nodeInfo node information - * @param rootJSONObject root JSON object - */ - @SuppressWarnings("unchecked") - private void addInfo(final FileInfo nodeInfo, JSONObject rootJSONObject) - { - String itemType = (String) rootJSONObject.get("type"); - final QName itemTypeQName = QName.createQName(itemType, namespaceService); - - NodeRef originatingLocation = AuthenticationUtil.runAsSystem(new RunAsWork() - { - public NodeRef doWork() - { - NodeRef originatingLocation = null; - - if (dictionaryService.isSubClass(itemTypeQName, ContentModel.TYPE_CONTENT)) - { - NodeRef nodeRef = nodeInfo.getNodeRef(); - List parentAssocs = nodeService.getParentAssocs(nodeRef); - - for (ChildAssociationRef parent : parentAssocs) - { - // FIXME: What if there is more than a secondary parent? - if (!parent.isPrimary()) - { - originatingLocation = parent.getParentRef(); - - // only consider the non-RM parent otherwise we can - // run into issues with frozen or transferring records - if (!nodeService.hasAspect(originatingLocation, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - // assume we have found the correct in-place location - // FIXME when we support multiple in-place locations - break; - } - } - } - } - - return originatingLocation; - } - }); - - if (originatingLocation != null) - { - // add the originating location (if there is one) - String pathSeparator = "/"; - String displayPath = getDisplayPath(originatingLocation); - String[] displayPathElements = displayPath.split(pathSeparator); - Object[] subPath = ArrayUtils.subarray(displayPathElements, 5, displayPathElements.length); - StringBuilder originatingLocationPath = new StringBuilder(); - for (int i = 0; i < subPath.length; i++) - { - originatingLocationPath.append(pathSeparator).append(subPath[i]); - } - rootJSONObject.put("originatingLocationPath", originatingLocationPath.toString()); - } - } - - /** - * Helper method to get the display path. - * - * @param nodeRef node reference - * @return String display path - */ - private String getDisplayPath(final NodeRef nodeRef) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - public String doWork() throws Exception - { - return PathUtil.getDisplayPath(nodeService.getPath(nodeRef), true); - } - }, AuthenticationUtil.getAdminUserName()); - } - - /** - * Helper method to set the RM node values - * - * @param nodeRef node reference - * @param useShortQName indicates whether the short QName are used or not - * @return {@link JSONObject} JSON object containing values - */ - @SuppressWarnings("unchecked") - private JSONObject setRmNodeValues(final NodeRef nodeRef, final boolean useShortQName) - { - JSONObject rmNodeValues = new JSONObject(); - - // UI convenience type - rmNodeValues.put("uiType", getUIType(nodeRef)); - - // Get the 'kind' of the file plan component - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - rmNodeValues.put("kind", kind.toString()); - - // set the primary parent node reference - ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); - if (assoc != null) - { - rmNodeValues.put("primaryParentNodeRef", assoc.getParentRef().toString()); - } - - Map values = AuthenticationUtil.runAsSystem(new RunAsWork>() - { - public Map doWork() throws Exception - { - Map result = new HashMap(); - - // File plan node reference - NodeRef filePlan = filePlanService.getFilePlan(nodeRef); - if (filePlan != null) - { - result.put("filePlan", filePlan.toString()); - - // Unfiled container node reference - NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan); - if (unfiledRecordContainer != null) - { - result.put("unfiledRecordContainer", unfiledRecordContainer.toString()); - result.put("properties", propertiesToJSON(unfiledRecordContainer, nodeService.getProperties(unfiledRecordContainer), useShortQName)); - QName type = fileFolderService.getFileInfo(unfiledRecordContainer).getType(); - result.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString()); - } - } - - return result; - } - }); - - rmNodeValues.putAll(values); - - // Set the indicators array - setIndicators(rmNodeValues, nodeRef); - - // Set the actions array - setActions(rmNodeValues, nodeRef); - - return rmNodeValues; - } - - @SuppressWarnings("unchecked") - private void setIndicators(JSONObject rmNodeValues, NodeRef nodeRef) - { - if (indicators != null && !indicators.isEmpty()) - { - JSONArray jsonIndicators = new JSONArray(); - - for (BaseEvaluator indicator : indicators) - { - if (indicator.evaluate(nodeRef)) - { - jsonIndicators.add(indicator.getName()); - } - } - - rmNodeValues.put("indicators", jsonIndicators); - } - } - - @SuppressWarnings("unchecked") - private void setActions(JSONObject rmNodeValues, NodeRef nodeRef) - { - if (actions != null && !actions.isEmpty()) - { - JSONArray jsonActions = new JSONArray(); - - for (BaseEvaluator action : actions) - { - if (action.evaluate(nodeRef)) - { - jsonActions.add(action.getName()); - } - } - - rmNodeValues.put("actions", jsonActions); - } - } - - /** - * @see org.alfresco.repo.jscript.app.JSONConversionComponent#permissionsToJSON(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - protected JSONObject permissionsToJSON(final NodeRef nodeRef) - { - JSONObject permissionsJSON = new JSONObject(); - if (!filePlanService.isFilePlanComponent(nodeRef)) - { - permissionsJSON = super.permissionsToJSON(nodeRef); - } - else - { - if (ALLOWED.equals(permissionService.hasPermission(nodeRef, READ_RECORDS))) - { - permissionsJSON.put("inherited", permissionService.getInheritParentPermissions(nodeRef)); - permissionsJSON.put("roles", allSetPermissionsToJSON(nodeRef)); - permissionsJSON.put("user", userPermissionsToJSON(nodeRef)); - } - } - return permissionsJSON; - } - - /** - * Gets the rm 'type' used as a UI convenience and compatibility flag. - */ - private String getUIType(NodeRef nodeRef) - { - String result = "unknown"; - - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (kind != null) - { - switch (kind) - { - case FILE_PLAN: - { - result = "fileplan"; - break; - } - case RECORD_CATEGORY: - { - result = "record-category"; - break; - } - case RECORD_FOLDER: - { - if (recordService.isMetadataStub(nodeRef)) - { - result = "metadata-stub-folder"; - } - else - { - result = "record-folder"; - } - break; - } - case RECORD: - { - if (recordService.isMetadataStub(nodeRef)) - { - result = "metadata-stub"; - } - else - { - if (recordService.isDeclared(nodeRef)) - { - result = "record"; - } - else - { - result = "undeclared-record"; - } - } - break; - } - case HOLD: - { - result = "hold"; - break; - } - case TRANSFER: - { - result = "transfer-container"; - break; - } - case UNFILED_RECORD_FOLDER: - { - result = "unfiled-record-folder"; - break; - } - default: - { - break; - } - } - } - - return result; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - getJsonConversionComponentCache().put(RM_SITE_EXISTS, false); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - public void onCreateNode(ChildAssociationRef childAssocRef) - { - getJsonConversionComponentCache().put(RM_SITE_EXISTS, true); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app; + +import static org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel.READ_RECORDS; +import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.repo.cache.SimpleCache; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.PathUtil; +import org.apache.commons.lang.ArrayUtils; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +/** + * Extend JSON conversion component to include RM specifics. + * + * @author Roy Wetherall + */ +public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONConversionComponent + implements NodeServicePolicies.OnDeleteNodePolicy, + NodeServicePolicies.OnCreateNodePolicy +{ + /** JSON values */ + private static final String IS_RM_NODE = "isRmNode"; + private static final String RM_NODE = "rmNode"; + private static final String IS_RM_SITE_CREATED = "isRmSiteCreated"; + private static final String IS_RECORD_CONTRIBUTOR_GROUP_ENABLED = "isRecordContributorGroupEnabled"; + private static final String RECORD_CONTRIBUTOR_GROUP_NAME = "recordContributorGroupName"; + + /** true if record contributor group is enabled, false otherwise */ + private boolean isRecordContributorsGroupEnabled = false; + + /** record contributors group */ + private String recordContributorsGroupName = "RECORD_CONTRIBUTORS"; + + /** Record service */ + private RecordService recordService; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Capability service */ + private CapabilityService capabilityService; + + /** dictionary service */ + private DictionaryService dictionaryService; + + /** site service */ + private SiteService siteService; + + /** Indicators */ + private List indicators = new ArrayList(); + + /** Actions */ + private List actions = new ArrayList(); + + /** The policy component */ + private PolicyComponent policyComponent; + + /** JSON conversion component cache */ + private SimpleCache jsonConversionComponentCache; + + /** Constants for checking the cache */ + private static final String RM_SITE_EXISTS = "rmSiteExists"; + + /** + * @param enabled true if enabled, false otherwise + */ + public void setRecordContributorsGroupEnabled(boolean enabled) + { + isRecordContributorsGroupEnabled = enabled; + } + + /** + * @param recordContributorsGroupName record contributors group name + */ + public void setRecordContributorsGroupName(String recordContributorsGroupName) + { + this.recordContributorsGroupName = recordContributorsGroupName; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @param indicator registered indicator + */ + public void registerIndicator(BaseEvaluator indicator) + { + indicators.add(indicator); + } + + /** + * @param action registered action + */ + public void registerAction(BaseEvaluator action) + { + actions.add(action); + } + + /** + * @param policyComponent policy component + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + /** + * Gets the json conversion component cache + * + * @return The json conversion component cache + */ + protected SimpleCache getJsonConversionComponentCache() + { + return this.jsonConversionComponentCache; + } + + /** + * Sets the json conversion component cache + * + * @param jsonConversionComponentCache The json conversion component cache + */ + public void setJsonConversionComponentCache(SimpleCache jsonConversionComponentCache) + { + this.jsonConversionComponentCache = jsonConversionComponentCache; + } + + /** + * The initialise method + */ + public void init() + { + policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"), + RecordsManagementModel.TYPE_RM_SITE, + new JavaBehaviour(this, "onDeleteNode")); + + policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), + RecordsManagementModel.TYPE_RM_SITE, + new JavaBehaviour(this, "onCreateNode")); + } + + /** + * @see org.alfresco.repo.jscript.app.JSONConversionComponent#setRootValues(org.alfresco.service.cmr.model.FileInfo, + * org.json.simple.JSONObject, boolean) + */ + @SuppressWarnings("unchecked") + @Override + protected void setRootValues(FileInfo nodeInfo, JSONObject rootJSONObject, boolean useShortQNames) + { + if (nodeInfo != null) + { + // Set the base root values + super.setRootValues(nodeInfo, rootJSONObject, useShortQNames); + + // check the exisitance of the RM site + checkRmSiteExistence(rootJSONObject); + + // get the record contributor information + rootJSONObject.put(IS_RECORD_CONTRIBUTOR_GROUP_ENABLED, isRecordContributorsGroupEnabled); + rootJSONObject.put(RECORD_CONTRIBUTOR_GROUP_NAME, recordContributorsGroupName); + + // Get the node reference for convenience + NodeRef nodeRef = nodeInfo.getNodeRef(); + + if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef, ViewRecordsCapability.NAME))) + { + // Indicate whether the node is a RM object or not + boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeRef); + rootJSONObject.put(IS_RM_NODE, isFilePlanComponent); + + if (isFilePlanComponent) + { + rootJSONObject.put(RM_NODE, setRmNodeValues(nodeRef, useShortQNames)); + + // FIXME: Is this the right place to add the information? + addInfo(nodeInfo, rootJSONObject); + } + } + } + } + + /** + * Checks for the existance of the RM site + * + * @param rootJSONObject the root JSON object + */ + @SuppressWarnings("unchecked") + private void checkRmSiteExistence(JSONObject rootJSONObject) + { + if (!getJsonConversionComponentCache().contains(RM_SITE_EXISTS)) + { + SiteInfo site = siteService.getSite(FilePlanService.DEFAULT_RM_SITE_ID); + if (site != null) + { + getJsonConversionComponentCache().put(RM_SITE_EXISTS, true); + rootJSONObject.put(IS_RM_SITE_CREATED, true); + } + else + { + getJsonConversionComponentCache().put(RM_SITE_EXISTS, false); + rootJSONObject.put(IS_RM_SITE_CREATED, false); + } + } + else + { + rootJSONObject.put(IS_RM_SITE_CREATED, getJsonConversionComponentCache().get(RM_SITE_EXISTS)); + } + } + + /** + * Helper method to add information about node + * + * @param nodeInfo node information + * @param rootJSONObject root JSON object + */ + @SuppressWarnings("unchecked") + private void addInfo(final FileInfo nodeInfo, JSONObject rootJSONObject) + { + String itemType = (String) rootJSONObject.get("type"); + final QName itemTypeQName = QName.createQName(itemType, namespaceService); + + NodeRef originatingLocation = AuthenticationUtil.runAsSystem(new RunAsWork() + { + public NodeRef doWork() + { + NodeRef originatingLocation = null; + + if (dictionaryService.isSubClass(itemTypeQName, ContentModel.TYPE_CONTENT)) + { + NodeRef nodeRef = nodeInfo.getNodeRef(); + List parentAssocs = nodeService.getParentAssocs(nodeRef); + + for (ChildAssociationRef parent : parentAssocs) + { + // FIXME: What if there is more than a secondary parent? + if (!parent.isPrimary()) + { + originatingLocation = parent.getParentRef(); + + // only consider the non-RM parent otherwise we can + // run into issues with frozen or transferring records + if (!nodeService.hasAspect(originatingLocation, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) + { + // assume we have found the correct in-place location + // FIXME when we support multiple in-place locations + break; + } + } + } + } + + return originatingLocation; + } + }); + + if (originatingLocation != null) + { + // add the originating location (if there is one) + String pathSeparator = "/"; + String displayPath = getDisplayPath(originatingLocation); + String[] displayPathElements = displayPath.split(pathSeparator); + Object[] subPath = ArrayUtils.subarray(displayPathElements, 5, displayPathElements.length); + StringBuilder originatingLocationPath = new StringBuilder(); + for (int i = 0; i < subPath.length; i++) + { + originatingLocationPath.append(pathSeparator).append(subPath[i]); + } + rootJSONObject.put("originatingLocationPath", originatingLocationPath.toString()); + } + } + + /** + * Helper method to get the display path. + * + * @param nodeRef node reference + * @return String display path + */ + private String getDisplayPath(final NodeRef nodeRef) + { + return AuthenticationUtil.runAs(new RunAsWork() + { + public String doWork() throws Exception + { + return PathUtil.getDisplayPath(nodeService.getPath(nodeRef), true); + } + }, AuthenticationUtil.getAdminUserName()); + } + + /** + * Helper method to set the RM node values + * + * @param nodeRef node reference + * @param useShortQName indicates whether the short QName are used or not + * @return {@link JSONObject} JSON object containing values + */ + @SuppressWarnings("unchecked") + private JSONObject setRmNodeValues(final NodeRef nodeRef, final boolean useShortQName) + { + JSONObject rmNodeValues = new JSONObject(); + + // UI convenience type + rmNodeValues.put("uiType", getUIType(nodeRef)); + + // Get the 'kind' of the file plan component + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); + rmNodeValues.put("kind", kind.toString()); + + // set the primary parent node reference + ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); + if (assoc != null) + { + rmNodeValues.put("primaryParentNodeRef", assoc.getParentRef().toString()); + } + + Map values = AuthenticationUtil.runAsSystem(new RunAsWork>() + { + public Map doWork() throws Exception + { + Map result = new HashMap(); + + // File plan node reference + NodeRef filePlan = filePlanService.getFilePlan(nodeRef); + if (filePlan != null) + { + result.put("filePlan", filePlan.toString()); + + // Unfiled container node reference + NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan); + if (unfiledRecordContainer != null) + { + result.put("unfiledRecordContainer", unfiledRecordContainer.toString()); + result.put("properties", propertiesToJSON(unfiledRecordContainer, nodeService.getProperties(unfiledRecordContainer), useShortQName)); + QName type = fileFolderService.getFileInfo(unfiledRecordContainer).getType(); + result.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString()); + } + } + + return result; + } + }); + + rmNodeValues.putAll(values); + + // Set the indicators array + setIndicators(rmNodeValues, nodeRef); + + // Set the actions array + setActions(rmNodeValues, nodeRef); + + return rmNodeValues; + } + + @SuppressWarnings("unchecked") + private void setIndicators(JSONObject rmNodeValues, NodeRef nodeRef) + { + if (indicators != null && !indicators.isEmpty()) + { + JSONArray jsonIndicators = new JSONArray(); + + for (BaseEvaluator indicator : indicators) + { + if (indicator.evaluate(nodeRef)) + { + jsonIndicators.add(indicator.getName()); + } + } + + rmNodeValues.put("indicators", jsonIndicators); + } + } + + @SuppressWarnings("unchecked") + private void setActions(JSONObject rmNodeValues, NodeRef nodeRef) + { + if (actions != null && !actions.isEmpty()) + { + JSONArray jsonActions = new JSONArray(); + + for (BaseEvaluator action : actions) + { + if (action.evaluate(nodeRef)) + { + jsonActions.add(action.getName()); + } + } + + rmNodeValues.put("actions", jsonActions); + } + } + + /** + * @see org.alfresco.repo.jscript.app.JSONConversionComponent#permissionsToJSON(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + protected JSONObject permissionsToJSON(final NodeRef nodeRef) + { + JSONObject permissionsJSON = new JSONObject(); + if (!filePlanService.isFilePlanComponent(nodeRef)) + { + permissionsJSON = super.permissionsToJSON(nodeRef); + } + else + { + if (ALLOWED.equals(permissionService.hasPermission(nodeRef, READ_RECORDS))) + { + permissionsJSON.put("inherited", permissionService.getInheritParentPermissions(nodeRef)); + permissionsJSON.put("roles", allSetPermissionsToJSON(nodeRef)); + permissionsJSON.put("user", userPermissionsToJSON(nodeRef)); + } + } + return permissionsJSON; + } + + /** + * Gets the rm 'type' used as a UI convenience and compatibility flag. + */ + private String getUIType(NodeRef nodeRef) + { + String result = "unknown"; + + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); + if (kind != null) + { + switch (kind) + { + case FILE_PLAN: + { + result = "fileplan"; + break; + } + case RECORD_CATEGORY: + { + result = "record-category"; + break; + } + case RECORD_FOLDER: + { + if (recordService.isMetadataStub(nodeRef)) + { + result = "metadata-stub-folder"; + } + else + { + result = "record-folder"; + } + break; + } + case RECORD: + { + if (recordService.isMetadataStub(nodeRef)) + { + result = "metadata-stub"; + } + else + { + if (recordService.isDeclared(nodeRef)) + { + result = "record"; + } + else + { + result = "undeclared-record"; + } + } + break; + } + case HOLD: + { + result = "hold"; + break; + } + case TRANSFER: + { + result = "transfer-container"; + break; + } + case UNFILED_RECORD_FOLDER: + { + result = "unfiled-record-folder"; + break; + } + default: + { + break; + } + } + } + + return result; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Override + public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) + { + getJsonConversionComponentCache().put(RM_SITE_EXISTS, false); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + public void onCreateNode(ChildAssociationRef childAssocRef) + { + getJsonConversionComponentCache().put(RM_SITE_EXISTS, true); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/CutoffEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/CutoffEvaluator.java index 2dc1a03b8d..bde931fe98 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/CutoffEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/CutoffEvaluator.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Cutoff indicator - * - * @author Roy Wetherall - */ -public class CutoffEvaluator extends BaseEvaluator -{ - private boolean isCutoff = true; - - public void setCutoff(boolean isCutoff) - { - this.isCutoff = isCutoff; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return (dispositionService.isDisposableItemCutoff(nodeRef) == isCutoff); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Cutoff indicator + * + * @author Roy Wetherall + */ +public class CutoffEvaluator extends BaseEvaluator +{ + private boolean isCutoff = true; + + public void setCutoff(boolean isCutoff) + { + this.isCutoff = isCutoff; + } + + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + return (dispositionService.isDisposableItemCutoff(nodeRef) == isCutoff); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/EditRecordMetadataActionEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/EditRecordMetadataActionEvaluator.java index cfbb24815a..c31c39b263 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/EditRecordMetadataActionEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/EditRecordMetadataActionEvaluator.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Additional action evaluator, disabling action if there are no record metadata aspects - * available for the node. - * - * @author Roy Wetherall - */ -public class EditRecordMetadataActionEvaluator extends BaseEvaluator -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return !recordService.getRecordMetadataAspects(nodeRef).isEmpty(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Additional action evaluator, disabling action if there are no record metadata aspects + * available for the node. + * + * @author Roy Wetherall + */ +public class EditRecordMetadataActionEvaluator extends BaseEvaluator +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + return !recordService.getRecordMetadataAspects(nodeRef).isEmpty(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FolderOpenClosedEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FolderOpenClosedEvaluator.java index 51ed8d89c0..1a6f044481 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FolderOpenClosedEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FolderOpenClosedEvaluator.java @@ -1,50 +1,50 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class FolderOpenClosedEvaluator extends BaseEvaluator -{ - private boolean expected = true; - - public void setExpected(boolean expected) - { - this.expected = expected; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return (recordFolderService.isRecordFolderClosed(nodeRef) == expected); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * @author Roy Wetherall + */ +public class FolderOpenClosedEvaluator extends BaseEvaluator +{ + private boolean expected = true; + + public void setExpected(boolean expected) + { + this.expected = expected; + } + + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + return (recordFolderService.isRecordFolderClosed(nodeRef) == expected); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluator.java index ef588f0d6d..9290b7c371 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluator.java @@ -1,68 +1,68 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Freeze indicator. - *

- * Only shows as frozen if the user can 'read' the holds - * that hold the nodeRef. - * - * @author Roy Wetherall - */ -public class FrozenEvaluator extends BaseEvaluator -{ - /** hold service */ - private HoldService holdService; - - /** - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * Only indicate the node is frozen if the user can 'read' at least one of the holds - * - * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - List heldBy = holdService.heldBy(nodeRef, true); - return !heldBy.isEmpty(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Freeze indicator. + *

+ * Only shows as frozen if the user can 'read' the holds + * that hold the nodeRef. + * + * @author Roy Wetherall + */ +public class FrozenEvaluator extends BaseEvaluator +{ + /** hold service */ + private HoldService holdService; + + /** + * @param holdService hold service + */ + public void setHoldService(HoldService holdService) + { + this.holdService = holdService; + } + + /** + * Only indicate the node is frozen if the user can 'read' at least one of the holds + * + * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + List heldBy = holdService.heldBy(nodeRef, true); + return !heldBy.isEmpty(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/HasAspectEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/HasAspectEvaluator.java index ae472f8457..f776b1fc16 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/HasAspectEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/HasAspectEvaluator.java @@ -1,54 +1,54 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Transfered indicator - * - * @author Roy Wetherall - */ -public class HasAspectEvaluator extends BaseEvaluator -{ - private String prefixAspectQNameString; - - public void setAspect(String aspect) - { - prefixAspectQNameString = aspect; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - QName aspect = QName.createQName(prefixAspectQNameString, namespaceService); - return nodeService.hasAspect(nodeRef, aspect); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Transfered indicator + * + * @author Roy Wetherall + */ +public class HasAspectEvaluator extends BaseEvaluator +{ + private String prefixAspectQNameString; + + public void setAspect(String aspect) + { + prefixAspectQNameString = aspect; + } + + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + QName aspect = QName.createQName(prefixAspectQNameString, namespaceService); + return nodeService.hasAspect(nodeRef, aspect); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java index 7caad56d12..7aa7972bac 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java @@ -1,76 +1,76 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -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.RegexQNamePattern; - -/** - * Determines whether a node has multiple parents within a file plan - * - * @author Roy Wetherall - * @since 2.0 - */ -public class MultiParentEvaluator extends BaseEvaluator -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(final NodeRef nodeRef) - { - return AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Boolean doWork() - { - - // get parent associations - List parents = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - int count = 0; - for (ChildAssociationRef parent : parents) - { - // count file plan component parents - if (nodeService.hasAspect(parent.getParentRef(), ASPECT_FILE_PLAN_COMPONENT)) - { - count++; - } - } - - // return true if more than one - return (count > 1); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +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.RegexQNamePattern; + +/** + * Determines whether a node has multiple parents within a file plan + * + * @author Roy Wetherall + * @since 2.0 + */ +public class MultiParentEvaluator extends BaseEvaluator +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected boolean evaluateImpl(final NodeRef nodeRef) + { + return AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Boolean doWork() + { + + // get parent associations + List parents = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + int count = 0; + for (ChildAssociationRef parent : parents) + { + // count file plan component parents + if (nodeService.hasAspect(parent.getParentRef(), ASPECT_FILE_PLAN_COMPONENT)) + { + count++; + } + } + + // return true if more than one + return (count > 1); + } + }); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java index 1c96dc2cb4..cfb469d30a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - */ -public class NonElectronicEvaluator extends BaseEvaluator -{ - private DictionaryService dictionaryService; - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - QName qName = nodeService.getType(nodeRef); - if (qName != null && dictionaryService.isSubClass(qName, TYPE_NON_ELECTRONIC_DOCUMENT)) - { - result = true; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * @author Roy Wetherall + */ +public class NonElectronicEvaluator extends BaseEvaluator +{ + private DictionaryService dictionaryService; + + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + QName qName = nodeService.getType(nodeRef); + if (qName != null && dictionaryService.isSubClass(qName, TYPE_NON_ELECTRONIC_DOCUMENT)) + { + result = true; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java index 3b844b893f..af3b49344b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Split EMail action evaluator - * - * @author Roy Wetherall - */ -public class SplitEmailActionEvaluator extends BaseEvaluator -{ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - if (!recordService.isDeclared(nodeRef)) - { - ContentData contentData = (ContentData)nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - if (contentData != null) - { - String mimetype = contentData.getMimetype(); - if (mimetype != null && - (MimetypeMap.MIMETYPE_RFC822.equals(mimetype) || - MimetypeMap.MIMETYPE_OUTLOOK_MSG.equals(mimetype))) - { - result = true; - } - } - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Split EMail action evaluator + * + * @author Roy Wetherall + */ +public class SplitEmailActionEvaluator extends BaseEvaluator +{ + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + if (!recordService.isDeclared(nodeRef)) + { + ContentData contentData = (ContentData)nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); + if (contentData != null) + { + String mimetype = contentData.getMimetype(); + if (mimetype != null && + (MimetypeMap.MIMETYPE_RFC822.equals(mimetype) || + MimetypeMap.MIMETYPE_OUTLOOK_MSG.equals(mimetype))) + { + result = true; + } + } + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java index 2df8663cd1..02cf41cfbc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java @@ -1,125 +1,125 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Evaluates whether the node in question is transferring is either a transfer or accession. - * - * @author Roy Wetherall - */ -public class TransferEvaluator extends BaseEvaluator -{ - /** Logger */ - private static Log logger = LogFactory.getLog(TransferEvaluator.class); - - /** indicates whether we are looking for accessions or transfers */ - private boolean transferAccessionIndicator = false; - - /** - * @param transferAccessionIndicator true if accession, false otherwise - */ - public void setTransferAccessionIndicator(boolean transferAccessionIndicator) - { - this.transferAccessionIndicator = transferAccessionIndicator; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - boolean result = false; - - NodeRef transfer = getTransferNodeRef(nodeRef); - if (transfer != null) - { - try - { - boolean actual = ((Boolean)nodeService.getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue(); - result = (actual == transferAccessionIndicator); - } - catch (AccessDeniedException ade) - { - logger.info("The user '" - + AuthenticationUtil.getFullyAuthenticatedUser() - + "' does not have permissions on the node '" - + transfer + "'."); - } - } - - return result; - } - - /** - * Helper method to get the transfer node reference. - *

- * Takes into account records in tranferred record folders. - * - * @param nodeRef node reference - * @return {@link NodeRef} transfer node - */ - private NodeRef getTransferNodeRef(NodeRef nodeRef) - { - NodeRef result = null; - - List parents = nodeService.getParentAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - if (parents.size() == 1) - { - result = parents.get(0).getParentRef(); - } - else - { - if (recordService.isRecord(nodeRef)) - { - for (NodeRef recordFolder : recordFolderService.getRecordFolders(nodeRef)) - { - result = getTransferNodeRef(recordFolder); - if (result != null) - { - break; - } - } - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Evaluates whether the node in question is transferring is either a transfer or accession. + * + * @author Roy Wetherall + */ +public class TransferEvaluator extends BaseEvaluator +{ + /** Logger */ + private static Log logger = LogFactory.getLog(TransferEvaluator.class); + + /** indicates whether we are looking for accessions or transfers */ + private boolean transferAccessionIndicator = false; + + /** + * @param transferAccessionIndicator true if accession, false otherwise + */ + public void setTransferAccessionIndicator(boolean transferAccessionIndicator) + { + this.transferAccessionIndicator = transferAccessionIndicator; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + boolean result = false; + + NodeRef transfer = getTransferNodeRef(nodeRef); + if (transfer != null) + { + try + { + boolean actual = ((Boolean)nodeService.getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue(); + result = (actual == transferAccessionIndicator); + } + catch (AccessDeniedException ade) + { + logger.info("The user '" + + AuthenticationUtil.getFullyAuthenticatedUser() + + "' does not have permissions on the node '" + + transfer + "'."); + } + } + + return result; + } + + /** + * Helper method to get the transfer node reference. + *

+ * Takes into account records in tranferred record folders. + * + * @param nodeRef node reference + * @return {@link NodeRef} transfer node + */ + private NodeRef getTransferNodeRef(NodeRef nodeRef) + { + NodeRef result = null; + + List parents = nodeService.getParentAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + if (parents.size() == 1) + { + result = parents.get(0).getParentRef(); + } + else + { + if (recordService.isRecord(nodeRef)) + { + for (NodeRef recordFolder : recordFolderService.getRecordFolders(nodeRef)) + { + result = getTransferNodeRef(recordFolder); + if (result != null) + { + break; + } + } + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TrueEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TrueEvaluator.java index 9d2705e7e1..c8d17fa77c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TrueEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TrueEvaluator.java @@ -1,45 +1,45 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Cutoff indicator - * - * @author Roy Wetherall - */ -public class TrueEvaluator extends BaseEvaluator -{ - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return true; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Cutoff indicator + * + * @author Roy Wetherall + */ +public class TrueEvaluator extends BaseEvaluator +{ + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + return true; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/VitalRecordEvaluator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/VitalRecordEvaluator.java index 9a3fffeb83..c29ce7acd4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/VitalRecordEvaluator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/VitalRecordEvaluator.java @@ -1,51 +1,51 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - */ -public class VitalRecordEvaluator extends BaseEvaluator -{ - private VitalRecordService vitalRecordService; - - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - @Override - protected boolean evaluateImpl(NodeRef nodeRef) - { - return vitalRecordService.isVitalRecord(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * @author Roy Wetherall + */ +public class VitalRecordEvaluator extends BaseEvaluator +{ + private VitalRecordService vitalRecordService; + + public void setVitalRecordService(VitalRecordService vitalRecordService) + { + this.vitalRecordService = vitalRecordService; + } + + @Override + protected boolean evaluateImpl(NodeRef nodeRef) + { + return vitalRecordService.isVitalRecord(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java index accd90e76a..d2d21414d4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java @@ -1,90 +1,90 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.annotation.BehaviourRegistry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Convenient base class for behaviour beans. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class BaseBehaviourBean extends ServiceBaseImpl - implements RecordsManagementModel, - BehaviourRegistry -{ - /** Logger */ - protected static final Log LOGGER = LogFactory.getLog(BaseBehaviourBean.class); - - /** behaviour filter */ - protected BehaviourFilter behaviourFilter; - - /** behaviour map */ - protected Map behaviours = new HashMap(7); - - /** - * @param behaviourFilter behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @see org.alfresco.repo.policy.annotation.BehaviourRegistry#registerBehaviour(java.lang.String, org.alfresco.repo.policy.Behaviour) - */ - @Override - public void registerBehaviour(String name, org.alfresco.repo.policy.Behaviour behaviour) - { - if (behaviours.containsKey(name)) - { - throw new AlfrescoRuntimeException("Can not register behaviour, because name " + name + "has already been used."); - } - - behaviours.put(name, behaviour); - } - - /** - * @see org.alfresco.repo.policy.annotation.BehaviourRegistry#getBehaviour(java.lang.String) - */ - @Override - public org.alfresco.repo.policy.Behaviour getBehaviour(String name) - { - return behaviours.get(name); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.policy.annotation.BehaviourRegistry; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Convenient base class for behaviour beans. + * + * @author Roy Wetherall + * @since 2.2 + */ +public abstract class BaseBehaviourBean extends ServiceBaseImpl + implements RecordsManagementModel, + BehaviourRegistry +{ + /** Logger */ + protected static final Log LOGGER = LogFactory.getLog(BaseBehaviourBean.class); + + /** behaviour filter */ + protected BehaviourFilter behaviourFilter; + + /** behaviour map */ + protected Map behaviours = new HashMap(7); + + /** + * @param behaviourFilter behaviour filter + */ + public void setBehaviourFilter(BehaviourFilter behaviourFilter) + { + this.behaviourFilter = behaviourFilter; + } + + /** + * @see org.alfresco.repo.policy.annotation.BehaviourRegistry#registerBehaviour(java.lang.String, org.alfresco.repo.policy.Behaviour) + */ + @Override + public void registerBehaviour(String name, org.alfresco.repo.policy.Behaviour behaviour) + { + if (behaviours.containsKey(name)) + { + throw new AlfrescoRuntimeException("Can not register behaviour, because name " + name + "has already been used."); + } + + behaviours.put(name, behaviour); + } + + /** + * @see org.alfresco.repo.policy.annotation.BehaviourRegistry#getBehaviour(java.lang.String) + */ + @Override + public org.alfresco.repo.policy.Behaviour getBehaviour(String name) + { + return behaviours.get(name); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java index d06332040f..5e168828d3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/CustomisableTypesBootstrap.java @@ -1,89 +1,89 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Bootstrap bean that indicates that the specified types or aspects are - * customizable. - * - * @author Roy Wetherall - * @since 2.0 - */ -public class CustomisableTypesBootstrap -{ - /** Records management admin service */ - private RecordsManagementAdminService recordsManagementAdminService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** List of types and aspects to register as customisable */ - private List customisable; - - /** - * @param recordsManagementAdminService records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param customizable list of types and aspects to register as customisable - */ - public void setCustomisable(List customisable) - { - this.customisable = customisable; - } - - /** - * Bean initialisation method - */ - public void init() - { - for (String customType : customisable) - { - QName customTypeQName = QName.createQName(customType, namespaceService); - recordsManagementAdminService.makeCustomisable(customTypeQName); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Bootstrap bean that indicates that the specified types or aspects are + * customizable. + * + * @author Roy Wetherall + * @since 2.0 + */ +public class CustomisableTypesBootstrap +{ + /** Records management admin service */ + private RecordsManagementAdminService recordsManagementAdminService; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** List of types and aspects to register as customisable */ + private List customisable; + + /** + * @param recordsManagementAdminService records management admin service + */ + public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) + { + this.recordsManagementAdminService = recordsManagementAdminService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param customizable list of types and aspects to register as customisable + */ + public void setCustomisable(List customisable) + { + this.customisable = customisable; + } + + /** + * Bean initialisation method + */ + public void init() + { + for (String customType : customisable) + { + QName customTypeQName = QName.createQName(customType, namespaceService); + recordsManagementAdminService.makeCustomisable(customTypeQName); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java index d21b67036c..7461b5cdaf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java @@ -1,67 +1,67 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.namespace.QName; - -/** - * Helper class containing records management custom model qualified names - * - * @author Gavin Cornwell - */ -@AlfrescoPublicApi -public interface RecordsManagementCustomModel -{ - // Namespace details - String RM_CUSTOM_URI = "http://www.alfresco.org/model/rmcustom/1.0"; - String RM_CUSTOM_PREFIX = "rmc"; - - // Model - QName RM_CUSTOM_MODEL = QName.createQName(RM_CUSTOM_URI, "rmcustom"); - - // Custom constraint for Supplemental Marking List - QName CONSTRAINT_CUSTOM_SMLIST = QName.createQName(RM_CUSTOM_URI, "smList"); - - // Custom property for for Supplemental Marking List - QName PROP_SUPPLEMENTAL_MARKING_LIST = QName.createQName(RM_CUSTOM_URI, "supplementalMarkingList"); - - // Supplemental Marking List aspect - QName ASPECT_SUPPLEMENTAL_MARKING_LIST = QName.createQName(RM_CUSTOM_URI, "customSupplementalMarkingList"); - - // Custom associations aspect - QName ASPECT_CUSTOM_ASSOCIATIONS = QName.createQName(RM_CUSTOM_URI, "customAssocs"); - - // Some Custom references which are present on system startup. - QName CUSTOM_REF_VERSIONS = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions"); - QName CUSTOM_REF_SUPERSEDES = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "supersedes"); - QName CUSTOM_REF_OBSOLETES = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "obsoletes"); - QName CUSTOM_REF_SUPPORTS = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "supports"); - QName CUSTOM_REF_CROSSREFERENCE = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "crossreference"); - QName CUSTOM_REF_RENDITION = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "rendition"); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.namespace.QName; + +/** + * Helper class containing records management custom model qualified names + * + * @author Gavin Cornwell + */ +@AlfrescoPublicApi +public interface RecordsManagementCustomModel +{ + // Namespace details + String RM_CUSTOM_URI = "http://www.alfresco.org/model/rmcustom/1.0"; + String RM_CUSTOM_PREFIX = "rmc"; + + // Model + QName RM_CUSTOM_MODEL = QName.createQName(RM_CUSTOM_URI, "rmcustom"); + + // Custom constraint for Supplemental Marking List + QName CONSTRAINT_CUSTOM_SMLIST = QName.createQName(RM_CUSTOM_URI, "smList"); + + // Custom property for for Supplemental Marking List + QName PROP_SUPPLEMENTAL_MARKING_LIST = QName.createQName(RM_CUSTOM_URI, "supplementalMarkingList"); + + // Supplemental Marking List aspect + QName ASPECT_SUPPLEMENTAL_MARKING_LIST = QName.createQName(RM_CUSTOM_URI, "customSupplementalMarkingList"); + + // Custom associations aspect + QName ASPECT_CUSTOM_ASSOCIATIONS = QName.createQName(RM_CUSTOM_URI, "customAssocs"); + + // Some Custom references which are present on system startup. + QName CUSTOM_REF_VERSIONS = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions"); + QName CUSTOM_REF_SUPERSEDES = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "supersedes"); + QName CUSTOM_REF_OBSOLETES = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "obsoletes"); + QName CUSTOM_REF_SUPPORTS = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "supports"); + QName CUSTOM_REF_CROSSREFERENCE = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "crossreference"); + QName CUSTOM_REF_RENDITION = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "rendition"); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java index c6b6f15a8a..082b626752 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java @@ -1,281 +1,281 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.namespace.QName; - -/** - * Helper class containing records management qualified names - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public interface RecordsManagementModel extends RecordsManagementCustomModel -{ - // Namespace details - String RM_URI = "http://www.alfresco.org/model/recordsmanagement/1.0"; - String RM_PREFIX = "rma"; - - // Model - QName RM_MODEL = QName.createQName(RM_URI, "recordsmanagement"); - - // RM Site - QName TYPE_RM_SITE = QName.createQName(RM_URI, "rmsite"); - - // Caveat config - QName TYPE_CAVEAT_CONFIG = QName.createQName(RM_URI, "caveatConfig"); - - QName ASPECT_CAVEAT_CONFIG_ROOT = QName.createQName(RM_URI, "caveatConfigRoot"); - QName ASSOC_CAVEAT_CONFIG = QName.createQName(RM_URI, "caveatConfigAssoc"); - - // Email config - QName TYPE_EMAIL_CONFIG = QName.createQName(RM_URI, "emailConfig"); - QName ASPECT_EMAIL_CONFIG_ROOT = QName.createQName(RM_URI, "emailConfigRoot"); - QName ASSOC_EMAIL_CONFIG = QName.createQName(RM_URI, "emailConfigAssoc"); - - // Records management container - QName TYPE_RECORDS_MANAGEMENT_CONTAINER = QName.createQName(RM_URI, "recordsManagementContainer"); - - // Record Category - QName TYPE_RECORD_CATEGORY = QName.createQName(RM_URI, "recordCategory"); - - // Records management root container - QName TYPE_FILE_PLAN = QName.createQName(RM_URI, "filePlan"); - - // Unfiled record container - QName TYPE_UNFILED_RECORD_CONTAINER = QName.createQName(RM_URI, "unfiledRecordContainer"); - - // Unfiled record folder - QName TYPE_UNFILED_RECORD_FOLDER = QName.createQName(RM_URI, "unfiledRecordFolder"); - - // Hold container - QName TYPE_HOLD_CONTAINER = QName.createQName(RM_URI, "holdContainer"); - - // Transfer container - QName TYPE_TRANSFER_CONTAINER = QName.createQName(RM_URI, "transferContainer"); - - // Disposition instructions aspect - QName ASPECT_SCHEDULED = QName.createQName(RM_URI, "scheduled"); - QName ASSOC_DISPOSITION_SCHEDULE = QName.createQName(RM_URI, "dispositionSchedule"); - - // Disposition definition type - QName TYPE_DISPOSITION_SCHEDULE = QName.createQName(RM_URI, "dispositionSchedule"); - QName PROP_DISPOSITION_AUTHORITY = QName.createQName(RM_URI, "dispositionAuthority"); - QName PROP_DISPOSITION_INSTRUCTIONS = QName.createQName(RM_URI, "dispositionInstructions"); - QName PROP_RECORD_LEVEL_DISPOSITION = QName.createQName(RM_URI, "recordLevelDisposition"); - QName ASSOC_DISPOSITION_ACTION_DEFINITIONS = QName.createQName(RM_URI, "dispositionActionDefinitions"); - - // Disposition action type - QName TYPE_DISPOSITION_ACTION_DEFINITION = QName.createQName(RM_URI, "dispositionActionDefinition"); - QName PROP_DISPOSITION_ACTION_NAME = QName.createQName(RM_URI, "dispositionActionName"); - QName PROP_DISPOSITION_DESCRIPTION = QName.createQName(RM_URI, "dispositionDescription"); - QName PROP_DISPOSITION_PERIOD = QName.createQName(RM_URI, "dispositionPeriod"); - QName PROP_DISPOSITION_PERIOD_PROPERTY = QName.createQName(RM_URI, "dispositionPeriodProperty"); - QName PROP_DISPOSITION_EVENT = QName.createQName(RM_URI, "dispositionEvent"); - QName PROP_DISPOSITION_EVENT_COMBINATION = QName.createQName(RM_URI, "dispositionEventCombination"); - QName PROP_DISPOSITION_LOCATION = QName.createQName(RM_URI, "dispositionLocation"); - QName PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY = QName.createQName(RM_URI, "dispositionActionGhostOnDestroy"); - - // Records folder - QName TYPE_RECORD_FOLDER = QName.createQName(RM_URI, "recordFolder"); - QName PROP_IS_CLOSED = QName.createQName(RM_URI, "isClosed"); - - // Declared record aspect - QName ASPECT_DECLARED_RECORD = QName.createQName(RM_URI, "declaredRecord"); - QName PROP_DECLARED_AT = QName.createQName(RM_URI, "declaredAt"); - QName PROP_DECLARED_BY = QName.createQName(RM_URI, "declaredBy"); - - // Record aspect - QName ASPECT_RECORD = QName.createQName(RM_URI, "record"); - QName PROP_DATE_FILED = QName.createQName(RM_URI, "dateFiled"); - QName PROP_ORIGIONAL_NAME = QName.createQName(RM_URI, "origionalName"); - - // Common record details - QName PROP_LOCATION = QName.createQName(RM_URI, "location"); - - // Fileable aspect - QName ASPECT_FILABLE = QName.createQName(RM_URI, "fileable"); - - // Record component identifier aspect - QName ASPECT_RECORD_COMPONENT_ID = QName.createQName(RM_URI, "recordComponentIdentifier"); - QName PROP_IDENTIFIER = QName.createQName(RM_URI, "identifier"); - QName PROP_DB_UNIQUENESS_ID = QName.createQName(RM_URI, "dbUniquenessId"); - - // Vital record definition aspect - QName ASPECT_VITAL_RECORD_DEFINITION = QName.createQName(RM_URI, "vitalRecordDefinition"); - QName PROP_VITAL_RECORD_INDICATOR = QName.createQName(RM_URI, "vitalRecordIndicator"); - QName PROP_REVIEW_PERIOD = QName.createQName(RM_URI, "reviewPeriod"); - - // Vital record aspect - QName ASPECT_VITAL_RECORD = QName.createQName(RM_URI, "vitalRecord"); - QName PROP_REVIEW_AS_OF = QName.createQName(RM_URI, "reviewAsOf"); - QName PROP_NOTIFICATION_ISSUED = QName.createQName(RM_URI, "notificationIssued"); - - // Cut off aspect - QName ASPECT_CUT_OFF = QName.createQName(RM_URI, "cutOff"); - QName PROP_CUT_OFF_DATE = QName.createQName(RM_URI, "cutOffDate"); - - // Uncut off aspect - QName ASPECT_UNCUT_OFF = QName.createQName(RM_URI, "uncutOff"); - - // Transferred aspect - QName ASPECT_TRANSFERRED = QName.createQName(RM_URI, "transferred"); - - // Ascended aspect - QName ASPECT_ASCENDED = QName.createQName(RM_URI, "ascended"); - - // Disposition schedule aspect - QName ASPECT_DISPOSITION_LIFECYCLE = QName.createQName(RM_URI, "dispositionLifecycle"); - QName ASSOC_NEXT_DISPOSITION_ACTION = QName.createQName(RM_URI, "nextDispositionAction"); - QName ASSOC_DISPOSITION_ACTION_HISTORY = QName.createQName(RM_URI, "dispositionActionHistory"); - - // Disposition action type - QName TYPE_DISPOSITION_ACTION = QName.createQName(RM_URI, "dispositionAction"); - QName PROP_DISPOSITION_ACTION_ID = QName.createQName(RM_URI, "dispositionActionId"); - QName PROP_DISPOSITION_ACTION = QName.createQName(RM_URI, "dispositionAction"); - QName PROP_DISPOSITION_AS_OF = QName.createQName(RM_URI, "dispositionAsOf"); - QName PROP_DISPOSITION_EVENTS_ELIGIBLE = QName.createQName(RM_URI, "dispositionEventsEligible"); - QName PROP_DISPOSITION_ACTION_STARTED_AT = QName.createQName(RM_URI, "dispositionActionStartedAt"); - QName PROP_DISPOSITION_ACTION_STARTED_BY = QName.createQName(RM_URI, "dispositionActionStartedBy"); - QName PROP_DISPOSITION_ACTION_COMPLETED_AT = QName.createQName(RM_URI, "dispositionActionCompletedAt"); - QName PROP_DISPOSITION_ACTION_COMPLETED_BY = QName.createQName(RM_URI, "dispositionActionCompletedBy"); - QName ASSOC_EVENT_EXECUTIONS = QName.createQName(RM_URI, "eventExecutions"); - - // Event execution type - QName TYPE_EVENT_EXECUTION = QName.createQName(RM_URI, "eventExecution"); - QName PROP_EVENT_EXECUTION_NAME = QName.createQName(RM_URI, "eventExecutionName"); - QName PROP_EVENT_EXECUTION_AUTOMATIC = QName.createQName(RM_URI, "eventExecutionAutomatic"); - QName PROP_EVENT_EXECUTION_COMPLETE = QName.createQName(RM_URI, "eventExecutionComplete"); - QName PROP_EVENT_EXECUTION_COMPLETED_BY = QName.createQName(RM_URI, "eventExecutionCompletedBy"); - QName PROP_EVENT_EXECUTION_COMPLETED_AT = QName.createQName(RM_URI, "eventExecutionCompletedAt"); - - // Custom RM data aspect - QName ASPECT_CUSTOM_RM_DATA = QName.createQName(RM_URI, "customRMData"); - - // marker aspect on all RM objercts (except caveat root) - QName ASPECT_FILE_PLAN_COMPONENT = QName.createQName(RM_URI, "filePlanComponent"); - QName PROP_ROOT_NODEREF = QName.createQName(RM_URI, "rootNodeRef"); - - // Non-electronic document - QName TYPE_NON_ELECTRONIC_DOCUMENT = QName.createQName(RM_URI, "nonElectronicDocument"); - - // Records management root aspect - QName ASPECT_RECORDS_MANAGEMENT_ROOT = QName.createQName(RM_URI, "recordsManagementRoot"); - // since 2.1 - @Deprecated - QName ASSOC_HOLDS = QName.createQName(RM_URI, "holds"); - // since 2.1 - @Deprecated - QName ASSOC_TRANSFERS = QName.createQName(RM_URI, "transfers"); - - // Hold type - QName TYPE_HOLD = QName.createQName(RM_URI, "hold"); - QName PROP_HOLD_REASON = QName.createQName(RM_URI, "holdReason"); - QName ASSOC_FROZEN_RECORDS = QName.createQName(RM_URI, "frozenRecords"); - - // Record meta data aspect - QName ASPECT_RECORD_META_DATA = QName.createQName(RM_URI, "recordMetaData"); - - // Frozen aspect - QName ASPECT_FROZEN = QName.createQName(RM_URI, "frozen"); - QName PROP_FROZEN_AT = QName.createQName(RM_URI, "frozenAt"); - QName PROP_FROZEN_BY = QName.createQName(RM_URI, "frozenBy"); - - // Transfer aspect - QName TYPE_TRANSFER = QName.createQName(RM_URI, "transfer"); - QName PROP_TRANSFER_ACCESSION_INDICATOR = QName.createQName(RM_URI, "transferAccessionIndicator"); - QName PROP_TRANSFER_PDF_INDICATOR = QName.createQName(RM_URI, "transferPDFIndicator"); - QName PROP_TRANSFER_LOCATION = QName.createQName(RM_URI, "transferLocation"); - QName ASSOC_TRANSFERRED = QName.createQName(RM_URI, "transferred"); - - // Transferring aspect - QName ASPECT_TRANSFERRING = QName.createQName(RM_URI, "transferring"); - - // Versioned record aspect - QName ASPECT_VERSIONED_RECORD = QName.createQName(RM_URI, "versionedRecord"); - - // Unpublished update aspect - QName ASPECT_UNPUBLISHED_UPDATE = QName.createQName(RM_URI, "unpublishedUpdate"); - QName PROP_UNPUBLISHED_UPDATE = QName.createQName(RM_URI, "unpublishedUpdate"); - QName PROP_UPDATE_TO = QName.createQName(RM_URI, "updateTo"); - QName PROP_UPDATED_PROPERTIES = QName.createQName(RM_URI, "updatedProperties"); - QName PROP_PUBLISH_IN_PROGRESS = QName.createQName(RM_URI, "publishInProgress"); - String UPDATE_TO_DISPOSITION_ACTION_DEFINITION = "dispositionActionDefinition"; - - // Ghosted aspect - QName ASPECT_GHOSTED = QName.createQName(RM_URI, "ghosted"); - - // Search rollup aspect - QName ASPECT_RM_SEARCH = QName.createQName(RM_URI, "recordSearch"); - QName PROP_RS_DISPOSITION_ACTION_NAME = QName.createQName(RM_URI, "recordSearchDispositionActionName"); - QName PROP_RS_DISPOSITION_ACTION_AS_OF = QName.createQName(RM_URI, "recordSearchDispositionActionAsOf"); - QName PROP_RS_DISPOSITION_EVENTS_ELIGIBLE = QName.createQName(RM_URI, "recordSearchDispositionEventsEligible"); - QName PROP_RS_DISPOSITION_EVENTS = QName.createQName(RM_URI, "recordSearchDispositionEvents"); - QName PROP_RS_VITAL_RECORD_REVIEW_PERIOD = QName.createQName(RM_URI, "recordSearchVitalRecordReviewPeriod"); - QName PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION = QName.createQName(RM_URI, "recordSearchVitalRecordReviewPeriodExpression"); - QName PROP_RS_DISPOSITION_PERIOD = QName.createQName(RM_URI, "recordSearchDispositionPeriod"); - QName PROP_RS_DISPOSITION_PERIOD_EXPRESSION = QName.createQName(RM_URI, "recordSearchDispositionPeriodExpression"); - QName PROP_RS_HAS_DISPOITION_SCHEDULE = QName.createQName(RM_URI, "recordSearchHasDispositionSchedule"); - QName PROP_RS_DISPOITION_INSTRUCTIONS = QName.createQName(RM_URI, "recordSearchDispositionInstructions"); - QName PROP_RS_DISPOITION_AUTHORITY = QName.createQName(RM_URI, "recordSearchDispositionAuthority"); - /** @depreacted as of 2.2, because disposable items can now be in multiple holds */ - @Deprecated - QName PROP_RS_HOLD_REASON = QName.createQName(RM_URI, "recordSearchHoldReason"); - - // Loaded Data Set Ids - QName ASPECT_LOADED_DATA_SET_ID = QName.createQName(RM_URI, "loadedDataSetId"); - QName PROP_LOADED_DATA_SET_IDS = QName.createQName(RM_URI, "loadedDataSetIds"); - - // Extended security aspect - // @deprecated as of 2.5, because of performance issues - @Deprecated QName ASPECT_EXTENDED_SECURITY = QName.createQName(RM_URI, "extendedSecurity"); - @Deprecated QName PROP_READERS = QName.createQName(RM_URI, "readers"); - @Deprecated QName PROP_WRITERS = QName.createQName(RM_URI, "writers"); - - // Originating details of a record - QName ASPECT_RECORD_ORIGINATING_DETAILS = QName.createQName(RM_URI, "recordOriginatingDetails"); - QName PROP_RECORD_ORIGINATING_USER_ID = QName.createQName(RM_URI, "recordOriginatingUserId"); - QName PROP_RECORD_ORIGINATING_CREATION_DATE = QName.createQName(RM_URI, "recordOriginatingCreationDate"); - QName PROP_RECORD_ORIGINATING_LOCATION = QName.createQName(RM_URI, "recordOriginatingLocation"); - - // Rejection details of a record - QName ASPECT_RECORD_REJECTION_DETAILS = QName.createQName(RM_URI, "recordRejectionDetails"); - QName PROP_RECORD_REJECTION_USER_ID = QName.createQName(RM_URI, "recordRejectionUserId"); - QName PROP_RECORD_REJECTION_DATE = QName.createQName(RM_URI, "recordRejectionDate"); - QName PROP_RECORD_REJECTION_REASON = QName.createQName(RM_URI, "recordRejectionReason"); - - // Held children aspect - // @since 2.2 - QName ASPECT_HELD_CHILDREN = QName.createQName(RM_URI, "heldChildren"); - QName PROP_HELD_CHILDREN_COUNT = QName.createQName(RM_URI, "heldChildrenCount"); - - // Countable aspect - QName ASPECT_COUNTABLE = QName.createQName(RM_URI, "countable"); - QName PROP_COUNT = QName.createQName(RM_URI, "count"); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.namespace.QName; + +/** + * Helper class containing records management qualified names + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface RecordsManagementModel extends RecordsManagementCustomModel +{ + // Namespace details + String RM_URI = "http://www.alfresco.org/model/recordsmanagement/1.0"; + String RM_PREFIX = "rma"; + + // Model + QName RM_MODEL = QName.createQName(RM_URI, "recordsmanagement"); + + // RM Site + QName TYPE_RM_SITE = QName.createQName(RM_URI, "rmsite"); + + // Caveat config + QName TYPE_CAVEAT_CONFIG = QName.createQName(RM_URI, "caveatConfig"); + + QName ASPECT_CAVEAT_CONFIG_ROOT = QName.createQName(RM_URI, "caveatConfigRoot"); + QName ASSOC_CAVEAT_CONFIG = QName.createQName(RM_URI, "caveatConfigAssoc"); + + // Email config + QName TYPE_EMAIL_CONFIG = QName.createQName(RM_URI, "emailConfig"); + QName ASPECT_EMAIL_CONFIG_ROOT = QName.createQName(RM_URI, "emailConfigRoot"); + QName ASSOC_EMAIL_CONFIG = QName.createQName(RM_URI, "emailConfigAssoc"); + + // Records management container + QName TYPE_RECORDS_MANAGEMENT_CONTAINER = QName.createQName(RM_URI, "recordsManagementContainer"); + + // Record Category + QName TYPE_RECORD_CATEGORY = QName.createQName(RM_URI, "recordCategory"); + + // Records management root container + QName TYPE_FILE_PLAN = QName.createQName(RM_URI, "filePlan"); + + // Unfiled record container + QName TYPE_UNFILED_RECORD_CONTAINER = QName.createQName(RM_URI, "unfiledRecordContainer"); + + // Unfiled record folder + QName TYPE_UNFILED_RECORD_FOLDER = QName.createQName(RM_URI, "unfiledRecordFolder"); + + // Hold container + QName TYPE_HOLD_CONTAINER = QName.createQName(RM_URI, "holdContainer"); + + // Transfer container + QName TYPE_TRANSFER_CONTAINER = QName.createQName(RM_URI, "transferContainer"); + + // Disposition instructions aspect + QName ASPECT_SCHEDULED = QName.createQName(RM_URI, "scheduled"); + QName ASSOC_DISPOSITION_SCHEDULE = QName.createQName(RM_URI, "dispositionSchedule"); + + // Disposition definition type + QName TYPE_DISPOSITION_SCHEDULE = QName.createQName(RM_URI, "dispositionSchedule"); + QName PROP_DISPOSITION_AUTHORITY = QName.createQName(RM_URI, "dispositionAuthority"); + QName PROP_DISPOSITION_INSTRUCTIONS = QName.createQName(RM_URI, "dispositionInstructions"); + QName PROP_RECORD_LEVEL_DISPOSITION = QName.createQName(RM_URI, "recordLevelDisposition"); + QName ASSOC_DISPOSITION_ACTION_DEFINITIONS = QName.createQName(RM_URI, "dispositionActionDefinitions"); + + // Disposition action type + QName TYPE_DISPOSITION_ACTION_DEFINITION = QName.createQName(RM_URI, "dispositionActionDefinition"); + QName PROP_DISPOSITION_ACTION_NAME = QName.createQName(RM_URI, "dispositionActionName"); + QName PROP_DISPOSITION_DESCRIPTION = QName.createQName(RM_URI, "dispositionDescription"); + QName PROP_DISPOSITION_PERIOD = QName.createQName(RM_URI, "dispositionPeriod"); + QName PROP_DISPOSITION_PERIOD_PROPERTY = QName.createQName(RM_URI, "dispositionPeriodProperty"); + QName PROP_DISPOSITION_EVENT = QName.createQName(RM_URI, "dispositionEvent"); + QName PROP_DISPOSITION_EVENT_COMBINATION = QName.createQName(RM_URI, "dispositionEventCombination"); + QName PROP_DISPOSITION_LOCATION = QName.createQName(RM_URI, "dispositionLocation"); + QName PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY = QName.createQName(RM_URI, "dispositionActionGhostOnDestroy"); + + // Records folder + QName TYPE_RECORD_FOLDER = QName.createQName(RM_URI, "recordFolder"); + QName PROP_IS_CLOSED = QName.createQName(RM_URI, "isClosed"); + + // Declared record aspect + QName ASPECT_DECLARED_RECORD = QName.createQName(RM_URI, "declaredRecord"); + QName PROP_DECLARED_AT = QName.createQName(RM_URI, "declaredAt"); + QName PROP_DECLARED_BY = QName.createQName(RM_URI, "declaredBy"); + + // Record aspect + QName ASPECT_RECORD = QName.createQName(RM_URI, "record"); + QName PROP_DATE_FILED = QName.createQName(RM_URI, "dateFiled"); + QName PROP_ORIGIONAL_NAME = QName.createQName(RM_URI, "origionalName"); + + // Common record details + QName PROP_LOCATION = QName.createQName(RM_URI, "location"); + + // Fileable aspect + QName ASPECT_FILABLE = QName.createQName(RM_URI, "fileable"); + + // Record component identifier aspect + QName ASPECT_RECORD_COMPONENT_ID = QName.createQName(RM_URI, "recordComponentIdentifier"); + QName PROP_IDENTIFIER = QName.createQName(RM_URI, "identifier"); + QName PROP_DB_UNIQUENESS_ID = QName.createQName(RM_URI, "dbUniquenessId"); + + // Vital record definition aspect + QName ASPECT_VITAL_RECORD_DEFINITION = QName.createQName(RM_URI, "vitalRecordDefinition"); + QName PROP_VITAL_RECORD_INDICATOR = QName.createQName(RM_URI, "vitalRecordIndicator"); + QName PROP_REVIEW_PERIOD = QName.createQName(RM_URI, "reviewPeriod"); + + // Vital record aspect + QName ASPECT_VITAL_RECORD = QName.createQName(RM_URI, "vitalRecord"); + QName PROP_REVIEW_AS_OF = QName.createQName(RM_URI, "reviewAsOf"); + QName PROP_NOTIFICATION_ISSUED = QName.createQName(RM_URI, "notificationIssued"); + + // Cut off aspect + QName ASPECT_CUT_OFF = QName.createQName(RM_URI, "cutOff"); + QName PROP_CUT_OFF_DATE = QName.createQName(RM_URI, "cutOffDate"); + + // Uncut off aspect + QName ASPECT_UNCUT_OFF = QName.createQName(RM_URI, "uncutOff"); + + // Transferred aspect + QName ASPECT_TRANSFERRED = QName.createQName(RM_URI, "transferred"); + + // Ascended aspect + QName ASPECT_ASCENDED = QName.createQName(RM_URI, "ascended"); + + // Disposition schedule aspect + QName ASPECT_DISPOSITION_LIFECYCLE = QName.createQName(RM_URI, "dispositionLifecycle"); + QName ASSOC_NEXT_DISPOSITION_ACTION = QName.createQName(RM_URI, "nextDispositionAction"); + QName ASSOC_DISPOSITION_ACTION_HISTORY = QName.createQName(RM_URI, "dispositionActionHistory"); + + // Disposition action type + QName TYPE_DISPOSITION_ACTION = QName.createQName(RM_URI, "dispositionAction"); + QName PROP_DISPOSITION_ACTION_ID = QName.createQName(RM_URI, "dispositionActionId"); + QName PROP_DISPOSITION_ACTION = QName.createQName(RM_URI, "dispositionAction"); + QName PROP_DISPOSITION_AS_OF = QName.createQName(RM_URI, "dispositionAsOf"); + QName PROP_DISPOSITION_EVENTS_ELIGIBLE = QName.createQName(RM_URI, "dispositionEventsEligible"); + QName PROP_DISPOSITION_ACTION_STARTED_AT = QName.createQName(RM_URI, "dispositionActionStartedAt"); + QName PROP_DISPOSITION_ACTION_STARTED_BY = QName.createQName(RM_URI, "dispositionActionStartedBy"); + QName PROP_DISPOSITION_ACTION_COMPLETED_AT = QName.createQName(RM_URI, "dispositionActionCompletedAt"); + QName PROP_DISPOSITION_ACTION_COMPLETED_BY = QName.createQName(RM_URI, "dispositionActionCompletedBy"); + QName ASSOC_EVENT_EXECUTIONS = QName.createQName(RM_URI, "eventExecutions"); + + // Event execution type + QName TYPE_EVENT_EXECUTION = QName.createQName(RM_URI, "eventExecution"); + QName PROP_EVENT_EXECUTION_NAME = QName.createQName(RM_URI, "eventExecutionName"); + QName PROP_EVENT_EXECUTION_AUTOMATIC = QName.createQName(RM_URI, "eventExecutionAutomatic"); + QName PROP_EVENT_EXECUTION_COMPLETE = QName.createQName(RM_URI, "eventExecutionComplete"); + QName PROP_EVENT_EXECUTION_COMPLETED_BY = QName.createQName(RM_URI, "eventExecutionCompletedBy"); + QName PROP_EVENT_EXECUTION_COMPLETED_AT = QName.createQName(RM_URI, "eventExecutionCompletedAt"); + + // Custom RM data aspect + QName ASPECT_CUSTOM_RM_DATA = QName.createQName(RM_URI, "customRMData"); + + // marker aspect on all RM objercts (except caveat root) + QName ASPECT_FILE_PLAN_COMPONENT = QName.createQName(RM_URI, "filePlanComponent"); + QName PROP_ROOT_NODEREF = QName.createQName(RM_URI, "rootNodeRef"); + + // Non-electronic document + QName TYPE_NON_ELECTRONIC_DOCUMENT = QName.createQName(RM_URI, "nonElectronicDocument"); + + // Records management root aspect + QName ASPECT_RECORDS_MANAGEMENT_ROOT = QName.createQName(RM_URI, "recordsManagementRoot"); + // since 2.1 + @Deprecated + QName ASSOC_HOLDS = QName.createQName(RM_URI, "holds"); + // since 2.1 + @Deprecated + QName ASSOC_TRANSFERS = QName.createQName(RM_URI, "transfers"); + + // Hold type + QName TYPE_HOLD = QName.createQName(RM_URI, "hold"); + QName PROP_HOLD_REASON = QName.createQName(RM_URI, "holdReason"); + QName ASSOC_FROZEN_RECORDS = QName.createQName(RM_URI, "frozenRecords"); + + // Record meta data aspect + QName ASPECT_RECORD_META_DATA = QName.createQName(RM_URI, "recordMetaData"); + + // Frozen aspect + QName ASPECT_FROZEN = QName.createQName(RM_URI, "frozen"); + QName PROP_FROZEN_AT = QName.createQName(RM_URI, "frozenAt"); + QName PROP_FROZEN_BY = QName.createQName(RM_URI, "frozenBy"); + + // Transfer aspect + QName TYPE_TRANSFER = QName.createQName(RM_URI, "transfer"); + QName PROP_TRANSFER_ACCESSION_INDICATOR = QName.createQName(RM_URI, "transferAccessionIndicator"); + QName PROP_TRANSFER_PDF_INDICATOR = QName.createQName(RM_URI, "transferPDFIndicator"); + QName PROP_TRANSFER_LOCATION = QName.createQName(RM_URI, "transferLocation"); + QName ASSOC_TRANSFERRED = QName.createQName(RM_URI, "transferred"); + + // Transferring aspect + QName ASPECT_TRANSFERRING = QName.createQName(RM_URI, "transferring"); + + // Versioned record aspect + QName ASPECT_VERSIONED_RECORD = QName.createQName(RM_URI, "versionedRecord"); + + // Unpublished update aspect + QName ASPECT_UNPUBLISHED_UPDATE = QName.createQName(RM_URI, "unpublishedUpdate"); + QName PROP_UNPUBLISHED_UPDATE = QName.createQName(RM_URI, "unpublishedUpdate"); + QName PROP_UPDATE_TO = QName.createQName(RM_URI, "updateTo"); + QName PROP_UPDATED_PROPERTIES = QName.createQName(RM_URI, "updatedProperties"); + QName PROP_PUBLISH_IN_PROGRESS = QName.createQName(RM_URI, "publishInProgress"); + String UPDATE_TO_DISPOSITION_ACTION_DEFINITION = "dispositionActionDefinition"; + + // Ghosted aspect + QName ASPECT_GHOSTED = QName.createQName(RM_URI, "ghosted"); + + // Search rollup aspect + QName ASPECT_RM_SEARCH = QName.createQName(RM_URI, "recordSearch"); + QName PROP_RS_DISPOSITION_ACTION_NAME = QName.createQName(RM_URI, "recordSearchDispositionActionName"); + QName PROP_RS_DISPOSITION_ACTION_AS_OF = QName.createQName(RM_URI, "recordSearchDispositionActionAsOf"); + QName PROP_RS_DISPOSITION_EVENTS_ELIGIBLE = QName.createQName(RM_URI, "recordSearchDispositionEventsEligible"); + QName PROP_RS_DISPOSITION_EVENTS = QName.createQName(RM_URI, "recordSearchDispositionEvents"); + QName PROP_RS_VITAL_RECORD_REVIEW_PERIOD = QName.createQName(RM_URI, "recordSearchVitalRecordReviewPeriod"); + QName PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION = QName.createQName(RM_URI, "recordSearchVitalRecordReviewPeriodExpression"); + QName PROP_RS_DISPOSITION_PERIOD = QName.createQName(RM_URI, "recordSearchDispositionPeriod"); + QName PROP_RS_DISPOSITION_PERIOD_EXPRESSION = QName.createQName(RM_URI, "recordSearchDispositionPeriodExpression"); + QName PROP_RS_HAS_DISPOITION_SCHEDULE = QName.createQName(RM_URI, "recordSearchHasDispositionSchedule"); + QName PROP_RS_DISPOITION_INSTRUCTIONS = QName.createQName(RM_URI, "recordSearchDispositionInstructions"); + QName PROP_RS_DISPOITION_AUTHORITY = QName.createQName(RM_URI, "recordSearchDispositionAuthority"); + /** @depreacted as of 2.2, because disposable items can now be in multiple holds */ + @Deprecated + QName PROP_RS_HOLD_REASON = QName.createQName(RM_URI, "recordSearchHoldReason"); + + // Loaded Data Set Ids + QName ASPECT_LOADED_DATA_SET_ID = QName.createQName(RM_URI, "loadedDataSetId"); + QName PROP_LOADED_DATA_SET_IDS = QName.createQName(RM_URI, "loadedDataSetIds"); + + // Extended security aspect + // @deprecated as of 2.5, because of performance issues + @Deprecated QName ASPECT_EXTENDED_SECURITY = QName.createQName(RM_URI, "extendedSecurity"); + @Deprecated QName PROP_READERS = QName.createQName(RM_URI, "readers"); + @Deprecated QName PROP_WRITERS = QName.createQName(RM_URI, "writers"); + + // Originating details of a record + QName ASPECT_RECORD_ORIGINATING_DETAILS = QName.createQName(RM_URI, "recordOriginatingDetails"); + QName PROP_RECORD_ORIGINATING_USER_ID = QName.createQName(RM_URI, "recordOriginatingUserId"); + QName PROP_RECORD_ORIGINATING_CREATION_DATE = QName.createQName(RM_URI, "recordOriginatingCreationDate"); + QName PROP_RECORD_ORIGINATING_LOCATION = QName.createQName(RM_URI, "recordOriginatingLocation"); + + // Rejection details of a record + QName ASPECT_RECORD_REJECTION_DETAILS = QName.createQName(RM_URI, "recordRejectionDetails"); + QName PROP_RECORD_REJECTION_USER_ID = QName.createQName(RM_URI, "recordRejectionUserId"); + QName PROP_RECORD_REJECTION_DATE = QName.createQName(RM_URI, "recordRejectionDate"); + QName PROP_RECORD_REJECTION_REASON = QName.createQName(RM_URI, "recordRejectionReason"); + + // Held children aspect + // @since 2.2 + QName ASPECT_HELD_CHILDREN = QName.createQName(RM_URI, "heldChildren"); + QName PROP_HELD_CHILDREN_COUNT = QName.createQName(RM_URI, "heldChildrenCount"); + + // Countable aspect + QName ASPECT_COUNTABLE = QName.createQName(RM_URI, "countable"); + QName PROP_COUNT = QName.createQName(RM_URI, "count"); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/AbstractDisposableItem.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/AbstractDisposableItem.java index e9052a691f..a83f090ae3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/AbstractDisposableItem.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/AbstractDisposableItem.java @@ -1,89 +1,89 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.behaviour; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Abstract disposable item, containing commonality between record and record folder. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class AbstractDisposableItem extends BaseBehaviourBean -{ - /** unwanted aspects */ - protected QName[] unwantedAspects = - { - ASPECT_VITAL_RECORD, - ASPECT_DISPOSITION_LIFECYCLE, - RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH - }; - - /** disposition service */ - protected DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Removes unwanted aspects - * - * @param nodeService - * @param nodeRef - */ - protected void cleanDisposableItem(NodeService nodeService, NodeRef nodeRef) - { - // Remove unwanted aspects - for (QName aspect : unwantedAspects) - { - if (nodeService.hasAspect(nodeRef, aspect)) - { - nodeService.removeAspect(nodeRef, aspect); - } - } - - // remove the current disposition action (if there is one) - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); - if (dispositionAction != null) - { - nodeService.deleteNode(dispositionAction.getNodeRef()); - } - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.behaviour; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; + +/** + * Abstract disposable item, containing commonality between record and record folder. + * + * @author Roy Wetherall + * @since 2.2 + */ +public abstract class AbstractDisposableItem extends BaseBehaviourBean +{ + /** unwanted aspects */ + protected QName[] unwantedAspects = + { + ASPECT_VITAL_RECORD, + ASPECT_DISPOSITION_LIFECYCLE, + RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH + }; + + /** disposition service */ + protected DispositionService dispositionService; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Removes unwanted aspects + * + * @param nodeService + * @param nodeRef + */ + protected void cleanDisposableItem(NodeService nodeService, NodeRef nodeRef) + { + // Remove unwanted aspects + for (QName aspect : unwantedAspects) + { + if (nodeService.hasAspect(nodeRef, aspect)) + { + nodeService.removeAspect(nodeRef, aspect); + } + } + + // remove the current disposition action (if there is one) + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef); + if (dispositionAction != null) + { + nodeService.deleteNode(dispositionAction.getNodeRef()); + } + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java index 0405853454..aacda376c7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java @@ -1,913 +1,913 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.behaviour; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionImpl; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.TransactionalResourceHelper; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Search behaviour class. - * - * Manages the collapse of data onto the supporting aspect on the record/record folder. - * - * @author Roy Wetherall - * @since 1.0 - */ -public class RecordsManagementSearchBehaviour implements RecordsManagementModel -{ - /** logger */ - private static Log logger = LogFactory.getLog(RecordsManagementSearchBehaviour.class); - - /** Policy component */ - private PolicyComponent policyComponent; - - /** Node service */ - private NodeService nodeService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Records management service registry */ - private RecordsManagementServiceRegistry recordsManagementServiceRegistry; - - /** Vital record service */ - private VitalRecordService vitalRecordService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Record service*/ - private RecordService recordService; - - /** - * @param nodeService the nodeService to set - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param policyComponent the policyComponent to set - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * @param recordsManagementServiceRegistry the records management service registry - */ - public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry recordsManagementServiceRegistry) - { - this.recordsManagementServiceRegistry = recordsManagementServiceRegistry; - } - - /** - * @param vitalRecordService vital record service - */ - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** on add search aspect behaviour */ - private JavaBehaviour onAddSearchAspect = new JavaBehaviour(this, "rmSearchAspectAdd", NotificationFrequency.TRANSACTION_COMMIT); - - /** disposition action behaviours */ - private JavaBehaviour jbDispositionActionCreate = new JavaBehaviour(this, "dispositionActionCreate", NotificationFrequency.TRANSACTION_COMMIT); - private JavaBehaviour jbDispositionActionPropertiesUpdate = new JavaBehaviour(this, "dispositionActionPropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT); - - /** disposition lifecycle behaviours */ - private JavaBehaviour jbDispositionLifeCycleAspect = new JavaBehaviour(this, "onAddDispositionLifecycleAspect", NotificationFrequency.TRANSACTION_COMMIT); - - /** disposition schedule behaviours */ - private JavaBehaviour jbDispositionSchedulePropertiesUpdate = new JavaBehaviour(this, "dispositionSchedulePropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT); - - /** event update behaviours */ - private JavaBehaviour jbEventExecutionUpdate = new JavaBehaviour(this, "eventExecutionUpdate", NotificationFrequency.TRANSACTION_COMMIT); - private JavaBehaviour jbEventExecutionDelete = new JavaBehaviour(this, "eventExecutionDelete", NotificationFrequency.TRANSACTION_COMMIT); - - /** Array of behaviours related to disposition schedule artifacts */ - private JavaBehaviour[] jbDispositionBehaviours = - { - jbDispositionActionCreate, - jbDispositionActionPropertiesUpdate, - jbDispositionSchedulePropertiesUpdate, - jbEventExecutionUpdate, - jbEventExecutionDelete, - jbDispositionLifeCycleAspect - }; - - /** - * Initialisation method - */ - public void init() - { - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), - TYPE_DISPOSITION_ACTION, - jbDispositionActionCreate); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), - TYPE_DISPOSITION_ACTION, - jbDispositionActionPropertiesUpdate); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), - TYPE_DISPOSITION_SCHEDULE, - jbDispositionSchedulePropertiesUpdate); - - this.policyComponent.bindAssociationBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), - TYPE_DISPOSITION_ACTION, - ASSOC_EVENT_EXECUTIONS, - jbEventExecutionUpdate); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"), - TYPE_EVENT_EXECUTION, - jbEventExecutionDelete); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), - ASPECT_RM_SEARCH, - onAddSearchAspect); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), - ASPECT_DISPOSITION_LIFECYCLE, - jbDispositionLifeCycleAspect); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), - ASPECT_RECORD, - new JavaBehaviour(this, "onAddRecordAspect", NotificationFrequency.TRANSACTION_COMMIT)); - - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), - TYPE_RECORD_FOLDER, - new JavaBehaviour(this, "recordFolderCreate", NotificationFrequency.TRANSACTION_COMMIT)); - - // Vital Records Review Details Rollup - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), - ASPECT_VITAL_RECORD_DEFINITION, - new JavaBehaviour(this, "vitalRecordDefintionAddAspect", NotificationFrequency.TRANSACTION_COMMIT)); - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), - ASPECT_VITAL_RECORD_DEFINITION, - new JavaBehaviour(this, "vitalRecordDefintionUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT)); - } - - /** - * Disabled disposition schedule behaviour - */ - public void disableDispositionScheduleBehaviour() - { - for (JavaBehaviour jb : jbDispositionBehaviours) - { - jb.disable(); - } - } - - /** - * Enables disposition schedule behaviour - */ - public void enableDispositionScheduleBehaviour() - { - for (JavaBehaviour jb : jbDispositionBehaviours) - { - jb.enable(); - } - } - - /** - * Ensures the search aspect for the given node is present, complete and correct. - * - * @param recordOrFolder node reference to record or record folder - */ - public void fixupSearchAspect(NodeRef recordOrFolder) - { - // for now only deal with record folders - if (recordFolderService.isRecordFolder(recordOrFolder)) - { - // ensure the search aspect is applied - applySearchAspect(recordOrFolder); - - // setup the properties relating to the disposition schedule - setupDispositionScheduleProperties(recordOrFolder); - - // setup the properties relating to the disposition lifecycle - DispositionAction da = dispositionService.getNextDispositionAction(recordOrFolder); - if (da != null) - { - updateDispositionActionProperties(recordOrFolder, da.getNodeRef()); - setupDispositionActionEvents(recordOrFolder, da); - } - - // setup the properties relating to the vital record indicator - setVitalRecordDefintionDetails(recordOrFolder); - } - } - - /** - * Updates the disposition action properties - * - * @param nodeRef node reference - * @param before value of properties before - * @param after value of properties after - */ - public void dispositionActionPropertiesUpdate(final NodeRef nodeRef, final Map before, final Map after) - { - if (nodeService.exists(nodeRef)) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); - if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) - { - // Get the record (or record folder) - NodeRef record = assoc.getParentRef(); - - // Apply the search aspect - applySearchAspect(record); - - // Update disposition properties - updateDispositionActionProperties(record, nodeRef); - } - - return null; - - }}, AuthenticationUtil.getSystemUserName()); - } - } - - /** - * Helper method to apply the search aspect - * - * @param nodeRef node reference - */ - private void applySearchAspect(NodeRef nodeRef) - { - onAddSearchAspect.disable(); - try - { - if (!nodeService.hasAspect(nodeRef, ASPECT_RM_SEARCH)) - { - nodeService.addAspect(nodeRef, ASPECT_RM_SEARCH , null); - - if (logger.isDebugEnabled()) - { - logger.debug("Added search aspect to node: " + nodeRef); - } - } - } - finally - { - onAddSearchAspect.enable(); - } - } - - /** - * On add record aspect behaviour implementation - * - * @param nodeRef node reference - * @param aspectTypeQName aspect type qname - */ - public void onAddRecordAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - applySearchAspect(nodeRef); - setupDispositionScheduleProperties(nodeRef); - } - - return null; - } - }); - } - - /** - * On addition of the disposition lifecycle aspect - * @param nodeRef - * @param aspectTypeQName - */ - public void onAddDispositionLifecycleAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - applySearchAspect(nodeRef); - setupDispositionScheduleProperties(nodeRef); - } - - return null; - } - }); - } - - /** - * On create record folder behaviour implmentation - * - * @param childAssocRef child association reference - */ - public void recordFolderCreate(final ChildAssociationRef childAssocRef) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() throws Exception - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (nodeService.exists(nodeRef)) - { - applySearchAspect(nodeRef); - setupDispositionScheduleProperties(nodeRef); - } - - return null; - } - }); - } - - /** - * Helper method to setup the disposition schedule properties - * - * @param recordOrFolder node reference of record or record folder - */ - private void setupDispositionScheduleProperties(NodeRef recordOrFolder) - { - if (!methodCached("setupDispositionScheduleProperties", recordOrFolder)) - { - DispositionSchedule ds = dispositionService.getDispositionSchedule(recordOrFolder); - if (ds == null) - { - nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, false); - } - else - { - nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, true); - setDispositionScheduleProperties(recordOrFolder, ds); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchHasDispositionSchedule for node " + recordOrFolder + - " to: " + (ds != null)); - } - } - } - - /** - * On disposition action create behaviour implementation - * - * @param childAssocRef child association reference - */ - public void dispositionActionCreate(final ChildAssociationRef childAssocRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - NodeRef child = childAssocRef.getChildRef(); - if (nodeService.exists(child) && - childAssocRef.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) - { - // Get the record (or record folder) - NodeRef record = childAssocRef.getParentRef(); - - // Apply the search aspect - applySearchAspect(record); - - // Update disposition properties - updateDispositionActionProperties(record, childAssocRef.getChildRef()); - - // Clear the events - nodeService.setProperty(record, PROP_RS_DISPOSITION_EVENTS, null); - } - - return null; - } - }); - } - - /** - * Helper method to determine whether a method has been called in this transaction - * already, or not. - *

- * Prevents work if we get unexpected behaviours firing. - * - * @param method method name (can be any unique string) - * @return boolean true if already called in this transaction, false otherwise - */ - private boolean methodCached(String method, NodeRef nodeRef) - { - boolean result = true; - Set methods = TransactionalResourceHelper.getSet("rm.seachrollup.methodCache"); - String key = method + "|" + nodeRef; - if (!methods.contains(key)) - { - result = false; - methods.add(key); - } - return result; - } - - /** - * On update disposition action properties behaviour implementation - * - * @param record record node reference - * @param dispositionAction disposition action - */ - private void updateDispositionActionProperties(NodeRef record, NodeRef dispositionAction) - { - if (!methodCached("updateDispositionActionProperties", record)) - { - Map props = nodeService.getProperties(record); - - DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction); - - props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName()); - props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate()); - props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE)); - - DispositionActionDefinition daDefinition = da.getDispositionActionDefinition(); - if (daDefinition != null) - { - Period period = daDefinition.getPeriod(); - if (period != null) - { - props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType()); - props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression()); - } - else - { - props.put(PROP_RS_DISPOSITION_PERIOD, null); - props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null); - } - } - - nodeService.setProperties(record, props); - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_ACTION_NAME)); - logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); - logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); - logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_PERIOD)); - logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " + - props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); - } - } - } - - /** - * On update of event execution information behaviour\ - * - * @param childAssocRef child association reference - * @param isNewNode true if a new node, false otherwise - */ - @SuppressWarnings("unchecked") - public void eventExecutionUpdate(ChildAssociationRef childAssocRef, boolean isNewNode) - { - NodeRef dispositionAction = childAssocRef.getParentRef(); - NodeRef eventExecution = childAssocRef.getChildRef(); - - if (nodeService.exists(dispositionAction) && - nodeService.exists(eventExecution)) - { - ChildAssociationRef assoc = nodeService.getPrimaryParent(dispositionAction); - if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) - { - // Get the record (or record folder) - NodeRef record = assoc.getParentRef(); - - // Apply the search aspect - applySearchAspect(record); - - Collection events = (Collection)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS); - if (events == null) - { - events = new ArrayList<>(1); - } - events.add((String)nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_NAME)); - nodeService.setProperty(record, PROP_RS_DISPOSITION_EVENTS, (Serializable)events); - } - } - } - - /** - * On event execution delete behaviour implementation. - * - * @param childAssocRef child association reference - * @param isNodeArchived true if node is archived on delete, false otherwise - */ - public void eventExecutionDelete(ChildAssociationRef childAssocRef, boolean isNodeArchived) - { - NodeRef dispositionActionNode = childAssocRef.getParentRef(); - - if (nodeService.exists(dispositionActionNode)) - { - ChildAssociationRef assoc = nodeService.getPrimaryParent(dispositionActionNode); - if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) - { - // Get the record (or record folder) - NodeRef record = assoc.getParentRef(); - - // Apply the search aspect - applySearchAspect(record); - - // make sure the list of events match the action definition - setupDispositionActionEvents(record, dispositionService.getNextDispositionAction(record)); - } - } - } - - /** - * Helper method to setup disposition action events. - * - * @param nodeRef node reference - * @param da disposition action - */ - private void setupDispositionActionEvents(NodeRef nodeRef, DispositionAction da) - { - if (!methodCached("setupDispositionActionEvents", nodeRef)) - { - if (da != null) - { - List eventNames = null; - List eventsList = da.getEventCompletionDetails(); - if (eventsList.size() > 0) - { - eventNames = new ArrayList(eventsList.size()); - for (EventCompletionDetails event : eventsList) - { - eventNames.add(event.getEventName()); - } - } - - // set the property - nodeService.setProperty(nodeRef, PROP_RS_DISPOSITION_EVENTS, (Serializable)eventNames); - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchDispositionEvents for node " + nodeRef + " to: " + eventNames); - } - } - } - } - - /** - * On add search aspect behaviour implementation. - * - * @param nodeRef node reference - * @param aspectTypeQName aspect type qname - */ - public void rmSearchAspectAdd(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef)) - { - // Initialise the search parameteres as required - setVitalRecordDefintionDetails(nodeRef); - } - - return null; - } - }); - } - - /** - * On add aspect vital record defintion behaviour implementation. - * - * @param nodeRef node reference - * @param aspectTypeQName aspect tyep qname - */ - public void vitalRecordDefintionAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - // Only care about record folders - if (nodeService.exists(nodeRef) && recordFolderService.isRecordFolder(nodeRef)) - { - updateVitalRecordDefinitionValues(nodeRef); - } - - return null; - } - }); - } - - /** - * On update vital record definition properties behaviour implementation. - * - * @param nodeRef node reference - * @param before before properties - * @param after after properties - */ - public void vitalRecordDefintionUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - @Override - public Void doWork() - { - // Only care about record folders - if (nodeService.exists(nodeRef) && recordFolderService.isRecordFolder(nodeRef)) - { - Set props = new HashSet(1); - props.add(PROP_REVIEW_PERIOD); - Set changed = determineChangedProps(before, after); - changed.retainAll(props); - if (!changed.isEmpty()) - { - updateVitalRecordDefinitionValues(nodeRef); - } - } - - return null; - } - }); - } - - /** - * Helper method to update the vital record defintion values - * - * @param nodeRef node reference - */ - private void updateVitalRecordDefinitionValues(NodeRef nodeRef) - { - if (!methodCached("updateVitalRecordDefinitionValues", nodeRef)) - { - // ensure the folder itself reflects the correct details - applySearchAspect(nodeRef); - setVitalRecordDefintionDetails(nodeRef); - - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - // Apply the search aspect - applySearchAspect(record); - - // Set the vital record definition details - setVitalRecordDefintionDetails(record); - } - } - } - - /** - * Helper method to set vital record definition details. - * - * @param nodeRef node reference - */ - private void setVitalRecordDefintionDetails(NodeRef nodeRef) - { - if (!methodCached("setVitalRecordDefinitionDetails", nodeRef)) - { - VitalRecordDefinition vrd = vitalRecordService.getVitalRecordDefinition(nodeRef); - - if (vrd != null && vrd.isEnabled() && vrd.getReviewPeriod() != null) - { - // Set the property values - nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, vrd.getReviewPeriod().getPeriodType()); - nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, vrd.getReviewPeriod().getExpression()); - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchVitalRecordReviewPeriod for node " + nodeRef + " to: " + - vrd.getReviewPeriod().getPeriodType()); - logger.debug("Set rma:recordSearchVitalRecordReviewPeriodExpression for node " + nodeRef + " to: " + - vrd.getReviewPeriod().getExpression()); - } - } - else - { - // Clear the vital record properties - nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, null); - nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, null); - } - } - } - - /** - * Updates the disposition schedule properties - * - * @param nodeRef node reference - * @param before properties before - * @param after properties after - */ - public void dispositionSchedulePropertiesUpdate(NodeRef nodeRef, Map before, Map after) - { - if (nodeService.exists(nodeRef)) - { - // create the schedule object and get the record category for it - DispositionSchedule schedule = new DispositionScheduleImpl(recordsManagementServiceRegistry, nodeService, nodeRef); - NodeRef recordCategoryNode = nodeService.getPrimaryParent(schedule.getNodeRef()).getParentRef(); - - if (schedule.isRecordLevelDisposition()) - { - for (NodeRef recordFolder : getRecordFolders(recordCategoryNode)) - { - for (NodeRef record : recordService.getRecords(recordFolder)) - { - applySearchAspect(record); - setDispositionScheduleProperties(record, schedule); - } - } - } - else - { - for (NodeRef recordFolder : getRecordFolders(recordCategoryNode)) - { - applySearchAspect(recordFolder); - setDispositionScheduleProperties(recordFolder, schedule); - } - } - } - } - - /** - * Helper method to set disposition schedule properties - * - * @param recordOrFolder node reference - * @param schedule dispostion schedule - */ - private void setDispositionScheduleProperties(NodeRef recordOrFolder, DispositionSchedule schedule) - { - if (schedule != null) - { - nodeService.setProperty(recordOrFolder, PROP_RS_DISPOITION_AUTHORITY, schedule.getDispositionAuthority()); - nodeService.setProperty(recordOrFolder, PROP_RS_DISPOITION_INSTRUCTIONS, schedule.getDispositionInstructions()); - - if (logger.isDebugEnabled()) - { - logger.debug("Set rma:recordSearchDispositionAuthority for node " + recordOrFolder + " to: " + schedule.getDispositionAuthority()); - logger.debug("Set rma:recordSearchDispositionInstructions for node " + recordOrFolder + " to: " + schedule.getDispositionInstructions()); - } - } - } - - /** - * This method compares the oldProps map against the newProps map and returns - * a set of QNames of the properties that have changed. Changed here means one of - *

    - *
  • the property has been removed
  • - *
  • the property has had its value changed
  • - *
  • the property has been added
  • - *
- */ - private Set determineChangedProps(Map oldProps, Map newProps) - { - Set result = new HashSet(); - for (Map.Entry entry : oldProps.entrySet()) - { - QName qn = entry.getKey(); - if (newProps.get(qn) == null || !newProps.get(qn).equals(entry.getValue())) - { - result.add(qn); - } - } - for (QName qn : newProps.keySet()) - { - if (oldProps.get(qn) == null) - { - result.add(qn); - } - } - - return result; - } - - /** - * Helper method to get the record folders contained in the provided record category. - * - * @param recordCategoryNode record category node reference - * @return List contained record folders - */ - private List getRecordFolders(NodeRef recordCategoryNode) - { - List results = new ArrayList(8); - - List folderAssocs = nodeService.getChildAssocs(recordCategoryNode, - ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef folderAssoc : folderAssocs) - { - NodeRef folder = folderAssoc.getChildRef(); - if (recordFolderService.isRecordFolder(folder)) - { - results.add(folder); - } - } - - return results; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.behaviour; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionImpl; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.TransactionalResourceHelper; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Search behaviour class. + * + * Manages the collapse of data onto the supporting aspect on the record/record folder. + * + * @author Roy Wetherall + * @since 1.0 + */ +public class RecordsManagementSearchBehaviour implements RecordsManagementModel +{ + /** logger */ + private static Log logger = LogFactory.getLog(RecordsManagementSearchBehaviour.class); + + /** Policy component */ + private PolicyComponent policyComponent; + + /** Node service */ + private NodeService nodeService; + + /** Disposition service */ + private DispositionService dispositionService; + + /** Records management service registry */ + private RecordsManagementServiceRegistry recordsManagementServiceRegistry; + + /** Vital record service */ + private VitalRecordService vitalRecordService; + + /** Record folder service */ + private RecordFolderService recordFolderService; + + /** Record service*/ + private RecordService recordService; + + /** + * @param nodeService the nodeService to set + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param dispositionService the disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param policyComponent the policyComponent to set + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + /** + * @param recordsManagementServiceRegistry the records management service registry + */ + public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry recordsManagementServiceRegistry) + { + this.recordsManagementServiceRegistry = recordsManagementServiceRegistry; + } + + /** + * @param vitalRecordService vital record service + */ + public void setVitalRecordService(VitalRecordService vitalRecordService) + { + this.vitalRecordService = vitalRecordService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** on add search aspect behaviour */ + private JavaBehaviour onAddSearchAspect = new JavaBehaviour(this, "rmSearchAspectAdd", NotificationFrequency.TRANSACTION_COMMIT); + + /** disposition action behaviours */ + private JavaBehaviour jbDispositionActionCreate = new JavaBehaviour(this, "dispositionActionCreate", NotificationFrequency.TRANSACTION_COMMIT); + private JavaBehaviour jbDispositionActionPropertiesUpdate = new JavaBehaviour(this, "dispositionActionPropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT); + + /** disposition lifecycle behaviours */ + private JavaBehaviour jbDispositionLifeCycleAspect = new JavaBehaviour(this, "onAddDispositionLifecycleAspect", NotificationFrequency.TRANSACTION_COMMIT); + + /** disposition schedule behaviours */ + private JavaBehaviour jbDispositionSchedulePropertiesUpdate = new JavaBehaviour(this, "dispositionSchedulePropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT); + + /** event update behaviours */ + private JavaBehaviour jbEventExecutionUpdate = new JavaBehaviour(this, "eventExecutionUpdate", NotificationFrequency.TRANSACTION_COMMIT); + private JavaBehaviour jbEventExecutionDelete = new JavaBehaviour(this, "eventExecutionDelete", NotificationFrequency.TRANSACTION_COMMIT); + + /** Array of behaviours related to disposition schedule artifacts */ + private JavaBehaviour[] jbDispositionBehaviours = + { + jbDispositionActionCreate, + jbDispositionActionPropertiesUpdate, + jbDispositionSchedulePropertiesUpdate, + jbEventExecutionUpdate, + jbEventExecutionDelete, + jbDispositionLifeCycleAspect + }; + + /** + * Initialisation method + */ + public void init() + { + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), + TYPE_DISPOSITION_ACTION, + jbDispositionActionCreate); + + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), + TYPE_DISPOSITION_ACTION, + jbDispositionActionPropertiesUpdate); + + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), + TYPE_DISPOSITION_SCHEDULE, + jbDispositionSchedulePropertiesUpdate); + + this.policyComponent.bindAssociationBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), + TYPE_DISPOSITION_ACTION, + ASSOC_EVENT_EXECUTIONS, + jbEventExecutionUpdate); + + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"), + TYPE_EVENT_EXECUTION, + jbEventExecutionDelete); + + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), + ASPECT_RM_SEARCH, + onAddSearchAspect); + + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), + ASPECT_DISPOSITION_LIFECYCLE, + jbDispositionLifeCycleAspect); + + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), + ASPECT_RECORD, + new JavaBehaviour(this, "onAddRecordAspect", NotificationFrequency.TRANSACTION_COMMIT)); + + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), + TYPE_RECORD_FOLDER, + new JavaBehaviour(this, "recordFolderCreate", NotificationFrequency.TRANSACTION_COMMIT)); + + // Vital Records Review Details Rollup + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"), + ASPECT_VITAL_RECORD_DEFINITION, + new JavaBehaviour(this, "vitalRecordDefintionAddAspect", NotificationFrequency.TRANSACTION_COMMIT)); + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), + ASPECT_VITAL_RECORD_DEFINITION, + new JavaBehaviour(this, "vitalRecordDefintionUpdateProperties", NotificationFrequency.TRANSACTION_COMMIT)); + } + + /** + * Disabled disposition schedule behaviour + */ + public void disableDispositionScheduleBehaviour() + { + for (JavaBehaviour jb : jbDispositionBehaviours) + { + jb.disable(); + } + } + + /** + * Enables disposition schedule behaviour + */ + public void enableDispositionScheduleBehaviour() + { + for (JavaBehaviour jb : jbDispositionBehaviours) + { + jb.enable(); + } + } + + /** + * Ensures the search aspect for the given node is present, complete and correct. + * + * @param recordOrFolder node reference to record or record folder + */ + public void fixupSearchAspect(NodeRef recordOrFolder) + { + // for now only deal with record folders + if (recordFolderService.isRecordFolder(recordOrFolder)) + { + // ensure the search aspect is applied + applySearchAspect(recordOrFolder); + + // setup the properties relating to the disposition schedule + setupDispositionScheduleProperties(recordOrFolder); + + // setup the properties relating to the disposition lifecycle + DispositionAction da = dispositionService.getNextDispositionAction(recordOrFolder); + if (da != null) + { + updateDispositionActionProperties(recordOrFolder, da.getNodeRef()); + setupDispositionActionEvents(recordOrFolder, da); + } + + // setup the properties relating to the vital record indicator + setVitalRecordDefintionDetails(recordOrFolder); + } + } + + /** + * Updates the disposition action properties + * + * @param nodeRef node reference + * @param before value of properties before + * @param after value of properties after + */ + public void dispositionActionPropertiesUpdate(final NodeRef nodeRef, final Map before, final Map after) + { + if (nodeService.exists(nodeRef)) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); + if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) + { + // Get the record (or record folder) + NodeRef record = assoc.getParentRef(); + + // Apply the search aspect + applySearchAspect(record); + + // Update disposition properties + updateDispositionActionProperties(record, nodeRef); + } + + return null; + + }}, AuthenticationUtil.getSystemUserName()); + } + } + + /** + * Helper method to apply the search aspect + * + * @param nodeRef node reference + */ + private void applySearchAspect(NodeRef nodeRef) + { + onAddSearchAspect.disable(); + try + { + if (!nodeService.hasAspect(nodeRef, ASPECT_RM_SEARCH)) + { + nodeService.addAspect(nodeRef, ASPECT_RM_SEARCH , null); + + if (logger.isDebugEnabled()) + { + logger.debug("Added search aspect to node: " + nodeRef); + } + } + } + finally + { + onAddSearchAspect.enable(); + } + } + + /** + * On add record aspect behaviour implementation + * + * @param nodeRef node reference + * @param aspectTypeQName aspect type qname + */ + public void onAddRecordAspect(final NodeRef nodeRef, final QName aspectTypeQName) + { + AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + @Override + public Void doWork() + { + if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD)) + { + applySearchAspect(nodeRef); + setupDispositionScheduleProperties(nodeRef); + } + + return null; + } + }); + } + + /** + * On addition of the disposition lifecycle aspect + * @param nodeRef + * @param aspectTypeQName + */ + public void onAddDispositionLifecycleAspect(final NodeRef nodeRef, final QName aspectTypeQName) + { + AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + @Override + public Void doWork() + { + if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD)) + { + applySearchAspect(nodeRef); + setupDispositionScheduleProperties(nodeRef); + } + + return null; + } + }); + } + + /** + * On create record folder behaviour implmentation + * + * @param childAssocRef child association reference + */ + public void recordFolderCreate(final ChildAssociationRef childAssocRef) + { + AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + @Override + public Void doWork() throws Exception + { + NodeRef nodeRef = childAssocRef.getChildRef(); + if (nodeService.exists(nodeRef)) + { + applySearchAspect(nodeRef); + setupDispositionScheduleProperties(nodeRef); + } + + return null; + } + }); + } + + /** + * Helper method to setup the disposition schedule properties + * + * @param recordOrFolder node reference of record or record folder + */ + private void setupDispositionScheduleProperties(NodeRef recordOrFolder) + { + if (!methodCached("setupDispositionScheduleProperties", recordOrFolder)) + { + DispositionSchedule ds = dispositionService.getDispositionSchedule(recordOrFolder); + if (ds == null) + { + nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, false); + } + else + { + nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, true); + setDispositionScheduleProperties(recordOrFolder, ds); + } + + if (logger.isDebugEnabled()) + { + logger.debug("Set rma:recordSearchHasDispositionSchedule for node " + recordOrFolder + + " to: " + (ds != null)); + } + } + } + + /** + * On disposition action create behaviour implementation + * + * @param childAssocRef child association reference + */ + public void dispositionActionCreate(final ChildAssociationRef childAssocRef) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Void doWork() throws Exception + { + NodeRef child = childAssocRef.getChildRef(); + if (nodeService.exists(child) && + childAssocRef.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) + { + // Get the record (or record folder) + NodeRef record = childAssocRef.getParentRef(); + + // Apply the search aspect + applySearchAspect(record); + + // Update disposition properties + updateDispositionActionProperties(record, childAssocRef.getChildRef()); + + // Clear the events + nodeService.setProperty(record, PROP_RS_DISPOSITION_EVENTS, null); + } + + return null; + } + }); + } + + /** + * Helper method to determine whether a method has been called in this transaction + * already, or not. + *

+ * Prevents work if we get unexpected behaviours firing. + * + * @param method method name (can be any unique string) + * @return boolean true if already called in this transaction, false otherwise + */ + private boolean methodCached(String method, NodeRef nodeRef) + { + boolean result = true; + Set methods = TransactionalResourceHelper.getSet("rm.seachrollup.methodCache"); + String key = method + "|" + nodeRef; + if (!methods.contains(key)) + { + result = false; + methods.add(key); + } + return result; + } + + /** + * On update disposition action properties behaviour implementation + * + * @param record record node reference + * @param dispositionAction disposition action + */ + private void updateDispositionActionProperties(NodeRef record, NodeRef dispositionAction) + { + if (!methodCached("updateDispositionActionProperties", record)) + { + Map props = nodeService.getProperties(record); + + DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction); + + props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName()); + props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate()); + props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE)); + + DispositionActionDefinition daDefinition = da.getDispositionActionDefinition(); + if (daDefinition != null) + { + Period period = daDefinition.getPeriod(); + if (period != null) + { + props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType()); + props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression()); + } + else + { + props.put(PROP_RS_DISPOSITION_PERIOD, null); + props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null); + } + } + + nodeService.setProperties(record, props); + + if (logger.isDebugEnabled()) + { + logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " + + props.get(PROP_RS_DISPOSITION_ACTION_NAME)); + logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " + + props.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); + logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " + + props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); + logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " + + props.get(PROP_RS_DISPOSITION_PERIOD)); + logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " + + props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); + } + } + } + + /** + * On update of event execution information behaviour\ + * + * @param childAssocRef child association reference + * @param isNewNode true if a new node, false otherwise + */ + @SuppressWarnings("unchecked") + public void eventExecutionUpdate(ChildAssociationRef childAssocRef, boolean isNewNode) + { + NodeRef dispositionAction = childAssocRef.getParentRef(); + NodeRef eventExecution = childAssocRef.getChildRef(); + + if (nodeService.exists(dispositionAction) && + nodeService.exists(eventExecution)) + { + ChildAssociationRef assoc = nodeService.getPrimaryParent(dispositionAction); + if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) + { + // Get the record (or record folder) + NodeRef record = assoc.getParentRef(); + + // Apply the search aspect + applySearchAspect(record); + + Collection events = (Collection)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS); + if (events == null) + { + events = new ArrayList<>(1); + } + events.add((String)nodeService.getProperty(eventExecution, PROP_EVENT_EXECUTION_NAME)); + nodeService.setProperty(record, PROP_RS_DISPOSITION_EVENTS, (Serializable)events); + } + } + } + + /** + * On event execution delete behaviour implementation. + * + * @param childAssocRef child association reference + * @param isNodeArchived true if node is archived on delete, false otherwise + */ + public void eventExecutionDelete(ChildAssociationRef childAssocRef, boolean isNodeArchived) + { + NodeRef dispositionActionNode = childAssocRef.getParentRef(); + + if (nodeService.exists(dispositionActionNode)) + { + ChildAssociationRef assoc = nodeService.getPrimaryParent(dispositionActionNode); + if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION)) + { + // Get the record (or record folder) + NodeRef record = assoc.getParentRef(); + + // Apply the search aspect + applySearchAspect(record); + + // make sure the list of events match the action definition + setupDispositionActionEvents(record, dispositionService.getNextDispositionAction(record)); + } + } + } + + /** + * Helper method to setup disposition action events. + * + * @param nodeRef node reference + * @param da disposition action + */ + private void setupDispositionActionEvents(NodeRef nodeRef, DispositionAction da) + { + if (!methodCached("setupDispositionActionEvents", nodeRef)) + { + if (da != null) + { + List eventNames = null; + List eventsList = da.getEventCompletionDetails(); + if (eventsList.size() > 0) + { + eventNames = new ArrayList(eventsList.size()); + for (EventCompletionDetails event : eventsList) + { + eventNames.add(event.getEventName()); + } + } + + // set the property + nodeService.setProperty(nodeRef, PROP_RS_DISPOSITION_EVENTS, (Serializable)eventNames); + + if (logger.isDebugEnabled()) + { + logger.debug("Set rma:recordSearchDispositionEvents for node " + nodeRef + " to: " + eventNames); + } + } + } + } + + /** + * On add search aspect behaviour implementation. + * + * @param nodeRef node reference + * @param aspectTypeQName aspect type qname + */ + public void rmSearchAspectAdd(final NodeRef nodeRef, final QName aspectTypeQName) + { + AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + @Override + public Void doWork() + { + if (nodeService.exists(nodeRef)) + { + // Initialise the search parameteres as required + setVitalRecordDefintionDetails(nodeRef); + } + + return null; + } + }); + } + + /** + * On add aspect vital record defintion behaviour implementation. + * + * @param nodeRef node reference + * @param aspectTypeQName aspect tyep qname + */ + public void vitalRecordDefintionAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) + { + AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + @Override + public Void doWork() + { + // Only care about record folders + if (nodeService.exists(nodeRef) && recordFolderService.isRecordFolder(nodeRef)) + { + updateVitalRecordDefinitionValues(nodeRef); + } + + return null; + } + }); + } + + /** + * On update vital record definition properties behaviour implementation. + * + * @param nodeRef node reference + * @param before before properties + * @param after after properties + */ + public void vitalRecordDefintionUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) + { + AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + @Override + public Void doWork() + { + // Only care about record folders + if (nodeService.exists(nodeRef) && recordFolderService.isRecordFolder(nodeRef)) + { + Set props = new HashSet(1); + props.add(PROP_REVIEW_PERIOD); + Set changed = determineChangedProps(before, after); + changed.retainAll(props); + if (!changed.isEmpty()) + { + updateVitalRecordDefinitionValues(nodeRef); + } + } + + return null; + } + }); + } + + /** + * Helper method to update the vital record defintion values + * + * @param nodeRef node reference + */ + private void updateVitalRecordDefinitionValues(NodeRef nodeRef) + { + if (!methodCached("updateVitalRecordDefinitionValues", nodeRef)) + { + // ensure the folder itself reflects the correct details + applySearchAspect(nodeRef); + setVitalRecordDefintionDetails(nodeRef); + + List records = recordService.getRecords(nodeRef); + for (NodeRef record : records) + { + // Apply the search aspect + applySearchAspect(record); + + // Set the vital record definition details + setVitalRecordDefintionDetails(record); + } + } + } + + /** + * Helper method to set vital record definition details. + * + * @param nodeRef node reference + */ + private void setVitalRecordDefintionDetails(NodeRef nodeRef) + { + if (!methodCached("setVitalRecordDefinitionDetails", nodeRef)) + { + VitalRecordDefinition vrd = vitalRecordService.getVitalRecordDefinition(nodeRef); + + if (vrd != null && vrd.isEnabled() && vrd.getReviewPeriod() != null) + { + // Set the property values + nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, vrd.getReviewPeriod().getPeriodType()); + nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, vrd.getReviewPeriod().getExpression()); + + if (logger.isDebugEnabled()) + { + logger.debug("Set rma:recordSearchVitalRecordReviewPeriod for node " + nodeRef + " to: " + + vrd.getReviewPeriod().getPeriodType()); + logger.debug("Set rma:recordSearchVitalRecordReviewPeriodExpression for node " + nodeRef + " to: " + + vrd.getReviewPeriod().getExpression()); + } + } + else + { + // Clear the vital record properties + nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, null); + nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, null); + } + } + } + + /** + * Updates the disposition schedule properties + * + * @param nodeRef node reference + * @param before properties before + * @param after properties after + */ + public void dispositionSchedulePropertiesUpdate(NodeRef nodeRef, Map before, Map after) + { + if (nodeService.exists(nodeRef)) + { + // create the schedule object and get the record category for it + DispositionSchedule schedule = new DispositionScheduleImpl(recordsManagementServiceRegistry, nodeService, nodeRef); + NodeRef recordCategoryNode = nodeService.getPrimaryParent(schedule.getNodeRef()).getParentRef(); + + if (schedule.isRecordLevelDisposition()) + { + for (NodeRef recordFolder : getRecordFolders(recordCategoryNode)) + { + for (NodeRef record : recordService.getRecords(recordFolder)) + { + applySearchAspect(record); + setDispositionScheduleProperties(record, schedule); + } + } + } + else + { + for (NodeRef recordFolder : getRecordFolders(recordCategoryNode)) + { + applySearchAspect(recordFolder); + setDispositionScheduleProperties(recordFolder, schedule); + } + } + } + } + + /** + * Helper method to set disposition schedule properties + * + * @param recordOrFolder node reference + * @param schedule dispostion schedule + */ + private void setDispositionScheduleProperties(NodeRef recordOrFolder, DispositionSchedule schedule) + { + if (schedule != null) + { + nodeService.setProperty(recordOrFolder, PROP_RS_DISPOITION_AUTHORITY, schedule.getDispositionAuthority()); + nodeService.setProperty(recordOrFolder, PROP_RS_DISPOITION_INSTRUCTIONS, schedule.getDispositionInstructions()); + + if (logger.isDebugEnabled()) + { + logger.debug("Set rma:recordSearchDispositionAuthority for node " + recordOrFolder + " to: " + schedule.getDispositionAuthority()); + logger.debug("Set rma:recordSearchDispositionInstructions for node " + recordOrFolder + " to: " + schedule.getDispositionInstructions()); + } + } + } + + /** + * This method compares the oldProps map against the newProps map and returns + * a set of QNames of the properties that have changed. Changed here means one of + *

    + *
  • the property has been removed
  • + *
  • the property has had its value changed
  • + *
  • the property has been added
  • + *
+ */ + private Set determineChangedProps(Map oldProps, Map newProps) + { + Set result = new HashSet(); + for (Map.Entry entry : oldProps.entrySet()) + { + QName qn = entry.getKey(); + if (newProps.get(qn) == null || !newProps.get(qn).equals(entry.getValue())) + { + result.add(qn); + } + } + for (QName qn : newProps.keySet()) + { + if (oldProps.get(qn) == null) + { + result.add(qn); + } + } + + return result; + } + + /** + * Helper method to get the record folders contained in the provided record category. + * + * @param recordCategoryNode record category node reference + * @return List contained record folders + */ + private List getRecordFolders(NodeRef recordCategoryNode) + { + List results = new ArrayList(8); + + List folderAssocs = nodeService.getChildAssocs(recordCategoryNode, + ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef folderAssoc : folderAssocs) + { + NodeRef folder = folderAssoc.getChildRef(); + if (recordFolderService.isRecordFolder(folder)) + { + results.add(folder); + } + } + + return results; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessor.java index 41999c77df..bcfc013c87 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessor.java @@ -1,66 +1,66 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.compatibility; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; - -/** - * Dictionary bootstap post processor. - *

- * Ensures compatibility with 4.2 and 4.2.1 as well as 4.2.2. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DictionaryBootstrapPostProcessor implements BeanFactoryPostProcessor -{ - /** bean id's */ - private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap"; - private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap"; - - /** - * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) - */ - @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) - { - // if the site service bootstrap bean and the RM dictionary bean are present in the bean factory - if (beanFactory.containsBean(BEAN_SITESERVICE_BOOTSTRAP) && - beanFactory.containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP)) - { - // get the RM dictionary bootstrap bean definition - BeanDefinition beanDef = beanFactory.getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); - - // set the dependency - beanDef.setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP}); - } - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.compatibility; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; + +/** + * Dictionary bootstap post processor. + *

+ * Ensures compatibility with 4.2 and 4.2.1 as well as 4.2.2. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class DictionaryBootstrapPostProcessor implements BeanFactoryPostProcessor +{ + /** bean id's */ + private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap"; + private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap"; + + /** + * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) + */ + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) + { + // if the site service bootstrap bean and the RM dictionary bean are present in the bean factory + if (beanFactory.containsBean(BEAN_SITESERVICE_BOOTSTRAP) && + beanFactory.containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP)) + { + // get the RM dictionary bootstrap bean definition + BeanDefinition beanDef = beanFactory.getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); + + // set the dependency + beanDef.setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP}); + } + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java index 9e9e4a0e37..660bfddd28 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/AccendedAspect.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java index a817b3b83e..6d86d30880 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/CutoffAspect.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java index 9dda3603b4..3530e7c143 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DeclaredRecordAspect.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java index 231afe1562..4dd7485e98 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java @@ -1,106 +1,106 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -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.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * rma:dispositionLifecycle behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:dispositionLifecycle" -) -public class DispositionLifecycleAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnAddAspectPolicy -{ - /** disposition service */ - protected DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Copy callback for disposition lifecycle - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.EVERY_EVENT - ) - public void onAddAspect(final NodeRef nodeRef, final QName aspect) - { - if (nodeService.exists(nodeRef)) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - dispositionService.refreshDispositionAction(nodeRef); - return null; - } - }); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +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.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * rma:dispositionLifecycle behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:dispositionLifecycle" +) +public class DispositionLifecycleAspect extends BaseBehaviourBean + implements NodeServicePolicies.OnAddAspectPolicy +{ + /** disposition service */ + protected DispositionService dispositionService; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Copy callback for disposition lifecycle + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.EVERY_EVENT + ) + public void onAddAspect(final NodeRef nodeRef, final QName aspect) + { + if (nodeService.exists(nodeRef)) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + dispositionService.refreshDispositionAction(nodeRef); + return null; + } + }); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java index 85658b5b8a..17fb6a5943 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ExtendedSecurityAspect.java @@ -1,77 +1,77 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -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.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.service.namespace.QName; - -/** - * rma:extendedSecurity behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:extendedSecurity" -) -public class ExtendedSecurityAspect extends BaseBehaviourBean -{ - /** extended security service */ - protected ExtendedSecurityService extendedSecurityService; - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) - { - 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(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +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.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.namespace.QName; + +/** + * rma:extendedSecurity behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:extendedSecurity" +) +public class ExtendedSecurityAspect extends BaseBehaviourBean +{ + /** extended security service */ + protected ExtendedSecurityService extendedSecurityService; + + /** + * @param extendedSecurityService extended security service + */ + public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) + { + 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(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java index abc6456d19..4def09023c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java @@ -1,342 +1,342 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.copy.AbstractCopyBehaviourCallback; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.rendition.RenditionService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.ScriptService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.PropertyMap; - -/** - * rma:filePlanComponent behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:filePlanComponent" -) -public class FilePlanComponentAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnMoveNodePolicy - - -{ - /** Well-known location of the scripts folder. */ - private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts"); - - /** script service */ - private ScriptService scriptService; - - /** namespace service */ - private NamespaceService namespaceService; - - /** file plan service */ - private FilePlanService filePlanService; - - /** rendition service */ - private RenditionService renditionService; - - /** - * @param scriptService set script service - */ - public void setScriptService(ScriptService scriptService) - { - this.scriptService = scriptService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param renditionService rendition service - */ - public void setRenditionService(RenditionService service) - { - this.renditionService = service; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef)) - { - lookupAndExecuteScripts(nodeRef, before, after); - } - - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - /** - * This method examines the old and new property sets and for those properties which - * have changed, looks for script resources corresponding to those properties. - * Those scripts are then called via the ScriptService. - * - * @param nodeWithChangedProperties the node whose properties have changed. - * @param oldProps the old properties and their values. - * @param newProps the new properties and their values. - * - * @see #lookupScripts(Map, Map) - */ - private void lookupAndExecuteScripts(NodeRef nodeWithChangedProperties, - Map oldProps, - Map newProps) - { - List scriptRefs = lookupScripts(oldProps, newProps); - - Map objectModel = new HashMap(1); - objectModel.put("node", nodeWithChangedProperties); - objectModel.put("oldProperties", oldProps); - objectModel.put("newProperties", newProps); - for (NodeRef scriptRef : scriptRefs) - { - scriptService.executeScript(scriptRef, null, objectModel); - } - } - - /** - * This method determines which properties have changed and for each such property - * looks for a script resource in a well-known location. - * - * @param oldProps the old properties and their values. - * @param newProps the new properties and their values. - * @return A list of nodeRefs corresponding to the Script resources. - * - * @see #determineChangedProps(Map, Map) - */ - private List lookupScripts(Map oldProps, Map newProps) - { - List result = new ArrayList(); - - Map changedProps = PropertyMap.getChangedProperties(oldProps, newProps); - for (QName propQName : changedProps.keySet()) - { - QName prefixedQName = propQName.getPrefixedQName(namespaceService); - - String [] splitQName = QName.splitPrefixedQName(prefixedQName.toPrefixString()); - final String shortPrefix = splitQName[0]; - final String localName = splitQName[1]; - - // This is the filename pattern which is assumed. - // e.g. a script file cm_name.js would be called for changed to cm:name - String expectedScriptName = shortPrefix + "_" + localName + ".js"; - - NodeRef nextElement = nodeService.getChildByName(scriptsFolderNodeRef, ContentModel.ASSOC_CONTAINS, expectedScriptName); - if (nextElement != null) - { - result.add(nextElement); - } - } - - return result; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - // Check if the node exists and the aspect hasn't been removed in the same transaction (see RM-3266) - if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, aspectTypeQName)) - { - // Look up the root and set on the aspect if found - NodeRef root = filePlanService.getFilePlan(nodeRef); - if (root != null) - { - nodeService.setProperty(nodeRef, PROP_ROOT_NODEREF, root); - } - - // If the node has any renditions, they inherit the file plan from their source node. - List renditions = renditionService.getRenditions(nodeRef); - NodeRef rendition; - for (ChildAssociationRef chAssRef : renditions) - { - rendition = chAssRef.getChildRef(); - if (nodeService.exists(rendition)) - { - // Apply file plan component aspect to node's renditions - nodeService.addAspect(rendition, ASPECT_FILE_PLAN_COMPONENT, null); - } - } - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onMoveNode(final ChildAssociationRef oldChildAssocRef, final ChildAssociationRef newChildAssocRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(newChildAssocRef.getParentRef()) && - nodeService.exists(newChildAssocRef.getChildRef())) - { - // Look up the root and re-set the value currently stored on the aspect - NodeRef root = filePlanService.getFilePlan(newChildAssocRef.getParentRef()); - // NOTE: set the null value if no root found - nodeService.setProperty(newChildAssocRef.getChildRef(), PROP_ROOT_NODEREF, root); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Copy behaviour call back - * - * @param classRef class reference - * @param copyDetail details of the information being copied - * @return CopyBehaviourCallback - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new AbstractCopyBehaviourCallback() - { - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getChildAssociationCopyAction(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, org.alfresco.repo.copy.CopyBehaviourCallback.CopyChildAssociationDetails) - */ - public ChildAssocCopyAction getChildAssociationCopyAction( - QName classQName, - CopyDetails copyDetails, - CopyChildAssociationDetails childAssocCopyDetails) - { - // Do not copy the associations - return null; - } - - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getCopyProperties(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, java.util.Map) - */ - public Map getCopyProperties( - QName classQName, - CopyDetails copyDetails, - Map properties) - { - // Only copy the root node reference if the new value can be looked up via the parent - NodeRef root = filePlanService.getFilePlan(copyDetails.getTargetParentNodeRef()); - if (root != null) - { - properties.put(PROP_ROOT_NODEREF, root); - } - return properties; - } - - /** - * @see org.alfresco.repo.copy.CopyBehaviourCallback#getMustCopy(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails) - */ - public boolean getMustCopy(QName classQName, CopyDetails copyDetails) - { - // Ensure the aspect is copied - return true; - } - }; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.AbstractCopyBehaviourCallback; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.rendition.RenditionService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.ScriptService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.PropertyMap; + +/** + * rma:filePlanComponent behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:filePlanComponent" +) +public class FilePlanComponentAspect extends BaseBehaviourBean + implements NodeServicePolicies.OnUpdatePropertiesPolicy, + NodeServicePolicies.OnAddAspectPolicy, + NodeServicePolicies.OnMoveNodePolicy + + +{ + /** Well-known location of the scripts folder. */ + private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts"); + + /** script service */ + private ScriptService scriptService; + + /** namespace service */ + private NamespaceService namespaceService; + + /** file plan service */ + private FilePlanService filePlanService; + + /** rendition service */ + private RenditionService renditionService; + + /** + * @param scriptService set script service + */ + public void setScriptService(ScriptService scriptService) + { + this.scriptService = scriptService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param renditionService rendition service + */ + public void setRenditionService(RenditionService service) + { + this.renditionService = service; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + if (nodeService.exists(nodeRef)) + { + lookupAndExecuteScripts(nodeRef, before, after); + } + + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + + /** + * This method examines the old and new property sets and for those properties which + * have changed, looks for script resources corresponding to those properties. + * Those scripts are then called via the ScriptService. + * + * @param nodeWithChangedProperties the node whose properties have changed. + * @param oldProps the old properties and their values. + * @param newProps the new properties and their values. + * + * @see #lookupScripts(Map, Map) + */ + private void lookupAndExecuteScripts(NodeRef nodeWithChangedProperties, + Map oldProps, + Map newProps) + { + List scriptRefs = lookupScripts(oldProps, newProps); + + Map objectModel = new HashMap(1); + objectModel.put("node", nodeWithChangedProperties); + objectModel.put("oldProperties", oldProps); + objectModel.put("newProperties", newProps); + for (NodeRef scriptRef : scriptRefs) + { + scriptService.executeScript(scriptRef, null, objectModel); + } + } + + /** + * This method determines which properties have changed and for each such property + * looks for a script resource in a well-known location. + * + * @param oldProps the old properties and their values. + * @param newProps the new properties and their values. + * @return A list of nodeRefs corresponding to the Script resources. + * + * @see #determineChangedProps(Map, Map) + */ + private List lookupScripts(Map oldProps, Map newProps) + { + List result = new ArrayList(); + + Map changedProps = PropertyMap.getChangedProperties(oldProps, newProps); + for (QName propQName : changedProps.keySet()) + { + QName prefixedQName = propQName.getPrefixedQName(namespaceService); + + String [] splitQName = QName.splitPrefixedQName(prefixedQName.toPrefixString()); + final String shortPrefix = splitQName[0]; + final String localName = splitQName[1]; + + // This is the filename pattern which is assumed. + // e.g. a script file cm_name.js would be called for changed to cm:name + String expectedScriptName = shortPrefix + "_" + localName + ".js"; + + NodeRef nextElement = nodeService.getChildByName(scriptsFolderNodeRef, ContentModel.ASSOC_CONTAINS, expectedScriptName); + if (nextElement != null) + { + result.add(nextElement); + } + } + + return result; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + // Check if the node exists and the aspect hasn't been removed in the same transaction (see RM-3266) + if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, aspectTypeQName)) + { + // Look up the root and set on the aspect if found + NodeRef root = filePlanService.getFilePlan(nodeRef); + if (root != null) + { + nodeService.setProperty(nodeRef, PROP_ROOT_NODEREF, root); + } + + // If the node has any renditions, they inherit the file plan from their source node. + List renditions = renditionService.getRenditions(nodeRef); + NodeRef rendition; + for (ChildAssociationRef chAssRef : renditions) + { + rendition = chAssRef.getChildRef(); + if (nodeService.exists(rendition)) + { + // Apply file plan component aspect to node's renditions + nodeService.addAspect(rendition, ASPECT_FILE_PLAN_COMPONENT, null); + } + } + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onMoveNode(final ChildAssociationRef oldChildAssocRef, final ChildAssociationRef newChildAssocRef) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + if (nodeService.exists(newChildAssocRef.getParentRef()) && + nodeService.exists(newChildAssocRef.getChildRef())) + { + // Look up the root and re-set the value currently stored on the aspect + NodeRef root = filePlanService.getFilePlan(newChildAssocRef.getParentRef()); + // NOTE: set the null value if no root found + nodeService.setProperty(newChildAssocRef.getChildRef(), PROP_ROOT_NODEREF, root); + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Copy behaviour call back + * + * @param classRef class reference + * @param copyDetail details of the information being copied + * @return CopyBehaviourCallback + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new AbstractCopyBehaviourCallback() + { + /** + * @see org.alfresco.repo.copy.CopyBehaviourCallback#getChildAssociationCopyAction(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, org.alfresco.repo.copy.CopyBehaviourCallback.CopyChildAssociationDetails) + */ + public ChildAssocCopyAction getChildAssociationCopyAction( + QName classQName, + CopyDetails copyDetails, + CopyChildAssociationDetails childAssocCopyDetails) + { + // Do not copy the associations + return null; + } + + /** + * @see org.alfresco.repo.copy.CopyBehaviourCallback#getCopyProperties(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails, java.util.Map) + */ + public Map getCopyProperties( + QName classQName, + CopyDetails copyDetails, + Map properties) + { + // Only copy the root node reference if the new value can be looked up via the parent + NodeRef root = filePlanService.getFilePlan(copyDetails.getTargetParentNodeRef()); + if (root != null) + { + properties.put(PROP_ROOT_NODEREF, root); + } + return properties; + } + + /** + * @see org.alfresco.repo.copy.CopyBehaviourCallback#getMustCopy(org.alfresco.service.namespace.QName, org.alfresco.repo.copy.CopyDetails) + */ + public boolean getMustCopy(QName classQName, CopyDetails copyDetails) + { + // Ensure the aspect is copied + return true; + } + }; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java index e9f4c22e04..39835475ca 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java @@ -1,214 +1,214 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * rma:frozen behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:frozen" -) -public class FrozenAspect extends BaseBehaviourBean - implements NodeServicePolicies.BeforeDeleteNodePolicy, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnRemoveAspectPolicy -{ - /** file plan service */ - protected FilePlanService filePlanService; - - /** freeze service */ - protected FreezeService freezeService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * Ensure that no frozen node is deleted. - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void beforeDeleteNode(final NodeRef nodeRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(nodeRef) && - filePlanService.isFilePlanComponent(nodeRef)) - { - if (freezeService.isFrozen(nodeRef)) - { - // never allowed to delete a frozen node - throw new AccessDeniedException("Frozen nodes can not be deleted."); - } - - // check children - checkChildren(nodeService.getChildAssocs(nodeRef)); - } - return null; - } - }); - } - - /** - * Checks the children for frozen nodes. Throws security error if any are - * found. - * - * @param assocs - */ - private void checkChildren(List assocs) - { - for (ChildAssociationRef assoc : assocs) - { - // we only care about primary children - if (assoc.isPrimary()) - { - NodeRef nodeRef = assoc.getChildRef(); - if (freezeService.isFrozen(nodeRef)) - { - // never allowed to delete a node with a frozen child - throw new AccessDeniedException("Can not delete node, because it contains a frozen child node."); - } - - // check children - checkChildren(nodeService.getChildAssocs(nodeRef)); - } - } - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onAddAspect(final NodeRef record, final QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(record) && - isRecord(record)) - { - // get the owning record folder - NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); - // check that the aspect has been added - if (nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)) - { - // increment current count - int currentCount = (Integer)nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT); - currentCount = currentCount + 1; - nodeService.setProperty(recordFolder, PROP_HELD_CHILDREN_COUNT, currentCount); - } - } - return null; - } - }); - } - - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onRemoveAspect(final NodeRef record, QName aspectTypeQName) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - if (nodeService.exists(record) && - isRecord(record)) - { - // get the owning record folder - NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); - - // check that the aspect has been added - if (nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)) - { - // decrement current count - int currentCount = (Integer)nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT); - if (currentCount > 0) - { - currentCount = currentCount - 1; - nodeService.setProperty(recordFolder, PROP_HELD_CHILDREN_COUNT, currentCount); - } - } - } - return null; - } - }); - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * rma:frozen behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:frozen" +) +public class FrozenAspect extends BaseBehaviourBean + implements NodeServicePolicies.BeforeDeleteNodePolicy, + NodeServicePolicies.OnAddAspectPolicy, + NodeServicePolicies.OnRemoveAspectPolicy +{ + /** file plan service */ + protected FilePlanService filePlanService; + + /** freeze service */ + protected FreezeService freezeService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param freezeService freeze service + */ + public void setFreezeService(FreezeService freezeService) + { + this.freezeService = freezeService; + } + + /** + * Ensure that no frozen node is deleted. + * + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void beforeDeleteNode(final NodeRef nodeRef) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + if (nodeService.exists(nodeRef) && + filePlanService.isFilePlanComponent(nodeRef)) + { + if (freezeService.isFrozen(nodeRef)) + { + // never allowed to delete a frozen node + throw new AccessDeniedException("Frozen nodes can not be deleted."); + } + + // check children + checkChildren(nodeService.getChildAssocs(nodeRef)); + } + return null; + } + }); + } + + /** + * Checks the children for frozen nodes. Throws security error if any are + * found. + * + * @param assocs + */ + private void checkChildren(List assocs) + { + for (ChildAssociationRef assoc : assocs) + { + // we only care about primary children + if (assoc.isPrimary()) + { + NodeRef nodeRef = assoc.getChildRef(); + if (freezeService.isFrozen(nodeRef)) + { + // never allowed to delete a node with a frozen child + throw new AccessDeniedException("Can not delete node, because it contains a frozen child node."); + } + + // check children + checkChildren(nodeService.getChildAssocs(nodeRef)); + } + } + } + + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onAddAspect(final NodeRef record, final QName aspectTypeQName) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + if (nodeService.exists(record) && + isRecord(record)) + { + // get the owning record folder + NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); + // check that the aspect has been added + if (nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)) + { + // increment current count + int currentCount = (Integer)nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT); + currentCount = currentCount + 1; + nodeService.setProperty(recordFolder, PROP_HELD_CHILDREN_COUNT, currentCount); + } + } + return null; + } + }); + } + + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onRemoveAspect(final NodeRef record, QName aspectTypeQName) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + if (nodeService.exists(record) && + isRecord(record)) + { + // get the owning record folder + NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); + + // check that the aspect has been added + if (nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)) + { + // decrement current count + int currentCount = (Integer)nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT); + if (currentCount > 0) + { + currentCount = currentCount - 1; + nodeService.setProperty(recordFolder, PROP_HELD_CHILDREN_COUNT, currentCount); + } + } + } + return null; + } + }); + + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java index 1dbe670509..6ab76a6b1d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/GhostedAspect.java @@ -1,82 +1,82 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.content.ContentServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:ghosted behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - // optional - defaultType = "rma:ghosted" -) -public class GhostedAspect extends BaseBehaviourBean - implements ContentServicePolicies.OnContentUpdatePolicy -{ - /** I18N */ - private static final String MSG_GHOSTED_PROP_UPDATE = "rm.action.ghosted-prop-update"; - - /** - * Ensure that the content of a ghosted node can not be updated. - * - * @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - @Behaviour - ( - // required, use ASSOC for association behaviors - kind = BehaviourKind.CLASS, - // (defaults to EVERY_EVENT) - notificationFrequency = NotificationFrequency.EVERY_EVENT, - // (defaults to alf:) - policy = "alf:onContentUpdate", - // required, unless defaultType set - type = "rma:ghosted" - - // isService (default false) - // name (only needs to specified if associated behvaiour object needs to be accessed) - // assocType (defaults to cm:contains, used with BehaviourKind.ASSOC) - ) - public void onContentUpdate(NodeRef content, boolean bNew) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_GHOSTED_PROP_UPDATE)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.content.ContentServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +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.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * rma:ghosted behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + // optional + defaultType = "rma:ghosted" +) +public class GhostedAspect extends BaseBehaviourBean + implements ContentServicePolicies.OnContentUpdatePolicy +{ + /** I18N */ + private static final String MSG_GHOSTED_PROP_UPDATE = "rm.action.ghosted-prop-update"; + + /** + * Ensure that the content of a ghosted node can not be updated. + * + * @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + @Override + @Behaviour + ( + // required, use ASSOC for association behaviors + kind = BehaviourKind.CLASS, + // (defaults to EVERY_EVENT) + notificationFrequency = NotificationFrequency.EVERY_EVENT, + // (defaults to alf:) + policy = "alf:onContentUpdate", + // required, unless defaultType set + type = "rma:ghosted" + + // isService (default false) + // name (only needs to specified if associated behvaiour object needs to be accessed) + // assocType (defaults to cm:contains, used with BehaviourKind.ASSOC) + ) + public void onContentUpdate(NodeRef content, boolean bNew) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_GHOSTED_PROP_UPDATE)); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java index 23c58fdcd9..e49df9f140 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java @@ -1,339 +1,339 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.AbstractDisposableItem; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -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.CopyServicePolicies; -import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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.cmr.repository.ScriptService; -import org.alfresco.service.namespace.QName; - -/** - * rma:record behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:record" -) -public class RecordAspect extends AbstractDisposableItem - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - RecordsManagementPolicies.OnCreateReference, - RecordsManagementPolicies.OnRemoveReference, - NodeServicePolicies.OnMoveNodePolicy, - CopyServicePolicies.OnCopyCompletePolicy -{ - /** Well-known location of the scripts folder. */ - // TODO make configurable - private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts"); - - /** extended security service */ - protected ExtendedSecurityService extendedSecurityService; - - /** script service */ - protected ScriptService scriptService; - - /** record service */ - protected RecordService recordService; - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - /** - * @param scriptService script service - */ - public void setScriptService(ScriptService scriptService) - { - this.scriptService = scriptService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * Behaviour to ensure renditions have the appropriate extended security. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - assocType = "rn:rendition", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean bNew) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - NodeRef thumbnail = childAssocRef.getChildRef(); - - if (nodeService.exists(thumbnail)) - { - // apply file plan component aspect to thumbnail - nodeService.addAspect(thumbnail, ASPECT_FILE_PLAN_COMPONENT, null); - - // manage any extended readers - NodeRef parent = childAssocRef.getParentRef(); - Set readers = extendedSecurityService.getReaders(parent); - Set writers = extendedSecurityService.getWriters(parent); - if (readers != null && readers.size() != 0) - { - extendedSecurityService.set(thumbnail, readers, writers); - } - } - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference#onCreateReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateReference(final NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) - { - // Deal with versioned records - if (reference.equals(CUSTOM_REF_VERSIONS)) - { - // run as system, to apply the versioned aspect to the from node - // as we can't be sure if the user has add aspect rights - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null); - return null; - } - }); - } - - // Execute script if for the reference event - executeReferenceScript("onCreate", reference, fromNodeRef, toNodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRemoveReference#onRemoveReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onRemoveReference(final NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) - { - // Deal with versioned records - if (reference.equals(CUSTOM_REF_VERSIONS)) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Apply the versioned aspect to the from node - nodeService.removeAspect(fromNodeRef, ASPECT_VERSIONED_RECORD); - - return null; - } - }); - } - - // Execute script if for the reference event - executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef); - } - - /** - * Record copy callback - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(final QName classRef, final CopyDetails copyDetails) - { - return new DefaultCopyBehaviourCallback() - { - - @Override - public Map getCopyProperties(QName classRef, CopyDetails copyDetails, - Map properties) - { - Map sourceProperties = super.getCopyProperties(classRef, copyDetails, properties); - - // Remove the Date Filed property from record properties on copy. - // It will be generated for the copy - if (sourceProperties.containsKey(PROP_DATE_FILED)) - { - sourceProperties.remove(PROP_DATE_FILED); - } - - return sourceProperties; - } - - }; - } - - /** - * Record move behaviour - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - // check the records parent has actually changed - if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) && - isFilePlanComponent(oldChildAssocRef.getParentRef())) - { - final NodeRef record = newChildAssocRef.getChildRef(); - authenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - if (nodeService.exists(record) && - recordService.isFiled(record)) - { - // clean record - cleanDisposableItem(nodeService, record); - - // re-file in the new folder - recordService.file(record); - } - - return null; - } - }, authenticationUtil.getAdminUserName()); - } - } - - /** - * Executes a reference script if present - * - * @param policy policy - * @param reference reference - * @param from reference from - * @param to reference to - */ - private void executeReferenceScript(String policy, QName reference, NodeRef from, NodeRef to) - { - String referenceId = reference.getLocalName(); - - // This is the filename pattern which is assumed. - // e.g. a script file onCreate_superceded.js for the creation of a superseded reference - String expectedScriptName = policy + "_" + referenceId + ".js"; - - NodeRef scriptNodeRef = nodeService.getChildByName(scriptsFolderNodeRef, ContentModel.ASSOC_CONTAINS, expectedScriptName); - if (scriptNodeRef != null) - { - Map objectModel = new HashMap(1); - objectModel.put("node", from); - objectModel.put("toNode", to); - objectModel.put("policy", policy); - objectModel.put("reference", referenceId); - - scriptService.executeScript(scriptNodeRef, null, objectModel); - } - } - - /** - * On copy complete behaviour for record aspect. - * - * @param classRef - * @param sourceNodeRef - * @param targetNodeRef - * @param copyToNewNode - * @param copyMap - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS - ) - public void onCopyComplete(QName classRef, - NodeRef sourceNodeRef, - NodeRef targetNodeRef, - boolean copyToNewNode, - Map copyMap) - { - // given the node exists and is a record - if (nodeService.exists(targetNodeRef) && - nodeService.hasAspect(targetNodeRef, ASPECT_RECORD)) - { - // then remove any extended security from the newly copied record - extendedSecurityService.remove(targetNodeRef); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.AbstractDisposableItem; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +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.CopyServicePolicies; +import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +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.cmr.repository.ScriptService; +import org.alfresco.service.namespace.QName; + +/** + * rma:record behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:record" +) +public class RecordAspect extends AbstractDisposableItem + implements NodeServicePolicies.OnCreateChildAssociationPolicy, + RecordsManagementPolicies.OnCreateReference, + RecordsManagementPolicies.OnRemoveReference, + NodeServicePolicies.OnMoveNodePolicy, + CopyServicePolicies.OnCopyCompletePolicy +{ + /** Well-known location of the scripts folder. */ + // TODO make configurable + private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts"); + + /** extended security service */ + protected ExtendedSecurityService extendedSecurityService; + + /** script service */ + protected ScriptService scriptService; + + /** record service */ + protected RecordService recordService; + + /** + * @param extendedSecurityService extended security service + */ + public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) + { + this.extendedSecurityService = extendedSecurityService; + } + + /** + * @param scriptService script service + */ + public void setScriptService(ScriptService scriptService) + { + this.scriptService = scriptService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * Behaviour to ensure renditions have the appropriate extended security. + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION, + assocType = "rn:rendition", + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean bNew) + { + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + NodeRef thumbnail = childAssocRef.getChildRef(); + + if (nodeService.exists(thumbnail)) + { + // apply file plan component aspect to thumbnail + nodeService.addAspect(thumbnail, ASPECT_FILE_PLAN_COMPONENT, null); + + // manage any extended readers + NodeRef parent = childAssocRef.getParentRef(); + Set readers = extendedSecurityService.getReaders(parent); + Set writers = extendedSecurityService.getWriters(parent); + if (readers != null && readers.size() != 0) + { + extendedSecurityService.set(thumbnail, readers, writers); + } + } + + return null; + } + }); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference#onCreateReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onCreateReference(final NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + { + // Deal with versioned records + if (reference.equals(CUSTOM_REF_VERSIONS)) + { + // run as system, to apply the versioned aspect to the from node + // as we can't be sure if the user has add aspect rights + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null); + return null; + } + }); + } + + // Execute script if for the reference event + executeReferenceScript("onCreate", reference, fromNodeRef, toNodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRemoveReference#onRemoveReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onRemoveReference(final NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + { + // Deal with versioned records + if (reference.equals(CUSTOM_REF_VERSIONS)) + { + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // Apply the versioned aspect to the from node + nodeService.removeAspect(fromNodeRef, ASPECT_VERSIONED_RECORD); + + return null; + } + }); + } + + // Execute script if for the reference event + executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef); + } + + /** + * Record copy callback + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(final QName classRef, final CopyDetails copyDetails) + { + return new DefaultCopyBehaviourCallback() + { + + @Override + public Map getCopyProperties(QName classRef, CopyDetails copyDetails, + Map properties) + { + Map sourceProperties = super.getCopyProperties(classRef, copyDetails, properties); + + // Remove the Date Filed property from record properties on copy. + // It will be generated for the copy + if (sourceProperties.containsKey(PROP_DATE_FILED)) + { + sourceProperties.remove(PROP_DATE_FILED); + } + + return sourceProperties; + } + + }; + } + + /** + * Record move behaviour + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) + { + // check the records parent has actually changed + if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) && + isFilePlanComponent(oldChildAssocRef.getParentRef())) + { + final NodeRef record = newChildAssocRef.getChildRef(); + authenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + if (nodeService.exists(record) && + recordService.isFiled(record)) + { + // clean record + cleanDisposableItem(nodeService, record); + + // re-file in the new folder + recordService.file(record); + } + + return null; + } + }, authenticationUtil.getAdminUserName()); + } + } + + /** + * Executes a reference script if present + * + * @param policy policy + * @param reference reference + * @param from reference from + * @param to reference to + */ + private void executeReferenceScript(String policy, QName reference, NodeRef from, NodeRef to) + { + String referenceId = reference.getLocalName(); + + // This is the filename pattern which is assumed. + // e.g. a script file onCreate_superceded.js for the creation of a superseded reference + String expectedScriptName = policy + "_" + referenceId + ".js"; + + NodeRef scriptNodeRef = nodeService.getChildByName(scriptsFolderNodeRef, ContentModel.ASSOC_CONTAINS, expectedScriptName); + if (scriptNodeRef != null) + { + Map objectModel = new HashMap(1); + objectModel.put("node", from); + objectModel.put("toNode", to); + objectModel.put("policy", policy); + objectModel.put("reference", referenceId); + + scriptService.executeScript(scriptNodeRef, null, objectModel); + } + } + + /** + * On copy complete behaviour for record aspect. + * + * @param classRef + * @param sourceNodeRef + * @param targetNodeRef + * @param copyToNewNode + * @param copyMap + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS + ) + public void onCopyComplete(QName classRef, + NodeRef sourceNodeRef, + NodeRef targetNodeRef, + boolean copyToNewNode, + Map copyMap) + { + // given the node exists and is a record + if (nodeService.exists(targetNodeRef) && + nodeService.hasAspect(targetNodeRef, ASPECT_RECORD)) + { + // then remove any extended security from the newly copied record + extendedSecurityService.remove(targetNodeRef); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java index c2453cbdfe..062de32577 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordComponentIdentifierAspect.java @@ -1,241 +1,241 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.CopyServicePolicies; -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; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.attributes.AttributeService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:recordComponentIdentifier behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordComponentIdentifier" -) -public class RecordComponentIdentifierAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.BeforeDeleteNodePolicy, - CopyServicePolicies.OnCopyCompletePolicy -{ - /** I18N */ - private static final String MSG_SET_ID = "rm.service.set-id"; - - /** attribute context value */ - private static final String CONTEXT_VALUE = "rma:identifier"; - - /** file plan service */ - private FilePlanService filePlanService; - - /** attribute service */ - private AttributeService attributeService; - - /** identifier service */ - private IdentifierService identifierService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param attributeService attribute service - */ - public void setAttributeService(AttributeService attributeService) - { - this.attributeService = attributeService; - } - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * Ensures that the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property remains - * unique within the context of the parent node. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.EVERY_EVENT - ) - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - String newIdValue = (String)after.get(PROP_IDENTIFIER); - if (newIdValue != null) - { - String oldIdValue = (String)before.get(PROP_IDENTIFIER); - if (oldIdValue != null && !oldIdValue.equals(newIdValue)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SET_ID, nodeRef.toString())); - } - - // update uniqueness - updateUniqueness(nodeRef, oldIdValue, newIdValue); - } - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Cleans up the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property unique triplet. - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.EVERY_EVENT - ) - public void beforeDeleteNode(final NodeRef nodeRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Object doWork() - { - String beforeId = (String) nodeService.getProperty(nodeRef, PROP_IDENTIFIER); - updateUniqueness(nodeRef, beforeId, null); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Record component identifier aspect copy callback - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } - - @SuppressWarnings("rawtypes") - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode, Map copyMap) - { - //Generate the id for the copy - String id = identifierService.generateIdentifier( - nodeService.getType(nodeService.getPrimaryParent(targetNodeRef).getParentRef()), - nodeService.getPrimaryParent(targetNodeRef).getParentRef()); - - //We need to allow the id to be overwritten disable the policy protecting changes to the id - behaviourFilter.disableBehaviour(); - try - { - nodeService.setProperty(targetNodeRef, PROP_IDENTIFIER, id); - } - finally - { - behaviourFilter.enableBehaviour(); - } - } - - /** - * Updates the uniqueness check using the values provided. If the after value is null - * then this is considered to be a removal. - * - * @param nodeRef node reference - * @param beforeId id before - * @param afterId id after - */ - private void updateUniqueness(NodeRef nodeRef, String beforeId, String afterId) - { - NodeRef contextNodeRef = filePlanService.getFilePlan(nodeRef); - - if (beforeId == null) - { - if (afterId != null) - { - // Just create it - attributeService.createAttribute(null, CONTEXT_VALUE, contextNodeRef, afterId); - } - } - else if (afterId == null) - { - // The before value was not null, so remove it - attributeService.removeAttribute(CONTEXT_VALUE, contextNodeRef, beforeId); - // Do a blanket removal in case this is a contextual nodes - attributeService.removeAttributes(CONTEXT_VALUE, nodeRef); - } - else - { - // This is a full update - attributeService.updateOrCreateAttribute( - CONTEXT_VALUE, contextNodeRef, beforeId, - CONTEXT_VALUE, contextNodeRef, afterId); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.CopyServicePolicies; +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; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.attributes.AttributeService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * rma:recordComponentIdentifier behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:recordComponentIdentifier" +) +public class RecordComponentIdentifierAspect extends BaseBehaviourBean + implements NodeServicePolicies.OnUpdatePropertiesPolicy, + NodeServicePolicies.BeforeDeleteNodePolicy, + CopyServicePolicies.OnCopyCompletePolicy +{ + /** I18N */ + private static final String MSG_SET_ID = "rm.service.set-id"; + + /** attribute context value */ + private static final String CONTEXT_VALUE = "rma:identifier"; + + /** file plan service */ + private FilePlanService filePlanService; + + /** attribute service */ + private AttributeService attributeService; + + /** identifier service */ + private IdentifierService identifierService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param attributeService attribute service + */ + public void setAttributeService(AttributeService attributeService) + { + this.attributeService = attributeService; + } + + /** + * @param identifierService identifier service + */ + public void setIdentifierService(IdentifierService identifierService) + { + this.identifierService = identifierService; + } + + /** + * Ensures that the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property remains + * unique within the context of the parent node. + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.EVERY_EVENT + ) + public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) + { + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + String newIdValue = (String)after.get(PROP_IDENTIFIER); + if (newIdValue != null) + { + String oldIdValue = (String)before.get(PROP_IDENTIFIER); + if (oldIdValue != null && !oldIdValue.equals(newIdValue)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SET_ID, nodeRef.toString())); + } + + // update uniqueness + updateUniqueness(nodeRef, oldIdValue, newIdValue); + } + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Cleans up the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property unique triplet. + * + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.EVERY_EVENT + ) + public void beforeDeleteNode(final NodeRef nodeRef) + { + AuthenticationUtil.runAs(new RunAsWork() + { + public Object doWork() + { + String beforeId = (String) nodeService.getProperty(nodeRef, PROP_IDENTIFIER); + updateUniqueness(nodeRef, beforeId, null); + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Record component identifier aspect copy callback + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } + + @SuppressWarnings("rawtypes") + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode, Map copyMap) + { + //Generate the id for the copy + String id = identifierService.generateIdentifier( + nodeService.getType(nodeService.getPrimaryParent(targetNodeRef).getParentRef()), + nodeService.getPrimaryParent(targetNodeRef).getParentRef()); + + //We need to allow the id to be overwritten disable the policy protecting changes to the id + behaviourFilter.disableBehaviour(); + try + { + nodeService.setProperty(targetNodeRef, PROP_IDENTIFIER, id); + } + finally + { + behaviourFilter.enableBehaviour(); + } + } + + /** + * Updates the uniqueness check using the values provided. If the after value is null + * then this is considered to be a removal. + * + * @param nodeRef node reference + * @param beforeId id before + * @param afterId id after + */ + private void updateUniqueness(NodeRef nodeRef, String beforeId, String afterId) + { + NodeRef contextNodeRef = filePlanService.getFilePlan(nodeRef); + + if (beforeId == null) + { + if (afterId != null) + { + // Just create it + attributeService.createAttribute(null, CONTEXT_VALUE, contextNodeRef, afterId); + } + } + else if (afterId == null) + { + // The before value was not null, so remove it + attributeService.removeAttribute(CONTEXT_VALUE, contextNodeRef, beforeId); + // Do a blanket removal in case this is a contextual nodes + attributeService.removeAttributes(CONTEXT_VALUE, nodeRef); + } + else + { + // This is a full update + attributeService.updateOrCreateAttribute( + CONTEXT_VALUE, contextNodeRef, beforeId, + CONTEXT_VALUE, contextNodeRef, afterId); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordOriginatingDetailsAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordOriginatingDetailsAspect.java index df5ac0f1aa..8002de9e48 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordOriginatingDetailsAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordOriginatingDetailsAspect.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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:recordOriginatingDetails behaviour bean - * - * @author Mark Hibbins - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordOriginatingDetails" -) -public class RecordOriginatingDetailsAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * Record originating details aspect should not be copied. - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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:recordOriginatingDetails behaviour bean + * + * @author Mark Hibbins + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:recordOriginatingDetails" +) +public class RecordOriginatingDetailsAspect extends BaseBehaviourBean +{ + /** + * Copy callback. + * + * Record originating details 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-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java index 49b09e605e..9ebce737c7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordSearchAspect.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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:recordSearch behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordSearch" -) -public class RecordSearchAspect extends BaseBehaviourBean -{ - /** - * Copy callback for record search - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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:recordSearch behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:recordSearch" +) +public class RecordSearchAspect extends BaseBehaviourBean +{ + /** + * Copy callback for record search + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java index da5243b6ae..4c56d8e2dc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java @@ -1,81 +1,81 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Behaviour associated with the scheduled aspect - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:scheduled" -) -public class ScheduledAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnAddAspectPolicy -{ - /** disposition service */ - private DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName) - { - if (nodeService.exists(nodeRef) && - dispositionService.getAssociatedDispositionSchedule(nodeRef) == null) - { - dispositionService.createDispositionSchedule(nodeRef, null); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +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.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Behaviour associated with the scheduled aspect + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:scheduled" +) +public class ScheduledAspect extends BaseBehaviourBean + implements NodeServicePolicies.OnAddAspectPolicy +{ + /** disposition service */ + private DispositionService dispositionService; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName) + { + if (nodeService.exists(nodeRef) && + dispositionService.getAssociatedDispositionSchedule(nodeRef) == null) + { + dispositionService.createDispositionSchedule(nodeRef, null); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java index 00329e0b35..a4766667bc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferredAspect.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java index e3f7b9ec42..44964bd2cf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/TransferringAspect.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/UncutoffAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/UncutoffAspect.java index 65f3121b33..7e6a06946e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/UncutoffAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/UncutoffAspect.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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:uncutoff behaviour bean - * - * @author Mark Hibbins - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:uncutOff" -) -public class UncutoffAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * Uncutoff aspect should not be copied. - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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:uncutoff behaviour bean + * + * @author Mark Hibbins + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:uncutOff" +) +public class UncutoffAspect extends BaseBehaviourBean +{ + /** + * Copy callback. + * + * Uncutoff 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-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspect.java index d2a8799235..cba53f5aec 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspect.java @@ -1,132 +1,132 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; - -/** - * rmv:versionRecord behaviour bean - * - * @author Roy Wetherall - * @since 2.3.1 - */ -@BehaviourBean -( - defaultType = "rmv:versionRecord" -) -public class VersionRecordAspect extends BaseBehaviourBean - implements NodeServicePolicies.BeforeDeleteNodePolicy -{ - /** recordable version service */ - private RecordableVersionService recordableVersionService; - - /** relationship service */ - private RelationshipService relationshipService; - - /** - * @param recordableVersionService recordable version service - */ - public void setRecordableVersionService(RecordableVersionService recordableVersionService) - { - this.recordableVersionService = recordableVersionService; - } - - /** - * @param relationshipService relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * If the record is a version record then delete the associated version entry - * - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour (kind = BehaviourKind.CLASS) - public void beforeDeleteNode(final NodeRef nodeRef) - { - final Version version = recordableVersionService.getRecordedVersion(nodeRef); - if (version != null) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - behaviourFilter.disableBehaviour(); - try - { - // mark the associated version as destroyed - recordableVersionService.destroyRecordedVersion(version); - - // re-organise the versions relationships ... - // if there is only one "to" reference since a version can only have one predecessor - Set tos = relationshipService.getRelationshipsTo(nodeRef, RelationshipService.RELATIONSHIP_VERSIONS); - if (!tos.isEmpty() && tos.size() == 1) - { - // if there is some "from" references - Set froms = relationshipService.getRelationshipsFrom(nodeRef, RelationshipService.RELATIONSHIP_VERSIONS); - if (!froms.isEmpty()) - { - // get predecessor version relationship - Relationship to = tos.iterator().next(); - - for (Relationship from : froms) - { - // point the "to" the all the "from's" - relationshipService.addRelationship(RelationshipService.RELATIONSHIP_VERSIONS, to.getSource(), from.getTarget()); - } - } - } - } - finally - { - behaviourFilter.enableBehaviour(); - } - - return null; - } - }); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; + +/** + * rmv:versionRecord behaviour bean + * + * @author Roy Wetherall + * @since 2.3.1 + */ +@BehaviourBean +( + defaultType = "rmv:versionRecord" +) +public class VersionRecordAspect extends BaseBehaviourBean + implements NodeServicePolicies.BeforeDeleteNodePolicy +{ + /** recordable version service */ + private RecordableVersionService recordableVersionService; + + /** relationship service */ + private RelationshipService relationshipService; + + /** + * @param recordableVersionService recordable version service + */ + public void setRecordableVersionService(RecordableVersionService recordableVersionService) + { + this.recordableVersionService = recordableVersionService; + } + + /** + * @param relationshipService relationship service + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * If the record is a version record then delete the associated version entry + * + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Behaviour (kind = BehaviourKind.CLASS) + public void beforeDeleteNode(final NodeRef nodeRef) + { + final Version version = recordableVersionService.getRecordedVersion(nodeRef); + if (version != null) + { + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + behaviourFilter.disableBehaviour(); + try + { + // mark the associated version as destroyed + recordableVersionService.destroyRecordedVersion(version); + + // re-organise the versions relationships ... + // if there is only one "to" reference since a version can only have one predecessor + Set tos = relationshipService.getRelationshipsTo(nodeRef, RelationshipService.RELATIONSHIP_VERSIONS); + if (!tos.isEmpty() && tos.size() == 1) + { + // if there is some "from" references + Set froms = relationshipService.getRelationshipsFrom(nodeRef, RelationshipService.RELATIONSHIP_VERSIONS); + if (!froms.isEmpty()) + { + // get predecessor version relationship + Relationship to = tos.iterator().next(); + + for (Relationship from : froms) + { + // point the "to" the all the "from's" + relationshipService.addRelationship(RelationshipService.RELATIONSHIP_VERSIONS, to.getSource(), from.getTarget()); + } + } + } + } + finally + { + behaviourFilter.enableBehaviour(); + } + + return null; + } + }); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java index 1faea44273..9e26820908 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordAspect.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.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:vitalRecord behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:vitalRecord" -) -public class VitalRecordAspect extends BaseBehaviourBean -{ - /** - * Copy callback for vital record - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.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:vitalRecord behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:vitalRecord" +) +public class VitalRecordAspect extends BaseBehaviourBean +{ + /** + * Copy callback for vital record + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) + { + return new DoNothingCopyBehaviourCallback(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java index af2a19ae3b..8065712f96 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java @@ -1,101 +1,101 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.PropertyMap; - -/** - * rma:ghosted behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:vitalRecordDefinition" -) -public class VitalRecordDefinitionAspect extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** records management action service */ - protected RecordsManagementActionService recordsManagementActionService; - - /** - * @param recordsManagementActionService records management action service - */ - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() - { - if (nodeService.exists(nodeRef) && - nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT)) - { - // check that vital record definition has been changed in the first place - Map changedProps = PropertyMap.getChangedProperties(before, after); - if (changedProps.containsKey(PROP_VITAL_RECORD_INDICATOR) || - changedProps.containsKey(PROP_REVIEW_PERIOD)) - { - recordsManagementActionService.executeRecordsManagementAction(nodeRef, "broadcastVitalRecordDefinition"); - } - } - return null; - } - }); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.PropertyMap; + +/** + * rma:ghosted behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:vitalRecordDefinition" +) +public class VitalRecordDefinitionAspect extends BaseBehaviourBean + implements NodeServicePolicies.OnUpdatePropertiesPolicy +{ + /** records management action service */ + protected RecordsManagementActionService recordsManagementActionService; + + /** + * @param recordsManagementActionService records management action service + */ + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Void doWork() + { + if (nodeService.exists(nodeRef) && + nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT)) + { + // check that vital record definition has been changed in the first place + Map changedProps = PropertyMap.getChangedProperties(before, after); + if (changedProps.containsKey(PROP_VITAL_RECORD_INDICATOR) || + changedProps.containsKey(PROP_REVIEW_PERIOD)) + { + recordsManagementActionService.executeRecordsManagementAction(nodeRef, "broadcastVitalRecordDefinition"); + } + } + return null; + } + }); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java index d946f95f0e..beeda539fe 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java @@ -1,174 +1,174 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.copy.CopyServicePolicies; -import org.alfresco.repo.node.NodeServicePolicies; -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.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * cm:cmobject behaviour bean - * - * @author Tuna Aksoy - * @since 2.3 - */ -@BehaviourBean -( - defaultType = "cm:cmobject" -) -public class CmObjectType extends BaseBehaviourBean implements NodeServicePolicies.OnMoveNodePolicy, CopyServicePolicies.BeforeCopyPolicy -{ - /** Move behaviour name */ - private static final String MOVE_BEHAVIOUR_NAME = "onMoveCmObjectType"; - - /** Copy behaviour name */ - private static final String COPY_BEHAVIOUR_NAME = "onCopyCmObjectType"; - - /** - * Disable the move behaviour for this transaction - * - */ - public void disableMove() - { - getBehaviour(MOVE_BEHAVIOUR_NAME).disable(); - } - - /** - * Enable the move behaviour for this transaction - * - */ - public void enableMove() - { - getBehaviour(MOVE_BEHAVIOUR_NAME).enable(); - } - - /** - * Disable the copy behaviour for this transaction - * - */ - public void disableCopy() - { - getBehaviour(COPY_BEHAVIOUR_NAME).disable(); - } - - /** - * Enable the copy behaviour for this transaction - * - */ - public void enableCopy() - { - getBehaviour(COPY_BEHAVIOUR_NAME).enable(); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = MOVE_BEHAVIOUR_NAME - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - mandatory("oldChildAssocRef", oldChildAssocRef); - mandatory("newChildAssocRef", newChildAssocRef); - - NodeRef sourceParent = oldChildAssocRef.getParentRef(); - boolean isSourceParentFilePlanComponent = isFilePlanComponent(sourceParent); - - NodeRef targetParent = newChildAssocRef.getParentRef(); - boolean isTargetParentFilePlanComponent = isFilePlanComponent(targetParent); - - // If we are doing the move operation within the RM site then we can stop here - // The method should just check move operations from outside of RM into the RM site - if (isSourceParentFilePlanComponent && isTargetParentFilePlanComponent) - { - return; - } - - NodeRef object = oldChildAssocRef.getChildRef(); - QName objectType = nodeService.getType(object); - - // Only documents can be moved into the RM site - if (!objectType.equals(ContentModel.TYPE_CONTENT) && isTargetParentFilePlanComponent) - { - throw new AlfrescoRuntimeException("Only documents can be moved from a collaboration site into a RM site."); - } - - // Documents can be moved only into a RM folder - if (isTargetParentFilePlanComponent && !isRecordFolder(targetParent)) - { - throw new AlfrescoRuntimeException("A document can only be moved into a folder in RM site."); - } - } - - /** - * @see org.alfresco.repo.copy.CopyServicePolicies.BeforeCopyPolicy#beforeCopy(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = COPY_BEHAVIOUR_NAME - ) - public void beforeCopy(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef) - { - mandatory("sourceNodeRef", sourceNodeRef); - mandatory("targetNodeRef", targetNodeRef); - - NodeRef sourceParentNodeRef = nodeService.getPrimaryParent(sourceNodeRef).getParentRef(); - boolean isSourceParentFilePlanComponent = isFilePlanComponent(sourceParentNodeRef); - - NodeRef targetParentNodeRef = nodeService.getPrimaryParent(targetNodeRef).getParentRef(); - boolean isTargetNodeParentFilePlanComponent = isFilePlanComponent(targetParentNodeRef); - - // If we are doing the copy operation within the RM site then we can stop here - // The method should just check copy operations from outside of RM into the RM site - if (isSourceParentFilePlanComponent && isTargetNodeParentFilePlanComponent) - { - return; - } - - // Do not allow to copy anything outside of RM site into the RM site - if (!isSourceParentFilePlanComponent && isTargetNodeParentFilePlanComponent) - { - throw new AlfrescoRuntimeException("Nothing can be copied from a collaboration site into a RM site."); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import static org.alfresco.util.ParameterCheck.mandatory; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.copy.CopyServicePolicies; +import org.alfresco.repo.node.NodeServicePolicies; +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.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * cm:cmobject behaviour bean + * + * @author Tuna Aksoy + * @since 2.3 + */ +@BehaviourBean +( + defaultType = "cm:cmobject" +) +public class CmObjectType extends BaseBehaviourBean implements NodeServicePolicies.OnMoveNodePolicy, CopyServicePolicies.BeforeCopyPolicy +{ + /** Move behaviour name */ + private static final String MOVE_BEHAVIOUR_NAME = "onMoveCmObjectType"; + + /** Copy behaviour name */ + private static final String COPY_BEHAVIOUR_NAME = "onCopyCmObjectType"; + + /** + * Disable the move behaviour for this transaction + * + */ + public void disableMove() + { + getBehaviour(MOVE_BEHAVIOUR_NAME).disable(); + } + + /** + * Enable the move behaviour for this transaction + * + */ + public void enableMove() + { + getBehaviour(MOVE_BEHAVIOUR_NAME).enable(); + } + + /** + * Disable the copy behaviour for this transaction + * + */ + public void disableCopy() + { + getBehaviour(COPY_BEHAVIOUR_NAME).disable(); + } + + /** + * Enable the copy behaviour for this transaction + * + */ + public void enableCopy() + { + getBehaviour(COPY_BEHAVIOUR_NAME).enable(); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + name = MOVE_BEHAVIOUR_NAME + ) + public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) + { + mandatory("oldChildAssocRef", oldChildAssocRef); + mandatory("newChildAssocRef", newChildAssocRef); + + NodeRef sourceParent = oldChildAssocRef.getParentRef(); + boolean isSourceParentFilePlanComponent = isFilePlanComponent(sourceParent); + + NodeRef targetParent = newChildAssocRef.getParentRef(); + boolean isTargetParentFilePlanComponent = isFilePlanComponent(targetParent); + + // If we are doing the move operation within the RM site then we can stop here + // The method should just check move operations from outside of RM into the RM site + if (isSourceParentFilePlanComponent && isTargetParentFilePlanComponent) + { + return; + } + + NodeRef object = oldChildAssocRef.getChildRef(); + QName objectType = nodeService.getType(object); + + // Only documents can be moved into the RM site + if (!objectType.equals(ContentModel.TYPE_CONTENT) && isTargetParentFilePlanComponent) + { + throw new AlfrescoRuntimeException("Only documents can be moved from a collaboration site into a RM site."); + } + + // Documents can be moved only into a RM folder + if (isTargetParentFilePlanComponent && !isRecordFolder(targetParent)) + { + throw new AlfrescoRuntimeException("A document can only be moved into a folder in RM site."); + } + } + + /** + * @see org.alfresco.repo.copy.CopyServicePolicies.BeforeCopyPolicy#beforeCopy(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + name = COPY_BEHAVIOUR_NAME + ) + public void beforeCopy(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef) + { + mandatory("sourceNodeRef", sourceNodeRef); + mandatory("targetNodeRef", targetNodeRef); + + NodeRef sourceParentNodeRef = nodeService.getPrimaryParent(sourceNodeRef).getParentRef(); + boolean isSourceParentFilePlanComponent = isFilePlanComponent(sourceParentNodeRef); + + NodeRef targetParentNodeRef = nodeService.getPrimaryParent(targetNodeRef).getParentRef(); + boolean isTargetNodeParentFilePlanComponent = isFilePlanComponent(targetParentNodeRef); + + // If we are doing the copy operation within the RM site then we can stop here + // The method should just check copy operations from outside of RM into the RM site + if (isSourceParentFilePlanComponent && isTargetNodeParentFilePlanComponent) + { + return; + } + + // Do not allow to copy anything outside of RM site into the RM site + if (!isSourceParentFilePlanComponent && isTargetNodeParentFilePlanComponent) + { + throw new AlfrescoRuntimeException("Nothing can be copied from a collaboration site into a RM site."); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java index 6630bcb100..f3897aef30 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java @@ -1,108 +1,108 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -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.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.PropertyMap; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:dispositionActionDefinition behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:dispositionActionDefinition" -) -public class DispositionActionDefinitionType extends BaseBehaviourBean - implements NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** I18N */ - private static final String MSG_UPDATE_DISP_ACT_DEF = "rm.service.update-disposition-action-def"; - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (nodeService.exists(nodeRef)) - { - // Determine the properties that have changed - Set changedProps = new HashSet(PropertyMap.getChangedProperties(before, after).keySet()); - changedProps.addAll(PropertyMap.getAddedProperties(before, after).keySet()); - - if (!nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE)) - { - // Apply the unpublished aspect - Map props = new HashMap(); - props.put(PROP_UPDATE_TO, UPDATE_TO_DISPOSITION_ACTION_DEFINITION); - props.put(PROP_UPDATED_PROPERTIES, (Serializable)changedProps); - nodeService.addAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE, props); - } - else - { - Map props = nodeService.getProperties(nodeRef); - - // Check that there isn't a update currently being published - if ((Boolean)props.get(PROP_PUBLISH_IN_PROGRESS).equals(Boolean.TRUE)) - { - // Can not update the disposition schedule since there is an outstanding update being published - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UPDATE_DISP_ACT_DEF)); - } - - // Update the update information - props.put(PROP_UPDATE_TO, UPDATE_TO_DISPOSITION_ACTION_DEFINITION); - props.put(PROP_UPDATED_PROPERTIES, (Serializable)changedProps); - nodeService.setProperties(nodeRef, props); - } - } - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +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.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.PropertyMap; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * rma:dispositionActionDefinition behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:dispositionActionDefinition" +) +public class DispositionActionDefinitionType extends BaseBehaviourBean + implements NodeServicePolicies.OnUpdatePropertiesPolicy +{ + /** I18N */ + private static final String MSG_UPDATE_DISP_ACT_DEF = "rm.service.update-disposition-action-def"; + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) + { + if (nodeService.exists(nodeRef)) + { + // Determine the properties that have changed + Set changedProps = new HashSet(PropertyMap.getChangedProperties(before, after).keySet()); + changedProps.addAll(PropertyMap.getAddedProperties(before, after).keySet()); + + if (!nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE)) + { + // Apply the unpublished aspect + Map props = new HashMap(); + props.put(PROP_UPDATE_TO, UPDATE_TO_DISPOSITION_ACTION_DEFINITION); + props.put(PROP_UPDATED_PROPERTIES, (Serializable)changedProps); + nodeService.addAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE, props); + } + else + { + Map props = nodeService.getProperties(nodeRef); + + // Check that there isn't a update currently being published + if ((Boolean)props.get(PROP_PUBLISH_IN_PROGRESS).equals(Boolean.TRUE)) + { + // Can not update the disposition schedule since there is an outstanding update being published + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UPDATE_DISP_ACT_DEF)); + } + + // Update the update information + props.put(PROP_UPDATE_TO, UPDATE_TO_DISPOSITION_ACTION_DEFINITION); + props.put(PROP_UPDATED_PROPERTIES, (Serializable)changedProps); + nodeService.setProperties(nodeRef, props); + } + } + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java index 38bd8b554b..e2e7ddafac 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java @@ -1,215 +1,215 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.rule.RuleModel; -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; - -/** - * rma:filePlan behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:filePlan" -) -public class FilePlanType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnCreateNodePolicy, - NodeServicePolicies.OnDeleteNodePolicy -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** identifier service */ - private IdentifierService identifierService; - - /** file plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** - * @return File plan service - */ - protected FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * @return Record folder service - */ - protected RecordFolderService getRecordFolderService() - { - return this.recordFolderService; - } - - /** - * @return Identifier service - */ - protected IdentifierService getIdentifierService() - { - return this.identifierService; - } - - /** - * @return File plan role service - */ - protected FilePlanRoleService getFilePlanRoleService() - { - return this.filePlanRoleService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION - ) - @Override - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - // ensure we are not trying to put content in the file plan root node - NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) - { - throw new AlfrescoRuntimeException("Operation failed, because you can't place content in the root of the file plan."); - } - - // ensure we are not trying to put a record folder in the root of the file plan - NodeRef parent = childAssocRef.getParentRef(); - if (getFilePlanService().isFilePlan(parent) && getRecordFolderService().isRecordFolder(nodeRef)) - { - throw new AlfrescoRuntimeException("Operation failed, because you can not place a record folder in the root of the file plan."); - } - - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - @Override - public void onCreateNode(final ChildAssociationRef childAssocRef) - { - final NodeRef filePlan = childAssocRef.getChildRef(); - - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Object doWork() - { - // ensure rules are not inherited - nodeService.addAspect(filePlan, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - - // set the identifier - if (nodeService.getProperty(filePlan, PROP_IDENTIFIER) == null) - { - String id = getIdentifierService().generateIdentifier(filePlan); - nodeService.setProperty(filePlan, RecordsManagementModel.PROP_IDENTIFIER, id); - } - - return null; - } - }); - - // setup the file plan roles - getFilePlanRoleService().setupFilePlanRoles(filePlan); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - @Override - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean archived) - { - // tear down the file plan roles - getFilePlanRoleService().tearDownFilePlanRoles(childAssocRef.getChildRef()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.rule.RuleModel; +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; + +/** + * rma:filePlan behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:filePlan" +) +public class FilePlanType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateChildAssociationPolicy, + NodeServicePolicies.OnCreateNodePolicy, + NodeServicePolicies.OnDeleteNodePolicy +{ + /** file plan service */ + private FilePlanService filePlanService; + + /** record folder service */ + private RecordFolderService recordFolderService; + + /** identifier service */ + private IdentifierService identifierService; + + /** file plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** + * @return File plan service + */ + protected FilePlanService getFilePlanService() + { + return this.filePlanService; + } + + /** + * @return Record folder service + */ + protected RecordFolderService getRecordFolderService() + { + return this.recordFolderService; + } + + /** + * @return Identifier service + */ + protected IdentifierService getIdentifierService() + { + return this.identifierService; + } + + /** + * @return File plan role service + */ + protected FilePlanRoleService getFilePlanRoleService() + { + return this.filePlanRoleService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param identifierService identifier service + */ + public void setIdentifierService(IdentifierService identifierService) + { + this.identifierService = identifierService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION + ) + @Override + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) + { + // ensure we are not trying to put content in the file plan root node + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) + { + throw new AlfrescoRuntimeException("Operation failed, because you can't place content in the root of the file plan."); + } + + // ensure we are not trying to put a record folder in the root of the file plan + NodeRef parent = childAssocRef.getParentRef(); + if (getFilePlanService().isFilePlan(parent) && getRecordFolderService().isRecordFolder(nodeRef)) + { + throw new AlfrescoRuntimeException("Operation failed, because you can not place a record folder in the root of the file plan."); + } + + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + @Override + public void onCreateNode(final ChildAssociationRef childAssocRef) + { + final NodeRef filePlan = childAssocRef.getChildRef(); + + AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Object doWork() + { + // ensure rules are not inherited + nodeService.addAspect(filePlan, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + + // set the identifier + if (nodeService.getProperty(filePlan, PROP_IDENTIFIER) == null) + { + String id = getIdentifierService().generateIdentifier(filePlan); + nodeService.setProperty(filePlan, RecordsManagementModel.PROP_IDENTIFIER, id); + } + + return null; + } + }); + + // setup the file plan roles + getFilePlanRoleService().setupFilePlanRoles(filePlan); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + @Override + public void onDeleteNode(ChildAssociationRef childAssocRef, boolean archived) + { + // tear down the file plan roles + getFilePlanRoleService().tearDownFilePlanRoles(childAssocRef.getChildRef()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java index c01f544991..0728ca3d29 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java @@ -1,77 +1,77 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -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.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:holdContainer behaviour bean - * - * @author Mihai Cozma - * @since 2.4 - */ -@BehaviourBean(defaultType = "rma:holdContainer") -public class HoldContainerType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy -{ - private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; - - /** - * On every event - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, - * boolean) - */ - @Override - @Behaviour(kind = BehaviourKind.ASSOCIATION) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - - NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( - I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } - - } - - @Override - public void onCreateNode(ChildAssociationRef childAssocRef) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( - I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +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.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * rma:holdContainer behaviour bean + * + * @author Mihai Cozma + * @since 2.4 + */ +@BehaviourBean(defaultType = "rma:holdContainer") +public class HoldContainerType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy +{ + private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; + + /** + * On every event + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, + * boolean) + */ + @Override + @Behaviour(kind = BehaviourKind.ASSOCIATION) + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) + { + + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( + I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } + + } + + @Override + public void onCreateNode(ChildAssociationRef childAssocRef) + { + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( + I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } + + } +} 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 2e73f64818..8a16406151 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 @@ -1,216 +1,216 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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:recordCategory behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordCategory" -) -public class RecordCategoryType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnCreateNodePolicy -{ - /** vital record service */ - protected VitalRecordService vitalRecordService; - - /** file plan permission service */ - protected FilePlanPermissionService filePlanPermissionService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** - * @param vitalRecordService vital record service - */ - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - /** - * @param filePlanPermissionService file plan permission service - */ - public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) - { - this.filePlanPermissionService = filePlanPermissionService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * On every event - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION - ) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - // ensure content is not placed directly into a record category - NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) - { - throw new AlfrescoRuntimeException("Operation failed, because you can't place content directly into a record category."); - } - - if (bNew) - { - // setup the record folder - recordFolderService.setupRecordFolder(nodeRef); - } - } - - /** - * On transaction commit - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - policy = "alf:onCreateChildAssociation", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew) - { - final NodeRef recordCategory = childAssocRef.getChildRef(); - - behaviourFilter.disableBehaviour(); - try - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // setup vital record definition - vitalRecordService.setupVitalRecordDefinition(recordCategory); - - return null; - } - }); - } - finally - { - behaviourFilter.enableBehaviour(); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateNode(final ChildAssociationRef childAssocRef) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("rma:recordCategory|alf:onCreateNode|this.onCreateNode()|TRANSATION_COMMIT"); - } - - // execute behaviour code as system user - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // setup record category permissions - filePlanPermissionService.setupRecordCategoryPermissions(childAssocRef.getChildRef()); - - return null; - } - }); - - } - - /** - * Copy callback for record category - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback onCopyRecordCategory(final QName classRef, final CopyDetails copyDetails) - { - return new DefaultCopyBehaviourCallback() - { - /** - * If the targets parent is a Record Folder -- Do Not Allow Copy - * - * @param classQName - * @param copyDetails - * @return boolean - */ - @Override - public boolean getMustCopy(QName classQName, CopyDetails copyDetails) - { - return nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER) ? false : true; - } - }; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +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:recordCategory behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:recordCategory" +) +public class RecordCategoryType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateChildAssociationPolicy, + NodeServicePolicies.OnCreateNodePolicy +{ + /** vital record service */ + protected VitalRecordService vitalRecordService; + + /** file plan permission service */ + protected FilePlanPermissionService filePlanPermissionService; + + /** record folder service */ + private RecordFolderService recordFolderService; + + /** + * @param vitalRecordService vital record service + */ + public void setVitalRecordService(VitalRecordService vitalRecordService) + { + this.vitalRecordService = vitalRecordService; + } + + /** + * @param filePlanPermissionService file plan permission service + */ + public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) + { + this.filePlanPermissionService = filePlanPermissionService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * On every event + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION + ) + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) + { + // ensure content is not placed directly into a record category + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) + { + throw new AlfrescoRuntimeException("Operation failed, because you can't place content directly into a record category."); + } + + if (bNew) + { + // setup the record folder + recordFolderService.setupRecordFolder(nodeRef); + } + } + + /** + * On transaction commit + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION, + policy = "alf:onCreateChildAssociation", + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew) + { + final NodeRef recordCategory = childAssocRef.getChildRef(); + + behaviourFilter.disableBehaviour(); + try + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // setup vital record definition + vitalRecordService.setupVitalRecordDefinition(recordCategory); + + return null; + } + }); + } + finally + { + behaviourFilter.enableBehaviour(); + } + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onCreateNode(final ChildAssociationRef childAssocRef) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("rma:recordCategory|alf:onCreateNode|this.onCreateNode()|TRANSATION_COMMIT"); + } + + // execute behaviour code as system user + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // setup record category permissions + filePlanPermissionService.setupRecordCategoryPermissions(childAssocRef.getChildRef()); + + return null; + } + }); + + } + + /** + * Copy callback for record category + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback onCopyRecordCategory(final QName classRef, final CopyDetails copyDetails) + { + return new DefaultCopyBehaviourCallback() + { + /** + * If the targets parent is a Record Folder -- Do Not Allow Copy + * + * @param classQName + * @param copyDetails + * @return boolean + */ + @Override + public boolean getMustCopy(QName classQName, CopyDetails copyDetails) + { + return nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER) ? false : true; + } + }; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java index 5974c922a6..d9b8ffe6b4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java @@ -1,273 +1,273 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.AbstractDisposableItem; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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; -import org.apache.commons.lang.ArrayUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:recordFolder behaviour bean - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordFolder" -) -public class RecordFolderType extends AbstractDisposableItem - implements NodeServicePolicies.OnMoveNodePolicy, - NodeServicePolicies.OnCreateChildAssociationPolicy -{ - /** record service */ - private RecordService recordService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** vital record service */ - protected VitalRecordService vitalRecordService; - - /** I18N */ - private static final String MSG_CANNOT_CREATE_RECORD_FOLDER = "rm.action.record-folder-create"; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param vitalRecordService vital record service - */ - public void setVitalRecordService(VitalRecordService vitalRecordService) - { - this.vitalRecordService = vitalRecordService; - } - - /** - * Record folder move behaviour - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - if (!nodeService.getType(newChildAssocRef.getParentRef()).equals(TYPE_RECORD_FOLDER)) - { - if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef())) - { - final NodeRef newNodeRef = newChildAssocRef.getChildRef(); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - // clean record folder - cleanDisposableItem(nodeService, newNodeRef); - - // re-initialise the record folder - recordFolderService.setupRecordFolder(newNodeRef); - - // sort out the child records - for (NodeRef record : recordService.getRecords(newNodeRef)) - { - // clean record - cleanDisposableItem(nodeService, record); - - // Re-initiate the records in the new folder. - recordService.file(record); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - } - else - { - throw new UnsupportedOperationException("Cannot move record folder into another record folder."); - } - } - - /** - * Record folder copy callback - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(final QName classRef, final CopyDetails copyDetails) - { - return new DefaultCopyBehaviourCallback() - { - @Override - public Map getCopyProperties(QName classRef, CopyDetails copyDetails, Map properties) - { - Map sourceProperties = super.getCopyProperties(classRef, copyDetails, properties); - - // ensure that the 'closed' status of the record folder is not copied - if (sourceProperties.containsKey(PROP_IS_CLOSED)) - { - sourceProperties.remove(PROP_IS_CLOSED); - } - - return sourceProperties; - } - - /** - * If the targets parent is a Record Folder -- Do Not Allow Copy - * - * @param classQName - * @param copyDetails - * @return boolean - */ - @Override - public boolean getMustCopy(QName classQName, CopyDetails copyDetails) - { - boolean result = true; - - if (nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER)) - { - result = false; - } - else if (ArrayUtils.contains(unwantedAspects, classQName)) - { - result = false; - } - - return result; - } - }; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - - if (nodeService.exists(nodeRef)) - { - // ensure nothing is being added to a closed record folder - NodeRef recordFolder = childAssocRef.getParentRef(); - Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED); - if (isClosed != null && isClosed) - { - throw new AlfrescoRuntimeException("You can't add new items to a closed record folder."); - } - } - } - - /** - * On transaction commit - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - policy = "alf:onCreateChildAssociation", - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT - ) - public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew) - { - final NodeRef recordFolder = childAssocRef.getChildRef(); - - // only records can be added in a record folder or hidden folders(is the case of e-mail attachments) - if (!instanceOf(recordFolder, ContentModel.TYPE_CONTENT) && !nodeService.hasAspect(recordFolder, ContentModel.ASPECT_HIDDEN)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_CREATE_RECORD_FOLDER)); - } - - behaviourFilter.disableBehaviour(); - try - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // setup vital record definition - vitalRecordService.setupVitalRecordDefinition(recordFolder); - - return null; - } - }); - } - finally - { - behaviourFilter.enableBehaviour(); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.AbstractDisposableItem; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; +import org.alfresco.repo.copy.CopyBehaviourCallback; +import org.alfresco.repo.copy.CopyDetails; +import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +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; +import org.apache.commons.lang.ArrayUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * rma:recordFolder behaviour bean + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:recordFolder" +) +public class RecordFolderType extends AbstractDisposableItem + implements NodeServicePolicies.OnMoveNodePolicy, + NodeServicePolicies.OnCreateChildAssociationPolicy +{ + /** record service */ + private RecordService recordService; + + /** record folder service */ + private RecordFolderService recordFolderService; + + /** vital record service */ + protected VitalRecordService vitalRecordService; + + /** I18N */ + private static final String MSG_CANNOT_CREATE_RECORD_FOLDER = "rm.action.record-folder-create"; + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param vitalRecordService vital record service + */ + public void setVitalRecordService(VitalRecordService vitalRecordService) + { + this.vitalRecordService = vitalRecordService; + } + + /** + * Record folder move behaviour + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) + { + if (!nodeService.getType(newChildAssocRef.getParentRef()).equals(TYPE_RECORD_FOLDER)) + { + if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef())) + { + final NodeRef newNodeRef = newChildAssocRef.getChildRef(); + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + // clean record folder + cleanDisposableItem(nodeService, newNodeRef); + + // re-initialise the record folder + recordFolderService.setupRecordFolder(newNodeRef); + + // sort out the child records + for (NodeRef record : recordService.getRecords(newNodeRef)) + { + // clean record + cleanDisposableItem(nodeService, record); + + // Re-initiate the records in the new folder. + recordService.file(record); + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + } + else + { + throw new UnsupportedOperationException("Cannot move record folder into another record folder."); + } + } + + /** + * Record folder copy callback + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + policy = "alf:getCopyCallback" + ) + public CopyBehaviourCallback getCopyCallback(final QName classRef, final CopyDetails copyDetails) + { + return new DefaultCopyBehaviourCallback() + { + @Override + public Map getCopyProperties(QName classRef, CopyDetails copyDetails, Map properties) + { + Map sourceProperties = super.getCopyProperties(classRef, copyDetails, properties); + + // ensure that the 'closed' status of the record folder is not copied + if (sourceProperties.containsKey(PROP_IS_CLOSED)) + { + sourceProperties.remove(PROP_IS_CLOSED); + } + + return sourceProperties; + } + + /** + * If the targets parent is a Record Folder -- Do Not Allow Copy + * + * @param classQName + * @param copyDetails + * @return boolean + */ + @Override + public boolean getMustCopy(QName classQName, CopyDetails copyDetails) + { + boolean result = true; + + if (nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER)) + { + result = false; + } + else if (ArrayUtils.contains(unwantedAspects, classQName)) + { + result = false; + } + + return result; + } + }; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) + { + NodeRef nodeRef = childAssocRef.getChildRef(); + + if (nodeService.exists(nodeRef)) + { + // ensure nothing is being added to a closed record folder + NodeRef recordFolder = childAssocRef.getParentRef(); + Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED); + if (isClosed != null && isClosed) + { + throw new AlfrescoRuntimeException("You can't add new items to a closed record folder."); + } + } + } + + /** + * On transaction commit + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION, + policy = "alf:onCreateChildAssociation", + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT + ) + public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew) + { + final NodeRef recordFolder = childAssocRef.getChildRef(); + + // only records can be added in a record folder or hidden folders(is the case of e-mail attachments) + if (!instanceOf(recordFolder, ContentModel.TYPE_CONTENT) && !nodeService.hasAspect(recordFolder, ContentModel.ASPECT_HIDDEN)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_CREATE_RECORD_FOLDER)); + } + + behaviourFilter.disableBehaviour(); + try + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // setup vital record definition + vitalRecordService.setupVitalRecordDefinition(recordFolder); + + return null; + } + }); + } + finally + { + behaviourFilter.enableBehaviour(); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java index 522cd5d96e..68a1d39ea9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java @@ -1,233 +1,233 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -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; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:recordsManagementContainer behaviour bean. - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:recordsManagementContainer" -) -public class RecordsManagementContainerType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy -{ - /** behaviour name */ - private static final String BEHAVIOUR_NAME = "onCreateContainerType"; - - /** identifier service */ - protected IdentifierService identifierService; - - /** record service */ - protected RecordService recordService; - - /** record folder service */ - protected RecordFolderService recordFolderService; - - /** I18N */ - private static final String MSG_CANNOT_CAST_TO_RM_TYPE = "rm.action.cast-to-rm-type"; - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * Disable the behaviours for this transaction - * - * @since 2.3 - */ - public void disable() - { - getBehaviour(BEHAVIOUR_NAME).disable(); - } - - /** - * Enable behaviours for this transaction - * - * @since 2.3 - */ - public void enable() - { - getBehaviour(BEHAVIOUR_NAME).enable(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.BaseTypeBehaviour#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Behaviour - ( - kind = BehaviourKind.ASSOCIATION, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT, - name = BEHAVIOUR_NAME - ) - public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Get the elements of the created association - final NodeRef child = childAssocRef.getChildRef(); - if (nodeService.exists(child)) - { - QName childType = nodeService.getType(child); - - // We only care about "folder" or sub-types that are not hidden. - // Some modules use hidden files to store information (see RM-3283) - if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) && - !nodeService.hasAspect(child, ContentModel.ASPECT_HIDDEN)) - { - if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER)) - { - // this is a rule container, make sure it is an file plan component - nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); - } - else - { - // We need to automatically cast the created folder to RM type if it is a plain folder - // This occurs if the RM folder has been created via IMap, WebDav, etc - if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT)) - { - // Throw exception if the type is not cm:folder - if (!ContentModel.TYPE_FOLDER.equals(childType)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_CAST_TO_RM_TYPE)); - } - // check the type of the parent to determine what 'kind' of artifact to create - NodeRef parent = childAssocRef.getParentRef(); - QName parentType = nodeService.getType(parent); - - if (dictionaryService.isSubClass(parentType, TYPE_FILE_PLAN)) - { - // create a rma:recordCategoty since we are in the root of the file plan - nodeService.setType(child, TYPE_RECORD_CATEGORY); - } - else - { - // create a rma:recordFolder and initialise record folder - nodeService.setType(child, TYPE_RECORD_FOLDER); - recordFolderService.setupRecordFolder(child); - } - } - - // Catch all to generate the rm id (assuming it doesn't already have one!) - setIdenifierProperty(child); - } - } - else - { - NodeRef parentRef = childAssocRef.getParentRef(); - QName parentType = nodeService.getType(parentRef); - boolean isContentSubType = dictionaryService.isSubClass(childType, ContentModel.TYPE_CONTENT); - boolean isUnfiledRecordContainer = parentType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - boolean isUnfiledRecordFolder = parentType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); - if (isContentSubType && (isUnfiledRecordContainer || isUnfiledRecordFolder)) - { - if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT)) - { - nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); - } - if (!nodeService.hasAspect(child, ASPECT_RECORD)) - { - recordService.makeRecord(child); - } - } - } - } - - return null; - } - }); - - } - - /** - * Set the identifier property - * - * @param nodeRef node reference - */ - protected void setIdenifierProperty(final NodeRef nodeRef) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Object doWork() - { - if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) && - nodeService.getProperty(nodeRef, PROP_IDENTIFIER) == null) - { - String id = identifierService.generateIdentifier(nodeRef); - nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER, id); - } - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +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; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * rma:recordsManagementContainer behaviour bean. + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:recordsManagementContainer" +) +public class RecordsManagementContainerType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateChildAssociationPolicy +{ + /** behaviour name */ + private static final String BEHAVIOUR_NAME = "onCreateContainerType"; + + /** identifier service */ + protected IdentifierService identifierService; + + /** record service */ + protected RecordService recordService; + + /** record folder service */ + protected RecordFolderService recordFolderService; + + /** I18N */ + private static final String MSG_CANNOT_CAST_TO_RM_TYPE = "rm.action.cast-to-rm-type"; + + /** + * @param identifierService identifier service + */ + public void setIdentifierService(IdentifierService identifierService) + { + this.identifierService = identifierService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * Disable the behaviours for this transaction + * + * @since 2.3 + */ + public void disable() + { + getBehaviour(BEHAVIOUR_NAME).disable(); + } + + /** + * Enable behaviours for this transaction + * + * @since 2.3 + */ + public void enable() + { + getBehaviour(BEHAVIOUR_NAME).enable(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.BaseTypeBehaviour#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Behaviour + ( + kind = BehaviourKind.ASSOCIATION, + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT, + name = BEHAVIOUR_NAME + ) + public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // Get the elements of the created association + final NodeRef child = childAssocRef.getChildRef(); + if (nodeService.exists(child)) + { + QName childType = nodeService.getType(child); + + // We only care about "folder" or sub-types that are not hidden. + // Some modules use hidden files to store information (see RM-3283) + if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) && + !nodeService.hasAspect(child, ContentModel.ASPECT_HIDDEN)) + { + if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER)) + { + // this is a rule container, make sure it is an file plan component + nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); + } + else + { + // We need to automatically cast the created folder to RM type if it is a plain folder + // This occurs if the RM folder has been created via IMap, WebDav, etc + if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT)) + { + // Throw exception if the type is not cm:folder + if (!ContentModel.TYPE_FOLDER.equals(childType)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_CAST_TO_RM_TYPE)); + } + // check the type of the parent to determine what 'kind' of artifact to create + NodeRef parent = childAssocRef.getParentRef(); + QName parentType = nodeService.getType(parent); + + if (dictionaryService.isSubClass(parentType, TYPE_FILE_PLAN)) + { + // create a rma:recordCategoty since we are in the root of the file plan + nodeService.setType(child, TYPE_RECORD_CATEGORY); + } + else + { + // create a rma:recordFolder and initialise record folder + nodeService.setType(child, TYPE_RECORD_FOLDER); + recordFolderService.setupRecordFolder(child); + } + } + + // Catch all to generate the rm id (assuming it doesn't already have one!) + setIdenifierProperty(child); + } + } + else + { + NodeRef parentRef = childAssocRef.getParentRef(); + QName parentType = nodeService.getType(parentRef); + boolean isContentSubType = dictionaryService.isSubClass(childType, ContentModel.TYPE_CONTENT); + boolean isUnfiledRecordContainer = parentType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); + boolean isUnfiledRecordFolder = parentType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER); + if (isContentSubType && (isUnfiledRecordContainer || isUnfiledRecordFolder)) + { + if (!nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT)) + { + nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); + } + if (!nodeService.hasAspect(child, ASPECT_RECORD)) + { + recordService.makeRecord(child); + } + } + } + } + + return null; + } + }); + + } + + /** + * Set the identifier property + * + * @param nodeRef node reference + */ + protected void setIdenifierProperty(final NodeRef nodeRef) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Object doWork() + { + if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) && + nodeService.getProperty(nodeRef, PROP_IDENTIFIER) == null) + { + String id = identifierService.generateIdentifier(nodeRef); + nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER, id); + } + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java index d45b21ff54..0a6c839818 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java @@ -1,298 +1,298 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; - -/** - * Behaviour associated with the RM Site type - * - * @author Roy Wetherall - * @since 2.2 - */ -@BehaviourBean -( - defaultType = "rma:rmsite" -) -public class RmSiteType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateNodePolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.BeforeDeleteNodePolicy -{ - /** Constant values */ - public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary"; - public static final String DEFAULT_SITE_NAME = "rm"; - public static final QName DEFAULT_FILE_PLAN_TYPE = TYPE_FILE_PLAN; - - /** Site service */ - protected SiteService siteService; - - /** Record Management Search Service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Capability service */ - protected CapabilityService capabilityService; - - /** Authority service */ - private AuthorityService authorityService; - - /** Map of file plan type's key'ed by corresponding site types */ - protected Map mapFilePlanType = new HashMap(3); - - /** - * Set the site service - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * Registers a file plan type for a specific site type. - * - * @param siteType siteType sub-type of rma:rmsite - * @param filePlanType filePlanType sub-type of rma:filePlan - * @since 2.2 - */ - public void registerFilePlanType(QName siteType, QName filePlanType) - { - ParameterCheck.mandatory("siteType", siteType); - ParameterCheck.mandatory("filePlanType", filePlanType); - - // check that the registered site type is a subtype of rma:rmsite - if (!dictionaryService.isSubClass(siteType, TYPE_RM_SITE)) - { - throw new AlfrescoRuntimeException( - "Can't register site type, because site type is not a sub type of rma:rmsite (siteType=" + siteType.toString() + ")"); - } - - // check that the registered file plan type is a sub type of rma:filePlan - if (!dictionaryService.isSubClass(filePlanType, TYPE_FILE_PLAN)) - { - throw new AlfrescoRuntimeException( - "Can't register file plan type, because site type is not a sub type of rma:filePlan (filePlanType=" + filePlanType.toString() + ")"); - } - - // add site and file plan types to map - mapFilePlanType.put(siteType, filePlanType); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onCreateNode(ChildAssociationRef childAssocRef) - { - final NodeRef rmSite = childAssocRef.getChildRef(); - - // Do not execute behaviour if this has been created in the archive store - if(rmSite.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE)) - { - // This is not the spaces store - probably the archive store - return; - } - - if (nodeService.exists(rmSite)) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - SiteInfo siteInfo = siteService.getSite(rmSite); - if (siteInfo != null) - { - // Create the file plan component - siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, getFilePlanType(siteInfo), null); - - // Add the reports - recordsManagementSearchService.addReports(siteInfo.getShortName()); - } - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - } - - /** - * Get the file plan type for the given site. - * - * @param siteInfo site info - * @return QName file plan type to create as a container - * @since 2.2 - */ - private QName getFilePlanType(SiteInfo siteInfo) - { - ParameterCheck.mandatory("siteInfo", siteInfo); - - // set default file plan - QName result = DEFAULT_FILE_PLAN_TYPE; - - // check to see if there is an 'override' for the file plan type given the site type - QName siteType = nodeService.getType(siteInfo.getNodeRef()); - if (mapFilePlanType.containsKey(siteType)) - { - result = mapFilePlanType.get(siteType); - } - - return result; - } - - /** - * Ensure that the visibility of a RM site can not be changed to anything but public. - * - * TODO support other site visibilities - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (nodeService.exists(nodeRef)) - { - Map changed = PropertyMap.getChangedProperties(before, after); - if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) && - changed.get(SiteModel.PROP_SITE_VISIBILITY) != null && - !SiteVisibility.PUBLIC.equals(changed.get(SiteModel.PROP_SITE_VISIBILITY))) - { - // we do not current support non-public RM sites - throw new AlfrescoRuntimeException("The records management site must have public visibility. It can't be changed to " + changed.get(SiteModel.PROP_SITE_VISIBILITY)); - } - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - notificationFrequency = NotificationFrequency.FIRST_EVENT - ) - public void beforeDeleteNode(NodeRef nodeRef) - { - final SiteInfo siteInfo = siteService.getSite(nodeRef); - if (siteInfo != null) - { - // grab the file plan for the RM site - NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return siteService.getContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY); - } - - }); - - if (filePlan != null) - { - // determine whether the current user has delete capability on the file plan node - AccessStatus accessStatus = capabilityService.getCapabilityAccessState(filePlan, "Delete"); - if (AccessStatus.DENIED.equals(accessStatus)) - { - throw new AlfrescoRuntimeException("The records management site can not be deleted, because the user doesn't have sufficient privillages to delete the file plan."); - } - - // work around for MNT-11038 .. we want to ensure that the RM site can be created once it's been deleted since we only - // allow one short name for the RM site - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // delete the authority - String siteGroup = siteService.getSiteGroup(siteInfo.getShortName()); - authorityService.deleteAuthority(siteGroup, true); - - return null; - } - }); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; +import org.alfresco.util.PropertyMap; + +/** + * Behaviour associated with the RM Site type + * + * @author Roy Wetherall + * @since 2.2 + */ +@BehaviourBean +( + defaultType = "rma:rmsite" +) +public class RmSiteType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateNodePolicy, + NodeServicePolicies.OnUpdatePropertiesPolicy, + NodeServicePolicies.BeforeDeleteNodePolicy +{ + /** Constant values */ + public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary"; + public static final String DEFAULT_SITE_NAME = "rm"; + public static final QName DEFAULT_FILE_PLAN_TYPE = TYPE_FILE_PLAN; + + /** Site service */ + protected SiteService siteService; + + /** Record Management Search Service */ + protected RecordsManagementSearchService recordsManagementSearchService; + + /** Capability service */ + protected CapabilityService capabilityService; + + /** Authority service */ + private AuthorityService authorityService; + + /** Map of file plan type's key'ed by corresponding site types */ + protected Map mapFilePlanType = new HashMap(3); + + /** + * Set the site service + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @param recordsManagementSearchService records management search service + */ + public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) + { + this.recordsManagementSearchService = recordsManagementSearchService; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * Registers a file plan type for a specific site type. + * + * @param siteType siteType sub-type of rma:rmsite + * @param filePlanType filePlanType sub-type of rma:filePlan + * @since 2.2 + */ + public void registerFilePlanType(QName siteType, QName filePlanType) + { + ParameterCheck.mandatory("siteType", siteType); + ParameterCheck.mandatory("filePlanType", filePlanType); + + // check that the registered site type is a subtype of rma:rmsite + if (!dictionaryService.isSubClass(siteType, TYPE_RM_SITE)) + { + throw new AlfrescoRuntimeException( + "Can't register site type, because site type is not a sub type of rma:rmsite (siteType=" + siteType.toString() + ")"); + } + + // check that the registered file plan type is a sub type of rma:filePlan + if (!dictionaryService.isSubClass(filePlanType, TYPE_FILE_PLAN)) + { + throw new AlfrescoRuntimeException( + "Can't register file plan type, because site type is not a sub type of rma:filePlan (filePlanType=" + filePlanType.toString() + ")"); + } + + // add site and file plan types to map + mapFilePlanType.put(siteType, filePlanType); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onCreateNode(ChildAssociationRef childAssocRef) + { + final NodeRef rmSite = childAssocRef.getChildRef(); + + // Do not execute behaviour if this has been created in the archive store + if(rmSite.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE)) + { + // This is not the spaces store - probably the archive store + return; + } + + if (nodeService.exists(rmSite)) + { + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + SiteInfo siteInfo = siteService.getSite(rmSite); + if (siteInfo != null) + { + // Create the file plan component + siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, getFilePlanType(siteInfo), null); + + // Add the reports + recordsManagementSearchService.addReports(siteInfo.getShortName()); + } + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + } + + /** + * Get the file plan type for the given site. + * + * @param siteInfo site info + * @return QName file plan type to create as a container + * @since 2.2 + */ + private QName getFilePlanType(SiteInfo siteInfo) + { + ParameterCheck.mandatory("siteInfo", siteInfo); + + // set default file plan + QName result = DEFAULT_FILE_PLAN_TYPE; + + // check to see if there is an 'override' for the file plan type given the site type + QName siteType = nodeService.getType(siteInfo.getNodeRef()); + if (mapFilePlanType.containsKey(siteType)) + { + result = mapFilePlanType.get(siteType); + } + + return result; + } + + /** + * Ensure that the visibility of a RM site can not be changed to anything but public. + * + * TODO support other site visibilities + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) + { + if (nodeService.exists(nodeRef)) + { + Map changed = PropertyMap.getChangedProperties(before, after); + if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) && + changed.get(SiteModel.PROP_SITE_VISIBILITY) != null && + !SiteVisibility.PUBLIC.equals(changed.get(SiteModel.PROP_SITE_VISIBILITY))) + { + // we do not current support non-public RM sites + throw new AlfrescoRuntimeException("The records management site must have public visibility. It can't be changed to " + changed.get(SiteModel.PROP_SITE_VISIBILITY)); + } + } + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Behaviour + ( + kind = BehaviourKind.CLASS, + notificationFrequency = NotificationFrequency.FIRST_EVENT + ) + public void beforeDeleteNode(NodeRef nodeRef) + { + final SiteInfo siteInfo = siteService.getSite(nodeRef); + if (siteInfo != null) + { + // grab the file plan for the RM site + NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public NodeRef doWork() + { + return siteService.getContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY); + } + + }); + + if (filePlan != null) + { + // determine whether the current user has delete capability on the file plan node + AccessStatus accessStatus = capabilityService.getCapabilityAccessState(filePlan, "Delete"); + if (AccessStatus.DENIED.equals(accessStatus)) + { + throw new AlfrescoRuntimeException("The records management site can not be deleted, because the user doesn't have sufficient privillages to delete the file plan."); + } + + // work around for MNT-11038 .. we want to ensure that the RM site can be created once it's been deleted since we only + // allow one short name for the RM site + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // delete the authority + String siteGroup = siteService.getSiteGroup(siteInfo.getShortName()); + authorityService.deleteAuthority(siteGroup, true); + + return null; + } + }); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java index a557cf2efe..9aab924c06 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java @@ -1,75 +1,75 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -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.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * rma:transferContainer behaviour bean - * - * @author Mihai Cozma - * @since 2.4 - */ -@BehaviourBean(defaultType = "rma:transferContainer") -public class TransferContainerType extends BaseBehaviourBean - implements NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy -{ - private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; - - /** - * On every event - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, - * boolean) - */ - @Override - @Behaviour(kind = BehaviourKind.ASSOCIATION) - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) - { - // ensure not content to be added in Holdsfolder - NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( - I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } - } - - @Override - public void onCreateNode(ChildAssociationRef childAssocRef) - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( - I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +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.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * rma:transferContainer behaviour bean + * + * @author Mihai Cozma + * @since 2.4 + */ +@BehaviourBean(defaultType = "rma:transferContainer") +public class TransferContainerType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy +{ + private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; + + /** + * On every event + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, + * boolean) + */ + @Override + @Behaviour(kind = BehaviourKind.ASSOCIATION) + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) + { + // ensure not content to be added in Holdsfolder + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( + I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } + } + + @Override + public void onCreateNode(ChildAssociationRef childAssocRef) + { + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( + I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelAccessDeniedException.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelAccessDeniedException.java index 6f15303003..09760be1ac 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelAccessDeniedException.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelAccessDeniedException.java @@ -1,51 +1,51 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.security; - -import org.alfresco.repo.security.permissions.AccessDeniedException; - -/** - * Model access denied exception implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ModelAccessDeniedException extends AccessDeniedException -{ - private static final long serialVersionUID = 6796435040345714366L; - - public ModelAccessDeniedException(String msg) - { - super(msg); - } - - public ModelAccessDeniedException(String msg, Throwable cause) - { - super(msg, cause); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.security; + +import org.alfresco.repo.security.permissions.AccessDeniedException; + +/** + * Model access denied exception implementation + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ModelAccessDeniedException extends AccessDeniedException +{ + private static final long serialVersionUID = 6796435040345714366L; + + public ModelAccessDeniedException(String msg) + { + super(msg); + } + + public ModelAccessDeniedException(String msg, Throwable cause) + { + super(msg, cause); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java index 13024343f1..e2558b5c84 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityService.java @@ -1,149 +1,149 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.security; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Model security service interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface ModelSecurityService -{ - /** - * Sets whether model security is enabled globally or not. - * - * @param enabled - */ - void setEnabled(boolean enabled); - - /** - * Indicates whether model security is enabled or not. - * - * @return - */ - boolean isEnabled(); - - /** - * Disable model security checks for the current thread. - */ - void disable(); - - /** - * Enable model security checks for the current thread. - */ - void enable(); - - /** - * Registers a protected model artifact with the service. - * - * @param atrifact protected model artifact - */ - void register(ProtectedModelArtifact atrifact); - - /** - * Indicates whether a property is protected or not. - * - * @param name name of property - * @return boolean true if property is protected, false otherwise - */ - boolean isProtectedProperty(QName property); - - /** - * Get the protected properties - * - * @return {@link Set}<{@link QName}> all the protected properties - */ - Set getProtectedProperties(); - - /** - * Get the details of the protected property, returns null if property - * is not protected. - * - * @param name name of the protected property - * @return {@link ProtectedProperty} protected property details, null otherwise - */ - ProtectedProperty getProtectedProperty(QName name); - - /** - * Indicates whether the current user can edit a protected property in the context of - * a given node. - *

- * If the property is not protected then returns true. - * - * @param nodeRef node reference - * @param property name of the property - * @return boolean true if the current user can edit the protected property or the property - * is not protected, false otherwise - */ - boolean canEditProtectedProperty(NodeRef nodeRef, QName property); - - /** - * Indicates whether an aspect is protected or not. - * - * @param aspect aspect name - * @return boolean true if aspect is protected, false otherwise - */ - boolean isProtectedAspect(QName aspect); - - /** - * Get the protected aspects. - * - * @return {@link Set}<{@link QName}> all the protected aspects - */ - Set getProtectedAspects(); - - /** - * Get the details of the protected aspect, returns null if aspect is - * not protected. - * - * @param name name of the aspect - * @return {@link ProtectedAspect} protected aspect details, null otherwise - */ - ProtectedAspect getProtectedAspect(QName name); - - /** - * Indicates whether the current user can edit (ie add or remove) a protected - * aspect in the context of a given node. - *

- * If the aspect is not protected then returns true. - * - * @param nodeRef node reference - * @param aspect name of the of aspect - * @return boolean true if the current user can edit the protected aspect or the the - * aspect is not protected, false otherwise - */ - boolean canEditProtectedAspect(NodeRef nodeRef, QName aspect); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.security; + +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Model security service interface. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface ModelSecurityService +{ + /** + * Sets whether model security is enabled globally or not. + * + * @param enabled + */ + void setEnabled(boolean enabled); + + /** + * Indicates whether model security is enabled or not. + * + * @return + */ + boolean isEnabled(); + + /** + * Disable model security checks for the current thread. + */ + void disable(); + + /** + * Enable model security checks for the current thread. + */ + void enable(); + + /** + * Registers a protected model artifact with the service. + * + * @param atrifact protected model artifact + */ + void register(ProtectedModelArtifact atrifact); + + /** + * Indicates whether a property is protected or not. + * + * @param name name of property + * @return boolean true if property is protected, false otherwise + */ + boolean isProtectedProperty(QName property); + + /** + * Get the protected properties + * + * @return {@link Set}<{@link QName}> all the protected properties + */ + Set getProtectedProperties(); + + /** + * Get the details of the protected property, returns null if property + * is not protected. + * + * @param name name of the protected property + * @return {@link ProtectedProperty} protected property details, null otherwise + */ + ProtectedProperty getProtectedProperty(QName name); + + /** + * Indicates whether the current user can edit a protected property in the context of + * a given node. + *

+ * If the property is not protected then returns true. + * + * @param nodeRef node reference + * @param property name of the property + * @return boolean true if the current user can edit the protected property or the property + * is not protected, false otherwise + */ + boolean canEditProtectedProperty(NodeRef nodeRef, QName property); + + /** + * Indicates whether an aspect is protected or not. + * + * @param aspect aspect name + * @return boolean true if aspect is protected, false otherwise + */ + boolean isProtectedAspect(QName aspect); + + /** + * Get the protected aspects. + * + * @return {@link Set}<{@link QName}> all the protected aspects + */ + Set getProtectedAspects(); + + /** + * Get the details of the protected aspect, returns null if aspect is + * not protected. + * + * @param name name of the aspect + * @return {@link ProtectedAspect} protected aspect details, null otherwise + */ + ProtectedAspect getProtectedAspect(QName name); + + /** + * Indicates whether the current user can edit (ie add or remove) a protected + * aspect in the context of a given node. + *

+ * If the aspect is not protected then returns true. + * + * @param nodeRef node reference + * @param aspect name of the of aspect + * @return boolean true if the current user can edit the protected aspect or the the + * aspect is not protected, false otherwise + */ + boolean canEditProtectedAspect(NodeRef nodeRef, QName aspect); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java index 46f183460f..87ca90d27e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ModelSecurityServiceImpl.java @@ -1,372 +1,372 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.security; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.EqualsHelper; - - -/** - * Model security service implementation. - *

- * This service records the protected properties and aspects, ensuring that only those with the appropriate capabilities can edit them. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class ModelSecurityServiceImpl extends BaseBehaviourBean - implements ModelSecurityService, - NodeServicePolicies.BeforeAddAspectPolicy, - NodeServicePolicies.BeforeRemoveAspectPolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** Indicates whether model security is enabled or not */ - private boolean enabled = true; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Map of protected properties keyed by name */ - private Map protectedProperties = new HashMap(21); - - /** Map of protected aspects keyed by name */ - private Map protectedAspects= new HashMap(21); - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#setEnabled(boolean) - */ - public void setEnabled(boolean enabled) - { - this.enabled = enabled; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isEnabled() - */ - public boolean isEnabled() - { - return enabled; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#disable() - */ - @Override - public void disable() - { - getBehaviour("beforeAddAspect").disable(); - getBehaviour("beforeRemoveAspect").disable(); - getBehaviour("onUpdateProperties").disable(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#enable() - */ - @Override - public void enable() - { - getBehaviour("beforeAddAspect").enable(); - getBehaviour("beforeRemoveAspect").enable(); - getBehaviour("onUpdateProperties").enable(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#register(org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedModelArtifact) - */ - @Override - public void register(ProtectedModelArtifact artifact) - { - // TODO validate that the artifact has a valid property and has a capability set ... - - if (artifact instanceof ProtectedProperty) - { - protectedProperties.put(artifact.getQName(), (ProtectedProperty)artifact); - } - else if (artifact instanceof ProtectedAspect) - { - protectedAspects.put(artifact.getQName(), (ProtectedAspect)artifact); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isProtectedProperty(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isProtectedProperty(QName property) - { - return protectedProperties.containsKey(property); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedProperties() - */ - @Override - public Set getProtectedProperties() - { - return Collections.unmodifiableSet(protectedProperties.keySet()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedProperty(org.alfresco.service.namespace.QName) - */ - @Override - public ProtectedProperty getProtectedProperty(QName name) - { - return protectedProperties.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#canEditProtectedProperty(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - public boolean canEditProtectedProperty(NodeRef nodeRef, QName property) - { - boolean result = false; - - ProtectedModelArtifact artifact = getProtectedProperty(property); - if (artifact == null) - { - result = true; - } - else - { - result = canEdit(nodeRef, artifact); - } - - return result; - } - - /** - * Indicates whether the current user can edit protected model artifact in the context - * of a given node or not. - * - * @param nodeRef node reference - * @param artifact protected model artifact - * @return boolean true if the current user can edit the protected model artifact, false otherwise - */ - private boolean canEdit(NodeRef nodeRef, ProtectedModelArtifact artifact) - { - boolean result = false; - - NodeRef filePlan = filePlanService.getFilePlan(nodeRef); - if (filePlan != null) - { - for (Capability capability : artifact.getCapabilities()) - { - if (capability.hasPermission(nodeRef).equals(AccessStatus.ALLOWED)) - { - result = true; - break; - } - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isProtectedAspect(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isProtectedAspect(QName aspect) - { - return protectedAspects.containsKey(aspect); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedAspects() - */ - @Override - public Set getProtectedAspects() - { - return Collections.unmodifiableSet(protectedAspects.keySet()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedAspect(org.alfresco.service.namespace.QName) - */ - @Override - public ProtectedAspect getProtectedAspect(QName name) - { - return protectedAspects.get(name); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#canEditProtectedAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - public boolean canEditProtectedAspect(NodeRef nodeRef, QName aspect) - { - boolean result = false; - - ProtectedModelArtifact artifact = getProtectedAspect(aspect); - if (artifact == null) - { - result = true; - } - else - { - result = canEdit(nodeRef, artifact); - } - - return result; - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy#beforeAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - name = "beforeAddAspect" - ) - public void beforeAddAspect(NodeRef nodeRef, QName aspect) - { - if (enabled && - AuthenticationUtil.getFullyAuthenticatedUser() != null && - !AuthenticationUtil.isRunAsUserTheSystemUser() && - isProtectedAspect(aspect) && - nodeService.exists(nodeRef) && - !canEditProtectedAspect(nodeRef, aspect)) - { - // the user can't edit the protected aspect - throw new ModelAccessDeniedException( - "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + - " does not have the permission to add the protected aspect " + aspect.toPrefixString(namespaceService) + - " to the node " + nodeRef.toString()); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeRemoveAspectPolicy#beforeRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - name = "beforeRemoveAspect" - ) - public void beforeRemoveAspect(NodeRef nodeRef, QName aspect) - { - if (enabled && - AuthenticationUtil.getFullyAuthenticatedUser() != null && - !AuthenticationUtil.isRunAsUserTheSystemUser() && - isProtectedAspect(aspect) && - nodeService.exists(nodeRef) && - !canEditProtectedAspect(nodeRef, aspect)) - { - // the user can't edit the protected aspect - throw new ModelAccessDeniedException( - "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + - " does not have the permission to remove the protected aspect " + aspect.toPrefixString(namespaceService) + - " from the node " + nodeRef.toString()); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - isService = true, - name = "onUpdateProperties" - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (enabled && - AuthenticationUtil.getFullyAuthenticatedUser() != null && - !AuthenticationUtil.isRunAsUserTheSystemUser() && - nodeService.exists(nodeRef)) - { - for (Map.Entry entry : after.entrySet()) - { - QName property = entry.getKey(); - if (isProtectedProperty(property)) - { - // always allow if this is the first time we are setting the protected property - if (before == null || before.isEmpty() || before.get(property) == null) - { - return; - } - - if (!EqualsHelper.nullSafeEquals(before.get(property), entry.getValue()) && - !canEditProtectedProperty(nodeRef, property)) - { - // the user can't edit the protected property - throw new ModelAccessDeniedException( - "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + - " does not have the permission to edit the protected property " + property.toPrefixString(namespaceService) + - " on the node " + nodeRef.toString()); - } - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.security; + +import java.io.Serializable; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.EqualsHelper; + + +/** + * Model security service implementation. + *

+ * This service records the protected properties and aspects, ensuring that only those with the appropriate capabilities can edit them. + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class ModelSecurityServiceImpl extends BaseBehaviourBean + implements ModelSecurityService, + NodeServicePolicies.BeforeAddAspectPolicy, + NodeServicePolicies.BeforeRemoveAspectPolicy, + NodeServicePolicies.OnUpdatePropertiesPolicy +{ + /** Indicates whether model security is enabled or not */ + private boolean enabled = true; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Map of protected properties keyed by name */ + private Map protectedProperties = new HashMap(21); + + /** Map of protected aspects keyed by name */ + private Map protectedAspects= new HashMap(21); + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#setEnabled(boolean) + */ + public void setEnabled(boolean enabled) + { + this.enabled = enabled; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isEnabled() + */ + public boolean isEnabled() + { + return enabled; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#disable() + */ + @Override + public void disable() + { + getBehaviour("beforeAddAspect").disable(); + getBehaviour("beforeRemoveAspect").disable(); + getBehaviour("onUpdateProperties").disable(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#enable() + */ + @Override + public void enable() + { + getBehaviour("beforeAddAspect").enable(); + getBehaviour("beforeRemoveAspect").enable(); + getBehaviour("onUpdateProperties").enable(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#register(org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedModelArtifact) + */ + @Override + public void register(ProtectedModelArtifact artifact) + { + // TODO validate that the artifact has a valid property and has a capability set ... + + if (artifact instanceof ProtectedProperty) + { + protectedProperties.put(artifact.getQName(), (ProtectedProperty)artifact); + } + else if (artifact instanceof ProtectedAspect) + { + protectedAspects.put(artifact.getQName(), (ProtectedAspect)artifact); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isProtectedProperty(org.alfresco.service.namespace.QName) + */ + @Override + public boolean isProtectedProperty(QName property) + { + return protectedProperties.containsKey(property); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedProperties() + */ + @Override + public Set getProtectedProperties() + { + return Collections.unmodifiableSet(protectedProperties.keySet()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedProperty(org.alfresco.service.namespace.QName) + */ + @Override + public ProtectedProperty getProtectedProperty(QName name) + { + return protectedProperties.get(name); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#canEditProtectedProperty(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + public boolean canEditProtectedProperty(NodeRef nodeRef, QName property) + { + boolean result = false; + + ProtectedModelArtifact artifact = getProtectedProperty(property); + if (artifact == null) + { + result = true; + } + else + { + result = canEdit(nodeRef, artifact); + } + + return result; + } + + /** + * Indicates whether the current user can edit protected model artifact in the context + * of a given node or not. + * + * @param nodeRef node reference + * @param artifact protected model artifact + * @return boolean true if the current user can edit the protected model artifact, false otherwise + */ + private boolean canEdit(NodeRef nodeRef, ProtectedModelArtifact artifact) + { + boolean result = false; + + NodeRef filePlan = filePlanService.getFilePlan(nodeRef); + if (filePlan != null) + { + for (Capability capability : artifact.getCapabilities()) + { + if (capability.hasPermission(nodeRef).equals(AccessStatus.ALLOWED)) + { + result = true; + break; + } + } + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#isProtectedAspect(org.alfresco.service.namespace.QName) + */ + @Override + public boolean isProtectedAspect(QName aspect) + { + return protectedAspects.containsKey(aspect); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedAspects() + */ + @Override + public Set getProtectedAspects() + { + return Collections.unmodifiableSet(protectedAspects.keySet()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#getProtectedAspect(org.alfresco.service.namespace.QName) + */ + @Override + public ProtectedAspect getProtectedAspect(QName name) + { + return protectedAspects.get(name); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#canEditProtectedAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + public boolean canEditProtectedAspect(NodeRef nodeRef, QName aspect) + { + boolean result = false; + + ProtectedModelArtifact artifact = getProtectedAspect(aspect); + if (artifact == null) + { + result = true; + } + else + { + result = canEdit(nodeRef, artifact); + } + + return result; + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy#beforeAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + isService = true, + name = "beforeAddAspect" + ) + public void beforeAddAspect(NodeRef nodeRef, QName aspect) + { + if (enabled && + AuthenticationUtil.getFullyAuthenticatedUser() != null && + !AuthenticationUtil.isRunAsUserTheSystemUser() && + isProtectedAspect(aspect) && + nodeService.exists(nodeRef) && + !canEditProtectedAspect(nodeRef, aspect)) + { + // the user can't edit the protected aspect + throw new ModelAccessDeniedException( + "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + + " does not have the permission to add the protected aspect " + aspect.toPrefixString(namespaceService) + + " to the node " + nodeRef.toString()); + } + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.BeforeRemoveAspectPolicy#beforeRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + isService = true, + name = "beforeRemoveAspect" + ) + public void beforeRemoveAspect(NodeRef nodeRef, QName aspect) + { + if (enabled && + AuthenticationUtil.getFullyAuthenticatedUser() != null && + !AuthenticationUtil.isRunAsUserTheSystemUser() && + isProtectedAspect(aspect) && + nodeService.exists(nodeRef) && + !canEditProtectedAspect(nodeRef, aspect)) + { + // the user can't edit the protected aspect + throw new ModelAccessDeniedException( + "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + + " does not have the permission to remove the protected aspect " + aspect.toPrefixString(namespaceService) + + " from the node " + nodeRef.toString()); + } + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + isService = true, + name = "onUpdateProperties" + ) + public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) + { + if (enabled && + AuthenticationUtil.getFullyAuthenticatedUser() != null && + !AuthenticationUtil.isRunAsUserTheSystemUser() && + nodeService.exists(nodeRef)) + { + for (Map.Entry entry : after.entrySet()) + { + QName property = entry.getKey(); + if (isProtectedProperty(property)) + { + // always allow if this is the first time we are setting the protected property + if (before == null || before.isEmpty() || before.get(property) == null) + { + return; + } + + if (!EqualsHelper.nullSafeEquals(before.get(property), entry.getValue()) && + !canEditProtectedProperty(nodeRef, property)) + { + // the user can't edit the protected property + throw new ModelAccessDeniedException( + "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + + " does not have the permission to edit the protected property " + property.toPrefixString(namespaceService) + + " on the node " + nodeRef.toString()); + } + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedAspect.java index 96c6f5be61..4e2eead7ce 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedAspect.java @@ -1,40 +1,40 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.security; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public class ProtectedAspect extends ProtectedModelArtifact -{ - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.security; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public class ProtectedAspect extends ProtectedModelArtifact +{ + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedModelArtifact.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedModelArtifact.java index ca5a74ef37..c2eaa49fa2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedModelArtifact.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedModelArtifact.java @@ -1,135 +1,135 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.security; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Protected model artifact class. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public abstract class ProtectedModelArtifact -{ - /** Model security service */ - private ModelSecurityService modelSecurityService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Qualified name of the model artifact */ - private QName name; - - /** Set of capabilities */ - private Set capabilities; - - /** Capability names */ - private Set capabilityNames; - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param modelSecurityService model security service - */ - public void setModelSecurityService(ModelSecurityService modelSecurityService) - { - this.modelSecurityService = modelSecurityService; - } - - /** - * Init method - */ - public void init() - { - modelSecurityService.register(this); - } - - /** - * @param name artifact name (in cm:content form) - */ - public void setName(String name) - { - QName qname = QName.createQName(name, namespaceService); - this.name = qname; - } - - /** - * @return artifact QName - */ - public QName getQName() - { - return name; - } - - /** - * @param capabilities capabilities - */ - public void setCapabilities(Set capabilities) - { - this.capabilities = capabilities; - } - - /** - * @return capabilities - */ - public Set getCapabilities() - { - return capabilities; - } - - /** - * @return capability names - */ - public Set getCapilityNames() - { - if (capabilityNames == null && capabilities != null) - { - capabilityNames = new HashSet(capabilities.size()); - for (Capability capability : capabilities) - { - capabilityNames.add(capability.getName()); - } - } - - return capabilityNames; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.security; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Protected model artifact class. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public abstract class ProtectedModelArtifact +{ + /** Model security service */ + private ModelSecurityService modelSecurityService; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** Qualified name of the model artifact */ + private QName name; + + /** Set of capabilities */ + private Set capabilities; + + /** Capability names */ + private Set capabilityNames; + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param modelSecurityService model security service + */ + public void setModelSecurityService(ModelSecurityService modelSecurityService) + { + this.modelSecurityService = modelSecurityService; + } + + /** + * Init method + */ + public void init() + { + modelSecurityService.register(this); + } + + /** + * @param name artifact name (in cm:content form) + */ + public void setName(String name) + { + QName qname = QName.createQName(name, namespaceService); + this.name = qname; + } + + /** + * @return artifact QName + */ + public QName getQName() + { + return name; + } + + /** + * @param capabilities capabilities + */ + public void setCapabilities(Set capabilities) + { + this.capabilities = capabilities; + } + + /** + * @return capabilities + */ + public Set getCapabilities() + { + return capabilities; + } + + /** + * @return capability names + */ + public Set getCapilityNames() + { + if (capabilityNames == null && capabilities != null) + { + capabilityNames = new HashSet(capabilities.size()); + for (Capability capability : capabilities) + { + capabilityNames.add(capability.getName()); + } + } + + return capabilityNames; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedProperty.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedProperty.java index f6844fa781..343ab832b4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedProperty.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/security/ProtectedProperty.java @@ -1,59 +1,59 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.security; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Protected property implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public class ProtectedProperty extends ProtectedModelArtifact -{ - /** always allow new indicator */ - private boolean allwaysAllowNew = false; - - /** - * @param allwaysAllowNew true if always allow new, false otherwise - */ - public void setAllwaysAllowNew(boolean allwaysAllowNew) - { - this.allwaysAllowNew = allwaysAllowNew; - } - - /** - * @return true if always allow new, false otherwise - */ - public boolean isAllwaysAllowNew() - { - return allwaysAllowNew; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.security; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Protected property implementation + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public class ProtectedProperty extends ProtectedModelArtifact +{ + /** always allow new indicator */ + private boolean allwaysAllowNew = false; + + /** + * @param allwaysAllowNew true if always allow new, false otherwise + */ + public void setAllwaysAllowNew(boolean allwaysAllowNew) + { + this.allwaysAllowNew = allwaysAllowNew; + } + + /** + * @return true if always allow new, false otherwise + */ + public boolean isAllwaysAllowNew() + { + return allwaysAllowNew; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java index b5c81378f4..4bb08a5c11 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java @@ -1,480 +1,480 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.notification; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.notification.EMailNotificationProvider; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.tenant.TenantAdminService; -import org.alfresco.repo.tenant.TenantUtil; -import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork; -import org.alfresco.service.cmr.notification.NotificationContext; -import org.alfresco.service.cmr.notification.NotificationService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Helper bean containing methods useful when sending records - * management notifications via the {@link NotificationService} - * - * @author Roy Wetherall - */ -public class RecordsManagementNotificationHelper implements RecordsManagementModel -{ - private static Log logger = LogFactory.getLog(RecordsManagementNotificationHelper.class); - - /** I18n */ - private static final String MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW = "notification.dueforreview.subject"; - private static final String MSG_SUBJECT_RECORD_SUPERCEDED = "notification.superseded.subject"; - private static final String MSG_SUBJECT_RECORD_REJECTED = "notification.rejected.subject"; - - /** Defaults */ - private static final String DEFAULT_SITE = "rm"; - - /** Services */ - private NotificationService notificationService; - private FilePlanRoleService filePlanRoleService; - private SearchService searchService; - private NamespaceService namespaceService; - private SiteService siteService; - private AuthorityService authorityService; - private TenantAdminService tenantAdminService; - private NodeService nodeService; - private FilePlanService filePlanService; - - /** Notification role */ - private String notificationRole; - - /** EMail notification templates */ - private NodeRef supersededTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_superseded_template"); - private NodeRef dueForReviewTemplate; - private NodeRef rejectedTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_rejected_template"); - - /** - * @param notificationService notification service - */ - public void setNotificationService(NotificationService notificationService) - { - this.notificationService = notificationService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param notificationRole rm notification role - */ - public void setNotificationRole(String notificationRole) - { - this.notificationRole = notificationRole; - } - - /** - * @param searchService search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param tenantAdminService tenant admin service - */ - public void setTenantAdminService(TenantAdminService tenantAdminService) - { - this.tenantAdminService = tenantAdminService; - } - - /** - * @return superseded email template - */ - public NodeRef getSupersededTemplate() - { - return supersededTemplate; - } - - /** - * @return rejected email template - */ - public NodeRef getRejectedTemplate() - { - return rejectedTemplate; - } - - /** - * @return due for review email template - */ - public NodeRef getDueForReviewTemplate() - { - if (dueForReviewTemplate == null) - { - List nodeRefs = - searchService.selectNodes( - getRootNode(), - "app:company_home/app:dictionary/cm:records_management/cm:records_management_email_templates/cm:notify-records-due-for-review-email.ftl", null, - namespaceService, - false); - if (nodeRefs.size() == 1) - { - dueForReviewTemplate = nodeRefs.get(0); - } - } - return dueForReviewTemplate; - } - - /** - * Helper method to get root node in a tenant safe way. - * - * @return NodeRef root node of spaces store - */ - private NodeRef getRootNode() - { - String tenantDomain = tenantAdminService.getCurrentUserDomain(); - return TenantUtil.runAsSystemTenant(new TenantRunAsWork() - { - public NodeRef doWork() - { - return nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - } - }, tenantDomain); - } - - /** - * Sends records due for review email notification. - * - * @param records records due for review - */ - public void recordsDueForReviewEmailNotification(final List records) - { - ParameterCheck.mandatory("records", records); - if (!records.isEmpty()) - { - if (nodeService.hasAspect(records.get(0), RecordsManagementModel.ASPECT_RECORD)) - { - NodeRef root = getRMRoot(records.get(0)); - String groupName = getGroupName(root); - - if (doesGroupContainUsers(groupName)) - { - NotificationContext notificationContext = new NotificationContext(); - notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW)); - notificationContext.setAsyncNotification(false); - notificationContext.setIgnoreNotificationFailure(true); - - notificationContext.setBodyTemplate(getDueForReviewTemplate().toString()); - Map args = new HashMap(1, 1.0f); - args.put("records", (Serializable) records); - args.put("site", getSiteName(root)); - notificationContext.setTemplateArgs(args); - - notificationContext.addTo(groupName); - - notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn("Unable to send record due for review email notification, because notification group was empty."); - } - - throw new AlfrescoRuntimeException( - "Unable to send record due for review email notification, because notification group was empty."); - } - } - } - } - - /** - * Sends record superseded email notification. - * - * @param record superseded record - */ - public void recordSupersededEmailNotification(final NodeRef record) - { - ParameterCheck.mandatory("record", record); - - NodeRef root = getRMRoot(record); - String groupName = getGroupName(root); - - if (doesGroupContainUsers(groupName)) - { - NotificationContext notificationContext = new NotificationContext(); - notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_SUPERCEDED)); - notificationContext.setAsyncNotification(false); - notificationContext.setIgnoreNotificationFailure(true); - - notificationContext.setBodyTemplate(supersededTemplate.toString()); - Map args = new HashMap(1, 1.0f); - args.put("record", record); - args.put("site", getSiteName(root)); - notificationContext.setTemplateArgs(args); - - notificationContext.addTo(groupName); - - notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn("Unable to send record superseded email notification, because notification group was empty."); - } - } - } - - /** - * Sends record rejected email notification. - * - * @param record rejected record - */ - public void recordRejectedEmailNotification(NodeRef record, String recordId, String recordCreator) - { - ParameterCheck.mandatory("record", record); - - if (canSendRejectEmail(record, recordCreator)) - { - String site = siteService.getSite(record).getShortName(); - String rejectReason = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON); - String rejectedPerson = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID); - Date rejectDate = (Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE); - String recordName = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); - - Map args = new HashMap(8); - args.put("record", record); - args.put("site", site); - args.put("recordCreator", recordCreator); - args.put("rejectReason", rejectReason); - args.put("rejectedPerson", rejectedPerson); - args.put("rejectDate", rejectDate); - args.put("recordId", recordId); - args.put("recordName", recordName); - - NotificationContext notificationContext = new NotificationContext(); - notificationContext.setAsyncNotification(true); - notificationContext.setIgnoreNotificationFailure(true); - notificationContext.addTo(recordCreator); - notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_REJECTED)); - notificationContext.setBodyTemplate(getRejectedTemplate().toString()); - notificationContext.setTemplateArgs(args); - - notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); - } - } - - /** - * Helper method to check if the mandatory properties are set - * - * @param record rejected record - */ - private boolean canSendRejectEmail(NodeRef record, String recordCreator) - { - boolean result = true; - - String msg1 = "Unable to send record rejected email notification, because "; - String msg2 = " could not be found!"; - - if (siteService.getSite(record) == null) - { - result = false; - logger.warn(msg1 + "the site which should contain the node '" + record.toString() + "'" + msg2); - } - if (StringUtils.isBlank(recordCreator)) - { - result = false; - logger.warn(msg1 + "the user, who created the record" + msg2); - } - if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON))) - { - result = false; - logger.warn(msg1 + "the reason for rejection" + msg2); - } - if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID))) - { - result = false; - logger.warn(msg1 + "the user, who rejected the record" + msg2); - } - if (((Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE)) == null) - { - result = false; - logger.warn(msg1 + "the date, when the record was rejected" + msg2); - } - - return result; - } - - /** - * Gets the rm root given a context node. - * - * @param context context node reference - * @return {@link NodeRef} rm root node reference - */ - private NodeRef getRMRoot(final NodeRef context) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return filePlanService.getFilePlan(context); - - } - }, AuthenticationUtil.getSystemUserName()); - - } - - /** - * Gets the group name for the notification role. - * - * @param root rm root node - * @return String notification role's group name - */ - private String getGroupName(final NodeRef root) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public String doWork() - { - // Find the authority for the given role - Role role = filePlanRoleService.getRole(root, notificationRole); - return role.getRoleGroupName(); - } - }, AuthenticationUtil.getSystemUserName()); - } - - private boolean doesGroupContainUsers(final String groupName) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Boolean doWork() throws Exception - { - Set users = authorityService.getContainedAuthorities(AuthorityType.USER, groupName, true); - return !users.isEmpty(); - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Get the site name, default if none/undetermined. - * - * @param root rm root - * @return String site name - */ - private String getSiteName(final NodeRef root) - { - return AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public String doWork() - { - String result = DEFAULT_SITE; - - SiteInfo siteInfo = siteService.getSite(root); - if (siteInfo != null) - { - result = siteInfo.getShortName(); - } - - return result; - } - }, AuthenticationUtil.getSystemUserName()); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.notification; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.repo.notification.EMailNotificationProvider; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.tenant.TenantAdminService; +import org.alfresco.repo.tenant.TenantUtil; +import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork; +import org.alfresco.service.cmr.notification.NotificationContext; +import org.alfresco.service.cmr.notification.NotificationService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Helper bean containing methods useful when sending records + * management notifications via the {@link NotificationService} + * + * @author Roy Wetherall + */ +public class RecordsManagementNotificationHelper implements RecordsManagementModel +{ + private static Log logger = LogFactory.getLog(RecordsManagementNotificationHelper.class); + + /** I18n */ + private static final String MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW = "notification.dueforreview.subject"; + private static final String MSG_SUBJECT_RECORD_SUPERCEDED = "notification.superseded.subject"; + private static final String MSG_SUBJECT_RECORD_REJECTED = "notification.rejected.subject"; + + /** Defaults */ + private static final String DEFAULT_SITE = "rm"; + + /** Services */ + private NotificationService notificationService; + private FilePlanRoleService filePlanRoleService; + private SearchService searchService; + private NamespaceService namespaceService; + private SiteService siteService; + private AuthorityService authorityService; + private TenantAdminService tenantAdminService; + private NodeService nodeService; + private FilePlanService filePlanService; + + /** Notification role */ + private String notificationRole; + + /** EMail notification templates */ + private NodeRef supersededTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_superseded_template"); + private NodeRef dueForReviewTemplate; + private NodeRef rejectedTemplate = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "record_rejected_template"); + + /** + * @param notificationService notification service + */ + public void setNotificationService(NotificationService notificationService) + { + this.notificationService = notificationService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param notificationRole rm notification role + */ + public void setNotificationRole(String notificationRole) + { + this.notificationRole = notificationRole; + } + + /** + * @param searchService search service + */ + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param tenantAdminService tenant admin service + */ + public void setTenantAdminService(TenantAdminService tenantAdminService) + { + this.tenantAdminService = tenantAdminService; + } + + /** + * @return superseded email template + */ + public NodeRef getSupersededTemplate() + { + return supersededTemplate; + } + + /** + * @return rejected email template + */ + public NodeRef getRejectedTemplate() + { + return rejectedTemplate; + } + + /** + * @return due for review email template + */ + public NodeRef getDueForReviewTemplate() + { + if (dueForReviewTemplate == null) + { + List nodeRefs = + searchService.selectNodes( + getRootNode(), + "app:company_home/app:dictionary/cm:records_management/cm:records_management_email_templates/cm:notify-records-due-for-review-email.ftl", null, + namespaceService, + false); + if (nodeRefs.size() == 1) + { + dueForReviewTemplate = nodeRefs.get(0); + } + } + return dueForReviewTemplate; + } + + /** + * Helper method to get root node in a tenant safe way. + * + * @return NodeRef root node of spaces store + */ + private NodeRef getRootNode() + { + String tenantDomain = tenantAdminService.getCurrentUserDomain(); + return TenantUtil.runAsSystemTenant(new TenantRunAsWork() + { + public NodeRef doWork() + { + return nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); + } + }, tenantDomain); + } + + /** + * Sends records due for review email notification. + * + * @param records records due for review + */ + public void recordsDueForReviewEmailNotification(final List records) + { + ParameterCheck.mandatory("records", records); + if (!records.isEmpty()) + { + if (nodeService.hasAspect(records.get(0), RecordsManagementModel.ASPECT_RECORD)) + { + NodeRef root = getRMRoot(records.get(0)); + String groupName = getGroupName(root); + + if (doesGroupContainUsers(groupName)) + { + NotificationContext notificationContext = new NotificationContext(); + notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW)); + notificationContext.setAsyncNotification(false); + notificationContext.setIgnoreNotificationFailure(true); + + notificationContext.setBodyTemplate(getDueForReviewTemplate().toString()); + Map args = new HashMap(1, 1.0f); + args.put("records", (Serializable) records); + args.put("site", getSiteName(root)); + notificationContext.setTemplateArgs(args); + + notificationContext.addTo(groupName); + + notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); + } + else + { + if (logger.isWarnEnabled()) + { + logger.warn("Unable to send record due for review email notification, because notification group was empty."); + } + + throw new AlfrescoRuntimeException( + "Unable to send record due for review email notification, because notification group was empty."); + } + } + } + } + + /** + * Sends record superseded email notification. + * + * @param record superseded record + */ + public void recordSupersededEmailNotification(final NodeRef record) + { + ParameterCheck.mandatory("record", record); + + NodeRef root = getRMRoot(record); + String groupName = getGroupName(root); + + if (doesGroupContainUsers(groupName)) + { + NotificationContext notificationContext = new NotificationContext(); + notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_SUPERCEDED)); + notificationContext.setAsyncNotification(false); + notificationContext.setIgnoreNotificationFailure(true); + + notificationContext.setBodyTemplate(supersededTemplate.toString()); + Map args = new HashMap(1, 1.0f); + args.put("record", record); + args.put("site", getSiteName(root)); + notificationContext.setTemplateArgs(args); + + notificationContext.addTo(groupName); + + notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); + } + else + { + if (logger.isWarnEnabled()) + { + logger.warn("Unable to send record superseded email notification, because notification group was empty."); + } + } + } + + /** + * Sends record rejected email notification. + * + * @param record rejected record + */ + public void recordRejectedEmailNotification(NodeRef record, String recordId, String recordCreator) + { + ParameterCheck.mandatory("record", record); + + if (canSendRejectEmail(record, recordCreator)) + { + String site = siteService.getSite(record).getShortName(); + String rejectReason = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON); + String rejectedPerson = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID); + Date rejectDate = (Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE); + String recordName = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); + + Map args = new HashMap(8); + args.put("record", record); + args.put("site", site); + args.put("recordCreator", recordCreator); + args.put("rejectReason", rejectReason); + args.put("rejectedPerson", rejectedPerson); + args.put("rejectDate", rejectDate); + args.put("recordId", recordId); + args.put("recordName", recordName); + + NotificationContext notificationContext = new NotificationContext(); + notificationContext.setAsyncNotification(true); + notificationContext.setIgnoreNotificationFailure(true); + notificationContext.addTo(recordCreator); + notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_REJECTED)); + notificationContext.setBodyTemplate(getRejectedTemplate().toString()); + notificationContext.setTemplateArgs(args); + + notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext); + } + } + + /** + * Helper method to check if the mandatory properties are set + * + * @param record rejected record + */ + private boolean canSendRejectEmail(NodeRef record, String recordCreator) + { + boolean result = true; + + String msg1 = "Unable to send record rejected email notification, because "; + String msg2 = " could not be found!"; + + if (siteService.getSite(record) == null) + { + result = false; + logger.warn(msg1 + "the site which should contain the node '" + record.toString() + "'" + msg2); + } + if (StringUtils.isBlank(recordCreator)) + { + result = false; + logger.warn(msg1 + "the user, who created the record" + msg2); + } + if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON))) + { + result = false; + logger.warn(msg1 + "the reason for rejection" + msg2); + } + if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID))) + { + result = false; + logger.warn(msg1 + "the user, who rejected the record" + msg2); + } + if (((Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE)) == null) + { + result = false; + logger.warn(msg1 + "the date, when the record was rejected" + msg2); + } + + return result; + } + + /** + * Gets the rm root given a context node. + * + * @param context context node reference + * @return {@link NodeRef} rm root node reference + */ + private NodeRef getRMRoot(final NodeRef context) + { + return AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public NodeRef doWork() + { + return filePlanService.getFilePlan(context); + + } + }, AuthenticationUtil.getSystemUserName()); + + } + + /** + * Gets the group name for the notification role. + * + * @param root rm root node + * @return String notification role's group name + */ + private String getGroupName(final NodeRef root) + { + return AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public String doWork() + { + // Find the authority for the given role + Role role = filePlanRoleService.getRole(root, notificationRole); + return role.getRoleGroupName(); + } + }, AuthenticationUtil.getSystemUserName()); + } + + private boolean doesGroupContainUsers(final String groupName) + { + return AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Boolean doWork() throws Exception + { + Set users = authorityService.getContainedAuthorities(AuthorityType.USER, groupName, true); + return !users.isEmpty(); + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Get the site name, default if none/undetermined. + * + * @param root rm root + * @return String site name + */ + private String getSiteName(final NodeRef root) + { + return AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public String doWork() + { + String result = DEFAULT_SITE; + + SiteInfo siteInfo = siteService.getSite(root); + if (siteInfo != null) + { + result = siteInfo.getShortName(); + } + + return result; + } + }, AuthenticationUtil.getSystemUserName()); + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java index b4fbd6f441..983d2dee2d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java @@ -1,298 +1,298 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch; - -import java.util.concurrent.TimeUnit; - -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.transaction.TransactionService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Abstract module patch implementation. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware -{ - /** logger */ - protected static final Log LOGGER = LogFactory.getLog(ModulePatch.class); - - /** module patch service */ - private ModulePatchExecuter modulePatchExecuter; - - /** transaction service */ - protected TransactionService transactionService; - - /** module patch id */ - private String id; - - /** module patch description */ - private String description; - - /** module id */ - private String moduleId; - - /** module patch fixes from module schema number */ - private int fixesFromSchema; - - /** module patch fixes to module schema number */ - private int fixesToSchema; - - /** module patch target module schema number */ - private int targetSchema; - - /** if it should use a read only transaction */ - private boolean txnReadOnly = true; - - /** if it should use a new transaction */ - private boolean txnRequiresNew = false; - - /** - * Initiialisation method - */ - public void init() - { - modulePatchExecuter.register(this); - } - - public void setTxnReadOnly(boolean txnReadOnly) - { - this.txnReadOnly = txnReadOnly; - } - - public void setTxnRequiresNew(boolean txnRequiresNew) - { - this.txnRequiresNew = txnRequiresNew; - } - - /** - * @param modulePatchExecuter module patch executer - */ - public void setModulePatchExecuter(ModulePatchExecuter modulePatchExecuter) - { - this.modulePatchExecuter = modulePatchExecuter; - } - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * @param id module patch id - */ - public void setId(String id) - { - this.id = id; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getId() - */ - @Override - public String getId() - { - return id; - } - - /** - * Convenience method to set the module patch id to the bean name (if not already specified) - */ - @Override - public void setBeanName(String beanName) - { - if (id == null) - { - id = beanName; - } - } - - /** - * @param description module patch description - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getDescription() - */ - @Override - public String getDescription() - { - return description; - } - - /** - * @param moduleId module id - */ - public void setModuleId(String moduleId) - { - this.moduleId = moduleId; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getModuleId() - */ - @Override - public String getModuleId() - { - return moduleId; - } - - /** - * @param fixesFromSchema fixes from schema value - */ - public void setFixesFromSchema(int fixesFromSchema) - { - this.fixesFromSchema = fixesFromSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesFromSchema() - */ - @Override - public int getFixesFromSchema() - { - return fixesFromSchema; - } - - /** - * @param fixesToSchema fixes to schema value - */ - public void setFixesToSchema(int fixesToSchema) - { - this.fixesToSchema = fixesToSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesToSchema() - */ - @Override - public int getFixesToSchema() - { - return fixesToSchema; - } - - public void setTargetSchema(int targetSchema) - { - this.targetSchema = targetSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getTargetSchema() - */ - @Override - public int getTargetSchema() - { - return targetSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#apply() - */ - @Override - public void apply() - { - if (LOGGER.isInfoEnabled()) - { - LOGGER.info("Executing module patch \"" + description + "\""); - } - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... id=" + id + - ",moduleId=" + moduleId + - ",from=" + fixesFromSchema + - ",to=" + fixesToSchema + - ",target=" + targetSchema); - } - - long startTime = System.nanoTime(); - - // do patch in transaction - transactionService.getRetryingTransactionHelper().doInTransaction( - new ApplyCallback(), - txnReadOnly, - txnRequiresNew); - - long elapsedTime = System.nanoTime() - startTime; - - if (LOGGER.isInfoEnabled()) - { - LOGGER.info(" ... module patch applied in " + TimeUnit.NANOSECONDS.toMillis(elapsedTime) + "ms"); - } - } - - /** - * Apply patch internal method. Implementations can assume a transaction has - * been started. - */ - public abstract void applyInternal(); - - /** - * Apply callback worker class implementation - */ - private class ApplyCallback implements RetryingTransactionCallback - { - /** - * @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute() - */ - @Override - public Void execute() - { - applyInternal(); - return null; - } - } - - /** - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - @Override - public int compareTo(ModulePatch o) - { - int result = 0; - if (getTargetSchema() < o.getTargetSchema()) - { - result = -1; - } - else if (getTargetSchema() > o.getTargetSchema()) - { - result = 1; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch; + +import java.util.concurrent.TimeUnit; + +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.transaction.TransactionService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.BeanNameAware; + +/** + * Abstract module patch implementation. + * + * @author Roy Wetherall + * @since 2.2 + */ +public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware +{ + /** logger */ + protected static final Log LOGGER = LogFactory.getLog(ModulePatch.class); + + /** module patch service */ + private ModulePatchExecuter modulePatchExecuter; + + /** transaction service */ + protected TransactionService transactionService; + + /** module patch id */ + private String id; + + /** module patch description */ + private String description; + + /** module id */ + private String moduleId; + + /** module patch fixes from module schema number */ + private int fixesFromSchema; + + /** module patch fixes to module schema number */ + private int fixesToSchema; + + /** module patch target module schema number */ + private int targetSchema; + + /** if it should use a read only transaction */ + private boolean txnReadOnly = true; + + /** if it should use a new transaction */ + private boolean txnRequiresNew = false; + + /** + * Initiialisation method + */ + public void init() + { + modulePatchExecuter.register(this); + } + + public void setTxnReadOnly(boolean txnReadOnly) + { + this.txnReadOnly = txnReadOnly; + } + + public void setTxnRequiresNew(boolean txnRequiresNew) + { + this.txnRequiresNew = txnRequiresNew; + } + + /** + * @param modulePatchExecuter module patch executer + */ + public void setModulePatchExecuter(ModulePatchExecuter modulePatchExecuter) + { + this.modulePatchExecuter = modulePatchExecuter; + } + + /** + * @param transactionService transaction service + */ + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + /** + * @param id module patch id + */ + public void setId(String id) + { + this.id = id; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getId() + */ + @Override + public String getId() + { + return id; + } + + /** + * Convenience method to set the module patch id to the bean name (if not already specified) + */ + @Override + public void setBeanName(String beanName) + { + if (id == null) + { + id = beanName; + } + } + + /** + * @param description module patch description + */ + public void setDescription(String description) + { + this.description = description; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getDescription() + */ + @Override + public String getDescription() + { + return description; + } + + /** + * @param moduleId module id + */ + public void setModuleId(String moduleId) + { + this.moduleId = moduleId; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getModuleId() + */ + @Override + public String getModuleId() + { + return moduleId; + } + + /** + * @param fixesFromSchema fixes from schema value + */ + public void setFixesFromSchema(int fixesFromSchema) + { + this.fixesFromSchema = fixesFromSchema; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesFromSchema() + */ + @Override + public int getFixesFromSchema() + { + return fixesFromSchema; + } + + /** + * @param fixesToSchema fixes to schema value + */ + public void setFixesToSchema(int fixesToSchema) + { + this.fixesToSchema = fixesToSchema; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesToSchema() + */ + @Override + public int getFixesToSchema() + { + return fixesToSchema; + } + + public void setTargetSchema(int targetSchema) + { + this.targetSchema = targetSchema; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getTargetSchema() + */ + @Override + public int getTargetSchema() + { + return targetSchema; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#apply() + */ + @Override + public void apply() + { + if (LOGGER.isInfoEnabled()) + { + LOGGER.info("Executing module patch \"" + description + "\""); + } + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... id=" + id + + ",moduleId=" + moduleId + + ",from=" + fixesFromSchema + + ",to=" + fixesToSchema + + ",target=" + targetSchema); + } + + long startTime = System.nanoTime(); + + // do patch in transaction + transactionService.getRetryingTransactionHelper().doInTransaction( + new ApplyCallback(), + txnReadOnly, + txnRequiresNew); + + long elapsedTime = System.nanoTime() - startTime; + + if (LOGGER.isInfoEnabled()) + { + LOGGER.info(" ... module patch applied in " + TimeUnit.NANOSECONDS.toMillis(elapsedTime) + "ms"); + } + } + + /** + * Apply patch internal method. Implementations can assume a transaction has + * been started. + */ + public abstract void applyInternal(); + + /** + * Apply callback worker class implementation + */ + private class ApplyCallback implements RetryingTransactionCallback + { + /** + * @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute() + */ + @Override + public Void execute() + { + applyInternal(); + return null; + } + } + + /** + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + @Override + public int compareTo(ModulePatch o) + { + int result = 0; + if (getTargetSchema() < o.getTargetSchema()) + { + result = -1; + } + else if (getTargetSchema() > o.getTargetSchema()) + { + result = 1; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatch.java index 2985665e4e..114172e8ee 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatch.java @@ -1,73 +1,73 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch; - -/** - * Module Patch Interface - * - * @author Roy Wetherall - * @since 2.2 - */ -public interface ModulePatch extends Comparable -{ - /** - * @return module patch id - */ - String getId(); - - /** - * @return module patch description - */ - String getDescription(); - - /** - * @return module id this patch applies to - */ - String getModuleId(); - - /** - * @return smallest module schema number that this patch may be applied to - */ - int getFixesFromSchema(); - - /** - * @return largest module schema number that this patch may be applied to - */ - int getFixesToSchema(); - - /** - * @return module schema number that this patch attempts to bring the repo up to - */ - int getTargetSchema(); - - /** - * Apply the module patch - */ - void apply(); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch; + +/** + * Module Patch Interface + * + * @author Roy Wetherall + * @since 2.2 + */ +public interface ModulePatch extends Comparable +{ + /** + * @return module patch id + */ + String getId(); + + /** + * @return module patch description + */ + String getDescription(); + + /** + * @return module id this patch applies to + */ + String getModuleId(); + + /** + * @return smallest module schema number that this patch may be applied to + */ + int getFixesFromSchema(); + + /** + * @return largest module schema number that this patch may be applied to + */ + int getFixesToSchema(); + + /** + * @return module schema number that this patch attempts to bring the repo up to + */ + int getTargetSchema(); + + /** + * Apply the module patch + */ + void apply(); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuter.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuter.java index 0149072527..0d789354f4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuter.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch; - -/** - * Module patch service interface - * - * @author Roy Wetherall - * @since 2.2 - */ -public interface ModulePatchExecuter -{ - /** - * Register module patch with the module patch executer - * - * @param modulePatch module patch - */ - void register(ModulePatch modulePatch); - - /** - * Init the schema version number - */ - void initSchemaVersion(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch; + +/** + * Module patch service interface + * + * @author Roy Wetherall + * @since 2.2 + */ +public interface ModulePatchExecuter +{ + /** + * Register module patch with the module patch executer + * + * @param modulePatch module patch + */ + void register(ModulePatch modulePatch); + + /** + * Init the schema version number + */ + void initSchemaVersion(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java index 6c77a8d883..2f3d43e2b8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java @@ -1,177 +1,177 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.repo.module.AbstractModuleComponent; -import org.alfresco.service.cmr.attributes.AttributeService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Module patch executer base implementation - * - * @author Roy Wetherall - * @since 2.2 - */ -public class ModulePatchExecuterImpl extends AbstractModuleComponent - implements ModulePatchExecuter -{ - /** logger */ - protected static final Log LOGGER = LogFactory.getLog(ModulePatchExecuterImpl.class); - - /** default start schema */ - private static final int START_SCHEMA = 0; - - /** attribute key */ - private static final String KEY_MODULE_SCHEMA = "module-schema"; - - /** configured module schema version */ - protected int moduleSchema = START_SCHEMA; - - /** attribute service */ - protected AttributeService attributeService; - - /** module patches */ - protected Map modulePatches = new HashMap(21); - - /** - * @param attributeService attribute service - */ - public void setAttributeService(AttributeService attributeService) - { - this.attributeService = attributeService; - } - - /** - * @param moduleSchema configured module schema version - */ - public void setModuleSchema(int moduleSchema) - { - this.moduleSchema = moduleSchema; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter#register(org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch) - */ - @Override - public void register(ModulePatch modulePatch) - { - // ensure that the module patch being registered relates to the module id - if (!getModuleId().equals(modulePatch.getModuleId())) - { - throw new AlfrescoRuntimeException("Unable to register module patch, becuase module id is invalid."); - } - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Registering module patch " + modulePatch.getId() + " for module " + getModuleId()); - } - - modulePatches.put(modulePatch.getId(), modulePatch); - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executeInternal() - { - // get current schema version - int currentSchema = getCurrentSchema(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Running module patch executer (currentSchema=" + currentSchema + ", configuredSchema=" + moduleSchema + ")"); - } - - if (moduleSchema > currentSchema) - { - // determine what patches should be applied - List patchesToApply = new ArrayList(13); - for (ModulePatch modulePatch : modulePatches.values()) - { - if (modulePatch.getFixesFromSchema() <= currentSchema && - modulePatch.getFixesToSchema() >= currentSchema) - { - patchesToApply.add(modulePatch); - } - } - - // apply the patches in the correct order - Collections.sort(patchesToApply); - for (ModulePatch patchToApply : patchesToApply) - { - patchToApply.apply(); - } - - // update the schema - updateSchema(moduleSchema); - } - } - - /** - * Get the currently recorded schema version for the module - * - * @return int currently recorded schema version - */ - protected int getCurrentSchema() - { - Integer result = START_SCHEMA; - if (attributeService.exists(KEY_MODULE_SCHEMA, getModuleId())) - { - result = (Integer)attributeService.getAttribute(KEY_MODULE_SCHEMA, getModuleId()); - } - return result; - } - - /** - * Update the recorded schema version for the module. - * - * @param newSchema new schema version - */ - protected void updateSchema(int newSchema) - { - attributeService.setAttribute(Integer.valueOf(newSchema), KEY_MODULE_SCHEMA, getModuleId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter#initSchemaVersion() - */ - @Override - public void initSchemaVersion() - { - updateSchema(moduleSchema); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.repo.module.AbstractModuleComponent; +import org.alfresco.service.cmr.attributes.AttributeService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Module patch executer base implementation + * + * @author Roy Wetherall + * @since 2.2 + */ +public class ModulePatchExecuterImpl extends AbstractModuleComponent + implements ModulePatchExecuter +{ + /** logger */ + protected static final Log LOGGER = LogFactory.getLog(ModulePatchExecuterImpl.class); + + /** default start schema */ + private static final int START_SCHEMA = 0; + + /** attribute key */ + private static final String KEY_MODULE_SCHEMA = "module-schema"; + + /** configured module schema version */ + protected int moduleSchema = START_SCHEMA; + + /** attribute service */ + protected AttributeService attributeService; + + /** module patches */ + protected Map modulePatches = new HashMap(21); + + /** + * @param attributeService attribute service + */ + public void setAttributeService(AttributeService attributeService) + { + this.attributeService = attributeService; + } + + /** + * @param moduleSchema configured module schema version + */ + public void setModuleSchema(int moduleSchema) + { + this.moduleSchema = moduleSchema; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter#register(org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch) + */ + @Override + public void register(ModulePatch modulePatch) + { + // ensure that the module patch being registered relates to the module id + if (!getModuleId().equals(modulePatch.getModuleId())) + { + throw new AlfrescoRuntimeException("Unable to register module patch, becuase module id is invalid."); + } + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Registering module patch " + modulePatch.getId() + " for module " + getModuleId()); + } + + modulePatches.put(modulePatch.getId(), modulePatch); + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executeInternal() + { + // get current schema version + int currentSchema = getCurrentSchema(); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Running module patch executer (currentSchema=" + currentSchema + ", configuredSchema=" + moduleSchema + ")"); + } + + if (moduleSchema > currentSchema) + { + // determine what patches should be applied + List patchesToApply = new ArrayList(13); + for (ModulePatch modulePatch : modulePatches.values()) + { + if (modulePatch.getFixesFromSchema() <= currentSchema && + modulePatch.getFixesToSchema() >= currentSchema) + { + patchesToApply.add(modulePatch); + } + } + + // apply the patches in the correct order + Collections.sort(patchesToApply); + for (ModulePatch patchToApply : patchesToApply) + { + patchToApply.apply(); + } + + // update the schema + updateSchema(moduleSchema); + } + } + + /** + * Get the currently recorded schema version for the module + * + * @return int currently recorded schema version + */ + protected int getCurrentSchema() + { + Integer result = START_SCHEMA; + if (attributeService.exists(KEY_MODULE_SCHEMA, getModuleId())) + { + result = (Integer)attributeService.getAttribute(KEY_MODULE_SCHEMA, getModuleId()); + } + return result; + } + + /** + * Update the recorded schema version for the module. + * + * @param newSchema new schema version + */ + protected void updateSchema(int newSchema) + { + attributeService.setAttribute(Integer.valueOf(newSchema), KEY_MODULE_SCHEMA, getModuleId()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter#initSchemaVersion() + */ + @Override + public void initSchemaVersion() + { + updateSchema(moduleSchema); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/common/CapabilityPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/common/CapabilityPatch.java index daa6203ff3..bac5846787 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/common/CapabilityPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/common/CapabilityPatch.java @@ -1,149 +1,149 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.common; - -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; - -/** - * Abstract implementation of capability patch. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class CapabilityPatch extends AbstractModulePatch -{ - /** File plan service */ - private FilePlanService filePlanService; - - /** authority service */ - private AuthorityService authorityService; - - /** permission service */ - private PermissionService permissionService; - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Helper method to get the file plans - * - * @return Set of file plan node references - */ - protected Set getFilePlans() - { - return filePlanService.getFilePlans(); - } - - /** - * Adds a new capability to the specified roles. - * - * @param filePlan file plan - * @param capabilityName capability name - * @param roles roles - */ - protected void addCapability(NodeRef filePlan, String capabilityName, String ... roles) - { - for (String role : roles) - { - String fullRoleName = role + filePlan.getId(); - String roleAuthority = authorityService.getName(AuthorityType.GROUP, fullRoleName); - if (roleAuthority == null) - { - throw new AlfrescoRuntimeException("Role " + role + " does not exist."); - } - else - { - permissionService.setPermission(filePlan, roleAuthority, capabilityName, true); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - Set filePlans = getFilePlans(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); - } - - for (NodeRef filePlan : filePlans) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating file plan " + filePlan.toString()); - } - - // apply the capability patch to each file plan - applyCapabilityPatch(filePlan); - } - } - - @Override - public void apply() - { - setTxnReadOnly(false); - setTxnRequiresNew(true); - super.apply(); - } - - protected abstract void applyCapabilityPatch(NodeRef filePlan); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.common; + +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.PermissionService; + +/** + * Abstract implementation of capability patch. + * + * @author Roy Wetherall + * @since 2.2 + */ +public abstract class CapabilityPatch extends AbstractModulePatch +{ + /** File plan service */ + private FilePlanService filePlanService; + + /** authority service */ + private AuthorityService authorityService; + + /** permission service */ + private PermissionService permissionService; + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Helper method to get the file plans + * + * @return Set of file plan node references + */ + protected Set getFilePlans() + { + return filePlanService.getFilePlans(); + } + + /** + * Adds a new capability to the specified roles. + * + * @param filePlan file plan + * @param capabilityName capability name + * @param roles roles + */ + protected void addCapability(NodeRef filePlan, String capabilityName, String ... roles) + { + for (String role : roles) + { + String fullRoleName = role + filePlan.getId(); + String roleAuthority = authorityService.getName(AuthorityType.GROUP, fullRoleName); + if (roleAuthority == null) + { + throw new AlfrescoRuntimeException("Role " + role + " does not exist."); + } + else + { + permissionService.setPermission(filePlan, roleAuthority, capabilityName, true); + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + Set filePlans = getFilePlans(); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); + } + + for (NodeRef filePlan : filePlans) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating file plan " + filePlan.toString()); + } + + // apply the capability patch to each file plan + applyCapabilityPatch(filePlan); + } + } + + @Override + public void apply() + { + setTxnReadOnly(false); + setTxnRequiresNew(true); + super.apply(); + } + + protected abstract void applyCapabilityPatch(NodeRef filePlan); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java index 1ea509b7db..62b3b484b6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java @@ -1,146 +1,146 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.compatibility; - -import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuterImpl; -import org.alfresco.repo.module.AbstractModuleComponent; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - -/** - * Module patch component base class. - * - * @author Roy Wetherall - * @since 2.1 - */ -@Deprecated -public abstract class ModulePatchComponent extends AbstractModuleComponent -{ - /** logger */ - protected static final Log LOGGER = LogFactory.getLog(ModulePatchComponent.class); - - /** Retrying transaction helper */ - protected RetryingTransactionHelper retryingTransactionHelper; - - /** Behaviour filter */ - protected BehaviourFilter behaviourFilter; - - /** module patch executer */ - protected ModulePatchExecuterImpl modulePatchExecuter; - - /** - * @param retryingTransactionHelper retrying transaction helper - */ - public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @param behaviourFilter behaviour filter - */ - public void setBehaviourFilter(BehaviourFilter behaviourFilter) - { - this.behaviourFilter = behaviourFilter; - } - - /** - * @param modulePatchExecuter module patch executer - */ - public void setModulePatchExecuter(ModulePatchExecuterImpl modulePatchExecuter) - { - this.modulePatchExecuter = modulePatchExecuter; - } - - /** - * Init method - */ - @Override - public void init() - { - super.init(); - modulePatchExecuter.getDependsOn().add(this); - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executeInternal() - { - try - { - if (LOGGER.isInfoEnabled()) - { - LOGGER.info("Module patch component '" + getName() + "' is executing ..."); - } - - // execute path within an isolated transaction - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - @Override - public Void execute() - { - behaviourFilter.disableBehaviour(); - try - { - executePatch(); - } - finally - { - behaviourFilter.enableBehaviour(); - } - return null; - } - - }, false, true); - - if (LOGGER.isInfoEnabled()) - { - LOGGER.info(" ... completed module patch '" + getName() + "'"); - } - } - catch (Exception exception) - { - // record the exception otherwise it gets swallowed - if (LOGGER.isInfoEnabled()) - { - LOGGER.info(" ... error encountered. " + exception.getMessage(), exception); - } - throw exception; - } - } - - /** - * Execute patch work. - */ - protected abstract void executePatch(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.compatibility; + +import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuterImpl; +import org.alfresco.repo.module.AbstractModuleComponent; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * Module patch component base class. + * + * @author Roy Wetherall + * @since 2.1 + */ +@Deprecated +public abstract class ModulePatchComponent extends AbstractModuleComponent +{ + /** logger */ + protected static final Log LOGGER = LogFactory.getLog(ModulePatchComponent.class); + + /** Retrying transaction helper */ + protected RetryingTransactionHelper retryingTransactionHelper; + + /** Behaviour filter */ + protected BehaviourFilter behaviourFilter; + + /** module patch executer */ + protected ModulePatchExecuterImpl modulePatchExecuter; + + /** + * @param retryingTransactionHelper retrying transaction helper + */ + public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) + { + this.retryingTransactionHelper = retryingTransactionHelper; + } + + /** + * @param behaviourFilter behaviour filter + */ + public void setBehaviourFilter(BehaviourFilter behaviourFilter) + { + this.behaviourFilter = behaviourFilter; + } + + /** + * @param modulePatchExecuter module patch executer + */ + public void setModulePatchExecuter(ModulePatchExecuterImpl modulePatchExecuter) + { + this.modulePatchExecuter = modulePatchExecuter; + } + + /** + * Init method + */ + @Override + public void init() + { + super.init(); + modulePatchExecuter.getDependsOn().add(this); + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executeInternal() + { + try + { + if (LOGGER.isInfoEnabled()) + { + LOGGER.info("Module patch component '" + getName() + "' is executing ..."); + } + + // execute path within an isolated transaction + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + @Override + public Void execute() + { + behaviourFilter.disableBehaviour(); + try + { + executePatch(); + } + finally + { + behaviourFilter.enableBehaviour(); + } + return null; + } + + }, false, true); + + if (LOGGER.isInfoEnabled()) + { + LOGGER.info(" ... completed module patch '" + getName() + "'"); + } + } + catch (Exception exception) + { + // record the exception otherwise it gets swallowed + if (LOGGER.isInfoEnabled()) + { + LOGGER.info(" ... error encountered. " + exception.getMessage(), exception); + } + throw exception; + } + } + + /** + * Execute patch work. + */ + protected abstract void executePatch(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java index 1929ebec5a..fe4d74ccab 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java @@ -1,211 +1,211 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v20; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.audit.AuditService; -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.NodeService; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.cmr.version.VersionType; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Notification template patch implementation - * - * @author Roy Wetherall - * @since 2.0 - */ -@SuppressWarnings("deprecation") -public class NotificationTemplatePatch extends ModulePatchComponent - implements BeanNameAware -{ - /** Last patch update property */ - private static final QName PROP_LAST_PATCH_UPDATE = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "lastPatchUpdate"); - - private static final String PATH_DUE_FOR_REVIEW = "alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl"; - private static final String PATH_SUPERSEDED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl"; - - /** Records management notification helper */ - private RecordsManagementNotificationHelper notificationHelper; - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** Version service */ - private VersionService versionService; - - /** Audit service */ - private AuditService auditService; - - /** Bean name */ - private String name; - - /** - * @param notificationHelper notification helper - */ - public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) - { - this.notificationHelper = notificationHelper; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @param versionService version service - */ - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - /** - * @param auditService audit service - */ - public void setAuditService(AuditService auditService) - { - this.auditService = auditService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#setBeanName(java.lang.String) - */ - @Override - public void setBeanName(String name) - { - this.name = name; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - NodeRef supersededTemplate = notificationHelper.getSupersededTemplate(); - updateTemplate(supersededTemplate, PATH_SUPERSEDED); - - NodeRef dueForReviewTemplate = notificationHelper.getDueForReviewTemplate(); - updateTemplate(dueForReviewTemplate, PATH_DUE_FOR_REVIEW); - } - - /** - * Attempt to update the template with the updated version - * - * @param template - * @param updatedTemplate - */ - private void updateTemplate(NodeRef template, String templateUpdate) - { - if (template == null || !nodeService.exists(template)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Skipping template update, because template has not been bootstraped."); - } - } - else - { - // Check to see if this template has already been updated - String lastPatchUpdate = (String)nodeService.getProperty(template, PROP_LAST_PATCH_UPDATE); - if (lastPatchUpdate == null || !name.equals(lastPatchUpdate)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Applying update to template. (template=" + template.toString() + ", templateUpdate=" + templateUpdate + ")"); - } - - // Make sure the template is versionable - if (!nodeService.hasAspect(template, ContentModel.ASPECT_VERSIONABLE)) - { - nodeService.addAspect(template, ContentModel.ASPECT_VERSIONABLE, null); - - // Create version (before template is updated) - Map versionProperties = new HashMap(2); - versionProperties.put(Version.PROP_DESCRIPTION, "Initial version"); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionService.createVersion(template, versionProperties); - } - - // Update the content of the template - InputStream is = getClass().getClassLoader().getResourceAsStream(templateUpdate); - ContentWriter writer = contentService.getWriter(template, ContentModel.PROP_CONTENT, true); - writer.putContent(is); - - boolean enabled = auditService.isAuditEnabled(); - auditService.setAuditEnabled(false); - try - { - // Set the last patch update property - nodeService.setProperty(template, PROP_LAST_PATCH_UPDATE, name); - } - finally - { - auditService.setAuditEnabled(enabled); - } - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("Skipping template update, because template has already been patched. (template=" + template.toString() + ")"); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v20; + +import java.io.InputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; +import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; +import org.alfresco.repo.version.VersionModel; +import org.alfresco.service.cmr.audit.AuditService; +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.NodeService; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionService; +import org.alfresco.service.cmr.version.VersionType; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.beans.factory.BeanNameAware; + +/** + * Notification template patch implementation + * + * @author Roy Wetherall + * @since 2.0 + */ +@SuppressWarnings("deprecation") +public class NotificationTemplatePatch extends ModulePatchComponent + implements BeanNameAware +{ + /** Last patch update property */ + private static final QName PROP_LAST_PATCH_UPDATE = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "lastPatchUpdate"); + + private static final String PATH_DUE_FOR_REVIEW = "alfresco/module/org_alfresco_module_rm/bootstrap/content/notify-records-due-for-review-email.ftl"; + private static final String PATH_SUPERSEDED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-superseded-email.ftl"; + + /** Records management notification helper */ + private RecordsManagementNotificationHelper notificationHelper; + + /** Node service */ + private NodeService nodeService; + + /** Content service */ + private ContentService contentService; + + /** Version service */ + private VersionService versionService; + + /** Audit service */ + private AuditService auditService; + + /** Bean name */ + private String name; + + /** + * @param notificationHelper notification helper + */ + public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) + { + this.notificationHelper = notificationHelper; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * @param versionService version service + */ + public void setVersionService(VersionService versionService) + { + this.versionService = versionService; + } + + /** + * @param auditService audit service + */ + public void setAuditService(AuditService auditService) + { + this.auditService = auditService; + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#setBeanName(java.lang.String) + */ + @Override + public void setBeanName(String name) + { + this.name = name; + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executePatch() + { + NodeRef supersededTemplate = notificationHelper.getSupersededTemplate(); + updateTemplate(supersededTemplate, PATH_SUPERSEDED); + + NodeRef dueForReviewTemplate = notificationHelper.getDueForReviewTemplate(); + updateTemplate(dueForReviewTemplate, PATH_DUE_FOR_REVIEW); + } + + /** + * Attempt to update the template with the updated version + * + * @param template + * @param updatedTemplate + */ + private void updateTemplate(NodeRef template, String templateUpdate) + { + if (template == null || !nodeService.exists(template)) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Skipping template update, because template has not been bootstraped."); + } + } + else + { + // Check to see if this template has already been updated + String lastPatchUpdate = (String)nodeService.getProperty(template, PROP_LAST_PATCH_UPDATE); + if (lastPatchUpdate == null || !name.equals(lastPatchUpdate)) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Applying update to template. (template=" + template.toString() + ", templateUpdate=" + templateUpdate + ")"); + } + + // Make sure the template is versionable + if (!nodeService.hasAspect(template, ContentModel.ASPECT_VERSIONABLE)) + { + nodeService.addAspect(template, ContentModel.ASPECT_VERSIONABLE, null); + + // Create version (before template is updated) + Map versionProperties = new HashMap(2); + versionProperties.put(Version.PROP_DESCRIPTION, "Initial version"); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + versionService.createVersion(template, versionProperties); + } + + // Update the content of the template + InputStream is = getClass().getClassLoader().getResourceAsStream(templateUpdate); + ContentWriter writer = contentService.getWriter(template, ContentModel.PROP_CONTENT, true); + writer.putContent(is); + + boolean enabled = auditService.isAuditEnabled(); + auditService.setAuditEnabled(false); + try + { + // Set the last patch update property + nodeService.setProperty(template, PROP_LAST_PATCH_UPDATE, name); + } + finally + { + auditService.setAuditEnabled(enabled); + } + } + else + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("Skipping template update, because template has already been patched. (template=" + template.toString() + ")"); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java index abbd140759..68413b7ffe 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java @@ -1,182 +1,182 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v20; - -import java.io.Serializable; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.0 File Plan Node Ref Patch - * - * @author Roy Wetherall - * @since 2.0 - */ -@SuppressWarnings("deprecation") -public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - private NodeService nodeService; - private PatchDAO patchDAO; - private NodeDAO nodeDAO; - private QNameDAO qnameDAO; - private PermissionService permissionService; - private FilePlanService filePlanService; - private FilePlanRoleService filePlanRoleService; - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - Pair aspectPair = qnameDAO.getQName(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); - if (aspectPair != null) - { - List filePlanComponents = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID()); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlanComponents.size() + " items"); - } - - - for (Long filePlanComponent : filePlanComponents) - { - Pair recordPair = nodeDAO.getNodePair(filePlanComponent); - NodeRef filePlanComponentNodeRef = recordPair.getSecond(); - - NodeRef filePlan = filePlanService.getFilePlan(filePlanComponentNodeRef); - - if(filePlan != null) - { - // set the file plan node reference - if (nodeService.getProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF) == null) - { - nodeService.setProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF, filePlan); - } - - // only set the admin permissions on record categories, record folders and records - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(filePlanComponentNodeRef); - if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) || - FilePlanComponentKind.RECORD_FOLDER.equals(kind) || - FilePlanComponentKind.RECORD.equals(kind)) - { - // ensure the that the records management role has read and file on the node - Role adminRole = filePlanRoleService.getRole(filePlan, "Administrator"); - if (adminRole != null) - { - permissionService.setPermission(filePlanComponentNodeRef, adminRole.getRoleGroupName(), RMPermissionModel.FILING, true); - } - - // ensure that the default vital record default values have been set (RM-753) - Serializable vitalRecordIndicator = nodeService.getProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR); - if (vitalRecordIndicator == null) - { - nodeService.setProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR, false); - } - Serializable reviewPeriod = nodeService.getProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD); - if (reviewPeriod == null) - { - nodeService.setProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD, new Period("none|0")); - } - } - } - else - { - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn(" ... node " + filePlanComponent.toString() + " was skiped, beacuse there was no associated file plan."); - } - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v20; + +import java.io.Serializable; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.repo.domain.node.NodeDAO; +import org.alfresco.repo.domain.patch.PatchDAO; +import org.alfresco.repo.domain.qname.QNameDAO; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.springframework.beans.factory.BeanNameAware; + +/** + * RM v2.0 File Plan Node Ref Patch + * + * @author Roy Wetherall + * @since 2.0 + */ +@SuppressWarnings("deprecation") +public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent + implements BeanNameAware, RecordsManagementModel, DOD5015Model +{ + private NodeService nodeService; + private PatchDAO patchDAO; + private NodeDAO nodeDAO; + private QNameDAO qnameDAO; + private PermissionService permissionService; + private FilePlanService filePlanService; + private FilePlanRoleService filePlanRoleService; + + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + public void setPatchDAO(PatchDAO patchDAO) + { + this.patchDAO = patchDAO; + } + + public void setNodeDAO(NodeDAO nodeDAO) + { + this.nodeDAO = nodeDAO; + } + + public void setQnameDAO(QNameDAO qnameDAO) + { + this.qnameDAO = qnameDAO; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executePatch() + { + Pair aspectPair = qnameDAO.getQName(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); + if (aspectPair != null) + { + List filePlanComponents = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID()); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + filePlanComponents.size() + " items"); + } + + + for (Long filePlanComponent : filePlanComponents) + { + Pair recordPair = nodeDAO.getNodePair(filePlanComponent); + NodeRef filePlanComponentNodeRef = recordPair.getSecond(); + + NodeRef filePlan = filePlanService.getFilePlan(filePlanComponentNodeRef); + + if(filePlan != null) + { + // set the file plan node reference + if (nodeService.getProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF) == null) + { + nodeService.setProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF, filePlan); + } + + // only set the admin permissions on record categories, record folders and records + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(filePlanComponentNodeRef); + if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) || + FilePlanComponentKind.RECORD_FOLDER.equals(kind) || + FilePlanComponentKind.RECORD.equals(kind)) + { + // ensure the that the records management role has read and file on the node + Role adminRole = filePlanRoleService.getRole(filePlan, "Administrator"); + if (adminRole != null) + { + permissionService.setPermission(filePlanComponentNodeRef, adminRole.getRoleGroupName(), RMPermissionModel.FILING, true); + } + + // ensure that the default vital record default values have been set (RM-753) + Serializable vitalRecordIndicator = nodeService.getProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR); + if (vitalRecordIndicator == null) + { + nodeService.setProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR, false); + } + Serializable reviewPeriod = nodeService.getProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD); + if (reviewPeriod == null) + { + nodeService.setProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD, new Period("none|0")); + } + } + } + else + { + if (LOGGER.isWarnEnabled()) + { + LOGGER.warn(" ... node " + filePlanComponent.toString() + " was skiped, beacuse there was no associated file plan."); + } + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java index d1f44e40c2..fe1da7a7e7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java @@ -1,156 +1,156 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v20; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.0 Model Updates Patch - * - * @author Roy Wetherall - * @since 2.0 - */ -@SuppressWarnings("deprecation") -public class RMv2ModelPatch extends ModulePatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - private static final long BATCH_SIZE = 100000L; - - private PatchDAO patchDAO; - private NodeDAO nodeDAO; - private QNameDAO qnameDAO; - - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - updateQName(QName.createQName(DOD_URI, "filePlan"), TYPE_FILE_PLAN, "TYPE"); - updateQName(QName.createQName(DOD_URI, "recordCategory"), TYPE_RECORD_CATEGORY, "TYPE"); - updateQName(QName.createQName(DOD_URI, "ghosted"), ASPECT_GHOSTED, "ASPECT"); - } - - private void updateQName(QName qnameBefore, QName qnameAfter, String reindexClass) - { - Work work = new Work(qnameBefore, qnameAfter, reindexClass); - retryingTransactionHelper.doInTransaction(work, false, true); - } - - private class Work implements RetryingTransactionHelper.RetryingTransactionCallback - { - private QName qnameBefore; - private QName qnameAfter; - private String reindexClass; - - /** - * Constructor - * - * @param qnameBefore qname before - * @param qnameAfter qname after - * @param reindexClass reindex class - */ - Work(QName qnameBefore, QName qnameAfter, String reindexClass) - { - this.qnameBefore = qnameBefore; - this.qnameAfter = qnameAfter; - this.reindexClass = reindexClass; - } - - /** - * @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute() - */ - @Override - public Integer execute() throws Throwable - { - Long maxNodeId = patchDAO.getMaxAdmNodeID(); - - Pair before = qnameDAO.getQName(qnameBefore); - - if (before != null) - { - for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE) - { - if ("TYPE".equals(reindexClass)) - { - List nodeIds = patchDAO.getNodesByTypeQNameId(before.getFirst(), i, i + BATCH_SIZE); - nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds); - } - else if ("ASPECT".equals(reindexClass)) - { - List nodeIds = patchDAO.getNodesByAspectQNameId(before.getFirst(), i, i + BATCH_SIZE); - nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds); - } - } - - qnameDAO.updateQName(qnameBefore, qnameAfter); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updated qname " + qnameBefore.toString()); - } - } - else - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... no need to update qname " + qnameBefore.toString()); - } - } - - //nothing to do - return 0; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v20; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; +import org.alfresco.repo.domain.node.NodeDAO; +import org.alfresco.repo.domain.patch.PatchDAO; +import org.alfresco.repo.domain.qname.QNameDAO; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.springframework.beans.factory.BeanNameAware; + +/** + * RM v2.0 Model Updates Patch + * + * @author Roy Wetherall + * @since 2.0 + */ +@SuppressWarnings("deprecation") +public class RMv2ModelPatch extends ModulePatchComponent + implements BeanNameAware, RecordsManagementModel, DOD5015Model +{ + private static final long BATCH_SIZE = 100000L; + + private PatchDAO patchDAO; + private NodeDAO nodeDAO; + private QNameDAO qnameDAO; + + public void setPatchDAO(PatchDAO patchDAO) + { + this.patchDAO = patchDAO; + } + + public void setNodeDAO(NodeDAO nodeDAO) + { + this.nodeDAO = nodeDAO; + } + + public void setQnameDAO(QNameDAO qnameDAO) + { + this.qnameDAO = qnameDAO; + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executePatch() + { + updateQName(QName.createQName(DOD_URI, "filePlan"), TYPE_FILE_PLAN, "TYPE"); + updateQName(QName.createQName(DOD_URI, "recordCategory"), TYPE_RECORD_CATEGORY, "TYPE"); + updateQName(QName.createQName(DOD_URI, "ghosted"), ASPECT_GHOSTED, "ASPECT"); + } + + private void updateQName(QName qnameBefore, QName qnameAfter, String reindexClass) + { + Work work = new Work(qnameBefore, qnameAfter, reindexClass); + retryingTransactionHelper.doInTransaction(work, false, true); + } + + private class Work implements RetryingTransactionHelper.RetryingTransactionCallback + { + private QName qnameBefore; + private QName qnameAfter; + private String reindexClass; + + /** + * Constructor + * + * @param qnameBefore qname before + * @param qnameAfter qname after + * @param reindexClass reindex class + */ + Work(QName qnameBefore, QName qnameAfter, String reindexClass) + { + this.qnameBefore = qnameBefore; + this.qnameAfter = qnameAfter; + this.reindexClass = reindexClass; + } + + /** + * @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute() + */ + @Override + public Integer execute() throws Throwable + { + Long maxNodeId = patchDAO.getMaxAdmNodeID(); + + Pair before = qnameDAO.getQName(qnameBefore); + + if (before != null) + { + for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE) + { + if ("TYPE".equals(reindexClass)) + { + List nodeIds = patchDAO.getNodesByTypeQNameId(before.getFirst(), i, i + BATCH_SIZE); + nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds); + } + else if ("ASPECT".equals(reindexClass)) + { + List nodeIds = patchDAO.getNodesByAspectQNameId(before.getFirst(), i, i + BATCH_SIZE); + nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds); + } + } + + qnameDAO.updateQName(qnameBefore, qnameAfter); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updated qname " + qnameBefore.toString()); + } + } + else + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... no need to update qname " + qnameBefore.toString()); + } + } + + //nothing to do + return 0; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java index 17bce98972..715aae9e3c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java @@ -1,126 +1,126 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v20; - -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; -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.site.SiteService; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.0 Saved Search Patch - * - * @author Roy Wetherall - * @since 2.0 - */ -@SuppressWarnings("deprecation") -public class RMv2SavedSearchPatch extends ModulePatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - /** RM site id */ - private static final String RM_SITE_ID = "rm"; - - /** Records management search service */ - private RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - private SiteService siteService; - - /** Content service */ - private ContentService contentService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - if (siteService.getSite(RM_SITE_ID) != null) - { - // get the saved searches - List savedSearches = recordsManagementSearchService.getSavedSearches(RM_SITE_ID); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + savedSearches.size() + " saved searches"); - } - - for (SavedSearchDetails savedSearchDetails : savedSearches) - { - // refresh the query - String refreshedJSON = savedSearchDetails.toJSONString(); - NodeRef nodeRef = savedSearchDetails.getNodeRef(); - - if (nodeRef != null) - { - ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); - writer.putContent(refreshedJSON); - - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updated saved search " + savedSearchDetails.getName() + " (nodeRef=" + nodeRef.toString() + ")"); - } - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v20; + +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; +import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; +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.site.SiteService; +import org.springframework.beans.factory.BeanNameAware; + +/** + * RM v2.0 Saved Search Patch + * + * @author Roy Wetherall + * @since 2.0 + */ +@SuppressWarnings("deprecation") +public class RMv2SavedSearchPatch extends ModulePatchComponent + implements BeanNameAware, RecordsManagementModel, DOD5015Model +{ + /** RM site id */ + private static final String RM_SITE_ID = "rm"; + + /** Records management search service */ + private RecordsManagementSearchService recordsManagementSearchService; + + /** Site service */ + private SiteService siteService; + + /** Content service */ + private ContentService contentService; + + /** + * @param recordsManagementSearchService records management search service + */ + public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) + { + this.recordsManagementSearchService = recordsManagementSearchService; + } + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executePatch() + { + if (siteService.getSite(RM_SITE_ID) != null) + { + // get the saved searches + List savedSearches = recordsManagementSearchService.getSavedSearches(RM_SITE_ID); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + savedSearches.size() + " saved searches"); + } + + for (SavedSearchDetails savedSearchDetails : savedSearches) + { + // refresh the query + String refreshedJSON = savedSearchDetails.toJSONString(); + NodeRef nodeRef = savedSearchDetails.getNodeRef(); + + if (nodeRef != null) + { + ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); + writer.putContent(refreshedJSON); + + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updated saved search " + savedSearchDetails.getName() + " (nodeRef=" + nodeRef.toString() + ")"); + } + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java index a056a14569..761e23a4fa 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java @@ -1,126 +1,126 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v21; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Adds a new email template for rejected records to the existing templates - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class NotificationTemplatePatch_v21 extends RMv21PatchComponent -{ - /** Email template path */ - private static final String PATH_REJECTED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl"; - - /** Reject template config node id*/ - private static final String CONFIG_NODEID = "record_rejected_template"; - - /** Records management notification helper */ - private RecordsManagementNotificationHelper notificationHelper; - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** - * @param notificationHelper notification helper - */ - public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) - { - this.notificationHelper = notificationHelper; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - @Override - protected void executePatch() - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); - // get the parent node - NodeRef supersededTemplate = notificationHelper.getSupersededTemplate(); - if (!nodeService.exists(nodeRef) && nodeService.exists(supersededTemplate)) - { - NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef(); - - // build the node properties - Map props = new HashMap(4); - props.put(ContentModel.PROP_DESCRIPTION, "Record superseded email template."); - props.put(ContentModel.PROP_TITLE, "record-rejected-email.ftl"); - props.put(ContentModel.PROP_NAME, "record-rejected-email.ftl"); - props.put(ContentModel.PROP_NODE_UUID, "record_rejected_template"); - - // get the assoc qname - QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("record-rejected-email.ftl")); - - // create the node - ChildAssociationRef node = nodeService.createNode(parent, - ContentModel.ASSOC_CONTAINS, - assocQName, - ContentModel.TYPE_CONTENT, - props); - - // put the content - ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); - InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_REJECTED); - writer.putContent(is); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v21; + +import java.io.InputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +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.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Adds a new email template for rejected records to the existing templates + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class NotificationTemplatePatch_v21 extends RMv21PatchComponent +{ + /** Email template path */ + private static final String PATH_REJECTED = "alfresco/module/org_alfresco_module_rm/bootstrap/content/record-rejected-email.ftl"; + + /** Reject template config node id*/ + private static final String CONFIG_NODEID = "record_rejected_template"; + + /** Records management notification helper */ + private RecordsManagementNotificationHelper notificationHelper; + + /** Node service */ + private NodeService nodeService; + + /** Content service */ + private ContentService contentService; + + /** + * @param notificationHelper notification helper + */ + public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) + { + this.notificationHelper = notificationHelper; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + @Override + protected void executePatch() + { + NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); + // get the parent node + NodeRef supersededTemplate = notificationHelper.getSupersededTemplate(); + if (!nodeService.exists(nodeRef) && nodeService.exists(supersededTemplate)) + { + NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef(); + + // build the node properties + Map props = new HashMap(4); + props.put(ContentModel.PROP_DESCRIPTION, "Record superseded email template."); + props.put(ContentModel.PROP_TITLE, "record-rejected-email.ftl"); + props.put(ContentModel.PROP_NAME, "record-rejected-email.ftl"); + props.put(ContentModel.PROP_NODE_UUID, "record_rejected_template"); + + // get the assoc qname + QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("record-rejected-email.ftl")); + + // create the node + ChildAssociationRef node = nodeService.createNode(parent, + ContentModel.ASSOC_CONTAINS, + assocQName, + ContentModel.TYPE_CONTENT, + props); + + // put the content + ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); + InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_REJECTED); + writer.putContent(is); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java index 3908842de5..7133cc8c50 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java @@ -1,184 +1,184 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v21; - -import static org.apache.commons.logging.LogFactory.getLog; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.springframework.beans.factory.BeanNameAware; - -/** - * This patch creates a new "Records Management Behavior Scripts" folder and moves existing behavior scripts from the old "Records Management Scripts" folder to the new folder. - * This is to compensate for any non-behavior RM scripts so that they can live in the old "Records Management Scripts" folder for its intended purpose and be picked up by the - * execute script rule action. - * - * @author Craig Tan - * @since 2.1 - */ -public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements BeanNameAware -{ - /** Logger */ - private static final Log LOGGER = getLog(RMv21BehaviorScriptsPatch.class); - - /** rm config folder root lookup */ - protected static final NodeRef RM_CONFIG = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); - - /** old behavior scripts folder root lookup */ - protected static final NodeRef OLD_BEHAVIOR_SCRIPTS_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_scripts"); - - /** new behavior scripts folder root lookup */ - private static NodeRef newBehaviorScriptsFolder = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_behavior_scripts"); - - /** name of example script */ - protected static final String IS_CLOSED_JS = "rma_isClosed.js"; - - /** Node Service */ - private NodeService nodeService; - - /** File Folder Service */ - private FileFolderService fileFolderService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch() - */ - @Override - protected void executePatch() - { - // check that the rm config root has been correctly bootstrapped - if (!nodeService.exists(RM_CONFIG)) - { - // we don't need to do anything - return; - } - - // check that the behavior scripts folder exists - if (!nodeService.exists(newBehaviorScriptsFolder)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... creating RM Behavior Scripts folder"); - } - - String newBehaviorScriptsFolderName = "Records Management Behavior Scripts"; - String newBehaviorScriptsNodeUUID = "rm_behavior_scripts"; - String newBehaviorScriptsAssocQName = "records_management_behavior_scripts"; - - Map newBehaviorScriptsFolderProps = new HashMap(); - newBehaviorScriptsFolderProps.put(ContentModel.PROP_NODE_UUID, newBehaviorScriptsNodeUUID); - newBehaviorScriptsFolderProps.put(ContentModel.PROP_NAME, newBehaviorScriptsFolderName); - newBehaviorScriptsFolderProps.put(ContentModel.PROP_TITLE, newBehaviorScriptsFolderName); - newBehaviorScriptsFolderProps.put(ContentModel.PROP_DESCRIPTION, "Scripts intended for execution in response to RM events."); - - newBehaviorScriptsFolder = nodeService.createNode(RM_CONFIG, ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, newBehaviorScriptsAssocQName), - ContentModel.TYPE_FOLDER, newBehaviorScriptsFolderProps).getChildRef(); - } - - // move to the new behavior scripts folder if the old behavior scripts folder exists and contains files - if (nodeService.exists(OLD_BEHAVIOR_SCRIPTS_FOLDER)) - { - // run the following code as System - AuthenticationUtil.runAs(new RunAsWork() - { - @SuppressWarnings("deprecation") - public Object doWork() - { - RetryingTransactionCallback callback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Update the description of the old Scripts folder. - nodeService.setProperty(OLD_BEHAVIOR_SCRIPTS_FOLDER, ContentModel.PROP_DESCRIPTION, "Scripts specific to RM that can also be executed by RM rules."); - - // Move files from RM Scripts folder to RM Behavior Scripts folder. - List oldBehaviorScripts = fileFolderService.listFiles(OLD_BEHAVIOR_SCRIPTS_FOLDER); - - if (oldBehaviorScripts != null && !oldBehaviorScripts.isEmpty()) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... moving files from RM Scripts folder to RM Behavior Scripts folder"); - } - - for (FileInfo script : oldBehaviorScripts) - { - // move the old script to the new location - fileFolderService.moveFrom(script.getNodeRef(), OLD_BEHAVIOR_SCRIPTS_FOLDER, RMv21BehaviorScriptsPatch.newBehaviorScriptsFolder, script.getName()); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ...... moved " + script.getName()); - } - } - - } - return null; - } - }; - - retryingTransactionHelper.doInTransaction(callback); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - } - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v21; + +import static org.apache.commons.logging.LogFactory.getLog; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.springframework.beans.factory.BeanNameAware; + +/** + * This patch creates a new "Records Management Behavior Scripts" folder and moves existing behavior scripts from the old "Records Management Scripts" folder to the new folder. + * This is to compensate for any non-behavior RM scripts so that they can live in the old "Records Management Scripts" folder for its intended purpose and be picked up by the + * execute script rule action. + * + * @author Craig Tan + * @since 2.1 + */ +public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements BeanNameAware +{ + /** Logger */ + private static final Log LOGGER = getLog(RMv21BehaviorScriptsPatch.class); + + /** rm config folder root lookup */ + protected static final NodeRef RM_CONFIG = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); + + /** old behavior scripts folder root lookup */ + protected static final NodeRef OLD_BEHAVIOR_SCRIPTS_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_scripts"); + + /** new behavior scripts folder root lookup */ + private static NodeRef newBehaviorScriptsFolder = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_behavior_scripts"); + + /** name of example script */ + protected static final String IS_CLOSED_JS = "rma_isClosed.js"; + + /** Node Service */ + private NodeService nodeService; + + /** File Folder Service */ + private FileFolderService fileFolderService; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param fileFolderService file folder service + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch() + */ + @Override + protected void executePatch() + { + // check that the rm config root has been correctly bootstrapped + if (!nodeService.exists(RM_CONFIG)) + { + // we don't need to do anything + return; + } + + // check that the behavior scripts folder exists + if (!nodeService.exists(newBehaviorScriptsFolder)) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... creating RM Behavior Scripts folder"); + } + + String newBehaviorScriptsFolderName = "Records Management Behavior Scripts"; + String newBehaviorScriptsNodeUUID = "rm_behavior_scripts"; + String newBehaviorScriptsAssocQName = "records_management_behavior_scripts"; + + Map newBehaviorScriptsFolderProps = new HashMap(); + newBehaviorScriptsFolderProps.put(ContentModel.PROP_NODE_UUID, newBehaviorScriptsNodeUUID); + newBehaviorScriptsFolderProps.put(ContentModel.PROP_NAME, newBehaviorScriptsFolderName); + newBehaviorScriptsFolderProps.put(ContentModel.PROP_TITLE, newBehaviorScriptsFolderName); + newBehaviorScriptsFolderProps.put(ContentModel.PROP_DESCRIPTION, "Scripts intended for execution in response to RM events."); + + newBehaviorScriptsFolder = nodeService.createNode(RM_CONFIG, ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, newBehaviorScriptsAssocQName), + ContentModel.TYPE_FOLDER, newBehaviorScriptsFolderProps).getChildRef(); + } + + // move to the new behavior scripts folder if the old behavior scripts folder exists and contains files + if (nodeService.exists(OLD_BEHAVIOR_SCRIPTS_FOLDER)) + { + // run the following code as System + AuthenticationUtil.runAs(new RunAsWork() + { + @SuppressWarnings("deprecation") + public Object doWork() + { + RetryingTransactionCallback callback = new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + // Update the description of the old Scripts folder. + nodeService.setProperty(OLD_BEHAVIOR_SCRIPTS_FOLDER, ContentModel.PROP_DESCRIPTION, "Scripts specific to RM that can also be executed by RM rules."); + + // Move files from RM Scripts folder to RM Behavior Scripts folder. + List oldBehaviorScripts = fileFolderService.listFiles(OLD_BEHAVIOR_SCRIPTS_FOLDER); + + if (oldBehaviorScripts != null && !oldBehaviorScripts.isEmpty()) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... moving files from RM Scripts folder to RM Behavior Scripts folder"); + } + + for (FileInfo script : oldBehaviorScripts) + { + // move the old script to the new location + fileFolderService.moveFrom(script.getNodeRef(), OLD_BEHAVIOR_SCRIPTS_FOLDER, RMv21BehaviorScriptsPatch.newBehaviorScriptsFolder, script.getName()); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ...... moved " + script.getName()); + } + } + + } + return null; + } + }; + + retryingTransactionHelper.doInTransaction(callback); + return null; + } + }, AuthenticationUtil.getSystemUserName()); + + } + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java index 3e21617218..1fd6b521cc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java @@ -1,176 +1,176 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v21; - -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; - -/** - * RM v2.1 patch to updated modified capabilities. - * - * @author Roy Wetherall - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21CapabilityPatch extends RMv21PatchComponent -{ - /** File plan service */ - private FilePlanService filePlanService; - - /** authority service */ - private AuthorityService authorityService; - - /** permission service */ - private PermissionService permissionService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Helper method to get the file plans - * - * @return Set of file plan node references - */ - protected Set getFilePlans() - { - return filePlanService.getFilePlans(); - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * Adds a new capability to the specified roles. - * - * @param filePlan file plan - * @param capabilityName capability name - * @param roles roles - */ - private void addCapability(NodeRef filePlan, String capabilityName, String ... roles) - { - for (String role : roles) - { - String fullRoleName = role + filePlan.getId(); - String roleAuthority = authorityService.getName(AuthorityType.GROUP, fullRoleName); - if (roleAuthority == null) - { - throw new AlfrescoRuntimeException("Role " + role + " does not exist."); - } - else - { - permissionService.setPermission(filePlan, roleAuthority, capabilityName, true); - } - } - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - Set filePlans = getFilePlans(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); - } - - for (NodeRef filePlan : filePlans) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating file plan " + filePlan.toString()); - } - - // add new capabilities - addCapability(filePlan, - "CreateRecords", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - addCapability(filePlan, - "ManageRules", - FilePlanRoleService.ROLE_ADMIN); - addCapability(filePlan, - "RequestRecordInformation", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - addCapability(filePlan, - "FileDestructionReport", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "RejectRecords", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - addCapability(filePlan, - "FileUnfiledRecords", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - addCapability(filePlan, - "LinkToRecords", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_POWER_USER, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v21; + +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.PermissionService; + +/** + * RM v2.1 patch to updated modified capabilities. + * + * @author Roy Wetherall + * @since 2.1 + */ +@SuppressWarnings("deprecation") +public class RMv21CapabilityPatch extends RMv21PatchComponent +{ + /** File plan service */ + private FilePlanService filePlanService; + + /** authority service */ + private AuthorityService authorityService; + + /** permission service */ + private PermissionService permissionService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Helper method to get the file plans + * + * @return Set of file plan node references + */ + protected Set getFilePlans() + { + return filePlanService.getFilePlans(); + } + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * Adds a new capability to the specified roles. + * + * @param filePlan file plan + * @param capabilityName capability name + * @param roles roles + */ + private void addCapability(NodeRef filePlan, String capabilityName, String ... roles) + { + for (String role : roles) + { + String fullRoleName = role + filePlan.getId(); + String roleAuthority = authorityService.getName(AuthorityType.GROUP, fullRoleName); + if (roleAuthority == null) + { + throw new AlfrescoRuntimeException("Role " + role + " does not exist."); + } + else + { + permissionService.setPermission(filePlan, roleAuthority, capabilityName, true); + } + } + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executePatch() + { + Set filePlans = getFilePlans(); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); + } + + for (NodeRef filePlan : filePlans) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating file plan " + filePlan.toString()); + } + + // add new capabilities + addCapability(filePlan, + "CreateRecords", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_POWER_USER, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_SECURITY_OFFICER); + addCapability(filePlan, + "ManageRules", + FilePlanRoleService.ROLE_ADMIN); + addCapability(filePlan, + "RequestRecordInformation", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_POWER_USER, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_SECURITY_OFFICER); + addCapability(filePlan, + "FileDestructionReport", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + addCapability(filePlan, + "RejectRecords", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_POWER_USER, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_SECURITY_OFFICER); + addCapability(filePlan, + "FileUnfiledRecords", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_POWER_USER, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_SECURITY_OFFICER); + addCapability(filePlan, + "LinkToRecords", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_POWER_USER, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_SECURITY_OFFICER); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java index 5eb2b2a992..ffe5b0f39c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java @@ -1,233 +1,233 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v21; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.1 patch to support InPlace functional updates - * - * @author Roy Wetherall - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21InPlacePatch extends RMv21PatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - /** Extended reader and writer role details */ - private static final String ROLE_READERS_LABEL = "In-Place Readers"; - private static final String[] ROLE_READERS_CAPABILITIES = new String[] - { - "ViewRecords" - }; - private static final String ROLE_WRITERS_LABEL = "In-Place Writers"; - private static final String[] ROLE_WRITERS_CAPABILITIES = new String[] - { - "ViewRecords", - "EditNonRecordMetadata" - }; - - /** file plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** file plan service */ - private FilePlanService filePlanService; - - /** File plan permission service */ - private FilePlanPermissionService filePlanPermissionService; - - /** capability service */ - private CapabilityService capabilityService; - - /** rule service */ - private RuleService ruleService; - - /** node service */ - private NodeService nodeService; - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanPermissionService file plan permission service - */ - public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) - { - this.filePlanPermissionService = filePlanPermissionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param ruleService rule service - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - Set filePlans = filePlanService.getFilePlans(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); - } - - for (NodeRef filePlan : filePlans) - { - if (filePlanService.getUnfiledContainer(filePlan) == null) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating file plan " + filePlan.toString()); - } - - ruleService.disableRules(); - try - { - // create fileplan containers - filePlanService.createHoldContainer(filePlan); - filePlanService.createTransferContainer(filePlan); - filePlanService.createUnfiledContainer(filePlan); - - // move any existing holds to new container - moveExistingHolds(filePlan); - - // move any existing transfers to new container - moveExistingTransfers(filePlan); - - // add the inplace roles - filePlanRoleService.createRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, ROLE_READERS_LABEL, getCapabilities(ROLE_READERS_CAPABILITIES)); - filePlanRoleService.createRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, ROLE_WRITERS_LABEL, getCapabilities(ROLE_WRITERS_CAPABILITIES)); - } - finally - { - ruleService.enableRules(); - } - } - } - } - - private Set getCapabilities(String[] capabilityNames) - { - Set capabilities = new HashSet(3); - for (String capabilityName : capabilityNames) - { - capabilities.add(capabilityService.getCapability(capabilityName)); - } - return capabilities; - } - - private void moveExistingHolds(NodeRef filePlan) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... moving existing holds for file plan " + filePlan.toString()); - } - - NodeRef container = filePlanService.getHoldContainer(filePlan); - - List assocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef hold = assoc.getChildRef(); - String name = (String)nodeService.getProperty(hold, ContentModel.PROP_NAME); - nodeService.moveNode(hold, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name)); - } - } - - private void moveExistingTransfers(NodeRef filePlan) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... moving existing transfers for file plan " + filePlan.toString()); - } - - NodeRef container = filePlanService.getTransferContainer(filePlan); - - List assocs = nodeService.getChildAssocs(filePlan, ASSOC_TRANSFERS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef transfer = assoc.getChildRef(); - String name = (String)nodeService.getProperty(transfer, ContentModel.PROP_NAME); - nodeService.moveNode(transfer, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name)); - } - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v21; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.rule.RuleService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.springframework.beans.factory.BeanNameAware; + +/** + * RM v2.1 patch to support InPlace functional updates + * + * @author Roy Wetherall + * @since 2.1 + */ +@SuppressWarnings("deprecation") +public class RMv21InPlacePatch extends RMv21PatchComponent + implements BeanNameAware, RecordsManagementModel, DOD5015Model +{ + /** Extended reader and writer role details */ + private static final String ROLE_READERS_LABEL = "In-Place Readers"; + private static final String[] ROLE_READERS_CAPABILITIES = new String[] + { + "ViewRecords" + }; + private static final String ROLE_WRITERS_LABEL = "In-Place Writers"; + private static final String[] ROLE_WRITERS_CAPABILITIES = new String[] + { + "ViewRecords", + "EditNonRecordMetadata" + }; + + /** file plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** file plan service */ + private FilePlanService filePlanService; + + /** File plan permission service */ + private FilePlanPermissionService filePlanPermissionService; + + /** capability service */ + private CapabilityService capabilityService; + + /** rule service */ + private RuleService ruleService; + + /** node service */ + private NodeService nodeService; + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param filePlanPermissionService file plan permission service + */ + public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService) + { + this.filePlanPermissionService = filePlanPermissionService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param ruleService rule service + */ + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executePatch() + { + Set filePlans = filePlanService.getFilePlans(); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); + } + + for (NodeRef filePlan : filePlans) + { + if (filePlanService.getUnfiledContainer(filePlan) == null) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating file plan " + filePlan.toString()); + } + + ruleService.disableRules(); + try + { + // create fileplan containers + filePlanService.createHoldContainer(filePlan); + filePlanService.createTransferContainer(filePlan); + filePlanService.createUnfiledContainer(filePlan); + + // move any existing holds to new container + moveExistingHolds(filePlan); + + // move any existing transfers to new container + moveExistingTransfers(filePlan); + + // add the inplace roles + filePlanRoleService.createRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, ROLE_READERS_LABEL, getCapabilities(ROLE_READERS_CAPABILITIES)); + filePlanRoleService.createRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, ROLE_WRITERS_LABEL, getCapabilities(ROLE_WRITERS_CAPABILITIES)); + } + finally + { + ruleService.enableRules(); + } + } + } + } + + private Set getCapabilities(String[] capabilityNames) + { + Set capabilities = new HashSet(3); + for (String capabilityName : capabilityNames) + { + capabilities.add(capabilityService.getCapability(capabilityName)); + } + return capabilities; + } + + private void moveExistingHolds(NodeRef filePlan) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... moving existing holds for file plan " + filePlan.toString()); + } + + NodeRef container = filePlanService.getHoldContainer(filePlan); + + List assocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + NodeRef hold = assoc.getChildRef(); + String name = (String)nodeService.getProperty(hold, ContentModel.PROP_NAME); + nodeService.moveNode(hold, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name)); + } + } + + private void moveExistingTransfers(NodeRef filePlan) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... moving existing transfers for file plan " + filePlan.toString()); + } + + NodeRef container = filePlanService.getTransferContainer(filePlan); + + List assocs = nodeService.getChildAssocs(filePlan, ASSOC_TRANSFERS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + NodeRef transfer = assoc.getChildRef(); + String name = (String)nodeService.getProperty(transfer, ContentModel.PROP_NAME); + nodeService.moveNode(transfer, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name)); + } + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21PatchComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21PatchComponent.java index c130bd70c4..f6adef362f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21PatchComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21PatchComponent.java @@ -1,84 +1,84 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v21; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; -import org.alfresco.repo.module.ModuleComponent; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Convenience class to ensure all V2.0 patches are executed before v2.1 - * - * @author Roy Wetherall - * @since 2.2 - */ -@SuppressWarnings("deprecation") -public abstract class RMv21PatchComponent extends ModulePatchComponent - implements ApplicationContextAware -{ - /** application context */ - private ApplicationContext applicationContext; - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * init method - */ - @Override - public void init() - { - super.init(); - - // manual addition of V20 patch dependencies - List depends = getDependsOn(); - addDependency(depends, "org_alfresco_module_rm_notificationTemplatePatch"); - addDependency(depends, "org_alfresco_module_rm_RMv2ModelPatch"); - addDependency(depends, "org_alfresco_module_rm_RMv2FilePlanNodeRefPatch"); - addDependency(depends, "org_alfresco_module_rm_RMv2SavedSearchPatch"); - } - - /** - * @param depends list of module dependencies - * @param beanName bean name - */ - private void addDependency(List depends, String beanName) - { - ModuleComponent moduleComponent = (ModuleComponent)applicationContext.getBean(beanName); - depends.add(moduleComponent); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v21; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent; +import org.alfresco.repo.module.ModuleComponent; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * Convenience class to ensure all V2.0 patches are executed before v2.1 + * + * @author Roy Wetherall + * @since 2.2 + */ +@SuppressWarnings("deprecation") +public abstract class RMv21PatchComponent extends ModulePatchComponent + implements ApplicationContextAware +{ + /** application context */ + private ApplicationContext applicationContext; + + /** + * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) + { + this.applicationContext = applicationContext; + } + + /** + * init method + */ + @Override + public void init() + { + super.init(); + + // manual addition of V20 patch dependencies + List depends = getDependsOn(); + addDependency(depends, "org_alfresco_module_rm_notificationTemplatePatch"); + addDependency(depends, "org_alfresco_module_rm_RMv2ModelPatch"); + addDependency(depends, "org_alfresco_module_rm_RMv2FilePlanNodeRefPatch"); + addDependency(depends, "org_alfresco_module_rm_RMv2SavedSearchPatch"); + } + + /** + * @param depends list of module dependencies + * @param beanName bean name + */ + private void addDependency(List depends, String beanName) + { + ModuleComponent moduleComponent = (ModuleComponent)applicationContext.getBean(beanName); + depends.add(moduleComponent); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java index f85feb708c..610ba955dc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java @@ -1,146 +1,146 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v21; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionServiceImpl; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.springframework.beans.factory.BeanNameAware; - -/** - * RM v2.1 patch to change the record inheritance of permissions. - * - * @author Roy Wetherall - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21RecordInheritancePatch extends RMv21PatchComponent - implements BeanNameAware, RecordsManagementModel, DOD5015Model -{ - /** file plan permission service */ - private FilePlanPermissionServiceImpl filePlanPermissionServiceImpl; - - /** node service */ - private NodeService nodeService; - - /** patch DAO */ - private PatchDAO patchDAO; - - /** qname DAO */ - private QNameDAO qnameDAO; - - /** node DAO */ - private NodeDAO nodeDAO; - - /** - * @param patchDAO patch DAO - */ - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - /** - * @param qnameDAO qname DAO - */ - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @param nodeDAO node DAO - */ - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - /** - * @param filePlanPermissionServiceImpl file plan permission service implementation - */ - public void setFilePlanPermissionServiceImpl(FilePlanPermissionServiceImpl filePlanPermissionServiceImpl) - { - this.filePlanPermissionServiceImpl = filePlanPermissionServiceImpl; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() - */ - @Override - protected void executePatch() - { - Pair aspectPair = qnameDAO.getQName(ASPECT_RECORD); - if (aspectPair != null) - { - List records = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID()); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + records.size() + " records"); - } - - for (Long record : records) - { - Pair recordPair = nodeDAO.getNodePair(record); - NodeRef recordNodeRef = recordPair.getSecond(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating record " + recordNodeRef.toString()); - - // get the primary parent - ChildAssociationRef assoc = nodeService.getPrimaryParent(recordNodeRef); - NodeRef parent = assoc.getParentRef(); - if (parent != null) - { - filePlanPermissionServiceImpl.setupPermissions(parent, recordNodeRef); - } - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v21; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionServiceImpl; +import org.alfresco.repo.domain.node.NodeDAO; +import org.alfresco.repo.domain.patch.PatchDAO; +import org.alfresco.repo.domain.qname.QNameDAO; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.springframework.beans.factory.BeanNameAware; + +/** + * RM v2.1 patch to change the record inheritance of permissions. + * + * @author Roy Wetherall + * @since 2.1 + */ +@SuppressWarnings("deprecation") +public class RMv21RecordInheritancePatch extends RMv21PatchComponent + implements BeanNameAware, RecordsManagementModel, DOD5015Model +{ + /** file plan permission service */ + private FilePlanPermissionServiceImpl filePlanPermissionServiceImpl; + + /** node service */ + private NodeService nodeService; + + /** patch DAO */ + private PatchDAO patchDAO; + + /** qname DAO */ + private QNameDAO qnameDAO; + + /** node DAO */ + private NodeDAO nodeDAO; + + /** + * @param patchDAO patch DAO + */ + public void setPatchDAO(PatchDAO patchDAO) + { + this.patchDAO = patchDAO; + } + + /** + * @param qnameDAO qname DAO + */ + public void setQnameDAO(QNameDAO qnameDAO) + { + this.qnameDAO = qnameDAO; + } + + /** + * @param nodeDAO node DAO + */ + public void setNodeDAO(NodeDAO nodeDAO) + { + this.nodeDAO = nodeDAO; + } + + /** + * @param filePlanPermissionServiceImpl file plan permission service implementation + */ + public void setFilePlanPermissionServiceImpl(FilePlanPermissionServiceImpl filePlanPermissionServiceImpl) + { + this.filePlanPermissionServiceImpl = filePlanPermissionServiceImpl; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal() + */ + @Override + protected void executePatch() + { + Pair aspectPair = qnameDAO.getQName(ASPECT_RECORD); + if (aspectPair != null) + { + List records = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID()); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + records.size() + " records"); + } + + for (Long record : records) + { + Pair recordPair = nodeDAO.getNodePair(record); + NodeRef recordNodeRef = recordPair.getSecond(); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating record " + recordNodeRef.toString()); + + // get the primary parent + ChildAssociationRef assoc = nodeService.getPrimaryParent(recordNodeRef); + NodeRef parent = assoc.getParentRef(); + if (parent != null) + { + filePlanPermissionServiceImpl.setupPermissions(parent, recordNodeRef); + } + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java index 65e7d1a46d..5494af5290 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java @@ -1,149 +1,149 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v21; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.content.MimetypeMap; -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.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Report service patch, adding report structure in data dictionary and report templates. - * - * @author Roy Wetherall - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21ReportServicePatch extends RMv21PatchComponent - implements BeanNameAware -{ - private static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); - private static final NodeRef RM_CONFIG_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); - - private static final String PATH_DESTRUCTION_TEMPLATE = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl"; - - /** node service */ - private NodeService nodeService; - - /** content service */ - private ContentService contentService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - @Override - protected void executePatch() - { - // check whether report dir exists or not - if (nodeService.exists(RM_CONFIG_FOLDER) && !nodeService.exists(TEMPLATE_ROOT)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... adding template root folder"); - } - - NodeRef reportTemplates = createNode( - RM_CONFIG_FOLDER, - ContentModel.TYPE_FOLDER, - "rm_report_templates", - "Records Management Report Templates", - "rm_report_templates", - "Records Management Report Templates", - "Records Management Report Templates"); - nodeService.addAspect(reportTemplates, ContentModel.ASPECT_TITLED, null); - nodeService.addAspect(reportTemplates, ContentModel.ASPECT_AUTHOR, null); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... adding destruction report template"); - } - - // create report templates - NodeRef destructionTemplate = createNode( - TEMPLATE_ROOT, - ContentModel.TYPE_CONTENT, - "rmr_destructionReport", - "report_rmr_destructionReport.html.ftl", - "report_rmr_destructionReport.html.ftl", - "Destruction Report Template", - "Desruction report template."); - nodeService.addAspect(destructionTemplate, ContentModel.ASPECT_TITLED, null); - nodeService.addAspect(destructionTemplate, ContentModel.ASPECT_AUTHOR, null); - - // put the content - ContentWriter writer = contentService.getWriter(destructionTemplate, ContentModel.PROP_CONTENT, true); - InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_DESTRUCTION_TEMPLATE); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(is); - } - } - - private NodeRef createNode(NodeRef parent, QName type, String id, String name, String assocName, String title, String description) - { - Map props = new HashMap(4); - props.put(ContentModel.PROP_DESCRIPTION, description); - props.put(ContentModel.PROP_TITLE, title); - props.put(ContentModel.PROP_NAME, name); - props.put(ContentModel.PROP_NODE_UUID, id); - - // get the assoc qname - QName assocQName = QName.createQName( - NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(assocName)); - - // create the node - return nodeService.createNode( - parent, - ContentModel.ASSOC_CONTAINS, - assocQName, - type, - props).getChildRef(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v21; + +import java.io.InputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.content.MimetypeMap; +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.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.beans.factory.BeanNameAware; + +/** + * Report service patch, adding report structure in data dictionary and report templates. + * + * @author Roy Wetherall + * @since 2.1 + */ +@SuppressWarnings("deprecation") +public class RMv21ReportServicePatch extends RMv21PatchComponent + implements BeanNameAware +{ + private static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); + private static final NodeRef RM_CONFIG_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); + + private static final String PATH_DESTRUCTION_TEMPLATE = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl"; + + /** node service */ + private NodeService nodeService; + + /** content service */ + private ContentService contentService; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + @Override + protected void executePatch() + { + // check whether report dir exists or not + if (nodeService.exists(RM_CONFIG_FOLDER) && !nodeService.exists(TEMPLATE_ROOT)) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... adding template root folder"); + } + + NodeRef reportTemplates = createNode( + RM_CONFIG_FOLDER, + ContentModel.TYPE_FOLDER, + "rm_report_templates", + "Records Management Report Templates", + "rm_report_templates", + "Records Management Report Templates", + "Records Management Report Templates"); + nodeService.addAspect(reportTemplates, ContentModel.ASPECT_TITLED, null); + nodeService.addAspect(reportTemplates, ContentModel.ASPECT_AUTHOR, null); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... adding destruction report template"); + } + + // create report templates + NodeRef destructionTemplate = createNode( + TEMPLATE_ROOT, + ContentModel.TYPE_CONTENT, + "rmr_destructionReport", + "report_rmr_destructionReport.html.ftl", + "report_rmr_destructionReport.html.ftl", + "Destruction Report Template", + "Desruction report template."); + nodeService.addAspect(destructionTemplate, ContentModel.ASPECT_TITLED, null); + nodeService.addAspect(destructionTemplate, ContentModel.ASPECT_AUTHOR, null); + + // put the content + ContentWriter writer = contentService.getWriter(destructionTemplate, ContentModel.PROP_CONTENT, true); + InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_DESTRUCTION_TEMPLATE); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.putContent(is); + } + } + + private NodeRef createNode(NodeRef parent, QName type, String id, String name, String assocName, String title, String description) + { + Map props = new HashMap(4); + props.put(ContentModel.PROP_DESCRIPTION, description); + props.put(ContentModel.PROP_TITLE, title); + props.put(ContentModel.PROP_NAME, name); + props.put(ContentModel.PROP_NODE_UUID, id); + + // get the assoc qname + QName assocQName = QName.createQName( + NamespaceService.CONTENT_MODEL_1_0_URI, + QName.createValidLocalName(assocName)); + + // create the node + return nodeService.createNode( + parent, + ContentModel.ASSOC_CONTAINS, + assocQName, + type, + props).getChildRef(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java index 32d468abdb..1b3e16e18d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java @@ -1,118 +1,118 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v21; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -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.repo.security.authority.RMAuthority; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.springframework.beans.factory.BeanNameAware; - -/** - * Adds the existing rm roles to a new zone "APP.RM" - * - * @author Tuna Aksoy - * @since 2.1 - */ -@SuppressWarnings("deprecation") -public class RMv21RolesPatch extends RMv21PatchComponent implements BeanNameAware -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** file plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** authority service */ - private AuthorityService authorityService; - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch() - */ - @Override - protected void executePatch() - { - Set filePlans = filePlanService.getFilePlans(); - - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); - } - - for (NodeRef filePlan : filePlans) - { - boolean parentAddedToZone = false; - Set roles = filePlanRoleService.getRoles(filePlan); - for (Role role : roles) - { - String roleGroupName = role.getRoleGroupName(); - if (!authorityService.getAuthorityZones(roleGroupName).contains(RMAuthority.ZONE_APP_RM)) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + roleGroupName + " in file plan " + filePlan.toString()); - } - - addAuthorityToZone(roleGroupName); - if (!parentAddedToZone) - { - String allRolesGroupName = filePlanRoleService.getAllRolesContainerGroup(filePlan); - addAuthorityToZone(allRolesGroupName); - parentAddedToZone = true; - } - } - } - } - } - - private void addAuthorityToZone(String roleGroupName) - { - authorityService.addAuthorityToZones(roleGroupName, new HashSet(Arrays.asList(RMAuthority.ZONE_APP_RM))); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v21; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +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.repo.security.authority.RMAuthority; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.springframework.beans.factory.BeanNameAware; + +/** + * Adds the existing rm roles to a new zone "APP.RM" + * + * @author Tuna Aksoy + * @since 2.1 + */ +@SuppressWarnings("deprecation") +public class RMv21RolesPatch extends RMv21PatchComponent implements BeanNameAware +{ + /** file plan service */ + private FilePlanService filePlanService; + + /** file plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** authority service */ + private AuthorityService authorityService; + + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch() + */ + @Override + protected void executePatch() + { + Set filePlans = filePlanService.getFilePlans(); + + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + filePlans.size() + " file plans"); + } + + for (NodeRef filePlan : filePlans) + { + boolean parentAddedToZone = false; + Set roles = filePlanRoleService.getRoles(filePlan); + for (Role role : roles) + { + String roleGroupName = role.getRoleGroupName(); + if (!authorityService.getAuthorityZones(roleGroupName).contains(RMAuthority.ZONE_APP_RM)) + { + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + roleGroupName + " in file plan " + filePlan.toString()); + } + + addAuthorityToZone(roleGroupName); + if (!parentAddedToZone) + { + String allRolesGroupName = filePlanRoleService.getAllRolesContainerGroup(filePlan); + addAuthorityToZone(allRolesGroupName); + parentAddedToZone = true; + } + } + } + } + } + + private void addAuthorityToZone(String roleGroupName) + { + authorityService.addAuthorityToZones(roleGroupName, new HashSet(Arrays.asList(RMAuthority.ZONE_APP_RM))); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java index f2c4920a3c..598380a0fa 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java @@ -1,71 +1,71 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * RM v2.2 patch to updated modified capabilities. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class RMv22CapabilityPatch extends CapabilityPatch -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) - */ - protected void applyCapabilityPatch(NodeRef filePlan) - { - // add new capbilities - addCapability(filePlan, - "FileDestructionReport", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "CreateHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "AddToHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "RemoveFromHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - - // @see https://issues.alfresco.com/jira/browse/RM-2058 - addCapability(filePlan, - "ManageAccessControls", - FilePlanRoleService.ROLE_SECURITY_OFFICER, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * RM v2.2 patch to updated modified capabilities. + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class RMv22CapabilityPatch extends CapabilityPatch +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) + */ + protected void applyCapabilityPatch(NodeRef filePlan) + { + // add new capbilities + addCapability(filePlan, + "FileDestructionReport", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + addCapability(filePlan, + "CreateHold", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + addCapability(filePlan, + "AddToHold", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + addCapability(filePlan, + "RemoveFromHold", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + + // @see https://issues.alfresco.com/jira/browse/RM-2058 + addCapability(filePlan, + "ManageAccessControls", + FilePlanRoleService.ROLE_SECURITY_OFFICER, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODCompliantSitePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODCompliantSitePatch.java index 65432aec91..26117f88da 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODCompliantSitePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODCompliantSitePatch.java @@ -1,91 +1,91 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.domain.qname.QNameDAO; - -/** - * DOD compliant site patch. - * - * Makes all existing sites of type dod:site to preserve their DOD compliance status. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22DODCompliantSitePatch extends AbstractModulePatch - implements RecordsManagementModel -{ - /** QName DAO */ - private QNameDAO qnameDAO; - - /** indicates whether we convert to a standard file plan or not */ - private boolean convertToStandardFilePlan = false; - - /** - * @param qnameDAO QName DAO - */ - public void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @param convertToStandardFilePlan convert to standard file if true, false otherwise - */ - public void setConvertToStandardFilePlan(boolean convertToStandardFilePlan) - { - this.convertToStandardFilePlan = convertToStandardFilePlan; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - if (!convertToStandardFilePlan) - { - // ensure all existing sites are of the correct type - if (qnameDAO.getQName(RecordsManagementModel.TYPE_RM_SITE) != null && - qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_SITE) == null) - { - qnameDAO.updateQName(RecordsManagementModel.TYPE_RM_SITE, DOD5015Model.TYPE_DOD_5015_SITE); - } - - // ensure all the existing file plans are of the correct type - if (qnameDAO.getQName(RecordsManagementModel.TYPE_FILE_PLAN) != null && - qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_FILE_PLAN) == null) - { - qnameDAO.updateQName(RecordsManagementModel.TYPE_FILE_PLAN, DOD5015Model.TYPE_DOD_5015_FILE_PLAN); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.repo.domain.qname.QNameDAO; + +/** + * DOD compliant site patch. + * + * Makes all existing sites of type dod:site to preserve their DOD compliance status. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RMv22DODCompliantSitePatch extends AbstractModulePatch + implements RecordsManagementModel +{ + /** QName DAO */ + private QNameDAO qnameDAO; + + /** indicates whether we convert to a standard file plan or not */ + private boolean convertToStandardFilePlan = false; + + /** + * @param qnameDAO QName DAO + */ + public void setQnameDAO(QNameDAO qnameDAO) + { + this.qnameDAO = qnameDAO; + } + + /** + * @param convertToStandardFilePlan convert to standard file if true, false otherwise + */ + public void setConvertToStandardFilePlan(boolean convertToStandardFilePlan) + { + this.convertToStandardFilePlan = convertToStandardFilePlan; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + if (!convertToStandardFilePlan) + { + // ensure all existing sites are of the correct type + if (qnameDAO.getQName(RecordsManagementModel.TYPE_RM_SITE) != null && + qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_SITE) == null) + { + qnameDAO.updateQName(RecordsManagementModel.TYPE_RM_SITE, DOD5015Model.TYPE_DOD_5015_SITE); + } + + // ensure all the existing file plans are of the correct type + if (qnameDAO.getQName(RecordsManagementModel.TYPE_FILE_PLAN) != null && + qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_FILE_PLAN) == null) + { + qnameDAO.updateQName(RecordsManagementModel.TYPE_FILE_PLAN, DOD5015Model.TYPE_DOD_5015_FILE_PLAN); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java index 25501753df..c20cda93bd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java @@ -1,177 +1,177 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import java.io.Serializable; -import java.util.Collections; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.domain.node.NodeDAO; -import org.alfresco.repo.domain.patch.PatchDAO; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; - -/** - * DOD model separation module patch implementation - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch - implements RecordsManagementModel -{ - /** query batch size */ - private static final long BATCH_SIZE = 100000L; - - /** indicates whether we convert to a standard file plan or not */ - private boolean convertToStandardFilePlan = false; - - /** Patch DAO */ - private PatchDAO patchDAO; - - /** Node DAO */ - private NodeDAO nodeDAO; - - /** qnames to update (switch to dod namespace) */ - private QName[] qnames = - { - DOD5015Model.PROP_ORIGINATOR, - DOD5015Model.PROP_ORIGINATING_ORGANIZATION, - DOD5015Model.PROP_PUBLICATION_DATE, - DOD5015Model.PROP_MEDIA_TYPE, - DOD5015Model.PROP_FORMAT, - DOD5015Model.PROP_DATE_RECEIVED, - DOD5015Model.PROP_ADDRESS, - DOD5015Model.PROP_OTHER_ADDRESS - }; - - /** - * @param convertToStandardFilePlan convert to standard file if true, false otherwise - */ - public void setConvertToStandardFilePlan(boolean convertToStandardFilePlan) - { - this.convertToStandardFilePlan = convertToStandardFilePlan; - } - - /** - * @param patchDAO patch DAO - */ - public void setPatchDAO(PatchDAO patchDAO) - { - this.patchDAO = patchDAO; - } - - /** - * @param nodeDAO node DAO - */ - public void setNodeDAO(NodeDAO nodeDAO) - { - this.nodeDAO = nodeDAO; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - if (!convertToStandardFilePlan) - { - Long maxNodeId = nodeDAO.getMaxNodeId(); - long recordCount = patchDAO.getCountNodesWithAspects(Collections.singleton(ASPECT_RECORD)); - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... updating " + recordCount + " records in batches of " + BATCH_SIZE); - } - - // apply the DOD record aspect to all exiting records - int completed = 0; - for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE) - { - final Long finali = i; - Integer batchCount = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - int batchCount = 0; - - public Integer execute() throws Throwable - { - nodeDAO.getNodesWithAspects(Collections.singleton(ASPECT_RECORD), finali, finali + BATCH_SIZE, new NodeDAO.NodeRefQueryCallback() - { - public boolean handle(Pair nodePair) - { - // get the records properties - Map properties = nodeDAO.getNodeProperties(nodePair.getFirst()); - boolean changed = false; - - for (QName qname : qnames) - { - // if the record has any of the moved properties - QName origional = QName.createQName(RecordsManagementModel.RM_URI, qname.getLocalName()); - if (properties.containsKey(origional)) - { - // move the property value - Serializable value = properties.get(origional); - properties.put(qname, value); - properties.remove(origional); - changed = true; - } - } - - // set properties and add aspect - if (changed) - { - nodeDAO.setNodeProperties(nodePair.getFirst(), properties); - } - nodeDAO.addNodeAspects(nodePair.getFirst(), Collections.singleton(DOD5015Model.ASPECT_DOD_5015_RECORD)); - batchCount ++; - - return true; - } - }); - - return batchCount; - } - } , false, true); - - if (batchCount != 0) - { - completed = completed + batchCount; - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(" ... completed " + completed + " of " + recordCount); - } - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import java.io.Serializable; +import java.util.Collections; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.repo.domain.node.NodeDAO; +import org.alfresco.repo.domain.patch.PatchDAO; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; + +/** + * DOD model separation module patch implementation + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch + implements RecordsManagementModel +{ + /** query batch size */ + private static final long BATCH_SIZE = 100000L; + + /** indicates whether we convert to a standard file plan or not */ + private boolean convertToStandardFilePlan = false; + + /** Patch DAO */ + private PatchDAO patchDAO; + + /** Node DAO */ + private NodeDAO nodeDAO; + + /** qnames to update (switch to dod namespace) */ + private QName[] qnames = + { + DOD5015Model.PROP_ORIGINATOR, + DOD5015Model.PROP_ORIGINATING_ORGANIZATION, + DOD5015Model.PROP_PUBLICATION_DATE, + DOD5015Model.PROP_MEDIA_TYPE, + DOD5015Model.PROP_FORMAT, + DOD5015Model.PROP_DATE_RECEIVED, + DOD5015Model.PROP_ADDRESS, + DOD5015Model.PROP_OTHER_ADDRESS + }; + + /** + * @param convertToStandardFilePlan convert to standard file if true, false otherwise + */ + public void setConvertToStandardFilePlan(boolean convertToStandardFilePlan) + { + this.convertToStandardFilePlan = convertToStandardFilePlan; + } + + /** + * @param patchDAO patch DAO + */ + public void setPatchDAO(PatchDAO patchDAO) + { + this.patchDAO = patchDAO; + } + + /** + * @param nodeDAO node DAO + */ + public void setNodeDAO(NodeDAO nodeDAO) + { + this.nodeDAO = nodeDAO; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + if (!convertToStandardFilePlan) + { + Long maxNodeId = nodeDAO.getMaxNodeId(); + long recordCount = patchDAO.getCountNodesWithAspects(Collections.singleton(ASPECT_RECORD)); + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... updating " + recordCount + " records in batches of " + BATCH_SIZE); + } + + // apply the DOD record aspect to all exiting records + int completed = 0; + for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE) + { + final Long finali = i; + Integer batchCount = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() + { + int batchCount = 0; + + public Integer execute() throws Throwable + { + nodeDAO.getNodesWithAspects(Collections.singleton(ASPECT_RECORD), finali, finali + BATCH_SIZE, new NodeDAO.NodeRefQueryCallback() + { + public boolean handle(Pair nodePair) + { + // get the records properties + Map properties = nodeDAO.getNodeProperties(nodePair.getFirst()); + boolean changed = false; + + for (QName qname : qnames) + { + // if the record has any of the moved properties + QName origional = QName.createQName(RecordsManagementModel.RM_URI, qname.getLocalName()); + if (properties.containsKey(origional)) + { + // move the property value + Serializable value = properties.get(origional); + properties.put(qname, value); + properties.remove(origional); + changed = true; + } + } + + // set properties and add aspect + if (changed) + { + nodeDAO.setNodeProperties(nodePair.getFirst(), properties); + } + nodeDAO.addNodeAspects(nodePair.getFirst(), Collections.singleton(DOD5015Model.ASPECT_DOD_5015_RECORD)); + batchCount ++; + + return true; + } + }); + + return batchCount; + } + } , false, true); + + if (batchCount != 0) + { + completed = completed + batchCount; + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug(" ... completed " + completed + " of " + recordCount); + } + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22FileHoldReportCapabilityPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22FileHoldReportCapabilityPatch.java index b6b5e025d8..e0c3c474db 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22FileHoldReportCapabilityPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22FileHoldReportCapabilityPatch.java @@ -1,53 +1,53 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * RM v2.2 patch to add FileHoldReport capability. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22FileHoldReportCapabilityPatch extends CapabilityPatch -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) - */ - protected void applyCapabilityPatch(NodeRef filePlan) - { - // add new capability - addCapability(filePlan, - "FileHoldReport", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * RM v2.2 patch to add FileHoldReport capability. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RMv22FileHoldReportCapabilityPatch extends CapabilityPatch +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) + */ + protected void applyCapabilityPatch(NodeRef filePlan) + { + // add new capability + addCapability(filePlan, + "FileHoldReport", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22GhostOnDestroyDispositionActionPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22GhostOnDestroyDispositionActionPatch.java index 3b23664467..5f5125e706 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22GhostOnDestroyDispositionActionPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22GhostOnDestroyDispositionActionPatch.java @@ -1,189 +1,189 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; - -/** - * Sets the ghost on destroy property for existing destroy disposition actions - * to the value specified in the global properties file - * - * @author Mark Hibbins - * @since 2.2 - */ -public class RMv22GhostOnDestroyDispositionActionPatch extends AbstractModulePatch -{ - /** Disposition service */ - private DispositionService dispositionService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Node service */ - private NodeService nodeService; - - /** Ghost on destroy setting */ - private boolean ghostingEnabled; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param nodeService file plan service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param ghostingEnabled Ghost on destroy setting from - * alfresco-global.properties - */ - public void setGhostingEnabled(boolean ghostingEnabled) - { - this.ghostingEnabled = ghostingEnabled; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - Set filePlans = filePlanService.getFilePlans(); - for (NodeRef filePlan : filePlans) - { - processFilePlan(filePlan); - } - } - - /** - * Apply the patch to each file plan - * - * @param filePlan - */ - private void processFilePlan(NodeRef filePlan) - { - Set dispositionSchedules = new HashSet(); - getDispositionSchedules(filePlan, dispositionSchedules); - for (DispositionSchedule dispositionSchedule : dispositionSchedules) - { - processDispositionSchedule(dispositionSchedule); - } - } - - /** - * Add the disposition schedule associated with the node ref to the passed - * set of disposition schedule then call this method recursively for this - * node's children - * - * @param nodeRef - * @param dispositionSchedules - */ - private void getDispositionSchedules(NodeRef nodeRef, Set dispositionSchedules) - { - if (filePlanService.isRecordCategory(nodeRef)) - { - DispositionSchedule dispositionSchedule = this.dispositionService.getDispositionSchedule(nodeRef); - if (dispositionSchedule != null) - { - dispositionSchedules.add(dispositionSchedule); - } - - List children = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef childAssoc : children) - { - getDispositionSchedules(childAssoc.getChildRef(), dispositionSchedules); - } - } - } - - /** - * Patch the specified disposition schedule. To do this add the host on - * destroy to any action definition that doesn't already have it defined and - * set the value to the value set in the global properties file. Leave any - * action definitions that have this property already defined untouched. - * - * @param dispositionSchedule - */ - private void processDispositionSchedule(DispositionSchedule dispositionSchedule) - { - List actionDefinitions = dispositionSchedule.getDispositionActionDefinitions(); - for(DispositionActionDefinition actionDefinition : actionDefinitions) - { - String actionName = (String) nodeService.getProperty(actionDefinition.getNodeRef(), - RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME); - if ("destroy".equals(actionName)) - { - // we only want to add the ghost on destroy property to action - // definitions that do not already have it defined - String ghostOnDestroyValue = (String) nodeService.getProperty(actionDefinition.getNodeRef(), - RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY); - if (ghostOnDestroyValue == null) - { - Map props = new HashMap(1); - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, - this.ghostingEnabled ? "ghost" : "destroy"); - this.dispositionService.updateDispositionActionDefinition(actionDefinition, props); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; + +/** + * Sets the ghost on destroy property for existing destroy disposition actions + * to the value specified in the global properties file + * + * @author Mark Hibbins + * @since 2.2 + */ +public class RMv22GhostOnDestroyDispositionActionPatch extends AbstractModulePatch +{ + /** Disposition service */ + private DispositionService dispositionService; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Node service */ + private NodeService nodeService; + + /** Ghost on destroy setting */ + private boolean ghostingEnabled; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param nodeService file plan service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param ghostingEnabled Ghost on destroy setting from + * alfresco-global.properties + */ + public void setGhostingEnabled(boolean ghostingEnabled) + { + this.ghostingEnabled = ghostingEnabled; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + Set filePlans = filePlanService.getFilePlans(); + for (NodeRef filePlan : filePlans) + { + processFilePlan(filePlan); + } + } + + /** + * Apply the patch to each file plan + * + * @param filePlan + */ + private void processFilePlan(NodeRef filePlan) + { + Set dispositionSchedules = new HashSet(); + getDispositionSchedules(filePlan, dispositionSchedules); + for (DispositionSchedule dispositionSchedule : dispositionSchedules) + { + processDispositionSchedule(dispositionSchedule); + } + } + + /** + * Add the disposition schedule associated with the node ref to the passed + * set of disposition schedule then call this method recursively for this + * node's children + * + * @param nodeRef + * @param dispositionSchedules + */ + private void getDispositionSchedules(NodeRef nodeRef, Set dispositionSchedules) + { + if (filePlanService.isRecordCategory(nodeRef)) + { + DispositionSchedule dispositionSchedule = this.dispositionService.getDispositionSchedule(nodeRef); + if (dispositionSchedule != null) + { + dispositionSchedules.add(dispositionSchedule); + } + + List children = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef childAssoc : children) + { + getDispositionSchedules(childAssoc.getChildRef(), dispositionSchedules); + } + } + } + + /** + * Patch the specified disposition schedule. To do this add the host on + * destroy to any action definition that doesn't already have it defined and + * set the value to the value set in the global properties file. Leave any + * action definitions that have this property already defined untouched. + * + * @param dispositionSchedule + */ + private void processDispositionSchedule(DispositionSchedule dispositionSchedule) + { + List actionDefinitions = dispositionSchedule.getDispositionActionDefinitions(); + for(DispositionActionDefinition actionDefinition : actionDefinitions) + { + String actionName = (String) nodeService.getProperty(actionDefinition.getNodeRef(), + RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME); + if ("destroy".equals(actionName)) + { + // we only want to add the ghost on destroy property to action + // definitions that do not already have it defined + String ghostOnDestroyValue = (String) nodeService.getProperty(actionDefinition.getNodeRef(), + RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY); + if (ghostOnDestroyValue == null) + { + Map props = new HashMap(1); + props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, + this.ghostingEnabled ? "ghost" : "destroy"); + this.dispositionService.updateDispositionActionDefinition(actionDefinition, props); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java index dff01e977e..da5115d8b2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java @@ -1,57 +1,57 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * RM v2.2 patch to update capabilities. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22HoldCapabilityPatch extends CapabilityPatch -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) - */ - protected void applyCapabilityPatch(NodeRef filePlan) - { - // add new capability - addCapability(filePlan, - "DeleteHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - addCapability(filePlan, - "EditHold", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * RM v2.2 patch to update capabilities. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RMv22HoldCapabilityPatch extends CapabilityPatch +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) + */ + protected void applyCapabilityPatch(NodeRef filePlan) + { + // add new capability + addCapability(filePlan, + "DeleteHold", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + addCapability(filePlan, + "EditHold", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldReportPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldReportPatch.java index 96ae48e24d..6c80ddf4a8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldReportPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldReportPatch.java @@ -1,118 +1,118 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Adds the hold report. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22HoldReportPatch extends AbstractModulePatch -{ - /** Report template path */ - private static final String REPORT_TEMPLATE_PATH = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl"; - - /** Report template config node IDs */ - private static final NodeRef REPORT_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); - private static final NodeRef REPORT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rmr_holdReport"); - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - if (!nodeService.exists(REPORT)) - { - // get the assoc qname - QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("report_rmr_holdReport.html.ftl")); - - // build the node properties - Map props = new HashMap(4); - props.put(ContentModel.PROP_DESCRIPTION, "Hold report template."); - props.put(ContentModel.PROP_TITLE, "Hold Report Template"); - props.put(ContentModel.PROP_NAME, "report_rmr_holdReport.html.ftl"); - props.put(ContentModel.PROP_NODE_UUID, "rmr_holdReport"); - - // create the node - ChildAssociationRef node = nodeService.createNode( - REPORT_FOLDER, - ContentModel.ASSOC_CONTAINS, - assocQName, - ContentModel.TYPE_CONTENT, - props); - - // put the content - ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - InputStream is = getClass().getClassLoader().getResourceAsStream(REPORT_TEMPLATE_PATH); - writer.putContent(is); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import java.io.InputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +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.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Adds the hold report. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RMv22HoldReportPatch extends AbstractModulePatch +{ + /** Report template path */ + private static final String REPORT_TEMPLATE_PATH = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_holdReport.html.ftl"; + + /** Report template config node IDs */ + private static final NodeRef REPORT_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); + private static final NodeRef REPORT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rmr_holdReport"); + + /** Node service */ + private NodeService nodeService; + + /** Content service */ + private ContentService contentService; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + if (!nodeService.exists(REPORT)) + { + // get the assoc qname + QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("report_rmr_holdReport.html.ftl")); + + // build the node properties + Map props = new HashMap(4); + props.put(ContentModel.PROP_DESCRIPTION, "Hold report template."); + props.put(ContentModel.PROP_TITLE, "Hold Report Template"); + props.put(ContentModel.PROP_NAME, "report_rmr_holdReport.html.ftl"); + props.put(ContentModel.PROP_NODE_UUID, "rmr_holdReport"); + + // create the node + ChildAssociationRef node = nodeService.createNode( + REPORT_FOLDER, + ContentModel.ASSOC_CONTAINS, + assocQName, + ContentModel.TYPE_CONTENT, + props); + + // put the content + ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + InputStream is = getClass().getClassLoader().getResourceAsStream(REPORT_TEMPLATE_PATH); + writer.putContent(is); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatch.java index 204d8af3c0..89ce461126 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatch.java @@ -1,106 +1,106 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -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; - -/** - * Removes the in-place groups from the all roles group. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22RemoveInPlaceRolesFromAllPatch extends AbstractModulePatch -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** file plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** authority service */ - private AuthorityService authorityService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - // get all file plans - Set filePlans = filePlanService.getFilePlans(); - for (NodeRef filePlan : filePlans) - { - Role extendedReaders = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); - Role extendedWriters = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); - - // remove extended readers and writers roles from the all roles group - String allRolesGroup = filePlanRoleService.getAllRolesContainerGroup(filePlan); - Set members = authorityService.getContainedAuthorities(null, allRolesGroup, true); - if (members.contains(extendedReaders.getRoleGroupName())) - { - authorityService.removeAuthority(allRolesGroup, extendedReaders.getRoleGroupName()); - } - if (members.contains(extendedWriters.getRoleGroupName())) - { - authorityService.removeAuthority(allRolesGroup, extendedWriters.getRoleGroupName()); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +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; + +/** + * Removes the in-place groups from the all roles group. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RMv22RemoveInPlaceRolesFromAllPatch extends AbstractModulePatch +{ + /** file plan service */ + private FilePlanService filePlanService; + + /** file plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** authority service */ + private AuthorityService authorityService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + // get all file plans + Set filePlans = filePlanService.getFilePlans(); + for (NodeRef filePlan : filePlans) + { + Role extendedReaders = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); + Role extendedWriters = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); + + // remove extended readers and writers roles from the all roles group + String allRolesGroup = filePlanRoleService.getAllRolesContainerGroup(filePlan); + Set members = authorityService.getContainedAuthorities(null, allRolesGroup, true); + if (members.contains(extendedReaders.getRoleGroupName())) + { + authorityService.removeAuthority(allRolesGroup, extendedReaders.getRoleGroupName()); + } + if (members.contains(extendedWriters.getRoleGroupName())) + { + authorityService.removeAuthority(allRolesGroup, extendedWriters.getRoleGroupName()); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java index 282286b3bf..a01c9aa088 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java @@ -1,121 +1,121 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Adds a new transfer/accession report template to the existing report templates - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class RMv22ReportTemplatePatch extends AbstractModulePatch -{ - /** Report template path */ - private static final String REPORT_TEMPLATE_PATH = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl"; - - /** Report template config node IDs */ - private static final String TRANSFER_REPORT = "rmr_transferReport"; - private static final String DESTRUCTION_REPORT = "rmr_destructionReport"; - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - NodeRef transferReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, TRANSFER_REPORT); - NodeRef destructionReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, DESTRUCTION_REPORT); - if (!nodeService.exists(transferReport) && nodeService.exists(destructionReport)) - { - NodeRef parent = nodeService.getPrimaryParent(destructionReport).getParentRef(); - - // get the assoc qname - QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("report_rmr_transferReport.html.ftl")); - - // build the node properties - Map props = new HashMap(4); - props.put(ContentModel.PROP_DESCRIPTION, "Transfer report template."); - props.put(ContentModel.PROP_TITLE, "Transfer Report Template"); - props.put(ContentModel.PROP_NAME, "report_rmr_transferReport.html.ftl"); - props.put(ContentModel.PROP_NODE_UUID, "rmr_transferReport"); - - // create the node - ChildAssociationRef node = nodeService.createNode(parent, - ContentModel.ASSOC_CONTAINS, - assocQName, - ContentModel.TYPE_CONTENT, - props); - - // put the content - ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); - InputStream is = getClass().getClassLoader().getResourceAsStream(REPORT_TEMPLATE_PATH); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(is); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import java.io.InputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +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.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Adds a new transfer/accession report template to the existing report templates + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class RMv22ReportTemplatePatch extends AbstractModulePatch +{ + /** Report template path */ + private static final String REPORT_TEMPLATE_PATH = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl"; + + /** Report template config node IDs */ + private static final String TRANSFER_REPORT = "rmr_transferReport"; + private static final String DESTRUCTION_REPORT = "rmr_destructionReport"; + + /** Node service */ + private NodeService nodeService; + + /** Content service */ + private ContentService contentService; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + NodeRef transferReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, TRANSFER_REPORT); + NodeRef destructionReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, DESTRUCTION_REPORT); + if (!nodeService.exists(transferReport) && nodeService.exists(destructionReport)) + { + NodeRef parent = nodeService.getPrimaryParent(destructionReport).getParentRef(); + + // get the assoc qname + QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("report_rmr_transferReport.html.ftl")); + + // build the node properties + Map props = new HashMap(4); + props.put(ContentModel.PROP_DESCRIPTION, "Transfer report template."); + props.put(ContentModel.PROP_TITLE, "Transfer Report Template"); + props.put(ContentModel.PROP_NAME, "report_rmr_transferReport.html.ftl"); + props.put(ContentModel.PROP_NODE_UUID, "rmr_transferReport"); + + // create the node + ChildAssociationRef node = nodeService.createNode(parent, + ContentModel.ASSOC_CONTAINS, + assocQName, + ContentModel.TYPE_CONTENT, + props); + + // put the content + ContentWriter writer = contentService.getWriter(node.getChildRef(), ContentModel.PROP_CONTENT, true); + InputStream is = getClass().getClassLoader().getResourceAsStream(REPORT_TEMPLATE_PATH); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.putContent(is); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java index 3d29f967e9..c571d4d381 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java @@ -1,54 +1,54 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v23; - -import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * RM v2.3 patch to add new end retention capability. - * - * @author Alex Balan - * @since 2.3 - */ -public class RMv23EndRetentionCapabilityPatch extends CapabilityPatch -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) - */ - protected void applyCapabilityPatch(NodeRef filePlan) - { - // add new capability - addCapability(filePlan, - "EndRetention", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v23; + +import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * RM v2.3 patch to add new end retention capability. + * + * @author Alex Balan + * @since 2.3 + */ +public class RMv23EndRetentionCapabilityPatch extends CapabilityPatch +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) + */ + protected void applyCapabilityPatch(NodeRef filePlan) + { + // add new capability + addCapability(filePlan, + "EndRetention", + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java index 206f737bc1..317f18342b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v23; - -import org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordContributorsGroupBootstrapComponent; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; - -/** - * RM v2.3 patch that creates the record contributors group. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RMv23RecordContributorsGroupPatch extends AbstractModulePatch -{ - /** record contributors group bootstrap component */ - private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent; - - /** - * @param recordContributorsGroupBootstrapComponent record contributors group bootstrap component - */ - public void setRecordContributorsGroupBootstrapComponent(RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent) - { - this.recordContributorsGroupBootstrapComponent = recordContributorsGroupBootstrapComponent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - // create record contributors group - recordContributorsGroupBootstrapComponent.createRecordContributorsGroup(); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v23; + +import org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordContributorsGroupBootstrapComponent; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; + +/** + * RM v2.3 patch that creates the record contributors group. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RMv23RecordContributorsGroupPatch extends AbstractModulePatch +{ + /** record contributors group bootstrap component */ + private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent; + + /** + * @param recordContributorsGroupBootstrapComponent record contributors group bootstrap component + */ + public void setRecordContributorsGroupBootstrapComponent(RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent) + { + this.recordContributorsGroupBootstrapComponent = recordContributorsGroupBootstrapComponent; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + // create record contributors group + recordContributorsGroupBootstrapComponent.createRecordContributorsGroup(); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java index 57528fc29b..daeb7637be 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java @@ -1,68 +1,68 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v23; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * RM v2.3 patch that creates the versions event. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RMv23VersionsEventPatch extends AbstractModulePatch -{ - /** event details */ - private static final String EVENT_TYPE = "rmEventType.versioned"; - private static final String EVENT_NAME = "versioned"; - private static final String EVENT_I18N = "rmevent.versioned"; - - /** records management event service */ - private RecordsManagementEventService recordsManagementEventService; - - /** - * @param recordsManagementEventService records management event service - */ - public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) - { - this.recordsManagementEventService = recordsManagementEventService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - // add versions event - recordsManagementEventService.addEvent(EVENT_TYPE, EVENT_NAME, I18NUtil.getMessage(EVENT_I18N)); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v23; + +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * RM v2.3 patch that creates the versions event. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RMv23VersionsEventPatch extends AbstractModulePatch +{ + /** event details */ + private static final String EVENT_TYPE = "rmEventType.versioned"; + private static final String EVENT_NAME = "versioned"; + private static final String EVENT_I18N = "rmevent.versioned"; + + /** records management event service */ + private RecordsManagementEventService recordsManagementEventService; + + /** + * @param recordsManagementEventService records management event service + */ + public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) + { + this.recordsManagementEventService = recordsManagementEventService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + */ + @Override + public void applyInternal() + { + // add versions event + recordsManagementEventService.addEvent(EVENT_TYPE, EVENT_NAME, I18NUtil.getMessage(EVENT_I18N)); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java index 2b5de0dffa..4e92766468 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java @@ -1,91 +1,91 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v24; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.alfresco.repo.rule.RuleModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * RM v2.4 patch that ensures that file plan root containers do not inherited rules, because this is no longer enforced - * in the service code anymore. - * - * See https://issues.alfresco.com/jira/browse/RM-3154 - * - * @author Roy Wetherall - * @since 2.4 - */ -public class RMv24FilePlanContainerRuleInheritancePatch extends AbstractModulePatch -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** node service */ - private NodeService nodeService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - * - * Note that we do not break rule inheritance for the root file since this wasn't previously - * the behaviour and we don't want to prevent this from happening if the current installation - * has been setup to allow it. - */ - @Override - public void applyInternal() - { - // get all the file plans - Set filePlans = filePlanService.getFilePlans(); - for (NodeRef filePlan : filePlans) - { - // set rule inheritance for all root file plan containers - nodeService.addAspect(filePlanService.getUnfiledContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - nodeService.addAspect(filePlanService.getHoldContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - nodeService.addAspect(filePlanService.getTransferContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v24; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.repo.rule.RuleModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; + +/** + * RM v2.4 patch that ensures that file plan root containers do not inherited rules, because this is no longer enforced + * in the service code anymore. + * + * See https://issues.alfresco.com/jira/browse/RM-3154 + * + * @author Roy Wetherall + * @since 2.4 + */ +public class RMv24FilePlanContainerRuleInheritancePatch extends AbstractModulePatch +{ + /** file plan service */ + private FilePlanService filePlanService; + + /** node service */ + private NodeService nodeService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + * + * Note that we do not break rule inheritance for the root file since this wasn't previously + * the behaviour and we don't want to prevent this from happening if the current installation + * has been setup to allow it. + */ + @Override + public void applyInternal() + { + // get all the file plans + Set filePlans = filePlanService.getFilePlans(); + for (NodeRef filePlan : filePlans) + { + // set rule inheritance for all root file plan containers + nodeService.addAspect(filePlanService.getUnfiledContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + nodeService.addAspect(filePlanService.getHoldContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + nodeService.addAspect(filePlanService.getTransferContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java index 3a3c10894b..5b31bdf651 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/permission/RecordsManagementPermissionPostProcessor.java @@ -1,82 +1,82 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.permission; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.permissions.processor.impl.PermissionPostProcessorBaseImpl; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; - -/** - * Records management permission post processor. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class RecordsManagementPermissionPostProcessor extends PermissionPostProcessorBaseImpl -{ - /** node service */ - private NodeService nodeService; - public void setNodeService(NodeService nodeService) {this.nodeService=nodeService;} - - /** permission service */ - private PermissionService permissionService; - public void setPermissionService(PermissionService permissionService) {this.permissionService=permissionService;} - - /** - * @see org.alfresco.repo.security.permissions.processor.PermissionPostProcessor#process(org.alfresco.service.cmr.security.AccessStatus, org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public AccessStatus process(AccessStatus accessStatus, NodeRef nodeRef, String perm) - { - AccessStatus result = accessStatus; - if (AccessStatus.DENIED.equals(accessStatus) && - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - // if read denied on rm artifact - if (PermissionService.READ.equals(perm)) - { - // check for read record - result = permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS); - } - // if write deinied on rm artificat - else if (PermissionService.WRITE.equals(perm) || PermissionService.ADD_CHILDREN.equals(perm)) - { - // check for file record - result = permissionService.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS); - } - } - - return result; - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.permission; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.permissions.processor.impl.PermissionPostProcessorBaseImpl; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; + +/** + * Records management permission post processor. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class RecordsManagementPermissionPostProcessor extends PermissionPostProcessorBaseImpl +{ + /** node service */ + private NodeService nodeService; + public void setNodeService(NodeService nodeService) {this.nodeService=nodeService;} + + /** permission service */ + private PermissionService permissionService; + public void setPermissionService(PermissionService permissionService) {this.permissionService=permissionService;} + + /** + * @see org.alfresco.repo.security.permissions.processor.PermissionPostProcessor#process(org.alfresco.service.cmr.security.AccessStatus, org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public AccessStatus process(AccessStatus accessStatus, NodeRef nodeRef, String perm) + { + AccessStatus result = accessStatus; + if (AccessStatus.DENIED.equals(accessStatus) && + nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) + { + // if read denied on rm artifact + if (PermissionService.READ.equals(perm)) + { + // check for read record + result = permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS); + } + // if write deinied on rm artificat + else if (PermissionService.WRITE.equals(perm) || PermissionService.ADD_CHILDREN.equals(perm)) + { + // check for file record + result = permissionService.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS); + } + } + + return result; + + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAO.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAO.java index da32af60e5..8fc12871a6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAO.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAO.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.query; - -/** - * Records management query DAO - * - * NOTE: a place holder that can be extended later when we want to enhance performance with canned queries. - * - * @author Roy Wetherall - * @since 2.1 - */ -public interface RecordsManagementQueryDAO -{ - /** - * Get the number of objects with the given identifier value. - * - * Note: this is provided as an example and is not currently used - * - * @param identifierValue id value - * @return int count - */ - int getCountRmaIdentifier(String identifierValue); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.query; + +/** + * Records management query DAO + * + * NOTE: a place holder that can be extended later when we want to enhance performance with canned queries. + * + * @author Roy Wetherall + * @since 2.1 + */ +public interface RecordsManagementQueryDAO +{ + /** + * Get the number of objects with the given identifier value. + * + * Note: this is provided as an example and is not currently used + * + * @param identifierValue id value + * @return int count + */ + int getCountRmaIdentifier(String identifierValue); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAOImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAOImpl.java index 26cd45c51a..2bea99a1ce 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAOImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/query/RecordsManagementQueryDAOImpl.java @@ -1,100 +1,100 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.query; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.domain.qname.QNameDAO; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.mybatis.spring.SqlSessionTemplate; - -/** - * Records management query DAO implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordsManagementQueryDAOImpl implements RecordsManagementQueryDAO, RecordsManagementModel -{ - private static final String COUNT_IDENTIFIER = "alfresco.query.rm.select_CountRMIndentifier"; - - /** SQL session template */ - protected SqlSessionTemplate template; - - /** QName DAO */ - protected QNameDAO qnameDAO; - - /** - * @param sqlSessionTemplate SQL session template - */ - public final void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) - { - this.template = sqlSessionTemplate; - } - - /** - * @param qnameDAO qname DAO - */ - public final void setQnameDAO(QNameDAO qnameDAO) - { - this.qnameDAO = qnameDAO; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO#getCountRmaIdentifier(java.lang.String) - */ - @Override - public int getCountRmaIdentifier(String identifierValue) - { - int result = 0; - - // lookup the id of the identifier property qname - Pair pair = qnameDAO.getQName(PROP_IDENTIFIER); - if (pair != null) - { - // create query params - Map params = new HashMap(2); - params.put("qnameId", pair.getFirst()); - params.put("idValue", identifierValue); - - // return the number of rma identifiers found that match the passed value - Integer count = (Integer)template.selectOne(COUNT_IDENTIFIER, params); - - if (count != null) - { - result = count; - } - } - - return result; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.query; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.domain.qname.QNameDAO; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.mybatis.spring.SqlSessionTemplate; + +/** + * Records management query DAO implementation + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RecordsManagementQueryDAOImpl implements RecordsManagementQueryDAO, RecordsManagementModel +{ + private static final String COUNT_IDENTIFIER = "alfresco.query.rm.select_CountRMIndentifier"; + + /** SQL session template */ + protected SqlSessionTemplate template; + + /** QName DAO */ + protected QNameDAO qnameDAO; + + /** + * @param sqlSessionTemplate SQL session template + */ + public final void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) + { + this.template = sqlSessionTemplate; + } + + /** + * @param qnameDAO qname DAO + */ + public final void setQnameDAO(QNameDAO qnameDAO) + { + this.qnameDAO = qnameDAO; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO#getCountRmaIdentifier(java.lang.String) + */ + @Override + public int getCountRmaIdentifier(String identifierValue) + { + int result = 0; + + // lookup the id of the identifier property qname + Pair pair = qnameDAO.getQName(PROP_IDENTIFIER); + if (pair != null) + { + // create query params + Map params = new HashMap(2); + params.put("qnameId", pair.getFirst()); + params.put("idValue", identifierValue); + + // return the number of rma identifiers found that match the passed value + Integer count = (Integer)template.selectOne(COUNT_IDENTIFIER, params); + + if (count != null) + { + result = count; + } + } + + return result; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java index 2fd45ca2ef..89af289f90 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java @@ -1,56 +1,56 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.record; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Inplace Record Service Interface. - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public interface InplaceRecordService -{ - /** - * Hides a record within a collaboration site - * - * @param nodeRef The record which should be hidden - */ - void hideRecord(NodeRef nodeRef); - - /** - * Moves a record within a collaboration site - * - * @param nodeRef The record which should be moved - * @param targetNodeRef The target node reference where it should be moved to - */ - void moveRecord(NodeRef nodeRef, NodeRef targetNodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.record; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Inplace Record Service Interface. + * + * @author Tuna Aksoy + * @since 2.3 + */ +@AlfrescoPublicApi +public interface InplaceRecordService +{ + /** + * Hides a record within a collaboration site + * + * @param nodeRef The record which should be hidden + */ + void hideRecord(NodeRef nodeRef); + + /** + * Moves a record within a collaboration site + * + * @param nodeRef The record which should be moved + * @param targetNodeRef The target node reference where it should be moved to + */ + void moveRecord(NodeRef nodeRef, NodeRef targetNodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java index 02431a8ea9..9d54a62b99 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java @@ -1,194 +1,194 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.record; - -import static org.alfresco.model.ContentModel.ASPECT_PENDING_DELETE; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.util.ParameterCheck; - -/** - * Inplace record service implementation. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class InplaceRecordServiceImpl extends ServiceBaseImpl implements InplaceRecordService, RecordsManagementModel -{ - /** Site service */ - private SiteService siteService; - - /** Extended security service */ - private ExtendedSecurityService extendedSecurityService; - - /** File folder service */ - private FileFolderService fileFolderService; - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService( - ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService#hideRecord(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void hideRecord(final NodeRef nodeRef) - { - ParameterCheck.mandatory("NodeRef", nodeRef); - - // do the work of hiding the record as the system user - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // remove the child association - NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); - - if (originatingLocation != null) - { - List parentAssocs = nodeService.getParentAssocs(nodeRef); - for (ChildAssociationRef childAssociationRef : parentAssocs) - { - if (!childAssociationRef.isPrimary() && - childAssociationRef.getParentRef().equals(originatingLocation) && - !nodeService.hasAspect(childAssociationRef.getChildRef(), ASPECT_PENDING_DELETE)) - { - nodeService.removeChildAssociation(childAssociationRef); - break; - } - } - - // remove the extended security from the node - // this prevents the users from continuing to see the record in searchs and other linked locations - extendedSecurityService.remove(nodeRef); - } - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService#moveRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void moveRecord(final NodeRef nodeRef, final NodeRef targetNodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("targetNodeRef", targetNodeRef); - - NodeRef sourceParentNodeRef = null; - - NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); - for (ChildAssociationRef parentAssoc : nodeService.getParentAssocs(nodeRef)) - { - if (!parentAssoc.isPrimary() && parentAssoc.getParentRef().equals(originatingLocation)) - { - sourceParentNodeRef = parentAssoc.getParentRef(); - break; - } - } - - if (sourceParentNodeRef == null) - { - throw new AlfrescoRuntimeException("Could not find source parent node reference."); - } - - SiteInfo sourceSite = siteService.getSite(sourceParentNodeRef); - SiteInfo targetSite = siteService.getSite(targetNodeRef); - - if (!sourceSite.equals(targetSite)) - { - throw new AlfrescoRuntimeException("The record can only be moved within the same collaboration site."); - } - - if (!sourceSite.getSitePreset().equals("site-dashboard")) - { - throw new AlfrescoRuntimeException("Only records within a collaboration site can be moved."); - } - - final NodeRef source = sourceParentNodeRef; - - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - try - { - // Move the record - fileFolderService.moveFrom(nodeRef, source, targetNodeRef, null); - - // Update the originating location property - nodeService.setProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION, targetNodeRef); - } - catch (FileExistsException | FileNotFoundException ex) - { - throw new AlfrescoRuntimeException("Can't move node: " + ex); - } - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.record; + +import static org.alfresco.model.ContentModel.ASPECT_PENDING_DELETE; + +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.model.FileExistsException; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileNotFoundException; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.util.ParameterCheck; + +/** + * Inplace record service implementation. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class InplaceRecordServiceImpl extends ServiceBaseImpl implements InplaceRecordService, RecordsManagementModel +{ + /** Site service */ + private SiteService siteService; + + /** Extended security service */ + private ExtendedSecurityService extendedSecurityService; + + /** File folder service */ + private FileFolderService fileFolderService; + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @param extendedSecurityService extended security service + */ + public void setExtendedSecurityService( + ExtendedSecurityService extendedSecurityService) + { + this.extendedSecurityService = extendedSecurityService; + } + + /** + * @param fileFolderService file folder service + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService#hideRecord(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void hideRecord(final NodeRef nodeRef) + { + ParameterCheck.mandatory("NodeRef", nodeRef); + + // do the work of hiding the record as the system user + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // remove the child association + NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); + + if (originatingLocation != null) + { + List parentAssocs = nodeService.getParentAssocs(nodeRef); + for (ChildAssociationRef childAssociationRef : parentAssocs) + { + if (!childAssociationRef.isPrimary() && + childAssociationRef.getParentRef().equals(originatingLocation) && + !nodeService.hasAspect(childAssociationRef.getChildRef(), ASPECT_PENDING_DELETE)) + { + nodeService.removeChildAssociation(childAssociationRef); + break; + } + } + + // remove the extended security from the node + // this prevents the users from continuing to see the record in searchs and other linked locations + extendedSecurityService.remove(nodeRef); + } + + return null; + } + }); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService#moveRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void moveRecord(final NodeRef nodeRef, final NodeRef targetNodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("targetNodeRef", targetNodeRef); + + NodeRef sourceParentNodeRef = null; + + NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); + for (ChildAssociationRef parentAssoc : nodeService.getParentAssocs(nodeRef)) + { + if (!parentAssoc.isPrimary() && parentAssoc.getParentRef().equals(originatingLocation)) + { + sourceParentNodeRef = parentAssoc.getParentRef(); + break; + } + } + + if (sourceParentNodeRef == null) + { + throw new AlfrescoRuntimeException("Could not find source parent node reference."); + } + + SiteInfo sourceSite = siteService.getSite(sourceParentNodeRef); + SiteInfo targetSite = siteService.getSite(targetNodeRef); + + if (!sourceSite.equals(targetSite)) + { + throw new AlfrescoRuntimeException("The record can only be moved within the same collaboration site."); + } + + if (!sourceSite.getSitePreset().equals("site-dashboard")) + { + throw new AlfrescoRuntimeException("Only records within a collaboration site can be moved."); + } + + final NodeRef source = sourceParentNodeRef; + + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + try + { + // Move the record + fileFolderService.moveFrom(nodeRef, source, targetNodeRef, null); + + // Update the originating location property + nodeService.setProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION, targetNodeRef); + } + catch (FileExistsException | FileNotFoundException ex) + { + throw new AlfrescoRuntimeException("Can't move node: " + ex); + } + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java index d4707b9d8b..dd24a0d8ad 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.record; - -import org.alfresco.error.AlfrescoRuntimeException; - - -/** - * Record link exception class - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordLinkRuntimeException extends AlfrescoRuntimeException -{ - private static final long serialVersionUID = 5202539484220535897L; - - public RecordLinkRuntimeException(String msgId, Throwable cause) - { - super(msgId, cause); - } - - public RecordLinkRuntimeException(String msgId, Object[] msgParams, Throwable cause) - { - super(msgId, msgParams, cause); - } - - public RecordLinkRuntimeException(String msgId, Object[] msgParams) - { - super(msgId, msgParams); - } - - public RecordLinkRuntimeException(String msgId) - { - super(msgId); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.record; + +import org.alfresco.error.AlfrescoRuntimeException; + + +/** + * Record link exception class + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RecordLinkRuntimeException extends AlfrescoRuntimeException +{ + private static final long serialVersionUID = 5202539484220535897L; + + public RecordLinkRuntimeException(String msgId, Throwable cause) + { + super(msgId, cause); + } + + public RecordLinkRuntimeException(String msgId, Object[] msgParams, Throwable cause) + { + super(msgId, msgParams, cause); + } + + public RecordLinkRuntimeException(String msgId, Object[] msgParams) + { + super(msgId, msgParams); + } + + public RecordLinkRuntimeException(String msgId) + { + super(msgId); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrap.java index c35604ce0e..56a87a786d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrap.java @@ -1,101 +1,101 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.record; - -import java.util.Map; - -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Record metadata bootstrap bean. - *

- * This method of bootstrapping record metadata aspects into the RecordService deprecates the - * previous practice of extending rma:recordMetaData. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RecordMetadataBootstrap -{ - /** record service */ - private RecordService recordService; - - /** namespace service */ - private NamespaceService namespaceService; - - /** map of record metadata aspects against file plan type */ - private Map recordMetadataAspects; - - /** - * @param recordMetadataAspects map of record metadata aspects against file plan types - */ - public void setRecordMetadataAspects(Map recordMetadataAspects) - { - this.recordMetadataAspects = recordMetadataAspects; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * Init method - */ - public void init() - { - ParameterCheck.mandatory("recordService", recordService); - ParameterCheck.mandatory("namespaceService", namespaceService); - - if (recordMetadataAspects != null) - { - for (Map.Entry entry : recordMetadataAspects.entrySet()) - { - // convert to qname's - QName recordMetadataAspect = QName.createQName(entry.getKey(), namespaceService); - QName filePlanType = QName.createQName(entry.getValue(), namespaceService); - - // register with record service - recordService.registerRecordMetadataAspect(recordMetadataAspect, filePlanType); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.record; + +import java.util.Map; + +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; + +/** + * Record metadata bootstrap bean. + *

+ * This method of bootstrapping record metadata aspects into the RecordService deprecates the + * previous practice of extending rma:recordMetaData. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RecordMetadataBootstrap +{ + /** record service */ + private RecordService recordService; + + /** namespace service */ + private NamespaceService namespaceService; + + /** map of record metadata aspects against file plan type */ + private Map recordMetadataAspects; + + /** + * @param recordMetadataAspects map of record metadata aspects against file plan types + */ + public void setRecordMetadataAspects(Map recordMetadataAspects) + { + this.recordMetadataAspects = recordMetadataAspects; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * Init method + */ + public void init() + { + ParameterCheck.mandatory("recordService", recordService); + ParameterCheck.mandatory("namespaceService", namespaceService); + + if (recordMetadataAspects != null) + { + for (Map.Entry entry : recordMetadataAspects.entrySet()) + { + // convert to qname's + QName recordMetadataAspect = QName.createQName(entry.getKey(), namespaceService); + QName filePlanType = QName.createQName(entry.getValue(), namespaceService); + + // register with record service + recordService.registerRecordMetadataAspect(recordMetadataAspect, filePlanType); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java index a710454e8f..6de8705a65 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java @@ -1,281 +1,281 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.record; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Record Service Interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordService -{ - /** - * Register a record metadata aspect. - *

- * The file plan type indicates which file plan type the aspect applied to. Null indicates that - * the aspect applies to rma:filePlan. - *

- * A record metadata aspect can be registered more than once if it applies to more than one - * file plan type. - * - * @param recordMetadataAspect record metadata aspect qualified name - * @param filePlanType file plan type - * - * @since 2.2 - */ - void registerRecordMetadataAspect(QName recordMetadataAspect, QName filePlanType); - - /** - * Disables the property editable check. - * - * @since 2.2 - */ - void disablePropertyEditableCheck(); - - /** - * Disables the property editable check for a given node in this transaction only. - * - * @param nodeRef node reference - * - * @since 2.2 - */ - void disablePropertyEditableCheck(NodeRef nodeRef); - - /** - * Enables the property editable check. By default this is always enabled. - */ - void enablePropertyEditableCheck(); - - /** - * Gets a list of all the record meta-data aspects - * - * @return {@link Set}<{@link QName}> list of record meta-data aspects - * - * @deprecated since 2.2, file plan component required to provide context - */ - @Deprecated - Set getRecordMetaDataAspects(); - - /** - * Indicates whether the provided aspect is a registered record meta-data - * aspect. - * - * @param aspect aspect {@link QName} - * @return boolean true if the aspect is a registered record meta-data aspect, false otherwise - * - * @since 2.3 - */ - boolean isRecordMetadataAspect(QName aspect); - - /** - * Indicates whther the provided property is declared on a registered record - * meta-data aspect. - * - * @param property property {@link QName} - * @return boolean true if the property is declared on a registered record meta-data aspect, - * false otherwise - * - * @since 2.3 - */ - boolean isRecordMetadataProperty(QName property); - - /** - * Gets a list of all the record metadata aspects relevant to the file plan type of the - * file plan component provided. - *

- * If a null context is provided all record meta-data aspects are returned, but this is not - * recommended. - * - * @param nodeRef node reference to file plan component providing context - * @return {@link Set}<{@link QName}> list of record meta-data aspects - * - * @since 2.2 - */ - Set getRecordMetadataAspects(NodeRef nodeRef); - - /** - * Gets a list of all the record metadata aspect that relate to the provided file plan type. - *

- * If null is provided for the file plan type then record metadata aspects for the default - * file plan type (rma:filePlan) are returned. - * - * @param filePlanType file plan type - * @return{@link Set}<{@link QName}> list of record meta-data aspects - * - * @since 2.2 - */ - Set getRecordMetadataAspects(QName filePlanType); - - /** - * Checks whether if the given node reference is a record or not - * - * @param nodeRef node reference to be checked - * @return boolean true if the node reference is a record, false otherwise - */ - boolean isRecord(NodeRef nodeRef); - - /** - * Indicates whether the record is declared - * - * @param nodeRef node reference of the record for which the check would be performed - * @return boolean true if record is declared, false otherwise - */ - boolean isDeclared(NodeRef nodeRef); - - /** - * Creates a new unfiled record from an existing node. - *

- * Note that the node reference of the record will be the same as the original - * document. - * - * @param filePlan The filePlan in which the record should be placed - * @param nodeRef The node from which the record will be created - * @param isLinked indicates if the newly created record is linked to it's original location or not. - */ - void createRecord(NodeRef filePlan, NodeRef nodeRef, boolean isLinked); - - /** - * Links the newly created record to it's original location. - * - * @see #createRecord(NodeRef, NodeRef, boolean) - */ - void createRecord(NodeRef filePlan, NodeRef nodeRef); - - /** - * Creates a record from a copy of the node reference provided. - * - * @param filePlan file plan - * @param nodeRef node reference - */ - NodeRef createRecordFromCopy(NodeRef filePlan, NodeRef nodeRef); - - /** - * Creates a new document in the unfiled records container if the given node reference is a file plan - * node reference otherwise the node reference will be used as the destination for the new record. - * - * @param parent parent node reference - * @param name name of the new record - * @param type content type, cm:content if null - * @param properties properties - * @param reader content reader - */ - NodeRef createRecordFromContent(NodeRef parent, String name, QName type, Map properties, ContentReader reader); - - /** - * Indicates whether the record is filed or not - * - * @param nodeRef record - * @return boolean true if filed, false otherwise - */ - boolean isFiled(NodeRef record); - - /** - * 'File' a new document that arrived in the file plan structure. - * - * @param nodeRef record - */ - void file(NodeRef record); - - /** - * Rejects a record with the provided reason - * - * @param nodeRef The record which will be rejected - * @param reason The reason for rejection - */ - void rejectRecord(NodeRef nodeRef, String reason); - - /** - * Indicates whether a property of a record is editable for the current user or not. - * - * @param record record - * @param property property - * @return boolean true if editable, false otherwise. - */ - boolean isPropertyEditable(NodeRef record, QName property); - - /** - * Indicates whether the given node (record or record folder) is a metadata stub or not. - * - * @param nodeRef node reference - * @return boolean true if a metadata stub, false otherwise - */ - boolean isMetadataStub(NodeRef nodeRef); - - /** - * Gets a list of all the records within a record folder - * - * @param recordFolder record folder - * @return List list of records in the record folder - */ - List getRecords(NodeRef recordFolder); - - /** - * Adds the specified type to the record - * - * @param nodeRef Record node reference - * @param typeQName Type to add - */ - void addRecordType(NodeRef nodeRef, QName typeQName); - - /** - * Creates a record from the given document - * - * @param nodeRef The document node reference from which a record will be created - */ - void makeRecord(NodeRef nodeRef); - - /** - * Links a record to a record folder - * - * @param record the record to link - * @param recordFolder the record folder to link it to - */ - void link(NodeRef record, NodeRef recordFolder); - - /** - * Unlinks a record from a specified record folder. - * - * @param record the record to unlink - * @param recordFolder the record folder to unlink it from - * - * @since 2.3 - */ - void unlink(NodeRef record, NodeRef recordFolder); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.record; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Record Service Interface. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface RecordService +{ + /** + * Register a record metadata aspect. + *

+ * The file plan type indicates which file plan type the aspect applied to. Null indicates that + * the aspect applies to rma:filePlan. + *

+ * A record metadata aspect can be registered more than once if it applies to more than one + * file plan type. + * + * @param recordMetadataAspect record metadata aspect qualified name + * @param filePlanType file plan type + * + * @since 2.2 + */ + void registerRecordMetadataAspect(QName recordMetadataAspect, QName filePlanType); + + /** + * Disables the property editable check. + * + * @since 2.2 + */ + void disablePropertyEditableCheck(); + + /** + * Disables the property editable check for a given node in this transaction only. + * + * @param nodeRef node reference + * + * @since 2.2 + */ + void disablePropertyEditableCheck(NodeRef nodeRef); + + /** + * Enables the property editable check. By default this is always enabled. + */ + void enablePropertyEditableCheck(); + + /** + * Gets a list of all the record meta-data aspects + * + * @return {@link Set}<{@link QName}> list of record meta-data aspects + * + * @deprecated since 2.2, file plan component required to provide context + */ + @Deprecated + Set getRecordMetaDataAspects(); + + /** + * Indicates whether the provided aspect is a registered record meta-data + * aspect. + * + * @param aspect aspect {@link QName} + * @return boolean true if the aspect is a registered record meta-data aspect, false otherwise + * + * @since 2.3 + */ + boolean isRecordMetadataAspect(QName aspect); + + /** + * Indicates whther the provided property is declared on a registered record + * meta-data aspect. + * + * @param property property {@link QName} + * @return boolean true if the property is declared on a registered record meta-data aspect, + * false otherwise + * + * @since 2.3 + */ + boolean isRecordMetadataProperty(QName property); + + /** + * Gets a list of all the record metadata aspects relevant to the file plan type of the + * file plan component provided. + *

+ * If a null context is provided all record meta-data aspects are returned, but this is not + * recommended. + * + * @param nodeRef node reference to file plan component providing context + * @return {@link Set}<{@link QName}> list of record meta-data aspects + * + * @since 2.2 + */ + Set getRecordMetadataAspects(NodeRef nodeRef); + + /** + * Gets a list of all the record metadata aspect that relate to the provided file plan type. + *

+ * If null is provided for the file plan type then record metadata aspects for the default + * file plan type (rma:filePlan) are returned. + * + * @param filePlanType file plan type + * @return{@link Set}<{@link QName}> list of record meta-data aspects + * + * @since 2.2 + */ + Set getRecordMetadataAspects(QName filePlanType); + + /** + * Checks whether if the given node reference is a record or not + * + * @param nodeRef node reference to be checked + * @return boolean true if the node reference is a record, false otherwise + */ + boolean isRecord(NodeRef nodeRef); + + /** + * Indicates whether the record is declared + * + * @param nodeRef node reference of the record for which the check would be performed + * @return boolean true if record is declared, false otherwise + */ + boolean isDeclared(NodeRef nodeRef); + + /** + * Creates a new unfiled record from an existing node. + *

+ * Note that the node reference of the record will be the same as the original + * document. + * + * @param filePlan The filePlan in which the record should be placed + * @param nodeRef The node from which the record will be created + * @param isLinked indicates if the newly created record is linked to it's original location or not. + */ + void createRecord(NodeRef filePlan, NodeRef nodeRef, boolean isLinked); + + /** + * Links the newly created record to it's original location. + * + * @see #createRecord(NodeRef, NodeRef, boolean) + */ + void createRecord(NodeRef filePlan, NodeRef nodeRef); + + /** + * Creates a record from a copy of the node reference provided. + * + * @param filePlan file plan + * @param nodeRef node reference + */ + NodeRef createRecordFromCopy(NodeRef filePlan, NodeRef nodeRef); + + /** + * Creates a new document in the unfiled records container if the given node reference is a file plan + * node reference otherwise the node reference will be used as the destination for the new record. + * + * @param parent parent node reference + * @param name name of the new record + * @param type content type, cm:content if null + * @param properties properties + * @param reader content reader + */ + NodeRef createRecordFromContent(NodeRef parent, String name, QName type, Map properties, ContentReader reader); + + /** + * Indicates whether the record is filed or not + * + * @param nodeRef record + * @return boolean true if filed, false otherwise + */ + boolean isFiled(NodeRef record); + + /** + * 'File' a new document that arrived in the file plan structure. + * + * @param nodeRef record + */ + void file(NodeRef record); + + /** + * Rejects a record with the provided reason + * + * @param nodeRef The record which will be rejected + * @param reason The reason for rejection + */ + void rejectRecord(NodeRef nodeRef, String reason); + + /** + * Indicates whether a property of a record is editable for the current user or not. + * + * @param record record + * @param property property + * @return boolean true if editable, false otherwise. + */ + boolean isPropertyEditable(NodeRef record, QName property); + + /** + * Indicates whether the given node (record or record folder) is a metadata stub or not. + * + * @param nodeRef node reference + * @return boolean true if a metadata stub, false otherwise + */ + boolean isMetadataStub(NodeRef nodeRef); + + /** + * Gets a list of all the records within a record folder + * + * @param recordFolder record folder + * @return List list of records in the record folder + */ + List getRecords(NodeRef recordFolder); + + /** + * Adds the specified type to the record + * + * @param nodeRef Record node reference + * @param typeQName Type to add + */ + void addRecordType(NodeRef nodeRef, QName typeQName); + + /** + * Creates a record from the given document + * + * @param nodeRef The document node reference from which a record will be created + */ + void makeRecord(NodeRef nodeRef); + + /** + * Links a record to a record folder + * + * @param record the record to link + * @param recordFolder the record folder to link it to + */ + void link(NodeRef record, NodeRef recordFolder); + + /** + * Unlinks a record from a specified record folder. + * + * @param record the record to unlink + * @param recordFolder the record folder to unlink it from + * + * @since 2.3 + */ + void unlink(NodeRef record, NodeRef recordFolder); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java index 1756b09a90..79e4311596 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java @@ -1,1798 +1,1798 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.record; - -import static com.google.common.collect.Lists.newArrayList; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeFileRecord; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RecordsManagementContainerType; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelAccessDeniedException; -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; -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.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.ClassPolicyDelegate; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.EqualsHelper; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Record service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class RecordServiceImpl extends BaseBehaviourBean - implements RecordService, - RecordsManagementModel, - RecordsManagementCustomModel, - NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnRemoveAspectPolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordServiceImpl.class); - - /** transation data key */ - private static final String KEY_IGNORE_ON_UPDATE = "ignoreOnUpdate"; - private static final String KEY_PENDING_FILLING = "pendingFilling"; - public static final String KEY_NEW_RECORDS = "newRecords"; - - /** I18N */ - private static final String MSG_NODE_HAS_ASPECT = "rm.service.node-has-aspect"; - private static final String FINAL_VERSION = "rm.service.final-version"; - private static final String FINAL_DESCRIPTION = "rm.service.final-version-description"; - - /** Always edit property array */ - private static final QName[] ALWAYS_EDIT_PROPERTIES = new QName[] - { - ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA - }; - - /** always edit model URI's */ - protected List getAlwaysEditURIs() - { - return newArrayList( - NamespaceService.SECURITY_MODEL_1_0_URI, - NamespaceService.SYSTEM_MODEL_1_0_URI, - NamespaceService.WORKFLOW_MODEL_1_0_URI, - NamespaceService.APP_MODEL_1_0_URI, - NamespaceService.DATALIST_MODEL_1_0_URI, - NamespaceService.DICTIONARY_MODEL_1_0_URI, - NamespaceService.BPM_MODEL_1_0_URI, - NamespaceService.RENDITION_MODEL_1_0_URI - ); - } - - /** record model URI's */ - public static final List RECORD_MODEL_URIS = Collections.unmodifiableList( - Arrays.asList( - RM_URI, - RM_CUSTOM_URI, - ReportModel.RMR_URI, - RecordableVersionModel.RMV_URI, - DOD5015Model.DOD_URI - )); - - /** non-record model URI's */ - private static final String[] NON_RECORD_MODEL_URIS = new String[] - { - NamespaceService.AUDIO_MODEL_1_0_URI, - NamespaceService.CONTENT_MODEL_1_0_URI, - NamespaceService.EMAILSERVER_MODEL_URI, - NamespaceService.EXIF_MODEL_1_0_URI, - NamespaceService.FORUMS_MODEL_1_0_URI, - NamespaceService.LINKS_MODEL_1_0_URI, - NamespaceService.REPOSITORY_VIEW_1_0_URI - }; - - /** Indentity service */ - private IdentifierService identifierService; - - /** Extended permission service */ - private ExtendedPermissionService extendedPermissionService; - - /** Extended security service */ - private ExtendedSecurityService extendedSecurityService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Records management notification helper */ - private RecordsManagementNotificationHelper notificationHelper; - - /** Policy component */ - private PolicyComponent policyComponent; - - /** Ownable service */ - private OwnableService ownableService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** Rule service */ - private RuleService ruleService; - - /** File folder service */ - private FileFolderService fileFolderService; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** Permission service */ - private PermissionService permissionService; - - /** Version service */ - private VersionService versionService; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** records management container type */ - private RecordsManagementContainerType recordsManagementContainerType; - - /** recordable version service */ - private RecordableVersionService recordableVersionService; - - /** list of available record meta-data aspects and the file plan types the are applicable to */ - private Map> recordMetaDataAspects; - - /** policies */ - private ClassPolicyDelegate beforeFileRecord; - private ClassPolicyDelegate onFileRecord; - - /** Behaviours */ - private JavaBehaviour onCreateChildAssociation = new JavaBehaviour( - this, - "onCreateChildAssociation", - NotificationFrequency.FIRST_EVENT); - - /** - * @param identifierService identifier service - */ - public void setIdentifierService(IdentifierService identifierService) - { - this.identifierService = identifierService; - } - - /** - * @param extendedPermissionService extended permission service - */ - public void setExtendedPermissionService(ExtendedPermissionService extendedPermissionService) - { - this.extendedPermissionService = extendedPermissionService; - } - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param notificationHelper notification helper - */ - public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) - { - this.notificationHelper = notificationHelper; - } - - /** - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * @param ownableService ownable service - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param ruleService rule service - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param versionService version service - */ - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - /** - * @param relationshipService relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordsManagementContainerType records management container type - */ - public void setRecordsManagementContainerType(RecordsManagementContainerType recordsManagementContainerType) - { - this.recordsManagementContainerType = recordsManagementContainerType; - } - - /** - * @param recordableVersionService recordable version service - */ - public void setRecordableVersionService(RecordableVersionService recordableVersionService) - { - this.recordableVersionService = recordableVersionService; - } - - /** - * Init method - */ - public void init() - { - // bind policies - beforeFileRecord = policyComponent.registerClassPolicy(BeforeFileRecord.class); - onFileRecord = policyComponent.registerClassPolicy(OnFileRecord.class); - - // bind behaviours - policyComponent.bindAssociationBehaviour( - NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME, - TYPE_RECORD_FOLDER, - ContentModel.ASSOC_CONTAINS, - onCreateChildAssociation); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "sys:noContent" - ) - public void onRemoveAspect(NodeRef nodeRef, QName aspect) - { - - if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - - // Only switch name back to the format of "name (identifierId)" if content size is non-zero, else leave it as the original name to avoid CIFS shuffling issues. - if (contentData != null && contentData.getSize() > 0) - { - switchNames(nodeRef); - } - } - else - { - // check whether filling is pending aspect removal - Set pendingFilling = transactionalResourceHelper.getSet(KEY_PENDING_FILLING); - if (pendingFilling.contains(nodeRef)) - { - file(nodeRef); - } - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "sys:noContent" - ) - public void onAddAspect(NodeRef nodeRef, QName aspect) - { - switchNames(nodeRef); - } - - /** - * Helper method to switch the name of the record around. Used to support record creation via - * file protocols. - * - * @param nodeRef node reference (record) - */ - private void switchNames(NodeRef nodeRef) - { - try - { - if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - String origionalName = (String)nodeService.getProperty(nodeRef, PROP_ORIGIONAL_NAME); - if (origionalName != null) - { - String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - fileFolderService.rename(nodeRef, origionalName); - nodeService.setProperty(nodeRef, PROP_ORIGIONAL_NAME, name); - } - } - } - catch (FileExistsException e) - { - if (logger.isDebugEnabled()) - { - logger.debug(e.getMessage()); - } - } - catch (InvalidNodeRefException e) - { - if (logger.isDebugEnabled()) - { - logger.debug(e.getMessage()); - } - } - catch (FileNotFoundException e) - { - if (logger.isDebugEnabled()) - { - logger.debug(e.getMessage()); - } - } - } - - /** - * Behaviour executed when a new item is added to a record folder. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, final boolean bNew) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - onCreateChildAssociation.disable(); - try - { - NodeRef nodeRef = childAssocRef.getChildRef(); - if (nodeService.exists(nodeRef) && - !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY) && - !nodeService.getType(nodeRef).equals(TYPE_RECORD_FOLDER) && - !nodeService.getType(nodeRef).equals(TYPE_RECORD_CATEGORY)) - { - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) - { - // we need to postpone filling until the NO_CONTENT aspect is removed - Set pendingFilling = transactionalResourceHelper.getSet(KEY_PENDING_FILLING); - pendingFilling.add(nodeRef); - } - else - { - // store information about the 'new' record in the transaction - // @since 2.3 - // @see https://issues.alfresco.com/jira/browse/RM-1956 - if (bNew) - { - Set newRecords = transactionalResourceHelper.getSet(KEY_NEW_RECORDS); - newRecords.add(nodeRef); - } - else - { - // if we are linking a record - NodeRef parentNodeRef = childAssocRef.getParentRef(); - if (isRecord(nodeRef) && isRecordFolder(parentNodeRef)) - { - // validate the link conditions - validateLinkConditions(nodeRef, parentNodeRef); - } - } - - // create and file the content as a record - file(nodeRef); - } - } - } - catch (RecordLinkRuntimeException e) - { - // rethrow exception - throw e; - } - catch (AlfrescoRuntimeException e) - { - // do nothing but log error - if (logger.isWarnEnabled()) - { - logger.warn("Unable to file pending record.", e); - } - } - finally - { - onCreateChildAssociation.enable(); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck() - */ - @Override - public void disablePropertyEditableCheck() - { - org.alfresco.repo.policy.Behaviour behaviour = getBehaviour("onUpdateProperties"); - if (behaviour != null) - { - getBehaviour("onUpdateProperties").disable(); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck(org.alfresco.service.cmr.repository.NodeRef) - */ - public void disablePropertyEditableCheck(NodeRef nodeRef) - { - Set ignoreOnUpdate = transactionalResourceHelper.getSet(KEY_IGNORE_ON_UPDATE); - ignoreOnUpdate.add(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#enablePropertyEditableCheck() - */ - @Override - public void enablePropertyEditableCheck() - { - org.alfresco.repo.policy.Behaviour behaviour = getBehaviour("onUpdateProperties"); - if (behaviour != null) - { - behaviour.enable(); - } - } - - /** - * Ensure that the user only updates record properties that they have permission to. - * - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - name = "onUpdateProperties", - kind = BehaviourKind.CLASS, - type= "rma:record" - ) - public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) - { - if (AuthenticationUtil.getFullyAuthenticatedUser() != null && - !AuthenticationUtil.isRunAsUserTheSystemUser() && - nodeService.exists(nodeRef) && - isRecord(nodeRef) && - !transactionalResourceHelper.getSet(KEY_IGNORE_ON_UPDATE).contains(nodeRef)) - { - for (Map.Entry entry : after.entrySet()) - { - Serializable beforeValue = null; - QName property = entry.getKey(); - if (before != null) - { - beforeValue = before.get(property); - } - - Serializable afterValue = entry.getValue(); - boolean propertyUnchanged = false; - if (beforeValue instanceof Date && afterValue instanceof Date) - { - // deal with date values, remove the seconds and milliseconds for the - // comparison as they are removed from the submitted for data - Calendar beforeCal = Calendar.getInstance(); - beforeCal.setTime((Date)beforeValue); - Calendar afterCal = Calendar.getInstance(); - afterCal.setTime((Date)afterValue); - beforeCal.set(Calendar.SECOND, 0); - beforeCal.set(Calendar.MILLISECOND, 0); - afterCal.set(Calendar.SECOND, 0); - afterCal.set(Calendar.MILLISECOND, 0); - propertyUnchanged = (beforeCal.compareTo(afterCal) == 0); - } - else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue.equals(Boolean.FALSE))) - { - propertyUnchanged = true; - } - else - { - // otherwise - propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue); - } - - if (!propertyUnchanged && - !(ContentModel.PROP_CONTENT.equals(property) && beforeValue == null) && - !isPropertyEditable(nodeRef, property)) - { - // the user can't edit the record property - throw new ModelAccessDeniedException( - "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + - " does not have the permission to edit the record property " + property.toString() + - " on the node " + nodeRef.toString()); - } - } - } - } - - /** - * Get map containing record metadata aspects. - * - * @return {@link Map}<{@link QName}, {@link Set}<{@link QName}>> map containing record metadata aspects - * - * @since 2.2 - */ - protected Map> getRecordMetadataAspectsMap() - { - if (recordMetaDataAspects == null) - { - // create map - recordMetaDataAspects = new HashMap>(); - - // init with legacy aspects - initRecordMetaDataMap(); - } - - return recordMetaDataAspects; - } - - /** - * Initialises the record meta-data map. - *

- * This is here to support backwards compatibility in case an existing - * customization (pre 2.2) is still using the record meta-data aspect. - * - * @since 2.2 - */ - private void initRecordMetaDataMap() - { - // populate the inital set of record meta-data aspects .. this is here for legacy reasons - Collection aspects = dictionaryService.getAllAspects(); - for (QName aspect : aspects) - { - AspectDefinition def = dictionaryService.getAspect(aspect); - if (def != null) - { - QName parent = def.getParentName(); - if (parent != null && ASPECT_RECORD_META_DATA.equals(parent)) - { - recordMetaDataAspects.put(aspect, Collections.singleton(TYPE_FILE_PLAN)); - } - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#registerRecordMetadataAspect(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName) - */ - @Override - public void registerRecordMetadataAspect(QName recordMetadataAspect, QName filePlanType) - { - ParameterCheck.mandatory("recordMetadataAspect", recordMetadataAspect); - ParameterCheck.mandatory("filePlanType", filePlanType); - - Set filePlanTypes = null; - - if (getRecordMetadataAspectsMap().containsKey(recordMetadataAspect)) - { - // get the current set of file plan types for this aspect - filePlanTypes = getRecordMetadataAspectsMap().get(recordMetadataAspect); - } - else - { - // create a new set for the file plan type - filePlanTypes = new HashSet(1); - getRecordMetadataAspectsMap().put(recordMetadataAspect, filePlanTypes); - } - - // add the file plan type - filePlanTypes.add(filePlanType); - } - - /** - * @deprecated since 2.2, file plan is required to provide context - */ - @Override - @Deprecated - public Set getRecordMetaDataAspects() - { - return getRecordMetadataAspects(TYPE_FILE_PLAN); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isRecordMetadataAspect(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isRecordMetadataAspect(QName aspect) - { - return getRecordMetadataAspectsMap().containsKey(aspect); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isRecordMetadataProperty(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isRecordMetadataProperty(QName property) - { - boolean result = false; - PropertyDefinition propertyDefinition = dictionaryService.getProperty(property); - if (propertyDefinition != null) - { - ClassDefinition classDefinition = propertyDefinition.getContainerClass(); - if (classDefinition != null && - getRecordMetadataAspectsMap().containsKey(classDefinition.getName())) - { - result = true; - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetaDataAspects(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Set getRecordMetadataAspects(NodeRef nodeRef) - { - QName filePlanType = TYPE_FILE_PLAN; - - if (nodeRef != null) - { - NodeRef filePlan = getFilePlan(nodeRef); - filePlanType = nodeService.getType(filePlan); - } - - return getRecordMetadataAspects(filePlanType); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetadataAspects(org.alfresco.service.namespace.QName) - */ - @Override - public Set getRecordMetadataAspects(QName filePlanType) - { - Set result = new HashSet(getRecordMetadataAspectsMap().size()); - - for (Entry> entry : getRecordMetadataAspectsMap().entrySet()) - { - if (entry.getValue().contains(filePlanType)) - { - result.add(entry.getKey()); - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void createRecord(NodeRef filePlan, NodeRef nodeRef) - { - createRecord(filePlan, nodeRef, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override - public void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final boolean isLinked) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("isLinked", isLinked); - - // first we do a sanity check to ensure that the user has at least write permissions on the document - if (extendedPermissionService.hasPermission(nodeRef, PermissionService.WRITE) != AccessStatus.ALLOWED) - { - throw new AccessDeniedException("Can not create record from document, because the user " + - AuthenticationUtil.getRunAsUser() + - " does not have Write permissions on the doucment " + - nodeRef.toString()); - } - - - // do the work of creating the record as the system user - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - if (!nodeService.hasAspect(nodeRef, ASPECT_RECORD)) - { - // disable delete rules - ruleService.disableRuleType("outbound"); - try - { - // get the new record container for the file plan - NodeRef newRecordContainer = filePlanService.getUnfiledContainer(filePlan); - if (newRecordContainer == null) - { - throw new AlfrescoRuntimeException("Unable to create record, because new record container could not be found."); - } - - // get the documents readers and writers - Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef); - - // get the current owner - String owner = ownableService.getOwner(nodeRef); - - // get the documents primary parent assoc - ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); - - // get the latest version record, if there is one - NodeRef latestVersionRecord = getLatestVersionRecord(nodeRef); - - behaviourFilter.disableBehaviour(); - try - { - // move the document into the file plan - nodeService.moveNode(nodeRef, newRecordContainer, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName()); - } - finally - { - behaviourFilter.enableBehaviour(); - } - - // save the information about the originating details - Map aspectProperties = new HashMap(3); - aspectProperties.put(PROP_RECORD_ORIGINATING_LOCATION, parentAssoc.getParentRef()); - aspectProperties.put(PROP_RECORD_ORIGINATING_USER_ID, owner); - aspectProperties.put(PROP_RECORD_ORIGINATING_CREATION_DATE, new Date()); - nodeService.addAspect(nodeRef, ASPECT_RECORD_ORIGINATING_DETAILS, aspectProperties); - - // make the document a record - makeRecord(nodeRef); - - if (latestVersionRecord != null) - { - // indicate that this is the 'final' record version - PropertyMap versionRecordProps = new PropertyMap(2); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, I18NUtil.getMessage(FINAL_VERSION)); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, I18NUtil.getMessage(FINAL_DESCRIPTION)); - nodeService.addAspect(nodeRef, RecordableVersionModel.ASPECT_VERSION_RECORD, versionRecordProps); - - // link to previous version - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), nodeRef, latestVersionRecord); - } - - if (isLinked) - { - // turn off rules - ruleService.disableRules(); - try - { - // maintain the original primary location - nodeService.addChild(parentAssoc.getParentRef(), nodeRef, parentAssoc.getTypeQName(), parentAssoc.getQName()); - - // set the extended security - extendedSecurityService.set(nodeRef, readersAndWriters); - } - finally - { - ruleService.enableRules(); - } - } - } - finally - { - ruleService.enableRuleType("outbound"); - } - } - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecordFromCopy(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef createRecordFromCopy(final NodeRef filePlan, final NodeRef nodeRef) - { - return authenticationUtil.runAsSystem(new RunAsWork() - { - public NodeRef doWork() throws Exception - { - // get the unfiled record folder - final NodeRef unfiledRecordFolder = filePlanService.getUnfiledContainer(filePlan); - - // get the documents readers and writers - Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef); - - // copy version state and create record - NodeRef record = null; - try - { - List originalAssocs = null; - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_COPIEDFROM)) - { - // take a note of any copyFrom information already on the node - originalAssocs = nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL); - } - - recordsManagementContainerType.disable(); - try - { - // create a copy of the original state and add it to the unfiled record container - FileInfo recordInfo = fileFolderService.copy(nodeRef, unfiledRecordFolder, null); - record = recordInfo.getNodeRef(); - } - finally - { - recordsManagementContainerType.enable(); - } - - // if versionable, then remove without destroying version history, - // because it is being shared with the originating document - behaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); - try - { - nodeService.removeAspect(record, ContentModel.ASPECT_VERSIONABLE); - } - finally - { - behaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); - } - - // make record - makeRecord(record); - - // remove added copy assocs - List recordAssocs = nodeService.getTargetAssocs(record, ContentModel.ASSOC_ORIGINAL); - for (AssociationRef recordAssoc : recordAssocs) - { - nodeService.removeAssociation( - recordAssoc.getSourceRef(), - recordAssoc.getTargetRef(), - ContentModel.ASSOC_ORIGINAL); - } - - // re-add origional assocs or remove aspect - if (originalAssocs == null) - { - nodeService.removeAspect(record, ContentModel.ASPECT_COPIEDFROM); - } - else - { - for (AssociationRef originalAssoc : originalAssocs) - { - nodeService.createAssociation(record, originalAssoc.getTargetRef(), ContentModel.ASSOC_ORIGINAL); - } - } - } - catch (FileNotFoundException e) - { - throw new AlfrescoRuntimeException("Can't create recorded version, because copy fails.", e); - } - - // set extended security on record - extendedSecurityService.set(record, readersAndWriters); - - return record; - } - }); - } - - /** - * Helper to get the latest version record for a given document (ie non-record) - * - * @param nodeRef node reference - * @return NodeRef latest version record, null otherwise - */ - private NodeRef getLatestVersionRecord(NodeRef nodeRef) - { - NodeRef versionRecord = null; - - // wire record up to previous record - VersionHistory versionHistory = versionService.getVersionHistory(nodeRef); - if (versionHistory != null) - { - Collection previousVersions = versionHistory.getAllVersions(); - for (Version previousVersion : previousVersions) - { - // look for the associated record - final NodeRef previousRecord = recordableVersionService.getVersionRecord(previousVersion); - if (previousRecord != null) - { - versionRecord = previousRecord; - break; - } - } - } - - return versionRecord; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createNewRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map, org.alfresco.service.cmr.repository.ContentReader) - */ - @Override - public NodeRef createRecordFromContent(NodeRef parent, String name, QName type, Map properties, ContentReader reader) - { - ParameterCheck.mandatory("nodeRef", parent); - ParameterCheck.mandatory("name", name); - - NodeRef result = null; - NodeRef destination = parent; - - if (isFilePlan(parent)) - { - // get the unfiled record container for the file plan - destination = filePlanService.getUnfiledContainer(parent); - if (destination == null) - { - throw new AlfrescoRuntimeException("Unable to create record, because unfiled container could not be found."); - } - } - - // if none set the default record type is cm:content - if (type == null) - { - type = ContentModel.TYPE_CONTENT; - } - else if (!dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) - { - throw new AlfrescoRuntimeException("Record can only be created from a sub-type of cm:content."); - } - - disablePropertyEditableCheck(); - try - { - // create the new record - final NodeRef record = fileFolderService.create(destination, name, type).getNodeRef(); - - // set the properties - if (properties != null) - { - nodeService.addProperties(record, properties); - } - - // set the content - if (reader != null) - { - ContentWriter writer = fileFolderService.getWriter(record); - writer.setEncoding(reader.getEncoding()); - writer.setMimetype(reader.getMimetype()); - writer.putContent(reader); - } - - result = authenticationUtil.runAsSystem(new RunAsWork() - { - public NodeRef doWork() throws Exception - { - // Check if the "record" aspect has been applied already. - // In case of filing a report the created node will be made - // a record within the "onCreateChildAssociation" method if - // a destination for the report has been selected. - if (!nodeService.hasAspect(record, ASPECT_RECORD)) - { - // make record - makeRecord(record); - } - - return record; - } - - }); - } - finally - { - enablePropertyEditableCheck(); - } - - return result; - } - - /** - * Creates a record from the given document - * - * @param document the document from which a record will be created - */ - @Override - public void makeRecord(NodeRef document) - { - ParameterCheck.mandatory("document", document); - - ruleService.disableRules(); - disablePropertyEditableCheck(); - try - { - // get the record id - String recordId = identifierService.generateIdentifier(ASPECT_RECORD, - nodeService.getPrimaryParent(document).getParentRef()); - - // get the record name - String name = (String)nodeService.getProperty(document, ContentModel.PROP_NAME); - - // rename the record - int dotIndex = name.lastIndexOf('.'); - String prefix = name; - String postfix = ""; - if (dotIndex != -1) - { - prefix = name.substring(0, dotIndex); - postfix = name.substring(dotIndex); - } - String recordName = prefix + " (" + recordId + ")" + postfix; - behaviourFilter.disableBehaviour(); - try - { - fileFolderService.rename(document, recordName); - } - finally - { - behaviourFilter.enableBehaviour(); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Rename " + name + " to " + recordName); - } - - // add the record aspect - Map props = new HashMap(2); - props.put(PROP_IDENTIFIER, recordId); - props.put(PROP_ORIGIONAL_NAME, name); - nodeService.addAspect(document, RecordsManagementModel.ASPECT_RECORD, props); - - // remove versionable aspect(s) - nodeService.removeAspect(document, RecordableVersionModel.ASPECT_VERSIONABLE); - - // remove the owner - ownableService.setOwner(document, OwnableService.NO_OWNER); - } - catch (FileNotFoundException e) - { - throw new AlfrescoRuntimeException("Unable to make record, because rename failed.", e); - } - finally - { - ruleService.enableRules(); - enablePropertyEditableCheck(); - } - - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.disposableitem.RecordService#isFiled(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isFiled(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - boolean result = false; - - if (isRecord(nodeRef)) - { - result = AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Boolean doWork() throws Exception - { - return (null != nodeService.getProperty(nodeRef, PROP_DATE_FILED)); - } - }); - } - - return result; - } - - /** - * Helper method to 'file' a new document that arrived in the file plan structure. - * - * TODO atm we only 'file' content as a record .. may need to consider other types if we - * are to support the notion of composite records. - * - * @param record node reference to record (or soon to be record!) - */ - @Override - public void file(NodeRef record) - { - ParameterCheck.mandatory("item", record); - - // we only support filling of content items - // TODO composite record support needs to file containers too - QName type = nodeService.getType(record); - if (ContentModel.TYPE_CONTENT.equals(type) || - dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) - { - // fire before file record policy - beforeFileRecord.get(getTypeAndApsects(record)).beforeFileRecord(record); - - // check whether this item is already an item or not - if (!isRecord(record)) - { - // make the item a record - makeRecord(record); - } - - // set filed date - if (nodeService.getProperty(record, PROP_DATE_FILED) == null) - { - Calendar fileCalendar = Calendar.getInstance(); - nodeService.setProperty(record, PROP_DATE_FILED, fileCalendar.getTime()); - } - - // file on file record policy - onFileRecord.get(getTypeAndApsects(record)).onFileRecord(record); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#rejectRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void rejectRecord(final NodeRef nodeRef, final String reason) - { - ParameterCheck.mandatory("NodeRef", nodeRef); - ParameterCheck.mandatoryString("Reason", reason); - - // Save the id of the currently logged in user - final String userId = AuthenticationUtil.getFullyAuthenticatedUser(); - - // do the work of rejecting the record as the system user - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - ruleService.disableRules(); - try - { - // get the latest version record, if there is one - NodeRef latestVersionRecord = getLatestVersionRecord(nodeRef); - - if (latestVersionRecord != null) - { - relationshipService.removeRelationship(CUSTOM_REF_VERSIONS.getLocalName(), nodeRef, latestVersionRecord); - } - - // get record property values - final Map properties = nodeService.getProperties(nodeRef); - final String recordId = (String)properties.get(PROP_IDENTIFIER); - final String documentOwner = (String)properties.get(PROP_RECORD_ORIGINATING_USER_ID); - final String originalName = (String)properties.get(PROP_ORIGIONAL_NAME); - final NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION); - - // we can only reject if the originating location is present - if (originatingLocation != null) - { - // first remove the secondary link association - final List parentAssocs = nodeService.getParentAssocs(nodeRef); - for (ChildAssociationRef childAssociationRef : parentAssocs) - { - if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation)) - { - nodeService.removeChildAssociation(childAssociationRef); - break; - } - } - - removeRmAspectsFrom(nodeRef); - - // get the records primary parent association - final ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); - - // move the record into the collaboration site - nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName()); - - // rename to the original name - if (originalName != null) - { - fileFolderService.rename(nodeRef, originalName); - - if (logger.isDebugEnabled()) - { - String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - logger.debug("Rename " + name + " to " + originalName); - } - } - - // save the information about the rejection details - final Map aspectProperties = new HashMap<>(3); - aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId); - aspectProperties.put(PROP_RECORD_REJECTION_DATE, new Date()); - aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason); - nodeService.addAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS, aspectProperties); - - // Restore the owner of the document - if (StringUtils.isBlank(documentOwner)) - { - throw new AlfrescoRuntimeException("Unable to find the creator of document."); - } - ownableService.setOwner(nodeRef, documentOwner); - - // clear the existing permissions - permissionService.clearPermission(nodeRef, null); - - // restore permission inheritance - permissionService.setInheritParentPermissions(nodeRef, true); - - // send an email to the record creator - notificationHelper.recordRejectedEmailNotification(nodeRef, recordId, documentOwner); - } - } - finally - { - ruleService.enableRules(); - } - - return null; - } - - /** Removes all RM related aspects from the specified node and any rendition children. */ - private void removeRmAspectsFrom(NodeRef nodeRef) - { - // Note that when folder records are supported, we will need to recursively - // remove aspects from their descendants. - final Set aspects = nodeService.getAspects(nodeRef); - for (QName aspect : aspects) - { - if (RM_URI.equals(aspect.getNamespaceURI()) || - RecordableVersionModel.RMV_URI.equals(aspect.getNamespaceURI())) - { - nodeService.removeAspect(nodeRef, aspect); - } - } - for (ChildAssociationRef renditionAssoc : renditionService.getRenditions(nodeRef)) - { - final NodeRef renditionNode = renditionAssoc.getChildRef(); - - // Do not attempt to clean up rendition nodes which are not children of their source node. - final boolean renditionRequiresCleaning = nodeService.exists(renditionNode) && - renditionAssoc.isPrimary(); - - if (renditionRequiresCleaning) - { - removeRmAspectsFrom(renditionNode); - } - } - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isPropertyEditable(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - @Override - public boolean isPropertyEditable(NodeRef record, QName property) - { - ParameterCheck.mandatory("record", record); - ParameterCheck.mandatory("property", property); - - if (!isRecord(record)) - { - throw new AlfrescoRuntimeException("Can not check if the property " + property.toString() + " is editable, because node reference is not a record."); - } - - NodeRef filePlan = getFilePlan(record); - - // DEBUG ... - boolean debugEnabled = logger.isDebugEnabled(); - if (debugEnabled) - { - logger.debug("Checking whether property " + property.toString() + " is editable for user " + AuthenticationUtil.getRunAsUser()); - - Set roles = filePlanRoleService.getRolesByUser(filePlan, AuthenticationUtil.getRunAsUser()); - - logger.debug(" ... users roles"); - - for (Role role : roles) - { - logger.debug(" ... user has role " + role.getName() + " with capabilities "); - - for (Capability cap : role.getCapabilities()) - { - logger.debug(" ... " + cap.getName()); - } - } - - logger.debug(" ... user has the following set permissions on the file plan"); - - Set perms = permissionService.getAllSetPermissions(filePlan); - for (AccessPermission perm : perms) - { - if ((perm.getPermission().contains(RMPermissionModel.EDIT_NON_RECORD_METADATA) || - perm.getPermission().contains(RMPermissionModel.EDIT_RECORD_METADATA))) - { - logger.debug(" ... " + perm.getAuthority() + " - " + perm.getPermission() + " - " + perm.getAccessStatus().toString()); - } - } - - if (permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA).equals(AccessStatus.ALLOWED)) - { - logger.debug(" ... user has the edit non record metadata permission on the file plan"); - } - } - // END DEBUG ... - - boolean result = alwaysEditProperty(property); - if (result) - { - if (debugEnabled) - { - logger.debug(" ... property marked as always editable."); - } - } - else - { - boolean allowRecordEdit = false; - boolean allowNonRecordEdit = false; - - AccessStatus accessNonRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_NON_RECORD_METADATA); - AccessStatus accessDeclaredRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); - AccessStatus accessRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_RECORD_METADATA); - - if (AccessStatus.ALLOWED.equals(accessNonRecord)) - { - if (debugEnabled) - { - logger.debug(" ... user has edit nonrecord metadata capability"); - } - - allowNonRecordEdit = true; - } - - if (AccessStatus.ALLOWED.equals(accessRecord) || - AccessStatus.ALLOWED.equals(accessDeclaredRecord)) - { - if (debugEnabled) - { - logger.debug(" ... user has edit record or declared metadata capability"); - } - - allowRecordEdit = true; - } - - if (allowNonRecordEdit && allowRecordEdit) - { - if (debugEnabled) - { - logger.debug(" ... so all properties can be edited."); - } - - result = true; - } - else if (allowNonRecordEdit && !allowRecordEdit) - { - // can only edit non record properties - if (!isRecordMetadata(filePlan, property)) - { - if (debugEnabled) - { - logger.debug(" ... property is not considered record metadata so editable."); - } - - result = true; - } - else - { - if (debugEnabled) - { - logger.debug(" ... property is considered record metadata so not editable."); - } - } - } - else if (!allowNonRecordEdit && allowRecordEdit) - { - // can only edit record properties - if (isRecordMetadata(filePlan, property)) - { - if (debugEnabled) - { - logger.debug(" ... property is considered record metadata so editable."); - } - - result = true; - } - else - { - if (debugEnabled) - { - logger.debug(" ... property is not considered record metadata so not editable."); - } - } - } - // otherwise we can't edit any properties so just return the empty set - } - return result; - } - - /** - * Helper method that indicates whether a property is considered record metadata or not. - * - * @param property property - * @return boolea true if record metadata, false otherwise - */ - private boolean isRecordMetadata(NodeRef filePlan, QName property) - { - boolean result = false; - - // grab the information about the properties parent type - ClassDefinition parent = null; - PropertyDefinition def = dictionaryService.getProperty(property); - if (def != null) - { - parent = def.getContainerClass(); - } - - // non-electronic record is considered a special case - // TODO move non-electronic record support to a separate model namespace - if (parent != null && TYPE_NON_ELECTRONIC_DOCUMENT.equals(parent.getName())) - { - result = false; - } - else - { - // check the URI's - result = RECORD_MODEL_URIS.contains(property.getNamespaceURI()); - - // check the custom model - if (!result && !ArrayUtils.contains(NON_RECORD_MODEL_URIS, property.getNamespaceURI())) - { - if (parent != null && parent.isAspect()) - { - result = getRecordMetadataAspects(filePlan).contains(parent.getName()); - } - } - } - - return result; - } - - /** - * Determines whether the property should always be allowed to be edited or not. - * - * @param property - * @return - */ - private boolean alwaysEditProperty(QName property) - { - return (getAlwaysEditURIs().contains(property.getNamespaceURI()) || - ArrayUtils.contains(ALWAYS_EDIT_PROPERTIES, property) || - isProtectedProperty(property)); - } - - /** - * Helper method to determine whether a property is protected at a dictionary definition - * level. - * - * @param property property qualified name - * @return booelan true if protected, false otherwise - */ - private boolean isProtectedProperty(QName property) - { - boolean result = false; - PropertyDefinition def = dictionaryService.getProperty(property); - if (def != null) - { - result = def.isProtected(); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isMetadataStub(NodeRef) - */ - @Override - public boolean isMetadataStub(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - return nodeService.hasAspect(nodeRef, ASPECT_GHOSTED); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecords(NodeRef) - */ - @Override - public List getRecords(NodeRef recordFolder) - { - ParameterCheck.mandatory("recordFolder", recordFolder); - - List result = new ArrayList(1); - if (recordFolderService.isRecordFolder(recordFolder)) - { - List assocs = nodeService.getChildAssocs(recordFolder, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef child = assoc.getChildRef(); - if (isRecord(child)) - { - result.add(child); - } - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#addRecordType(NodeRef, QName) - */ - @Override - public void addRecordType(NodeRef nodeRef, QName typeQName) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("typeQName", typeQName); - - if (!nodeService.hasAspect(nodeRef, typeQName)) - { - nodeService.addAspect(nodeRef, typeQName, null); - } - else - { - logger.info(I18NUtil.getMessage(MSG_NODE_HAS_ASPECT, nodeRef.toString(), typeQName.toString())); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#link(NodeRef, NodeRef) - */ - @Override - public void link(NodeRef record, NodeRef recordFolder) - { - ParameterCheck.mandatory("record", record); - ParameterCheck.mandatory("recordFolder", recordFolder); - - // ensure we are linking a record to a record folder - if(isRecord(record) && isRecordFolder(recordFolder)) - { - // ensure that we are not linking a record to an exisiting location - List parents = nodeService.getParentAssocs(record); - for (ChildAssociationRef parent : parents) - { - if (parent.getParentRef().equals(recordFolder)) - { - // we can not link a record to the same location more than once - throw new RecordLinkRuntimeException("Can not link a record to the same record folder more than once"); - } - } - - // validate link conditions - validateLinkConditions(record, recordFolder); - - // get the current name of the record - String name = nodeService.getProperty(record, ContentModel.PROP_NAME).toString(); - - // create a secondary link to the record folder - nodeService.addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - else - { - // can only link a record to a record folder - throw new RecordLinkRuntimeException("Can only link a record to a record folder."); - } - } - - /** - * - * @param record - * @param recordFolder - */ - private void validateLinkConditions(NodeRef record, NodeRef recordFolder) - { - // ensure that the linking record folders have compatible disposition schedules - DispositionSchedule recordDispositionSchedule = dispositionService.getDispositionSchedule(record); - if (recordDispositionSchedule != null) - { - DispositionSchedule recordFolderDispositionSchedule = dispositionService.getDispositionSchedule(recordFolder); - if (recordFolderDispositionSchedule != null) - { - if (recordDispositionSchedule.isRecordLevelDisposition() != recordFolderDispositionSchedule.isRecordLevelDisposition()) - { - // we can't link a record to an incompatible disposition schedule - throw new RecordLinkRuntimeException("Can not link a record to a record folder with an incompatible retention schedule. " - + "They must either both be record level or record folder level retentions."); - } - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#unlink(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void unlink(NodeRef record, NodeRef recordFolder) - { - ParameterCheck.mandatory("record", record); - ParameterCheck.mandatory("recordFolder", recordFolder); - - // ensure we are unlinking a record from a record folder - if(isRecord(record) && isRecordFolder(recordFolder)) - { - // check that we are not trying to unlink the primary parent - NodeRef primaryParent = nodeService.getPrimaryParent(record).getParentRef(); - if (primaryParent.equals(recordFolder)) - { - throw new RecordLinkRuntimeException("Can't unlink a record from it's owning record folder."); - } - - // remove the link - nodeService.removeChild(recordFolder, record); - } - else - { - // can only unlink a record from a record folder - throw new RecordLinkRuntimeException("Can only unlink a record from a record folder."); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.record; + +import static com.google.common.collect.Lists.newArrayList; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeFileRecord; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RecordsManagementContainerType; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelAccessDeniedException; +import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; +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.security.ExtendedSecurityService; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.ClassPolicyDelegate; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.ClassDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.model.FileExistsException; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.model.FileNotFoundException; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.rule.RuleService; +import org.alfresco.service.cmr.security.AccessPermission; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionHistory; +import org.alfresco.service.cmr.version.VersionService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.EqualsHelper; +import org.alfresco.util.Pair; +import org.alfresco.util.ParameterCheck; +import org.alfresco.util.PropertyMap; +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Record service implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class RecordServiceImpl extends BaseBehaviourBean + implements RecordService, + RecordsManagementModel, + RecordsManagementCustomModel, + NodeServicePolicies.OnCreateChildAssociationPolicy, + NodeServicePolicies.OnAddAspectPolicy, + NodeServicePolicies.OnRemoveAspectPolicy, + NodeServicePolicies.OnUpdatePropertiesPolicy +{ + /** Logger */ + private static Log logger = LogFactory.getLog(RecordServiceImpl.class); + + /** transation data key */ + private static final String KEY_IGNORE_ON_UPDATE = "ignoreOnUpdate"; + private static final String KEY_PENDING_FILLING = "pendingFilling"; + public static final String KEY_NEW_RECORDS = "newRecords"; + + /** I18N */ + private static final String MSG_NODE_HAS_ASPECT = "rm.service.node-has-aspect"; + private static final String FINAL_VERSION = "rm.service.final-version"; + private static final String FINAL_DESCRIPTION = "rm.service.final-version-description"; + + /** Always edit property array */ + private static final QName[] ALWAYS_EDIT_PROPERTIES = new QName[] + { + ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA + }; + + /** always edit model URI's */ + protected List getAlwaysEditURIs() + { + return newArrayList( + NamespaceService.SECURITY_MODEL_1_0_URI, + NamespaceService.SYSTEM_MODEL_1_0_URI, + NamespaceService.WORKFLOW_MODEL_1_0_URI, + NamespaceService.APP_MODEL_1_0_URI, + NamespaceService.DATALIST_MODEL_1_0_URI, + NamespaceService.DICTIONARY_MODEL_1_0_URI, + NamespaceService.BPM_MODEL_1_0_URI, + NamespaceService.RENDITION_MODEL_1_0_URI + ); + } + + /** record model URI's */ + public static final List RECORD_MODEL_URIS = Collections.unmodifiableList( + Arrays.asList( + RM_URI, + RM_CUSTOM_URI, + ReportModel.RMR_URI, + RecordableVersionModel.RMV_URI, + DOD5015Model.DOD_URI + )); + + /** non-record model URI's */ + private static final String[] NON_RECORD_MODEL_URIS = new String[] + { + NamespaceService.AUDIO_MODEL_1_0_URI, + NamespaceService.CONTENT_MODEL_1_0_URI, + NamespaceService.EMAILSERVER_MODEL_URI, + NamespaceService.EXIF_MODEL_1_0_URI, + NamespaceService.FORUMS_MODEL_1_0_URI, + NamespaceService.LINKS_MODEL_1_0_URI, + NamespaceService.REPOSITORY_VIEW_1_0_URI + }; + + /** Indentity service */ + private IdentifierService identifierService; + + /** Extended permission service */ + private ExtendedPermissionService extendedPermissionService; + + /** Extended security service */ + private ExtendedSecurityService extendedSecurityService; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Records management notification helper */ + private RecordsManagementNotificationHelper notificationHelper; + + /** Policy component */ + private PolicyComponent policyComponent; + + /** Ownable service */ + private OwnableService ownableService; + + /** Capability service */ + private CapabilityService capabilityService; + + /** Rule service */ + private RuleService ruleService; + + /** File folder service */ + private FileFolderService fileFolderService; + + /** Record folder service */ + private RecordFolderService recordFolderService; + + /** File plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** Permission service */ + private PermissionService permissionService; + + /** Version service */ + private VersionService versionService; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** Disposition service */ + private DispositionService dispositionService; + + /** records management container type */ + private RecordsManagementContainerType recordsManagementContainerType; + + /** recordable version service */ + private RecordableVersionService recordableVersionService; + + /** list of available record meta-data aspects and the file plan types the are applicable to */ + private Map> recordMetaDataAspects; + + /** policies */ + private ClassPolicyDelegate beforeFileRecord; + private ClassPolicyDelegate onFileRecord; + + /** Behaviours */ + private JavaBehaviour onCreateChildAssociation = new JavaBehaviour( + this, + "onCreateChildAssociation", + NotificationFrequency.FIRST_EVENT); + + /** + * @param identifierService identifier service + */ + public void setIdentifierService(IdentifierService identifierService) + { + this.identifierService = identifierService; + } + + /** + * @param extendedPermissionService extended permission service + */ + public void setExtendedPermissionService(ExtendedPermissionService extendedPermissionService) + { + this.extendedPermissionService = extendedPermissionService; + } + + /** + * @param extendedSecurityService extended security service + */ + public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) + { + this.extendedSecurityService = extendedSecurityService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param notificationHelper notification helper + */ + public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper) + { + this.notificationHelper = notificationHelper; + } + + /** + * @param policyComponent policy component + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + /** + * @param ownableService ownable service + */ + public void setOwnableService(OwnableService ownableService) + { + this.ownableService = ownableService; + } + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param ruleService rule service + */ + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + + /** + * @param fileFolderService file folder service + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param versionService version service + */ + public void setVersionService(VersionService versionService) + { + this.versionService = versionService; + } + + /** + * @param relationshipService relationship service + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param recordsManagementContainerType records management container type + */ + public void setRecordsManagementContainerType(RecordsManagementContainerType recordsManagementContainerType) + { + this.recordsManagementContainerType = recordsManagementContainerType; + } + + /** + * @param recordableVersionService recordable version service + */ + public void setRecordableVersionService(RecordableVersionService recordableVersionService) + { + this.recordableVersionService = recordableVersionService; + } + + /** + * Init method + */ + public void init() + { + // bind policies + beforeFileRecord = policyComponent.registerClassPolicy(BeforeFileRecord.class); + onFileRecord = policyComponent.registerClassPolicy(OnFileRecord.class); + + // bind behaviours + policyComponent.bindAssociationBehaviour( + NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME, + TYPE_RECORD_FOLDER, + ContentModel.ASSOC_CONTAINS, + onCreateChildAssociation); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "sys:noContent" + ) + public void onRemoveAspect(NodeRef nodeRef, QName aspect) + { + + if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) + { + ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); + + // Only switch name back to the format of "name (identifierId)" if content size is non-zero, else leave it as the original name to avoid CIFS shuffling issues. + if (contentData != null && contentData.getSize() > 0) + { + switchNames(nodeRef); + } + } + else + { + // check whether filling is pending aspect removal + Set pendingFilling = transactionalResourceHelper.getSet(KEY_PENDING_FILLING); + if (pendingFilling.contains(nodeRef)) + { + file(nodeRef); + } + } + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + @Behaviour + ( + kind = BehaviourKind.CLASS, + type = "sys:noContent" + ) + public void onAddAspect(NodeRef nodeRef, QName aspect) + { + switchNames(nodeRef); + } + + /** + * Helper method to switch the name of the record around. Used to support record creation via + * file protocols. + * + * @param nodeRef node reference (record) + */ + private void switchNames(NodeRef nodeRef) + { + try + { + if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) + { + String origionalName = (String)nodeService.getProperty(nodeRef, PROP_ORIGIONAL_NAME); + if (origionalName != null) + { + String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); + fileFolderService.rename(nodeRef, origionalName); + nodeService.setProperty(nodeRef, PROP_ORIGIONAL_NAME, name); + } + } + } + catch (FileExistsException e) + { + if (logger.isDebugEnabled()) + { + logger.debug(e.getMessage()); + } + } + catch (InvalidNodeRefException e) + { + if (logger.isDebugEnabled()) + { + logger.debug(e.getMessage()); + } + } + catch (FileNotFoundException e) + { + if (logger.isDebugEnabled()) + { + logger.debug(e.getMessage()); + } + } + } + + /** + * Behaviour executed when a new item is added to a record folder. + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) + */ + @Override + public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, final boolean bNew) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + onCreateChildAssociation.disable(); + try + { + NodeRef nodeRef = childAssocRef.getChildRef(); + if (nodeService.exists(nodeRef) && + !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY) && + !nodeService.getType(nodeRef).equals(TYPE_RECORD_FOLDER) && + !nodeService.getType(nodeRef).equals(TYPE_RECORD_CATEGORY)) + { + if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) + { + // we need to postpone filling until the NO_CONTENT aspect is removed + Set pendingFilling = transactionalResourceHelper.getSet(KEY_PENDING_FILLING); + pendingFilling.add(nodeRef); + } + else + { + // store information about the 'new' record in the transaction + // @since 2.3 + // @see https://issues.alfresco.com/jira/browse/RM-1956 + if (bNew) + { + Set newRecords = transactionalResourceHelper.getSet(KEY_NEW_RECORDS); + newRecords.add(nodeRef); + } + else + { + // if we are linking a record + NodeRef parentNodeRef = childAssocRef.getParentRef(); + if (isRecord(nodeRef) && isRecordFolder(parentNodeRef)) + { + // validate the link conditions + validateLinkConditions(nodeRef, parentNodeRef); + } + } + + // create and file the content as a record + file(nodeRef); + } + } + } + catch (RecordLinkRuntimeException e) + { + // rethrow exception + throw e; + } + catch (AlfrescoRuntimeException e) + { + // do nothing but log error + if (logger.isWarnEnabled()) + { + logger.warn("Unable to file pending record.", e); + } + } + finally + { + onCreateChildAssociation.enable(); + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck() + */ + @Override + public void disablePropertyEditableCheck() + { + org.alfresco.repo.policy.Behaviour behaviour = getBehaviour("onUpdateProperties"); + if (behaviour != null) + { + getBehaviour("onUpdateProperties").disable(); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck(org.alfresco.service.cmr.repository.NodeRef) + */ + public void disablePropertyEditableCheck(NodeRef nodeRef) + { + Set ignoreOnUpdate = transactionalResourceHelper.getSet(KEY_IGNORE_ON_UPDATE); + ignoreOnUpdate.add(nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#enablePropertyEditableCheck() + */ + @Override + public void enablePropertyEditableCheck() + { + org.alfresco.repo.policy.Behaviour behaviour = getBehaviour("onUpdateProperties"); + if (behaviour != null) + { + behaviour.enable(); + } + } + + /** + * Ensure that the user only updates record properties that they have permission to. + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) + */ + @Override + @Behaviour + ( + name = "onUpdateProperties", + kind = BehaviourKind.CLASS, + type= "rma:record" + ) + public void onUpdateProperties(final NodeRef nodeRef, final Map before, final Map after) + { + if (AuthenticationUtil.getFullyAuthenticatedUser() != null && + !AuthenticationUtil.isRunAsUserTheSystemUser() && + nodeService.exists(nodeRef) && + isRecord(nodeRef) && + !transactionalResourceHelper.getSet(KEY_IGNORE_ON_UPDATE).contains(nodeRef)) + { + for (Map.Entry entry : after.entrySet()) + { + Serializable beforeValue = null; + QName property = entry.getKey(); + if (before != null) + { + beforeValue = before.get(property); + } + + Serializable afterValue = entry.getValue(); + boolean propertyUnchanged = false; + if (beforeValue instanceof Date && afterValue instanceof Date) + { + // deal with date values, remove the seconds and milliseconds for the + // comparison as they are removed from the submitted for data + Calendar beforeCal = Calendar.getInstance(); + beforeCal.setTime((Date)beforeValue); + Calendar afterCal = Calendar.getInstance(); + afterCal.setTime((Date)afterValue); + beforeCal.set(Calendar.SECOND, 0); + beforeCal.set(Calendar.MILLISECOND, 0); + afterCal.set(Calendar.SECOND, 0); + afterCal.set(Calendar.MILLISECOND, 0); + propertyUnchanged = (beforeCal.compareTo(afterCal) == 0); + } + else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue.equals(Boolean.FALSE))) + { + propertyUnchanged = true; + } + else + { + // otherwise + propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue); + } + + if (!propertyUnchanged && + !(ContentModel.PROP_CONTENT.equals(property) && beforeValue == null) && + !isPropertyEditable(nodeRef, property)) + { + // the user can't edit the record property + throw new ModelAccessDeniedException( + "The user " + AuthenticationUtil.getFullyAuthenticatedUser() + + " does not have the permission to edit the record property " + property.toString() + + " on the node " + nodeRef.toString()); + } + } + } + } + + /** + * Get map containing record metadata aspects. + * + * @return {@link Map}<{@link QName}, {@link Set}<{@link QName}>> map containing record metadata aspects + * + * @since 2.2 + */ + protected Map> getRecordMetadataAspectsMap() + { + if (recordMetaDataAspects == null) + { + // create map + recordMetaDataAspects = new HashMap>(); + + // init with legacy aspects + initRecordMetaDataMap(); + } + + return recordMetaDataAspects; + } + + /** + * Initialises the record meta-data map. + *

+ * This is here to support backwards compatibility in case an existing + * customization (pre 2.2) is still using the record meta-data aspect. + * + * @since 2.2 + */ + private void initRecordMetaDataMap() + { + // populate the inital set of record meta-data aspects .. this is here for legacy reasons + Collection aspects = dictionaryService.getAllAspects(); + for (QName aspect : aspects) + { + AspectDefinition def = dictionaryService.getAspect(aspect); + if (def != null) + { + QName parent = def.getParentName(); + if (parent != null && ASPECT_RECORD_META_DATA.equals(parent)) + { + recordMetaDataAspects.put(aspect, Collections.singleton(TYPE_FILE_PLAN)); + } + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#registerRecordMetadataAspect(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName) + */ + @Override + public void registerRecordMetadataAspect(QName recordMetadataAspect, QName filePlanType) + { + ParameterCheck.mandatory("recordMetadataAspect", recordMetadataAspect); + ParameterCheck.mandatory("filePlanType", filePlanType); + + Set filePlanTypes = null; + + if (getRecordMetadataAspectsMap().containsKey(recordMetadataAspect)) + { + // get the current set of file plan types for this aspect + filePlanTypes = getRecordMetadataAspectsMap().get(recordMetadataAspect); + } + else + { + // create a new set for the file plan type + filePlanTypes = new HashSet(1); + getRecordMetadataAspectsMap().put(recordMetadataAspect, filePlanTypes); + } + + // add the file plan type + filePlanTypes.add(filePlanType); + } + + /** + * @deprecated since 2.2, file plan is required to provide context + */ + @Override + @Deprecated + public Set getRecordMetaDataAspects() + { + return getRecordMetadataAspects(TYPE_FILE_PLAN); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isRecordMetadataAspect(org.alfresco.service.namespace.QName) + */ + @Override + public boolean isRecordMetadataAspect(QName aspect) + { + return getRecordMetadataAspectsMap().containsKey(aspect); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isRecordMetadataProperty(org.alfresco.service.namespace.QName) + */ + @Override + public boolean isRecordMetadataProperty(QName property) + { + boolean result = false; + PropertyDefinition propertyDefinition = dictionaryService.getProperty(property); + if (propertyDefinition != null) + { + ClassDefinition classDefinition = propertyDefinition.getContainerClass(); + if (classDefinition != null && + getRecordMetadataAspectsMap().containsKey(classDefinition.getName())) + { + result = true; + } + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetaDataAspects(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Set getRecordMetadataAspects(NodeRef nodeRef) + { + QName filePlanType = TYPE_FILE_PLAN; + + if (nodeRef != null) + { + NodeRef filePlan = getFilePlan(nodeRef); + filePlanType = nodeService.getType(filePlan); + } + + return getRecordMetadataAspects(filePlanType); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetadataAspects(org.alfresco.service.namespace.QName) + */ + @Override + public Set getRecordMetadataAspects(QName filePlanType) + { + Set result = new HashSet(getRecordMetadataAspectsMap().size()); + + for (Entry> entry : getRecordMetadataAspectsMap().entrySet()) + { + if (entry.getValue().contains(filePlanType)) + { + result.add(entry.getKey()); + } + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void createRecord(NodeRef filePlan, NodeRef nodeRef) + { + createRecord(filePlan, nodeRef, true); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + @Override + public void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final boolean isLinked) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("isLinked", isLinked); + + // first we do a sanity check to ensure that the user has at least write permissions on the document + if (extendedPermissionService.hasPermission(nodeRef, PermissionService.WRITE) != AccessStatus.ALLOWED) + { + throw new AccessDeniedException("Can not create record from document, because the user " + + AuthenticationUtil.getRunAsUser() + + " does not have Write permissions on the doucment " + + nodeRef.toString()); + } + + + // do the work of creating the record as the system user + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + if (!nodeService.hasAspect(nodeRef, ASPECT_RECORD)) + { + // disable delete rules + ruleService.disableRuleType("outbound"); + try + { + // get the new record container for the file plan + NodeRef newRecordContainer = filePlanService.getUnfiledContainer(filePlan); + if (newRecordContainer == null) + { + throw new AlfrescoRuntimeException("Unable to create record, because new record container could not be found."); + } + + // get the documents readers and writers + Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef); + + // get the current owner + String owner = ownableService.getOwner(nodeRef); + + // get the documents primary parent assoc + ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); + + // get the latest version record, if there is one + NodeRef latestVersionRecord = getLatestVersionRecord(nodeRef); + + behaviourFilter.disableBehaviour(); + try + { + // move the document into the file plan + nodeService.moveNode(nodeRef, newRecordContainer, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName()); + } + finally + { + behaviourFilter.enableBehaviour(); + } + + // save the information about the originating details + Map aspectProperties = new HashMap(3); + aspectProperties.put(PROP_RECORD_ORIGINATING_LOCATION, parentAssoc.getParentRef()); + aspectProperties.put(PROP_RECORD_ORIGINATING_USER_ID, owner); + aspectProperties.put(PROP_RECORD_ORIGINATING_CREATION_DATE, new Date()); + nodeService.addAspect(nodeRef, ASPECT_RECORD_ORIGINATING_DETAILS, aspectProperties); + + // make the document a record + makeRecord(nodeRef); + + if (latestVersionRecord != null) + { + // indicate that this is the 'final' record version + PropertyMap versionRecordProps = new PropertyMap(2); + versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, I18NUtil.getMessage(FINAL_VERSION)); + versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, I18NUtil.getMessage(FINAL_DESCRIPTION)); + nodeService.addAspect(nodeRef, RecordableVersionModel.ASPECT_VERSION_RECORD, versionRecordProps); + + // link to previous version + relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), nodeRef, latestVersionRecord); + } + + if (isLinked) + { + // turn off rules + ruleService.disableRules(); + try + { + // maintain the original primary location + nodeService.addChild(parentAssoc.getParentRef(), nodeRef, parentAssoc.getTypeQName(), parentAssoc.getQName()); + + // set the extended security + extendedSecurityService.set(nodeRef, readersAndWriters); + } + finally + { + ruleService.enableRules(); + } + } + } + finally + { + ruleService.enableRuleType("outbound"); + } + } + + return null; + } + }); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecordFromCopy(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public NodeRef createRecordFromCopy(final NodeRef filePlan, final NodeRef nodeRef) + { + return authenticationUtil.runAsSystem(new RunAsWork() + { + public NodeRef doWork() throws Exception + { + // get the unfiled record folder + final NodeRef unfiledRecordFolder = filePlanService.getUnfiledContainer(filePlan); + + // get the documents readers and writers + Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef); + + // copy version state and create record + NodeRef record = null; + try + { + List originalAssocs = null; + if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_COPIEDFROM)) + { + // take a note of any copyFrom information already on the node + originalAssocs = nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL); + } + + recordsManagementContainerType.disable(); + try + { + // create a copy of the original state and add it to the unfiled record container + FileInfo recordInfo = fileFolderService.copy(nodeRef, unfiledRecordFolder, null); + record = recordInfo.getNodeRef(); + } + finally + { + recordsManagementContainerType.enable(); + } + + // if versionable, then remove without destroying version history, + // because it is being shared with the originating document + behaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); + try + { + nodeService.removeAspect(record, ContentModel.ASPECT_VERSIONABLE); + } + finally + { + behaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); + } + + // make record + makeRecord(record); + + // remove added copy assocs + List recordAssocs = nodeService.getTargetAssocs(record, ContentModel.ASSOC_ORIGINAL); + for (AssociationRef recordAssoc : recordAssocs) + { + nodeService.removeAssociation( + recordAssoc.getSourceRef(), + recordAssoc.getTargetRef(), + ContentModel.ASSOC_ORIGINAL); + } + + // re-add origional assocs or remove aspect + if (originalAssocs == null) + { + nodeService.removeAspect(record, ContentModel.ASPECT_COPIEDFROM); + } + else + { + for (AssociationRef originalAssoc : originalAssocs) + { + nodeService.createAssociation(record, originalAssoc.getTargetRef(), ContentModel.ASSOC_ORIGINAL); + } + } + } + catch (FileNotFoundException e) + { + throw new AlfrescoRuntimeException("Can't create recorded version, because copy fails.", e); + } + + // set extended security on record + extendedSecurityService.set(record, readersAndWriters); + + return record; + } + }); + } + + /** + * Helper to get the latest version record for a given document (ie non-record) + * + * @param nodeRef node reference + * @return NodeRef latest version record, null otherwise + */ + private NodeRef getLatestVersionRecord(NodeRef nodeRef) + { + NodeRef versionRecord = null; + + // wire record up to previous record + VersionHistory versionHistory = versionService.getVersionHistory(nodeRef); + if (versionHistory != null) + { + Collection previousVersions = versionHistory.getAllVersions(); + for (Version previousVersion : previousVersions) + { + // look for the associated record + final NodeRef previousRecord = recordableVersionService.getVersionRecord(previousVersion); + if (previousRecord != null) + { + versionRecord = previousRecord; + break; + } + } + } + + return versionRecord; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createNewRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map, org.alfresco.service.cmr.repository.ContentReader) + */ + @Override + public NodeRef createRecordFromContent(NodeRef parent, String name, QName type, Map properties, ContentReader reader) + { + ParameterCheck.mandatory("nodeRef", parent); + ParameterCheck.mandatory("name", name); + + NodeRef result = null; + NodeRef destination = parent; + + if (isFilePlan(parent)) + { + // get the unfiled record container for the file plan + destination = filePlanService.getUnfiledContainer(parent); + if (destination == null) + { + throw new AlfrescoRuntimeException("Unable to create record, because unfiled container could not be found."); + } + } + + // if none set the default record type is cm:content + if (type == null) + { + type = ContentModel.TYPE_CONTENT; + } + else if (!dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) + { + throw new AlfrescoRuntimeException("Record can only be created from a sub-type of cm:content."); + } + + disablePropertyEditableCheck(); + try + { + // create the new record + final NodeRef record = fileFolderService.create(destination, name, type).getNodeRef(); + + // set the properties + if (properties != null) + { + nodeService.addProperties(record, properties); + } + + // set the content + if (reader != null) + { + ContentWriter writer = fileFolderService.getWriter(record); + writer.setEncoding(reader.getEncoding()); + writer.setMimetype(reader.getMimetype()); + writer.putContent(reader); + } + + result = authenticationUtil.runAsSystem(new RunAsWork() + { + public NodeRef doWork() throws Exception + { + // Check if the "record" aspect has been applied already. + // In case of filing a report the created node will be made + // a record within the "onCreateChildAssociation" method if + // a destination for the report has been selected. + if (!nodeService.hasAspect(record, ASPECT_RECORD)) + { + // make record + makeRecord(record); + } + + return record; + } + + }); + } + finally + { + enablePropertyEditableCheck(); + } + + return result; + } + + /** + * Creates a record from the given document + * + * @param document the document from which a record will be created + */ + @Override + public void makeRecord(NodeRef document) + { + ParameterCheck.mandatory("document", document); + + ruleService.disableRules(); + disablePropertyEditableCheck(); + try + { + // get the record id + String recordId = identifierService.generateIdentifier(ASPECT_RECORD, + nodeService.getPrimaryParent(document).getParentRef()); + + // get the record name + String name = (String)nodeService.getProperty(document, ContentModel.PROP_NAME); + + // rename the record + int dotIndex = name.lastIndexOf('.'); + String prefix = name; + String postfix = ""; + if (dotIndex != -1) + { + prefix = name.substring(0, dotIndex); + postfix = name.substring(dotIndex); + } + String recordName = prefix + " (" + recordId + ")" + postfix; + behaviourFilter.disableBehaviour(); + try + { + fileFolderService.rename(document, recordName); + } + finally + { + behaviourFilter.enableBehaviour(); + } + + if (logger.isDebugEnabled()) + { + logger.debug("Rename " + name + " to " + recordName); + } + + // add the record aspect + Map props = new HashMap(2); + props.put(PROP_IDENTIFIER, recordId); + props.put(PROP_ORIGIONAL_NAME, name); + nodeService.addAspect(document, RecordsManagementModel.ASPECT_RECORD, props); + + // remove versionable aspect(s) + nodeService.removeAspect(document, RecordableVersionModel.ASPECT_VERSIONABLE); + + // remove the owner + ownableService.setOwner(document, OwnableService.NO_OWNER); + } + catch (FileNotFoundException e) + { + throw new AlfrescoRuntimeException("Unable to make record, because rename failed.", e); + } + finally + { + ruleService.enableRules(); + enablePropertyEditableCheck(); + } + + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.disposableitem.RecordService#isFiled(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean isFiled(final NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + boolean result = false; + + if (isRecord(nodeRef)) + { + result = AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Boolean doWork() throws Exception + { + return (null != nodeService.getProperty(nodeRef, PROP_DATE_FILED)); + } + }); + } + + return result; + } + + /** + * Helper method to 'file' a new document that arrived in the file plan structure. + * + * TODO atm we only 'file' content as a record .. may need to consider other types if we + * are to support the notion of composite records. + * + * @param record node reference to record (or soon to be record!) + */ + @Override + public void file(NodeRef record) + { + ParameterCheck.mandatory("item", record); + + // we only support filling of content items + // TODO composite record support needs to file containers too + QName type = nodeService.getType(record); + if (ContentModel.TYPE_CONTENT.equals(type) || + dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) + { + // fire before file record policy + beforeFileRecord.get(getTypeAndApsects(record)).beforeFileRecord(record); + + // check whether this item is already an item or not + if (!isRecord(record)) + { + // make the item a record + makeRecord(record); + } + + // set filed date + if (nodeService.getProperty(record, PROP_DATE_FILED) == null) + { + Calendar fileCalendar = Calendar.getInstance(); + nodeService.setProperty(record, PROP_DATE_FILED, fileCalendar.getTime()); + } + + // file on file record policy + onFileRecord.get(getTypeAndApsects(record)).onFileRecord(record); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#rejectRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public void rejectRecord(final NodeRef nodeRef, final String reason) + { + ParameterCheck.mandatory("NodeRef", nodeRef); + ParameterCheck.mandatoryString("Reason", reason); + + // Save the id of the currently logged in user + final String userId = AuthenticationUtil.getFullyAuthenticatedUser(); + + // do the work of rejecting the record as the system user + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + ruleService.disableRules(); + try + { + // get the latest version record, if there is one + NodeRef latestVersionRecord = getLatestVersionRecord(nodeRef); + + if (latestVersionRecord != null) + { + relationshipService.removeRelationship(CUSTOM_REF_VERSIONS.getLocalName(), nodeRef, latestVersionRecord); + } + + // get record property values + final Map properties = nodeService.getProperties(nodeRef); + final String recordId = (String)properties.get(PROP_IDENTIFIER); + final String documentOwner = (String)properties.get(PROP_RECORD_ORIGINATING_USER_ID); + final String originalName = (String)properties.get(PROP_ORIGIONAL_NAME); + final NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION); + + // we can only reject if the originating location is present + if (originatingLocation != null) + { + // first remove the secondary link association + final List parentAssocs = nodeService.getParentAssocs(nodeRef); + for (ChildAssociationRef childAssociationRef : parentAssocs) + { + if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation)) + { + nodeService.removeChildAssociation(childAssociationRef); + break; + } + } + + removeRmAspectsFrom(nodeRef); + + // get the records primary parent association + final ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); + + // move the record into the collaboration site + nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName()); + + // rename to the original name + if (originalName != null) + { + fileFolderService.rename(nodeRef, originalName); + + if (logger.isDebugEnabled()) + { + String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); + logger.debug("Rename " + name + " to " + originalName); + } + } + + // save the information about the rejection details + final Map aspectProperties = new HashMap<>(3); + aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId); + aspectProperties.put(PROP_RECORD_REJECTION_DATE, new Date()); + aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason); + nodeService.addAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS, aspectProperties); + + // Restore the owner of the document + if (StringUtils.isBlank(documentOwner)) + { + throw new AlfrescoRuntimeException("Unable to find the creator of document."); + } + ownableService.setOwner(nodeRef, documentOwner); + + // clear the existing permissions + permissionService.clearPermission(nodeRef, null); + + // restore permission inheritance + permissionService.setInheritParentPermissions(nodeRef, true); + + // send an email to the record creator + notificationHelper.recordRejectedEmailNotification(nodeRef, recordId, documentOwner); + } + } + finally + { + ruleService.enableRules(); + } + + return null; + } + + /** Removes all RM related aspects from the specified node and any rendition children. */ + private void removeRmAspectsFrom(NodeRef nodeRef) + { + // Note that when folder records are supported, we will need to recursively + // remove aspects from their descendants. + final Set aspects = nodeService.getAspects(nodeRef); + for (QName aspect : aspects) + { + if (RM_URI.equals(aspect.getNamespaceURI()) || + RecordableVersionModel.RMV_URI.equals(aspect.getNamespaceURI())) + { + nodeService.removeAspect(nodeRef, aspect); + } + } + for (ChildAssociationRef renditionAssoc : renditionService.getRenditions(nodeRef)) + { + final NodeRef renditionNode = renditionAssoc.getChildRef(); + + // Do not attempt to clean up rendition nodes which are not children of their source node. + final boolean renditionRequiresCleaning = nodeService.exists(renditionNode) && + renditionAssoc.isPrimary(); + + if (renditionRequiresCleaning) + { + removeRmAspectsFrom(renditionNode); + } + } + } + }); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isPropertyEditable(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + @Override + public boolean isPropertyEditable(NodeRef record, QName property) + { + ParameterCheck.mandatory("record", record); + ParameterCheck.mandatory("property", property); + + if (!isRecord(record)) + { + throw new AlfrescoRuntimeException("Can not check if the property " + property.toString() + " is editable, because node reference is not a record."); + } + + NodeRef filePlan = getFilePlan(record); + + // DEBUG ... + boolean debugEnabled = logger.isDebugEnabled(); + if (debugEnabled) + { + logger.debug("Checking whether property " + property.toString() + " is editable for user " + AuthenticationUtil.getRunAsUser()); + + Set roles = filePlanRoleService.getRolesByUser(filePlan, AuthenticationUtil.getRunAsUser()); + + logger.debug(" ... users roles"); + + for (Role role : roles) + { + logger.debug(" ... user has role " + role.getName() + " with capabilities "); + + for (Capability cap : role.getCapabilities()) + { + logger.debug(" ... " + cap.getName()); + } + } + + logger.debug(" ... user has the following set permissions on the file plan"); + + Set perms = permissionService.getAllSetPermissions(filePlan); + for (AccessPermission perm : perms) + { + if ((perm.getPermission().contains(RMPermissionModel.EDIT_NON_RECORD_METADATA) || + perm.getPermission().contains(RMPermissionModel.EDIT_RECORD_METADATA))) + { + logger.debug(" ... " + perm.getAuthority() + " - " + perm.getPermission() + " - " + perm.getAccessStatus().toString()); + } + } + + if (permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA).equals(AccessStatus.ALLOWED)) + { + logger.debug(" ... user has the edit non record metadata permission on the file plan"); + } + } + // END DEBUG ... + + boolean result = alwaysEditProperty(property); + if (result) + { + if (debugEnabled) + { + logger.debug(" ... property marked as always editable."); + } + } + else + { + boolean allowRecordEdit = false; + boolean allowNonRecordEdit = false; + + AccessStatus accessNonRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_NON_RECORD_METADATA); + AccessStatus accessDeclaredRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); + AccessStatus accessRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_RECORD_METADATA); + + if (AccessStatus.ALLOWED.equals(accessNonRecord)) + { + if (debugEnabled) + { + logger.debug(" ... user has edit nonrecord metadata capability"); + } + + allowNonRecordEdit = true; + } + + if (AccessStatus.ALLOWED.equals(accessRecord) || + AccessStatus.ALLOWED.equals(accessDeclaredRecord)) + { + if (debugEnabled) + { + logger.debug(" ... user has edit record or declared metadata capability"); + } + + allowRecordEdit = true; + } + + if (allowNonRecordEdit && allowRecordEdit) + { + if (debugEnabled) + { + logger.debug(" ... so all properties can be edited."); + } + + result = true; + } + else if (allowNonRecordEdit && !allowRecordEdit) + { + // can only edit non record properties + if (!isRecordMetadata(filePlan, property)) + { + if (debugEnabled) + { + logger.debug(" ... property is not considered record metadata so editable."); + } + + result = true; + } + else + { + if (debugEnabled) + { + logger.debug(" ... property is considered record metadata so not editable."); + } + } + } + else if (!allowNonRecordEdit && allowRecordEdit) + { + // can only edit record properties + if (isRecordMetadata(filePlan, property)) + { + if (debugEnabled) + { + logger.debug(" ... property is considered record metadata so editable."); + } + + result = true; + } + else + { + if (debugEnabled) + { + logger.debug(" ... property is not considered record metadata so not editable."); + } + } + } + // otherwise we can't edit any properties so just return the empty set + } + return result; + } + + /** + * Helper method that indicates whether a property is considered record metadata or not. + * + * @param property property + * @return boolea true if record metadata, false otherwise + */ + private boolean isRecordMetadata(NodeRef filePlan, QName property) + { + boolean result = false; + + // grab the information about the properties parent type + ClassDefinition parent = null; + PropertyDefinition def = dictionaryService.getProperty(property); + if (def != null) + { + parent = def.getContainerClass(); + } + + // non-electronic record is considered a special case + // TODO move non-electronic record support to a separate model namespace + if (parent != null && TYPE_NON_ELECTRONIC_DOCUMENT.equals(parent.getName())) + { + result = false; + } + else + { + // check the URI's + result = RECORD_MODEL_URIS.contains(property.getNamespaceURI()); + + // check the custom model + if (!result && !ArrayUtils.contains(NON_RECORD_MODEL_URIS, property.getNamespaceURI())) + { + if (parent != null && parent.isAspect()) + { + result = getRecordMetadataAspects(filePlan).contains(parent.getName()); + } + } + } + + return result; + } + + /** + * Determines whether the property should always be allowed to be edited or not. + * + * @param property + * @return + */ + private boolean alwaysEditProperty(QName property) + { + return (getAlwaysEditURIs().contains(property.getNamespaceURI()) || + ArrayUtils.contains(ALWAYS_EDIT_PROPERTIES, property) || + isProtectedProperty(property)); + } + + /** + * Helper method to determine whether a property is protected at a dictionary definition + * level. + * + * @param property property qualified name + * @return booelan true if protected, false otherwise + */ + private boolean isProtectedProperty(QName property) + { + boolean result = false; + PropertyDefinition def = dictionaryService.getProperty(property); + if (def != null) + { + result = def.isProtected(); + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isMetadataStub(NodeRef) + */ + @Override + public boolean isMetadataStub(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + return nodeService.hasAspect(nodeRef, ASPECT_GHOSTED); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecords(NodeRef) + */ + @Override + public List getRecords(NodeRef recordFolder) + { + ParameterCheck.mandatory("recordFolder", recordFolder); + + List result = new ArrayList(1); + if (recordFolderService.isRecordFolder(recordFolder)) + { + List assocs = nodeService.getChildAssocs(recordFolder, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + NodeRef child = assoc.getChildRef(); + if (isRecord(child)) + { + result.add(child); + } + } + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#addRecordType(NodeRef, QName) + */ + @Override + public void addRecordType(NodeRef nodeRef, QName typeQName) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("typeQName", typeQName); + + if (!nodeService.hasAspect(nodeRef, typeQName)) + { + nodeService.addAspect(nodeRef, typeQName, null); + } + else + { + logger.info(I18NUtil.getMessage(MSG_NODE_HAS_ASPECT, nodeRef.toString(), typeQName.toString())); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#link(NodeRef, NodeRef) + */ + @Override + public void link(NodeRef record, NodeRef recordFolder) + { + ParameterCheck.mandatory("record", record); + ParameterCheck.mandatory("recordFolder", recordFolder); + + // ensure we are linking a record to a record folder + if(isRecord(record) && isRecordFolder(recordFolder)) + { + // ensure that we are not linking a record to an exisiting location + List parents = nodeService.getParentAssocs(record); + for (ChildAssociationRef parent : parents) + { + if (parent.getParentRef().equals(recordFolder)) + { + // we can not link a record to the same location more than once + throw new RecordLinkRuntimeException("Can not link a record to the same record folder more than once"); + } + } + + // validate link conditions + validateLinkConditions(record, recordFolder); + + // get the current name of the record + String name = nodeService.getProperty(record, ContentModel.PROP_NAME).toString(); + + // create a secondary link to the record folder + nodeService.addChild( + recordFolder, + record, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); + } + else + { + // can only link a record to a record folder + throw new RecordLinkRuntimeException("Can only link a record to a record folder."); + } + } + + /** + * + * @param record + * @param recordFolder + */ + private void validateLinkConditions(NodeRef record, NodeRef recordFolder) + { + // ensure that the linking record folders have compatible disposition schedules + DispositionSchedule recordDispositionSchedule = dispositionService.getDispositionSchedule(record); + if (recordDispositionSchedule != null) + { + DispositionSchedule recordFolderDispositionSchedule = dispositionService.getDispositionSchedule(recordFolder); + if (recordFolderDispositionSchedule != null) + { + if (recordDispositionSchedule.isRecordLevelDisposition() != recordFolderDispositionSchedule.isRecordLevelDisposition()) + { + // we can't link a record to an incompatible disposition schedule + throw new RecordLinkRuntimeException("Can not link a record to a record folder with an incompatible retention schedule. " + + "They must either both be record level or record folder level retentions."); + } + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#unlink(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void unlink(NodeRef record, NodeRef recordFolder) + { + ParameterCheck.mandatory("record", record); + ParameterCheck.mandatory("recordFolder", recordFolder); + + // ensure we are unlinking a record from a record folder + if(isRecord(record) && isRecordFolder(recordFolder)) + { + // check that we are not trying to unlink the primary parent + NodeRef primaryParent = nodeService.getPrimaryParent(record).getParentRef(); + if (primaryParent.equals(recordFolder)) + { + throw new RecordLinkRuntimeException("Can't unlink a record from it's owning record folder."); + } + + // remove the link + nodeService.removeChild(recordFolder, record); + } + else + { + // can only unlink a record from a record folder + throw new RecordLinkRuntimeException("Can only unlink a record from a record folder."); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java index 12dfef7198..9875eb50c4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java @@ -1,60 +1,60 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.recordableversion; - -import java.util.List; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Recordable version config service interface - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public interface RecordableVersionConfigService -{ - /** - * Gets the recordable versions - * - * @param nodeRef The node reference for which the recordable versions should be retrieved - * @return The list of recordable versions - */ - List getVersions(NodeRef nodeRef); - - /** - * Sets the recordable version for the given node - * - * @param nodeRef The node reference for which the recorable version should be set - * @param version The version to be set - */ - void setVersion(NodeRef nodeRef, String version); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.recordableversion; + +import java.util.List; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Recordable version config service interface + * + * @author Tuna Aksoy + * @since 2.3 + */ +@AlfrescoPublicApi +public interface RecordableVersionConfigService +{ + /** + * Gets the recordable versions + * + * @param nodeRef The node reference for which the recordable versions should be retrieved + * @return The list of recordable versions + */ + List getVersions(NodeRef nodeRef); + + /** + * Sets the recordable version for the given node + * + * @param nodeRef The node reference for which the recorable version should be set + * @param version The version to be set + */ + void setVersion(NodeRef nodeRef, String version); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java index deb80d46c5..df919bb298 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java @@ -1,136 +1,136 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.recordableversion; - -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang.StringUtils.isNotBlank; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * Recordable version config service - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordableVersionConfigServiceImpl implements RecordableVersionConfigService, RecordableVersionModel -{ - /** Node service */ - private NodeService nodeService; - - /** - * Gets the node service - * - * @return The node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Sets the node service - * - * @param nodeService The node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService#getVersions(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getVersions(NodeRef nodeRef) - { - mandatory("nodeRef", nodeRef); - - RecordableVersionPolicy[] recordableVersionPolicies = RecordableVersionPolicy.values(); - List versions = new ArrayList(recordableVersionPolicies.length); - - for (RecordableVersionPolicy recordableVersionPolicy : recordableVersionPolicies) - { - String policy = recordableVersionPolicy.toString(); - boolean selected = isVersionPolicySelected(recordableVersionPolicy, nodeRef); - versions.add(new Version(policy, selected)); - } - - return versions; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService#setVersion(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void setVersion(NodeRef nodeRef, String version) - { - mandatory("nodeRef", nodeRef); - mandatoryString("recordedVersion", version); - - RecordableVersionPolicy recordableVersionPolicy = RecordableVersionPolicy.valueOf(version); - getNodeService().setProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY, recordableVersionPolicy); - } - - /** - * Checks if the specified recordable version policy has been selected for the document - * - * @param recordableVersionPolicy The recordable version policy - * @param nodeRef Node reference of the document - * @return true if the specified recordable version policy has been selected for the document, false otherwise - */ - private boolean isVersionPolicySelected(RecordableVersionPolicy recordableVersionPolicy, NodeRef nodeRef) - { - boolean isVersionPolicySelected = false; - String policy = (String) getNodeService().getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); - if (isNotBlank(policy)) - { - if (RecordableVersionPolicy.valueOf(policy).equals(recordableVersionPolicy)) - { - isVersionPolicySelected = true; - } - } - else - { - if (recordableVersionPolicy.equals(NONE)) - { - isVersionPolicySelected = true; - } - } - return isVersionPolicySelected; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.recordableversion; + +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; +import static org.alfresco.util.ParameterCheck.mandatory; +import static org.alfresco.util.ParameterCheck.mandatoryString; +import static org.apache.commons.lang.StringUtils.isNotBlank; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; + +/** + * Recordable version config service + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RecordableVersionConfigServiceImpl implements RecordableVersionConfigService, RecordableVersionModel +{ + /** Node service */ + private NodeService nodeService; + + /** + * Gets the node service + * + * @return The node service + */ + protected NodeService getNodeService() + { + return this.nodeService; + } + + /** + * Sets the node service + * + * @param nodeService The node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService#getVersions(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getVersions(NodeRef nodeRef) + { + mandatory("nodeRef", nodeRef); + + RecordableVersionPolicy[] recordableVersionPolicies = RecordableVersionPolicy.values(); + List versions = new ArrayList(recordableVersionPolicies.length); + + for (RecordableVersionPolicy recordableVersionPolicy : recordableVersionPolicies) + { + String policy = recordableVersionPolicy.toString(); + boolean selected = isVersionPolicySelected(recordableVersionPolicy, nodeRef); + versions.add(new Version(policy, selected)); + } + + return versions; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService#setVersion(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public void setVersion(NodeRef nodeRef, String version) + { + mandatory("nodeRef", nodeRef); + mandatoryString("recordedVersion", version); + + RecordableVersionPolicy recordableVersionPolicy = RecordableVersionPolicy.valueOf(version); + getNodeService().setProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY, recordableVersionPolicy); + } + + /** + * Checks if the specified recordable version policy has been selected for the document + * + * @param recordableVersionPolicy The recordable version policy + * @param nodeRef Node reference of the document + * @return true if the specified recordable version policy has been selected for the document, false otherwise + */ + private boolean isVersionPolicySelected(RecordableVersionPolicy recordableVersionPolicy, NodeRef nodeRef) + { + boolean isVersionPolicySelected = false; + String policy = (String) getNodeService().getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); + if (isNotBlank(policy)) + { + if (RecordableVersionPolicy.valueOf(policy).equals(recordableVersionPolicy)) + { + isVersionPolicySelected = true; + } + } + else + { + if (recordableVersionPolicy.equals(NONE)) + { + isVersionPolicySelected = true; + } + } + return isVersionPolicySelected; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java index 3e93b32ffe..b59d85c85f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderService.java @@ -1,169 +1,169 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.recordfolder; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Record folder service interface - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface RecordFolderService -{ - /** - * Sets up the a record folder from a standard folder. - * - * @param nodeRef node reference of the folder to setup - * - * @since 2.2 - */ - void setupRecordFolder(NodeRef nodeRef); - - /** - * Indicates whether the given node is a record folder or not. - * - * @param nodeRef node reference - * @return boolean true if record folder, false otherwise - * - * @since 2.2 - */ - boolean isRecordFolder(NodeRef nodeRef); - - /** - * Indicates whether the contents of a record folder are all declared. - * - * @param nodeRef node reference (record folder) - * @return boolean true if record folder contents are declared, false otherwise - * - * @since 2.2 - */ - boolean isRecordFolderDeclared(NodeRef nodeRef); - - /** - * Indicates whether a record folder is closed or not. - * - * @param nodeRef node reference (record folder) - * @return boolean true if record folder is closed, false otherwise - * - * @since 2.2 - */ - boolean isRecordFolderClosed(NodeRef nodeRef); - - /** - * Create a record folder in the rm container. The record folder will take the name and type - * provided. - * - * @param rmContainer records management container - * @param name name - * @param type type - * @return NodeRef node reference of record folder - * - * @since 2.2 - */ - NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type); - - /** - * Create a record folder in the rm container. The record folder will take the name, type and - * properties provided. - * - * @param rmContainer records management container - * @param name name - * @param type type - * @param properties properties - * @return NodeRef node reference of record folder - * - * @since 2.2 - */ - NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties); - - /** - * Create a record folder in the rm container. The record folder will take the name provided. - * Type defaults to rm:recordFolder. - * - * @param rmContainer records management container - * @param name name - * @return NodeRef node reference of record folder - * - * @since 2.2 - */ - NodeRef createRecordFolder(NodeRef rmContainer, String name); - - /** - * Create a record folder in the rm container. The record folder will take the name and - * properties provided. Type defaults to rm:recordFolder. - * - * @param rmContainer records management container - * @param name name - * @param properties properties - * @return NodeRef node reference of record folder - * - * @since 2.2 - */ - NodeRef createRecordFolder(NodeRef rmContainer, String name, Map properties); - - /** - * Get all the record folders that a record is filed into. - * - * @param record the record node reference - * @return List list of folder record node references - * - * @since 2.2 - */ - // TODO rename to List getParentRecordFolders(NodeRef record); - List getRecordFolders(NodeRef record); - - // TODO NodeRef getRecordFolderByPath(String path); - - // TODO NodeRef getRecordFolderById(String id); - - // TODO NodeRef getRecordFolderByName(NodeRef parent, String name); - - // TODO void deleteRecordFolder(NodeRef recordFolder); - - // TODO List getParentRecordsManagementContainers(NodeRef container); // also applicable to record folders - - // TODO rename to getContainedRecords(NodeRef recordFolder); - - /** - * Closes the record folder. If the given node reference is a record the parent will be retrieved and processed. - * - * @param nodeRef the record folder node reference - * - * @since 2.2 - */ - void closeRecordFolder(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.recordfolder; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Record folder service interface + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface RecordFolderService +{ + /** + * Sets up the a record folder from a standard folder. + * + * @param nodeRef node reference of the folder to setup + * + * @since 2.2 + */ + void setupRecordFolder(NodeRef nodeRef); + + /** + * Indicates whether the given node is a record folder or not. + * + * @param nodeRef node reference + * @return boolean true if record folder, false otherwise + * + * @since 2.2 + */ + boolean isRecordFolder(NodeRef nodeRef); + + /** + * Indicates whether the contents of a record folder are all declared. + * + * @param nodeRef node reference (record folder) + * @return boolean true if record folder contents are declared, false otherwise + * + * @since 2.2 + */ + boolean isRecordFolderDeclared(NodeRef nodeRef); + + /** + * Indicates whether a record folder is closed or not. + * + * @param nodeRef node reference (record folder) + * @return boolean true if record folder is closed, false otherwise + * + * @since 2.2 + */ + boolean isRecordFolderClosed(NodeRef nodeRef); + + /** + * Create a record folder in the rm container. The record folder will take the name and type + * provided. + * + * @param rmContainer records management container + * @param name name + * @param type type + * @return NodeRef node reference of record folder + * + * @since 2.2 + */ + NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type); + + /** + * Create a record folder in the rm container. The record folder will take the name, type and + * properties provided. + * + * @param rmContainer records management container + * @param name name + * @param type type + * @param properties properties + * @return NodeRef node reference of record folder + * + * @since 2.2 + */ + NodeRef createRecordFolder(NodeRef rmContainer, String name, QName type, Map properties); + + /** + * Create a record folder in the rm container. The record folder will take the name provided. + * Type defaults to rm:recordFolder. + * + * @param rmContainer records management container + * @param name name + * @return NodeRef node reference of record folder + * + * @since 2.2 + */ + NodeRef createRecordFolder(NodeRef rmContainer, String name); + + /** + * Create a record folder in the rm container. The record folder will take the name and + * properties provided. Type defaults to rm:recordFolder. + * + * @param rmContainer records management container + * @param name name + * @param properties properties + * @return NodeRef node reference of record folder + * + * @since 2.2 + */ + NodeRef createRecordFolder(NodeRef rmContainer, String name, Map properties); + + /** + * Get all the record folders that a record is filed into. + * + * @param record the record node reference + * @return List list of folder record node references + * + * @since 2.2 + */ + // TODO rename to List getParentRecordFolders(NodeRef record); + List getRecordFolders(NodeRef record); + + // TODO NodeRef getRecordFolderByPath(String path); + + // TODO NodeRef getRecordFolderById(String id); + + // TODO NodeRef getRecordFolderByName(NodeRef parent, String name); + + // TODO void deleteRecordFolder(NodeRef recordFolder); + + // TODO List getParentRecordsManagementContainers(NodeRef container); // also applicable to record folders + + // TODO rename to getContainedRecords(NodeRef recordFolder); + + /** + * Closes the record folder. If the given node reference is a record the parent will be retrieved and processed. + * + * @param nodeRef the record folder node reference + * + * @since 2.2 + */ + void closeRecordFolder(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java index dc1bcaf2fc..03ac3e3997 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java @@ -1,321 +1,321 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.recordfolder; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -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.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Record Folder Service Implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordFolderServiceImpl extends ServiceBaseImpl - implements RecordFolderService, - RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(RecordFolderServiceImpl.class); - - /** I18N */ - private static final String MSG_RECORD_FOLDER_EXPECTED = "rm.service.record-folder-expected"; - private static final String MSG_PARENT_RECORD_FOLDER_ROOT = "rm.service.parent-record-folder-root"; - private static final String MSG_PARENT_RECORD_FOLDER_TYPE = "rm.service.parent-record-folder-type"; - private static final String MSG_RECORD_FOLDER_TYPE = "rm.service.record-folder-type"; - private static final String MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER = "rm.service.close-record-folder-not-folder"; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Record Service */ - private RecordService recordService; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#setupRecordFolder(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void setupRecordFolder(NodeRef nodeRef) - { - // initialise disposition details - if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) - { - DispositionSchedule di = dispositionService.getDispositionSchedule(nodeRef); - if (di != null && !di.isRecordLevelDisposition()) - { - nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#isRecordFolderDeclared(NodeRef) - */ - @Override - public boolean isRecordFolderDeclared(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Check we have a record folder - if (!isRecordFolder(nodeRef)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_EXPECTED)); - } - - boolean result = true; - - // Check that each record in the record folder in declared - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - if (!recordService.isDeclared(record)) - { - result = false; - break; - } - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#isRecordFolderClosed(NodeRef) - */ - @Override - public boolean isRecordFolderClosed(final NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Check we have a record folder - if (!isRecordFolder(nodeRef)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_EXPECTED)); - } - - return AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Boolean doWork() throws Exception - { - return ((Boolean) nodeService.getProperty(nodeRef, PROP_IS_CLOSED)); - } - }); - } - - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name, - QName type) - { - ParameterCheck.mandatory("rmContainer", rmContainer); - ParameterCheck.mandatoryString("name", name); - ParameterCheck.mandatory("type", type); - - return createRecordFolder(rmContainer, name, type, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String, QName, Map) - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name, - QName type, Map properties) - { - ParameterCheck.mandatory("rmContainer", rmContainer); - ParameterCheck.mandatoryString("name", name); - ParameterCheck.mandatory("type", type); - // "properties" is not mandatory - - // Check that we are not trying to create a record folder in a root container - if (filePlanService.isFilePlan(rmContainer)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_ROOT)); - } - - // Check that the parent is a container - QName parentType = nodeService.getType(rmContainer); - if (!TYPE_RECORD_CATEGORY.equals(parentType) && - !dictionaryService.isSubClass(parentType, TYPE_RECORD_CATEGORY)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_TYPE, parentType.toString())); - } - - // Check that the the provided type is a sub-type of rm:recordFolder - if (!TYPE_RECORD_FOLDER.equals(type) && - !dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_TYPE, type.toString())); - } - - Map props = new HashMap(1); - if (properties != null && properties.size() != 0) - { - props.putAll(properties); - } - props.put(ContentModel.PROP_NAME, name); - - return nodeService.createNode( - rmContainer, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, (name.length() > QName.MAX_LENGTH ? name.substring(0, QName.MAX_LENGTH) : name)), - type, - props).getChildRef(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String) - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name) - { - ParameterCheck.mandatory("rmContainer", rmContainer); - ParameterCheck.mandatoryString("name", name); - - // TODO defaults to rm:recordFolder, but in future could auto-detect sub-type of folder based on context - return createRecordFolder(rmContainer, name, TYPE_RECORD_FOLDER); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String, Map) - */ - @Override - public NodeRef createRecordFolder(NodeRef rmContainer, String name, - Map properties) - { - ParameterCheck.mandatory("rmContainer", rmContainer); - ParameterCheck.mandatoryString("name", name); - ParameterCheck.mandatory("properties", properties); - - return createRecordFolder(rmContainer, name, TYPE_RECORD_FOLDER, properties); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#getRecordFolders(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getRecordFolders(NodeRef record) - { - ParameterCheck.mandatory("record", record); - - List result = new ArrayList(1); - if (recordService.isRecord(record)) - { - List assocs = nodeService.getParentAssocs(record, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef parent = assoc.getParentRef(); - if (isRecordFolder(parent)) - { - result.add(parent); - } - } - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#closeRecordFolder(NodeRef) - */ - @Override - public void closeRecordFolder(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - if (isRecord(nodeRef)) - { - ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); - if (assocRef != null) - { - nodeRef = assocRef.getParentRef(); - } - } - - if (isRecordFolder(nodeRef)) - { - if (!isRecordFolderClosed(nodeRef)) - { - nodeService.setProperty(nodeRef, PROP_IS_CLOSED, true); - } - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn(I18NUtil.getMessage(MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER, nodeRef.toString())); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.recordfolder; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +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.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Record Folder Service Implementation + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RecordFolderServiceImpl extends ServiceBaseImpl + implements RecordFolderService, + RecordsManagementModel +{ + /** Logger */ + private static Log logger = LogFactory.getLog(RecordFolderServiceImpl.class); + + /** I18N */ + private static final String MSG_RECORD_FOLDER_EXPECTED = "rm.service.record-folder-expected"; + private static final String MSG_PARENT_RECORD_FOLDER_ROOT = "rm.service.parent-record-folder-root"; + private static final String MSG_PARENT_RECORD_FOLDER_TYPE = "rm.service.parent-record-folder-type"; + private static final String MSG_RECORD_FOLDER_TYPE = "rm.service.record-folder-type"; + private static final String MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER = "rm.service.close-record-folder-not-folder"; + + /** Disposition service */ + private DispositionService dispositionService; + + /** Record Service */ + private RecordService recordService; + + /** File Plan Service */ + private FilePlanService filePlanService; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#setupRecordFolder(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void setupRecordFolder(NodeRef nodeRef) + { + // initialise disposition details + if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + { + DispositionSchedule di = dispositionService.getDispositionSchedule(nodeRef); + if (di != null && !di.isRecordLevelDisposition()) + { + nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null); + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#isRecordFolderDeclared(NodeRef) + */ + @Override + public boolean isRecordFolderDeclared(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + // Check we have a record folder + if (!isRecordFolder(nodeRef)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_EXPECTED)); + } + + boolean result = true; + + // Check that each record in the record folder in declared + List records = recordService.getRecords(nodeRef); + for (NodeRef record : records) + { + if (!recordService.isDeclared(record)) + { + result = false; + break; + } + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#isRecordFolderClosed(NodeRef) + */ + @Override + public boolean isRecordFolderClosed(final NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + // Check we have a record folder + if (!isRecordFolder(nodeRef)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_EXPECTED)); + } + + return AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Boolean doWork() throws Exception + { + return ((Boolean) nodeService.getProperty(nodeRef, PROP_IS_CLOSED)); + } + }); + } + + @Override + public NodeRef createRecordFolder(NodeRef rmContainer, String name, + QName type) + { + ParameterCheck.mandatory("rmContainer", rmContainer); + ParameterCheck.mandatoryString("name", name); + ParameterCheck.mandatory("type", type); + + return createRecordFolder(rmContainer, name, type, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String, QName, Map) + */ + @Override + public NodeRef createRecordFolder(NodeRef rmContainer, String name, + QName type, Map properties) + { + ParameterCheck.mandatory("rmContainer", rmContainer); + ParameterCheck.mandatoryString("name", name); + ParameterCheck.mandatory("type", type); + // "properties" is not mandatory + + // Check that we are not trying to create a record folder in a root container + if (filePlanService.isFilePlan(rmContainer)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_ROOT)); + } + + // Check that the parent is a container + QName parentType = nodeService.getType(rmContainer); + if (!TYPE_RECORD_CATEGORY.equals(parentType) && + !dictionaryService.isSubClass(parentType, TYPE_RECORD_CATEGORY)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_TYPE, parentType.toString())); + } + + // Check that the the provided type is a sub-type of rm:recordFolder + if (!TYPE_RECORD_FOLDER.equals(type) && + !dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORD_FOLDER_TYPE, type.toString())); + } + + Map props = new HashMap(1); + if (properties != null && properties.size() != 0) + { + props.putAll(properties); + } + props.put(ContentModel.PROP_NAME, name); + + return nodeService.createNode( + rmContainer, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, (name.length() > QName.MAX_LENGTH ? name.substring(0, QName.MAX_LENGTH) : name)), + type, + props).getChildRef(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String) + */ + @Override + public NodeRef createRecordFolder(NodeRef rmContainer, String name) + { + ParameterCheck.mandatory("rmContainer", rmContainer); + ParameterCheck.mandatoryString("name", name); + + // TODO defaults to rm:recordFolder, but in future could auto-detect sub-type of folder based on context + return createRecordFolder(rmContainer, name, TYPE_RECORD_FOLDER); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#createRecordFolder(NodeRef, String, Map) + */ + @Override + public NodeRef createRecordFolder(NodeRef rmContainer, String name, + Map properties) + { + ParameterCheck.mandatory("rmContainer", rmContainer); + ParameterCheck.mandatoryString("name", name); + ParameterCheck.mandatory("properties", properties); + + return createRecordFolder(rmContainer, name, TYPE_RECORD_FOLDER, properties); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#getRecordFolders(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getRecordFolders(NodeRef record) + { + ParameterCheck.mandatory("record", record); + + List result = new ArrayList(1); + if (recordService.isRecord(record)) + { + List assocs = nodeService.getParentAssocs(record, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + NodeRef parent = assoc.getParentRef(); + if (isRecordFolder(parent)) + { + result.add(parent); + } + } + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService#closeRecordFolder(NodeRef) + */ + @Override + public void closeRecordFolder(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + if (isRecord(nodeRef)) + { + ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); + if (assocRef != null) + { + nodeRef = assocRef.getParentRef(); + } + } + + if (isRecordFolder(nodeRef)) + { + if (!isRecordFolderClosed(nodeRef)) + { + nodeService.setProperty(nodeRef, PROP_IS_CLOSED, true); + } + } + else + { + if (logger.isWarnEnabled()) + { + logger.warn(I18NUtil.getMessage(MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER, nodeRef.toString())); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java index 09048f4cd2..0e6d2e1c07 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.relationship; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Interface representing the relationship - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public interface Relationship -{ - /** - * Gets the unique name of the relationship - * - * @return The unique name of the relationship - */ - String getUniqueName(); - - /** - * Gets the source of the relationship - * - * @return The source of the relationship - */ - NodeRef getSource(); - - /** - * Gets the target of the relationship - * - * @return The target of the relationship - */ - NodeRef getTarget(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.relationship; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Interface representing the relationship + * + * @author Tuna Aksoy + * @since 2.3 + */ +@AlfrescoPublicApi +public interface Relationship +{ + /** + * Gets the unique name of the relationship + * + * @return The unique name of the relationship + */ + String getUniqueName(); + + /** + * Gets the source of the relationship + * + * @return The source of the relationship + */ + NodeRef getSource(); + + /** + * Gets the target of the relationship + * + * @return The target of the relationship + */ + NodeRef getTarget(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java index 2493664b3e..19022bec77 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java @@ -1,61 +1,61 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.relationship; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Interface representing the relationship definition - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public interface RelationshipDefinition -{ - /** - * Gets the unique name of the relationship definition - * - * @return The unique name of the relationship definition - */ - String getUniqueName(); - - /** - * Gets the type of the relationship definition - * - * @return The type of the relationship definition - */ - RelationshipType getType(); - - /** - * Gets the display name of the relationship definition - * - * @return The display name of the relationship definition - */ - RelationshipDisplayName getDisplayName(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.relationship; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Interface representing the relationship definition + * + * @author Tuna Aksoy + * @since 2.3 + */ +@AlfrescoPublicApi +public interface RelationshipDefinition +{ + /** + * Gets the unique name of the relationship definition + * + * @return The unique name of the relationship definition + */ + String getUniqueName(); + + /** + * Gets the type of the relationship definition + * + * @return The type of the relationship definition + */ + RelationshipType getType(); + + /** + * Gets the display name of the relationship definition + * + * @return The display name of the relationship definition + */ + RelationshipDisplayName getDisplayName(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java index aa3888b35b..96f63a5a56 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java @@ -1,124 +1,124 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.relationship; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; - -/** - * Relationship definition implementation - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipDefinitionImpl implements RelationshipDefinition -{ - /** The unique name of the relationship definition */ - private String uniqueName; - - /** The type of the relationship definition */ - private RelationshipType type; - - /** The display name of the relationship definition */ - private RelationshipDisplayName displayName; - - /** - * Constructor for creating a relationship definition - * - * @param uniqueName The unique name of the relationship definition - * @param type The type of the relationship definition - * @param displayName The display name of the relationship definition - */ - public RelationshipDefinitionImpl(String uniqueName, RelationshipType type, RelationshipDisplayName displayName) - { - mandatoryString("uniqueName", uniqueName); - mandatory("type", type); - mandatory("displayName", displayName); - - setUniqueName(uniqueName); - setType(type); - setDisplayName(displayName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getUniqueName() - */ - @Override - public String getUniqueName() - { - return this.uniqueName; - } - - /** - * Sets the name of the relationship definition - * - * @param uniqueName The name of the relationship definition - */ - private void setUniqueName(String uniqueName) - { - this.uniqueName = uniqueName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getType() - */ - @Override - public RelationshipType getType() - { - return this.type; - } - - /** - * Sets the type of the relationship definition - * - * @param type The type of the relationship definition - */ - private void setType(RelationshipType type) - { - this.type = type; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getDisplayName() - */ - @Override - public RelationshipDisplayName getDisplayName() - { - return this.displayName; - } - - /** - * Sets the display name of the relationship definition - * - * @param displayName The display name of the relationship definition - */ - private void setDisplayName(RelationshipDisplayName displayName) - { - this.displayName = displayName; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.relationship; + +import static org.alfresco.util.ParameterCheck.mandatory; +import static org.alfresco.util.ParameterCheck.mandatoryString; + +/** + * Relationship definition implementation + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RelationshipDefinitionImpl implements RelationshipDefinition +{ + /** The unique name of the relationship definition */ + private String uniqueName; + + /** The type of the relationship definition */ + private RelationshipType type; + + /** The display name of the relationship definition */ + private RelationshipDisplayName displayName; + + /** + * Constructor for creating a relationship definition + * + * @param uniqueName The unique name of the relationship definition + * @param type The type of the relationship definition + * @param displayName The display name of the relationship definition + */ + public RelationshipDefinitionImpl(String uniqueName, RelationshipType type, RelationshipDisplayName displayName) + { + mandatoryString("uniqueName", uniqueName); + mandatory("type", type); + mandatory("displayName", displayName); + + setUniqueName(uniqueName); + setType(type); + setDisplayName(displayName); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getUniqueName() + */ + @Override + public String getUniqueName() + { + return this.uniqueName; + } + + /** + * Sets the name of the relationship definition + * + * @param uniqueName The name of the relationship definition + */ + private void setUniqueName(String uniqueName) + { + this.uniqueName = uniqueName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getType() + */ + @Override + public RelationshipType getType() + { + return this.type; + } + + /** + * Sets the type of the relationship definition + * + * @param type The type of the relationship definition + */ + private void setType(RelationshipType type) + { + this.type = type; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getDisplayName() + */ + @Override + public RelationshipDisplayName getDisplayName() + { + return this.displayName; + } + + /** + * Sets the display name of the relationship definition + * + * @param displayName The display name of the relationship definition + */ + private void setDisplayName(RelationshipDisplayName displayName) + { + this.displayName = displayName; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java index 59be1f4983..f5fb23c273 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java @@ -1,119 +1,119 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.relationship; - -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * POJO representing the relationship display name - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public class RelationshipDisplayName -{ - /** The source text of the relationship */ - private String sourceText; - - /** The target text of the relationship */ - private String targetText; - - /** - * Constructor for creating the relationship display name. - * In case of a bidirectional relationship the source - * text and target text will be the same. - * - * @param sourceText The source text of the relationship - * @param targetText The target text of the relationship - */ - public RelationshipDisplayName(String sourceText, String targetText) - { - mandatoryString("sourceText", sourceText); - mandatoryString("targetText", targetText); - - setSourceText(sourceText); - setTargetText(targetText); - } - - /** - * Gets the source text of the relationship - * - * @return The source text of the relationship - */ - public String getSourceText() - { - return this.sourceText; - } - - /** - * Sets the source text of the relationship - * - * @param sourceText The source text of the relationship - */ - private void setSourceText(String sourceText) - { - this.sourceText = sourceText; - } - - /** - * Gets the target text of the relationship - * - * @return The target text of the relationship - */ - public String getTargetText() - { - return this.targetText; - } - - /** - * Sets the target text of the relationship - * - * @param targetText The target text of the relationship - */ - private void setTargetText(String targetText) - { - this.targetText = targetText; - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("(") - .append("source=").append(sourceText) - .append(", target=").append(targetText) - .append(")"); - return sb.toString(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.relationship; + +import static org.alfresco.util.ParameterCheck.mandatoryString; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * POJO representing the relationship display name + * + * @author Tuna Aksoy + * @since 2.3 + */ +@AlfrescoPublicApi +public class RelationshipDisplayName +{ + /** The source text of the relationship */ + private String sourceText; + + /** The target text of the relationship */ + private String targetText; + + /** + * Constructor for creating the relationship display name. + * In case of a bidirectional relationship the source + * text and target text will be the same. + * + * @param sourceText The source text of the relationship + * @param targetText The target text of the relationship + */ + public RelationshipDisplayName(String sourceText, String targetText) + { + mandatoryString("sourceText", sourceText); + mandatoryString("targetText", targetText); + + setSourceText(sourceText); + setTargetText(targetText); + } + + /** + * Gets the source text of the relationship + * + * @return The source text of the relationship + */ + public String getSourceText() + { + return this.sourceText; + } + + /** + * Sets the source text of the relationship + * + * @param sourceText The source text of the relationship + */ + private void setSourceText(String sourceText) + { + this.sourceText = sourceText; + } + + /** + * Gets the target text of the relationship + * + * @return The target text of the relationship + */ + public String getTargetText() + { + return this.targetText; + } + + /** + * Sets the target text of the relationship + * + * @param targetText The target text of the relationship + */ + private void setTargetText(String targetText) + { + this.targetText = targetText; + } + + /** + * @see java.lang.Object#toString() + */ + @Override + public String toString() + { + StringBuilder sb = new StringBuilder(); + sb.append("(") + .append("source=").append(sourceText) + .append(", target=").append(targetText) + .append(")"); + return sb.toString(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java index c22f53105a..26e6ed5bc0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java @@ -1,166 +1,166 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.relationship; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import java.io.Serializable; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Relationship implementation - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipImpl implements Relationship, Serializable -{ - /** serial UID */ - private static final long serialVersionUID = 9120649510198344978L; - - /** The unique name of the relationship */ - private String uniqueName; - - /** The source of the relationship */ - private NodeRef source; - - /** The target of the relationship */ - private NodeRef target; - - /** - * Constructor for creating a relationship - * - * @param uniqueName The unique name of the relationship - * @param source The source of the relationship - * @param target The target of the relationship - */ - public RelationshipImpl(String uniqueName, NodeRef source, NodeRef target) - { - mandatoryString("uniqueName", uniqueName); - mandatory("source", source); - mandatory("target", target); - - setUniqueName(uniqueName); - setSource(source); - setTarget(target); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getUniqueName() - */ - @Override - public String getUniqueName() - { - return uniqueName; - } - - /** - * Sets the unique name of the relationship - * - * @param uniqueName The unique name of the relationship - */ - private void setUniqueName(String uniqueName) - { - this.uniqueName = uniqueName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getSource() - */ - @Override - public NodeRef getSource() - { - return source; - } - - /** - * Sets the source of the relationship - * - * @param source The source of the relationship - */ - private void setSource(NodeRef source) - { - this.source = source; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getTarget() - */ - @Override - public NodeRef getTarget() - { - return target; - } - - /** - * Sets the target of the relationship - * - * @param target The target of the relationship - */ - private void setTarget(NodeRef target) - { - this.target = target; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj instanceof Relationship) - { - RelationshipImpl that = (RelationshipImpl) obj; - return (this.uniqueName.equals(that.uniqueName) - && this.source.equals(that.source) - && this.target.equals(that.target)); - } - else - { - return false; - } - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() - { - int prime = 31; - int result = prime + uniqueName.hashCode(); - result = (prime*result) + source.hashCode(); - return (prime*result) + target.hashCode(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.relationship; + +import static org.alfresco.util.ParameterCheck.mandatory; +import static org.alfresco.util.ParameterCheck.mandatoryString; + +import java.io.Serializable; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Relationship implementation + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RelationshipImpl implements Relationship, Serializable +{ + /** serial UID */ + private static final long serialVersionUID = 9120649510198344978L; + + /** The unique name of the relationship */ + private String uniqueName; + + /** The source of the relationship */ + private NodeRef source; + + /** The target of the relationship */ + private NodeRef target; + + /** + * Constructor for creating a relationship + * + * @param uniqueName The unique name of the relationship + * @param source The source of the relationship + * @param target The target of the relationship + */ + public RelationshipImpl(String uniqueName, NodeRef source, NodeRef target) + { + mandatoryString("uniqueName", uniqueName); + mandatory("source", source); + mandatory("target", target); + + setUniqueName(uniqueName); + setSource(source); + setTarget(target); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getUniqueName() + */ + @Override + public String getUniqueName() + { + return uniqueName; + } + + /** + * Sets the unique name of the relationship + * + * @param uniqueName The unique name of the relationship + */ + private void setUniqueName(String uniqueName) + { + this.uniqueName = uniqueName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getSource() + */ + @Override + public NodeRef getSource() + { + return source; + } + + /** + * Sets the source of the relationship + * + * @param source The source of the relationship + */ + private void setSource(NodeRef source) + { + this.source = source; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getTarget() + */ + @Override + public NodeRef getTarget() + { + return target; + } + + /** + * Sets the target of the relationship + * + * @param target The target of the relationship + */ + private void setTarget(NodeRef target) + { + this.target = target; + } + + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) + { + if (this == obj) + { + return true; + } + if (obj instanceof Relationship) + { + RelationshipImpl that = (RelationshipImpl) obj; + return (this.uniqueName.equals(that.uniqueName) + && this.source.equals(that.source) + && this.target.equals(that.target)); + } + else + { + return false; + } + } + + /** + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() + { + int prime = 31; + int result = prime + uniqueName.hashCode(); + result = (prime*result) + source.hashCode(); + return (prime*result) + target.hashCode(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java index e8500f49c9..208e647dea 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java @@ -1,158 +1,158 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.relationship; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * The relationship service interface - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public interface RelationshipService -{ - /** System relationship names */ - static final String RELATIONSHIP_VERSIONS = "versions"; - - /** - * Gets all the existing relationship definitions - * - * @return All existing relationship definitions - */ - Set getRelationshipDefinitions(); - - /** - * Gets the relationship definition for the given unique name - * - * @param uniqueName The unique name of the relationship definition - * @return The relationship definition for the given unique name if it exist, null otherwise - */ - RelationshipDefinition getRelationshipDefinition(String uniqueName); - - /** - * Creates a relationship definition using the display name - * - * @param displayName The display name of the relationship definition - * @return The new relationship definition - */ - RelationshipDefinition createRelationshipDefinition(RelationshipDisplayName displayName); - - /** - * Updates an existing relationship definition - * - * @param uniqueName The unique name of the relationship definition - * @param displayName The display name of the relationship definition - * @return The updated relationship definition - */ - RelationshipDefinition updateRelationshipDefinition(String uniqueName, RelationshipDisplayName displayName); - - /** - * Removes a relationship definition - * - * @param uniqueName The unique name of the relationship definition - * @return true if the relationship definition was removed successfully, false otherwise - */ - boolean removeRelationshipDefinition(String uniqueName); - - /** - * Checks if a relationship exists or not - * - * @param uniqueName The unique name of the relationship definition - * @return true if the relationship definition exists, false otherwise - */ - boolean existsRelationshipDefinition(String uniqueName); - - /** - * Gets all the relationships that come out from the given node reference - * - * @param nodeRef The node reference - * @return All relationships that come out from the given node reference - */ - Set getRelationshipsFrom(NodeRef nodeRef); - - /** - * Gets all the relationships that come out from the given node reference - * that match the a given name filter. - *

- * Exact match only. - * - * @param nodeRef The node reference - * @param nameFilter Name filter for results - * @return All relationships that come out from the given node reference - * - * @since 2.3.1 - */ - Set getRelationshipsFrom(NodeRef nodeRef, String nameFilter); - - /** - * Gets all the relationships that go into the given node reference - * - * @param nodeRef The node reference - * @return All relationships that go into the given node reference - */ - Set getRelationshipsTo(NodeRef nodeRef); - - /** - * Gets all the relationships that go into the given node reference - * that match the a given name filter. - *

- * Exact match only. - * - * @param nodeRef The node reference - * @param nameFilter Name filter for results - * @return All relationships that go into the given node reference - * - * @since 2.3.1 - */ - Set getRelationshipsTo(NodeRef nodeRef, String nameFilter); - - /** - * Adds a relationship from the given node source - * to the give node target with the given unique name - * - * @param uniqueName The unique name of the relationship - * @param source The node reference which the relationship come from - * @param target The node reference which the relationship go to - */ - void addRelationship(String uniqueName, NodeRef source, NodeRef target); - - /** - * Removes the relationship from the given node source - * to the given node target with the given unique name - * - * @param uniqueName The unique name of the relationship - * @param source The node reference which the relationship come from - * @param target The node reference which the relationship go to - */ - void removeRelationship(String uniqueName, NodeRef source, NodeRef target); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.relationship; + +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * The relationship service interface + * + * @author Tuna Aksoy + * @since 2.3 + */ +@AlfrescoPublicApi +public interface RelationshipService +{ + /** System relationship names */ + static final String RELATIONSHIP_VERSIONS = "versions"; + + /** + * Gets all the existing relationship definitions + * + * @return All existing relationship definitions + */ + Set getRelationshipDefinitions(); + + /** + * Gets the relationship definition for the given unique name + * + * @param uniqueName The unique name of the relationship definition + * @return The relationship definition for the given unique name if it exist, null otherwise + */ + RelationshipDefinition getRelationshipDefinition(String uniqueName); + + /** + * Creates a relationship definition using the display name + * + * @param displayName The display name of the relationship definition + * @return The new relationship definition + */ + RelationshipDefinition createRelationshipDefinition(RelationshipDisplayName displayName); + + /** + * Updates an existing relationship definition + * + * @param uniqueName The unique name of the relationship definition + * @param displayName The display name of the relationship definition + * @return The updated relationship definition + */ + RelationshipDefinition updateRelationshipDefinition(String uniqueName, RelationshipDisplayName displayName); + + /** + * Removes a relationship definition + * + * @param uniqueName The unique name of the relationship definition + * @return true if the relationship definition was removed successfully, false otherwise + */ + boolean removeRelationshipDefinition(String uniqueName); + + /** + * Checks if a relationship exists or not + * + * @param uniqueName The unique name of the relationship definition + * @return true if the relationship definition exists, false otherwise + */ + boolean existsRelationshipDefinition(String uniqueName); + + /** + * Gets all the relationships that come out from the given node reference + * + * @param nodeRef The node reference + * @return All relationships that come out from the given node reference + */ + Set getRelationshipsFrom(NodeRef nodeRef); + + /** + * Gets all the relationships that come out from the given node reference + * that match the a given name filter. + *

+ * Exact match only. + * + * @param nodeRef The node reference + * @param nameFilter Name filter for results + * @return All relationships that come out from the given node reference + * + * @since 2.3.1 + */ + Set getRelationshipsFrom(NodeRef nodeRef, String nameFilter); + + /** + * Gets all the relationships that go into the given node reference + * + * @param nodeRef The node reference + * @return All relationships that go into the given node reference + */ + Set getRelationshipsTo(NodeRef nodeRef); + + /** + * Gets all the relationships that go into the given node reference + * that match the a given name filter. + *

+ * Exact match only. + * + * @param nodeRef The node reference + * @param nameFilter Name filter for results + * @return All relationships that go into the given node reference + * + * @since 2.3.1 + */ + Set getRelationshipsTo(NodeRef nodeRef, String nameFilter); + + /** + * Adds a relationship from the given node source + * to the give node target with the given unique name + * + * @param uniqueName The unique name of the relationship + * @param source The node reference which the relationship come from + * @param target The node reference which the relationship go to + */ + void addRelationship(String uniqueName, NodeRef source, NodeRef target); + + /** + * Removes the relationship from the given node source + * to the given node target with the given unique name + * + * @param uniqueName The unique name of the relationship + * @param source The node reference which the relationship come from + * @param target The node reference which the relationship go to + */ + void removeRelationship(String uniqueName, NodeRef source, NodeRef target); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java index 4c15643969..a5d25d6e03 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java @@ -1,969 +1,969 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.relationship; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_FROZEN; -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang.StringUtils.isBlank; - -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeCreateReference; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRemoveReference; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRemoveReference; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminBase; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil; -import org.alfresco.repo.dictionary.M2Aspect; -import org.alfresco.repo.dictionary.M2ClassAssociation; -import org.alfresco.repo.dictionary.M2Model; -import org.alfresco.repo.policy.ClassPolicyDelegate; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.GUID; - -/** - * The relationship service implementation - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipServiceImpl extends RecordsManagementAdminBase implements RelationshipService -{ - /** Policy component */ - private PolicyComponent policyComponent; - - /** - * Gets the policy component instance - * - * @return The policy component instance - */ - private PolicyComponent getPolicyComponent() - { - return this.policyComponent; - } - - /** - * Sets the policy component instance - * - * @param policyComponent The policy component instance - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** Policy delegates */ - private ClassPolicyDelegate beforeCreateReferenceDelegate; - private ClassPolicyDelegate onCreateReferenceDelegate; - private ClassPolicyDelegate beforeRemoveReferenceDelegate; - private ClassPolicyDelegate onRemoveReferenceDelegate; - - /** - * Initialisation method - */ - public void init() - { - // Register the various policies - beforeCreateReferenceDelegate = getPolicyComponent().registerClassPolicy(BeforeCreateReference.class); - onCreateReferenceDelegate = getPolicyComponent().registerClassPolicy(OnCreateReference.class); - beforeRemoveReferenceDelegate = getPolicyComponent().registerClassPolicy(BeforeRemoveReference.class); - onRemoveReferenceDelegate = getPolicyComponent().registerClassPolicy(OnRemoveReference.class); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipDefinitions() - */ - @Override - public Set getRelationshipDefinitions() - { - Set relationshipDefinitions = new HashSet(); - - Set> associationsEntrySet = getCustomAssociations().entrySet(); - for (Map.Entry associationEntry : associationsEntrySet) - { - AssociationDefinition associationDefinition = associationEntry.getValue(); - RelationshipDefinition relationshipDefinition = createRelationshipDefinition(associationDefinition); - if (relationshipDefinition != null) - { - relationshipDefinitions.add(relationshipDefinition); - } - } - - return relationshipDefinitions; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipDefinition(java.lang.String) - */ - @Override - public RelationshipDefinition getRelationshipDefinition(String uniqueName) - { - mandatoryString("uniqueName", uniqueName); - - RelationshipDefinition relationshipDefinition = null; - - AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); - if (associationDefinition != null) - { - relationshipDefinition = createRelationshipDefinition(associationDefinition); - } - - return relationshipDefinition; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName) - */ - @Override - public RelationshipDefinition createRelationshipDefinition(RelationshipDisplayName displayName) - { - mandatory("displayName", displayName); - - String title; - RelationshipType type = determineRelationshipTypeFromDisplayName(displayName); - - switch (type) - { - case BIDIRECTIONAL: - - title = displayName.getSourceText(); - break; - - case PARENTCHILD: - - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - title = composeAssociationDefinitionTitle(sourceText, targetText); - break; - - default: - - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type: '") - .append(type.toString()) - .append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // If this title is already taken... - if (existsTitle(title)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot create a relationship definition for the display name: '") - .append(displayName.toString()) - .append("' as there is already a relationship definition with this display name."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // Defaults to RM_CUSTOM_URI - NodeRef modelRef = getCustomModelRef(""); - M2Model deserializedModel = readCustomContentModel(modelRef); - String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(getNamespaceService()); - M2Aspect customAssocsAspect = deserializedModel.getAspect(customAspectName); - - if (customAssocsAspect == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("The aspect: '") - .append(customAspectName) - .append("' is undefined."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - QName relationshipDefinitionQName = generateRelationshipDefinitionQNameFor(title); - String generatedShortQName = relationshipDefinitionQName.toPrefixString(getNamespaceService()); - - M2ClassAssociation customAssoc = customAssocsAspect.getAssociation(generatedShortQName); - if (customAssoc != null) - { - StringBuilder sb = new StringBuilder(); - sb.append("The association: '") - .append(customAssoc.getName()) - .append("' already exists."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - M2ClassAssociation newAssoc; - - switch (type) - { - case BIDIRECTIONAL: - - newAssoc = customAssocsAspect.createAssociation(generatedShortQName); - break; - - case PARENTCHILD: - - newAssoc = customAssocsAspect.createChildAssociation(generatedShortQName); - break; - - default: - - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type: '") - .append(type.toString()) - .append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - newAssoc.setSourceMandatory(false); - newAssoc.setTargetMandatory(false); - - // MOB-1573 - newAssoc.setSourceMany(true); - newAssoc.setTargetMany(true); - - newAssoc.setTitle(title); - newAssoc.setTargetClassName(RecordsManagementModel.ASPECT_RECORD.toPrefixString(getNamespaceService())); - writeCustomContentModel(modelRef, deserializedModel); - - return new RelationshipDefinitionImpl(relationshipDefinitionQName.getLocalName(), type, displayName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#updateReleationshipDefinition(java.lang.String) - */ - @Override - public RelationshipDefinition updateRelationshipDefinition(String uniqueName, RelationshipDisplayName displayName) - { - mandatoryString("uniqueName", uniqueName); - - RelationshipDefinition relationshipDefinition = getRelationshipDefinition(uniqueName); - if (relationshipDefinition == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("The relationship definition for the unique name '") - .append(uniqueName) - .append("' was not found."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - String title; - RelationshipType type = relationshipDefinition.getType(); - - switch (type) - { - case BIDIRECTIONAL: - - title = displayName.getSourceText(); - - if (isBlank(title)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Label text '") - .append(title) - .append(" cannot be blank."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - break; - - case PARENTCHILD: - - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - - if (isBlank(sourceText) || isBlank(targetText)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Neither source text '") - .append(sourceText) - .append("' nor target text '") - .append(targetText) - .append(" can be blank."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - title = composeAssociationDefinitionTitle(sourceText, targetText); - - break; - - default: - - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type: '") - .append(type.toString()) - .append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - if (existsTitle(title)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot update the relationship definition as '") - .append(title) - .append("' already exists."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - QName associationDefinitionQName = getAssociationDefinitionName(uniqueName); - QName updatedAssociationDefinitionQName = persistUpdatedAssocTitle(associationDefinitionQName, title); - RelationshipDefinition updatedRelationshipDefinition = getRelationshipDefinition(updatedAssociationDefinitionQName.getLocalName()); - - if (updatedRelationshipDefinition == null) - { - throw new AlfrescoRuntimeException("The relationship definition could not be updated successfully."); - } - - return updatedRelationshipDefinition; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#removeRelationshipDefinition(java.lang.String) - */ - @Override - public boolean removeRelationshipDefinition(String uniqueName) - { - mandatoryString("uniqueName", uniqueName); - - throw new UnsupportedOperationException("It is not possible to remove a relationship."); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#existsRelationshipDefinition(java.lang.String) - */ - @Override - public boolean existsRelationshipDefinition(String uniqueName) - { - mandatoryString("uniqueName", uniqueName); - - boolean exists = false; - - RelationshipDefinition relationshipDefinition = getRelationshipDefinition(uniqueName); - if (relationshipDefinition != null) - { - exists = true; - } - - return exists; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsFrom(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Set getRelationshipsFrom(NodeRef nodeRef) - { - return getRelationshipsFrom(nodeRef, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsFrom(org.alfresco.service.cmr.repository.NodeRef, String) - */ - @Override - public Set getRelationshipsFrom(NodeRef nodeRef, String nameFilter) - { - mandatory("nodeRef", nodeRef); - - Set relationships = new HashSet(); - - List customReferencesFrom = getNodeService().getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); - relationships.addAll(generateRelationshipFromAssociationRef(customReferencesFrom, nameFilter)); - - List customChildReferences = getNodeService().getChildAssocs(nodeRef); - relationships.addAll(generateRelationshipFromParentChildAssociationRef(customChildReferences, nameFilter)); - - return relationships; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsTo(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Set getRelationshipsTo(NodeRef nodeRef) - { - return getRelationshipsTo(nodeRef, null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsTo(org.alfresco.service.cmr.repository.NodeRef, String) - */ - @Override - public Set getRelationshipsTo(NodeRef nodeRef, String nameFilter) - { - mandatory("nodeRef", nodeRef); - - Set relationships = new HashSet(); - - List customReferencesTo = getNodeService().getSourceAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); - relationships.addAll(generateRelationshipFromAssociationRef(customReferencesTo, nameFilter)); - - List customParentReferences = getNodeService().getParentAssocs(nodeRef); - relationships.addAll(generateRelationshipFromParentChildAssociationRef(customParentReferences, nameFilter)); - - return relationships; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#addRelationship(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void addRelationship(String uniqueName, NodeRef source, NodeRef target) - { - mandatoryString("uniqueName", uniqueName); - mandatory("source", source); - mandatory("target", target); - - // check the source node exists - if (!getNodeService().exists(source)) - { - throw new AlfrescoRuntimeException("Can't create relationship '" + uniqueName + "', because source node doesn't exist."); - } - - // check the target node exists - if (!getNodeService().exists(target)) - { - throw new AlfrescoRuntimeException("Can't create relationship " + uniqueName + ", because target node doesn't exist."); - } - - if (getNodeService().hasAspect(target, ASPECT_FROZEN)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Relationship cannot be created as the target '"). - append(getNodeService().getProperty(target, ContentModel.PROP_NAME)). - append("' is in a hold."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // Check that the association definition for the given unique name exists. - AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); - if (associationDefinition == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("No association definition found for '"). - append(uniqueName). - append("'."); - throw new IllegalArgumentException(sb.toString()); - } - - // Get the association definition name - QName associationDefinitionName = associationDefinition.getName(); - - // Check if an instance of this association already exists in the same direction - boolean associationAlreadyExists = associationExists(associationDefinition, source, target); - - if (associationAlreadyExists) - { - StringBuilder sb = new StringBuilder(); - sb.append("Association '"). - append(associationDefinitionName.getLocalName()). - append("' already exists from '"). - append(source). - append("' to '"). - append(target). - append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // Invoke before create reference policy - invokeBeforeCreateReference(source, target, associationDefinitionName); - - if (associationDefinition.isChild()) - { - getNodeService().addChild(source, target, associationDefinitionName, associationDefinitionName); - } - else - { - getNodeService().createAssociation(source, target, associationDefinitionName); - } - - // Invoke on create reference policy - invokeOnCreateReference(source, target, associationDefinitionName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#removeRelationship(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void removeRelationship(String uniqueName, NodeRef source, NodeRef target) - { - mandatoryString("uniqueName", uniqueName); - mandatory("source", source); - mandatory("target", target); - - // Check that the association definition for the given unique name exists. - AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); - if (associationDefinition == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("No association definition found for '"). - append(uniqueName). - append("'."); - throw new IllegalArgumentException(sb.toString()); - } - - // Get the association definition name - final QName associationDefinitionName = associationDefinition.getName(); - final NodeRef targetNode = target; - final NodeRef sourceNode = source; - - invokeBeforeRemoveReference(sourceNode, targetNode, associationDefinitionName); - - if (associationDefinition.isChild()) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - List children = getNodeService().getChildAssocs(sourceNode); - for (ChildAssociationRef chRef : children) - { - if (associationDefinitionName.equals(chRef.getTypeQName()) && chRef.getChildRef().equals(targetNode)) - { - getNodeService().removeChildAssociation(chRef); - } - } - - return null; - } - }); - } - else - { - getNodeService().removeAssociation(source, targetNode, associationDefinitionName); - } - - invokeOnRemoveReference(source, targetNode, associationDefinitionName); - } - - /** - * Creates the relationship definition from the association definition - * - * @param associationDefinition The association definition - * @return The relationship definition if associationDefinition exists, null otherwise - */ - private RelationshipDefinition createRelationshipDefinition(AssociationDefinition associationDefinition) - { - RelationshipDefinition relationshipDefinition = null; - - if (associationDefinition != null) - { - String uniqueName = associationDefinition.getName().getLocalName(); - - RelationshipType type = getRelationshipType(associationDefinition); - - String title = associationDefinition.getTitle(getDictionaryService()); - RelationshipDisplayName displayName = getRelationshipDisplayName(type, title); - - relationshipDefinition = new RelationshipDefinitionImpl(uniqueName, type, displayName); - } - - return relationshipDefinition; - } - - /** - * Gets the relationship type from the association definition - * - * @param associationDefinition The association definition - * @return The type of the relationship definition - */ - private RelationshipType getRelationshipType(AssociationDefinition associationDefinition) - { - RelationshipType type; - - if (associationDefinition instanceof ChildAssociationDefinition) - { - type = RelationshipType.PARENTCHILD; - } - else - { - type = RelationshipType.BIDIRECTIONAL; - } - - return type; - } - - /** - * Gets the relationship display name of the relationship definition - * - * @param type The type of the relationship definition - * @param title The title of the association definition - * @return The relationship display name of the relationship definition - */ - private RelationshipDisplayName getRelationshipDisplayName(RelationshipType type, String title) - { - String sourceText = null; - String targetText = null; - - switch (type) - { - case BIDIRECTIONAL: - - sourceText = title; - targetText = title; - break; - - case PARENTCHILD: - - String[] sourceAndTarget = splitAssociationDefinitionTitle(title); - sourceText = sourceAndTarget[0]; - targetText = sourceAndTarget[1]; - break; - - default: - - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type: '") - .append(type.toString()) - .append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - return new RelationshipDisplayName(sourceText, targetText); - } - - /** - * Generates relationships from the given association references - * - * @param associationRefs Association references - * @return Relationships generated from the given association references - */ - private Set generateRelationshipFromAssociationRef(List associationRefs, String nameFilter) - { - Set relationships = new HashSet(); - - for (AssociationRef associationRef : associationRefs) - { - String uniqueName = associationRef.getTypeQName().getLocalName(); - if (existsRelationshipDefinition(uniqueName) && - (nameFilter == null || uniqueName.equals(nameFilter))) - { - NodeRef from = associationRef.getSourceRef(); - NodeRef to = associationRef.getTargetRef(); - relationships.add(new RelationshipImpl(uniqueName, from, to)); - } - } - - return relationships; - } - - /** - * Generates relationships from the given child association references - * - * @param childAssociationRefs Child association references - * @return Relationships generated from the given child association references - */ - private Set generateRelationshipFromParentChildAssociationRef(List childAssociationRefs, String nameFilter) - { - Set relationships = new HashSet(); - - for (ChildAssociationRef childAssociationRef : childAssociationRefs) - { - String uniqueName = childAssociationRef.getQName().getLocalName(); - if (existsRelationshipDefinition(uniqueName)&& - (nameFilter == null || uniqueName.equals(nameFilter))) - { - NodeRef from = childAssociationRef.getParentRef(); - NodeRef to = childAssociationRef.getChildRef(); - relationships.add(new RelationshipImpl(uniqueName, from, to)); - } - } - - return relationships; - } - - /** - * Determines the relationship type from the display name - * - * @param displayName The display name of the relationship - * @return The relationship type from the display name - */ - private RelationshipType determineRelationshipTypeFromDisplayName(RelationshipDisplayName displayName) - { - RelationshipType relationshipType; - - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - - String errorMsg = "Relationship type could not be determined from the display name. It is neither biderectional nor parent/child relationship"; - - if (isBlank(sourceText) || isBlank(targetText)) - { - throw new AlfrescoRuntimeException(errorMsg); - } - - if (sourceText.equals(targetText)) - { - relationshipType = RelationshipType.BIDIRECTIONAL; - } - else - { - relationshipType = RelationshipType.PARENTCHILD; - } - - return relationshipType; - } - - /** - * Invoke before create reference policy - * - * @param source The source node reference - * @param target The target node reference - * @param associationDefinitionName The association definition name - */ - private void invokeBeforeCreateReference(NodeRef source, NodeRef target, QName associationDefinitionName) - { - // Get QNames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); - // Execute policy for node type and aspects - BeforeCreateReference policy = beforeCreateReferenceDelegate.get(qnames); - policy.beforeCreateReference(source, target, associationDefinitionName); - } - - /** - * Invoke on create reference policy - * - * @param source The source node reference - * @param target The target node reference - * @param associationDefinitionName The association definition name - */ - private void invokeOnCreateReference(NodeRef source, NodeRef target, QName associationDefinitionName) - { - // Get QNames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); - // Execute policy for node type and aspects - OnCreateReference policy = onCreateReferenceDelegate.get(qnames); - policy.onCreateReference(source, target, associationDefinitionName); - } - - /** - * Invoke before remove reference policy - * - * @param source The source node reference - * @param target The target node reference - * @param associationDefinitionName The association definition name - */ - private void invokeBeforeRemoveReference(NodeRef source, NodeRef target, QName associationDefinitionName) - { - // Get QNames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); - // Execute policy for node type and aspects - BeforeRemoveReference policy = beforeRemoveReferenceDelegate.get(qnames); - policy.beforeRemoveReference(source, target, associationDefinitionName); - } - - /** - * Invoke on remove reference policy - * - * @param source The source node reference - * @param target The target node reference - * @param associationDefinitionName The association definition name - */ - private void invokeOnRemoveReference(NodeRef source, NodeRef target, QName associationDefinitionName) - { - // Get QNames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); - // Execute policy for node type and aspects - OnRemoveReference policy = onRemoveReferenceDelegate.get(qnames); - policy.onRemoveReference(source, target, associationDefinitionName); - } - - /** - * Check if an instance of the association already exists from the given - * source node reference to the given target node reference - * - * @param associationDefinition The association definition - * @param source The source node reference - * @param target The target node reference - * @return true if an association already exists, false otherwise - */ - private boolean associationExists(AssociationDefinition associationDefinition, NodeRef source, NodeRef target) - { - boolean associationAlreadyExists = false; - - QName associationDefinitionName = associationDefinition.getName(); - if (associationDefinition.isChild()) - { - List childAssocs = getNodeService().getChildAssocs(source, associationDefinitionName, associationDefinitionName); - for (ChildAssociationRef chAssRef : childAssocs) - { - if (chAssRef.getChildRef().equals(target)) - { - associationAlreadyExists = true; - } - } - } - else - { - List assocs = getNodeService().getTargetAssocs(source, associationDefinitionName); - for (AssociationRef assRef : assocs) - { - if (assRef.getTargetRef().equals(target)) - { - associationAlreadyExists = true; - } - } - } - - return associationAlreadyExists; - } - - /** - * Gets the association definition for the given unique name - * - * @param uniqueName The unique name - * @return The association definition for the given unique name if exists, null otherwise - */ - private AssociationDefinition getAssociationDefinition(String uniqueName) - { - AssociationDefinition associationDefinition = null; - - Set> associationsEntrySet = getCustomAssociations().entrySet(); - for (Map.Entry associationEntry : associationsEntrySet) - { - String localName = associationEntry.getKey().getLocalName(); - if (uniqueName.equals(localName)) - { - associationDefinition = associationEntry.getValue(); - break; - } - } - - return associationDefinition; - } - - /** - * Gets the qualified name of the association definition for the given unique name - * - * @param uniqueName The unique name - * @return The qualified name of the association definition for the given unique name - */ - private QName getAssociationDefinitionName(String uniqueName) - { - AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); - - if (associationDefinition == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("The qualified name for '") - .append(uniqueName) - .append("' was not found."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - return associationDefinition.getName(); - } - - /** - * This method writes the specified String into the association's title property. - * For RM custom properties and references, Title is used to store the identifier. - * - * NOTE: Currently RMC custom associations only - * @param associationDefinitionQName Qualified name for the association definition - * @param newTitle The new title - * @return Qualified name for the association definition - */ - private QName persistUpdatedAssocTitle(QName associationDefinitionQName, String newTitle) - { - mandatory("associationDefinitionQName", associationDefinitionQName); - - AssociationDefinition assocDefn = getDictionaryService().getAssociation(associationDefinitionQName); - if (assocDefn == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot find the association definiton for '"). - append(associationDefinitionQName.getLocalName()). - append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // defaults to RM_CUSTOM_URI - NodeRef modelRef = getCustomModelRef(""); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(getNamespaceService()); - M2Aspect customAssocsAspect = deserializedModel.getAspect(customAspectName); - - for (M2ClassAssociation assoc : customAssocsAspect.getAssociations()) - { - if (associationDefinitionQName.toPrefixString(getNamespaceService()).equals(assoc.getName()) && newTitle != null) - { - assoc.setTitle(newTitle); - } - } - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("persistUpdatedAssocTitle: " + associationDefinitionQName + "=" + newTitle + " to aspect: " + customAspectName); - } - - return associationDefinitionQName; - } - - /** - * Generates a qualified name for the given relationship definition unique name - * - * @param uniqueName The unique name of the relationship definition - * @return The qualified name of relationship definition - */ - private QName generateRelationshipDefinitionQNameFor(String uniqueName) - { - mandatoryString("uniqueName", uniqueName); - - QName existingQName = null; - - Set customAssociationsQNames = getCustomAssociations().keySet(); - for (QName customAssociationsQName : customAssociationsQNames) - { - if (uniqueName.equals(customAssociationsQName.getLocalName())) - { - existingQName = customAssociationsQName; - } - } - - if (existingQName != null) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot create qualified name for given unique name '"). - append(uniqueName). - append("' as it already exists."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - return QName.createQName(RM_CUSTOM_PREFIX, GUID.generate(), getNamespaceService()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.relationship; + +import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_FROZEN; +import static org.alfresco.util.ParameterCheck.mandatory; +import static org.alfresco.util.ParameterCheck.mandatoryString; +import static org.apache.commons.lang.StringUtils.isBlank; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeCreateReference; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRemoveReference; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRemoveReference; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminBase; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil; +import org.alfresco.repo.dictionary.M2Aspect; +import org.alfresco.repo.dictionary.M2ClassAssociation; +import org.alfresco.repo.dictionary.M2Model; +import org.alfresco.repo.policy.ClassPolicyDelegate; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.GUID; + +/** + * The relationship service implementation + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RelationshipServiceImpl extends RecordsManagementAdminBase implements RelationshipService +{ + /** Policy component */ + private PolicyComponent policyComponent; + + /** + * Gets the policy component instance + * + * @return The policy component instance + */ + private PolicyComponent getPolicyComponent() + { + return this.policyComponent; + } + + /** + * Sets the policy component instance + * + * @param policyComponent The policy component instance + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + /** Policy delegates */ + private ClassPolicyDelegate beforeCreateReferenceDelegate; + private ClassPolicyDelegate onCreateReferenceDelegate; + private ClassPolicyDelegate beforeRemoveReferenceDelegate; + private ClassPolicyDelegate onRemoveReferenceDelegate; + + /** + * Initialisation method + */ + public void init() + { + // Register the various policies + beforeCreateReferenceDelegate = getPolicyComponent().registerClassPolicy(BeforeCreateReference.class); + onCreateReferenceDelegate = getPolicyComponent().registerClassPolicy(OnCreateReference.class); + beforeRemoveReferenceDelegate = getPolicyComponent().registerClassPolicy(BeforeRemoveReference.class); + onRemoveReferenceDelegate = getPolicyComponent().registerClassPolicy(OnRemoveReference.class); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipDefinitions() + */ + @Override + public Set getRelationshipDefinitions() + { + Set relationshipDefinitions = new HashSet(); + + Set> associationsEntrySet = getCustomAssociations().entrySet(); + for (Map.Entry associationEntry : associationsEntrySet) + { + AssociationDefinition associationDefinition = associationEntry.getValue(); + RelationshipDefinition relationshipDefinition = createRelationshipDefinition(associationDefinition); + if (relationshipDefinition != null) + { + relationshipDefinitions.add(relationshipDefinition); + } + } + + return relationshipDefinitions; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipDefinition(java.lang.String) + */ + @Override + public RelationshipDefinition getRelationshipDefinition(String uniqueName) + { + mandatoryString("uniqueName", uniqueName); + + RelationshipDefinition relationshipDefinition = null; + + AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); + if (associationDefinition != null) + { + relationshipDefinition = createRelationshipDefinition(associationDefinition); + } + + return relationshipDefinition; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName) + */ + @Override + public RelationshipDefinition createRelationshipDefinition(RelationshipDisplayName displayName) + { + mandatory("displayName", displayName); + + String title; + RelationshipType type = determineRelationshipTypeFromDisplayName(displayName); + + switch (type) + { + case BIDIRECTIONAL: + + title = displayName.getSourceText(); + break; + + case PARENTCHILD: + + String sourceText = displayName.getSourceText(); + String targetText = displayName.getTargetText(); + title = composeAssociationDefinitionTitle(sourceText, targetText); + break; + + default: + + StringBuilder sb = new StringBuilder(); + sb.append("Unsupported relationship type: '") + .append(type.toString()) + .append("'."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + // If this title is already taken... + if (existsTitle(title)) + { + StringBuilder sb = new StringBuilder(); + sb.append("Cannot create a relationship definition for the display name: '") + .append(displayName.toString()) + .append("' as there is already a relationship definition with this display name."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + // Defaults to RM_CUSTOM_URI + NodeRef modelRef = getCustomModelRef(""); + M2Model deserializedModel = readCustomContentModel(modelRef); + String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(getNamespaceService()); + M2Aspect customAssocsAspect = deserializedModel.getAspect(customAspectName); + + if (customAssocsAspect == null) + { + StringBuilder sb = new StringBuilder(); + sb.append("The aspect: '") + .append(customAspectName) + .append("' is undefined."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + QName relationshipDefinitionQName = generateRelationshipDefinitionQNameFor(title); + String generatedShortQName = relationshipDefinitionQName.toPrefixString(getNamespaceService()); + + M2ClassAssociation customAssoc = customAssocsAspect.getAssociation(generatedShortQName); + if (customAssoc != null) + { + StringBuilder sb = new StringBuilder(); + sb.append("The association: '") + .append(customAssoc.getName()) + .append("' already exists."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + M2ClassAssociation newAssoc; + + switch (type) + { + case BIDIRECTIONAL: + + newAssoc = customAssocsAspect.createAssociation(generatedShortQName); + break; + + case PARENTCHILD: + + newAssoc = customAssocsAspect.createChildAssociation(generatedShortQName); + break; + + default: + + StringBuilder sb = new StringBuilder(); + sb.append("Unsupported relationship type: '") + .append(type.toString()) + .append("'."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + newAssoc.setSourceMandatory(false); + newAssoc.setTargetMandatory(false); + + // MOB-1573 + newAssoc.setSourceMany(true); + newAssoc.setTargetMany(true); + + newAssoc.setTitle(title); + newAssoc.setTargetClassName(RecordsManagementModel.ASPECT_RECORD.toPrefixString(getNamespaceService())); + writeCustomContentModel(modelRef, deserializedModel); + + return new RelationshipDefinitionImpl(relationshipDefinitionQName.getLocalName(), type, displayName); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#updateReleationshipDefinition(java.lang.String) + */ + @Override + public RelationshipDefinition updateRelationshipDefinition(String uniqueName, RelationshipDisplayName displayName) + { + mandatoryString("uniqueName", uniqueName); + + RelationshipDefinition relationshipDefinition = getRelationshipDefinition(uniqueName); + if (relationshipDefinition == null) + { + StringBuilder sb = new StringBuilder(); + sb.append("The relationship definition for the unique name '") + .append(uniqueName) + .append("' was not found."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + String title; + RelationshipType type = relationshipDefinition.getType(); + + switch (type) + { + case BIDIRECTIONAL: + + title = displayName.getSourceText(); + + if (isBlank(title)) + { + StringBuilder sb = new StringBuilder(); + sb.append("Label text '") + .append(title) + .append(" cannot be blank."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + break; + + case PARENTCHILD: + + String sourceText = displayName.getSourceText(); + String targetText = displayName.getTargetText(); + + if (isBlank(sourceText) || isBlank(targetText)) + { + StringBuilder sb = new StringBuilder(); + sb.append("Neither source text '") + .append(sourceText) + .append("' nor target text '") + .append(targetText) + .append(" can be blank."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + title = composeAssociationDefinitionTitle(sourceText, targetText); + + break; + + default: + + StringBuilder sb = new StringBuilder(); + sb.append("Unsupported relationship type: '") + .append(type.toString()) + .append("'."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + if (existsTitle(title)) + { + StringBuilder sb = new StringBuilder(); + sb.append("Cannot update the relationship definition as '") + .append(title) + .append("' already exists."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + QName associationDefinitionQName = getAssociationDefinitionName(uniqueName); + QName updatedAssociationDefinitionQName = persistUpdatedAssocTitle(associationDefinitionQName, title); + RelationshipDefinition updatedRelationshipDefinition = getRelationshipDefinition(updatedAssociationDefinitionQName.getLocalName()); + + if (updatedRelationshipDefinition == null) + { + throw new AlfrescoRuntimeException("The relationship definition could not be updated successfully."); + } + + return updatedRelationshipDefinition; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#removeRelationshipDefinition(java.lang.String) + */ + @Override + public boolean removeRelationshipDefinition(String uniqueName) + { + mandatoryString("uniqueName", uniqueName); + + throw new UnsupportedOperationException("It is not possible to remove a relationship."); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#existsRelationshipDefinition(java.lang.String) + */ + @Override + public boolean existsRelationshipDefinition(String uniqueName) + { + mandatoryString("uniqueName", uniqueName); + + boolean exists = false; + + RelationshipDefinition relationshipDefinition = getRelationshipDefinition(uniqueName); + if (relationshipDefinition != null) + { + exists = true; + } + + return exists; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsFrom(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Set getRelationshipsFrom(NodeRef nodeRef) + { + return getRelationshipsFrom(nodeRef, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsFrom(org.alfresco.service.cmr.repository.NodeRef, String) + */ + @Override + public Set getRelationshipsFrom(NodeRef nodeRef, String nameFilter) + { + mandatory("nodeRef", nodeRef); + + Set relationships = new HashSet(); + + List customReferencesFrom = getNodeService().getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); + relationships.addAll(generateRelationshipFromAssociationRef(customReferencesFrom, nameFilter)); + + List customChildReferences = getNodeService().getChildAssocs(nodeRef); + relationships.addAll(generateRelationshipFromParentChildAssociationRef(customChildReferences, nameFilter)); + + return relationships; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsTo(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Set getRelationshipsTo(NodeRef nodeRef) + { + return getRelationshipsTo(nodeRef, null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsTo(org.alfresco.service.cmr.repository.NodeRef, String) + */ + @Override + public Set getRelationshipsTo(NodeRef nodeRef, String nameFilter) + { + mandatory("nodeRef", nodeRef); + + Set relationships = new HashSet(); + + List customReferencesTo = getNodeService().getSourceAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); + relationships.addAll(generateRelationshipFromAssociationRef(customReferencesTo, nameFilter)); + + List customParentReferences = getNodeService().getParentAssocs(nodeRef); + relationships.addAll(generateRelationshipFromParentChildAssociationRef(customParentReferences, nameFilter)); + + return relationships; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#addRelationship(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void addRelationship(String uniqueName, NodeRef source, NodeRef target) + { + mandatoryString("uniqueName", uniqueName); + mandatory("source", source); + mandatory("target", target); + + // check the source node exists + if (!getNodeService().exists(source)) + { + throw new AlfrescoRuntimeException("Can't create relationship '" + uniqueName + "', because source node doesn't exist."); + } + + // check the target node exists + if (!getNodeService().exists(target)) + { + throw new AlfrescoRuntimeException("Can't create relationship " + uniqueName + ", because target node doesn't exist."); + } + + if (getNodeService().hasAspect(target, ASPECT_FROZEN)) + { + StringBuilder sb = new StringBuilder(); + sb.append("Relationship cannot be created as the target '"). + append(getNodeService().getProperty(target, ContentModel.PROP_NAME)). + append("' is in a hold."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + // Check that the association definition for the given unique name exists. + AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); + if (associationDefinition == null) + { + StringBuilder sb = new StringBuilder(); + sb.append("No association definition found for '"). + append(uniqueName). + append("'."); + throw new IllegalArgumentException(sb.toString()); + } + + // Get the association definition name + QName associationDefinitionName = associationDefinition.getName(); + + // Check if an instance of this association already exists in the same direction + boolean associationAlreadyExists = associationExists(associationDefinition, source, target); + + if (associationAlreadyExists) + { + StringBuilder sb = new StringBuilder(); + sb.append("Association '"). + append(associationDefinitionName.getLocalName()). + append("' already exists from '"). + append(source). + append("' to '"). + append(target). + append("'."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + // Invoke before create reference policy + invokeBeforeCreateReference(source, target, associationDefinitionName); + + if (associationDefinition.isChild()) + { + getNodeService().addChild(source, target, associationDefinitionName, associationDefinitionName); + } + else + { + getNodeService().createAssociation(source, target, associationDefinitionName); + } + + // Invoke on create reference policy + invokeOnCreateReference(source, target, associationDefinitionName); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#removeRelationship(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void removeRelationship(String uniqueName, NodeRef source, NodeRef target) + { + mandatoryString("uniqueName", uniqueName); + mandatory("source", source); + mandatory("target", target); + + // Check that the association definition for the given unique name exists. + AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); + if (associationDefinition == null) + { + StringBuilder sb = new StringBuilder(); + sb.append("No association definition found for '"). + append(uniqueName). + append("'."); + throw new IllegalArgumentException(sb.toString()); + } + + // Get the association definition name + final QName associationDefinitionName = associationDefinition.getName(); + final NodeRef targetNode = target; + final NodeRef sourceNode = source; + + invokeBeforeRemoveReference(sourceNode, targetNode, associationDefinitionName); + + if (associationDefinition.isChild()) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + List children = getNodeService().getChildAssocs(sourceNode); + for (ChildAssociationRef chRef : children) + { + if (associationDefinitionName.equals(chRef.getTypeQName()) && chRef.getChildRef().equals(targetNode)) + { + getNodeService().removeChildAssociation(chRef); + } + } + + return null; + } + }); + } + else + { + getNodeService().removeAssociation(source, targetNode, associationDefinitionName); + } + + invokeOnRemoveReference(source, targetNode, associationDefinitionName); + } + + /** + * Creates the relationship definition from the association definition + * + * @param associationDefinition The association definition + * @return The relationship definition if associationDefinition exists, null otherwise + */ + private RelationshipDefinition createRelationshipDefinition(AssociationDefinition associationDefinition) + { + RelationshipDefinition relationshipDefinition = null; + + if (associationDefinition != null) + { + String uniqueName = associationDefinition.getName().getLocalName(); + + RelationshipType type = getRelationshipType(associationDefinition); + + String title = associationDefinition.getTitle(getDictionaryService()); + RelationshipDisplayName displayName = getRelationshipDisplayName(type, title); + + relationshipDefinition = new RelationshipDefinitionImpl(uniqueName, type, displayName); + } + + return relationshipDefinition; + } + + /** + * Gets the relationship type from the association definition + * + * @param associationDefinition The association definition + * @return The type of the relationship definition + */ + private RelationshipType getRelationshipType(AssociationDefinition associationDefinition) + { + RelationshipType type; + + if (associationDefinition instanceof ChildAssociationDefinition) + { + type = RelationshipType.PARENTCHILD; + } + else + { + type = RelationshipType.BIDIRECTIONAL; + } + + return type; + } + + /** + * Gets the relationship display name of the relationship definition + * + * @param type The type of the relationship definition + * @param title The title of the association definition + * @return The relationship display name of the relationship definition + */ + private RelationshipDisplayName getRelationshipDisplayName(RelationshipType type, String title) + { + String sourceText = null; + String targetText = null; + + switch (type) + { + case BIDIRECTIONAL: + + sourceText = title; + targetText = title; + break; + + case PARENTCHILD: + + String[] sourceAndTarget = splitAssociationDefinitionTitle(title); + sourceText = sourceAndTarget[0]; + targetText = sourceAndTarget[1]; + break; + + default: + + StringBuilder sb = new StringBuilder(); + sb.append("Unsupported relationship type: '") + .append(type.toString()) + .append("'."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + return new RelationshipDisplayName(sourceText, targetText); + } + + /** + * Generates relationships from the given association references + * + * @param associationRefs Association references + * @return Relationships generated from the given association references + */ + private Set generateRelationshipFromAssociationRef(List associationRefs, String nameFilter) + { + Set relationships = new HashSet(); + + for (AssociationRef associationRef : associationRefs) + { + String uniqueName = associationRef.getTypeQName().getLocalName(); + if (existsRelationshipDefinition(uniqueName) && + (nameFilter == null || uniqueName.equals(nameFilter))) + { + NodeRef from = associationRef.getSourceRef(); + NodeRef to = associationRef.getTargetRef(); + relationships.add(new RelationshipImpl(uniqueName, from, to)); + } + } + + return relationships; + } + + /** + * Generates relationships from the given child association references + * + * @param childAssociationRefs Child association references + * @return Relationships generated from the given child association references + */ + private Set generateRelationshipFromParentChildAssociationRef(List childAssociationRefs, String nameFilter) + { + Set relationships = new HashSet(); + + for (ChildAssociationRef childAssociationRef : childAssociationRefs) + { + String uniqueName = childAssociationRef.getQName().getLocalName(); + if (existsRelationshipDefinition(uniqueName)&& + (nameFilter == null || uniqueName.equals(nameFilter))) + { + NodeRef from = childAssociationRef.getParentRef(); + NodeRef to = childAssociationRef.getChildRef(); + relationships.add(new RelationshipImpl(uniqueName, from, to)); + } + } + + return relationships; + } + + /** + * Determines the relationship type from the display name + * + * @param displayName The display name of the relationship + * @return The relationship type from the display name + */ + private RelationshipType determineRelationshipTypeFromDisplayName(RelationshipDisplayName displayName) + { + RelationshipType relationshipType; + + String sourceText = displayName.getSourceText(); + String targetText = displayName.getTargetText(); + + String errorMsg = "Relationship type could not be determined from the display name. It is neither biderectional nor parent/child relationship"; + + if (isBlank(sourceText) || isBlank(targetText)) + { + throw new AlfrescoRuntimeException(errorMsg); + } + + if (sourceText.equals(targetText)) + { + relationshipType = RelationshipType.BIDIRECTIONAL; + } + else + { + relationshipType = RelationshipType.PARENTCHILD; + } + + return relationshipType; + } + + /** + * Invoke before create reference policy + * + * @param source The source node reference + * @param target The target node reference + * @param associationDefinitionName The association definition name + */ + private void invokeBeforeCreateReference(NodeRef source, NodeRef target, QName associationDefinitionName) + { + // Get QNames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); + // Execute policy for node type and aspects + BeforeCreateReference policy = beforeCreateReferenceDelegate.get(qnames); + policy.beforeCreateReference(source, target, associationDefinitionName); + } + + /** + * Invoke on create reference policy + * + * @param source The source node reference + * @param target The target node reference + * @param associationDefinitionName The association definition name + */ + private void invokeOnCreateReference(NodeRef source, NodeRef target, QName associationDefinitionName) + { + // Get QNames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); + // Execute policy for node type and aspects + OnCreateReference policy = onCreateReferenceDelegate.get(qnames); + policy.onCreateReference(source, target, associationDefinitionName); + } + + /** + * Invoke before remove reference policy + * + * @param source The source node reference + * @param target The target node reference + * @param associationDefinitionName The association definition name + */ + private void invokeBeforeRemoveReference(NodeRef source, NodeRef target, QName associationDefinitionName) + { + // Get QNames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); + // Execute policy for node type and aspects + BeforeRemoveReference policy = beforeRemoveReferenceDelegate.get(qnames); + policy.beforeRemoveReference(source, target, associationDefinitionName); + } + + /** + * Invoke on remove reference policy + * + * @param source The source node reference + * @param target The target node reference + * @param associationDefinitionName The association definition name + */ + private void invokeOnRemoveReference(NodeRef source, NodeRef target, QName associationDefinitionName) + { + // Get QNames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); + // Execute policy for node type and aspects + OnRemoveReference policy = onRemoveReferenceDelegate.get(qnames); + policy.onRemoveReference(source, target, associationDefinitionName); + } + + /** + * Check if an instance of the association already exists from the given + * source node reference to the given target node reference + * + * @param associationDefinition The association definition + * @param source The source node reference + * @param target The target node reference + * @return true if an association already exists, false otherwise + */ + private boolean associationExists(AssociationDefinition associationDefinition, NodeRef source, NodeRef target) + { + boolean associationAlreadyExists = false; + + QName associationDefinitionName = associationDefinition.getName(); + if (associationDefinition.isChild()) + { + List childAssocs = getNodeService().getChildAssocs(source, associationDefinitionName, associationDefinitionName); + for (ChildAssociationRef chAssRef : childAssocs) + { + if (chAssRef.getChildRef().equals(target)) + { + associationAlreadyExists = true; + } + } + } + else + { + List assocs = getNodeService().getTargetAssocs(source, associationDefinitionName); + for (AssociationRef assRef : assocs) + { + if (assRef.getTargetRef().equals(target)) + { + associationAlreadyExists = true; + } + } + } + + return associationAlreadyExists; + } + + /** + * Gets the association definition for the given unique name + * + * @param uniqueName The unique name + * @return The association definition for the given unique name if exists, null otherwise + */ + private AssociationDefinition getAssociationDefinition(String uniqueName) + { + AssociationDefinition associationDefinition = null; + + Set> associationsEntrySet = getCustomAssociations().entrySet(); + for (Map.Entry associationEntry : associationsEntrySet) + { + String localName = associationEntry.getKey().getLocalName(); + if (uniqueName.equals(localName)) + { + associationDefinition = associationEntry.getValue(); + break; + } + } + + return associationDefinition; + } + + /** + * Gets the qualified name of the association definition for the given unique name + * + * @param uniqueName The unique name + * @return The qualified name of the association definition for the given unique name + */ + private QName getAssociationDefinitionName(String uniqueName) + { + AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); + + if (associationDefinition == null) + { + StringBuilder sb = new StringBuilder(); + sb.append("The qualified name for '") + .append(uniqueName) + .append("' was not found."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + return associationDefinition.getName(); + } + + /** + * This method writes the specified String into the association's title property. + * For RM custom properties and references, Title is used to store the identifier. + * + * NOTE: Currently RMC custom associations only + * @param associationDefinitionQName Qualified name for the association definition + * @param newTitle The new title + * @return Qualified name for the association definition + */ + private QName persistUpdatedAssocTitle(QName associationDefinitionQName, String newTitle) + { + mandatory("associationDefinitionQName", associationDefinitionQName); + + AssociationDefinition assocDefn = getDictionaryService().getAssociation(associationDefinitionQName); + if (assocDefn == null) + { + StringBuilder sb = new StringBuilder(); + sb.append("Cannot find the association definiton for '"). + append(associationDefinitionQName.getLocalName()). + append("'."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + // defaults to RM_CUSTOM_URI + NodeRef modelRef = getCustomModelRef(""); + M2Model deserializedModel = readCustomContentModel(modelRef); + + String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(getNamespaceService()); + M2Aspect customAssocsAspect = deserializedModel.getAspect(customAspectName); + + for (M2ClassAssociation assoc : customAssocsAspect.getAssociations()) + { + if (associationDefinitionQName.toPrefixString(getNamespaceService()).equals(assoc.getName()) && newTitle != null) + { + assoc.setTitle(newTitle); + } + } + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("persistUpdatedAssocTitle: " + associationDefinitionQName + "=" + newTitle + " to aspect: " + customAspectName); + } + + return associationDefinitionQName; + } + + /** + * Generates a qualified name for the given relationship definition unique name + * + * @param uniqueName The unique name of the relationship definition + * @return The qualified name of relationship definition + */ + private QName generateRelationshipDefinitionQNameFor(String uniqueName) + { + mandatoryString("uniqueName", uniqueName); + + QName existingQName = null; + + Set customAssociationsQNames = getCustomAssociations().keySet(); + for (QName customAssociationsQName : customAssociationsQNames) + { + if (uniqueName.equals(customAssociationsQName.getLocalName())) + { + existingQName = customAssociationsQName; + } + } + + if (existingQName != null) + { + StringBuilder sb = new StringBuilder(); + sb.append("Cannot create qualified name for given unique name '"). + append(uniqueName). + append("' as it already exists."); + throw new AlfrescoRuntimeException(sb.toString()); + } + + return QName.createQName(RM_CUSTOM_PREFIX, GUID.generate(), getNamespaceService()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java index b1e8201489..76df497eac 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java @@ -1,43 +1,43 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.relationship; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Enum representing the relationship types - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public enum RelationshipType -{ - BIDIRECTIONAL, - PARENTCHILD; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.relationship; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Enum representing the relationship types + * + * @author Tuna Aksoy + * @since 2.3 + */ +@AlfrescoPublicApi +public enum RelationshipType +{ + BIDIRECTIONAL, + PARENTCHILD; +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java index e98a1c2819..44b88a90a4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/Report.java @@ -1,66 +1,66 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.namespace.QName; - -/** - * Report interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface Report -{ - /** - * @return {@link QName} report type - */ - QName getReportType(); - - /** - * @return {@link String} report name - */ - String getReportName(); - - /** - * @return {@link Map}<{@link QName},{@link Serializable}> report properties - */ - Map getReportProperties(); - - /** - * @return {@link ContentReader} content reader to report content - */ - ContentReader getReportContent(); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.namespace.QName; + +/** + * Report interface. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface Report +{ + /** + * @return {@link QName} report type + */ + QName getReportType(); + + /** + * @return {@link String} report name + */ + String getReportName(); + + /** + * @return {@link Map}<{@link QName},{@link Serializable}> report properties + */ + Map getReportProperties(); + + /** + * @return {@link ContentReader} content reader to report content + */ + ContentReader getReportContent(); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportGenerator.java index 2d9ab07d76..edb5f2bdb5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportGenerator.java @@ -1,56 +1,56 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Report generator interface. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface ReportGenerator -{ - /** - * @return {@link QName} report type - */ - QName getReportType(); - - /** - * Generate report. - * - * @param reportedUponNodeRef - * @param mimetype - * @return - */ - Report generateReport(NodeRef reportedUponNodeRef, String mimetype); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Report generator interface. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface ReportGenerator +{ + /** + * @return {@link QName} report type + */ + QName getReportType(); + + /** + * Generate report. + * + * @param reportedUponNodeRef + * @param mimetype + * @return + */ + Report generateReport(NodeRef reportedUponNodeRef, String mimetype); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportModel.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportModel.java index 31aae11506..2d132fc04c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportModel.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportModel.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report; - -import org.alfresco.service.namespace.QName; - -/** - * Helper class containing records management report qualified names - * - * @author Roy Wetherall - * @since 2.1 - */ -public interface ReportModel -{ - /** Namespace details */ - String RMR_URI = "http://www.alfresco.org/model/recordsmanagementreport/1.0"; - String RMR_PREFIX = "rmr"; - - /** base report type */ - QName TYPE_REPORT = QName.createQName(RMR_URI, "report"); - - /** destruction report type */ - QName TYPE_DESTRUCTION_REPORT = QName.createQName(RMR_URI, "destructionReport"); - - /** transfer report type */ - QName TYPE_TRANSFER_REPORT = QName.createQName(RMR_URI, "transferReport"); - - /** - * hold report type - * @since 2.2 - */ - QName TYPE_HOLD_REPORT = QName.createQName(RMR_URI, "holdReport"); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report; + +import org.alfresco.service.namespace.QName; + +/** + * Helper class containing records management report qualified names + * + * @author Roy Wetherall + * @since 2.1 + */ +public interface ReportModel +{ + /** Namespace details */ + String RMR_URI = "http://www.alfresco.org/model/recordsmanagementreport/1.0"; + String RMR_PREFIX = "rmr"; + + /** base report type */ + QName TYPE_REPORT = QName.createQName(RMR_URI, "report"); + + /** destruction report type */ + QName TYPE_DESTRUCTION_REPORT = QName.createQName(RMR_URI, "destructionReport"); + + /** transfer report type */ + QName TYPE_TRANSFER_REPORT = QName.createQName(RMR_URI, "transferReport"); + + /** + * hold report type + * @since 2.2 + */ + QName TYPE_HOLD_REPORT = QName.createQName(RMR_URI, "holdReport"); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java index 3fcc6afbf4..3a99167902 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportService.java @@ -1,89 +1,89 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Report service. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface ReportService -{ - /** - * Register a report generator with the report service. - * - * @param reportGenerator report generator - */ - void registerReportGenerator(ReportGenerator reportGenerator); - - /** - * Get a list of the available report types. - * - * @return {@link Set}<{@link QName}> list of the available report types - */ - Set getReportTypes(); - - /** - * Generate a report of the given type and reported upon node reference. - * - * @param reportType report type - * @param reportedUponNodeRef reported upon node reference - * @return {@link Report} generated report - */ - Report generateReport(QName reportType, NodeRef reportedUponNodeRef); - - /** - * Generate a report for a specified mimetype. - * - * @see #generateReport(QName, NodeRef) - * - * @param reportType report type - * @param reportedUponNodeRef report upon node reference - * @param mimetype report mimetype - * @return {@link Report} generated report - */ - Report generateReport(QName reportType, NodeRef reportedUponNodeRef, String mimetype); - - /** - * File report in the given destination. If the given node reference is a file plan node - * reference the report will be filed in the unfiled records container. - * - * @param nodeRef node reference - * @param report report - * @return NodeRef node reference of the filed report - */ - NodeRef fileReport(NodeRef nodeRef, Report report); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report; + +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Report service. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface ReportService +{ + /** + * Register a report generator with the report service. + * + * @param reportGenerator report generator + */ + void registerReportGenerator(ReportGenerator reportGenerator); + + /** + * Get a list of the available report types. + * + * @return {@link Set}<{@link QName}> list of the available report types + */ + Set getReportTypes(); + + /** + * Generate a report of the given type and reported upon node reference. + * + * @param reportType report type + * @param reportedUponNodeRef reported upon node reference + * @return {@link Report} generated report + */ + Report generateReport(QName reportType, NodeRef reportedUponNodeRef); + + /** + * Generate a report for a specified mimetype. + * + * @see #generateReport(QName, NodeRef) + * + * @param reportType report type + * @param reportedUponNodeRef report upon node reference + * @param mimetype report mimetype + * @return {@link Report} generated report + */ + Report generateReport(QName reportType, NodeRef reportedUponNodeRef, String mimetype); + + /** + * File report in the given destination. If the given node reference is a file plan node + * reference the report will be filed in the unfiled records container. + * + * @param nodeRef node reference + * @param report report + * @return NodeRef node reference of the filed report + */ + NodeRef fileReport(NodeRef nodeRef, Report report); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java index f552d7e9e6..7f9df661c6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/ReportServiceImpl.java @@ -1,134 +1,134 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Report service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ReportServiceImpl extends ServiceBaseImpl - implements ReportService -{ - /** record service */ - protected RecordService recordService; - - /** report generator registry */ - private Map registry = new HashMap(); - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#registerReportGenerator(org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator) - */ - @Override - public void registerReportGenerator(ReportGenerator reportGenerator) - { - ParameterCheck.mandatory("reportGenerator", reportGenerator); - registry.put(reportGenerator.getReportType(), reportGenerator); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#getReportTypes() - */ - @Override - public Set getReportTypes() - { - return registry.keySet(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#generateReport(QName, NodeRef) - */ - @Override - public Report generateReport(QName reportType, NodeRef reportedUponNodeRef) - { - ParameterCheck.mandatory("reportType", reportType); - ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); - - return generateReport(reportType, reportedUponNodeRef, MimetypeMap.MIMETYPE_HTML); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#generateReport(QName, NodeRef, String) - */ - @Override - public Report generateReport(QName reportType, NodeRef reportedUponNodeRef, String mimetype) - { - ParameterCheck.mandatory("reportType", reportType); - ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); - ParameterCheck.mandatoryString("mimetype", mimetype); - - // get the generator - ReportGenerator generator = registry.get(reportType); - - // error is generator not found in registry - if (generator == null) - { - throw new AlfrescoRuntimeException("Unable to generate report, because report type " + reportType.toString() + " does not correspond to a registered report type."); - } - - // generate the report - return generator.generateReport(reportedUponNodeRef, mimetype); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#fileReport(org.alfresco.module.org_alfresco_module_rm.report.Report) - */ - @Override - public NodeRef fileReport(NodeRef nodeRef, Report report) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("report", report); - - return recordService.createRecordFromContent(nodeRef, - report.getReportName(), - report.getReportType(), - report.getReportProperties(), - report.getReportContent()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.ParameterCheck; + +/** + * Report service implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ReportServiceImpl extends ServiceBaseImpl + implements ReportService +{ + /** record service */ + protected RecordService recordService; + + /** report generator registry */ + private Map registry = new HashMap(); + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#registerReportGenerator(org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator) + */ + @Override + public void registerReportGenerator(ReportGenerator reportGenerator) + { + ParameterCheck.mandatory("reportGenerator", reportGenerator); + registry.put(reportGenerator.getReportType(), reportGenerator); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#getReportTypes() + */ + @Override + public Set getReportTypes() + { + return registry.keySet(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#generateReport(QName, NodeRef) + */ + @Override + public Report generateReport(QName reportType, NodeRef reportedUponNodeRef) + { + ParameterCheck.mandatory("reportType", reportType); + ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); + + return generateReport(reportType, reportedUponNodeRef, MimetypeMap.MIMETYPE_HTML); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#generateReport(QName, NodeRef, String) + */ + @Override + public Report generateReport(QName reportType, NodeRef reportedUponNodeRef, String mimetype) + { + ParameterCheck.mandatory("reportType", reportType); + ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); + ParameterCheck.mandatoryString("mimetype", mimetype); + + // get the generator + ReportGenerator generator = registry.get(reportType); + + // error is generator not found in registry + if (generator == null) + { + throw new AlfrescoRuntimeException("Unable to generate report, because report type " + reportType.toString() + " does not correspond to a registered report type."); + } + + // generate the report + return generator.generateReport(reportedUponNodeRef, mimetype); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportService#fileReport(org.alfresco.module.org_alfresco_module_rm.report.Report) + */ + @Override + public NodeRef fileReport(NodeRef nodeRef, Report report) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("report", report); + + return recordService.createRecordFromContent(nodeRef, + report.getReportName(), + report.getReportType(), + report.getReportProperties(), + report.getReportContent()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java index 4683ae671b..8ac0e135a1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/BaseReportGenerator.java @@ -1,157 +1,157 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report.generator; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator; -import org.alfresco.module.org_alfresco_module_rm.report.ReportService; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Base report generator. - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class BaseReportGenerator implements ReportGenerator -{ - /** report service */ - protected ReportService reportService; - - /** namespace service */ - protected NamespaceService namespaceService; - - /** report type qualified name */ - protected QName reportType; - - /** - * @param reportService report service - */ - public void setReportService(ReportService reportService) - { - this.reportService = reportService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param reportType report type - */ - public void setReportType(QName reportType) - { - this.reportType = reportType; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#getReportType() - */ - @Override - public QName getReportType() - { - return reportType; - } - - /** - * Init method - */ - public void init() - { - // ensure required values have been set - ParameterCheck.mandatory("reportType", reportType); - - // register report generator - reportService.registerReportGenerator(this); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#generateReport(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) - */ - @Override - public Report generateReport(NodeRef reportedUponNodeRef, String mimetype) - { - ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); - ParameterCheck.mandatoryString("mimetype", mimetype); - - // check the applicability of the report generator for the given reported upon node - checkReportApplicability(reportedUponNodeRef); - - // generate the report name - String reportName = generateReportName(reportedUponNodeRef, mimetype); - - // generate the report meta-data - Map reportProperties = generateReportMetadata(reportedUponNodeRef); - - // generate the report content - ContentReader contentReader = generateReportContent(reportedUponNodeRef, mimetype, generateReportTemplateContext(reportedUponNodeRef)); - - // return the report information object - return new ReportInfo(reportType, reportName, reportProperties, contentReader); - } - - /** - * Checks whether the report generator is applicable given the reported upon node reference. - *

- * Throws AlfrescoRuntimeException if applicability fails, with reason. - * - * @param reportedUponNodeRef reported upon node reference - */ - protected abstract void checkReportApplicability(NodeRef reportedUponNodeRef); - - /** - * Generate the report name - */ - protected abstract String generateReportName(NodeRef reportedUponNodeRef, String mimetype); - - /** - * Generate the report template context. - */ - protected abstract Map generateReportTemplateContext(NodeRef reportedUponNodeRef); - - /** - * Generate report meta-data - */ - protected abstract Map generateReportMetadata(NodeRef reportedUponNodeRef); - - /** - * Generate report content - */ - protected abstract ContentReader generateReportContent(NodeRef reportedUponNodeRef, String mimetype, Map properties); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report.generator; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.report.Report; +import org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator; +import org.alfresco.module.org_alfresco_module_rm.report.ReportService; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; + +/** + * Base report generator. + * + * @author Roy Wetherall + * @since 2.1 + */ +public abstract class BaseReportGenerator implements ReportGenerator +{ + /** report service */ + protected ReportService reportService; + + /** namespace service */ + protected NamespaceService namespaceService; + + /** report type qualified name */ + protected QName reportType; + + /** + * @param reportService report service + */ + public void setReportService(ReportService reportService) + { + this.reportService = reportService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param reportType report type + */ + public void setReportType(QName reportType) + { + this.reportType = reportType; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#getReportType() + */ + @Override + public QName getReportType() + { + return reportType; + } + + /** + * Init method + */ + public void init() + { + // ensure required values have been set + ParameterCheck.mandatory("reportType", reportType); + + // register report generator + reportService.registerReportGenerator(this); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.ReportGenerator#generateReport(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map) + */ + @Override + public Report generateReport(NodeRef reportedUponNodeRef, String mimetype) + { + ParameterCheck.mandatory("reportedUponNodeRef", reportedUponNodeRef); + ParameterCheck.mandatoryString("mimetype", mimetype); + + // check the applicability of the report generator for the given reported upon node + checkReportApplicability(reportedUponNodeRef); + + // generate the report name + String reportName = generateReportName(reportedUponNodeRef, mimetype); + + // generate the report meta-data + Map reportProperties = generateReportMetadata(reportedUponNodeRef); + + // generate the report content + ContentReader contentReader = generateReportContent(reportedUponNodeRef, mimetype, generateReportTemplateContext(reportedUponNodeRef)); + + // return the report information object + return new ReportInfo(reportType, reportName, reportProperties, contentReader); + } + + /** + * Checks whether the report generator is applicable given the reported upon node reference. + *

+ * Throws AlfrescoRuntimeException if applicability fails, with reason. + * + * @param reportedUponNodeRef reported upon node reference + */ + protected abstract void checkReportApplicability(NodeRef reportedUponNodeRef); + + /** + * Generate the report name + */ + protected abstract String generateReportName(NodeRef reportedUponNodeRef, String mimetype); + + /** + * Generate the report template context. + */ + protected abstract Map generateReportTemplateContext(NodeRef reportedUponNodeRef); + + /** + * Generate report meta-data + */ + protected abstract Map generateReportMetadata(NodeRef reportedUponNodeRef); + + /** + * Generate report content + */ + protected abstract ContentReader generateReportContent(NodeRef reportedUponNodeRef, String mimetype, Map properties); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java index 6b5d606b7c..09b7d32c4a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/DeclarativeReportGenerator.java @@ -1,377 +1,377 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report.generator; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.admin.SysAdminParams; -import org.alfresco.repo.i18n.StaticMessageLookup; -import org.alfresco.repo.model.Repository; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.model.FileFolderService; -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.MimetypeService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.repository.TemplateService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.UrlUtil; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Declarative report generator. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class DeclarativeReportGenerator extends BaseReportGenerator -{ - /** message lookups */ - protected static final String MSG_REPORT = "report.default"; - - /** template lookup root */ - protected static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); - - /** model keys */ - protected static final String KEY_NODE = "node"; - protected static final String KEY_CHILDREN = "children"; - - /** applicable reported upon types */ - protected Set applicableTypes; - - /** content service */ - protected ContentService contentService; - - /** mimetype service */ - protected MimetypeService mimetypeService; - - /** file folder service */ - protected FileFolderService fileFolderService; - - /** template service */ - protected TemplateService templateService; - - /** repository helper */ - protected Repository repository; - - /** node service */ - protected NodeService nodeService; - - /** dictionary service */ - protected DictionaryService dictionaryService; - - /** sys admin params */ - protected SysAdminParams sysAdminParams; - - /** - * @param applicableTypes applicable types - */ - public void setApplicableTypes(Set applicableTypes) - { - this.applicableTypes = applicableTypes; - } - - /** - * @param mimetypeService mimetype service - */ - public void setMimetypeService(MimetypeService mimetypeService) - { - this.mimetypeService = mimetypeService; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @param templateService template service - */ - public void setTemplateService(TemplateService templateService) - { - this.templateService = templateService; - } - - /** - * @param contentService content service - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param repository repository helper - */ - public void setRepository(Repository repository) - { - this.repository = repository; - } - - /** - * @param sysAdminParams sys admin params - */ - public void setSysAdminParams(SysAdminParams sysAdminParams) - { - this.sysAdminParams = sysAdminParams; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportName(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected String generateReportName(NodeRef reportedUponNodeRef, String mimetype) - { - // get the file extension based on the mimetype - String extension = mimetypeService.getExtension(mimetype); - - // get the name of the reported updon node ref - String name = (String)nodeService.getProperty(reportedUponNodeRef, ContentModel.PROP_NAME); - - // build default report name - StringBuilder builder = new StringBuilder(); - builder.append(getReportDisplayLabel()); - if (StringUtils.isNotBlank(name)) - { - builder.append(" - ").append(name); - } - builder.append(".").append(extension); - - return builder.toString(); - } - - /** - * Helper method to get the report types display label - * - * @return {@link String} report type display label - */ - private String getReportDisplayLabel() - { - String result = I18NUtil.getMessage(MSG_REPORT); - - TypeDefinition typeDef = dictionaryService.getType(reportType); - if (typeDef != null) - { - result = typeDef.getTitle(new StaticMessageLookup()); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportContent(NodeRef, String, Map) - */ - @Override - protected ContentReader generateReportContent(NodeRef reportedUponNodeRef, String mimetype, Map properties) - { - // get the template - NodeRef reportTemplateNodeRef = getReportTemplate(mimetype); - - // get the model - Map model = createTemplateModel(reportTemplateNodeRef, reportedUponNodeRef, properties); - - // run the template - String result = templateService.processTemplate("freemarker", reportTemplateNodeRef.toString(), model); - - // create the temp content - ContentWriter contentWriter = contentService.getTempWriter(); - contentWriter.setEncoding("UTF-8"); - contentWriter.setMimetype(mimetype); - contentWriter.putContent(result); - - // return the reader to the temp content - return contentWriter.getReader(); - } - - /** - * Create template model. - * - * @param templateNodeRef - * @param reportedUponNodeRef - * @param properties - * @return - */ - protected Map createTemplateModel(NodeRef templateNodeRef, NodeRef reportedUponNodeRef, Map properties) - { - Map model = new HashMap(); - - // build the default model - NodeRef person = repository.getPerson(); - templateService.buildDefaultModel(person, - repository.getCompanyHome(), - repository.getUserHome(person), - templateNodeRef, - null); - - // put the reported upon node reference in the model - model.put(KEY_NODE, reportedUponNodeRef); - - // context url's (handy for images and links) - model.put("url", UrlUtil.getAlfrescoUrl(sysAdminParams)); - model.put(TemplateService.KEY_SHARE_URL, UrlUtil.getShareUrl(sysAdminParams)); - - // who and when the report was generated - model.put("reportUser", AuthenticationUtil.getRunAsUser()); - Calendar now = Calendar.getInstance(I18NUtil.getContentLocale()); - model.put("reportDate", SimpleDateFormat.getDateInstance(SimpleDateFormat.MEDIUM).format(now.getTime())); - - // add additional properties - model.put("properties", (Serializable) properties); - - return model; - } - - /** - * Get's the report template based on the type and mimetype. - * - * @param mimetype - * @return - */ - private NodeRef getReportTemplate(String mimetype) - { - // check that the template root has been correctly bootstraped - if (!fileFolderService.exists(TEMPLATE_ROOT)) - { - throw new AlfrescoRuntimeException("Unable to get report template, because the template root folder does not exist in the data dictionary."); - } - - String reportTemplateName = getReportTemplateName(mimetype); - - NodeRef reportTemplateNodeRef = fileFolderService.searchSimple(TEMPLATE_ROOT, reportTemplateName); - if (reportTemplateNodeRef == null) - { - throw new AlfrescoRuntimeException("Unable to get report template, because report template " + reportTemplateName + " does not exist."); - } - - // get localise template - return fileFolderService.getLocalizedSibling(reportTemplateNodeRef); - } - - /** - * Gets the template name based on the type and mimetype. - * - * @param mimetype - * @return - */ - private String getReportTemplateName(String mimetype) - { - String typePrefixName = reportType.getPrefixedQName(namespaceService).getPrefixString().replace(":", "_"); - String extension = mimetypeService.getExtension(mimetype); - - StringBuilder sb = new StringBuilder(128) - .append("report_") - .append(typePrefixName) - .append(".") - .append(extension) - .append(".ftl"); - - return sb.toString(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#checkReportApplicability(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void checkReportApplicability(NodeRef reportedUponNodeRef) - { - if (applicableTypes != null && applicableTypes.size() != 0) - { - boolean isTypeApplicable = false; - QName type = nodeService.getType(reportedUponNodeRef); - - for (QName applicableType : applicableTypes) - { - if (dictionaryService.isSubClass(type, applicableType)) - { - isTypeApplicable = true; - break; - } - } - - if (!isTypeApplicable) - { - // throw an exception - throw new AlfrescoRuntimeException("Can't generate report, because the provided reported upon node reference is type " + type.toString() + - " which is not an applicable type for a " + reportType.toString() + " report."); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - protected Map generateReportTemplateContext(NodeRef reportedUponNodeRef) - { - return Collections.EMPTY_MAP; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportMetadata(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - protected Map generateReportMetadata(NodeRef reportedUponNodeRef) - { - return Collections.EMPTY_MAP; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report.generator; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.admin.SysAdminParams; +import org.alfresco.repo.i18n.StaticMessageLookup; +import org.alfresco.repo.model.Repository; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.TypeDefinition; +import org.alfresco.service.cmr.model.FileFolderService; +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.MimetypeService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.repository.TemplateService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.UrlUtil; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Declarative report generator. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class DeclarativeReportGenerator extends BaseReportGenerator +{ + /** message lookups */ + protected static final String MSG_REPORT = "report.default"; + + /** template lookup root */ + protected static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates"); + + /** model keys */ + protected static final String KEY_NODE = "node"; + protected static final String KEY_CHILDREN = "children"; + + /** applicable reported upon types */ + protected Set applicableTypes; + + /** content service */ + protected ContentService contentService; + + /** mimetype service */ + protected MimetypeService mimetypeService; + + /** file folder service */ + protected FileFolderService fileFolderService; + + /** template service */ + protected TemplateService templateService; + + /** repository helper */ + protected Repository repository; + + /** node service */ + protected NodeService nodeService; + + /** dictionary service */ + protected DictionaryService dictionaryService; + + /** sys admin params */ + protected SysAdminParams sysAdminParams; + + /** + * @param applicableTypes applicable types + */ + public void setApplicableTypes(Set applicableTypes) + { + this.applicableTypes = applicableTypes; + } + + /** + * @param mimetypeService mimetype service + */ + public void setMimetypeService(MimetypeService mimetypeService) + { + this.mimetypeService = mimetypeService; + } + + /** + * @param fileFolderService file folder service + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + /** + * @param templateService template service + */ + public void setTemplateService(TemplateService templateService) + { + this.templateService = templateService; + } + + /** + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param repository repository helper + */ + public void setRepository(Repository repository) + { + this.repository = repository; + } + + /** + * @param sysAdminParams sys admin params + */ + public void setSysAdminParams(SysAdminParams sysAdminParams) + { + this.sysAdminParams = sysAdminParams; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportName(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected String generateReportName(NodeRef reportedUponNodeRef, String mimetype) + { + // get the file extension based on the mimetype + String extension = mimetypeService.getExtension(mimetype); + + // get the name of the reported updon node ref + String name = (String)nodeService.getProperty(reportedUponNodeRef, ContentModel.PROP_NAME); + + // build default report name + StringBuilder builder = new StringBuilder(); + builder.append(getReportDisplayLabel()); + if (StringUtils.isNotBlank(name)) + { + builder.append(" - ").append(name); + } + builder.append(".").append(extension); + + return builder.toString(); + } + + /** + * Helper method to get the report types display label + * + * @return {@link String} report type display label + */ + private String getReportDisplayLabel() + { + String result = I18NUtil.getMessage(MSG_REPORT); + + TypeDefinition typeDef = dictionaryService.getType(reportType); + if (typeDef != null) + { + result = typeDef.getTitle(new StaticMessageLookup()); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportContent(NodeRef, String, Map) + */ + @Override + protected ContentReader generateReportContent(NodeRef reportedUponNodeRef, String mimetype, Map properties) + { + // get the template + NodeRef reportTemplateNodeRef = getReportTemplate(mimetype); + + // get the model + Map model = createTemplateModel(reportTemplateNodeRef, reportedUponNodeRef, properties); + + // run the template + String result = templateService.processTemplate("freemarker", reportTemplateNodeRef.toString(), model); + + // create the temp content + ContentWriter contentWriter = contentService.getTempWriter(); + contentWriter.setEncoding("UTF-8"); + contentWriter.setMimetype(mimetype); + contentWriter.putContent(result); + + // return the reader to the temp content + return contentWriter.getReader(); + } + + /** + * Create template model. + * + * @param templateNodeRef + * @param reportedUponNodeRef + * @param properties + * @return + */ + protected Map createTemplateModel(NodeRef templateNodeRef, NodeRef reportedUponNodeRef, Map properties) + { + Map model = new HashMap(); + + // build the default model + NodeRef person = repository.getPerson(); + templateService.buildDefaultModel(person, + repository.getCompanyHome(), + repository.getUserHome(person), + templateNodeRef, + null); + + // put the reported upon node reference in the model + model.put(KEY_NODE, reportedUponNodeRef); + + // context url's (handy for images and links) + model.put("url", UrlUtil.getAlfrescoUrl(sysAdminParams)); + model.put(TemplateService.KEY_SHARE_URL, UrlUtil.getShareUrl(sysAdminParams)); + + // who and when the report was generated + model.put("reportUser", AuthenticationUtil.getRunAsUser()); + Calendar now = Calendar.getInstance(I18NUtil.getContentLocale()); + model.put("reportDate", SimpleDateFormat.getDateInstance(SimpleDateFormat.MEDIUM).format(now.getTime())); + + // add additional properties + model.put("properties", (Serializable) properties); + + return model; + } + + /** + * Get's the report template based on the type and mimetype. + * + * @param mimetype + * @return + */ + private NodeRef getReportTemplate(String mimetype) + { + // check that the template root has been correctly bootstraped + if (!fileFolderService.exists(TEMPLATE_ROOT)) + { + throw new AlfrescoRuntimeException("Unable to get report template, because the template root folder does not exist in the data dictionary."); + } + + String reportTemplateName = getReportTemplateName(mimetype); + + NodeRef reportTemplateNodeRef = fileFolderService.searchSimple(TEMPLATE_ROOT, reportTemplateName); + if (reportTemplateNodeRef == null) + { + throw new AlfrescoRuntimeException("Unable to get report template, because report template " + reportTemplateName + " does not exist."); + } + + // get localise template + return fileFolderService.getLocalizedSibling(reportTemplateNodeRef); + } + + /** + * Gets the template name based on the type and mimetype. + * + * @param mimetype + * @return + */ + private String getReportTemplateName(String mimetype) + { + String typePrefixName = reportType.getPrefixedQName(namespaceService).getPrefixString().replace(":", "_"); + String extension = mimetypeService.getExtension(mimetype); + + StringBuilder sb = new StringBuilder(128) + .append("report_") + .append(typePrefixName) + .append(".") + .append(extension) + .append(".ftl"); + + return sb.toString(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#checkReportApplicability(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void checkReportApplicability(NodeRef reportedUponNodeRef) + { + if (applicableTypes != null && applicableTypes.size() != 0) + { + boolean isTypeApplicable = false; + QName type = nodeService.getType(reportedUponNodeRef); + + for (QName applicableType : applicableTypes) + { + if (dictionaryService.isSubClass(type, applicableType)) + { + isTypeApplicable = true; + break; + } + } + + if (!isTypeApplicable) + { + // throw an exception + throw new AlfrescoRuntimeException("Can't generate report, because the provided reported upon node reference is type " + type.toString() + + " which is not an applicable type for a " + reportType.toString() + " report."); + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + @Override + protected Map generateReportTemplateContext(NodeRef reportedUponNodeRef) + { + return Collections.EMPTY_MAP; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportMetadata(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + @Override + protected Map generateReportMetadata(NodeRef reportedUponNodeRef) + { + return Collections.EMPTY_MAP; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/ReportInfo.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/ReportInfo.java index 7ab4038897..4783d54d00 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/ReportInfo.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/ReportInfo.java @@ -1,112 +1,112 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report.generator; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Report implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -/*package*/ class ReportInfo implements Report -{ - /** report type */ - private QName reportType; - - private String reportName; - - private Map reportProperties = new HashMap(21); - - /** content reader */ - private ContentReader reportContent; - - /** - * Default constructor. - * - * @param reportType report type - * @param reportName report name - * @param reportProperties report properties - * @param reportContent report content reader - */ - public ReportInfo(QName reportType, String reportName, Map reportProperties, ContentReader reportContent) - { - ParameterCheck.mandatory("reportType", reportType); - ParameterCheck.mandatory("reportName", reportName); - ParameterCheck.mandatory("reportContent", reportContent); - - this.reportType = reportType; - this.reportName = reportName; - this.reportProperties = reportProperties; - this.reportContent = reportContent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportType() - */ - public QName getReportType() - { - return reportType; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportName() - */ - @Override - public String getReportName() - { - return reportName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportProperties() - */ - @Override - public Map getReportProperties() - { - return reportProperties; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportContent() - */ - @Override - public ContentReader getReportContent() - { - return reportContent; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report.generator; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.report.Report; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.ParameterCheck; + +/** + * Report implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +/*package*/ class ReportInfo implements Report +{ + /** report type */ + private QName reportType; + + private String reportName; + + private Map reportProperties = new HashMap(21); + + /** content reader */ + private ContentReader reportContent; + + /** + * Default constructor. + * + * @param reportType report type + * @param reportName report name + * @param reportProperties report properties + * @param reportContent report content reader + */ + public ReportInfo(QName reportType, String reportName, Map reportProperties, ContentReader reportContent) + { + ParameterCheck.mandatory("reportType", reportType); + ParameterCheck.mandatory("reportName", reportName); + ParameterCheck.mandatory("reportContent", reportContent); + + this.reportType = reportType; + this.reportName = reportName; + this.reportProperties = reportProperties; + this.reportContent = reportContent; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportType() + */ + public QName getReportType() + { + return reportType; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportName() + */ + @Override + public String getReportName() + { + return reportName; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportProperties() + */ + @Override + public Map getReportProperties() + { + return reportProperties; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.Report#getReportContent() + */ + @Override + public ContentReader getReportContent() + { + return reportContent; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferNode.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferNode.java index ba905444ab..ea49e1fd50 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferNode.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferNode.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report.generator.transfer; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Transfer node class - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class TransferNode -{ - /** Transfer node reference */ - private NodeRef nodeRef; - - /** Transfer node properties */ - private Map properties; - - /** - * @param nodeRef - * @param properties - */ - public TransferNode(NodeRef nodeRef, Map properties) - { - this.nodeRef = nodeRef; - this.properties = properties; - } - - /** - * @return transfer node reference - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } - - /** - * @return transfer node properties - */ - public Map getProperties() - { - return this.properties; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report.generator.transfer; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Transfer node class + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class TransferNode +{ + /** Transfer node reference */ + private NodeRef nodeRef; + + /** Transfer node properties */ + private Map properties; + + /** + * @param nodeRef + * @param properties + */ + public TransferNode(NodeRef nodeRef, Map properties) + { + this.nodeRef = nodeRef; + this.properties = properties; + } + + /** + * @return transfer node reference + */ + public NodeRef getNodeRef() + { + return this.nodeRef; + } + + /** + * @return transfer node properties + */ + public Map getProperties() + { + return this.properties; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java index 6715d60877..fc6d384479 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/report/generator/transfer/TransferReportGenerator.java @@ -1,242 +1,242 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.report.generator.transfer; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGenerator; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.lang.StringUtils; - -/** - * Transfer report generator. - * - * @author Tuna Aksoy - * @author Roy Wetherall - * @since 2.2 - */ -public class TransferReportGenerator extends DeclarativeReportGenerator -{ - /** dispotion service */ - protected DispositionService dispositionService; - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGeneratorUnitTest#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected Map generateReportTemplateContext(NodeRef reportedUponNodeRef) - { - // Get all 'transferred' nodes - List transferNodes = getTransferNodes(reportedUponNodeRef); - - // Get the disposition authority - String dispositionAuthority = getDispositionAuthority(transferNodes); - - // Save to the properties map - Map properties = new HashMap(2); - properties.put("transferNodes", (ArrayList) transferNodes); - properties.put("dispositionAuthority", dispositionAuthority); - - return properties; - } - - /** - * Returns a list of transfer nodes - * - * @param nodeRef The transfer object - * @return Transfer node list - */ - private List getTransferNodes(NodeRef nodeRef) - { - List assocs = nodeService.getChildAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - List transferNodes = new ArrayList(assocs.size()); - for (ChildAssociationRef assoc : assocs) - { - NodeRef childRef = assoc.getChildRef(); - Map properties = getTransferNodeProperties(childRef); - transferNodes.add(new TransferNode(childRef, properties)); - } - return transferNodes; - } - - /** - * Helper method to get the properties of a transfer node - * - * @param childRef Node reference - * @return Transfer node properties - */ - private Map getTransferNodeProperties(NodeRef childRef) - { - Map transferNodeProperties = new HashMap(6); - - boolean isFolder = dictionaryService.isSubClass(nodeService.getType(childRef), ContentModel.TYPE_FOLDER); - transferNodeProperties.put("isFolder", isFolder); - - if (isFolder) - { - Map folderProperties = getFolderProperties(childRef); - transferNodeProperties.putAll(folderProperties); - } - else - { - Map recordProperties = getRecordProperties(childRef); - transferNodeProperties.putAll(recordProperties); - } - - return transferNodeProperties; - } - - /** - * Helper method to get the list of records (with their properties) within a folder - * - * @param childRef Node reference of the folder - * @return List of records within the specified folder - */ - private List getRecords(NodeRef childRef) - { - List records = new ArrayList(4); - List assocs = nodeService.getChildAssocs(childRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : assocs) - { - NodeRef record = child.getChildRef(); - if (nodeService.hasAspect(record, RecordsManagementModel.ASPECT_RECORD)) - { - Map recordProperties = getRecordProperties(record); - TransferNode transferNode = new TransferNode(record, recordProperties); - records.add(transferNode); - } - } - return records; - } - - /** - * Helper method to get the common transfer node properties - * - * @param nodeRef Node reference of the transfer node - * @return Map of the common transfer node properties - */ - private Map getCommonProperties(NodeRef nodeRef) - { - Map transferNodeProperties = new HashMap(3); - - Map properties = nodeService.getProperties(nodeRef); - String name = (String) properties.get(ContentModel.PROP_NAME); - String identifier = (String) properties.get(RecordsManagementModel.PROP_IDENTIFIER); - - transferNodeProperties.put("name", name); - transferNodeProperties.put("identifier", identifier); - - return transferNodeProperties; - } - - /** - * Helper method to get the folder specific properties - * - * @param folder Node reference of the folder - * @return Map of the folder specific properties - */ - private Map getFolderProperties(NodeRef folder) - { - Map transferNodeProperties = new HashMap(3); - - Map commonProperties = getCommonProperties(folder); - ArrayList records = (ArrayList) getRecords(folder); - transferNodeProperties.putAll(commonProperties); - transferNodeProperties.put("records", records); - - return transferNodeProperties; - } - - /** - * Helper method to get the record folder properties - * - * @param record Node reference of the record - * @return Map of the record specific properties - */ - private Map getRecordProperties(NodeRef record) - { - Map transferNodeProperties = new HashMap(5); - - Map properties = nodeService.getProperties(record); - String declaredBy = (String) properties.get(RecordsManagementModel.PROP_DECLARED_BY); - Date declaredOn = (Date) properties.get(RecordsManagementModel.PROP_DECLARED_AT); - boolean isDeclared = nodeService.hasAspect(record, RecordsManagementModel.ASPECT_DECLARED_RECORD); - - Map commonProperties = getCommonProperties(record); - transferNodeProperties.putAll(commonProperties); - transferNodeProperties.put("declaredBy", declaredBy); - transferNodeProperties.put("declaredOn", declaredOn); - transferNodeProperties.put("isDeclared", isDeclared); - - return transferNodeProperties; - } - - /** - * Gets the disposition authority from the list of the transfer nodes - * - * @param transferNodes The transfer nodes - * @return Disposition authority - */ - private String getDispositionAuthority(List transferNodes) - { - // use RMService to get disposition authority - String dispositionAuthority = null; - if (transferNodes.size() > 0) - { - // use the first transfer item to get to disposition schedule - NodeRef nodeRef = transferNodes.iterator().next().getNodeRef(); - DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef); - if (ds != null) - { - dispositionAuthority = ds.getDispositionAuthority(); - } - } - return dispositionAuthority == null ? StringUtils.EMPTY : dispositionAuthority; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.report.generator.transfer; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGenerator; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.apache.commons.lang.StringUtils; + +/** + * Transfer report generator. + * + * @author Tuna Aksoy + * @author Roy Wetherall + * @since 2.2 + */ +public class TransferReportGenerator extends DeclarativeReportGenerator +{ + /** dispotion service */ + protected DispositionService dispositionService; + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGeneratorUnitTest#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected Map generateReportTemplateContext(NodeRef reportedUponNodeRef) + { + // Get all 'transferred' nodes + List transferNodes = getTransferNodes(reportedUponNodeRef); + + // Get the disposition authority + String dispositionAuthority = getDispositionAuthority(transferNodes); + + // Save to the properties map + Map properties = new HashMap(2); + properties.put("transferNodes", (ArrayList) transferNodes); + properties.put("dispositionAuthority", dispositionAuthority); + + return properties; + } + + /** + * Returns a list of transfer nodes + * + * @param nodeRef The transfer object + * @return Transfer node list + */ + private List getTransferNodes(NodeRef nodeRef) + { + List assocs = nodeService.getChildAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + List transferNodes = new ArrayList(assocs.size()); + for (ChildAssociationRef assoc : assocs) + { + NodeRef childRef = assoc.getChildRef(); + Map properties = getTransferNodeProperties(childRef); + transferNodes.add(new TransferNode(childRef, properties)); + } + return transferNodes; + } + + /** + * Helper method to get the properties of a transfer node + * + * @param childRef Node reference + * @return Transfer node properties + */ + private Map getTransferNodeProperties(NodeRef childRef) + { + Map transferNodeProperties = new HashMap(6); + + boolean isFolder = dictionaryService.isSubClass(nodeService.getType(childRef), ContentModel.TYPE_FOLDER); + transferNodeProperties.put("isFolder", isFolder); + + if (isFolder) + { + Map folderProperties = getFolderProperties(childRef); + transferNodeProperties.putAll(folderProperties); + } + else + { + Map recordProperties = getRecordProperties(childRef); + transferNodeProperties.putAll(recordProperties); + } + + return transferNodeProperties; + } + + /** + * Helper method to get the list of records (with their properties) within a folder + * + * @param childRef Node reference of the folder + * @return List of records within the specified folder + */ + private List getRecords(NodeRef childRef) + { + List records = new ArrayList(4); + List assocs = nodeService.getChildAssocs(childRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef child : assocs) + { + NodeRef record = child.getChildRef(); + if (nodeService.hasAspect(record, RecordsManagementModel.ASPECT_RECORD)) + { + Map recordProperties = getRecordProperties(record); + TransferNode transferNode = new TransferNode(record, recordProperties); + records.add(transferNode); + } + } + return records; + } + + /** + * Helper method to get the common transfer node properties + * + * @param nodeRef Node reference of the transfer node + * @return Map of the common transfer node properties + */ + private Map getCommonProperties(NodeRef nodeRef) + { + Map transferNodeProperties = new HashMap(3); + + Map properties = nodeService.getProperties(nodeRef); + String name = (String) properties.get(ContentModel.PROP_NAME); + String identifier = (String) properties.get(RecordsManagementModel.PROP_IDENTIFIER); + + transferNodeProperties.put("name", name); + transferNodeProperties.put("identifier", identifier); + + return transferNodeProperties; + } + + /** + * Helper method to get the folder specific properties + * + * @param folder Node reference of the folder + * @return Map of the folder specific properties + */ + private Map getFolderProperties(NodeRef folder) + { + Map transferNodeProperties = new HashMap(3); + + Map commonProperties = getCommonProperties(folder); + ArrayList records = (ArrayList) getRecords(folder); + transferNodeProperties.putAll(commonProperties); + transferNodeProperties.put("records", records); + + return transferNodeProperties; + } + + /** + * Helper method to get the record folder properties + * + * @param record Node reference of the record + * @return Map of the record specific properties + */ + private Map getRecordProperties(NodeRef record) + { + Map transferNodeProperties = new HashMap(5); + + Map properties = nodeService.getProperties(record); + String declaredBy = (String) properties.get(RecordsManagementModel.PROP_DECLARED_BY); + Date declaredOn = (Date) properties.get(RecordsManagementModel.PROP_DECLARED_AT); + boolean isDeclared = nodeService.hasAspect(record, RecordsManagementModel.ASPECT_DECLARED_RECORD); + + Map commonProperties = getCommonProperties(record); + transferNodeProperties.putAll(commonProperties); + transferNodeProperties.put("declaredBy", declaredBy); + transferNodeProperties.put("declaredOn", declaredOn); + transferNodeProperties.put("isDeclared", isDeclared); + + return transferNodeProperties; + } + + /** + * Gets the disposition authority from the list of the transfer nodes + * + * @param transferNodes The transfer nodes + * @return Disposition authority + */ + private String getDispositionAuthority(List transferNodes) + { + // use RMService to get disposition authority + String dispositionAuthority = null; + if (transferNodes.size() > 0) + { + // use the first transfer item to get to disposition schedule + NodeRef nodeRef = transferNodes.iterator().next().getNodeRef(); + DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef); + if (ds != null) + { + dispositionAuthority = ds.getDispositionAuthority(); + } + } + return dispositionAuthority == null ? StringUtils.EMPTY : dispositionAuthority; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java index 3ae284f404..734516267f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java @@ -1,226 +1,226 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.role; - -import java.util.Arrays; -import java.util.List; -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Role service interface - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface FilePlanRoleService -{ - /** Default role names */ - String ROLE_USER = "User"; - String ROLE_POWER_USER = "PowerUser"; - String ROLE_SECURITY_OFFICER = "SecurityOfficer"; - String ROLE_RECORDS_MANAGER = "RecordsManager"; - String ROLE_ADMIN = "Administrator"; - String ROLE_EXTENDED_READERS = "ExtendedReaders"; - String ROLE_EXTENDED_WRITERS = "ExtendedWriters"; - - /** System roles */ - List SYSTEM_ROLES = Arrays.asList( - ROLE_EXTENDED_READERS, - ROLE_EXTENDED_WRITERS - ); - - /** - * Sets up the roles on a new file plan. - * - * @param filePlan file plan - */ - void setupFilePlanRoles(NodeRef filePlan); - - /** - * Tears down the roles on a file plan. - * - * @param filePlan file plan - */ - void tearDownFilePlanRoles(NodeRef filePlan); - - /** - * Returns the name of the container group for all roles of a specified file - * plan. - * - * @param filePlan file plan node reference - * @return String group name - */ - String getAllRolesContainerGroup(NodeRef filePlan); - - /** - * Get all the available roles for the given records management root node - * (includes also the system roles) - * - * @param filePlan file plan - * @return - */ - Set getRoles(NodeRef filePlan); - - /** - * Get all the available roles for the given records management root node. - * System roles can be filtered - * - * @param filePlan file plan - * @param includeSystemRoles system roles - * @return - */ - Set getRoles(NodeRef filePlan, boolean includeSystemRoles); - - /** - * Gets the roles for a given user - * (includes also the system roles) - * - * @param filePlan file plan - * @param user user - * @return - */ - Set getRolesByUser(NodeRef filePlan, String user); - - /** - * Gets the roles for a given user. - * System roles can be filtered - * - * @param filePlan file plan - * @param user user - * @param includeSystemRoles system roles - * @return - */ - Set getRolesByUser(NodeRef filePlan, String user, boolean includeSystemRoles); - - /** - * Get a role by name - * - * @param filePlan file plan - * @param role role - * @return - */ - Role getRole(NodeRef filePlan, String role); - - /** - * Indicate whether a role exists for a given records management root node - * @param filePlan file plan - * @param role role - * @return - */ - boolean existsRole(NodeRef filePlan, String role); - - /** - * Determines whether the given user has the RM Admin role - * - * @param filePlan filePlan - * @param user user name to check - * @return true if the user has the RM Admin role, false otherwise - */ - boolean hasRMAdminRole(NodeRef filePlan, String user); - - /** - * Create a new role - * - * @param filePlan file plan - * @param role - * @param roleDisplayLabel - * @param capabilities - * @return - */ - Role createRole(NodeRef filePlan, String role, String roleDisplayLabel, Set capabilities); - - /** - * Update an existing role - * - * @param filePlan file plan - * @param role - * @param roleDisplayLabel - * @param capabilities - * @return - */ - Role updateRole(NodeRef filePlan, String role, String roleDisplayLabel, Set capabilities); - - /** - * Delete a role - * - * @param filePlan file plan - * @param role role - */ - void deleteRole(NodeRef filePlan, String role); - - /** - * Gets all the users that have been directly assigned to a role. - * - * @param filePlan file plan - * @param role role - * @return {@link Set}<{@link String}> set of users - */ - Set getUsersAssignedToRole(NodeRef filePlan, String role); - - /** - * Gets all the groups that have been directly assigned to a role. - * - * @param filePlan file plan - * @param role role - * @return {@link Set}<{@link String}> set of groups - */ - Set getGroupsAssignedToRole(NodeRef filePlan, String role); - - /** - * Gets all the groups and users that have been directly assigned to a role. - * - * @param filePlan file plan - * @param role role - * @return {@link Set}<{@link String}> set of groups and users - */ - Set getAllAssignedToRole(NodeRef filePlan, String role); - - /** - * Assign a role to an authority - * - * @param filePlan file plan - * @param role role - * @param authorityName authority name - */ - void assignRoleToAuthority(NodeRef filePlan, String role, String authorityName); - - - /** - * Unassign a role from an authority - * - * @param filePlan file plan - * @param role role - * @param authorityName authority name - */ - void unassignRoleFromAuthority(NodeRef filePlan, String role, String authorityName); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.role; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Role service interface + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface FilePlanRoleService +{ + /** Default role names */ + String ROLE_USER = "User"; + String ROLE_POWER_USER = "PowerUser"; + String ROLE_SECURITY_OFFICER = "SecurityOfficer"; + String ROLE_RECORDS_MANAGER = "RecordsManager"; + String ROLE_ADMIN = "Administrator"; + String ROLE_EXTENDED_READERS = "ExtendedReaders"; + String ROLE_EXTENDED_WRITERS = "ExtendedWriters"; + + /** System roles */ + List SYSTEM_ROLES = Arrays.asList( + ROLE_EXTENDED_READERS, + ROLE_EXTENDED_WRITERS + ); + + /** + * Sets up the roles on a new file plan. + * + * @param filePlan file plan + */ + void setupFilePlanRoles(NodeRef filePlan); + + /** + * Tears down the roles on a file plan. + * + * @param filePlan file plan + */ + void tearDownFilePlanRoles(NodeRef filePlan); + + /** + * Returns the name of the container group for all roles of a specified file + * plan. + * + * @param filePlan file plan node reference + * @return String group name + */ + String getAllRolesContainerGroup(NodeRef filePlan); + + /** + * Get all the available roles for the given records management root node + * (includes also the system roles) + * + * @param filePlan file plan + * @return + */ + Set getRoles(NodeRef filePlan); + + /** + * Get all the available roles for the given records management root node. + * System roles can be filtered + * + * @param filePlan file plan + * @param includeSystemRoles system roles + * @return + */ + Set getRoles(NodeRef filePlan, boolean includeSystemRoles); + + /** + * Gets the roles for a given user + * (includes also the system roles) + * + * @param filePlan file plan + * @param user user + * @return + */ + Set getRolesByUser(NodeRef filePlan, String user); + + /** + * Gets the roles for a given user. + * System roles can be filtered + * + * @param filePlan file plan + * @param user user + * @param includeSystemRoles system roles + * @return + */ + Set getRolesByUser(NodeRef filePlan, String user, boolean includeSystemRoles); + + /** + * Get a role by name + * + * @param filePlan file plan + * @param role role + * @return + */ + Role getRole(NodeRef filePlan, String role); + + /** + * Indicate whether a role exists for a given records management root node + * @param filePlan file plan + * @param role role + * @return + */ + boolean existsRole(NodeRef filePlan, String role); + + /** + * Determines whether the given user has the RM Admin role + * + * @param filePlan filePlan + * @param user user name to check + * @return true if the user has the RM Admin role, false otherwise + */ + boolean hasRMAdminRole(NodeRef filePlan, String user); + + /** + * Create a new role + * + * @param filePlan file plan + * @param role + * @param roleDisplayLabel + * @param capabilities + * @return + */ + Role createRole(NodeRef filePlan, String role, String roleDisplayLabel, Set capabilities); + + /** + * Update an existing role + * + * @param filePlan file plan + * @param role + * @param roleDisplayLabel + * @param capabilities + * @return + */ + Role updateRole(NodeRef filePlan, String role, String roleDisplayLabel, Set capabilities); + + /** + * Delete a role + * + * @param filePlan file plan + * @param role role + */ + void deleteRole(NodeRef filePlan, String role); + + /** + * Gets all the users that have been directly assigned to a role. + * + * @param filePlan file plan + * @param role role + * @return {@link Set}<{@link String}> set of users + */ + Set getUsersAssignedToRole(NodeRef filePlan, String role); + + /** + * Gets all the groups that have been directly assigned to a role. + * + * @param filePlan file plan + * @param role role + * @return {@link Set}<{@link String}> set of groups + */ + Set getGroupsAssignedToRole(NodeRef filePlan, String role); + + /** + * Gets all the groups and users that have been directly assigned to a role. + * + * @param filePlan file plan + * @param role role + * @return {@link Set}<{@link String}> set of groups and users + */ + Set getAllAssignedToRole(NodeRef filePlan, String role); + + /** + * Assign a role to an authority + * + * @param filePlan file plan + * @param role role + * @param authorityName authority name + */ + void assignRoleToAuthority(NodeRef filePlan, String role, String authorityName); + + + /** + * Unassign a role from an authority + * + * @param filePlan file plan + * @param role role + * @param authorityName authority name + */ + void unassignRoleFromAuthority(NodeRef filePlan, String role, String authorityName); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java index e4357d3d24..d5f6919a46 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java @@ -1,886 +1,886 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.role; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponent; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang.StringUtils; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Role service implementation - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanRoleServiceImpl implements FilePlanRoleService, - RecordsManagementModel -{ - /** I18N */ - private static final String MSG_ALL_ROLES = "rm.role.all"; - - /** Location of bootstrap role JSON */ - private static final String BOOTSTRAP_ROLE_JSON_LOCATION = "alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json"; - - /** JSON names */ - private static final String JSON_NAME = "name"; - private static final String JSON_DISPLAY_LABEL = "displayLabel"; - private static final String JSON_IS_ADMIN = "isAdmin"; - private static final String JSON_CAPABILITIES = "capabilities"; - - /** Capability service */ - private CapabilityService capabilityService; - - /** Authority service */ - private AuthorityService authorityService; - - /** Permission service */ - private PermissionService permissionService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Node service */ - private NodeService nodeService; - - private BootstrapImporterModuleComponent bootstrapImporterModule; - - /** Records management role zone */ - public static final String RM_ROLE_ZONE_PREFIX = "rmRoleZone"; - - /** Records Management Config Node */ - private static final String CONFIG_NODEID = "rm_config_folder"; - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * - * @param bootstrapImporterModuleComponent - */ - public void setBootstrapImporterModuleComponent(BootstrapImporterModuleComponent bootstrapImporterModuleComponent) - { - this.bootstrapImporterModule = bootstrapImporterModuleComponent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#initialiseFilePlan(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void setupFilePlanRoles(final NodeRef filePlan) - { - // Do not execute behaviour if this has been created in the archive store - if(filePlan.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE)) - { - // This is not the spaces store - probably the archive store - return; - } - - if (nodeService.exists(filePlan)) - { - List systemContainers = AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork>() - { - public List doWork() - { - List systemContainers = new ArrayList(3); - - //In a multi tenant store we need to initialize the rm config if it has been done yet - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); - if (!nodeService.exists(nodeRef)) - { - bootstrapImporterModule.execute(); - } - - // Create "all" role group for root node - String allRoles = authorityService.createAuthority( - AuthorityType.GROUP, - getAllRolesGroupShortName(filePlan), - I18NUtil.getMessage(MSG_ALL_ROLES), - new HashSet(Arrays.asList(RMAuthority.ZONE_APP_RM))); - - // Set the permissions - permissionService.setInheritParentPermissions(filePlan, false); - permissionService.setPermission(filePlan, allRoles, RMPermissionModel.READ_RECORDS, true); - - // Create the transfer and hold containers - systemContainers.add(filePlanService.createHoldContainer(filePlan)); - systemContainers.add(filePlanService.createTransferContainer(filePlan)); - - // Create the unfiled record container - systemContainers.add(filePlanService.createUnfiledContainer(filePlan)); - - return systemContainers; - } - }); - - // Bootstrap in the default set of roles for the newly created root node - bootstrapDefaultRoles(filePlan, systemContainers); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#tearDownFilePlanRoles(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void tearDownFilePlanRoles(final NodeRef filePlan) - { - AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - // cascade delete the 'all' roles group for the site - String allRolesGroup = authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); - Set groups = authorityService.getContainedAuthorities(AuthorityType.GROUP, allRolesGroup, true); - for (String group : groups) - { - authorityService.deleteAuthority(group); - } - - authorityService.deleteAuthority(allRolesGroup, false); - - return null; - } - }); - } - - /** - * Get all the roles by short name - * - * @param rmRootNode - * @return - */ - private String getAllRolesGroupShortName(NodeRef rmRootNode) - { - return RMAuthority.ALL_ROLES_PREFIX + rmRootNode.getId(); - } - - /** - * Bootstraps the default roles - * - * @param filePlan file plan - * @param systemContainers system containers - */ - private void bootstrapDefaultRoles(final NodeRef filePlan, final List systemContainers) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - try - { - JSONArray array = null; - try - { - // Load up the default roles from JSON - InputStream is = getClass().getClassLoader().getResourceAsStream(BOOTSTRAP_ROLE_JSON_LOCATION); - if (is == null) - { - throw new AlfrescoRuntimeException("Could not load default bootstrap roles configuration"); - } - array = new JSONArray(convertStreamToString(is)); - } - catch (IOException ioe) - { - throw new AlfrescoRuntimeException("Unable to load rm-default-roles-bootstrap.json configuration file.", ioe); - } - - // Add each role to the rm root node - for (int i = 0; i < array.length(); i++) - { - JSONObject object = array.getJSONObject(i); - - // Get the name of the role - String name = null; - if (object.has(JSON_NAME)) - { - name = object.getString(JSON_NAME); - if (existsRole(filePlan, name)) - { - throw new AlfrescoRuntimeException("The bootstrap role " + name + " already exists on the rm root node " + filePlan.toString()); - } - } - else - { - throw new AlfrescoRuntimeException("No name given to default bootstrap role. Check json configuration file."); - } - - - // Get the role's display label - String displayLabel = name; - if (object.has(JSON_DISPLAY_LABEL)) - { - displayLabel = object.getString(JSON_DISPLAY_LABEL); - } - - // Determine whether the role is an admin role or not - boolean isAdmin = false; - if (object.has(JSON_IS_ADMIN)) - { - isAdmin = object.getBoolean(JSON_IS_ADMIN); - } - - // Get the roles capabilities - Set capabilities = new HashSet(30); - if (object.has(JSON_CAPABILITIES)) - { - JSONArray arrCaps = object.getJSONArray(JSON_CAPABILITIES); - for (int index = 0; index < arrCaps.length(); index++) - { - String capName = arrCaps.getString(index); - Capability capability = capabilityService.getCapability(capName); - if (capability == null) - { - throw new AlfrescoRuntimeException("The capability '" + capName + "' configured for the deafult boostrap role '" + name + "' is invalid."); - } - capabilities.add(capability); - } - } - - // Create the role - Role role = createRole(filePlan, name, displayLabel, capabilities); - - // Add any additional admin permissions - if (isAdmin) - { - // Admin has filing - permissionService.setPermission(filePlan, role.getRoleGroupName(), RMPermissionModel.FILING, true); - if (systemContainers != null) - { - for (NodeRef systemContainer : systemContainers) - { - permissionService.setPermission(systemContainer, role.getRoleGroupName(), RMPermissionModel.FILING, true); - } - } - - // Add the creating user to the administration group - String user = AuthenticationUtil.getFullyAuthenticatedUser(); - authorityService.addAuthority(role.getRoleGroupName(), user); - - if (!AuthenticationUtil.getAdminUserName().equals(user)) - { - // add the dynamic admin authority - authorityService.addAuthority(role.getRoleGroupName(), AuthenticationUtil.getAdminUserName()); - } - } - } - } - catch (JSONException exception) - { - throw new AlfrescoRuntimeException("Error loading json configuration file rm-default-roles-bootstrap.json", exception); - } - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Helper method to convert a stream to a string. - * - * @param is input stream - * @return {@link String} string - * @throws IOException - */ - public String convertStreamToString(InputStream is) throws IOException - { - /* - * To convert the InputStream to String we use the BufferedReader.readLine() - * method. We iterate until the BufferedReader return null which means - * there's no more data to read. Each line will appended to a StringBuilder - * and returned as String. - */ - BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); - StringBuilder sb = new StringBuilder(); - - String line = null; - try - { - while ((line = reader.readLine()) != null) - { - sb.append(line + "\n"); - } - } - finally - { - try {is.close();} catch (IOException e) {} - } - - return sb.toString(); - } - - /** - * Helper method to check whether the current authority is a system role or not - * - * @param roleAuthority The role to check - * @return Returns true if roleAuthority is a system role, false otherwise - */ - private boolean isSystemRole(String roleAuthority) - { - boolean isSystemRole = false; - - for (String systemRole : SYSTEM_ROLES) - { - if (StringUtils.contains(roleAuthority, systemRole)) - { - isSystemRole = true; - break; - } - } - - return isSystemRole; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRoles() - */ - public Set getRoles(final NodeRef rmRootNode) - { - return getRoles(rmRootNode, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRoles(NodeRef, boolean) - */ - @Override - public Set getRoles(final NodeRef rmRootNode, final boolean includeSystemRoles) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() - { - public Set doWork() - { - Set result = new HashSet(13); - - Set roleAuthorities = authorityService.getAllAuthoritiesInZone(getZoneName(rmRootNode), AuthorityType.GROUP); - for (String roleAuthority : roleAuthorities) - { - if (includeSystemRoles || !isSystemRole(roleAuthority)) - { - String groupShortName = authorityService.getShortName(roleAuthority); - String name = getShortRoleName(groupShortName, rmRootNode); - String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); - String translated = I18NUtil.getMessage(displayLabel); - if (translated != null) - { - displayLabel = translated; - } - Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); - - Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName); - result.add(role); - } - } - - return result; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRolesByUser(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public Set getRolesByUser(final NodeRef rmRootNode, final String user) - { - return getRolesByUser(rmRootNode, user, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRolesByUser(NodeRef, String, boolean) - */ - @Override - public Set getRolesByUser(final NodeRef rmRootNode, final String user, final boolean includeSystemRoles) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() - { - public Set doWork() - { - Set result = new HashSet(13); - - Set roleAuthorities = authorityService.getAllAuthoritiesInZone(getZoneName(rmRootNode), AuthorityType.GROUP); - for (String roleAuthority : roleAuthorities) - { - Set users = authorityService.getContainedAuthorities(AuthorityType.USER, roleAuthority, false); - if (users.contains(user) && (includeSystemRoles || !isSystemRole(roleAuthority))) - { - String groupShortName = authorityService.getShortName(roleAuthority); - String name = getShortRoleName(groupShortName, rmRootNode); - String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); - String translated = I18NUtil.getMessage(displayLabel); - if (translated != null) - { - displayLabel = translated; - } - Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); - - Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName); - result.add(role); - } - } - - return result; - } - }, AuthenticationUtil.getSystemUserName()); - }; - - /** - * - * @param rmRootNode - * @return - */ - private String getZoneName(NodeRef rmRootNode) - { - return RM_ROLE_ZONE_PREFIX + rmRootNode.getId(); - } - - /** - * Get the full role name - * - * @param role - * @param rmRootNode - * @return - */ - private String getFullRoleName(String role, NodeRef rmRootNode) - { - return role + rmRootNode.getId(); - } - - /** - * Get the short role name - * - * @param fullRoleName - * @param rmRootNode - * @return - */ - private String getShortRoleName(String fullRoleName, NodeRef rmRootNode) - { - return fullRoleName.replaceAll(rmRootNode.getId(), ""); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - public Role getRole(final NodeRef rmRootNode, final String role) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Role doWork() - { - Role result = null; - - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - if (authorityService.authorityExists(roleAuthority)) - { - String name = getShortRoleName(authorityService.getShortName(roleAuthority), rmRootNode); - String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); - Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); - - result = new Role(name, displayLabel, capabilities, roleAuthority); - } - - return result; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * - * @param rmRootNode - * @param roleAuthority - * @return - */ - private Set getCapabilitiesImpl(NodeRef rmRootNode, String roleAuthority) - { - Set permissions = permissionService.getAllSetPermissions(rmRootNode); - Set capabilities = new HashSet(52); - for (AccessPermission permission : permissions) - { - if (permission.getAuthority().equals(roleAuthority)) - { - String capabilityName = permission.getPermission(); - Capability capability = capabilityService.getCapability(capabilityName); - if (capability != null && !capability.isPrivate()) - { - capabilities.add(capability); - } - } - } - - return capabilities; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#existsRole(java.lang.String) - */ - public boolean existsRole(final NodeRef rmRootNode, final String role) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Boolean doWork() - { - String fullRoleName = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - - String zone = getZoneName(rmRootNode); - Set roles = authorityService.getAllAuthoritiesInZone(zone, AuthorityType.GROUP); - return Boolean.valueOf(roles.contains(fullRoleName)); - } - }, AuthenticationUtil.getSystemUserName()).booleanValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - * - * TODO .. change this to check a property of the role its self - */ - public boolean hasRMAdminRole(NodeRef rmRootNode, String user) - { - boolean isAdmin = false; - - Set userRoles = this.getRolesByUser(rmRootNode, user); - if (userRoles != null) - { - for (Role role : userRoles) - { - if (role.getName().equals("Administrator")) - { - isAdmin = true; - break; - } - } - } - - return isAdmin; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#createRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) - */ - public Role createRole(final NodeRef filePlan, final String role, final String roleDisplayLabel, final Set capabilities) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Role doWork() - { - String fullRoleName = getFullRoleName(role, filePlan); - - // Check that the role does not already exist for the rm root node - if (authorityService.authorityExists(authorityService.getName(AuthorityType.GROUP, fullRoleName))) - { - throw new AlfrescoRuntimeException("The role " + role + " already exists for root rm node " + filePlan.getId()); - } - - // Create a group that relates to the records management role - Set zones = new HashSet(2); - zones.add(getZoneName(filePlan)); - zones.add(RMAuthority.ZONE_APP_RM); - - // Look up string, default to passed value if none found - String groupDisplayLabel = I18NUtil.getMessage(roleDisplayLabel); - if (groupDisplayLabel == null) - { - groupDisplayLabel = roleDisplayLabel; - } - - String roleGroup = authorityService.createAuthority(AuthorityType.GROUP, fullRoleName, groupDisplayLabel, zones); - - // do not add system roles to "all" - if (!isSystemRole(role)) - { - // Add the roleGroup to the "all" role group - String allRoleGroup = authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); - authorityService.addAuthority(allRoleGroup, roleGroup); - } - - // TODO .. we should be creating a permission set containing all the capabilities and then assigning that - // single permission group to the file plan .. would be tidier - - // Assign the various capabilities to the group on the root records management node - if (capabilities != null) - { - for (Capability capability : capabilities) - { - permissionService.setPermission(filePlan, roleGroup, capability.getName(), true); - } - } - - return new Role(role, roleDisplayLabel, capabilities, roleGroup); - } - }, AuthenticationUtil.getSystemUserName()); - } - - - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#updateRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) - */ - public Role updateRole(final NodeRef rmRootNode, final String role, final String roleDisplayLabel, final Set capabilities) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Role doWork() - { - if (!existsRole(rmRootNode, role)) - { - throw new AlfrescoRuntimeException("Unable to update role " + role + ", because it does not exist."); - } - - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - - // Reset the role display name - authorityService.setAuthorityDisplayName(roleAuthority, roleDisplayLabel); - - // TODO this needs to be improved, removing all and reading is not ideal - - // Clear the current capabilities - permissionService.clearPermission(rmRootNode, roleAuthority); - - // Re-add the provided capabilities - for (Capability capability : capabilities) - { - permissionService.setPermission(rmRootNode, roleAuthority, capability.getName(), true); - } - - return new Role(role, roleDisplayLabel, capabilities, roleAuthority); - - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deleteRole(java.lang.String) - */ - public void deleteRole(final NodeRef rmRootNode, final String role) - { - // ensure that we are not trying to delete the admin role - if (ROLE_ADMIN.equals(role)) - { - throw new AlfrescoRuntimeException("Can not delete the records management administration role."); - } - - // ensure that we are not trying to delete a system role - if (FilePlanRoleService.SYSTEM_ROLES.contains(role)) - { - throw new AlfrescoRuntimeException("'" + role + "' is a system role and cannot be deleted."); - } - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - authorityService.deleteAuthority(roleAuthority); - return null; - - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getUsersAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public Set getUsersAssignedToRole(final NodeRef filePlan, final String roleName) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("roleName", roleName); - - return getAuthoritiesAssignedToRole(filePlan, roleName, AuthorityType.USER); - } - - /** - * Gets all the authorities of a given type directly assigned to the given role in the file plan. - * - * @param filePlan file plan - * @param roleName role name - * @param authorityType authority type - * @return Set directly assigned authorities - */ - private Set getAuthoritiesAssignedToRole(final NodeRef filePlan, final String roleName, final AuthorityType authorityType) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() - { - public Set doWork() - { - Role role = getRole(filePlan, roleName); - if (role == null) - { - throw new AlfrescoRuntimeException("Can not get authorities for role " + roleName + ", because it does not exist. (filePlan=" + filePlan.toString() + ")"); - } - return authorityService.getContainedAuthorities(authorityType, role.getRoleGroupName(), true); - } - }, AuthenticationUtil.getSystemUserName()); - - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getGroupsAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public Set getGroupsAssignedToRole(final NodeRef filePlan, final String roleName) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("roleName", roleName); - - return getAuthoritiesAssignedToRole(filePlan, roleName, AuthorityType.GROUP); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getAllAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public Set getAllAssignedToRole(NodeRef filePlan, String role) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("roleName", role); - - Set result = new HashSet(21); - result.addAll(getUsersAssignedToRole(filePlan, role)); - result.addAll(getGroupsAssignedToRole(filePlan, role)); - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - public void assignRoleToAuthority(final NodeRef filePlan, final String role, final String authorityName) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - if (authorityService.authorityExists(authorityName) && - !getAllAssignedToRole(filePlan, role).contains(authorityName)) - { - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan)); - try - { - authorityService.addAuthority(roleAuthority, authorityName); - } - catch (DuplicateChildNodeNameException exception) - { - // ignore, because the work has already been performed - } - } - return null; - - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#unassignRoleFromAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - @Override - public void unassignRoleFromAuthority(final NodeRef filePlan, final String role, final String authorityName) - { - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan)); - authorityService.removeAuthority(roleAuthority, authorityName); - return null; - - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getAllRolesContainerGroup(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String getAllRolesContainerGroup(NodeRef filePlan) - { - return authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.role; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponent; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authority.RMAuthority; +import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AccessPermission; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Role service implementation + * + * @author Roy Wetherall + * @since 2.1 + */ +public class FilePlanRoleServiceImpl implements FilePlanRoleService, + RecordsManagementModel +{ + /** I18N */ + private static final String MSG_ALL_ROLES = "rm.role.all"; + + /** Location of bootstrap role JSON */ + private static final String BOOTSTRAP_ROLE_JSON_LOCATION = "alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json"; + + /** JSON names */ + private static final String JSON_NAME = "name"; + private static final String JSON_DISPLAY_LABEL = "displayLabel"; + private static final String JSON_IS_ADMIN = "isAdmin"; + private static final String JSON_CAPABILITIES = "capabilities"; + + /** Capability service */ + private CapabilityService capabilityService; + + /** Authority service */ + private AuthorityService authorityService; + + /** Permission service */ + private PermissionService permissionService; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Node service */ + private NodeService nodeService; + + private BootstrapImporterModuleComponent bootstrapImporterModule; + + /** Records management role zone */ + public static final String RM_ROLE_ZONE_PREFIX = "rmRoleZone"; + + /** Records Management Config Node */ + private static final String CONFIG_NODEID = "rm_config_folder"; + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * + * @param bootstrapImporterModuleComponent + */ + public void setBootstrapImporterModuleComponent(BootstrapImporterModuleComponent bootstrapImporterModuleComponent) + { + this.bootstrapImporterModule = bootstrapImporterModuleComponent; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#initialiseFilePlan(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void setupFilePlanRoles(final NodeRef filePlan) + { + // Do not execute behaviour if this has been created in the archive store + if(filePlan.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE)) + { + // This is not the spaces store - probably the archive store + return; + } + + if (nodeService.exists(filePlan)) + { + List systemContainers = AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork>() + { + public List doWork() + { + List systemContainers = new ArrayList(3); + + //In a multi tenant store we need to initialize the rm config if it has been done yet + NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID); + if (!nodeService.exists(nodeRef)) + { + bootstrapImporterModule.execute(); + } + + // Create "all" role group for root node + String allRoles = authorityService.createAuthority( + AuthorityType.GROUP, + getAllRolesGroupShortName(filePlan), + I18NUtil.getMessage(MSG_ALL_ROLES), + new HashSet(Arrays.asList(RMAuthority.ZONE_APP_RM))); + + // Set the permissions + permissionService.setInheritParentPermissions(filePlan, false); + permissionService.setPermission(filePlan, allRoles, RMPermissionModel.READ_RECORDS, true); + + // Create the transfer and hold containers + systemContainers.add(filePlanService.createHoldContainer(filePlan)); + systemContainers.add(filePlanService.createTransferContainer(filePlan)); + + // Create the unfiled record container + systemContainers.add(filePlanService.createUnfiledContainer(filePlan)); + + return systemContainers; + } + }); + + // Bootstrap in the default set of roles for the newly created root node + bootstrapDefaultRoles(filePlan, systemContainers); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#tearDownFilePlanRoles(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void tearDownFilePlanRoles(final NodeRef filePlan) + { + AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + // cascade delete the 'all' roles group for the site + String allRolesGroup = authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); + Set groups = authorityService.getContainedAuthorities(AuthorityType.GROUP, allRolesGroup, true); + for (String group : groups) + { + authorityService.deleteAuthority(group); + } + + authorityService.deleteAuthority(allRolesGroup, false); + + return null; + } + }); + } + + /** + * Get all the roles by short name + * + * @param rmRootNode + * @return + */ + private String getAllRolesGroupShortName(NodeRef rmRootNode) + { + return RMAuthority.ALL_ROLES_PREFIX + rmRootNode.getId(); + } + + /** + * Bootstraps the default roles + * + * @param filePlan file plan + * @param systemContainers system containers + */ + private void bootstrapDefaultRoles(final NodeRef filePlan, final List systemContainers) + { + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + try + { + JSONArray array = null; + try + { + // Load up the default roles from JSON + InputStream is = getClass().getClassLoader().getResourceAsStream(BOOTSTRAP_ROLE_JSON_LOCATION); + if (is == null) + { + throw new AlfrescoRuntimeException("Could not load default bootstrap roles configuration"); + } + array = new JSONArray(convertStreamToString(is)); + } + catch (IOException ioe) + { + throw new AlfrescoRuntimeException("Unable to load rm-default-roles-bootstrap.json configuration file.", ioe); + } + + // Add each role to the rm root node + for (int i = 0; i < array.length(); i++) + { + JSONObject object = array.getJSONObject(i); + + // Get the name of the role + String name = null; + if (object.has(JSON_NAME)) + { + name = object.getString(JSON_NAME); + if (existsRole(filePlan, name)) + { + throw new AlfrescoRuntimeException("The bootstrap role " + name + " already exists on the rm root node " + filePlan.toString()); + } + } + else + { + throw new AlfrescoRuntimeException("No name given to default bootstrap role. Check json configuration file."); + } + + + // Get the role's display label + String displayLabel = name; + if (object.has(JSON_DISPLAY_LABEL)) + { + displayLabel = object.getString(JSON_DISPLAY_LABEL); + } + + // Determine whether the role is an admin role or not + boolean isAdmin = false; + if (object.has(JSON_IS_ADMIN)) + { + isAdmin = object.getBoolean(JSON_IS_ADMIN); + } + + // Get the roles capabilities + Set capabilities = new HashSet(30); + if (object.has(JSON_CAPABILITIES)) + { + JSONArray arrCaps = object.getJSONArray(JSON_CAPABILITIES); + for (int index = 0; index < arrCaps.length(); index++) + { + String capName = arrCaps.getString(index); + Capability capability = capabilityService.getCapability(capName); + if (capability == null) + { + throw new AlfrescoRuntimeException("The capability '" + capName + "' configured for the deafult boostrap role '" + name + "' is invalid."); + } + capabilities.add(capability); + } + } + + // Create the role + Role role = createRole(filePlan, name, displayLabel, capabilities); + + // Add any additional admin permissions + if (isAdmin) + { + // Admin has filing + permissionService.setPermission(filePlan, role.getRoleGroupName(), RMPermissionModel.FILING, true); + if (systemContainers != null) + { + for (NodeRef systemContainer : systemContainers) + { + permissionService.setPermission(systemContainer, role.getRoleGroupName(), RMPermissionModel.FILING, true); + } + } + + // Add the creating user to the administration group + String user = AuthenticationUtil.getFullyAuthenticatedUser(); + authorityService.addAuthority(role.getRoleGroupName(), user); + + if (!AuthenticationUtil.getAdminUserName().equals(user)) + { + // add the dynamic admin authority + authorityService.addAuthority(role.getRoleGroupName(), AuthenticationUtil.getAdminUserName()); + } + } + } + } + catch (JSONException exception) + { + throw new AlfrescoRuntimeException("Error loading json configuration file rm-default-roles-bootstrap.json", exception); + } + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Helper method to convert a stream to a string. + * + * @param is input stream + * @return {@link String} string + * @throws IOException + */ + public String convertStreamToString(InputStream is) throws IOException + { + /* + * To convert the InputStream to String we use the BufferedReader.readLine() + * method. We iterate until the BufferedReader return null which means + * there's no more data to read. Each line will appended to a StringBuilder + * and returned as String. + */ + BufferedReader reader = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); + StringBuilder sb = new StringBuilder(); + + String line = null; + try + { + while ((line = reader.readLine()) != null) + { + sb.append(line + "\n"); + } + } + finally + { + try {is.close();} catch (IOException e) {} + } + + return sb.toString(); + } + + /** + * Helper method to check whether the current authority is a system role or not + * + * @param roleAuthority The role to check + * @return Returns true if roleAuthority is a system role, false otherwise + */ + private boolean isSystemRole(String roleAuthority) + { + boolean isSystemRole = false; + + for (String systemRole : SYSTEM_ROLES) + { + if (StringUtils.contains(roleAuthority, systemRole)) + { + isSystemRole = true; + break; + } + } + + return isSystemRole; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRoles() + */ + public Set getRoles(final NodeRef rmRootNode) + { + return getRoles(rmRootNode, true); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRoles(NodeRef, boolean) + */ + @Override + public Set getRoles(final NodeRef rmRootNode, final boolean includeSystemRoles) + { + return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() + { + public Set doWork() + { + Set result = new HashSet(13); + + Set roleAuthorities = authorityService.getAllAuthoritiesInZone(getZoneName(rmRootNode), AuthorityType.GROUP); + for (String roleAuthority : roleAuthorities) + { + if (includeSystemRoles || !isSystemRole(roleAuthority)) + { + String groupShortName = authorityService.getShortName(roleAuthority); + String name = getShortRoleName(groupShortName, rmRootNode); + String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); + String translated = I18NUtil.getMessage(displayLabel); + if (translated != null) + { + displayLabel = translated; + } + Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); + + Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName); + result.add(role); + } + } + + return result; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRolesByUser(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + public Set getRolesByUser(final NodeRef rmRootNode, final String user) + { + return getRolesByUser(rmRootNode, user, true); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getRolesByUser(NodeRef, String, boolean) + */ + @Override + public Set getRolesByUser(final NodeRef rmRootNode, final String user, final boolean includeSystemRoles) + { + return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() + { + public Set doWork() + { + Set result = new HashSet(13); + + Set roleAuthorities = authorityService.getAllAuthoritiesInZone(getZoneName(rmRootNode), AuthorityType.GROUP); + for (String roleAuthority : roleAuthorities) + { + Set users = authorityService.getContainedAuthorities(AuthorityType.USER, roleAuthority, false); + if (users.contains(user) && (includeSystemRoles || !isSystemRole(roleAuthority))) + { + String groupShortName = authorityService.getShortName(roleAuthority); + String name = getShortRoleName(groupShortName, rmRootNode); + String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); + String translated = I18NUtil.getMessage(displayLabel); + if (translated != null) + { + displayLabel = translated; + } + Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); + + Role role = new Role(name, displayLabel, capabilities, roleAuthority, groupShortName); + result.add(role); + } + } + + return result; + } + }, AuthenticationUtil.getSystemUserName()); + }; + + /** + * + * @param rmRootNode + * @return + */ + private String getZoneName(NodeRef rmRootNode) + { + return RM_ROLE_ZONE_PREFIX + rmRootNode.getId(); + } + + /** + * Get the full role name + * + * @param role + * @param rmRootNode + * @return + */ + private String getFullRoleName(String role, NodeRef rmRootNode) + { + return role + rmRootNode.getId(); + } + + /** + * Get the short role name + * + * @param fullRoleName + * @param rmRootNode + * @return + */ + private String getShortRoleName(String fullRoleName, NodeRef rmRootNode) + { + return fullRoleName.replaceAll(rmRootNode.getId(), ""); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + public Role getRole(final NodeRef rmRootNode, final String role) + { + return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Role doWork() + { + Role result = null; + + String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); + if (authorityService.authorityExists(roleAuthority)) + { + String name = getShortRoleName(authorityService.getShortName(roleAuthority), rmRootNode); + String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); + Set capabilities = getCapabilitiesImpl(rmRootNode, roleAuthority); + + result = new Role(name, displayLabel, capabilities, roleAuthority); + } + + return result; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * + * @param rmRootNode + * @param roleAuthority + * @return + */ + private Set getCapabilitiesImpl(NodeRef rmRootNode, String roleAuthority) + { + Set permissions = permissionService.getAllSetPermissions(rmRootNode); + Set capabilities = new HashSet(52); + for (AccessPermission permission : permissions) + { + if (permission.getAuthority().equals(roleAuthority)) + { + String capabilityName = permission.getPermission(); + Capability capability = capabilityService.getCapability(capabilityName); + if (capability != null && !capability.isPrivate()) + { + capabilities.add(capability); + } + } + } + + return capabilities; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#existsRole(java.lang.String) + */ + public boolean existsRole(final NodeRef rmRootNode, final String role) + { + return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Boolean doWork() + { + String fullRoleName = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); + + String zone = getZoneName(rmRootNode); + Set roles = authorityService.getAllAuthoritiesInZone(zone, AuthorityType.GROUP); + return Boolean.valueOf(roles.contains(fullRoleName)); + } + }, AuthenticationUtil.getSystemUserName()).booleanValue(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#hasRMAdminRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + * + * TODO .. change this to check a property of the role its self + */ + public boolean hasRMAdminRole(NodeRef rmRootNode, String user) + { + boolean isAdmin = false; + + Set userRoles = this.getRolesByUser(rmRootNode, user); + if (userRoles != null) + { + for (Role role : userRoles) + { + if (role.getName().equals("Administrator")) + { + isAdmin = true; + break; + } + } + } + + return isAdmin; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#createRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) + */ + public Role createRole(final NodeRef filePlan, final String role, final String roleDisplayLabel, final Set capabilities) + { + return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Role doWork() + { + String fullRoleName = getFullRoleName(role, filePlan); + + // Check that the role does not already exist for the rm root node + if (authorityService.authorityExists(authorityService.getName(AuthorityType.GROUP, fullRoleName))) + { + throw new AlfrescoRuntimeException("The role " + role + " already exists for root rm node " + filePlan.getId()); + } + + // Create a group that relates to the records management role + Set zones = new HashSet(2); + zones.add(getZoneName(filePlan)); + zones.add(RMAuthority.ZONE_APP_RM); + + // Look up string, default to passed value if none found + String groupDisplayLabel = I18NUtil.getMessage(roleDisplayLabel); + if (groupDisplayLabel == null) + { + groupDisplayLabel = roleDisplayLabel; + } + + String roleGroup = authorityService.createAuthority(AuthorityType.GROUP, fullRoleName, groupDisplayLabel, zones); + + // do not add system roles to "all" + if (!isSystemRole(role)) + { + // Add the roleGroup to the "all" role group + String allRoleGroup = authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); + authorityService.addAuthority(allRoleGroup, roleGroup); + } + + // TODO .. we should be creating a permission set containing all the capabilities and then assigning that + // single permission group to the file plan .. would be tidier + + // Assign the various capabilities to the group on the root records management node + if (capabilities != null) + { + for (Capability capability : capabilities) + { + permissionService.setPermission(filePlan, roleGroup, capability.getName(), true); + } + } + + return new Role(role, roleDisplayLabel, capabilities, roleGroup); + } + }, AuthenticationUtil.getSystemUserName()); + } + + + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#updateRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, java.util.Set) + */ + public Role updateRole(final NodeRef rmRootNode, final String role, final String roleDisplayLabel, final Set capabilities) + { + return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Role doWork() + { + if (!existsRole(rmRootNode, role)) + { + throw new AlfrescoRuntimeException("Unable to update role " + role + ", because it does not exist."); + } + + String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); + + // Reset the role display name + authorityService.setAuthorityDisplayName(roleAuthority, roleDisplayLabel); + + // TODO this needs to be improved, removing all and reading is not ideal + + // Clear the current capabilities + permissionService.clearPermission(rmRootNode, roleAuthority); + + // Re-add the provided capabilities + for (Capability capability : capabilities) + { + permissionService.setPermission(rmRootNode, roleAuthority, capability.getName(), true); + } + + return new Role(role, roleDisplayLabel, capabilities, roleAuthority); + + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deleteRole(java.lang.String) + */ + public void deleteRole(final NodeRef rmRootNode, final String role) + { + // ensure that we are not trying to delete the admin role + if (ROLE_ADMIN.equals(role)) + { + throw new AlfrescoRuntimeException("Can not delete the records management administration role."); + } + + // ensure that we are not trying to delete a system role + if (FilePlanRoleService.SYSTEM_ROLES.contains(role)) + { + throw new AlfrescoRuntimeException("'" + role + "' is a system role and cannot be deleted."); + } + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() + { + String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); + authorityService.deleteAuthority(roleAuthority); + return null; + + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getUsersAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public Set getUsersAssignedToRole(final NodeRef filePlan, final String roleName) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("roleName", roleName); + + return getAuthoritiesAssignedToRole(filePlan, roleName, AuthorityType.USER); + } + + /** + * Gets all the authorities of a given type directly assigned to the given role in the file plan. + * + * @param filePlan file plan + * @param roleName role name + * @param authorityType authority type + * @return Set directly assigned authorities + */ + private Set getAuthoritiesAssignedToRole(final NodeRef filePlan, final String roleName, final AuthorityType authorityType) + { + return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() + { + public Set doWork() + { + Role role = getRole(filePlan, roleName); + if (role == null) + { + throw new AlfrescoRuntimeException("Can not get authorities for role " + roleName + ", because it does not exist. (filePlan=" + filePlan.toString() + ")"); + } + return authorityService.getContainedAuthorities(authorityType, role.getRoleGroupName(), true); + } + }, AuthenticationUtil.getSystemUserName()); + + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getGroupsAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public Set getGroupsAssignedToRole(final NodeRef filePlan, final String roleName) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("roleName", roleName); + + return getAuthoritiesAssignedToRole(filePlan, roleName, AuthorityType.GROUP); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#getAllAssignedToRole(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + @Override + public Set getAllAssignedToRole(NodeRef filePlan, String role) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("roleName", role); + + Set result = new HashSet(21); + result.addAll(getUsersAssignedToRole(filePlan, role)); + result.addAll(getGroupsAssignedToRole(filePlan, role)); + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) + */ + public void assignRoleToAuthority(final NodeRef filePlan, final String role, final String authorityName) + { + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() + { + if (authorityService.authorityExists(authorityName) && + !getAllAssignedToRole(filePlan, role).contains(authorityName)) + { + String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan)); + try + { + authorityService.addAuthority(roleAuthority, authorityName); + } + catch (DuplicateChildNodeNameException exception) + { + // ignore, because the work has already been performed + } + } + return null; + + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#unassignRoleFromAuthority(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) + */ + @Override + public void unassignRoleFromAuthority(final NodeRef filePlan, final String role, final String authorityName) + { + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() + { + String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, filePlan)); + authorityService.removeAuthority(roleAuthority, authorityName); + return null; + + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getAllRolesContainerGroup(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public String getAllRolesContainerGroup(NodeRef filePlan) + { + return authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/Role.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/Role.java index 07ff98bbd0..7e485add16 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/Role.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/role/Role.java @@ -1,125 +1,125 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.role; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; - -/** - * Records management role class - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public class Role -{ - /** Role name */ - private String name; - - /** Role label */ - private String displayLabel; - - /** Role capabilities */ - private Set capabilities; - - /** Role group name */ - private String roleGroupName; - - /** Role group short name */ - private String groupShortName; - - /** - * @param name - * @param displayLabel - * @param capabilities - * @param roleGroupName - */ - public Role(String name, String displayLabel, Set capabilities, String roleGroupName) - { - this.name = name; - this.displayLabel = displayLabel; - this.capabilities = capabilities; - this.roleGroupName = roleGroupName; - } - - /** - * @param name - * @param displayLabel - * @param capabilities - * @param roleGroupName - * @param groupShortName - */ - public Role(String name, String displayLabel, Set capabilities, String roleGroupName, String groupShortName) - { - this(name, displayLabel, capabilities, roleGroupName); - this.groupShortName = groupShortName; - } - - /** - * @return the name - */ - public String getName() - { - return name; - } - - /** - * @return the displayLabel - */ - public String getDisplayLabel() - { - return displayLabel; - } - - /** - * @return the capabilities - */ - public Set getCapabilities() - { - return capabilities; - } - - /** - * @return the roleGroupName - */ - public String getRoleGroupName() - { - return roleGroupName; - } - - /** - * @return the groupShortName - */ - public String getGroupShortName() - { - return this.groupShortName; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.role; + +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; + +/** + * Records management role class + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public class Role +{ + /** Role name */ + private String name; + + /** Role label */ + private String displayLabel; + + /** Role capabilities */ + private Set capabilities; + + /** Role group name */ + private String roleGroupName; + + /** Role group short name */ + private String groupShortName; + + /** + * @param name + * @param displayLabel + * @param capabilities + * @param roleGroupName + */ + public Role(String name, String displayLabel, Set capabilities, String roleGroupName) + { + this.name = name; + this.displayLabel = displayLabel; + this.capabilities = capabilities; + this.roleGroupName = roleGroupName; + } + + /** + * @param name + * @param displayLabel + * @param capabilities + * @param roleGroupName + * @param groupShortName + */ + public Role(String name, String displayLabel, Set capabilities, String roleGroupName, String groupShortName) + { + this(name, displayLabel, capabilities, roleGroupName); + this.groupShortName = groupShortName; + } + + /** + * @return the name + */ + public String getName() + { + return name; + } + + /** + * @return the displayLabel + */ + public String getDisplayLabel() + { + return displayLabel; + } + + /** + * @return the capabilities + */ + public Set getCapabilities() + { + return capabilities; + } + + /** + * @return the roleGroupName + */ + public String getRoleGroupName() + { + return roleGroupName; + } + + /** + * @return the groupShortName + */ + public String getGroupShortName() + { + return this.groupShortName; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java index e3afeb99c1..b2e58b17ac 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java @@ -1,158 +1,158 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.WebScriptUtils.getTemplateVars; - -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Abstract base class for all RM webscript classes. - * Includes utility methods for processing the webscript request. - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public abstract class AbstractRmWebScript extends DeclarativeWebScript -{ - /** Constants */ - protected static final String PATH_SEPARATOR = "/"; - protected static final String STORE_TYPE = "store_type"; - protected static final String STORE_ID = "store_id"; - protected static final String ID = "id"; - protected static final String SUCCESS = "success"; - protected static final String INVERT = "__invert"; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Node service */ - private NodeService nodeService; - - /** - * Gets the disposition service instance - * - * @return The disposition service instance - */ - protected DispositionService getDispositionService() - { - return this.dispositionService; - } - - /** - * Sets the disposition service instance - * - * @param dispositionService The disposition service instance - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Gets the namespace service instance - * - * @return The namespace service instance - */ - protected NamespaceService getNamespaceService() - { - return this.namespaceService; - } - - /** - * Sets the namespace service instance - * - * @param namespaceService The namespace service instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Gets the node service instance - * - * @return The node service instance - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Sets the node service instance - * - * @param nodeService The node service instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Parses the request and providing it's valid returns the NodeRef. - * - * @param req The webscript request - * @return The NodeRef passed in the request - * - * @author Gavin Cornwell - */ - protected NodeRef parseRequestForNodeRef(WebScriptRequest req) - { - // get the parameters that represent the NodeRef, we know they are present - // otherwise this webscript would not have matched - Map templateVars = getTemplateVars(req); - String storeType = templateVars.get(STORE_TYPE); - String storeId = templateVars.get(STORE_ID); - String nodeId = templateVars.get(ID); - - // create the NodeRef and ensure it is valid - NodeRef nodeRef = new NodeRef(storeType, storeId, nodeId); - - if (!getNodeService().exists(nodeRef)) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: '" + - nodeRef.toString() + "'."); - } - - return nodeRef; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.WebScriptUtils.getTemplateVars; + +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.NamespaceService; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Abstract base class for all RM webscript classes. + * Includes utility methods for processing the webscript request. + * + * @author Neil McErlean + * @author Tuna Aksoy + */ +public abstract class AbstractRmWebScript extends DeclarativeWebScript +{ + /** Constants */ + protected static final String PATH_SEPARATOR = "/"; + protected static final String STORE_TYPE = "store_type"; + protected static final String STORE_ID = "store_id"; + protected static final String ID = "id"; + protected static final String SUCCESS = "success"; + protected static final String INVERT = "__invert"; + + /** Disposition service */ + private DispositionService dispositionService; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** Node service */ + private NodeService nodeService; + + /** + * Gets the disposition service instance + * + * @return The disposition service instance + */ + protected DispositionService getDispositionService() + { + return this.dispositionService; + } + + /** + * Sets the disposition service instance + * + * @param dispositionService The disposition service instance + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Gets the namespace service instance + * + * @return The namespace service instance + */ + protected NamespaceService getNamespaceService() + { + return this.namespaceService; + } + + /** + * Sets the namespace service instance + * + * @param namespaceService The namespace service instance + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * Gets the node service instance + * + * @return The node service instance + */ + protected NodeService getNodeService() + { + return this.nodeService; + } + + /** + * Sets the node service instance + * + * @param nodeService The node service instance + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Parses the request and providing it's valid returns the NodeRef. + * + * @param req The webscript request + * @return The NodeRef passed in the request + * + * @author Gavin Cornwell + */ + protected NodeRef parseRequestForNodeRef(WebScriptRequest req) + { + // get the parameters that represent the NodeRef, we know they are present + // otherwise this webscript would not have matched + Map templateVars = getTemplateVars(req); + String storeType = templateVars.get(STORE_TYPE); + String storeId = templateVars.get(STORE_ID); + String nodeId = templateVars.get(ID); + + // create the NodeRef and ensure it is valid + NodeRef nodeRef = new NodeRef(storeType, storeId, nodeId); + + if (!getNodeService().exists(nodeRef)) + { + throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: '" + + nodeRef.toString() + "'."); + } + + return nodeRef; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java index 096e32b8d8..8ecdb5012d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java @@ -1,227 +1,227 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.dictionary.IndexTokenisationMode; -import org.alfresco.repo.dictionary.M2Aspect; -import org.alfresco.repo.dictionary.M2ClassAssociation; -import org.alfresco.repo.dictionary.M2Model; -import org.alfresco.repo.dictionary.M2Property; -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.namespace.NamespaceService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This webscript applies necessary changes to the RM custom model in the repository. These changes - * are to 'patch' a deployed RM custom model during the DoD certification process. With that in mind - * they are safe to apply to a live database i.e. without side-effect to existing data and safe - * to call multiple times. - *

- * - * TODO This webscript should be removed after DOD certification as none of these patches are needed - * for a newly-installed DoD amp. - * - * @author neilm - */ -@Deprecated -public class ApplyDodCertModelFixesGet extends DeclarativeWebScript - implements RecordsManagementModel -{ - private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef("workspace://SpacesStore/records_management_custom_model"); - private static final String RMC_CUSTOM_RECORD_SERIES_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordSeriesProperties"; - private static final String RMC_CUSTOM_RECORD_CATEGORY_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordCategoryProperties"; - private static final String RMC_CUSTOM_RECORD_FOLDER_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordFolderProperties"; - private static final String RMC_CUSTOM_RECORD_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordProperties"; - - /** Logger */ - private static Log logger = LogFactory.getLog(ApplyDodCertModelFixesGet.class); - - private ContentService contentService; - private NamespaceService namespaceService; - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - if (logger.isInfoEnabled()) - { - logger.info("Applying webscript-based patches to RM custom model in the repo."); - } - - M2Model customModel = readCustomContentModel(); - - String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(namespaceService); - M2Aspect customAssocsAspect = customModel.getAspect(customAspectName); - - if (customAssocsAspect == null) - { - final String msg = "Unknown aspect: " + customAspectName; - if (logger.isErrorEnabled()) - { - logger.error(msg); - } - throw new AlfrescoRuntimeException(msg); - } - - - // MOB-1573. All custom references should have many-many multiplicity. - if (logger.isInfoEnabled()) - { - logger.info("MOB-1573. All custom references should have many-many multiplicity."); - } - - for (M2ClassAssociation classAssoc : customAssocsAspect.getAssociations()) - { - classAssoc.setSourceMany(true); - classAssoc.setTargetMany(true); - - } - - //MOB-1621. Custom fields should be created as untokenized by default. - if (logger.isInfoEnabled()) - { - logger.info("MOB-1621. Custom fields should be created as untokenized by default."); - } - - List allCustomPropertiesAspects = new ArrayList(4); - allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_SERIES_PROPERTIES); - allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_CATEGORY_PROPERTIES); - allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_FOLDER_PROPERTIES); - allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_PROPERTIES); - for (String aspectName : allCustomPropertiesAspects) - { - M2Aspect aspectObj = customModel.getAspect(aspectName); - List customProperties = aspectObj.getProperties(); - for (M2Property propertyObj : customProperties) - { - propertyObj.setIndexed(true); - propertyObj.setIndexedAtomically(true); - propertyObj.setStoredInIndex(false); - propertyObj.setIndexTokenisationMode(IndexTokenisationMode.FALSE); - } - } - - - writeCustomContentModel(customModel); - - if (logger.isInfoEnabled()) - { - logger.info("Completed application of webscript-based patches to RM custom model in the repo."); - } - - Map model = new HashMap(1, 1.0f); - model.put("success", true); - - return model; - } - - private M2Model readCustomContentModel() - { - ContentReader reader = this.contentService.getReader(RM_CUSTOM_MODEL_NODE_REF, - ContentModel.TYPE_CONTENT); - - if (!reader.exists()) {throw new AlfrescoRuntimeException("RM CustomModel has no content.");} - - InputStream contentIn = null; - M2Model deserializedModel = null; - try - { - contentIn = reader.getContentInputStream(); - deserializedModel = M2Model.createModel(contentIn); - } - finally - { - try - { - if (contentIn != null) - { - contentIn.close(); - } - } - catch (IOException ignored) - { - // Intentionally empty.` - } - } - return deserializedModel; - } - - private void writeCustomContentModel(M2Model deserializedModel) - { - ContentWriter writer = this.contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF, - ContentModel.TYPE_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_XML); - writer.setEncoding("UTF-8"); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - deserializedModel.toXML(baos); - - String updatedModelXml; - try - { - updatedModelXml = baos.toString("UTF-8"); - writer.putContent(updatedModelXml); - // putContent closes all resources. - // so we don't have to. - } catch (UnsupportedEncodingException uex) - { - throw new AlfrescoRuntimeException("Exception when writing custom model xml.", uex); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.dictionary.IndexTokenisationMode; +import org.alfresco.repo.dictionary.M2Aspect; +import org.alfresco.repo.dictionary.M2ClassAssociation; +import org.alfresco.repo.dictionary.M2Model; +import org.alfresco.repo.dictionary.M2Property; +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.namespace.NamespaceService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * This webscript applies necessary changes to the RM custom model in the repository. These changes + * are to 'patch' a deployed RM custom model during the DoD certification process. With that in mind + * they are safe to apply to a live database i.e. without side-effect to existing data and safe + * to call multiple times. + *

+ * + * TODO This webscript should be removed after DOD certification as none of these patches are needed + * for a newly-installed DoD amp. + * + * @author neilm + */ +@Deprecated +public class ApplyDodCertModelFixesGet extends DeclarativeWebScript + implements RecordsManagementModel +{ + private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef("workspace://SpacesStore/records_management_custom_model"); + private static final String RMC_CUSTOM_RECORD_SERIES_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordSeriesProperties"; + private static final String RMC_CUSTOM_RECORD_CATEGORY_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordCategoryProperties"; + private static final String RMC_CUSTOM_RECORD_FOLDER_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordFolderProperties"; + private static final String RMC_CUSTOM_RECORD_PROPERTIES = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customRecordProperties"; + + /** Logger */ + private static Log logger = LogFactory.getLog(ApplyDodCertModelFixesGet.class); + + private ContentService contentService; + private NamespaceService namespaceService; + + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + if (logger.isInfoEnabled()) + { + logger.info("Applying webscript-based patches to RM custom model in the repo."); + } + + M2Model customModel = readCustomContentModel(); + + String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(namespaceService); + M2Aspect customAssocsAspect = customModel.getAspect(customAspectName); + + if (customAssocsAspect == null) + { + final String msg = "Unknown aspect: " + customAspectName; + if (logger.isErrorEnabled()) + { + logger.error(msg); + } + throw new AlfrescoRuntimeException(msg); + } + + + // MOB-1573. All custom references should have many-many multiplicity. + if (logger.isInfoEnabled()) + { + logger.info("MOB-1573. All custom references should have many-many multiplicity."); + } + + for (M2ClassAssociation classAssoc : customAssocsAspect.getAssociations()) + { + classAssoc.setSourceMany(true); + classAssoc.setTargetMany(true); + + } + + //MOB-1621. Custom fields should be created as untokenized by default. + if (logger.isInfoEnabled()) + { + logger.info("MOB-1621. Custom fields should be created as untokenized by default."); + } + + List allCustomPropertiesAspects = new ArrayList(4); + allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_SERIES_PROPERTIES); + allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_CATEGORY_PROPERTIES); + allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_FOLDER_PROPERTIES); + allCustomPropertiesAspects.add(RMC_CUSTOM_RECORD_PROPERTIES); + for (String aspectName : allCustomPropertiesAspects) + { + M2Aspect aspectObj = customModel.getAspect(aspectName); + List customProperties = aspectObj.getProperties(); + for (M2Property propertyObj : customProperties) + { + propertyObj.setIndexed(true); + propertyObj.setIndexedAtomically(true); + propertyObj.setStoredInIndex(false); + propertyObj.setIndexTokenisationMode(IndexTokenisationMode.FALSE); + } + } + + + writeCustomContentModel(customModel); + + if (logger.isInfoEnabled()) + { + logger.info("Completed application of webscript-based patches to RM custom model in the repo."); + } + + Map model = new HashMap(1, 1.0f); + model.put("success", true); + + return model; + } + + private M2Model readCustomContentModel() + { + ContentReader reader = this.contentService.getReader(RM_CUSTOM_MODEL_NODE_REF, + ContentModel.TYPE_CONTENT); + + if (!reader.exists()) {throw new AlfrescoRuntimeException("RM CustomModel has no content.");} + + InputStream contentIn = null; + M2Model deserializedModel = null; + try + { + contentIn = reader.getContentInputStream(); + deserializedModel = M2Model.createModel(contentIn); + } + finally + { + try + { + if (contentIn != null) + { + contentIn.close(); + } + } + catch (IOException ignored) + { + // Intentionally empty.` + } + } + return deserializedModel; + } + + private void writeCustomContentModel(M2Model deserializedModel) + { + ContentWriter writer = this.contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF, + ContentModel.TYPE_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_XML); + writer.setEncoding("UTF-8"); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + deserializedModel.toXML(baos); + + String updatedModelXml; + try + { + updatedModelXml = baos.toString("UTF-8"); + writer.putContent(updatedModelXml); + // putContent closes all resources. + // so we don't have to. + } catch (UnsupportedEncodingException uex) + { + throw new AlfrescoRuntimeException("Exception when writing custom model xml.", uex); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java index 0338d90dcf..caba8a9482 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java @@ -1,164 +1,164 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.dictionary.M2Aspect; -import org.alfresco.repo.dictionary.M2ClassAssociation; -import org.alfresco.repo.dictionary.M2Model; -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.namespace.NamespaceService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This webscript patches the RM custom model as fix for MOB-1573. It is only necessary for databases - * that had their RM amps initialised before the fix went in. - * There is no side-effect if it is called when it is not needed or if it is called multiple times. - * - * TODO This webscript should be removed after DOD certification. - * - * @author neilm - */ -@Deprecated -public class ApplyFixMob1573Get extends DeclarativeWebScript - implements RecordsManagementModel -{ - private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef("workspace://SpacesStore/records_management_custom_model"); - - private ContentService contentService; - private NamespaceService namespaceService; - - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - M2Model customModel = readCustomContentModel(); - - // Go through every custom reference defined in the custom model and make sure that it - // has many-to-many multiplicity - String aspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(namespaceService); - M2Aspect customAssocsAspect = customModel.getAspect(aspectName); - - if (customAssocsAspect == null) - { - throw new AlfrescoRuntimeException("Unknown aspect: "+aspectName); - } - - for (M2ClassAssociation classAssoc : customAssocsAspect.getAssociations()) - { - classAssoc.setSourceMany(true); - classAssoc.setTargetMany(true); - } - - writeCustomContentModel(customModel); - - Map model = new HashMap(1, 1.0f); - model.put("success", true); - - return model; - } - - private M2Model readCustomContentModel() - { - ContentReader reader = contentService.getReader(RM_CUSTOM_MODEL_NODE_REF, - ContentModel.TYPE_CONTENT); - - if (!reader.exists()) {throw new AlfrescoRuntimeException("RM CustomModel has no content.");} - - InputStream contentIn = null; - M2Model deserializedModel = null; - try - { - contentIn = reader.getContentInputStream(); - deserializedModel = M2Model.createModel(contentIn); - } - finally - { - try - { - if (contentIn != null) - { - contentIn.close(); - } - } - catch (IOException ignored) - { - // Intentionally empty. - } - } - return deserializedModel; - } - - private void writeCustomContentModel(M2Model deserializedModel) - { - ContentWriter writer = contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF, - ContentModel.TYPE_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_XML); - writer.setEncoding("UTF-8"); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - deserializedModel.toXML(baos); - - String updatedModelXml; - try - { - updatedModelXml = baos.toString("UTF-8"); - writer.putContent(updatedModelXml); - // putContent closes all resources. - // so we don't have to. - } catch (UnsupportedEncodingException uex) - { - throw new AlfrescoRuntimeException("Exception when writing custom model xml.", uex); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.dictionary.M2Aspect; +import org.alfresco.repo.dictionary.M2ClassAssociation; +import org.alfresco.repo.dictionary.M2Model; +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.namespace.NamespaceService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * This webscript patches the RM custom model as fix for MOB-1573. It is only necessary for databases + * that had their RM amps initialised before the fix went in. + * There is no side-effect if it is called when it is not needed or if it is called multiple times. + * + * TODO This webscript should be removed after DOD certification. + * + * @author neilm + */ +@Deprecated +public class ApplyFixMob1573Get extends DeclarativeWebScript + implements RecordsManagementModel +{ + private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef("workspace://SpacesStore/records_management_custom_model"); + + private ContentService contentService; + private NamespaceService namespaceService; + + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + M2Model customModel = readCustomContentModel(); + + // Go through every custom reference defined in the custom model and make sure that it + // has many-to-many multiplicity + String aspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(namespaceService); + M2Aspect customAssocsAspect = customModel.getAspect(aspectName); + + if (customAssocsAspect == null) + { + throw new AlfrescoRuntimeException("Unknown aspect: "+aspectName); + } + + for (M2ClassAssociation classAssoc : customAssocsAspect.getAssociations()) + { + classAssoc.setSourceMany(true); + classAssoc.setTargetMany(true); + } + + writeCustomContentModel(customModel); + + Map model = new HashMap(1, 1.0f); + model.put("success", true); + + return model; + } + + private M2Model readCustomContentModel() + { + ContentReader reader = contentService.getReader(RM_CUSTOM_MODEL_NODE_REF, + ContentModel.TYPE_CONTENT); + + if (!reader.exists()) {throw new AlfrescoRuntimeException("RM CustomModel has no content.");} + + InputStream contentIn = null; + M2Model deserializedModel = null; + try + { + contentIn = reader.getContentInputStream(); + deserializedModel = M2Model.createModel(contentIn); + } + finally + { + try + { + if (contentIn != null) + { + contentIn.close(); + } + } + catch (IOException ignored) + { + // Intentionally empty. + } + } + return deserializedModel; + } + + private void writeCustomContentModel(M2Model deserializedModel) + { + ContentWriter writer = contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF, + ContentModel.TYPE_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_XML); + writer.setEncoding("UTF-8"); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + deserializedModel.toXML(baos); + + String updatedModelXml; + try + { + updatedModelXml = baos.toString("UTF-8"); + writer.putContent(updatedModelXml); + // putContent closes all resources. + // so we don't have to. + } catch (UnsupportedEncodingException uex) + { + throw new AlfrescoRuntimeException("Exception when writing custom model xml.", uex); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java index ded32611a7..419c98aa95 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to clear the - * Records Management audit log. - * - * @author Gavin Cornwell - */ -public class AuditLogDelete extends BaseAuditAdminWebScript -{ - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - this.rmAuditService.clearAuditLog(getDefaultFilePlan()); - - // create model object with the audit status model - Map model = new HashMap(1); - model.put("auditstatus", createAuditStatusModel()); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to clear the + * Records Management audit log. + * + * @author Gavin Cornwell + */ +public class AuditLogDelete extends BaseAuditAdminWebScript +{ + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + this.rmAuditService.clearAuditLog(getDefaultFilePlan()); + + // create model object with the audit status model + Map model = new HashMap(1); + model.put("auditstatus", createAuditStatusModel()); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogGet.java index aac1f0298a..fde596e2c8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogGet.java @@ -1,169 +1,169 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.File; -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.ReportFormat; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Implementation for Java backed webscript to return audit - * log of RM events, optionally scoped to an RM node. - * - * @author Gavin Cornwell - */ -public class AuditLogGet extends BaseAuditRetrievalWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(AuditLogGet.class); - - private static final String PARAM_EXPORT = "export"; - private static final String ACCESS_AUDIT_CAPABILITY = "AccessAudit"; - - /** Content Streamer */ - protected ContentStreamer contentStreamer; - - /** Capability service */ - protected CapabilityService capabilityService; - - /** File plan service */ - protected FilePlanService filePlanService; - - /** - * @param contentStreamer - */ - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - /** - * - * @param capabilityService Capability Service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * - * @param capabilityService Capability Service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - @Override - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - File auditTrail = null; - - try - { - - RecordsManagementAuditQueryParameters queryParams = parseQueryParameters(req); - ReportFormat reportFormat = parseReportFormat(req); - - if( !userCanAccessAudit(queryParams) ) - { - throw new WebScriptException(Status.STATUS_FORBIDDEN, "Access denied because the user does not have the Access Audit capability"); - } - // parse the parameters and get a file containing the audit trail - auditTrail = this.rmAuditService.getAuditTrailFile(queryParams, reportFormat); - - if (logger.isDebugEnabled()) - { - logger.debug("Streaming audit trail from file: " + auditTrail.getAbsolutePath()); - } - - boolean attach = false; - String attachFileName = null; - String export = req.getParameter(PARAM_EXPORT); - if (export != null && Boolean.parseBoolean(export)) - { - attach = true; - attachFileName = auditTrail.getName(); - - if (logger.isDebugEnabled()) - { - logger.debug("Exporting audit trail using file name: " + attachFileName); - } - } - - // stream the file back to the client - contentStreamer.streamContent(req, res, auditTrail, null, attach, attachFileName, null); - } - finally - { - if (auditTrail != null) - { - if (logger.isDebugEnabled()) - { - logger.debug( - "Audit results written to file: \n" + - " File: " + auditTrail + "\n" + - " Parameter: " + parseQueryParameters(req)); - } - else - { - auditTrail.delete(); - } - } - } - } - - private boolean userCanAccessAudit(RecordsManagementAuditQueryParameters queryParams) - { - NodeRef targetNode = queryParams.getNodeRef(); - if( targetNode == null ) - { - targetNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if(targetNode == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The default RM site was not found"); - } - } - return AccessStatus.ALLOWED.equals( - capabilityService.getCapabilityAccessState(targetNode, ACCESS_AUDIT_CAPABILITY)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.File; +import java.io.IOException; + +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.ReportFormat; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.repo.web.scripts.content.ContentStreamer; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; + +/** + * Implementation for Java backed webscript to return audit + * log of RM events, optionally scoped to an RM node. + * + * @author Gavin Cornwell + */ +public class AuditLogGet extends BaseAuditRetrievalWebScript +{ + /** Logger */ + private static Log logger = LogFactory.getLog(AuditLogGet.class); + + private static final String PARAM_EXPORT = "export"; + private static final String ACCESS_AUDIT_CAPABILITY = "AccessAudit"; + + /** Content Streamer */ + protected ContentStreamer contentStreamer; + + /** Capability service */ + protected CapabilityService capabilityService; + + /** File plan service */ + protected FilePlanService filePlanService; + + /** + * @param contentStreamer + */ + public void setContentStreamer(ContentStreamer contentStreamer) + { + this.contentStreamer = contentStreamer; + } + + /** + * + * @param capabilityService Capability Service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * + * @param capabilityService Capability Service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + @Override + public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException + { + File auditTrail = null; + + try + { + + RecordsManagementAuditQueryParameters queryParams = parseQueryParameters(req); + ReportFormat reportFormat = parseReportFormat(req); + + if( !userCanAccessAudit(queryParams) ) + { + throw new WebScriptException(Status.STATUS_FORBIDDEN, "Access denied because the user does not have the Access Audit capability"); + } + // parse the parameters and get a file containing the audit trail + auditTrail = this.rmAuditService.getAuditTrailFile(queryParams, reportFormat); + + if (logger.isDebugEnabled()) + { + logger.debug("Streaming audit trail from file: " + auditTrail.getAbsolutePath()); + } + + boolean attach = false; + String attachFileName = null; + String export = req.getParameter(PARAM_EXPORT); + if (export != null && Boolean.parseBoolean(export)) + { + attach = true; + attachFileName = auditTrail.getName(); + + if (logger.isDebugEnabled()) + { + logger.debug("Exporting audit trail using file name: " + attachFileName); + } + } + + // stream the file back to the client + contentStreamer.streamContent(req, res, auditTrail, null, attach, attachFileName, null); + } + finally + { + if (auditTrail != null) + { + if (logger.isDebugEnabled()) + { + logger.debug( + "Audit results written to file: \n" + + " File: " + auditTrail + "\n" + + " Parameter: " + parseQueryParameters(req)); + } + else + { + auditTrail.delete(); + } + } + } + } + + private boolean userCanAccessAudit(RecordsManagementAuditQueryParameters queryParams) + { + NodeRef targetNode = queryParams.getNodeRef(); + if( targetNode == null ) + { + targetNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if(targetNode == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "The default RM site was not found"); + } + } + return AccessStatus.ALLOWED.equals( + capabilityService.getCapabilityAccessState(targetNode, ACCESS_AUDIT_CAPABILITY)); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPost.java index 2387696f78..cf0de08e27 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPost.java @@ -1,298 +1,298 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.IOException; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Implementation for Java backed webscript to file an - * audit log as a record. - * - * @author Gavin Cornwell - */ -public class AuditLogPost extends BaseAuditRetrievalWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(AuditLogPost.class); - - /** Constants */ - protected static final String PARAM_DESTINATION = "destination"; - protected static final String RESPONSE_SUCCESS = "success"; - protected static final String RESPONSE_RECORD = "record"; - protected static final String RESPONSE_RECORD_NAME = "recordName"; - - /** Record folder service */ - private RecordFolderService recordFolderService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** - * Sets the record folder service - * - * @param recordFolderService Record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * Sets the disposition service - * - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @see org.alfresco.repo.web.scripts.content.StreamContent#execute(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.WebScriptResponse) - */ - @Override - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - try - { - ParameterCheck.mandatory("req", req); - ParameterCheck.mandatory("res", res); - - // build the json object from the request - JSONObject json = getJSONObjectFromRequest(req); - - // extract the destination parameter, ensure it's present and it is a record folder and not closed or cut off - NodeRef destination = getDestination(json); - - // file audit trail as a record - NodeRef record = fileAuditTrail(destination, req); - - // create response - String response = createResponse(record); - - // write the JSON response - writeResponse(res, response); - } - catch (Exception ex) - { - JSONObject json = new JSONObject(); - putToJSONObject(json, "message", ex.getMessage()); - writeResponse(res, json.toString()); - } - } - - /** - * Helper method to write the response to the web script response - * - * @param res {@link WebScriptResponse} Web script response - * @param reponse {@link String} Response to write - * @throws IOException can throw an exception whilst writing the response - */ - private void writeResponse(WebScriptResponse res, String response) throws IOException - { - // setup response - res.setContentType(MimetypeMap.MIMETYPE_JSON); - res.setContentEncoding("UTF-8"); - res.setHeader("Content-Length", Long.toString(response.length())); - - // write the JSON response - res.getWriter().write(response); - } - - /** - * Helper method to create the response text from the record - * - * @param record {@link NodeRef} The audit trail as record - * @return Response text as {@link String} - */ - @SuppressWarnings("null") - private String createResponse(NodeRef record) - { - JSONObject responseJSON = new JSONObject(); - boolean recordExists = record != null; - - putToJSONObject(responseJSON, RESPONSE_SUCCESS, recordExists); - - if (recordExists) - { - putToJSONObject(responseJSON, RESPONSE_RECORD, record.toString()); - putToJSONObject(responseJSON, RESPONSE_RECORD_NAME, (String) nodeService.getProperty(record, ContentModel.PROP_NAME)); - } - - return responseJSON.toString(); - } - - /** - * Helper method to put a key and a value to a json object. - * It handles the {@link JSONException} so that a try/catch - * block is not need through out the code - * - * @param json The json object the key/value write to - * @param key The key which will be written to the json object - * @param value The value which will be written to the json object - */ - private void putToJSONObject(JSONObject json, String key, Object value) - { - try - { - json.put(key, value); - } - catch (JSONException error) - { - throw new AlfrescoRuntimeException("Error writing the value '" + value + "' of the key '" + key + "' to the json object.", error); - } - } - - /** - * Helper method which will file the audit trail - * - * @param destination The destination where the audit trail will be filed - * @param req {@link WebScriptRequest} from which additional parameters will be retrieved - * @return The {@link NodeRef} of the record - */ - private NodeRef fileAuditTrail(NodeRef destination, WebScriptRequest req) - { - - NodeRef record = rmAuditService.fileAuditTrailAsRecord(parseQueryParameters(req), destination, parseReportFormat(req)); - - if (logger.isDebugEnabled()) - { - logger.debug("Filed audit trail as new record: '" + record + "'."); - } - - return record; - } - - /** - * Helper method to create a json object from the request - * - * @param req {@link WebScriptRequest} from which the json object will be created - * @return Returns a json object containing the request content - * @throws IOException can throw an exception whilst getting the content from the request - */ - private JSONObject getJSONObjectFromRequest(WebScriptRequest req) throws IOException - { - JSONObject json; - - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - } - catch (JSONException error) - { - throw new AlfrescoRuntimeException("Error creating json object from request content.", error); - } - - return json; - } - - /** - * Helper method to get the destination from the json object - * - * @param json The json object which was created from the request content - * @return {@link NodeRef} The destination of the audit log - */ - private NodeRef getDestination(JSONObject json) - { - if (!json.has(PARAM_DESTINATION)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory parameter '" + PARAM_DESTINATION + "' has not been supplied."); - } - - String destinationParam; - try - { - destinationParam = json.getString(PARAM_DESTINATION); - } - catch (JSONException error) - { - throw new AlfrescoRuntimeException("Error extracting 'destination' from parameter.", error); - } - - if (StringUtils.isBlank(destinationParam)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Please select a record folder."); - } - - NodeRef destination = new NodeRef(destinationParam); - if (!nodeService.exists(destination)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "Selected node does not exist"); - } - - // ensure the node is a record folder - if (!RecordsManagementModel.TYPE_RECORD_FOLDER.equals(nodeService.getType(destination))) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Selected node is not a record folder"); - } - - // ensure the record folder is not closed - if (recordFolderService.isRecordFolderClosed(destination)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Cannot file into a closed folder."); - } - - // ensure the record folder is not cut off - if (dispositionService.isDisposableItemCutoff(destination)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Cannot file into a cut off folder."); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Filing audit trail as record in record folder: '" + destination + "'."); - } - - return destination; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.IOException; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; + +/** + * Implementation for Java backed webscript to file an + * audit log as a record. + * + * @author Gavin Cornwell + */ +public class AuditLogPost extends BaseAuditRetrievalWebScript +{ + /** Logger */ + private static Log logger = LogFactory.getLog(AuditLogPost.class); + + /** Constants */ + protected static final String PARAM_DESTINATION = "destination"; + protected static final String RESPONSE_SUCCESS = "success"; + protected static final String RESPONSE_RECORD = "record"; + protected static final String RESPONSE_RECORD_NAME = "recordName"; + + /** Record folder service */ + private RecordFolderService recordFolderService; + + /** Disposition service */ + private DispositionService dispositionService; + + /** + * Sets the record folder service + * + * @param recordFolderService Record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * Sets the disposition service + * + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @see org.alfresco.repo.web.scripts.content.StreamContent#execute(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.WebScriptResponse) + */ + @Override + public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException + { + try + { + ParameterCheck.mandatory("req", req); + ParameterCheck.mandatory("res", res); + + // build the json object from the request + JSONObject json = getJSONObjectFromRequest(req); + + // extract the destination parameter, ensure it's present and it is a record folder and not closed or cut off + NodeRef destination = getDestination(json); + + // file audit trail as a record + NodeRef record = fileAuditTrail(destination, req); + + // create response + String response = createResponse(record); + + // write the JSON response + writeResponse(res, response); + } + catch (Exception ex) + { + JSONObject json = new JSONObject(); + putToJSONObject(json, "message", ex.getMessage()); + writeResponse(res, json.toString()); + } + } + + /** + * Helper method to write the response to the web script response + * + * @param res {@link WebScriptResponse} Web script response + * @param reponse {@link String} Response to write + * @throws IOException can throw an exception whilst writing the response + */ + private void writeResponse(WebScriptResponse res, String response) throws IOException + { + // setup response + res.setContentType(MimetypeMap.MIMETYPE_JSON); + res.setContentEncoding("UTF-8"); + res.setHeader("Content-Length", Long.toString(response.length())); + + // write the JSON response + res.getWriter().write(response); + } + + /** + * Helper method to create the response text from the record + * + * @param record {@link NodeRef} The audit trail as record + * @return Response text as {@link String} + */ + @SuppressWarnings("null") + private String createResponse(NodeRef record) + { + JSONObject responseJSON = new JSONObject(); + boolean recordExists = record != null; + + putToJSONObject(responseJSON, RESPONSE_SUCCESS, recordExists); + + if (recordExists) + { + putToJSONObject(responseJSON, RESPONSE_RECORD, record.toString()); + putToJSONObject(responseJSON, RESPONSE_RECORD_NAME, (String) nodeService.getProperty(record, ContentModel.PROP_NAME)); + } + + return responseJSON.toString(); + } + + /** + * Helper method to put a key and a value to a json object. + * It handles the {@link JSONException} so that a try/catch + * block is not need through out the code + * + * @param json The json object the key/value write to + * @param key The key which will be written to the json object + * @param value The value which will be written to the json object + */ + private void putToJSONObject(JSONObject json, String key, Object value) + { + try + { + json.put(key, value); + } + catch (JSONException error) + { + throw new AlfrescoRuntimeException("Error writing the value '" + value + "' of the key '" + key + "' to the json object.", error); + } + } + + /** + * Helper method which will file the audit trail + * + * @param destination The destination where the audit trail will be filed + * @param req {@link WebScriptRequest} from which additional parameters will be retrieved + * @return The {@link NodeRef} of the record + */ + private NodeRef fileAuditTrail(NodeRef destination, WebScriptRequest req) + { + + NodeRef record = rmAuditService.fileAuditTrailAsRecord(parseQueryParameters(req), destination, parseReportFormat(req)); + + if (logger.isDebugEnabled()) + { + logger.debug("Filed audit trail as new record: '" + record + "'."); + } + + return record; + } + + /** + * Helper method to create a json object from the request + * + * @param req {@link WebScriptRequest} from which the json object will be created + * @return Returns a json object containing the request content + * @throws IOException can throw an exception whilst getting the content from the request + */ + private JSONObject getJSONObjectFromRequest(WebScriptRequest req) throws IOException + { + JSONObject json; + + try + { + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + } + catch (JSONException error) + { + throw new AlfrescoRuntimeException("Error creating json object from request content.", error); + } + + return json; + } + + /** + * Helper method to get the destination from the json object + * + * @param json The json object which was created from the request content + * @return {@link NodeRef} The destination of the audit log + */ + private NodeRef getDestination(JSONObject json) + { + if (!json.has(PARAM_DESTINATION)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory parameter '" + PARAM_DESTINATION + "' has not been supplied."); + } + + String destinationParam; + try + { + destinationParam = json.getString(PARAM_DESTINATION); + } + catch (JSONException error) + { + throw new AlfrescoRuntimeException("Error extracting 'destination' from parameter.", error); + } + + if (StringUtils.isBlank(destinationParam)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Please select a record folder."); + } + + NodeRef destination = new NodeRef(destinationParam); + if (!nodeService.exists(destination)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, + "Selected node does not exist"); + } + + // ensure the node is a record folder + if (!RecordsManagementModel.TYPE_RECORD_FOLDER.equals(nodeService.getType(destination))) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Selected node is not a record folder"); + } + + // ensure the record folder is not closed + if (recordFolderService.isRecordFolderClosed(destination)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Cannot file into a closed folder."); + } + + // ensure the record folder is not cut off + if (dispositionService.isDisposableItemCutoff(destination)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Cannot file into a cut off folder."); + } + + if (logger.isDebugEnabled()) + { + logger.debug("Filing audit trail as record in record folder: '" + destination + "'."); + } + + return destination; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java index 4105325052..fd7a1abae3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java @@ -1,96 +1,96 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to start - * and stop Records Management auditing. - * - * @author Gavin Cornwell - */ -public class AuditLogPut extends BaseAuditAdminWebScript -{ - protected static final String PARAM_ENABLED = "enabled"; - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - try - { - // determine whether to start or stop auditing - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // check the enabled property present - if (!json.has(PARAM_ENABLED)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'enabled' parameter was not provided in request body"); - } - - boolean enabled = json.getBoolean(PARAM_ENABLED); - if (enabled) - { - this.rmAuditService.startAuditLog(getDefaultFilePlan()); - } - else - { - this.rmAuditService.stopAuditLog(getDefaultFilePlan()); - } - - // create model object with the audit status model - Map model = new HashMap(1); - model.put("auditstatus", createAuditStatusModel()); - return model; - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to start + * and stop Records Management auditing. + * + * @author Gavin Cornwell + */ +public class AuditLogPut extends BaseAuditAdminWebScript +{ + protected static final String PARAM_ENABLED = "enabled"; + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + try + { + // determine whether to start or stop auditing + JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); + + // check the enabled property present + if (!json.has(PARAM_ENABLED)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory 'enabled' parameter was not provided in request body"); + } + + boolean enabled = json.getBoolean(PARAM_ENABLED); + if (enabled) + { + this.rmAuditService.startAuditLog(getDefaultFilePlan()); + } + else + { + this.rmAuditService.stopAuditLog(getDefaultFilePlan()); + } + + // create model object with the audit status model + Map model = new HashMap(1); + model.put("auditstatus", createAuditStatusModel()); + return model; + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java index a74d8efae0..f34f2ecf11 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java @@ -1,98 +1,98 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * GET audit log status - * - * @author Roy Wetherall - */ -public class AuditLogStatusGet extends DeclarativeWebScript -{ - /** Records management audit service */ - protected RecordsManagementAuditService rmAuditService; - - /** File plan service */ - protected FilePlanService filePlanService; - - /** - * Sets the RecordsManagementAuditService instance - * - * @param auditService The RecordsManagementAuditService instance - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) - { - this.rmAuditService = rmAuditService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.web.scripts.content.StreamContent#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - model.put("enabled", Boolean.valueOf(rmAuditService.isAuditLogEnabled(getDefaultFilePlan()))); - return model; - } - - /** - * Helper method to get default file plan. - * - * @return NodeRef default file plan - */ - protected NodeRef getDefaultFilePlan() - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("Default file plan not found."); - } - return filePlan; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * GET audit log status + * + * @author Roy Wetherall + */ +public class AuditLogStatusGet extends DeclarativeWebScript +{ + /** Records management audit service */ + protected RecordsManagementAuditService rmAuditService; + + /** File plan service */ + protected FilePlanService filePlanService; + + /** + * Sets the RecordsManagementAuditService instance + * + * @param auditService The RecordsManagementAuditService instance + */ + public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) + { + this.rmAuditService = rmAuditService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.repo.web.scripts.content.StreamContent#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1); + model.put("enabled", Boolean.valueOf(rmAuditService.isAuditLogEnabled(getDefaultFilePlan()))); + return model; + } + + /** + * Helper method to get default file plan. + * + * @return NodeRef default file plan + */ + protected NodeRef getDefaultFilePlan() + { + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (filePlan == null) + { + throw new AlfrescoRuntimeException("Default file plan not found."); + } + return filePlan; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java index e7dae1adac..e69243d17f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java @@ -1,101 +1,101 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Base class for all audit administration webscripts. - * - * @author Gavin Cornwell - */ -public class BaseAuditAdminWebScript extends DeclarativeWebScript -{ - /** Records management audit service */ - protected RecordsManagementAuditService rmAuditService; - - /** File plan service */ - protected FilePlanService filePlanService; - - /** - * Sets the RecordsManagementAuditService instance - * - * @param auditService The RecordsManagementAuditService instance - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) - { - this.rmAuditService = rmAuditService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Creates a model to represent the current status of the RM audit log. - * - * @return Map of RM audit log status - */ - protected Map createAuditStatusModel() - { - Map auditStatus = new HashMap(3); - - auditStatus.put("started", ISO8601DateFormat.format(rmAuditService.getDateAuditLogLastStarted(getDefaultFilePlan()))); - auditStatus.put("stopped", ISO8601DateFormat.format(rmAuditService.getDateAuditLogLastStopped(getDefaultFilePlan()))); - auditStatus.put("enabled", Boolean.valueOf(rmAuditService.isAuditLogEnabled(getDefaultFilePlan()))); - - return auditStatus; - } - - /** - * Helper method to get default file plan. - * - * @return NodeRef default file plan - */ - protected NodeRef getDefaultFilePlan() - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("Default file plan not found."); - } - return filePlan; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.ISO8601DateFormat; +import org.springframework.extensions.webscripts.DeclarativeWebScript; + +/** + * Base class for all audit administration webscripts. + * + * @author Gavin Cornwell + */ +public class BaseAuditAdminWebScript extends DeclarativeWebScript +{ + /** Records management audit service */ + protected RecordsManagementAuditService rmAuditService; + + /** File plan service */ + protected FilePlanService filePlanService; + + /** + * Sets the RecordsManagementAuditService instance + * + * @param auditService The RecordsManagementAuditService instance + */ + public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) + { + this.rmAuditService = rmAuditService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Creates a model to represent the current status of the RM audit log. + * + * @return Map of RM audit log status + */ + protected Map createAuditStatusModel() + { + Map auditStatus = new HashMap(3); + + auditStatus.put("started", ISO8601DateFormat.format(rmAuditService.getDateAuditLogLastStarted(getDefaultFilePlan()))); + auditStatus.put("stopped", ISO8601DateFormat.format(rmAuditService.getDateAuditLogLastStopped(getDefaultFilePlan()))); + auditStatus.put("enabled", Boolean.valueOf(rmAuditService.isAuditLogEnabled(getDefaultFilePlan()))); + + return auditStatus; + } + + /** + * Helper method to get default file plan. + * + * @return NodeRef default file plan + */ + protected NodeRef getDefaultFilePlan() + { + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (filePlan == null) + { + throw new AlfrescoRuntimeException("Default file plan not found."); + } + return filePlan; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java index 254436d240..defcf8edf0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditRetrievalWebScript.java @@ -1,282 +1,282 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.IOException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.ReportFormat; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.web.scripts.content.StreamContent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.InvalidQNameException; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Base class for all audit retrieval webscripts. - * - * @author Gavin Cornwell - */ -public class BaseAuditRetrievalWebScript extends StreamContent -{ - /** Logger */ - private static Log logger = LogFactory.getLog(BaseAuditRetrievalWebScript.class); - - private static final String PARAM_USER = "user"; - private static final String PARAM_SIZE = "size"; - private static final String PARAM_EVENT = "event"; - private static final String PARAM_FROM = "from"; - private static final String PARAM_TO = "to"; - private static final String PARAM_PROPERTY = "property"; - private static final String DATE_PATTERN = "yyyy-MM-dd"; - - protected RecordsManagementAuditService rmAuditService; - protected NamespaceService namespaceService; - - /** - * Sets the RecordsManagementAuditService instance - * - * @param auditService The RecordsManagementAuditService instance - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) - { - this.rmAuditService = rmAuditService; - } - - /** - * Sets the NamespaceService instance - * - * @param namespaceService The NamespaceService instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Parses the given request and builds an instance of - * RecordsManagementAuditQueryParameters to retrieve the relevant audit entries - * - * @param req The request - * @return RecordsManagementAuditQueryParameters instance - */ - protected RecordsManagementAuditQueryParameters parseQueryParameters(WebScriptRequest req) - { - // create parameters for audit trail retrieval - RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); - - // the webscripts can have a couple of different forms of url, work out - // whether a nodeRef has been supplied or whether the whole audit - // log should be displayed - NodeRef nodeRef = null; - Map templateVars = req.getServiceMatch().getTemplateVars(); - String storeType = templateVars.get("store_type"); - if (storeType != null && storeType.length() > 0) - { - // there is a store_type so all other params are likely to be present - String storeId = templateVars.get("store_id"); - String nodeId = templateVars.get("id"); - - // create the nodeRef - nodeRef = new NodeRef(new StoreRef(storeType, storeId), nodeId); - } - - // gather all the common filtering parameters, these could be on the - // query string, in a multipart/form-data request or in a JSON body - String size = null; - String user = null; - String event = null; - String from = null; - String to = null; - String property = null; - - if (MimetypeMap.MIMETYPE_JSON.equals(req.getContentType())) - { - try - { - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - if (json.has(PARAM_SIZE)) - { - size = json.getString(PARAM_SIZE); - } - if (json.has(PARAM_USER)) - { - user = json.getString(PARAM_USER); - } - if (json.has(PARAM_EVENT)) - { - event = json.getString(PARAM_EVENT); - } - if (json.has(PARAM_FROM)) - { - from = json.getString(PARAM_FROM); - } - if (json.has(PARAM_TO)) - { - to = json.getString(PARAM_TO); - } - if (json.has(PARAM_PROPERTY)) - { - property = json.getString(PARAM_PROPERTY); - } - } - catch (IOException ioe) - { - // log a warning - if (logger.isWarnEnabled()) - { - logger.warn("Failed to parse JSON parameters for audit query: " + ioe.getMessage()); - } - } - catch (JSONException je) - { - // log a warning - if (logger.isWarnEnabled()) - { - logger.warn("Failed to parse JSON parameters for audit query: " + je.getMessage()); - } - } - } - else - { - size = req.getParameter(PARAM_SIZE); - user = req.getParameter(PARAM_USER); - event = req.getParameter(PARAM_EVENT); - from = req.getParameter(PARAM_FROM); - to = req.getParameter(PARAM_TO); - property = req.getParameter(PARAM_PROPERTY); - } - - // setup the audit query parameters object - params.setNodeRef(nodeRef); - params.setUser(user); - params.setEvent(event); - - if (size != null && size.length() > 0) - { - try - { - params.setMaxEntries(Integer.parseInt(size)); - } - catch (NumberFormatException nfe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Ignoring size parameter as '" + size + "' is not a number!"); - } - } - } - - if (from != null && from.length() > 0) - { - try - { - SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN); - params.setDateFrom(dateFormat.parse(from)); - } - catch (ParseException pe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Ignoring from parameter as '" + from + "' does not conform to the date pattern: " + DATE_PATTERN); - } - } - } - - if (to != null && to.length() > 0) - { - try - { - SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN); - params.setDateTo(dateFormat.parse(to)); - } - catch (ParseException pe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Ignoring to parameter as '" + to + "' does not conform to the date pattern: " + DATE_PATTERN); - } - } - } - - if (property != null && property.length() > 0) - { - try - { - params.setProperty(QName.createQName(property, namespaceService)); - } - catch (InvalidQNameException iqe) - { - if (logger.isWarnEnabled()) - { - logger.warn("Ignoring property parameter as '" + property + "' is an invalid QName"); - } - } - } - - return params; - } - - /** - * Parses the given request for the format the audit report - * should be returned in - * - * @param req The request - * @return The format for the report - */ - protected ReportFormat parseReportFormat(WebScriptRequest req) - { - String format = req.getFormat(); - - if (format != null) - { - if (format.equalsIgnoreCase("json")) - { - return ReportFormat.JSON; - } - else if (format.equalsIgnoreCase("html")) - { - return ReportFormat.HTML; - } - } - - return ReportFormat.JSON; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.IOException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.ReportFormat; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.web.scripts.content.StreamContent; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.InvalidQNameException; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Base class for all audit retrieval webscripts. + * + * @author Gavin Cornwell + */ +public class BaseAuditRetrievalWebScript extends StreamContent +{ + /** Logger */ + private static Log logger = LogFactory.getLog(BaseAuditRetrievalWebScript.class); + + private static final String PARAM_USER = "user"; + private static final String PARAM_SIZE = "size"; + private static final String PARAM_EVENT = "event"; + private static final String PARAM_FROM = "from"; + private static final String PARAM_TO = "to"; + private static final String PARAM_PROPERTY = "property"; + private static final String DATE_PATTERN = "yyyy-MM-dd"; + + protected RecordsManagementAuditService rmAuditService; + protected NamespaceService namespaceService; + + /** + * Sets the RecordsManagementAuditService instance + * + * @param auditService The RecordsManagementAuditService instance + */ + public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) + { + this.rmAuditService = rmAuditService; + } + + /** + * Sets the NamespaceService instance + * + * @param namespaceService The NamespaceService instance + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * Parses the given request and builds an instance of + * RecordsManagementAuditQueryParameters to retrieve the relevant audit entries + * + * @param req The request + * @return RecordsManagementAuditQueryParameters instance + */ + protected RecordsManagementAuditQueryParameters parseQueryParameters(WebScriptRequest req) + { + // create parameters for audit trail retrieval + RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); + + // the webscripts can have a couple of different forms of url, work out + // whether a nodeRef has been supplied or whether the whole audit + // log should be displayed + NodeRef nodeRef = null; + Map templateVars = req.getServiceMatch().getTemplateVars(); + String storeType = templateVars.get("store_type"); + if (storeType != null && storeType.length() > 0) + { + // there is a store_type so all other params are likely to be present + String storeId = templateVars.get("store_id"); + String nodeId = templateVars.get("id"); + + // create the nodeRef + nodeRef = new NodeRef(new StoreRef(storeType, storeId), nodeId); + } + + // gather all the common filtering parameters, these could be on the + // query string, in a multipart/form-data request or in a JSON body + String size = null; + String user = null; + String event = null; + String from = null; + String to = null; + String property = null; + + if (MimetypeMap.MIMETYPE_JSON.equals(req.getContentType())) + { + try + { + JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); + if (json.has(PARAM_SIZE)) + { + size = json.getString(PARAM_SIZE); + } + if (json.has(PARAM_USER)) + { + user = json.getString(PARAM_USER); + } + if (json.has(PARAM_EVENT)) + { + event = json.getString(PARAM_EVENT); + } + if (json.has(PARAM_FROM)) + { + from = json.getString(PARAM_FROM); + } + if (json.has(PARAM_TO)) + { + to = json.getString(PARAM_TO); + } + if (json.has(PARAM_PROPERTY)) + { + property = json.getString(PARAM_PROPERTY); + } + } + catch (IOException ioe) + { + // log a warning + if (logger.isWarnEnabled()) + { + logger.warn("Failed to parse JSON parameters for audit query: " + ioe.getMessage()); + } + } + catch (JSONException je) + { + // log a warning + if (logger.isWarnEnabled()) + { + logger.warn("Failed to parse JSON parameters for audit query: " + je.getMessage()); + } + } + } + else + { + size = req.getParameter(PARAM_SIZE); + user = req.getParameter(PARAM_USER); + event = req.getParameter(PARAM_EVENT); + from = req.getParameter(PARAM_FROM); + to = req.getParameter(PARAM_TO); + property = req.getParameter(PARAM_PROPERTY); + } + + // setup the audit query parameters object + params.setNodeRef(nodeRef); + params.setUser(user); + params.setEvent(event); + + if (size != null && size.length() > 0) + { + try + { + params.setMaxEntries(Integer.parseInt(size)); + } + catch (NumberFormatException nfe) + { + if (logger.isWarnEnabled()) + { + logger.warn("Ignoring size parameter as '" + size + "' is not a number!"); + } + } + } + + if (from != null && from.length() > 0) + { + try + { + SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN); + params.setDateFrom(dateFormat.parse(from)); + } + catch (ParseException pe) + { + if (logger.isWarnEnabled()) + { + logger.warn("Ignoring from parameter as '" + from + "' does not conform to the date pattern: " + DATE_PATTERN); + } + } + } + + if (to != null && to.length() > 0) + { + try + { + SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN); + params.setDateTo(dateFormat.parse(to)); + } + catch (ParseException pe) + { + if (logger.isWarnEnabled()) + { + logger.warn("Ignoring to parameter as '" + to + "' does not conform to the date pattern: " + DATE_PATTERN); + } + } + } + + if (property != null && property.length() > 0) + { + try + { + params.setProperty(QName.createQName(property, namespaceService)); + } + catch (InvalidQNameException iqe) + { + if (logger.isWarnEnabled()) + { + logger.warn("Ignoring property parameter as '" + property + "' is an invalid QName"); + } + } + } + + return params; + } + + /** + * Parses the given request for the format the audit report + * should be returned in + * + * @param req The request + * @return The format for the report + */ + protected ReportFormat parseReportFormat(WebScriptRequest req) + { + String format = req.getFormat(); + + if (format != null) + { + if (format.equalsIgnoreCase("json")) + { + return ReportFormat.JSON; + } + else if (format.equalsIgnoreCase("html")) + { + return ReportFormat.HTML; + } + } + + return ReportFormat.JSON; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java index 34833fca6f..7029379212 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java @@ -1,73 +1,73 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.namespace.QName; - -/** - * Base class for all custom property webscripts. - * - * @author Roy Wetherall - */ -public class BaseCustomPropertyWebScript extends AbstractRmWebScript -{ - /** - * Takes the element name and maps it to the QName of the customisable type. The passed element name should be a prefixed - * qname string, but to support previous versions of this API a couple of hard coded checks are made first. - * - * @param elementName - * @return - */ - protected QName mapToTypeQName(String elementName) - { - // Direct matching provided for backward compatibility with RM 1.0 - if ("recordFolder".equalsIgnoreCase(elementName)) - { - return RecordsManagementModel.TYPE_RECORD_FOLDER; - } - else if ("record".equalsIgnoreCase(elementName)) - { - return RecordsManagementModel.ASPECT_RECORD; - } - else if ("recordCategory".equalsIgnoreCase(elementName)) - { - return RecordsManagementModel.TYPE_RECORD_CATEGORY; - } - else if ("recordSeries".equalsIgnoreCase(elementName)) - { - return CompatibilityModel.TYPE_RECORD_SERIES; - } - else - { - // Try and convert the string to a qname - return QName.createQName(elementName, getNamespaceService()); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.namespace.QName; + +/** + * Base class for all custom property webscripts. + * + * @author Roy Wetherall + */ +public class BaseCustomPropertyWebScript extends AbstractRmWebScript +{ + /** + * Takes the element name and maps it to the QName of the customisable type. The passed element name should be a prefixed + * qname string, but to support previous versions of this API a couple of hard coded checks are made first. + * + * @param elementName + * @return + */ + protected QName mapToTypeQName(String elementName) + { + // Direct matching provided for backward compatibility with RM 1.0 + if ("recordFolder".equalsIgnoreCase(elementName)) + { + return RecordsManagementModel.TYPE_RECORD_FOLDER; + } + else if ("record".equalsIgnoreCase(elementName)) + { + return RecordsManagementModel.ASPECT_RECORD; + } + else if ("recordCategory".equalsIgnoreCase(elementName)) + { + return RecordsManagementModel.TYPE_RECORD_CATEGORY; + } + else if ("recordSeries".equalsIgnoreCase(elementName)) + { + return CompatibilityModel.TYPE_RECORD_SERIES; + } + else + { + // Try and convert the string to a qname + return QName.createQName(elementName, getNamespaceService()); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java index adcb968bf3..69258df14f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseTransferWebScript.java @@ -1,224 +1,224 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.web.scripts.content.StreamACP; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Abstract base class for transfer related web scripts. - * - * @author Gavin Cornwell - */ -public abstract class BaseTransferWebScript extends StreamACP - implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(BaseTransferWebScript.class); - - protected FilePlanService filePlanService; - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) - */ - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - File tempFile = null; - try - { - // retrieve requested format - String format = req.getFormat(); - - // construct model for template - Status status = new Status(); - Cache cache = new Cache(getDescription().getRequiredCache()); - Map model = new HashMap(); - model.put("status", status); - model.put("cache", cache); - - // get the parameters that represent the NodeRef, we know they are present - // otherwise this webscript would not have matched - Map templateVars = req.getServiceMatch().getTemplateVars(); - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String nodeId = templateVars.get("id"); - String transferId = templateVars.get("transfer_id"); - - // create and return the file plan NodeRef - NodeRef filePlan = new NodeRef(new StoreRef(storeType, storeId), nodeId); - - if (logger.isDebugEnabled()) - { - logger.debug("Retrieving transfer '" + transferId + "' from file plan: " + filePlan); - } - - // ensure the file plan exists - if (!this.nodeService.exists(filePlan)) - { - status.setCode(HttpServletResponse.SC_NOT_FOUND, - "Node " + filePlan.toString() + " does not exist"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return; - } - - // ensure the node is a filePlan object - if (!filePlanService.isFilePlan(filePlan)) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST, - "Node " + filePlan.toString() + " is not a file plan"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return; - } - - // attempt to find the transfer node - NodeRef transferNode = findTransferNode(filePlan, transferId); - - // send 404 if the transfer is not found - if (transferNode == null) - { - status.setCode(HttpServletResponse.SC_NOT_FOUND, - "Could not locate transfer with id: " + transferId); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return; - } - - // execute the transfer operation - tempFile = executeTransfer(transferNode, req, res, status, cache); - } - catch (Exception e) - { - throw createStatusException(e, req, res); - } - finally - { - // try and delete the temporary file (if not in debug mode) - if (tempFile != null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Transfer report saved to temporary file: " + tempFile.getAbsolutePath()); - } - else - { - tempFile.delete(); - } - } - } - } - - /** - * Abstract method subclasses implement to perform the actual logic required. - * - * @param transferNode The transfer node - * @param req The request - * @param res The response - * @param status Status object - * @param cache Cache object - * @return File object representing the file containing the JSON of the report - * @throws IOException - */ - protected abstract File executeTransfer(NodeRef transferNode, - WebScriptRequest req, WebScriptResponse res, - Status status, Cache cache) throws IOException; - - /** - * Finds a transfer object with the given id in the given file plan. - * This method returns null if a transfer with the given id is not found. - * - * @param filePlan The file plan to search - * @param transferId The id of the transfer being requested - * @return The transfer node or null if not found - */ - protected NodeRef findTransferNode(NodeRef filePlan, String transferId) - { - NodeRef transferNode = null; - - // get all the transfer nodes and find the one we need - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - List assocs = this.nodeService.getChildAssocs(transferContainer, - ContentModel.ASSOC_CONTAINS, - RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : assocs) - { - if (child.getChildRef().getId().equals(transferId)) - { - transferNode = child.getChildRef(); - break; - } - } - - return transferNode; - } - - /** - * Returns an array of NodeRefs representing the items to be transferred. - * - * @param transferNode The transfer object - * @return Array of NodeRefs - */ - protected NodeRef[] getTransferNodes(NodeRef transferNode) - { - List assocs = this.nodeService.getChildAssocs(transferNode, - RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - NodeRef[] itemsToTransfer = new NodeRef[assocs.size()]; - for (int idx = 0; idx < assocs.size(); idx++) - { - itemsToTransfer[idx] = assocs.get(idx).getChildRef(); - } - - return itemsToTransfer; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.web.scripts.content.StreamACP; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; + +/** + * Abstract base class for transfer related web scripts. + * + * @author Gavin Cornwell + */ +public abstract class BaseTransferWebScript extends StreamACP + implements RecordsManagementModel +{ + /** Logger */ + private static Log logger = LogFactory.getLog(BaseTransferWebScript.class); + + protected FilePlanService filePlanService; + + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) + */ + public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException + { + File tempFile = null; + try + { + // retrieve requested format + String format = req.getFormat(); + + // construct model for template + Status status = new Status(); + Cache cache = new Cache(getDescription().getRequiredCache()); + Map model = new HashMap(); + model.put("status", status); + model.put("cache", cache); + + // get the parameters that represent the NodeRef, we know they are present + // otherwise this webscript would not have matched + Map templateVars = req.getServiceMatch().getTemplateVars(); + String storeType = templateVars.get("store_type"); + String storeId = templateVars.get("store_id"); + String nodeId = templateVars.get("id"); + String transferId = templateVars.get("transfer_id"); + + // create and return the file plan NodeRef + NodeRef filePlan = new NodeRef(new StoreRef(storeType, storeId), nodeId); + + if (logger.isDebugEnabled()) + { + logger.debug("Retrieving transfer '" + transferId + "' from file plan: " + filePlan); + } + + // ensure the file plan exists + if (!this.nodeService.exists(filePlan)) + { + status.setCode(HttpServletResponse.SC_NOT_FOUND, + "Node " + filePlan.toString() + " does not exist"); + Map templateModel = createTemplateParameters(req, res, model); + sendStatus(req, res, status, cache, format, templateModel); + return; + } + + // ensure the node is a filePlan object + if (!filePlanService.isFilePlan(filePlan)) + { + status.setCode(HttpServletResponse.SC_BAD_REQUEST, + "Node " + filePlan.toString() + " is not a file plan"); + Map templateModel = createTemplateParameters(req, res, model); + sendStatus(req, res, status, cache, format, templateModel); + return; + } + + // attempt to find the transfer node + NodeRef transferNode = findTransferNode(filePlan, transferId); + + // send 404 if the transfer is not found + if (transferNode == null) + { + status.setCode(HttpServletResponse.SC_NOT_FOUND, + "Could not locate transfer with id: " + transferId); + Map templateModel = createTemplateParameters(req, res, model); + sendStatus(req, res, status, cache, format, templateModel); + return; + } + + // execute the transfer operation + tempFile = executeTransfer(transferNode, req, res, status, cache); + } + catch (Exception e) + { + throw createStatusException(e, req, res); + } + finally + { + // try and delete the temporary file (if not in debug mode) + if (tempFile != null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Transfer report saved to temporary file: " + tempFile.getAbsolutePath()); + } + else + { + tempFile.delete(); + } + } + } + } + + /** + * Abstract method subclasses implement to perform the actual logic required. + * + * @param transferNode The transfer node + * @param req The request + * @param res The response + * @param status Status object + * @param cache Cache object + * @return File object representing the file containing the JSON of the report + * @throws IOException + */ + protected abstract File executeTransfer(NodeRef transferNode, + WebScriptRequest req, WebScriptResponse res, + Status status, Cache cache) throws IOException; + + /** + * Finds a transfer object with the given id in the given file plan. + * This method returns null if a transfer with the given id is not found. + * + * @param filePlan The file plan to search + * @param transferId The id of the transfer being requested + * @return The transfer node or null if not found + */ + protected NodeRef findTransferNode(NodeRef filePlan, String transferId) + { + NodeRef transferNode = null; + + // get all the transfer nodes and find the one we need + NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); + List assocs = this.nodeService.getChildAssocs(transferContainer, + ContentModel.ASSOC_CONTAINS, + RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef child : assocs) + { + if (child.getChildRef().getId().equals(transferId)) + { + transferNode = child.getChildRef(); + break; + } + } + + return transferNode; + } + + /** + * Returns an array of NodeRefs representing the items to be transferred. + * + * @param transferNode The transfer object + * @return Array of NodeRefs + */ + protected NodeRef[] getTransferNodes(NodeRef transferNode) + { + List assocs = this.nodeService.getChildAssocs(transferNode, + RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + NodeRef[] itemsToTransfer = new NodeRef[assocs.size()]; + for (int idx = 0; idx < assocs.size(); idx++) + { + itemsToTransfer[idx] = assocs.get(idx).getChildRef(); + } + + return itemsToTransfer; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java index 98a70af95f..62e69d84ac 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java @@ -1,356 +1,356 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.Role; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.view.ImporterService; -import org.alfresco.service.cmr.view.Location; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * BootstrapTestData GET WebScript implementation. - */ -@Deprecated -public class BootstrapTestDataGet extends DeclarativeWebScript - implements RecordsManagementModel -{ - private static Log logger = LogFactory.getLog(BootstrapTestDataGet.class); - - private static final String ARG_SITE_NAME = "site"; - private static final String ARG_IMPORT = "import"; - - private static final String XML_IMPORT = "alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml"; - private static final String CHARSET_NAME = "UTF-8"; - - private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private NodeService nodeService; - private SearchService searchService; - private RecordsManagementService recordsManagementService; - private RecordsManagementActionService recordsManagementActionService; - private ImporterService importerService; - private SiteService siteService; - private PermissionService permissionService; - private RecordsManagementSecurityService recordsManagementSecurityService; - private AuthorityService authorityService; - private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour; - private DispositionService dispositionService; - private RecordFolderService recordFolderService; - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - public void setRecordsManagementService(RecordsManagementService recordsManagementService) - { - this.recordsManagementService = recordsManagementService; - } - - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - public void setImporterService(ImporterService importerService) - { - this.importerService = importerService; - } - - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - public void setRecordsManagementSecurityService(RecordsManagementSecurityService recordsManagementSecurityService) - { - this.recordsManagementSecurityService = recordsManagementSecurityService; - } - - public void setRecordsManagementSearchBehaviour(RecordsManagementSearchBehaviour searchBehaviour) - { - this.recordsManagementSearchBehaviour = searchBehaviour; - } - - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // resolve import argument - boolean importData = false; - if (req.getParameter(ARG_IMPORT) != null) - { - importData = Boolean.parseBoolean(req.getParameter(ARG_IMPORT)); - } - - // resolve rm site - String siteName = RmSiteType.DEFAULT_SITE_NAME; - if (req.getParameter(ARG_SITE_NAME) != null) - { - siteName = req.getParameter(ARG_SITE_NAME); - } - - if (importData) - { - SiteInfo site = siteService.getSite(siteName); - if (site == null) - { - throw new AlfrescoRuntimeException("Records Management site does not exist: " + siteName); - } - - // resolve documentLibrary (filePlan) container - NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - if (filePlan == null) - { - filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY, TYPE_FILE_PLAN, null); - } - - // import the RM test data ACP into the the provided filePlan node reference - InputStream is = BootstrapTestDataGet.class.getClassLoader().getResourceAsStream(XML_IMPORT); - if (is == null) - { - throw new AlfrescoRuntimeException("The DODExampleFilePlan.xml import file could not be found"); - } - Reader viewReader = null; - try - { - viewReader = new InputStreamReader(is, CHARSET_NAME); - } - catch (UnsupportedEncodingException error) - { - throw new AlfrescoRuntimeException("The Character Encoding '" + CHARSET_NAME + "' is not supported.", error); - } - Location location = new Location(filePlan); - importerService.importView(viewReader, location, null, null); - } - - // Patch data - BootstrapTestDataGet.patchLoadedData(searchService, nodeService, recordsManagementService, - recordsManagementActionService, permissionService, - authorityService, recordsManagementSecurityService, - recordsManagementSearchBehaviour, - dispositionService, recordFolderService); - - Map model = new HashMap(1, 1.0f); - model.put("success", true); - - return model; - } - - /** - * Temp method to patch AMP'ed data - * - * @param searchService - * @param nodeService - * @param recordsManagementService - * @param recordsManagementActionService - */ - public static void patchLoadedData( final SearchService searchService, - final NodeService nodeService, - final RecordsManagementService recordsManagementService, - final RecordsManagementActionService recordsManagementActionService, - final PermissionService permissionService, - final AuthorityService authorityService, - final RecordsManagementSecurityService recordsManagementSecurityService, - final RecordsManagementSearchBehaviour recordManagementSearchBehaviour, - final DispositionService dispositionService, - final RecordFolderService recordFolderService) - { - AuthenticationUtil.RunAsWork runAsWork = new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - java.util.List rmRoots = recordsManagementService.getFilePlans(); - logger.info("Bootstraping " + rmRoots.size() + " rm roots ..."); - for (NodeRef rmRoot : rmRoots) - { - if (permissionService.getInheritParentPermissions(rmRoot)) - { - logger.info("Updating permissions for rm root: " + rmRoot); - permissionService.setInheritParentPermissions(rmRoot, false); - } - - String allRoleShortName = RMAuthority.ALL_ROLES_PREFIX + rmRoot.getId(); - String allRoleGroupName = authorityService.getName(AuthorityType.GROUP, allRoleShortName); - - if (!authorityService.authorityExists(allRoleGroupName)) - { - logger.info("Creating all roles group for root node: " + rmRoot.toString()); - - // Create "all" role group for root node - String allRoles = authorityService.createAuthority(AuthorityType.GROUP, - allRoleShortName, - RMAuthority.ALL_ROLES_DISPLAY_NAME, - new HashSet(Arrays.asList(RMAuthority.ZONE_APP_RM))); - - // Put all the role groups in it - Set roles = recordsManagementSecurityService.getRoles(rmRoot); - for (Role role : roles) - { - logger.info(" - adding role group " + role.getRoleGroupName() + " to all roles group"); - authorityService.addAuthority(allRoles, role.getRoleGroupName()); - } - - // Set the permissions - permissionService.setPermission(rmRoot, allRoles, RMPermissionModel.READ_RECORDS, true); - } - } - - // Make sure all the containers do not inherit permissions - ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordsManagementContainer\""); - try - { - logger.info("Bootstraping " + rs.length() + " record containers ..."); - - for (NodeRef container : rs.getNodeRefs()) - { - String containerName = (String)nodeService.getProperty(container, ContentModel.PROP_NAME); - - // Set permissions - if (permissionService.getInheritParentPermissions(container)) - { - logger.info("Updating permissions for record container: " + containerName); - permissionService.setInheritParentPermissions(container, false); - } - } - } - finally - { - rs.close(); - } - - // fix up the test dataset to fire initial events for disposition schedules - rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordFolder\""); - try - { - logger.info("Bootstraping " + rs.length() + " record folders ..."); - - for (NodeRef recordFolder : rs.getNodeRefs()) - { - String folderName = (String)nodeService.getProperty(recordFolder, ContentModel.PROP_NAME); - - // Set permissions - if (permissionService.getInheritParentPermissions(recordFolder)) - { - logger.info("Updating permissions for record folder: " + folderName); - permissionService.setInheritParentPermissions(recordFolder, false); - } - - if (!nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)) - { - // See if the folder has a disposition schedule that needs to be applied - DispositionSchedule ds = dispositionService.getDispositionSchedule(recordFolder); - if (ds != null) - { - // Fire action to "set-up" the folder correctly - logger.info("Setting up bootstraped record folder: " + folderName); - recordFolderService.setupRecordFolder(recordFolder); - } - } - - // fixup the search behaviour aspect for the record folder - logger.info("Setting up search aspect for record folder: " + folderName); - recordManagementSearchBehaviour.fixupSearchAspect(recordFolder); - } - } - finally - { - rs.close(); - } - - return null; - } - }; - - AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; +import org.alfresco.module.org_alfresco_module_rm.security.Role; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authority.RMAuthority; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.cmr.view.ImporterService; +import org.alfresco.service.cmr.view.Location; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * BootstrapTestData GET WebScript implementation. + */ +@Deprecated +public class BootstrapTestDataGet extends DeclarativeWebScript + implements RecordsManagementModel +{ + private static Log logger = LogFactory.getLog(BootstrapTestDataGet.class); + + private static final String ARG_SITE_NAME = "site"; + private static final String ARG_IMPORT = "import"; + + private static final String XML_IMPORT = "alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml"; + private static final String CHARSET_NAME = "UTF-8"; + + private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); + + private NodeService nodeService; + private SearchService searchService; + private RecordsManagementService recordsManagementService; + private RecordsManagementActionService recordsManagementActionService; + private ImporterService importerService; + private SiteService siteService; + private PermissionService permissionService; + private RecordsManagementSecurityService recordsManagementSecurityService; + private AuthorityService authorityService; + private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour; + private DispositionService dispositionService; + private RecordFolderService recordFolderService; + + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + public void setRecordsManagementService(RecordsManagementService recordsManagementService) + { + this.recordsManagementService = recordsManagementService; + } + + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + public void setImporterService(ImporterService importerService) + { + this.importerService = importerService; + } + + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + public void setRecordsManagementSecurityService(RecordsManagementSecurityService recordsManagementSecurityService) + { + this.recordsManagementSecurityService = recordsManagementSecurityService; + } + + public void setRecordsManagementSearchBehaviour(RecordsManagementSearchBehaviour searchBehaviour) + { + this.recordsManagementSearchBehaviour = searchBehaviour; + } + + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // resolve import argument + boolean importData = false; + if (req.getParameter(ARG_IMPORT) != null) + { + importData = Boolean.parseBoolean(req.getParameter(ARG_IMPORT)); + } + + // resolve rm site + String siteName = RmSiteType.DEFAULT_SITE_NAME; + if (req.getParameter(ARG_SITE_NAME) != null) + { + siteName = req.getParameter(ARG_SITE_NAME); + } + + if (importData) + { + SiteInfo site = siteService.getSite(siteName); + if (site == null) + { + throw new AlfrescoRuntimeException("Records Management site does not exist: " + siteName); + } + + // resolve documentLibrary (filePlan) container + NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); + if (filePlan == null) + { + filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY, TYPE_FILE_PLAN, null); + } + + // import the RM test data ACP into the the provided filePlan node reference + InputStream is = BootstrapTestDataGet.class.getClassLoader().getResourceAsStream(XML_IMPORT); + if (is == null) + { + throw new AlfrescoRuntimeException("The DODExampleFilePlan.xml import file could not be found"); + } + Reader viewReader = null; + try + { + viewReader = new InputStreamReader(is, CHARSET_NAME); + } + catch (UnsupportedEncodingException error) + { + throw new AlfrescoRuntimeException("The Character Encoding '" + CHARSET_NAME + "' is not supported.", error); + } + Location location = new Location(filePlan); + importerService.importView(viewReader, location, null, null); + } + + // Patch data + BootstrapTestDataGet.patchLoadedData(searchService, nodeService, recordsManagementService, + recordsManagementActionService, permissionService, + authorityService, recordsManagementSecurityService, + recordsManagementSearchBehaviour, + dispositionService, recordFolderService); + + Map model = new HashMap(1, 1.0f); + model.put("success", true); + + return model; + } + + /** + * Temp method to patch AMP'ed data + * + * @param searchService + * @param nodeService + * @param recordsManagementService + * @param recordsManagementActionService + */ + public static void patchLoadedData( final SearchService searchService, + final NodeService nodeService, + final RecordsManagementService recordsManagementService, + final RecordsManagementActionService recordsManagementActionService, + final PermissionService permissionService, + final AuthorityService authorityService, + final RecordsManagementSecurityService recordsManagementSecurityService, + final RecordsManagementSearchBehaviour recordManagementSearchBehaviour, + final DispositionService dispositionService, + final RecordFolderService recordFolderService) + { + AuthenticationUtil.RunAsWork runAsWork = new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + java.util.List rmRoots = recordsManagementService.getFilePlans(); + logger.info("Bootstraping " + rmRoots.size() + " rm roots ..."); + for (NodeRef rmRoot : rmRoots) + { + if (permissionService.getInheritParentPermissions(rmRoot)) + { + logger.info("Updating permissions for rm root: " + rmRoot); + permissionService.setInheritParentPermissions(rmRoot, false); + } + + String allRoleShortName = RMAuthority.ALL_ROLES_PREFIX + rmRoot.getId(); + String allRoleGroupName = authorityService.getName(AuthorityType.GROUP, allRoleShortName); + + if (!authorityService.authorityExists(allRoleGroupName)) + { + logger.info("Creating all roles group for root node: " + rmRoot.toString()); + + // Create "all" role group for root node + String allRoles = authorityService.createAuthority(AuthorityType.GROUP, + allRoleShortName, + RMAuthority.ALL_ROLES_DISPLAY_NAME, + new HashSet(Arrays.asList(RMAuthority.ZONE_APP_RM))); + + // Put all the role groups in it + Set roles = recordsManagementSecurityService.getRoles(rmRoot); + for (Role role : roles) + { + logger.info(" - adding role group " + role.getRoleGroupName() + " to all roles group"); + authorityService.addAuthority(allRoles, role.getRoleGroupName()); + } + + // Set the permissions + permissionService.setPermission(rmRoot, allRoles, RMPermissionModel.READ_RECORDS, true); + } + } + + // Make sure all the containers do not inherit permissions + ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordsManagementContainer\""); + try + { + logger.info("Bootstraping " + rs.length() + " record containers ..."); + + for (NodeRef container : rs.getNodeRefs()) + { + String containerName = (String)nodeService.getProperty(container, ContentModel.PROP_NAME); + + // Set permissions + if (permissionService.getInheritParentPermissions(container)) + { + logger.info("Updating permissions for record container: " + containerName); + permissionService.setInheritParentPermissions(container, false); + } + } + } + finally + { + rs.close(); + } + + // fix up the test dataset to fire initial events for disposition schedules + rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordFolder\""); + try + { + logger.info("Bootstraping " + rs.length() + " record folders ..."); + + for (NodeRef recordFolder : rs.getNodeRefs()) + { + String folderName = (String)nodeService.getProperty(recordFolder, ContentModel.PROP_NAME); + + // Set permissions + if (permissionService.getInheritParentPermissions(recordFolder)) + { + logger.info("Updating permissions for record folder: " + folderName); + permissionService.setInheritParentPermissions(recordFolder, false); + } + + if (!nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)) + { + // See if the folder has a disposition schedule that needs to be applied + DispositionSchedule ds = dispositionService.getDispositionSchedule(recordFolder); + if (ds != null) + { + // Fire action to "set-up" the folder correctly + logger.info("Setting up bootstraped record folder: " + folderName); + recordFolderService.setupRecordFolder(recordFolder); + } + } + + // fixup the search behaviour aspect for the record folder + logger.info("Setting up search aspect for record folder: " + folderName); + recordManagementSearchBehaviour.fixupSearchAspect(recordFolder); + } + } + finally + { + rs.close(); + } + + return null; + } + }; + + AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getAdminUserName()); + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java index 81541c1aa3..5f347a7570 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java @@ -1,122 +1,122 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to remove RM custom property definitions - * from the custom model. - * - * @author Neil McErlean - */ -public class CustomPropertyDefinitionDelete extends AbstractRmWebScript -{ - private static final String PROP_ID = "propId"; - - private static Log logger = LogFactory.getLog(CustomPropertyDefinitionDelete.class); - - private RecordsManagementAdminService rmAdminService; - - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map ftlModel = null; - try - { - QName propQName = getPropertyFromReq(req); - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Deleting property definition ").append(propQName); - logger.debug(msg.toString()); - } - ftlModel = removePropertyDefinition(propQName); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - return ftlModel; - } - - private QName getPropertyFromReq(WebScriptRequest req) - { - Map templateVars = req.getServiceMatch().getTemplateVars(); - String propIdString = templateVars.get(PROP_ID); - - QName propQName = this.rmAdminService.getQNameForClientId(propIdString); - Map existingPropDefs = rmAdminService.getCustomPropertyDefinitions(); - - if (!existingPropDefs.containsKey(propQName)) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, - "Requested property definition (id:" + propIdString + ") does not exist"); - } - - return propQName; - } - - /** - * Applies custom properties to the specified record node. - */ - protected Map removePropertyDefinition(QName propQName) throws JSONException - { - Map result = new HashMap(); - - rmAdminService.removeCustomPropertyDefinition(propQName); - - result.put("propertyqname", propQName.toPrefixString(getNamespaceService())); - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONException; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to remove RM custom property definitions + * from the custom model. + * + * @author Neil McErlean + */ +public class CustomPropertyDefinitionDelete extends AbstractRmWebScript +{ + private static final String PROP_ID = "propId"; + + private static Log logger = LogFactory.getLog(CustomPropertyDefinitionDelete.class); + + private RecordsManagementAdminService rmAdminService; + + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map ftlModel = null; + try + { + QName propQName = getPropertyFromReq(req); + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Deleting property definition ").append(propQName); + logger.debug(msg.toString()); + } + ftlModel = removePropertyDefinition(propQName); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + return ftlModel; + } + + private QName getPropertyFromReq(WebScriptRequest req) + { + Map templateVars = req.getServiceMatch().getTemplateVars(); + String propIdString = templateVars.get(PROP_ID); + + QName propQName = this.rmAdminService.getQNameForClientId(propIdString); + Map existingPropDefs = rmAdminService.getCustomPropertyDefinitions(); + + if (!existingPropDefs.containsKey(propQName)) + { + throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, + "Requested property definition (id:" + propIdString + ") does not exist"); + } + + return propQName; + } + + /** + * Applies custom properties to the specified record node. + */ + protected Map removePropertyDefinition(QName propQName) throws JSONException + { + Map result = new HashMap(); + + rmAdminService.removeCustomPropertyDefinition(propQName); + + result.put("propertyqname", propQName.toPrefixString(getNamespaceService())); + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java index 0451f169d2..88fd492ab3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java @@ -1,254 +1,254 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.IOException; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.service.namespace.QName; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.URLDecoder; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to add RM custom property definitions - * to the custom model. - * - * @author Neil McErlean - */ -public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript -{ - protected RecordsManagementAdminService rmAdminService; - - private static final String PARAM_DATATYPE = "dataType"; - private static final String PARAM_TITLE = "title"; - private static final String PARAM_DESCRIPTION = "description"; - private static final String PARAM_DEFAULT_VALUE = "defaultValue"; - private static final String PARAM_MULTI_VALUED = "multiValued"; - private static final String PARAM_MANDATORY = "mandatory"; - private static final String PARAM_PROTECTED = "protected"; - private static final String PARAM_CONSTRAINT_REF = "constraintRef"; - private static final String PARAM_ELEMENT = "element"; - private static final String PARAM_LABEL = "label"; - private static final String PROP_ID = "propId"; - private static final String MESSAGE = "errorMessage"; - private static final String URL = "url"; - - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - JSONObject json = null; - Map ftlModel = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - try - { - ftlModel = createPropertyDefinition(req, json); - } - catch (CustomMetadataException e) - { - status.setCode(Status.STATUS_BAD_REQUEST); - ftlModel = new HashMap(); - ftlModel.put(MESSAGE, e.getMessage()); - } - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - return ftlModel; - } - - /** - * Applies custom properties. - * @throws CustomMetadataException - */ - protected Map createPropertyDefinition(WebScriptRequest req, JSONObject json) - throws JSONException, CustomMetadataException - { - Map result = new HashMap(); - Map params = getParamsFromUrlAndJson(req, json); - - QName propertyQName = createNewPropertyDefinition(params); - String localName = propertyQName.getLocalName(); - - result.put(PROP_ID, localName); - - String urlResult = req.getServicePath() + "/" + propertyQName.getLocalName(); - result.put(URL, urlResult); - - return result; - } - - @SuppressWarnings("rawtypes") - protected Map getParamsFromUrlAndJson(WebScriptRequest req, JSONObject json) - throws JSONException - { - Map params; - params = new HashMap(); - params.put(PARAM_ELEMENT, req.getParameter(PARAM_ELEMENT)); - - for (Iterator iter = json.keys(); iter.hasNext(); ) - { - String nextKeyString = (String)iter.next(); - String nextValueString = json.getString(nextKeyString); - - params.put(nextKeyString, nextValueString); - } - - return params; - } - - /** - * Create a property definition based on the parameter values provided - * - * @param params parameter values - * @return {@link QName} qname of the newly created custom property - * @throws CustomMetadataException - */ - protected QName createNewPropertyDefinition(Map params) throws CustomMetadataException - { - // Get the customisable type name - String customisableElement = (String)params.get(PARAM_ELEMENT); - QName customisableType = mapToTypeQName(customisableElement); - - String label = URLDecoder.decode((String)params.get(PARAM_LABEL)); - - //According to the wireframes, type here can only be date|text|number - Serializable serializableParam = params.get(PARAM_DATATYPE); - QName type = null; - if (serializableParam != null) - { - if (serializableParam instanceof String) - { - type = QName.createQName((String)serializableParam, getNamespaceService()); - } - else if (serializableParam instanceof QName) - { - type = (QName)serializableParam; - } - else - { - throw new AlfrescoRuntimeException("Unexpected type of dataType param: "+serializableParam+" (expected String or QName)"); - } - } - - // The title is actually generated, so this parameter will be ignored - // by the RMAdminService - String title = (String)params.get(PARAM_TITLE); - String description = (String)params.get(PARAM_DESCRIPTION); - String defaultValue = (String)params.get(PARAM_DEFAULT_VALUE); - - boolean mandatory = false; - serializableParam = params.get(PARAM_MANDATORY); - if (serializableParam != null) - { - mandatory = Boolean.valueOf(serializableParam.toString()); - } - - boolean isProtected = false; - serializableParam = params.get(PARAM_PROTECTED); - if (serializableParam != null) - { - isProtected = Boolean.valueOf(serializableParam.toString()); - } - - boolean multiValued = false; - serializableParam = params.get(PARAM_MULTI_VALUED); - if (serializableParam != null) - { - multiValued = Boolean.valueOf(serializableParam.toString()); - } - - serializableParam = params.get(PARAM_CONSTRAINT_REF); - QName constraintRef = null; - if (serializableParam != null) - { - if (serializableParam instanceof String) - { - constraintRef = QName.createQName((String)serializableParam, getNamespaceService()); - } - else if (serializableParam instanceof QName) - { - constraintRef = (QName)serializableParam; - } - else - { - throw new AlfrescoRuntimeException("Unexpected type of constraintRef param: "+serializableParam+" (expected String or QName)"); - } - } - - // if propId is specified, use it. - QName proposedQName = null; - String propId = (String)params.get(PROP_ID); - if (propId != null) - { - proposedQName = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_PREFIX, propId, getNamespaceService()); - } - - return rmAdminService.addCustomPropertyDefinition( - proposedQName, - customisableType, - label, - type, - title, - description, - defaultValue, - multiValued, - mandatory, - isProtected, - constraintRef); - } - - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.service.namespace.QName; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.surf.util.URLDecoder; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to add RM custom property definitions + * to the custom model. + * + * @author Neil McErlean + */ +public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript +{ + protected RecordsManagementAdminService rmAdminService; + + private static final String PARAM_DATATYPE = "dataType"; + private static final String PARAM_TITLE = "title"; + private static final String PARAM_DESCRIPTION = "description"; + private static final String PARAM_DEFAULT_VALUE = "defaultValue"; + private static final String PARAM_MULTI_VALUED = "multiValued"; + private static final String PARAM_MANDATORY = "mandatory"; + private static final String PARAM_PROTECTED = "protected"; + private static final String PARAM_CONSTRAINT_REF = "constraintRef"; + private static final String PARAM_ELEMENT = "element"; + private static final String PARAM_LABEL = "label"; + private static final String PROP_ID = "propId"; + private static final String MESSAGE = "errorMessage"; + private static final String URL = "url"; + + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + JSONObject json = null; + Map ftlModel = null; + try + { + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + try + { + ftlModel = createPropertyDefinition(req, json); + } + catch (CustomMetadataException e) + { + status.setCode(Status.STATUS_BAD_REQUEST); + ftlModel = new HashMap(); + ftlModel.put(MESSAGE, e.getMessage()); + } + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + return ftlModel; + } + + /** + * Applies custom properties. + * @throws CustomMetadataException + */ + protected Map createPropertyDefinition(WebScriptRequest req, JSONObject json) + throws JSONException, CustomMetadataException + { + Map result = new HashMap(); + Map params = getParamsFromUrlAndJson(req, json); + + QName propertyQName = createNewPropertyDefinition(params); + String localName = propertyQName.getLocalName(); + + result.put(PROP_ID, localName); + + String urlResult = req.getServicePath() + "/" + propertyQName.getLocalName(); + result.put(URL, urlResult); + + return result; + } + + @SuppressWarnings("rawtypes") + protected Map getParamsFromUrlAndJson(WebScriptRequest req, JSONObject json) + throws JSONException + { + Map params; + params = new HashMap(); + params.put(PARAM_ELEMENT, req.getParameter(PARAM_ELEMENT)); + + for (Iterator iter = json.keys(); iter.hasNext(); ) + { + String nextKeyString = (String)iter.next(); + String nextValueString = json.getString(nextKeyString); + + params.put(nextKeyString, nextValueString); + } + + return params; + } + + /** + * Create a property definition based on the parameter values provided + * + * @param params parameter values + * @return {@link QName} qname of the newly created custom property + * @throws CustomMetadataException + */ + protected QName createNewPropertyDefinition(Map params) throws CustomMetadataException + { + // Get the customisable type name + String customisableElement = (String)params.get(PARAM_ELEMENT); + QName customisableType = mapToTypeQName(customisableElement); + + String label = URLDecoder.decode((String)params.get(PARAM_LABEL)); + + //According to the wireframes, type here can only be date|text|number + Serializable serializableParam = params.get(PARAM_DATATYPE); + QName type = null; + if (serializableParam != null) + { + if (serializableParam instanceof String) + { + type = QName.createQName((String)serializableParam, getNamespaceService()); + } + else if (serializableParam instanceof QName) + { + type = (QName)serializableParam; + } + else + { + throw new AlfrescoRuntimeException("Unexpected type of dataType param: "+serializableParam+" (expected String or QName)"); + } + } + + // The title is actually generated, so this parameter will be ignored + // by the RMAdminService + String title = (String)params.get(PARAM_TITLE); + String description = (String)params.get(PARAM_DESCRIPTION); + String defaultValue = (String)params.get(PARAM_DEFAULT_VALUE); + + boolean mandatory = false; + serializableParam = params.get(PARAM_MANDATORY); + if (serializableParam != null) + { + mandatory = Boolean.valueOf(serializableParam.toString()); + } + + boolean isProtected = false; + serializableParam = params.get(PARAM_PROTECTED); + if (serializableParam != null) + { + isProtected = Boolean.valueOf(serializableParam.toString()); + } + + boolean multiValued = false; + serializableParam = params.get(PARAM_MULTI_VALUED); + if (serializableParam != null) + { + multiValued = Boolean.valueOf(serializableParam.toString()); + } + + serializableParam = params.get(PARAM_CONSTRAINT_REF); + QName constraintRef = null; + if (serializableParam != null) + { + if (serializableParam instanceof String) + { + constraintRef = QName.createQName((String)serializableParam, getNamespaceService()); + } + else if (serializableParam instanceof QName) + { + constraintRef = (QName)serializableParam; + } + else + { + throw new AlfrescoRuntimeException("Unexpected type of constraintRef param: "+serializableParam+" (expected String or QName)"); + } + } + + // if propId is specified, use it. + QName proposedQName = null; + String propId = (String)params.get(PROP_ID); + if (propId != null) + { + proposedQName = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_PREFIX, propId, getNamespaceService()); + } + + return rmAdminService.addCustomPropertyDefinition( + proposedQName, + customisableType, + label, + type, + title, + description, + defaultValue, + multiValued, + mandatory, + isProtected, + constraintRef); + } + + + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java index e51a5fc4c4..0b67b1b0ff 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java @@ -1,235 +1,235 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; -import java.io.IOException; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; -import org.alfresco.module.org_alfresco_module_rm.admin.PropertyAlreadyExistsMetadataException; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.namespace.QName; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.ParameterCheck; -import org.springframework.extensions.surf.util.URLEncoder; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to update RM custom property definitions - * in the custom model. - * - * @author Neil McErlean - */ -public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript -{ - private RecordsManagementAdminService rmAdminService; - - private static final String PARAM_LABEL = "label"; - private static final String PARAM_CONSTRAINT_REF = "constraintRef"; - private static final String PROP_ID = "propId"; - private static final String URL = "url"; - private static final String MESSAGE = "errorMessage"; - - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - JSONObject json = null; - Map ftlModel = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - try - { - ftlModel = handlePropertyDefinitionUpdate(req, json); - } - catch (CustomMetadataException e) - { - status.setCode(Status.STATUS_BAD_REQUEST); - ftlModel = new HashMap(); - ftlModel.put(MESSAGE, e.getMessage()); - } - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - return ftlModel; - } - - /** - * Applies custom properties. - * @throws CustomMetadataException - */ - protected Map handlePropertyDefinitionUpdate(WebScriptRequest req, JSONObject json) - throws JSONException, CustomMetadataException - { - Map result = new HashMap(); - - Map params = getParamsFromUrlAndJson(req, json); - - QName propertyQName; - propertyQName = updatePropertyDefinition(params); - String localName = propertyQName.getLocalName(); - - result.put(PROP_ID, localName); - - String urlResult = req.getServicePath(); - result.put(URL, urlResult); - - return result; - } - - /** - * If label has a non-null value, it is set on the property def. - * If constraintRef has a non-null value, it is set on this propDef. - * If constraintRef has a null value, all constraints for that propDef are removed. - * - * @param params - * @return - * @throws CustomMetadataException - */ - protected QName updatePropertyDefinition(Map params) throws CustomMetadataException - { - QName result = null; - boolean updated = false; - - String propId = (String)params.get(PROP_ID); - ParameterCheck.mandatoryString("propId", propId); - - QName propQName = rmAdminService.getQNameForClientId(propId); - if (propQName == null) - { - propQName = rmAdminService.getQNameForClientId(URLEncoder.encode(propId)); - } - if (propQName == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "Could not find property definition for: " + propId); - } - - if (params.containsKey(PARAM_CONSTRAINT_REF)) - { - String constraintRef = (String)params.get(PARAM_CONSTRAINT_REF); - List constraints = rmAdminService.getCustomPropertyDefinitions().get(propQName).getConstraints(); - - if (constraintRef == null) - { - result = rmAdminService.removeCustomPropertyDefinitionConstraints(propQName); - updated = constraints.isEmpty() ? false : true; - } - else - { - boolean exists = false; - for (ConstraintDefinition constraintDefinition : constraints) - { - if (constraintDefinition.getConstraint().getShortName().equalsIgnoreCase(constraintRef)) - { - exists = true; - break; - } - } - if (!exists) - { - QName constraintRefQName = QName.createQName(constraintRef, getNamespaceService()); - result = rmAdminService.setCustomPropertyDefinitionConstraint(propQName, constraintRefQName); - updated = true; - } - } - } - - if (params.containsKey(PARAM_LABEL)) - { - String label = (String)params.get(PARAM_LABEL); - try - { - result = rmAdminService.updateCustomPropertyDefinitionName(propQName, label); - } - catch (PropertyAlreadyExistsMetadataException ex) - { - if (!updated) - { - String propIdAsString = rmAdminService.getQNameForClientId(label).toPrefixString(getNamespaceService()); - throw new PropertyAlreadyExistsMetadataException(propIdAsString); - } - } - } - - return result; - } - - - @SuppressWarnings("unchecked") - protected Map getParamsFromUrlAndJson(WebScriptRequest req, JSONObject json) - throws JSONException - { - Map params; - params = new HashMap(); - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String propId = templateVars.get(PROP_ID); - if (propId != null) - { - params.put(PROP_ID, (Serializable)propId); - } - - for (Iterator iter = json.keys(); iter.hasNext(); ) - { - String nextKeyString = iter.next(); - String nextValueString = null; - if (!json.isNull(nextKeyString)) - { - nextValueString = json.getString(nextKeyString); - } - - params.put(nextKeyString, nextValueString); - } - - return params; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; +import org.alfresco.module.org_alfresco_module_rm.admin.PropertyAlreadyExistsMetadataException; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.cmr.dictionary.ConstraintDefinition; +import org.alfresco.service.namespace.QName; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.surf.util.ParameterCheck; +import org.springframework.extensions.surf.util.URLEncoder; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to update RM custom property definitions + * in the custom model. + * + * @author Neil McErlean + */ +public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript +{ + private RecordsManagementAdminService rmAdminService; + + private static final String PARAM_LABEL = "label"; + private static final String PARAM_CONSTRAINT_REF = "constraintRef"; + private static final String PROP_ID = "propId"; + private static final String URL = "url"; + private static final String MESSAGE = "errorMessage"; + + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + JSONObject json = null; + Map ftlModel = null; + try + { + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + try + { + ftlModel = handlePropertyDefinitionUpdate(req, json); + } + catch (CustomMetadataException e) + { + status.setCode(Status.STATUS_BAD_REQUEST); + ftlModel = new HashMap(); + ftlModel.put(MESSAGE, e.getMessage()); + } + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + return ftlModel; + } + + /** + * Applies custom properties. + * @throws CustomMetadataException + */ + protected Map handlePropertyDefinitionUpdate(WebScriptRequest req, JSONObject json) + throws JSONException, CustomMetadataException + { + Map result = new HashMap(); + + Map params = getParamsFromUrlAndJson(req, json); + + QName propertyQName; + propertyQName = updatePropertyDefinition(params); + String localName = propertyQName.getLocalName(); + + result.put(PROP_ID, localName); + + String urlResult = req.getServicePath(); + result.put(URL, urlResult); + + return result; + } + + /** + * If label has a non-null value, it is set on the property def. + * If constraintRef has a non-null value, it is set on this propDef. + * If constraintRef has a null value, all constraints for that propDef are removed. + * + * @param params + * @return + * @throws CustomMetadataException + */ + protected QName updatePropertyDefinition(Map params) throws CustomMetadataException + { + QName result = null; + boolean updated = false; + + String propId = (String)params.get(PROP_ID); + ParameterCheck.mandatoryString("propId", propId); + + QName propQName = rmAdminService.getQNameForClientId(propId); + if (propQName == null) + { + propQName = rmAdminService.getQNameForClientId(URLEncoder.encode(propId)); + } + if (propQName == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, + "Could not find property definition for: " + propId); + } + + if (params.containsKey(PARAM_CONSTRAINT_REF)) + { + String constraintRef = (String)params.get(PARAM_CONSTRAINT_REF); + List constraints = rmAdminService.getCustomPropertyDefinitions().get(propQName).getConstraints(); + + if (constraintRef == null) + { + result = rmAdminService.removeCustomPropertyDefinitionConstraints(propQName); + updated = constraints.isEmpty() ? false : true; + } + else + { + boolean exists = false; + for (ConstraintDefinition constraintDefinition : constraints) + { + if (constraintDefinition.getConstraint().getShortName().equalsIgnoreCase(constraintRef)) + { + exists = true; + break; + } + } + if (!exists) + { + QName constraintRefQName = QName.createQName(constraintRef, getNamespaceService()); + result = rmAdminService.setCustomPropertyDefinitionConstraint(propQName, constraintRefQName); + updated = true; + } + } + } + + if (params.containsKey(PARAM_LABEL)) + { + String label = (String)params.get(PARAM_LABEL); + try + { + result = rmAdminService.updateCustomPropertyDefinitionName(propQName, label); + } + catch (PropertyAlreadyExistsMetadataException ex) + { + if (!updated) + { + String propIdAsString = rmAdminService.getQNameForClientId(label).toPrefixString(getNamespaceService()); + throw new PropertyAlreadyExistsMetadataException(propIdAsString); + } + } + } + + return result; + } + + + @SuppressWarnings("unchecked") + protected Map getParamsFromUrlAndJson(WebScriptRequest req, JSONObject json) + throws JSONException + { + Map params; + params = new HashMap(); + + Map templateVars = req.getServiceMatch().getTemplateVars(); + String propId = templateVars.get(PROP_ID); + if (propId != null) + { + params.put(PROP_ID, (Serializable)propId); + } + + for (Iterator iter = json.keys(); iter.hasNext(); ) + { + String nextKeyString = iter.next(); + String nextValueString = null; + if (!json.isNull(nextKeyString)) + { + nextValueString = json.getString(nextKeyString); + } + + params.put(nextKeyString, nextValueString); + } + + return params; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionsGet.java index 2cbd80e84d..43edc1f415 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionsGet.java @@ -1,130 +1,130 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This class provides the implementation for the custompropdefinitions.get webscript. - * - * @author Neil McErlean - */ -public class CustomPropertyDefinitionsGet extends BaseCustomPropertyWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(CustomPropertyDefinitionsGet.class); - - private static final String ELEMENT = "element"; - private static final String PROP_ID = "propId"; - - /** Records management admin service */ - private RecordsManagementAdminService rmAdminService; - - /** - * @param rmAdminService records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String propId = templateVars.get(PROP_ID); - String elementName = req.getParameter(ELEMENT); - - if (logger.isDebugEnabled() && elementName != null) - { - logger.debug("Getting custom property definitions for elementName " + elementName); - } - else if (logger.isDebugEnabled() && propId != null) - { - logger.debug("Getting custom property definition for propId " + propId); - } - - // If propId has been provided then this is a request for a single custom-property-defn. - // else it is a request for all defined on the specified element. - List propData = new ArrayList(); - if (propId != null) - { - QName propQName = rmAdminService.getQNameForClientId(propId); - PropertyDefinition propDefn = rmAdminService.getCustomPropertyDefinitions().get(propQName); - if (propQName == null || propDefn == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Property definition for " + propId + " not found."); - } - propData.add(propDefn); - } - else if (elementName != null) - { - QName customisableType = mapToTypeQName(elementName); - Map currentCustomProps = rmAdminService.getCustomPropertyDefinitions(customisableType); - if (currentCustomProps != null) - { - for (Entry entry : currentCustomProps.entrySet()) - { - propData.add(entry.getValue()); - } - } - } - else - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Either elementName or propId must be specified."); - } - - if (logger.isDebugEnabled()) - { - logger.debug("Retrieved custom property definitions: " + propData); - } - - model.put("customProps", propData); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * This class provides the implementation for the custompropdefinitions.get webscript. + * + * @author Neil McErlean + */ +public class CustomPropertyDefinitionsGet extends BaseCustomPropertyWebScript +{ + /** Logger */ + private static Log logger = LogFactory.getLog(CustomPropertyDefinitionsGet.class); + + private static final String ELEMENT = "element"; + private static final String PROP_ID = "propId"; + + /** Records management admin service */ + private RecordsManagementAdminService rmAdminService; + + /** + * @param rmAdminService records management admin service + */ + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + Map templateVars = req.getServiceMatch().getTemplateVars(); + String propId = templateVars.get(PROP_ID); + String elementName = req.getParameter(ELEMENT); + + if (logger.isDebugEnabled() && elementName != null) + { + logger.debug("Getting custom property definitions for elementName " + elementName); + } + else if (logger.isDebugEnabled() && propId != null) + { + logger.debug("Getting custom property definition for propId " + propId); + } + + // If propId has been provided then this is a request for a single custom-property-defn. + // else it is a request for all defined on the specified element. + List propData = new ArrayList(); + if (propId != null) + { + QName propQName = rmAdminService.getQNameForClientId(propId); + PropertyDefinition propDefn = rmAdminService.getCustomPropertyDefinitions().get(propQName); + if (propQName == null || propDefn == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Property definition for " + propId + " not found."); + } + propData.add(propDefn); + } + else if (elementName != null) + { + QName customisableType = mapToTypeQName(elementName); + Map currentCustomProps = rmAdminService.getCustomPropertyDefinitions(customisableType); + if (currentCustomProps != null) + { + for (Entry entry : currentCustomProps.entrySet()) + { + propData.add(entry.getValue()); + } + } + } + else + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Either elementName or propId must be specified."); + } + + if (logger.isDebugEnabled()) + { + logger.debug("Retrieved custom property definitions: " + propData); + } + + model.put("customProps", propData); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java index 69e900b78d..bd0bac1c6a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java @@ -1,161 +1,161 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to remove RM custom relationship from a node. - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public class CustomRefDelete extends AbstractRmWebScript -{ - /** Constants */ - private static final String REF_ID = "refId"; - private static final String ST = "st"; - private static final String SI = "si"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Rule service */ - private RuleService ruleService; - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Returns the rule service instance - * - * @return The rule service instance - */ - protected RuleService getRuleService() - { - return this.ruleService; - } - - /** - * Sets the rule service instance - * - * @param ruleService The rule service instance - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - try - { - getRuleService().disableRuleType(RuleType.OUTBOUND); - removeCustomRelationship(req); - model.put(SUCCESS, true); - } - finally - { - getRuleService().enableRuleType(RuleType.OUTBOUND); - } - return model; - } - - /** - * Removes a custom relationship - * - * @param req The webscript request - */ - private void removeCustomRelationship(WebScriptRequest req) - { - String uniqueName = getRequestParameterValue(req, REF_ID); - NodeRef source = parseRequestForNodeRef(req); - NodeRef target = getTargetNode(req); - - getRelationshipService().removeRelationship(uniqueName, source, target); - getRelationshipService().removeRelationship(uniqueName, target, source); - } - - /** - * Gets the target node - * - * @param req The webscript request - * @return The target node - */ - private NodeRef getTargetNode(WebScriptRequest req) - { - String storeType = req.getParameter(ST); - String storeId = req.getParameter(SI); - String nodeId = req.getParameter(ID); - - NodeRef targetNode = new NodeRef(storeType, storeId, nodeId); - if (!getNodeService().exists(targetNode)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find the target node: '" + - targetNode.toString() + "'."); - } - - return targetNode; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.rule.RuleService; +import org.alfresco.service.cmr.rule.RuleType; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to remove RM custom relationship from a node. + * + * @author Neil McErlean + * @author Tuna Aksoy + */ +public class CustomRefDelete extends AbstractRmWebScript +{ + /** Constants */ + private static final String REF_ID = "refId"; + private static final String ST = "st"; + private static final String SI = "si"; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** Rule service */ + private RuleService ruleService; + + /** + * Gets the relationship service instance + * + * @return The relationship service instance + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Sets the relationship service instance + * + * @param relationshipService The relationship service instance + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * Returns the rule service instance + * + * @return The rule service instance + */ + protected RuleService getRuleService() + { + return this.ruleService; + } + + /** + * Sets the rule service instance + * + * @param ruleService The rule service instance + */ + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1); + try + { + getRuleService().disableRuleType(RuleType.OUTBOUND); + removeCustomRelationship(req); + model.put(SUCCESS, true); + } + finally + { + getRuleService().enableRuleType(RuleType.OUTBOUND); + } + return model; + } + + /** + * Removes a custom relationship + * + * @param req The webscript request + */ + private void removeCustomRelationship(WebScriptRequest req) + { + String uniqueName = getRequestParameterValue(req, REF_ID); + NodeRef source = parseRequestForNodeRef(req); + NodeRef target = getTargetNode(req); + + getRelationshipService().removeRelationship(uniqueName, source, target); + getRelationshipService().removeRelationship(uniqueName, target, source); + } + + /** + * Gets the target node + * + * @param req The webscript request + * @return The target node + */ + private NodeRef getTargetNode(WebScriptRequest req) + { + String storeType = req.getParameter(ST); + String storeId = req.getParameter(SI); + String nodeId = req.getParameter(ID); + + NodeRef targetNode = new NodeRef(storeType, storeId, nodeId); + if (!getNodeService().exists(targetNode)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find the target node: '" + + targetNode.toString() + "'."); + } + + return targetNode; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java index c514870f4d..6df029769b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java @@ -1,168 +1,168 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; -import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to add RM custom relationship to a node. - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public class CustomRefPost extends AbstractRmWebScript -{ - /** Constants */ - private static final String TO_NODE = "toNode"; - private static final String REF_ID = "refId"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Rule service */ - private RuleService ruleService; - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Gets the rule service instance - * - * @return The rule service instance - */ - protected RuleService getRuleService() - { - return this.ruleService; - } - - /** - * Sets the rule service instance - * - * @param ruleService The rule service instance - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - try - { - getRuleService().disableRuleType(RuleType.INBOUND); - addCustomRelationship(req); - model.put(SUCCESS, true); - } - finally - { - getRuleService().enableRuleType(RuleType.INBOUND); - } - return model; - } - - /** - * Adds a custom relationship - * - * @param req The webscript request - */ - protected void addCustomRelationship(WebScriptRequest req) - { - JSONObject json = getRequestContentAsJSONObject(req); - String uniqueName = getStringValueFromJSONObject(json, REF_ID); - NodeRef target = getTargetNode(json); - NodeRef source = parseRequestForNodeRef(req); - - if (uniqueName.endsWith(INVERT)) - { - String uniqueNameStem = uniqueName.split(INVERT)[0]; - getRelationshipService().addRelationship(uniqueNameStem, target, source); - } - else - { - getRelationshipService().addRelationship(uniqueName, source, target); - } - } - - /** - * Gets the target node - * - * @param json Request content as json object - * @return The target node - */ - private NodeRef getTargetNode(JSONObject json) - { - String targetNodeString = getStringValueFromJSONObject(json, TO_NODE); - NodeRef targetNode = new NodeRef(targetNodeString); - - if (!getNodeService().exists(targetNode)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find the target node: '" + - targetNode.toString() + "'."); - } - - return targetNode; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; +import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.rule.RuleService; +import org.alfresco.service.cmr.rule.RuleType; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to add RM custom relationship to a node. + * + * @author Neil McErlean + * @author Tuna Aksoy + */ +public class CustomRefPost extends AbstractRmWebScript +{ + /** Constants */ + private static final String TO_NODE = "toNode"; + private static final String REF_ID = "refId"; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** Rule service */ + private RuleService ruleService; + + /** + * Gets the relationship service instance + * + * @return The relationship service instance + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Sets the relationship service instance + * + * @param relationshipService The relationship service instance + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * Gets the rule service instance + * + * @return The rule service instance + */ + protected RuleService getRuleService() + { + return this.ruleService; + } + + /** + * Sets the rule service instance + * + * @param ruleService The rule service instance + */ + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1); + try + { + getRuleService().disableRuleType(RuleType.INBOUND); + addCustomRelationship(req); + model.put(SUCCESS, true); + } + finally + { + getRuleService().enableRuleType(RuleType.INBOUND); + } + return model; + } + + /** + * Adds a custom relationship + * + * @param req The webscript request + */ + protected void addCustomRelationship(WebScriptRequest req) + { + JSONObject json = getRequestContentAsJSONObject(req); + String uniqueName = getStringValueFromJSONObject(json, REF_ID); + NodeRef target = getTargetNode(json); + NodeRef source = parseRequestForNodeRef(req); + + if (uniqueName.endsWith(INVERT)) + { + String uniqueNameStem = uniqueName.split(INVERT)[0]; + getRelationshipService().addRelationship(uniqueNameStem, target, source); + } + else + { + getRelationshipService().addRelationship(uniqueName, source, target); + } + } + + /** + * Gets the target node + * + * @param json Request content as json object + * @return The target node + */ + private NodeRef getTargetNode(JSONObject json) + { + String targetNodeString = getStringValueFromJSONObject(json, TO_NODE); + NodeRef targetNode = new NodeRef(targetNodeString); + + if (!getNodeService().exists(targetNode)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find the target node: '" + + targetNode.toString() + "'."); + } + + return targetNode; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java index 29c4d02b38..f817191aec 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java @@ -1,103 +1,103 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; -import static org.apache.commons.lang.StringUtils.isBlank; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.json.JSONObject; - -/** - * Base class for custom reference definition classes - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class CustomReferenceDefinitionBase extends AbstractRmWebScript -{ - /** Constants for the custom reference definition classes */ - protected static final String REFERENCE_TYPE = "referenceType"; - protected static final String REF_ID = "refId"; - protected static final String LABEL = "label"; - protected static final String SOURCE = "source"; - protected static final String TARGET = "target"; - protected static final String CUSTOM_REFS = "customRefs"; - protected static final String URL = "url"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Creates the relationship display name from request content - * - * @param requestContent The request content as json object - * @return The relationship display name - */ - protected RelationshipDisplayName createDisplayName(JSONObject requestContent) - { - String sourceText; - String targetText; - - String labelText = getStringValueFromJSONObject(requestContent, LABEL, false, false); - - if (isBlank(labelText)) - { - sourceText = getStringValueFromJSONObject(requestContent, SOURCE); - targetText = getStringValueFromJSONObject(requestContent, TARGET); - } - else - { - sourceText = labelText; - targetText = labelText; - } - - return new RelationshipDisplayName(sourceText, targetText); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; +import static org.apache.commons.lang.StringUtils.isBlank; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.json.JSONObject; + +/** + * Base class for custom reference definition classes + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class CustomReferenceDefinitionBase extends AbstractRmWebScript +{ + /** Constants for the custom reference definition classes */ + protected static final String REFERENCE_TYPE = "referenceType"; + protected static final String REF_ID = "refId"; + protected static final String LABEL = "label"; + protected static final String SOURCE = "source"; + protected static final String TARGET = "target"; + protected static final String CUSTOM_REFS = "customRefs"; + protected static final String URL = "url"; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** + * Gets the relationship service instance + * + * @return The relationship service instance + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Sets the relationship service instance + * + * @param relationshipService The relationship service instance + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * Creates the relationship display name from request content + * + * @param requestContent The request content as json object + * @return The relationship display name + */ + protected RelationshipDisplayName createDisplayName(JSONObject requestContent) + { + String sourceText; + String targetText; + + String labelText = getStringValueFromJSONObject(requestContent, LABEL, false, false); + + if (isBlank(labelText)) + { + sourceText = getStringValueFromJSONObject(requestContent, SOURCE); + targetText = getStringValueFromJSONObject(requestContent, TARGET); + } + else + { + sourceText = labelText; + targetText = labelText; + } + + return new RelationshipDisplayName(sourceText, targetText); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java index 84755cf312..a48a98de41 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java @@ -1,88 +1,88 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to add RM custom reference definitions - * to the custom model. - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public class CustomReferenceDefinitionPost extends CustomReferenceDefinitionBase -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - JSONObject requestContent = getRequestContentAsJSONObject(req); - RelationshipDisplayName displayName = createDisplayName(requestContent); - RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); - - Map model = new HashMap(); - String servicePath = req.getServicePath(); - Map customRelationshipData = createRelationshipDefinitionData(relationshipDefinition, servicePath); - model.putAll(customRelationshipData); - - return model; - } - - /** - * Creates relationship definition data for the ftl template - * - * @param relationshipDefinition The relationship definition - * @param servicePath The service path - * @return The relationship definition data - */ - private Map createRelationshipDefinitionData(RelationshipDefinition relationshipDefinition, String servicePath) - { - Map relationshipDefinitionData = new HashMap(4); - String uniqueName = relationshipDefinition.getUniqueName(); - relationshipDefinitionData.put(REFERENCE_TYPE, relationshipDefinition.getType().toString()); - relationshipDefinitionData.put(REF_ID, uniqueName); - relationshipDefinitionData.put(URL, servicePath + PATH_SEPARATOR + uniqueName); - relationshipDefinitionData.put(SUCCESS, Boolean.TRUE); - return relationshipDefinitionData; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to add RM custom reference definitions + * to the custom model. + * + * @author Neil McErlean + * @author Tuna Aksoy + */ +public class CustomReferenceDefinitionPost extends CustomReferenceDefinitionBase +{ + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + JSONObject requestContent = getRequestContentAsJSONObject(req); + RelationshipDisplayName displayName = createDisplayName(requestContent); + RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); + + Map model = new HashMap(); + String servicePath = req.getServicePath(); + Map customRelationshipData = createRelationshipDefinitionData(relationshipDefinition, servicePath); + model.putAll(customRelationshipData); + + return model; + } + + /** + * Creates relationship definition data for the ftl template + * + * @param relationshipDefinition The relationship definition + * @param servicePath The service path + * @return The relationship definition data + */ + private Map createRelationshipDefinitionData(RelationshipDefinition relationshipDefinition, String servicePath) + { + Map relationshipDefinitionData = new HashMap(4); + String uniqueName = relationshipDefinition.getUniqueName(); + relationshipDefinitionData.put(REFERENCE_TYPE, relationshipDefinition.getType().toString()); + relationshipDefinitionData.put(REF_ID, uniqueName); + relationshipDefinitionData.put(URL, servicePath + PATH_SEPARATOR + uniqueName); + relationshipDefinitionData.put(SUCCESS, Boolean.TRUE); + return relationshipDefinitionData; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java index f154010b5f..2bd0b98928 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java @@ -1,88 +1,88 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to update RM custom reference definitions. - * There is currently only support for updating the label (for bidirectional references) or - * the source/target (for parent/child references). - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public class CustomReferenceDefinitionPut extends CustomReferenceDefinitionBase -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - String uniqueName = getRequestParameterValue(req, REF_ID); - JSONObject requestContent = getRequestContentAsJSONObject(req); - RelationshipDisplayName displayName = createDisplayName(requestContent); - getRelationshipService().updateRelationshipDefinition(uniqueName, displayName); - - Map model = new HashMap(); - String servicePath = req.getServicePath(); - Map customReferenceData = createRelationshipDefinitionData(servicePath, uniqueName); - model.putAll(customReferenceData); - - return model; - } - - /** - * Creates relationship definition data for the ftl template - * - * @param servicePath The service path - * @param String The relationship unique name - * @return The relationship definition data - */ - private Map createRelationshipDefinitionData(String servicePath, String uniqueName) - { - Map relationshipDefinitionData = new HashMap(3); - relationshipDefinitionData.put(URL, servicePath); - relationshipDefinitionData.put(REF_ID, uniqueName); - relationshipDefinitionData.put(SUCCESS, Boolean.TRUE); - return relationshipDefinitionData; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; +import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to update RM custom reference definitions. + * There is currently only support for updating the label (for bidirectional references) or + * the source/target (for parent/child references). + * + * @author Neil McErlean + * @author Tuna Aksoy + */ +public class CustomReferenceDefinitionPut extends CustomReferenceDefinitionBase +{ + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + String uniqueName = getRequestParameterValue(req, REF_ID); + JSONObject requestContent = getRequestContentAsJSONObject(req); + RelationshipDisplayName displayName = createDisplayName(requestContent); + getRelationshipService().updateRelationshipDefinition(uniqueName, displayName); + + Map model = new HashMap(); + String servicePath = req.getServicePath(); + Map customReferenceData = createRelationshipDefinitionData(servicePath, uniqueName); + model.putAll(customReferenceData); + + return model; + } + + /** + * Creates relationship definition data for the ftl template + * + * @param servicePath The service path + * @param String The relationship unique name + * @return The relationship definition data + */ + private Map createRelationshipDefinitionData(String servicePath, String uniqueName) + { + Map relationshipDefinitionData = new HashMap(3); + relationshipDefinitionData.put(URL, servicePath); + relationshipDefinitionData.put(REF_ID, uniqueName); + relationshipDefinitionData.put(SUCCESS, Boolean.TRUE); + return relationshipDefinitionData; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java index bfc864eecd..27f7d19f06 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java @@ -1,145 +1,145 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; -import static org.apache.commons.lang3.StringUtils.isBlank; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get RM custom reference definitions. - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public class CustomReferenceDefinitionsGet extends CustomReferenceDefinitionBase -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - String uniqueName = getRequestParameterValue(req, REF_ID, false); - Set relationshipDefinitions = getRelationshipDefinitons(uniqueName); - List> relationshipDefinitionData = createRelationshipDefinitionData(relationshipDefinitions); - - Map model = new HashMap(); - model.put(CUSTOM_REFS, relationshipDefinitionData); - return model; - } - - /** - * Gets the relationship definition for the unique name. If the unique - * name is blank all relationship definitions will be retrieved - * - * @param uniqueName The unique name of the relationship definition - * @return Relationship definition for the given unique name or all - * relationship definitions if unique name is blank - */ - private Set getRelationshipDefinitons(String uniqueName) - { - Set relationshipDefinitions = new HashSet(); - - if (isBlank(uniqueName)) - { - relationshipDefinitions.addAll(getRelationshipService().getRelationshipDefinitions()); - } - else - { - RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); - if (relationshipDefinition != null) - { - relationshipDefinitions.add(relationshipDefinition); - } - } - - return relationshipDefinitions; - } - - /** - * Creates relationship definition data for the ftl template - * - * @param relationshipDefinitions The relationship definitions - * @return The relationship definition data - */ - private List> createRelationshipDefinitionData(Set relationshipDefinitions) - { - List> relationshipDefinitionData = new ArrayList>(); - - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) - { - Map data = new HashMap(); - - RelationshipType type = relationshipDefinition.getType(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - - if (RelationshipType.BIDIRECTIONAL.equals(type)) - { - data.put(LABEL, displayName.getSourceText()); - } - else if (RelationshipType.PARENTCHILD.equals(type)) - { - data.put(SOURCE, displayName.getSourceText()); - data.put(TARGET, displayName.getTargetText()); - } - else - { - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type '") - .append(type) - .append("'."); - - throw new WebScriptException(Status.STATUS_BAD_REQUEST, sb.toString()); - } - - data.put(REF_ID, relationshipDefinition.getUniqueName()); - data.put(REFERENCE_TYPE, type.toString().toLowerCase()); - - relationshipDefinitionData.add(data); - } - - return relationshipDefinitionData; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; +import static org.apache.commons.lang3.StringUtils.isBlank; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to get RM custom reference definitions. + * + * @author Neil McErlean + * @author Tuna Aksoy + */ +public class CustomReferenceDefinitionsGet extends CustomReferenceDefinitionBase +{ + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + String uniqueName = getRequestParameterValue(req, REF_ID, false); + Set relationshipDefinitions = getRelationshipDefinitons(uniqueName); + List> relationshipDefinitionData = createRelationshipDefinitionData(relationshipDefinitions); + + Map model = new HashMap(); + model.put(CUSTOM_REFS, relationshipDefinitionData); + return model; + } + + /** + * Gets the relationship definition for the unique name. If the unique + * name is blank all relationship definitions will be retrieved + * + * @param uniqueName The unique name of the relationship definition + * @return Relationship definition for the given unique name or all + * relationship definitions if unique name is blank + */ + private Set getRelationshipDefinitons(String uniqueName) + { + Set relationshipDefinitions = new HashSet(); + + if (isBlank(uniqueName)) + { + relationshipDefinitions.addAll(getRelationshipService().getRelationshipDefinitions()); + } + else + { + RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); + if (relationshipDefinition != null) + { + relationshipDefinitions.add(relationshipDefinition); + } + } + + return relationshipDefinitions; + } + + /** + * Creates relationship definition data for the ftl template + * + * @param relationshipDefinitions The relationship definitions + * @return The relationship definition data + */ + private List> createRelationshipDefinitionData(Set relationshipDefinitions) + { + List> relationshipDefinitionData = new ArrayList>(); + + for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) + { + Map data = new HashMap(); + + RelationshipType type = relationshipDefinition.getType(); + RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); + + if (RelationshipType.BIDIRECTIONAL.equals(type)) + { + data.put(LABEL, displayName.getSourceText()); + } + else if (RelationshipType.PARENTCHILD.equals(type)) + { + data.put(SOURCE, displayName.getSourceText()); + data.put(TARGET, displayName.getTargetText()); + } + else + { + StringBuilder sb = new StringBuilder(); + sb.append("Unsupported relationship type '") + .append(type) + .append("'."); + + throw new WebScriptException(Status.STATUS_BAD_REQUEST, sb.toString()); + } + + data.put(REF_ID, relationshipDefinition.getUniqueName()); + data.put(REFERENCE_TYPE, type.toString().toLowerCase()); + + relationshipDefinitionData.add(data); + } + + return relationshipDefinitionData; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java index 1637ea4467..2b453cf8fd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java @@ -1,67 +1,67 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; - -/** - * This enum represents the allowed types of custom references. - * - * @author Neil McErlean - * @deprecated as of RM 2.3, please use {@link RelationshipType} instead. - */ -public enum CustomReferenceType -{ - PARENT_CHILD("parentchild"), - BIDIRECTIONAL("bidirectional"); - - private final String printableString; - - private CustomReferenceType(String printableString) - { - this.printableString = printableString; - } - - @Override - public String toString() - { - return this.printableString; - } - - public static CustomReferenceType getEnumFromString(String stg) - { - for (CustomReferenceType type : CustomReferenceType.values()) - { - if (type.printableString.equals(stg)) - { - return type; - } - } - throw new IllegalArgumentException("Unrecognised CustomReferenceType: " + stg); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; + +/** + * This enum represents the allowed types of custom references. + * + * @author Neil McErlean + * @deprecated as of RM 2.3, please use {@link RelationshipType} instead. + */ +public enum CustomReferenceType +{ + PARENT_CHILD("parentchild"), + BIDIRECTIONAL("bidirectional"); + + private final String printableString; + + private CustomReferenceType(String printableString) + { + this.printableString = printableString; + } + + @Override + public String toString() + { + return this.printableString; + } + + public static CustomReferenceType getEnumFromString(String stg) + { + for (CustomReferenceType type : CustomReferenceType.values()) + { + if (type.printableString.equals(stg)) + { + return type; + } + } + throw new IllegalArgumentException("Unrecognised CustomReferenceType: " + stg); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java index cf7ed0c67a..a9e9f06c96 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java @@ -1,243 +1,243 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get RM custom references for a node. - * - * @author Neil McErlean - * @author Tuna Aksoy - */ -public class CustomRefsGet extends AbstractRmWebScript -{ - /** Constants */ - private static final String REFERENCE_TYPE = "referenceType"; - private static final String REF_ID = "refId"; - private static final String LABEL = "label"; - private static final String SOURCE = "source"; - private static final String TARGET = "target"; - private static final String PARENT_REF = "parentRef"; - private static final String CHILD_REF = "childRef"; - private static final String SOURCE_REF = "sourceRef"; - private static final String TARGET_REF = "targetRef"; - private static final String CUSTOM_REFS_FROM = "customRefsFrom"; - private static final String CUSTOM_REFS_TO = "customRefsTo"; - private static final String NODE_NAME = "nodeName"; - private static final String NODE_TITLE = "nodeTitle"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Gets the capability service instance - * - * @return The capability service instance - */ - protected CapabilityService getCapabilityService() - { - return this.capabilityService; - } - - /** - * Sets the capability service instance - * - * @param capabilityService Capability service instance - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(4); - NodeRef nodeRef = parseRequestForNodeRef(req); - model.put(NODE_NAME, getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME)); - model.put(NODE_TITLE, getNodeService().getProperty(nodeRef, ContentModel.PROP_TITLE)); - model.put(CUSTOM_REFS_FROM, getOutwardReferences(nodeRef)); - model.put(CUSTOM_REFS_TO, getInwardReferenceData(nodeRef)); - return model; - } - - /** - * Gets all the references that come 'out' from this node - * - * @param nodeRef Node reference - * @return All the references that come 'out' from this node - */ - private List> getOutwardReferences(NodeRef nodeRef) - { - List> outwardReferenceData = new ArrayList>(); - Set relationships = getRelationshipService().getRelationshipsFrom(nodeRef); - outwardReferenceData.addAll(getRelationshipData(relationships)); - return outwardReferenceData; - } - - /** - * Gets all the references that come 'in' to this node - * - * @param nodeRef Node reference - * @return All the references that come 'in' to this node - */ - private List> getInwardReferenceData(NodeRef nodeRef) - { - List> inwardReferenceData = new ArrayList>(); - Set relationships = getRelationshipService().getRelationshipsTo(nodeRef); - inwardReferenceData.addAll(getRelationshipData(relationships)); - return inwardReferenceData; - } - - /** - * Creates relationship data for the ftl template - * - * @param relationships The relationships - * @return The relationship data - */ - private List> getRelationshipData(Set relationships) - { - List> relationshipData = new ArrayList>(); - - for (Relationship relationship : relationships) - { - String uniqueName = relationship.getUniqueName(); - RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); - - NodeRef source = relationship.getSource(); - NodeRef target = relationship.getTarget(); - - if (relationshipDefinition != null && hasView(source) && hasView(target)) - { - Map data = new HashMap(); - - RelationshipType type = relationshipDefinition.getType(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - - if (RelationshipType.BIDIRECTIONAL.equals(type)) - { - data.put(LABEL, displayName.getSourceText()); - data.put(SOURCE_REF, source.toString()); - data.put(TARGET_REF, target.toString()); - } - else if (RelationshipType.PARENTCHILD.equals(type)) - { - data.put(SOURCE, displayName.getSourceText()); - data.put(TARGET, displayName.getTargetText()); - data.put(PARENT_REF, source.toString()); - data.put(CHILD_REF, target.toString()); - } - else - { - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type '") - .append(type) - .append("'."); - - throw new WebScriptException(Status.STATUS_BAD_REQUEST, sb.toString()); - } - - data.put(REFERENCE_TYPE, type.toString().toLowerCase()); - data.put(REF_ID, uniqueName); - - relationshipData.add(data); - } - - } - - return relationshipData; - } - - /** - * Determines whether the current user has view capabilities on the given node. - * - * @param nodeRef Node reference - * @return boolean true if current user has view capability, false otherwise - */ - private boolean hasView(NodeRef nodeRef) - { - boolean result = false; - - Capability viewRecordCapability = getCapabilityService().getCapability(ViewRecordsCapability.NAME); - if (AccessStatus.ALLOWED.equals(viewRecordCapability.hasPermission(nodeRef))) - { - result = true; - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; +import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to get RM custom references for a node. + * + * @author Neil McErlean + * @author Tuna Aksoy + */ +public class CustomRefsGet extends AbstractRmWebScript +{ + /** Constants */ + private static final String REFERENCE_TYPE = "referenceType"; + private static final String REF_ID = "refId"; + private static final String LABEL = "label"; + private static final String SOURCE = "source"; + private static final String TARGET = "target"; + private static final String PARENT_REF = "parentRef"; + private static final String CHILD_REF = "childRef"; + private static final String SOURCE_REF = "sourceRef"; + private static final String TARGET_REF = "targetRef"; + private static final String CUSTOM_REFS_FROM = "customRefsFrom"; + private static final String CUSTOM_REFS_TO = "customRefsTo"; + private static final String NODE_NAME = "nodeName"; + private static final String NODE_TITLE = "nodeTitle"; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** Capability service */ + private CapabilityService capabilityService; + + /** + * Gets the relationship service instance + * + * @return The relationship service instance + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Sets the relationship service instance + * + * @param relationshipService The relationship service instance + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * Gets the capability service instance + * + * @return The capability service instance + */ + protected CapabilityService getCapabilityService() + { + return this.capabilityService; + } + + /** + * Sets the capability service instance + * + * @param capabilityService Capability service instance + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(4); + NodeRef nodeRef = parseRequestForNodeRef(req); + model.put(NODE_NAME, getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME)); + model.put(NODE_TITLE, getNodeService().getProperty(nodeRef, ContentModel.PROP_TITLE)); + model.put(CUSTOM_REFS_FROM, getOutwardReferences(nodeRef)); + model.put(CUSTOM_REFS_TO, getInwardReferenceData(nodeRef)); + return model; + } + + /** + * Gets all the references that come 'out' from this node + * + * @param nodeRef Node reference + * @return All the references that come 'out' from this node + */ + private List> getOutwardReferences(NodeRef nodeRef) + { + List> outwardReferenceData = new ArrayList>(); + Set relationships = getRelationshipService().getRelationshipsFrom(nodeRef); + outwardReferenceData.addAll(getRelationshipData(relationships)); + return outwardReferenceData; + } + + /** + * Gets all the references that come 'in' to this node + * + * @param nodeRef Node reference + * @return All the references that come 'in' to this node + */ + private List> getInwardReferenceData(NodeRef nodeRef) + { + List> inwardReferenceData = new ArrayList>(); + Set relationships = getRelationshipService().getRelationshipsTo(nodeRef); + inwardReferenceData.addAll(getRelationshipData(relationships)); + return inwardReferenceData; + } + + /** + * Creates relationship data for the ftl template + * + * @param relationships The relationships + * @return The relationship data + */ + private List> getRelationshipData(Set relationships) + { + List> relationshipData = new ArrayList>(); + + for (Relationship relationship : relationships) + { + String uniqueName = relationship.getUniqueName(); + RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); + + NodeRef source = relationship.getSource(); + NodeRef target = relationship.getTarget(); + + if (relationshipDefinition != null && hasView(source) && hasView(target)) + { + Map data = new HashMap(); + + RelationshipType type = relationshipDefinition.getType(); + RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); + + if (RelationshipType.BIDIRECTIONAL.equals(type)) + { + data.put(LABEL, displayName.getSourceText()); + data.put(SOURCE_REF, source.toString()); + data.put(TARGET_REF, target.toString()); + } + else if (RelationshipType.PARENTCHILD.equals(type)) + { + data.put(SOURCE, displayName.getSourceText()); + data.put(TARGET, displayName.getTargetText()); + data.put(PARENT_REF, source.toString()); + data.put(CHILD_REF, target.toString()); + } + else + { + StringBuilder sb = new StringBuilder(); + sb.append("Unsupported relationship type '") + .append(type) + .append("'."); + + throw new WebScriptException(Status.STATUS_BAD_REQUEST, sb.toString()); + } + + data.put(REFERENCE_TYPE, type.toString().toLowerCase()); + data.put(REF_ID, uniqueName); + + relationshipData.add(data); + } + + } + + return relationshipData; + } + + /** + * Determines whether the current user has view capabilities on the given node. + * + * @param nodeRef Node reference + * @return boolean true if current user has view capability, false otherwise + */ + private boolean hasView(NodeRef nodeRef) + { + boolean result = false; + + Capability viewRecordCapability = getCapabilityService().getCapability(ViewRecordsCapability.NAME); + if (AccessStatus.ALLOWED.equals(viewRecordCapability.hasPermission(nodeRef))) + { + result = true; + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomisableGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomisableGet.java index c8535cdc59..baa2cf2bb5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomisableGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomisableGet.java @@ -1,177 +1,177 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This class provides the implementation for the customisable.get webscript. - * - * @author Roy Wetherall - */ -public class CustomisableGet extends DeclarativeWebScript -{ - /** Records management admin service */ - private RecordsManagementAdminService rmAdminService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** - * @param rmAdminService records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) - { - this.rmAdminService = rmAdminService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - Set qnames = rmAdminService.getCustomisable(); - ArrayList items = new ArrayList(qnames.size()); - for (QName qname : qnames) - { - ClassDefinition definition = dictionaryService.getClass(qname); - if (definition != null) - { - String name = qname.toPrefixString(namespaceService); - String title = definition.getTitle(dictionaryService); - if (title == null || title.length() == 0) - { - title = qname.getLocalName(); - } - boolean isAspect = definition.isAspect(); - - items.add(new Item(name, isAspect, title)); - } - } - - // Sort the customisable types and aspects by title - Collections.sort(items, new Comparator() - { - @Override - public int compare(Item o1, Item o2) - { - return o1.title.compareToIgnoreCase(o2.title); - }}); - - model.put("items", items); - return model; - } - - /** - * Model items - */ - public class Item - { - private String name; - private boolean isAspect; - private String title; - - public Item(String name, boolean isAspect, String title) - { - this.name = name; - this.isAspect = isAspect; - this.title = title; - } - - public String getName() - { - return name; - } - - public boolean getIsAspect() - { - return isAspect; - } - - public String getTitle() - { - return title; - } - - @Override - public int hashCode() - { - int varCode = (null == name ? 0 : name.hashCode()); - return 31 + varCode; - } - - @Override - public boolean equals(Object obj) - { - if (obj == null || (obj.getClass() != this.getClass())) - { - return false; - } - else - { - return this.name.equals(((Item)obj).name); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.cmr.dictionary.ClassDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * This class provides the implementation for the customisable.get webscript. + * + * @author Roy Wetherall + */ +public class CustomisableGet extends DeclarativeWebScript +{ + /** Records management admin service */ + private RecordsManagementAdminService rmAdminService; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** + * @param rmAdminService records management admin service + */ + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + Set qnames = rmAdminService.getCustomisable(); + ArrayList items = new ArrayList(qnames.size()); + for (QName qname : qnames) + { + ClassDefinition definition = dictionaryService.getClass(qname); + if (definition != null) + { + String name = qname.toPrefixString(namespaceService); + String title = definition.getTitle(dictionaryService); + if (title == null || title.length() == 0) + { + title = qname.getLocalName(); + } + boolean isAspect = definition.isAspect(); + + items.add(new Item(name, isAspect, title)); + } + } + + // Sort the customisable types and aspects by title + Collections.sort(items, new Comparator() + { + @Override + public int compare(Item o1, Item o2) + { + return o1.title.compareToIgnoreCase(o2.title); + }}); + + model.put("items", items); + return model; + } + + /** + * Model items + */ + public class Item + { + private String name; + private boolean isAspect; + private String title; + + public Item(String name, boolean isAspect, String title) + { + this.name = name; + this.isAspect = isAspect; + this.title = title; + } + + public String getName() + { + return name; + } + + public boolean getIsAspect() + { + return isAspect; + } + + public String getTitle() + { + return title; + } + + @Override + public int hashCode() + { + int varCode = (null == name ? 0 : name.hashCode()); + return 31 + varCode; + } + + @Override + public boolean equals(Object obj) + { + if (obj == null || (obj.getClass() != this.getClass())) + { + return false; + } + else + { + return this.name.equals(((Item)obj).name); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java index 053a2de3f1..ab6083793a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java @@ -1,144 +1,144 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteService; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -public class DataSetPost extends DeclarativeWebScript implements RecordsManagementModel -{ - /** Constant for the site name parameter */ - private static final String ARG_SITE_NAME = "site"; - - /** Constant for the data set id parameter */ - private static final String ARG_DATA_SET_ID = "dataSetId"; - - /** Logger */ - private static Log logger = LogFactory.getLog(DataSetPost.class); - - /** Site service */ - private SiteService siteService; - - /** Data set service */ - private DataSetService dataSetService; - - /** - * Set site service - * - * @param siteService the site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * Data set service - * - * @param dataSetService the data set service - */ - public void setDataSetService(DataSetService dataSetService) - { - this.dataSetService = dataSetService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1, 1.0f); - try - { - // Resolve data set id - String dataSetId = req.getServiceMatch().getTemplateVars().get(ARG_DATA_SET_ID); - if (StringUtils.isBlank(dataSetId)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "A data set id was not provided."); - } - if (!dataSetService.existsDataSet(dataSetId)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "A data set with the id '" + dataSetId + "'" - + " does not exist."); - } - - // Resolve RM site - String siteName = req.getParameter(ARG_SITE_NAME); - if (StringUtils.isBlank(siteName)) - { - siteName = RmSiteType.DEFAULT_SITE_NAME; - } - - // Check the site if it exists - if (siteService.getSite(siteName) == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "A Records Management site with the name '" - + siteName + "' does not exist."); - } - - // Resolve documentLibrary (filePlan) container - NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - if (filePlan == null) - { - filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY, - TYPE_FILE_PLAN, null); - } - - // Load data set in to the file plan - dataSetService.loadDataSet(filePlan, dataSetId); - - model.put("success", true); - model.put("message", "Successfully imported data set."); - } - catch (Exception ex) - { - model.put("success", false); - model.put("message", ex.getMessage()); - logger.error("Error while importing data set: " + ex); - } - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.site.SiteService; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +public class DataSetPost extends DeclarativeWebScript implements RecordsManagementModel +{ + /** Constant for the site name parameter */ + private static final String ARG_SITE_NAME = "site"; + + /** Constant for the data set id parameter */ + private static final String ARG_DATA_SET_ID = "dataSetId"; + + /** Logger */ + private static Log logger = LogFactory.getLog(DataSetPost.class); + + /** Site service */ + private SiteService siteService; + + /** Data set service */ + private DataSetService dataSetService; + + /** + * Set site service + * + * @param siteService the site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * Data set service + * + * @param dataSetService the data set service + */ + public void setDataSetService(DataSetService dataSetService) + { + this.dataSetService = dataSetService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1, 1.0f); + try + { + // Resolve data set id + String dataSetId = req.getServiceMatch().getTemplateVars().get(ARG_DATA_SET_ID); + if (StringUtils.isBlank(dataSetId)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "A data set id was not provided."); + } + if (!dataSetService.existsDataSet(dataSetId)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "A data set with the id '" + dataSetId + "'" + + " does not exist."); + } + + // Resolve RM site + String siteName = req.getParameter(ARG_SITE_NAME); + if (StringUtils.isBlank(siteName)) + { + siteName = RmSiteType.DEFAULT_SITE_NAME; + } + + // Check the site if it exists + if (siteService.getSite(siteName) == null) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "A Records Management site with the name '" + + siteName + "' does not exist."); + } + + // Resolve documentLibrary (filePlan) container + NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); + if (filePlan == null) + { + filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY, + TYPE_FILE_PLAN, null); + } + + // Load data set in to the file plan + dataSetService.loadDataSet(filePlan, dataSetId); + + model.put("success", true); + model.put("message", "Successfully imported data set."); + } + catch (Exception ex) + { + model.put("success", false); + model.put("message", ex.getMessage()); + logger.error("Error while importing data set: " + ex); + } + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java index 0c2a97f847..8fe930f6ac 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetsGet.java @@ -1,131 +1,131 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSet; -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteService; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -public class DataSetsGet extends DeclarativeWebScript -{ - - /** Constant for the site name parameter */ - private static final String ARG_SITE_NAME = "site"; - - /** Constant for the unloadedonly parameter */ - private static final String ARG_UNLOADED_ONLY = "unloadedonly"; - - /** Data set service */ - private DataSetService dataSetService; - - /** Site service */ - private SiteService siteService; - - /** - * Set data set service - * - * @param dataSetService the data set service - */ - public void setDataSetService(DataSetService dataSetService) - { - this.dataSetService = dataSetService; - } - - /** - * Set site service - * - * @param siteService the site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Get the site name from the URL and find out the file plan - String siteName = req.getParameter(ARG_SITE_NAME); - if (StringUtils.isBlank(siteName)) - { - siteName = RmSiteType.DEFAULT_SITE_NAME; - } - NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - - // Check if only unloaded data sets should be returned - default value is false - String unloadedOnlyParam = req.getParameter(ARG_UNLOADED_ONLY); - boolean unloadedOnly = false; - if (StringUtils.isNotBlank(unloadedOnlyParam)) - { - unloadedOnly = Boolean.valueOf(unloadedOnlyParam).booleanValue(); - } - - // Get the loaded/unloaded data sets depending on the "unloadedOnly" parameter - Map dataSets = dataSetService.getDataSets(filePlan, unloadedOnly); - List> dataSetList = new ArrayList>(dataSets.size()); - - for (Map.Entry entry : dataSets.entrySet()) - { - Map dataSet = new HashMap(3); - DataSet value = entry.getValue(); - - // Data set details - String dataSetId = value.getId(); - String isLoaded = String.valueOf(dataSetService.isLoadedDataSet(filePlan, dataSetId)); - - dataSet.put("label", value.getLabel()); - dataSet.put("id", dataSetId); - dataSet.put("isLoaded", isLoaded); - - // Add data set to the list - dataSetList.add(dataSet); - } - - Map model = new HashMap(1); - model.put("datasets", dataSetList); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.dataset.DataSet; +import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.site.SiteService; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +public class DataSetsGet extends DeclarativeWebScript +{ + + /** Constant for the site name parameter */ + private static final String ARG_SITE_NAME = "site"; + + /** Constant for the unloadedonly parameter */ + private static final String ARG_UNLOADED_ONLY = "unloadedonly"; + + /** Data set service */ + private DataSetService dataSetService; + + /** Site service */ + private SiteService siteService; + + /** + * Set data set service + * + * @param dataSetService the data set service + */ + public void setDataSetService(DataSetService dataSetService) + { + this.dataSetService = dataSetService; + } + + /** + * Set site service + * + * @param siteService the site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // Get the site name from the URL and find out the file plan + String siteName = req.getParameter(ARG_SITE_NAME); + if (StringUtils.isBlank(siteName)) + { + siteName = RmSiteType.DEFAULT_SITE_NAME; + } + NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); + + // Check if only unloaded data sets should be returned - default value is false + String unloadedOnlyParam = req.getParameter(ARG_UNLOADED_ONLY); + boolean unloadedOnly = false; + if (StringUtils.isNotBlank(unloadedOnlyParam)) + { + unloadedOnly = Boolean.valueOf(unloadedOnlyParam).booleanValue(); + } + + // Get the loaded/unloaded data sets depending on the "unloadedOnly" parameter + Map dataSets = dataSetService.getDataSets(filePlan, unloadedOnly); + List> dataSetList = new ArrayList>(dataSets.size()); + + for (Map.Entry entry : dataSets.entrySet()) + { + Map dataSet = new HashMap(3); + DataSet value = entry.getValue(); + + // Data set details + String dataSetId = value.getId(); + String isLoaded = String.valueOf(dataSetService.isLoadedDataSet(filePlan, dataSetId)); + + dataSet.put("label", value.getLabel()); + dataSet.put("id", dataSetId); + dataSet.put("isLoaded", isLoaded); + + // Add data set to the list + dataSetList.add(dataSet); + } + + Map model = new HashMap(1); + model.put("datasets", dataSetList); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java index 1ab54e8a84..f148aa7082 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java @@ -1,229 +1,229 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Abstract base class for all disposition related java backed webscripts. - * - * @author Gavin Cornwell - */ -public class DispositionAbstractBase extends AbstractRmWebScript -{ - /** - * Parses the request and providing it's valid returns the DispositionSchedule object. - * - * @param req The webscript request - * @return The DispositionSchedule object the request is aimed at - */ - protected DispositionSchedule parseRequestForSchedule(WebScriptRequest req) - { - // get the NodeRef from the request - NodeRef nodeRef = parseRequestForNodeRef(req); - - // Determine whether we are getting the inherited disposition schedule or not - boolean inherited = true; - String inheritedString = req.getParameter("inherited"); - if (inheritedString != null) - { - inherited = Boolean.parseBoolean(inheritedString); - } - - // make sure the node passed in has a disposition schedule attached - DispositionSchedule schedule = null; - if (inherited) - { - schedule = getDispositionService().getDispositionSchedule(nodeRef); - } - else - { - schedule = getDispositionService().getAssociatedDispositionSchedule(nodeRef); - } - if (schedule == null) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Node " + - nodeRef.toString() + " does not have a disposition schedule"); - } - - return schedule; - } - - /** - * Parses the request and providing it's valid returns the DispositionActionDefinition object. - * - * @param req The webscript request - * @param schedule The disposition schedule - * @return The DispositionActionDefinition object the request is aimed at - */ - protected DispositionActionDefinition parseRequestForActionDefinition(WebScriptRequest req, - DispositionSchedule schedule) - { - // make sure the requested action definition exists - Map templateVars = req.getServiceMatch().getTemplateVars(); - String actionDefId = templateVars.get("action_def_id"); - DispositionActionDefinition actionDef = schedule.getDispositionActionDefinition(actionDefId); - if (actionDef == null) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, - "Requested disposition action definition (id:" + actionDefId + ") does not exist"); - } - - return actionDef; - } - - /** - * Helper to create a model to represent the given disposition action definition. - * - * @param actionDef The DispositionActionDefinition instance to generate model for - * @param url The URL for the DispositionActionDefinition - * @return Map representing the model - */ - protected Map createActionDefModel(DispositionActionDefinition actionDef, - String url) - { - Map model = new HashMap(8); - - model.put("id", actionDef.getId()); - model.put("index", actionDef.getIndex()); - model.put("url", url); - model.put("name", actionDef.getName()); - model.put("label", actionDef.getLabel()); - model.put("eligibleOnFirstCompleteEvent", actionDef.eligibleOnFirstCompleteEvent()); - - if (actionDef.getDescription() != null) - { - model.put("description", actionDef.getDescription()); - } - - if (actionDef.getPeriod() != null) - { - model.put("period", actionDef.getPeriod().toString()); - } - - if (actionDef.getPeriodProperty() != null) - { - model.put("periodProperty", actionDef.getPeriodProperty().toPrefixString(getNamespaceService())); - } - - if (actionDef.getLocation() != null) - { - model.put("location", actionDef.getLocation()); - } - - if (actionDef.getGhostOnDestroy() != null) - { - model.put("ghostOnDestroy", actionDef.getGhostOnDestroy()); - } - - List events = actionDef.getEvents(); - if (events != null && events.size() > 0) - { - List eventNames = new ArrayList(events.size()); - for (RecordsManagementEvent event : events) - { - eventNames.add(event.getName()); - } - model.put("events", eventNames); - } - - return model; - } - - /** - * Helper method to parse the request and retrieve the disposition schedule model. - * - * @param req The webscript request - * @return Map representing the model - */ - protected Map getDispositionScheduleModel(WebScriptRequest req) - { - // parse the request to retrieve the schedule object - DispositionSchedule schedule = parseRequestForSchedule(req); - - // add all the schedule data to Map - Map scheduleModel = new HashMap(8); - - // build url - String serviceUrl = req.getServiceContextPath() + req.getPathInfo(); - scheduleModel.put("url", serviceUrl); - String actionsUrl = serviceUrl + "/dispositionactiondefinitions"; - scheduleModel.put("actionsUrl", actionsUrl); - scheduleModel.put("nodeRef", schedule.getNodeRef().toString()); - scheduleModel.put("recordLevelDisposition", schedule.isRecordLevelDisposition()); - scheduleModel.put("canStepsBeRemoved", - !getDispositionService().hasDisposableItems(schedule)); - - if (schedule.getDispositionAuthority() != null) - { - scheduleModel.put("authority", schedule.getDispositionAuthority()); - } - - if (schedule.getDispositionInstructions() != null) - { - scheduleModel.put("instructions", schedule.getDispositionInstructions()); - } - - boolean unpublishedUpdates = false; - boolean publishInProgress = false; - - List> actions = new ArrayList>(); - for (DispositionActionDefinition actionDef : schedule.getDispositionActionDefinitions()) - { - NodeRef actionDefNodeRef = actionDef.getNodeRef(); - if (getNodeService().hasAspect(actionDefNodeRef, RecordsManagementModel.ASPECT_UNPUBLISHED_UPDATE)) - { - unpublishedUpdates = true; - publishInProgress = ((Boolean) getNodeService().getProperty(actionDefNodeRef, RecordsManagementModel.PROP_PUBLISH_IN_PROGRESS)).booleanValue(); - } - - actions.add(createActionDefModel(actionDef, actionsUrl + "/" + actionDef.getId())); - } - scheduleModel.put("actions", actions); - scheduleModel.put("unpublishedUpdates", unpublishedUpdates); - scheduleModel.put("publishInProgress", publishInProgress); - - // create model object with just the schedule data - Map model = new HashMap(1); - model.put("schedule", scheduleModel); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Abstract base class for all disposition related java backed webscripts. + * + * @author Gavin Cornwell + */ +public class DispositionAbstractBase extends AbstractRmWebScript +{ + /** + * Parses the request and providing it's valid returns the DispositionSchedule object. + * + * @param req The webscript request + * @return The DispositionSchedule object the request is aimed at + */ + protected DispositionSchedule parseRequestForSchedule(WebScriptRequest req) + { + // get the NodeRef from the request + NodeRef nodeRef = parseRequestForNodeRef(req); + + // Determine whether we are getting the inherited disposition schedule or not + boolean inherited = true; + String inheritedString = req.getParameter("inherited"); + if (inheritedString != null) + { + inherited = Boolean.parseBoolean(inheritedString); + } + + // make sure the node passed in has a disposition schedule attached + DispositionSchedule schedule = null; + if (inherited) + { + schedule = getDispositionService().getDispositionSchedule(nodeRef); + } + else + { + schedule = getDispositionService().getAssociatedDispositionSchedule(nodeRef); + } + if (schedule == null) + { + throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Node " + + nodeRef.toString() + " does not have a disposition schedule"); + } + + return schedule; + } + + /** + * Parses the request and providing it's valid returns the DispositionActionDefinition object. + * + * @param req The webscript request + * @param schedule The disposition schedule + * @return The DispositionActionDefinition object the request is aimed at + */ + protected DispositionActionDefinition parseRequestForActionDefinition(WebScriptRequest req, + DispositionSchedule schedule) + { + // make sure the requested action definition exists + Map templateVars = req.getServiceMatch().getTemplateVars(); + String actionDefId = templateVars.get("action_def_id"); + DispositionActionDefinition actionDef = schedule.getDispositionActionDefinition(actionDefId); + if (actionDef == null) + { + throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, + "Requested disposition action definition (id:" + actionDefId + ") does not exist"); + } + + return actionDef; + } + + /** + * Helper to create a model to represent the given disposition action definition. + * + * @param actionDef The DispositionActionDefinition instance to generate model for + * @param url The URL for the DispositionActionDefinition + * @return Map representing the model + */ + protected Map createActionDefModel(DispositionActionDefinition actionDef, + String url) + { + Map model = new HashMap(8); + + model.put("id", actionDef.getId()); + model.put("index", actionDef.getIndex()); + model.put("url", url); + model.put("name", actionDef.getName()); + model.put("label", actionDef.getLabel()); + model.put("eligibleOnFirstCompleteEvent", actionDef.eligibleOnFirstCompleteEvent()); + + if (actionDef.getDescription() != null) + { + model.put("description", actionDef.getDescription()); + } + + if (actionDef.getPeriod() != null) + { + model.put("period", actionDef.getPeriod().toString()); + } + + if (actionDef.getPeriodProperty() != null) + { + model.put("periodProperty", actionDef.getPeriodProperty().toPrefixString(getNamespaceService())); + } + + if (actionDef.getLocation() != null) + { + model.put("location", actionDef.getLocation()); + } + + if (actionDef.getGhostOnDestroy() != null) + { + model.put("ghostOnDestroy", actionDef.getGhostOnDestroy()); + } + + List events = actionDef.getEvents(); + if (events != null && events.size() > 0) + { + List eventNames = new ArrayList(events.size()); + for (RecordsManagementEvent event : events) + { + eventNames.add(event.getName()); + } + model.put("events", eventNames); + } + + return model; + } + + /** + * Helper method to parse the request and retrieve the disposition schedule model. + * + * @param req The webscript request + * @return Map representing the model + */ + protected Map getDispositionScheduleModel(WebScriptRequest req) + { + // parse the request to retrieve the schedule object + DispositionSchedule schedule = parseRequestForSchedule(req); + + // add all the schedule data to Map + Map scheduleModel = new HashMap(8); + + // build url + String serviceUrl = req.getServiceContextPath() + req.getPathInfo(); + scheduleModel.put("url", serviceUrl); + String actionsUrl = serviceUrl + "/dispositionactiondefinitions"; + scheduleModel.put("actionsUrl", actionsUrl); + scheduleModel.put("nodeRef", schedule.getNodeRef().toString()); + scheduleModel.put("recordLevelDisposition", schedule.isRecordLevelDisposition()); + scheduleModel.put("canStepsBeRemoved", + !getDispositionService().hasDisposableItems(schedule)); + + if (schedule.getDispositionAuthority() != null) + { + scheduleModel.put("authority", schedule.getDispositionAuthority()); + } + + if (schedule.getDispositionInstructions() != null) + { + scheduleModel.put("instructions", schedule.getDispositionInstructions()); + } + + boolean unpublishedUpdates = false; + boolean publishInProgress = false; + + List> actions = new ArrayList>(); + for (DispositionActionDefinition actionDef : schedule.getDispositionActionDefinitions()) + { + NodeRef actionDefNodeRef = actionDef.getNodeRef(); + if (getNodeService().hasAspect(actionDefNodeRef, RecordsManagementModel.ASPECT_UNPUBLISHED_UPDATE)) + { + unpublishedUpdates = true; + publishInProgress = ((Boolean) getNodeService().getProperty(actionDefNodeRef, RecordsManagementModel.PROP_PUBLISH_IN_PROGRESS)).booleanValue(); + } + + actions.add(createActionDefModel(actionDef, actionsUrl + "/" + actionDef.getId())); + } + scheduleModel.put("actions", actions); + scheduleModel.put("unpublishedUpdates", unpublishedUpdates); + scheduleModel.put("publishInProgress", publishInProgress); + + // create model object with just the schedule data + Map model = new HashMap(1); + model.put("schedule", scheduleModel); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java index 2b4584c2a7..e712023635 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java @@ -1,83 +1,83 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to delete a dispostion action definition. - * - * @author Gavin Cornwell - */ -public class DispositionActionDefinitionDelete extends DispositionAbstractBase -{ - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // parse the request to retrieve the schedule object - DispositionSchedule schedule = parseRequestForSchedule(req); - - // parse the request to retrieve the action definition object - DispositionActionDefinition actionDef = parseRequestForActionDefinition(req, schedule); - - // remove the action definition from the schedule - removeDispositionActionDefinitions(schedule, actionDef); - - // return the disposition schedule model - return getDispositionScheduleModel(req); - } - - /** - * Helper method to remove a disposition action definition and the following definition(s) - * - * @param schedule The disposition schedule - * @param actionDef The disposition action definition - */ - private void removeDispositionActionDefinitions(DispositionSchedule schedule, DispositionActionDefinition actionDef) - { - int index = actionDef.getIndex(); - List dispositionActionDefinitions = schedule.getDispositionActionDefinitions(); - for (DispositionActionDefinition dispositionActionDefinition : dispositionActionDefinitions) - { - if (dispositionActionDefinition.getIndex() >= index) - { - getDispositionService().removeDispositionActionDefinition(schedule, dispositionActionDefinition); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to delete a dispostion action definition. + * + * @author Gavin Cornwell + */ +public class DispositionActionDefinitionDelete extends DispositionAbstractBase +{ + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // parse the request to retrieve the schedule object + DispositionSchedule schedule = parseRequestForSchedule(req); + + // parse the request to retrieve the action definition object + DispositionActionDefinition actionDef = parseRequestForActionDefinition(req, schedule); + + // remove the action definition from the schedule + removeDispositionActionDefinitions(schedule, actionDef); + + // return the disposition schedule model + return getDispositionScheduleModel(req); + } + + /** + * Helper method to remove a disposition action definition and the following definition(s) + * + * @param schedule The disposition schedule + * @param actionDef The disposition action definition + */ + private void removeDispositionActionDefinitions(DispositionSchedule schedule, DispositionActionDefinition actionDef) + { + int index = actionDef.getIndex(); + List dispositionActionDefinitions = schedule.getDispositionActionDefinitions(); + for (DispositionActionDefinition dispositionActionDefinition : dispositionActionDefinitions) + { + if (dispositionActionDefinition.getIndex() >= index) + { + getDispositionService().removeDispositionActionDefinition(schedule, dispositionActionDefinition); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java index 4f10697acf..6cbf9358d4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java @@ -1,168 +1,168 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.namespace.QName; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to create a new dispositon action definition. - * - * @author Gavin Cornwell - */ -public class DispositionActionDefinitionPost extends DispositionAbstractBase -{ - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // parse the request to retrieve the schedule object - DispositionSchedule schedule = parseRequestForSchedule(req); - - // retrieve the rest of the post body and create the action - // definition - JSONObject json = null; - DispositionActionDefinition actionDef = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - actionDef = createActionDefinition(json, schedule); - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - // create model object with just the action data - Map model = new HashMap(1); - model.put("action", createActionDefModel(actionDef, req.getURL() + "/" + actionDef.getId())); - return model; - } - - /** - * Creates a dispositionActionDefinition node in the repo. - * - * @param json The JSON to use to create the action definition - * @param schedule The DispositionSchedule the action is for - * @return The DispositionActionDefinition representing the new action definition - */ - protected DispositionActionDefinition createActionDefinition(JSONObject json, - DispositionSchedule schedule) throws JSONException - { - // extract the data from the JSON request - if (!json.has("name")) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'name' parameter was not provided in request body"); - } - - // create the properties for the action definition - Map props = new HashMap(8); - String name = json.getString("name"); - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME, name); - - if (json.has("description")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_DESCRIPTION, json.getString("description")); - } - - if (json.has("period")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD, json.getString("period")); - } - - if (json.has("periodProperty")) - { - QName periodProperty = QName.createQName(json.getString("periodProperty"), getNamespaceService()); - props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY, periodProperty); - } - - if (json.has("eligibleOnFirstCompleteEvent")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION, - json.getBoolean("eligibleOnFirstCompleteEvent") ? "or" : "and"); - } - - if (json.has("location")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_LOCATION, - json.getString("location")); - } - - if (json.has("events")) - { - JSONArray events = json.getJSONArray("events"); - List eventsList = new ArrayList(events.length()); - for (int x = 0; x < events.length(); x++) - { - eventsList.add(events.getString(x)); - } - props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT, (Serializable)eventsList); - } - - if (json.has("name") && "destroy".equals(json.getString("name"))) - { - if (json.has("ghostOnDestroy")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "ghost"); - } - else - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "delete"); - } - } - - // add the action definition to the schedule - return getDispositionService().addDispositionActionDefinition(schedule, props); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.namespace.QName; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to create a new dispositon action definition. + * + * @author Gavin Cornwell + */ +public class DispositionActionDefinitionPost extends DispositionAbstractBase +{ + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // parse the request to retrieve the schedule object + DispositionSchedule schedule = parseRequestForSchedule(req); + + // retrieve the rest of the post body and create the action + // definition + JSONObject json = null; + DispositionActionDefinition actionDef = null; + try + { + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + actionDef = createActionDefinition(json, schedule); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + // create model object with just the action data + Map model = new HashMap(1); + model.put("action", createActionDefModel(actionDef, req.getURL() + "/" + actionDef.getId())); + return model; + } + + /** + * Creates a dispositionActionDefinition node in the repo. + * + * @param json The JSON to use to create the action definition + * @param schedule The DispositionSchedule the action is for + * @return The DispositionActionDefinition representing the new action definition + */ + protected DispositionActionDefinition createActionDefinition(JSONObject json, + DispositionSchedule schedule) throws JSONException + { + // extract the data from the JSON request + if (!json.has("name")) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory 'name' parameter was not provided in request body"); + } + + // create the properties for the action definition + Map props = new HashMap(8); + String name = json.getString("name"); + props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME, name); + + if (json.has("description")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_DESCRIPTION, json.getString("description")); + } + + if (json.has("period")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD, json.getString("period")); + } + + if (json.has("periodProperty")) + { + QName periodProperty = QName.createQName(json.getString("periodProperty"), getNamespaceService()); + props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY, periodProperty); + } + + if (json.has("eligibleOnFirstCompleteEvent")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION, + json.getBoolean("eligibleOnFirstCompleteEvent") ? "or" : "and"); + } + + if (json.has("location")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_LOCATION, + json.getString("location")); + } + + if (json.has("events")) + { + JSONArray events = json.getJSONArray("events"); + List eventsList = new ArrayList(events.length()); + for (int x = 0; x < events.length(); x++) + { + eventsList.add(events.getString(x)); + } + props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT, (Serializable)eventsList); + } + + if (json.has("name") && "destroy".equals(json.getString("name"))) + { + if (json.has("ghostOnDestroy")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "ghost"); + } + else + { + props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "delete"); + } + } + + // add the action definition to the schedule + return getDispositionService().addDispositionActionDefinition(schedule, props); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java index a676e8cf45..e22481c4bd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java @@ -1,167 +1,167 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.namespace.QName; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to update an existing dispositon - * action definition. - * - * @author Gavin Cornwell - */ -public class DispositionActionDefinitionPut extends DispositionAbstractBase -{ - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // parse the request to retrieve the schedule object - DispositionSchedule schedule = parseRequestForSchedule(req); - - // parse the request to retrieve the action definition object - DispositionActionDefinition actionDef = parseRequestForActionDefinition(req, schedule); - - // retrieve the rest of the post body and update the action definition - JSONObject json = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - actionDef = updateActionDefinition(actionDef, json); - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - // create model object with just the action data - Map model = new HashMap(1); - model.put("action", createActionDefModel(actionDef, req.getURL())); - return model; - } - - /** - * Updates a dispositionActionDefinition node in the repo. - * - * @param actionDef The action definition to update - * @param json The JSON to use to create the action definition - * @param schedule The DispositionSchedule the action definition belongs to - * @return The updated DispositionActionDefinition - */ - protected DispositionActionDefinition updateActionDefinition(DispositionActionDefinition actionDef, - JSONObject json) throws JSONException - { - // create the properties for the action definition - Map props = new HashMap(8); - - if (json.has("name")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME, json.getString("name")); - } - - if (json.has("description")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_DESCRIPTION, json.getString("description")); - } - - if (json.has("period")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD, json.getString("period")); - } - - if (json.has("periodProperty")) - { - QName periodProperty = QName.createQName(json.getString("periodProperty"), getNamespaceService()); - props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY, periodProperty); - } - - if (json.has("eligibleOnFirstCompleteEvent")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION, - json.getBoolean("eligibleOnFirstCompleteEvent") ? "or" : "and"); - } - - if (json.has("location")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_LOCATION, - json.getString("location")); - } - - if (json.has("events")) - { - JSONArray events = json.getJSONArray("events"); - List eventsList = new ArrayList(events.length()); - for (int x = 0; x < events.length(); x++) - { - eventsList.add(events.getString(x)); - } - props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT, (Serializable)eventsList); - } - - if (json.has("name") && "destroy".equals(json.getString("name"))) - { - if (json.has("ghostOnDestroy")) - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "ghost"); - } - else - { - props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "delete"); - } - } - - // update the action definition - return getDispositionService().updateDispositionActionDefinition(actionDef, props); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.namespace.QName; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to update an existing dispositon + * action definition. + * + * @author Gavin Cornwell + */ +public class DispositionActionDefinitionPut extends DispositionAbstractBase +{ + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // parse the request to retrieve the schedule object + DispositionSchedule schedule = parseRequestForSchedule(req); + + // parse the request to retrieve the action definition object + DispositionActionDefinition actionDef = parseRequestForActionDefinition(req, schedule); + + // retrieve the rest of the post body and update the action definition + JSONObject json = null; + try + { + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + actionDef = updateActionDefinition(actionDef, json); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + // create model object with just the action data + Map model = new HashMap(1); + model.put("action", createActionDefModel(actionDef, req.getURL())); + return model; + } + + /** + * Updates a dispositionActionDefinition node in the repo. + * + * @param actionDef The action definition to update + * @param json The JSON to use to create the action definition + * @param schedule The DispositionSchedule the action definition belongs to + * @return The updated DispositionActionDefinition + */ + protected DispositionActionDefinition updateActionDefinition(DispositionActionDefinition actionDef, + JSONObject json) throws JSONException + { + // create the properties for the action definition + Map props = new HashMap(8); + + if (json.has("name")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME, json.getString("name")); + } + + if (json.has("description")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_DESCRIPTION, json.getString("description")); + } + + if (json.has("period")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD, json.getString("period")); + } + + if (json.has("periodProperty")) + { + QName periodProperty = QName.createQName(json.getString("periodProperty"), getNamespaceService()); + props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY, periodProperty); + } + + if (json.has("eligibleOnFirstCompleteEvent")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT_COMBINATION, + json.getBoolean("eligibleOnFirstCompleteEvent") ? "or" : "and"); + } + + if (json.has("location")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_LOCATION, + json.getString("location")); + } + + if (json.has("events")) + { + JSONArray events = json.getJSONArray("events"); + List eventsList = new ArrayList(events.length()); + for (int x = 0; x < events.length(); x++) + { + eventsList.add(events.getString(x)); + } + props.put(RecordsManagementModel.PROP_DISPOSITION_EVENT, (Serializable)eventsList); + } + + if (json.has("name") && "destroy".equals(json.getString("name"))) + { + if (json.has("ghostOnDestroy")) + { + props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "ghost"); + } + else + { + props.put(RecordsManagementModel.PROP_DISPOSITION_ACTION_GHOST_ON_DESTROY, "delete"); + } + } + + // update the action definition + return getDispositionService().updateDispositionActionDefinition(actionDef, props); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java index 57e22e413a..61df7504a1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java @@ -1,193 +1,193 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.PersonService; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return full details - * about a disposition lifecycle (next disposition action). - * - * @author Gavin Cornwell - */ -public class DispositionLifecycleGet extends DispositionAbstractBase -{ - PersonService personService; - - /** - * Sets the PersonService instance - * - * @param personService The PersonService instance - */ - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // parse the request to retrieve the next action - NodeRef nodeRef = parseRequestForNodeRef(req); - - // make sure the node passed in has a next action attached - DispositionAction nextAction = getDispositionService().getNextDispositionAction(nodeRef); - if (nextAction == null) - { - Map nextActionModel = new HashMap(2); - nextActionModel.put("notFound", true); - nextActionModel.put("message", "Node " + nodeRef.toString() + " does not have a disposition lifecycle"); - Map model = new HashMap(1); - model.put("nextaction", nextActionModel); - return model; - } - else - { - // add all the next action data to Map - Map nextActionModel = new HashMap(8); - String serviceUrl = req.getServiceContextPath() + req.getPathInfo(); - nextActionModel.put("url", serviceUrl); - nextActionModel.put("name", nextAction.getName()); - nextActionModel.put("label", nextAction.getLabel()); - nextActionModel.put("eventsEligible", getDispositionService().isNextDispositionActionEligible(nodeRef)); - - if (nextAction.getAsOfDate() != null) - { - nextActionModel.put("asOf", ISO8601DateFormat.format(nextAction.getAsOfDate())); - } - - if (nextAction.getStartedAt() != null) - { - nextActionModel.put("startedAt", ISO8601DateFormat.format(nextAction.getStartedAt())); - } - - String startedBy = nextAction.getStartedBy(); - if (startedBy != null) - { - nextActionModel.put("startedBy", startedBy); - addUsersRealName(nextActionModel, startedBy, "startedBy"); - } - - if (nextAction.getCompletedAt() != null) - { - nextActionModel.put("completedAt", ISO8601DateFormat.format(nextAction.getCompletedAt())); - } - - String completedBy = nextAction.getCompletedBy(); - if (completedBy != null) - { - nextActionModel.put("completedBy", completedBy); - addUsersRealName(nextActionModel, completedBy, "completedBy"); - } - - List> events = new ArrayList>(); - for (EventCompletionDetails event : nextAction.getEventCompletionDetails()) - { - events.add(createEventModel(event)); - } - nextActionModel.put("events", events); - - // create model object with just the schedule data - Map model = new HashMap(1); - model.put("nextaction", nextActionModel); - return model; - } - } - - /** - * Helper to create a model to represent the given event execution. - * - * @param event The event to create a model for - * @return Map representing the model - */ - protected Map createEventModel(EventCompletionDetails event) - { - Map model = new HashMap(8); - - model.put("name", event.getEventName()); - model.put("label", event.getEventLabel()); - model.put("automatic", event.isEventExecutionAutomatic()); - model.put("complete", event.isEventComplete()); - - String completedBy = event.getEventCompletedBy(); - if (completedBy != null) - { - model.put("completedBy", completedBy); - addUsersRealName(model, completedBy, "completedBy"); - } - - if (event.getEventCompletedAt() != null) - { - model.put("completedAt", ISO8601DateFormat.format(event.getEventCompletedAt())); - } - - return model; - } - - /** - * Adds the given username's first and last name to the given model. - * - * @param model The model to add the first and last name to - * @param userName The username of the user to lookup - * @param propertyPrefix The prefix of the property name to use when adding to the model - */ - protected void addUsersRealName(Map model, String userName, String propertyPrefix) - { - NodeRef user = this.personService.getPerson(userName); - if (user != null) - { - String firstName = (String) getNodeService().getProperty(user, ContentModel.PROP_FIRSTNAME); - if (firstName != null) - { - model.put(propertyPrefix + "FirstName", firstName); - } - - String lastName = (String) getNodeService().getProperty(user, ContentModel.PROP_LASTNAME); - if (lastName != null) - { - model.put(propertyPrefix + "LastName", lastName); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.PersonService; +import org.springframework.extensions.surf.util.ISO8601DateFormat; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return full details + * about a disposition lifecycle (next disposition action). + * + * @author Gavin Cornwell + */ +public class DispositionLifecycleGet extends DispositionAbstractBase +{ + PersonService personService; + + /** + * Sets the PersonService instance + * + * @param personService The PersonService instance + */ + public void setPersonService(PersonService personService) + { + this.personService = personService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // parse the request to retrieve the next action + NodeRef nodeRef = parseRequestForNodeRef(req); + + // make sure the node passed in has a next action attached + DispositionAction nextAction = getDispositionService().getNextDispositionAction(nodeRef); + if (nextAction == null) + { + Map nextActionModel = new HashMap(2); + nextActionModel.put("notFound", true); + nextActionModel.put("message", "Node " + nodeRef.toString() + " does not have a disposition lifecycle"); + Map model = new HashMap(1); + model.put("nextaction", nextActionModel); + return model; + } + else + { + // add all the next action data to Map + Map nextActionModel = new HashMap(8); + String serviceUrl = req.getServiceContextPath() + req.getPathInfo(); + nextActionModel.put("url", serviceUrl); + nextActionModel.put("name", nextAction.getName()); + nextActionModel.put("label", nextAction.getLabel()); + nextActionModel.put("eventsEligible", getDispositionService().isNextDispositionActionEligible(nodeRef)); + + if (nextAction.getAsOfDate() != null) + { + nextActionModel.put("asOf", ISO8601DateFormat.format(nextAction.getAsOfDate())); + } + + if (nextAction.getStartedAt() != null) + { + nextActionModel.put("startedAt", ISO8601DateFormat.format(nextAction.getStartedAt())); + } + + String startedBy = nextAction.getStartedBy(); + if (startedBy != null) + { + nextActionModel.put("startedBy", startedBy); + addUsersRealName(nextActionModel, startedBy, "startedBy"); + } + + if (nextAction.getCompletedAt() != null) + { + nextActionModel.put("completedAt", ISO8601DateFormat.format(nextAction.getCompletedAt())); + } + + String completedBy = nextAction.getCompletedBy(); + if (completedBy != null) + { + nextActionModel.put("completedBy", completedBy); + addUsersRealName(nextActionModel, completedBy, "completedBy"); + } + + List> events = new ArrayList>(); + for (EventCompletionDetails event : nextAction.getEventCompletionDetails()) + { + events.add(createEventModel(event)); + } + nextActionModel.put("events", events); + + // create model object with just the schedule data + Map model = new HashMap(1); + model.put("nextaction", nextActionModel); + return model; + } + } + + /** + * Helper to create a model to represent the given event execution. + * + * @param event The event to create a model for + * @return Map representing the model + */ + protected Map createEventModel(EventCompletionDetails event) + { + Map model = new HashMap(8); + + model.put("name", event.getEventName()); + model.put("label", event.getEventLabel()); + model.put("automatic", event.isEventExecutionAutomatic()); + model.put("complete", event.isEventComplete()); + + String completedBy = event.getEventCompletedBy(); + if (completedBy != null) + { + model.put("completedBy", completedBy); + addUsersRealName(model, completedBy, "completedBy"); + } + + if (event.getEventCompletedAt() != null) + { + model.put("completedAt", ISO8601DateFormat.format(event.getEventCompletedAt())); + } + + return model; + } + + /** + * Adds the given username's first and last name to the given model. + * + * @param model The model to add the first and last name to + * @param userName The username of the user to lookup + * @param propertyPrefix The prefix of the property name to use when adding to the model + */ + protected void addUsersRealName(Map model, String userName, String propertyPrefix) + { + NodeRef user = this.personService.getPerson(userName); + if (user != null) + { + String firstName = (String) getNodeService().getProperty(user, ContentModel.PROP_FIRSTNAME); + if (firstName != null) + { + model.put(propertyPrefix + "FirstName", firstName); + } + + String lastName = (String) getNodeService().getProperty(user, ContentModel.PROP_LASTNAME); + if (lastName != null) + { + model.put(propertyPrefix + "LastName", lastName); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java index b1e13b2980..a4ea607ef0 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionPropertiesGet.java @@ -1,127 +1,127 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.util.StringUtils; - -/** - * @author Roy Wetherall - */ -public class DispositionPropertiesGet extends DeclarativeWebScript -{ - protected DispositionService dispositionService; - protected NamespaceService namespaceService; - protected DictionaryService dictionaryService; - - /** - * Sets the disposition service - * - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Sets the NamespaceService instance - * - * @param namespaceService The NamespaceService instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Sets the DictionaryService instance - * - * @param dictionaryService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - boolean recordLevel = false; - String recordLevelValue = req.getParameter("recordlevel"); - if (recordLevelValue != null) - { - recordLevel = Boolean.valueOf(recordLevelValue); - } - String dispositionAction = req.getParameter("dispositionaction"); - - Collection dispositionProperties = dispositionService.getDispositionProperties(recordLevel, dispositionAction); - List> items = new ArrayList>(dispositionProperties.size()); - for (DispositionProperty dispositionProperty : dispositionProperties) - { - PropertyDefinition propDef = dispositionProperty.getPropertyDefinition(); - QName propName = dispositionProperty.getQName(); - - if (propDef != null) - { - Map item = new HashMap(2); - String propTitle = propDef.getTitle(dictionaryService); - if (propTitle == null || propTitle.length() == 0) - { - propTitle = StringUtils.capitalize(propName.getLocalName()); - } - item.put("label", propTitle); - item.put("value", propName.toPrefixString(this.namespaceService)); - items.add(item); - } - } - - // create model object with the lists model - Map model = new HashMap(1); - model.put("properties", items); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.util.StringUtils; + +/** + * @author Roy Wetherall + */ +public class DispositionPropertiesGet extends DeclarativeWebScript +{ + protected DispositionService dispositionService; + protected NamespaceService namespaceService; + protected DictionaryService dictionaryService; + + /** + * Sets the disposition service + * + * @param dispositionService the disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Sets the NamespaceService instance + * + * @param namespaceService The NamespaceService instance + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * Sets the DictionaryService instance + * + * @param dictionaryService The DictionaryService instance + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + boolean recordLevel = false; + String recordLevelValue = req.getParameter("recordlevel"); + if (recordLevelValue != null) + { + recordLevel = Boolean.valueOf(recordLevelValue); + } + String dispositionAction = req.getParameter("dispositionaction"); + + Collection dispositionProperties = dispositionService.getDispositionProperties(recordLevel, dispositionAction); + List> items = new ArrayList>(dispositionProperties.size()); + for (DispositionProperty dispositionProperty : dispositionProperties) + { + PropertyDefinition propDef = dispositionProperty.getPropertyDefinition(); + QName propName = dispositionProperty.getQName(); + + if (propDef != null) + { + Map item = new HashMap(2); + String propTitle = propDef.getTitle(dictionaryService); + if (propTitle == null || propTitle.length() == 0) + { + propTitle = StringUtils.capitalize(propName.getLocalName()); + } + item.put("label", propTitle); + item.put("value", propName.toPrefixString(this.namespaceService)); + items.add(item); + } + } + + // create model object with the lists model + Map model = new HashMap(1); + model.put("properties", items); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionScheduleGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionScheduleGet.java index 0ab4a0e716..f0372c2bad 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionScheduleGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionScheduleGet.java @@ -1,53 +1,53 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.Map; - -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return full details - * about a disposition schedule. - * - * @author Gavin Cornwell - */ -public class DispositionScheduleGet extends DispositionAbstractBase -{ - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // return the disposition schedule model - return getDispositionScheduleModel(req); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.Map; + +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return full details + * about a disposition schedule. + * + * @author Gavin Cornwell + */ +public class DispositionScheduleGet extends DispositionAbstractBase +{ + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // return the disposition schedule model + return getDispositionScheduleModel(req); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DodCustomTypesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DodCustomTypesGet.java index 020d8bbd3a..aa6ae83c42 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DodCustomTypesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/DodCustomTypesGet.java @@ -1,78 +1,78 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This class provides the implementation for the dodcustomtypes.get webscript. - * - * @author Neil McErlean - */ -public class DodCustomTypesGet extends DeclarativeWebScript -{ - // TODO Investigate a way of not hard-coding the 4 custom types here. - private static final List CUSTOM_TYPE_ASPECTS = Arrays.asList(new QName[]{DOD5015Model.ASPECT_SCANNED_RECORD, - DOD5015Model.ASPECT_PDF_RECORD, DOD5015Model.ASPECT_DIGITAL_PHOTOGRAPH_RECORD, DOD5015Model.ASPECT_WEB_RECORD}); - - private DictionaryService dictionaryService; - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - List customTypeAspectDefinitions = new ArrayList(4); - for (QName aspectQName : CUSTOM_TYPE_ASPECTS) - { - AspectDefinition nextAspectDef = dictionaryService.getAspect(aspectQName); - customTypeAspectDefinitions.add(nextAspectDef); - } - model.put("dodCustomTypes", customTypeAspectDefinitions); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * This class provides the implementation for the dodcustomtypes.get webscript. + * + * @author Neil McErlean + */ +public class DodCustomTypesGet extends DeclarativeWebScript +{ + // TODO Investigate a way of not hard-coding the 4 custom types here. + private static final List CUSTOM_TYPE_ASPECTS = Arrays.asList(new QName[]{DOD5015Model.ASPECT_SCANNED_RECORD, + DOD5015Model.ASPECT_PDF_RECORD, DOD5015Model.ASPECT_DIGITAL_PHOTOGRAPH_RECORD, DOD5015Model.ASPECT_WEB_RECORD}); + + private DictionaryService dictionaryService; + + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + List customTypeAspectDefinitions = new ArrayList(4); + for (QName aspectQName : CUSTOM_TYPE_ASPECTS) + { + AspectDefinition nextAspectDef = dictionaryService.getAspect(aspectQName); + customTypeAspectDefinitions.add(nextAspectDef); + } + model.put("dodCustomTypes", customTypeAspectDefinitions); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java index f0311b8356..cbf94e786b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapDelete.java @@ -1,87 +1,87 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return - * custom email field mappings - */ -public class EmailMapDelete extends DeclarativeWebScript -{ - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - try - { - // Get the data from the request - JSONObject json = new JSONObject(req.getServiceMatch().getTemplateVars()); - - // Delete custom mapping - customEmailMappingService.deleteCustomMapping(json.getString("from"), json.getString("to")); - - // Create model object with the lists of custom mappings - Map model = new HashMap(1); - model.put("emailmap", customEmailMappingService.getCustomMappings()); - - return model; - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return + * custom email field mappings + */ +public class EmailMapDelete extends DeclarativeWebScript +{ + /** Custom email mapping service */ + private CustomEmailMappingService customEmailMappingService; + + /** + * Custom email mapping service + * + * @param customEmailMappingService the custom email mapping service + */ + public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) + { + this.customEmailMappingService = customEmailMappingService; + } + + /** + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + try + { + // Get the data from the request + JSONObject json = new JSONObject(req.getServiceMatch().getTemplateVars()); + + // Delete custom mapping + customEmailMappingService.deleteCustomMapping(json.getString("from"), json.getString("to")); + + // Create model object with the lists of custom mappings + Map model = new HashMap(1); + model.put("emailmap", customEmailMappingService.getCustomMappings()); + + return model; + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java index 86b0087295..040a5ef991 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapGet.java @@ -1,69 +1,69 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return - * custom email field mappings - */ -public class EmailMapGet extends DeclarativeWebScript -{ - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Create model object with the lists of custom mappings - Map model = new HashMap(1); - model.put("emailmap", customEmailMappingService.getCustomMappings()); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return + * custom email field mappings + */ +public class EmailMapGet extends DeclarativeWebScript +{ + /** Custom email mapping service */ + private CustomEmailMappingService customEmailMappingService; + + /** + * Custom email mapping service + * + * @param customEmailMappingService the custom email mapping service + */ + public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) + { + this.customEmailMappingService = customEmailMappingService; + } + + /** + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // Create model object with the lists of custom mappings + Map model = new HashMap(1); + model.put("emailmap", customEmailMappingService.getCustomMappings()); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java index 8cc2550aae..e4ed734069 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapKeysGet.java @@ -1,68 +1,68 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return email mapping keys - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class EmailMapKeysGet extends DeclarativeWebScript -{ - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Create model object with the lists of email mapping keys - Map model = new HashMap(1); - model.put("emailmapkeys", customEmailMappingService.getEmailMappingKeys()); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return email mapping keys + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class EmailMapKeysGet extends DeclarativeWebScript +{ + /** Custom email mapping service */ + private CustomEmailMappingService customEmailMappingService; + + /** + * Custom email mapping service + * + * @param customEmailMappingService the custom email mapping service + */ + public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) + { + this.customEmailMappingService = customEmailMappingService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // Create model object with the lists of email mapping keys + Map model = new HashMap(1); + model.put("emailmapkeys", customEmailMappingService.getEmailMappingKeys()); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java index d03085f606..14414c0ee6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/EmailMapPost.java @@ -1,100 +1,100 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return - * custom email field mappings - */ -public class EmailMapPost extends DeclarativeWebScript -{ - /** Custom email mapping service */ - private CustomEmailMappingService customEmailMappingService; - - /** - * Custom email mapping service - * - * @param customEmailMappingService the custom email mapping service - */ - public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) - { - this.customEmailMappingService = customEmailMappingService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - try - { - // Get the data from the content - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // Add custom mapping - customEmailMappingService.addCustomMapping(json.getString("from"), json.getString("to")); - - // Add the lists of custom mappings to the model - model.put("emailmap", customEmailMappingService.getCustomMappings()); - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - catch (AlfrescoRuntimeException are) - { - throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, - are.getMessage(), are); - } - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return + * custom email field mappings + */ +public class EmailMapPost extends DeclarativeWebScript +{ + /** Custom email mapping service */ + private CustomEmailMappingService customEmailMappingService; + + /** + * Custom email mapping service + * + * @param customEmailMappingService the custom email mapping service + */ + public void setCustomEmailMappingService(CustomEmailMappingService customEmailMappingService) + { + this.customEmailMappingService = customEmailMappingService; + } + + /** + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1); + try + { + // Get the data from the content + JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); + + // Add custom mapping + customEmailMappingService.addCustomMapping(json.getString("from"), json.getString("to")); + + // Add the lists of custom mappings to the model + model.put("emailmap", customEmailMappingService.getCustomMappings()); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + catch (AlfrescoRuntimeException are) + { + throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, + are.getMessage(), are); + } + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java index cfe95bd375..3b40a8c81d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ExportPost.java @@ -1,185 +1,185 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.RenditionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.repo.exporter.ACPExportPackageHandler; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.repo.web.scripts.content.StreamACP; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.view.ExporterCrawlerParameters; -import org.alfresco.service.cmr.view.Location; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Creates an RM specific ACP file of nodes to export then streams it back - * to the client. - * - * @author Gavin Cornwell - */ -public class ExportPost extends StreamACP -{ - /** Logger */ - private static Log logger = LogFactory.getLog(ExportPost.class); - - protected static final String PARAM_TRANSFER_FORMAT = "transferFormat"; - - /** Content Streamer */ - private ContentStreamer contentStreamer; - - /** - * @param contentStreamer - */ - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - /** - * @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) - */ - @SuppressWarnings("deprecation") - @Override - public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException - { - File tempACPFile = null; - try - { - NodeRef[] nodeRefs = null; - boolean transferFormat = false; - String contentType = req.getContentType(); - if (MULTIPART_FORMDATA.equals(contentType)) - { - // get nodeRefs parameter from form - nodeRefs = getNodeRefs(req.getParameter(PARAM_NODE_REFS)); - - // look for the transfer format - String transferFormatParam = req.getParameter(PARAM_TRANSFER_FORMAT); - if (transferFormatParam != null && transferFormatParam.length() > 0) - { - transferFormat = Boolean.parseBoolean(transferFormatParam); - } - } - else - { - // presume the request is a JSON request so get nodeRefs from JSON body - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - nodeRefs = getNodeRefs(json); - - if (json.has(PARAM_TRANSFER_FORMAT)) - { - transferFormat = json.getBoolean(PARAM_TRANSFER_FORMAT); - } - } - - // setup the ACP parameters - ExporterCrawlerParameters params = new ExporterCrawlerParameters(); - params.setCrawlSelf(true); - params.setCrawlChildNodes(true); - params.setExportFrom(new Location(nodeRefs)); - - // if transfer format has been requested we need to exclude certain aspects - if (transferFormat) - { - // restrict specific aspects from being returned - QName[] excludedAspects = new QName[] { - RenditionModel.ASPECT_RENDITIONED, - ContentModel.ASPECT_THUMBNAILED, - RecordsManagementModel.ASPECT_DISPOSITION_LIFECYCLE, - RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH, - RecordsManagementModel.ASPECT_EXTENDED_SECURITY}; - params.setExcludeAspects(excludedAspects); - } - else - { - // restrict specific aspects from being returned - QName[] excludedAspects = new QName[] {RecordsManagementModel.ASPECT_EXTENDED_SECURITY}; - params.setExcludeAspects(excludedAspects); - } - - // create an ACP of the nodes - tempACPFile = createACP(params, - transferFormat ? ZIP_EXTENSION : ACPExportPackageHandler.ACP_EXTENSION, - transferFormat); - - // stream the ACP back to the client as an attachment (forcing save as) - contentStreamer.streamContent(req, res, tempACPFile, null, true, tempACPFile.getName(), null); - } - catch (IOException ioe) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", ioe); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - catch(Exception e) - { - if (logger.isDebugEnabled()) - { - StringWriter stack = new StringWriter(); - e.printStackTrace(new PrintWriter(stack)); - logger.debug("Caught exception; decorating with appropriate status template : " + stack.toString()); - } - - throw createStatusException(e, req, res); - } - finally - { - // try and delete the temporary file - if (tempACPFile != null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Deleting temporary archive: " + tempACPFile.getAbsolutePath()); - } - - tempACPFile.delete(); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.alfresco.model.ContentModel; +import org.alfresco.model.RenditionModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; +import org.alfresco.repo.exporter.ACPExportPackageHandler; +import org.alfresco.repo.web.scripts.content.ContentStreamer; +import org.alfresco.repo.web.scripts.content.StreamACP; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.view.ExporterCrawlerParameters; +import org.alfresco.service.cmr.view.Location; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; + +/** + * Creates an RM specific ACP file of nodes to export then streams it back + * to the client. + * + * @author Gavin Cornwell + */ +public class ExportPost extends StreamACP +{ + /** Logger */ + private static Log logger = LogFactory.getLog(ExportPost.class); + + protected static final String PARAM_TRANSFER_FORMAT = "transferFormat"; + + /** Content Streamer */ + private ContentStreamer contentStreamer; + + /** + * @param contentStreamer + */ + public void setContentStreamer(ContentStreamer contentStreamer) + { + this.contentStreamer = contentStreamer; + } + + /** + * @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse) + */ + @SuppressWarnings("deprecation") + @Override + public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException + { + File tempACPFile = null; + try + { + NodeRef[] nodeRefs = null; + boolean transferFormat = false; + String contentType = req.getContentType(); + if (MULTIPART_FORMDATA.equals(contentType)) + { + // get nodeRefs parameter from form + nodeRefs = getNodeRefs(req.getParameter(PARAM_NODE_REFS)); + + // look for the transfer format + String transferFormatParam = req.getParameter(PARAM_TRANSFER_FORMAT); + if (transferFormatParam != null && transferFormatParam.length() > 0) + { + transferFormat = Boolean.parseBoolean(transferFormatParam); + } + } + else + { + // presume the request is a JSON request so get nodeRefs from JSON body + JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); + nodeRefs = getNodeRefs(json); + + if (json.has(PARAM_TRANSFER_FORMAT)) + { + transferFormat = json.getBoolean(PARAM_TRANSFER_FORMAT); + } + } + + // setup the ACP parameters + ExporterCrawlerParameters params = new ExporterCrawlerParameters(); + params.setCrawlSelf(true); + params.setCrawlChildNodes(true); + params.setExportFrom(new Location(nodeRefs)); + + // if transfer format has been requested we need to exclude certain aspects + if (transferFormat) + { + // restrict specific aspects from being returned + QName[] excludedAspects = new QName[] { + RenditionModel.ASPECT_RENDITIONED, + ContentModel.ASPECT_THUMBNAILED, + RecordsManagementModel.ASPECT_DISPOSITION_LIFECYCLE, + RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH, + RecordsManagementModel.ASPECT_EXTENDED_SECURITY}; + params.setExcludeAspects(excludedAspects); + } + else + { + // restrict specific aspects from being returned + QName[] excludedAspects = new QName[] {RecordsManagementModel.ASPECT_EXTENDED_SECURITY}; + params.setExcludeAspects(excludedAspects); + } + + // create an ACP of the nodes + tempACPFile = createACP(params, + transferFormat ? ZIP_EXTENSION : ACPExportPackageHandler.ACP_EXTENSION, + transferFormat); + + // stream the ACP back to the client as an attachment (forcing save as) + contentStreamer.streamContent(req, res, tempACPFile, null, true, tempACPFile.getName(), null); + } + catch (IOException ioe) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", ioe); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + catch(Exception e) + { + if (logger.isDebugEnabled()) + { + StringWriter stack = new StringWriter(); + e.printStackTrace(new PrintWriter(stack)); + logger.debug("Caught exception; decorating with appropriate status template : " + stack.toString()); + } + + throw createStatusException(e, req, res); + } + finally + { + // try and delete the temporary file + if (tempACPFile != null) + { + if (logger.isDebugEnabled()) + { + logger.debug("Deleting temporary archive: " + tempACPFile.getAbsolutePath()); + } + + tempACPFile.delete(); + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ImportPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ImportPost.java index 0f6f20c236..e9d0de7f5a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ImportPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ImportPost.java @@ -1,265 +1,265 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.repo.exporter.ACPExportPackageHandler; -import org.alfresco.repo.importer.ACPImportPackageHandler; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.view.ImporterService; -import org.alfresco.service.cmr.view.Location; -import org.alfresco.util.TempFileProvider; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WrappingWebScriptRequest; -import org.springframework.extensions.webscripts.servlet.FormData.FormField; -import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest; -import org.springframework.util.FileCopyUtils; - -/** - * Imports an ACP file into a records management container. - * - * @author Gavin Cornwell - */ -public class ImportPost extends DeclarativeWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(ImportPost.class); - - protected static final String MULTIPART_FORMDATA = "multipart/form-data"; - protected static final String PARAM_DESTINATION = "destination"; - protected static final String PARAM_ARCHIVE = "archive"; - protected static final String PARAM_FILEDATA = "filedata"; - protected static final String TEMP_FILE_PREFIX = "import_"; - - protected NodeService nodeService; - protected DictionaryService dictionaryService; - protected ImporterService importerService; - protected FilePlanRoleService filePlanRoleService; - protected FilePlanService filePlanService; - - /** - * @param nodeService - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Sets the data dictionary service - * - * @param dictionaryService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Sets the ImporterService to use - * - * @param importerService The ImporterService - */ - public void setImporterService(ImporterService importerService) - { - this.importerService = importerService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Unwrap to a WebScriptServletRequest if we have one - WebScriptServletRequest webScriptServletRequest = null; - WebScriptRequest current = req; - do - { - if (current instanceof WebScriptServletRequest) - { - webScriptServletRequest = (WebScriptServletRequest) current; - current = null; - } - else if (current instanceof WrappingWebScriptRequest) - { - current = ((WrappingWebScriptRequest) req).getNext(); - } - else - { - current = null; - } - } - while (current != null); - - // get the content type of request and ensure it's multipart/form-data - String contentType = req.getContentType(); - if (MULTIPART_FORMDATA.equals(contentType) && webScriptServletRequest != null) - { - String nodeRef = req.getParameter(PARAM_DESTINATION); - - if (nodeRef == null || nodeRef.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'destination' parameter was not provided in form data"); - } - - // create and check noderef - final NodeRef destination = new NodeRef(nodeRef); - if (nodeService.exists(destination)) - { - // check the destination is an RM container - if (!nodeService.hasAspect(destination, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) || - !dictionaryService.isSubClass(nodeService.getType(destination), ContentModel.TYPE_FOLDER)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "NodeRef '" + destination + "' does not represent an Records Management container node."); - } - } - else - { - status.setCode(HttpServletResponse.SC_NOT_FOUND, - "NodeRef '" + destination + "' does not exist."); - } - - // as there is no 'import capability' and the RM admin user is different from - // the DM admin user (meaning the webscript 'admin' authentication can't be used) - // perform a manual check here to ensure the current user has the RM admin role. - boolean isAdmin = filePlanRoleService.hasRMAdminRole( - filePlanService.getFilePlan(destination), - AuthenticationUtil.getRunAsUser()); - if (!isAdmin) - { - throw new WebScriptException(Status.STATUS_FORBIDDEN, "Access Denied"); - } - - File acpFile = null; - try - { - // create a temporary file representing uploaded ACP file - FormField acpContent = webScriptServletRequest.getFileField(PARAM_ARCHIVE); - if (acpContent == null) - { - acpContent = webScriptServletRequest.getFileField(PARAM_FILEDATA); - if (acpContent == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'archive' file content was not provided in form data"); - } - } - - acpFile = TempFileProvider.createTempFile(TEMP_FILE_PREFIX, "." + ACPExportPackageHandler.ACP_EXTENSION); - - // copy contents of uploaded file to temp ACP file - FileOutputStream fos = new FileOutputStream(acpFile); - // NOTE: this method closes both streams - FileCopyUtils.copy(acpContent.getInputStream(), fos); - - if (logger.isDebugEnabled()) - { - logger.debug("Importing uploaded ACP (" + acpFile.getAbsolutePath() + ") into " + nodeRef); - } - - // setup the import handler - final ACPImportPackageHandler importHandler = new ACPImportPackageHandler(acpFile, "UTF-8"); - - // import the ACP file as the system user - AuthenticationUtil.runAs(new RunAsWork() - { - public NodeRef doWork() - { - importerService.importView(importHandler, new Location(destination), null, null); - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - // create and return model - Map model = new HashMap(1); - model.put("success", true); - return model; - } - catch (FileNotFoundException fnfe) - { - throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, - "Failed to import ACP file", fnfe); - } - catch (IOException ioe) - { - throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, - "Failed to import ACP file", ioe); - } - finally - { - if (acpFile != null) - { - acpFile.delete(); - } - } - } - else - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Request is not " + MULTIPART_FORMDATA + " encoded"); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.repo.exporter.ACPExportPackageHandler; +import org.alfresco.repo.importer.ACPImportPackageHandler; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.view.ImporterService; +import org.alfresco.service.cmr.view.Location; +import org.alfresco.util.TempFileProvider; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WrappingWebScriptRequest; +import org.springframework.extensions.webscripts.servlet.FormData.FormField; +import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest; +import org.springframework.util.FileCopyUtils; + +/** + * Imports an ACP file into a records management container. + * + * @author Gavin Cornwell + */ +public class ImportPost extends DeclarativeWebScript +{ + /** Logger */ + private static Log logger = LogFactory.getLog(ImportPost.class); + + protected static final String MULTIPART_FORMDATA = "multipart/form-data"; + protected static final String PARAM_DESTINATION = "destination"; + protected static final String PARAM_ARCHIVE = "archive"; + protected static final String PARAM_FILEDATA = "filedata"; + protected static final String TEMP_FILE_PREFIX = "import_"; + + protected NodeService nodeService; + protected DictionaryService dictionaryService; + protected ImporterService importerService; + protected FilePlanRoleService filePlanRoleService; + protected FilePlanService filePlanService; + + /** + * @param nodeService + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Sets the data dictionary service + * + * @param dictionaryService The DictionaryService instance + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * Sets the ImporterService to use + * + * @param importerService The ImporterService + */ + public void setImporterService(ImporterService importerService) + { + this.importerService = importerService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // Unwrap to a WebScriptServletRequest if we have one + WebScriptServletRequest webScriptServletRequest = null; + WebScriptRequest current = req; + do + { + if (current instanceof WebScriptServletRequest) + { + webScriptServletRequest = (WebScriptServletRequest) current; + current = null; + } + else if (current instanceof WrappingWebScriptRequest) + { + current = ((WrappingWebScriptRequest) req).getNext(); + } + else + { + current = null; + } + } + while (current != null); + + // get the content type of request and ensure it's multipart/form-data + String contentType = req.getContentType(); + if (MULTIPART_FORMDATA.equals(contentType) && webScriptServletRequest != null) + { + String nodeRef = req.getParameter(PARAM_DESTINATION); + + if (nodeRef == null || nodeRef.length() == 0) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory 'destination' parameter was not provided in form data"); + } + + // create and check noderef + final NodeRef destination = new NodeRef(nodeRef); + if (nodeService.exists(destination)) + { + // check the destination is an RM container + if (!nodeService.hasAspect(destination, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) || + !dictionaryService.isSubClass(nodeService.getType(destination), ContentModel.TYPE_FOLDER)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "NodeRef '" + destination + "' does not represent an Records Management container node."); + } + } + else + { + status.setCode(HttpServletResponse.SC_NOT_FOUND, + "NodeRef '" + destination + "' does not exist."); + } + + // as there is no 'import capability' and the RM admin user is different from + // the DM admin user (meaning the webscript 'admin' authentication can't be used) + // perform a manual check here to ensure the current user has the RM admin role. + boolean isAdmin = filePlanRoleService.hasRMAdminRole( + filePlanService.getFilePlan(destination), + AuthenticationUtil.getRunAsUser()); + if (!isAdmin) + { + throw new WebScriptException(Status.STATUS_FORBIDDEN, "Access Denied"); + } + + File acpFile = null; + try + { + // create a temporary file representing uploaded ACP file + FormField acpContent = webScriptServletRequest.getFileField(PARAM_ARCHIVE); + if (acpContent == null) + { + acpContent = webScriptServletRequest.getFileField(PARAM_FILEDATA); + if (acpContent == null) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory 'archive' file content was not provided in form data"); + } + } + + acpFile = TempFileProvider.createTempFile(TEMP_FILE_PREFIX, "." + ACPExportPackageHandler.ACP_EXTENSION); + + // copy contents of uploaded file to temp ACP file + FileOutputStream fos = new FileOutputStream(acpFile); + // NOTE: this method closes both streams + FileCopyUtils.copy(acpContent.getInputStream(), fos); + + if (logger.isDebugEnabled()) + { + logger.debug("Importing uploaded ACP (" + acpFile.getAbsolutePath() + ") into " + nodeRef); + } + + // setup the import handler + final ACPImportPackageHandler importHandler = new ACPImportPackageHandler(acpFile, "UTF-8"); + + // import the ACP file as the system user + AuthenticationUtil.runAs(new RunAsWork() + { + public NodeRef doWork() + { + importerService.importView(importHandler, new Location(destination), null, null); + return null; + } + }, AuthenticationUtil.getSystemUserName()); + + // create and return model + Map model = new HashMap(1); + model.put("success", true); + return model; + } + catch (FileNotFoundException fnfe) + { + throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, + "Failed to import ACP file", fnfe); + } + catch (IOException ioe) + { + throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, + "Failed to import ACP file", ioe); + } + finally + { + if (acpFile != null) + { + acpFile.delete(); + } + } + } + else + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Request is not " + MULTIPART_FORMDATA + " encoded"); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ListOfValuesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ListOfValuesGet.java index 2d0c4e76e3..e17a0672ab 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ListOfValuesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/ListOfValuesGet.java @@ -1,304 +1,304 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.cmr.repository.PeriodProvider; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.util.StringUtils; - -/** - * Implementation for Java backed webscript to return lists - * of values for various records management services. - * - * @author Gavin Cornwell - */ -public class ListOfValuesGet extends DeclarativeWebScript -{ - protected RecordsManagementActionService rmActionService; - protected RecordsManagementAuditService rmAuditService; - protected RecordsManagementEventService rmEventService; - protected DispositionService dispositionService; - protected DictionaryService ddService; - protected NamespaceService namespaceService; - - /** - * Sets the RecordsManagementActionService instance - * - * @param rmActionService The RecordsManagementActionService instance - */ - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * Sets the RecordsManagementAuditService instance - * - * @param rmAuditService The RecordsManagementAuditService instance - */ - public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) - { - this.rmAuditService = rmAuditService; - } - - /** - * Sets the RecordsManagementEventService instance - * - * @param rmEventService The RecordsManagementEventService instance - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - /** - * Sets the disposition service - * - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Sets the DictionaryService instance - * - * @param ddService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService ddService) - { - this.ddService = ddService; - } - - /** - * Sets the NamespaceService instance - * - * @param namespaceService The NamespaceService instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // add all the lists data to a Map - Map listsModel = new HashMap(4); - String requestUrl = req.getURL(); - listsModel.put("dispositionActions", createDispositionActionsModel(requestUrl)); - listsModel.put("events", createEventsModel(requestUrl)); - listsModel.put("periodTypes", createPeriodTypesModel(requestUrl)); - listsModel.put("periodProperties", createPeriodPropertiesModel(requestUrl)); - listsModel.put("auditEvents", createAuditEventsModel(requestUrl)); - - // create model object with the lists model - Map model = new HashMap(1); - model.put("lists", listsModel); - return model; - } - - /** - * Creates the model for the list of disposition actions. - * - * @param baseUrl The base URL of the service - * @return model of disposition actions list - */ - protected Map createDispositionActionsModel(String baseUrl) - { - // iterate over the disposition actions - List dispositionActions = this.rmActionService.getDispositionActions(); - List> items = new ArrayList>(dispositionActions.size()); - for (RecordsManagementAction dispositionAction : dispositionActions) - { - Map item = new HashMap(2); - item.put("label", dispositionAction.getLabel()); - item.put("value", dispositionAction.getName()); - items.add(item); - } - - // create the model - Map model = new HashMap(2); - model.put("url", baseUrl + "/dispositionactions"); - model.put("items", items); - - return model; - } - - /** - * Creates the model for the list of events. - * - * @param baseUrl The base URL of the service - * @return model of events list - */ - protected Map createEventsModel(String baseUrl) - { - // get all the events including their display labels from the event service - List events = this.rmEventService.getEvents(); - List> items = new ArrayList>(events.size()); - for (RecordsManagementEvent event : events) - { - Map item = new HashMap(3); - item.put("label", event.getDisplayLabel()); - item.put("value", event.getName()); - item.put("automatic", - this.rmEventService.getEventType(event.getType()).isAutomaticEvent()); - items.add(item); - } - - // create the model - Map model = new HashMap(2); - model.put("url", baseUrl + "/events"); - model.put("items", items); - - return model; - } - - /** - * Creates the model for the list of period types. - * - * @param baseUrl The base URL of the service - * @return model of period types list - */ - protected Map createPeriodTypesModel(String baseUrl) - { - // iterate over all period provides, but ignore 'cron' - Set providers = Period.getProviderNames(); - List> items = new ArrayList>(providers.size()); - for (String provider : providers) - { - PeriodProvider pp = Period.getProvider(provider); - if (!pp.getPeriodType().equals("cron")) - { - Map item = new HashMap(2); - item.put("label", pp.getDisplayLabel()); - item.put("value", pp.getPeriodType()); - items.add(item); - } - } - - // create the model - Map model = new HashMap(2); - model.put("url", baseUrl + "/periodtypes"); - model.put("items", items); - - return model; - } - - /** - * Creates the model for the list of period properties. - * - * @param baseUrl The base URL of the service - * @return model of period properties list - */ - protected Map createPeriodPropertiesModel(String baseUrl) - { - // iterate over all period properties and get the label from their type definition - Collection dispositionProperties = dispositionService.getDispositionProperties(); - List> items = new ArrayList>(dispositionProperties.size()); - for (DispositionProperty dispositionProperty : dispositionProperties) - { - PropertyDefinition propDef = dispositionProperty.getPropertyDefinition(); - QName propName = dispositionProperty.getQName(); - - if (propDef != null) - { - Map item = new HashMap(2); - String propTitle = propDef.getTitle(ddService); - if (propTitle == null || propTitle.length() == 0) - { - propTitle = StringUtils.capitalize(propName.getLocalName()); - } - item.put("label", propTitle); - item.put("value", propName.toPrefixString(this.namespaceService)); - items.add(item); - } - } - - // create the model - Map model = new HashMap(2); - model.put("url", baseUrl + "/periodproperties"); - model.put("items", items); - - return model; - } - - /** - * Creates the model for the list of audit events. - * - * @param baseUrl The base URL of the service - * @return model of audit events list - */ - protected Map createAuditEventsModel(String baseUrl) - { - // iterate over all audit events - List auditEvents = this.rmAuditService.getAuditEvents(); - List> items = new ArrayList>(auditEvents.size()); - for (AuditEvent event : auditEvents) - { - Map item = new HashMap(2); - item.put("label", event.getLabel()); - item.put("value", event.getName()); - items.add(item); - } - - // create the model - Map model = new HashMap(2); - model.put("url", baseUrl + "/auditevents"); - model.put("items", items); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.cmr.repository.PeriodProvider; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.util.StringUtils; + +/** + * Implementation for Java backed webscript to return lists + * of values for various records management services. + * + * @author Gavin Cornwell + */ +public class ListOfValuesGet extends DeclarativeWebScript +{ + protected RecordsManagementActionService rmActionService; + protected RecordsManagementAuditService rmAuditService; + protected RecordsManagementEventService rmEventService; + protected DispositionService dispositionService; + protected DictionaryService ddService; + protected NamespaceService namespaceService; + + /** + * Sets the RecordsManagementActionService instance + * + * @param rmActionService The RecordsManagementActionService instance + */ + public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) + { + this.rmActionService = rmActionService; + } + + /** + * Sets the RecordsManagementAuditService instance + * + * @param rmAuditService The RecordsManagementAuditService instance + */ + public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService) + { + this.rmAuditService = rmAuditService; + } + + /** + * Sets the RecordsManagementEventService instance + * + * @param rmEventService The RecordsManagementEventService instance + */ + public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) + { + this.rmEventService = rmEventService; + } + + /** + * Sets the disposition service + * + * @param dispositionService the disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Sets the DictionaryService instance + * + * @param ddService The DictionaryService instance + */ + public void setDictionaryService(DictionaryService ddService) + { + this.ddService = ddService; + } + + /** + * Sets the NamespaceService instance + * + * @param namespaceService The NamespaceService instance + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // add all the lists data to a Map + Map listsModel = new HashMap(4); + String requestUrl = req.getURL(); + listsModel.put("dispositionActions", createDispositionActionsModel(requestUrl)); + listsModel.put("events", createEventsModel(requestUrl)); + listsModel.put("periodTypes", createPeriodTypesModel(requestUrl)); + listsModel.put("periodProperties", createPeriodPropertiesModel(requestUrl)); + listsModel.put("auditEvents", createAuditEventsModel(requestUrl)); + + // create model object with the lists model + Map model = new HashMap(1); + model.put("lists", listsModel); + return model; + } + + /** + * Creates the model for the list of disposition actions. + * + * @param baseUrl The base URL of the service + * @return model of disposition actions list + */ + protected Map createDispositionActionsModel(String baseUrl) + { + // iterate over the disposition actions + List dispositionActions = this.rmActionService.getDispositionActions(); + List> items = new ArrayList>(dispositionActions.size()); + for (RecordsManagementAction dispositionAction : dispositionActions) + { + Map item = new HashMap(2); + item.put("label", dispositionAction.getLabel()); + item.put("value", dispositionAction.getName()); + items.add(item); + } + + // create the model + Map model = new HashMap(2); + model.put("url", baseUrl + "/dispositionactions"); + model.put("items", items); + + return model; + } + + /** + * Creates the model for the list of events. + * + * @param baseUrl The base URL of the service + * @return model of events list + */ + protected Map createEventsModel(String baseUrl) + { + // get all the events including their display labels from the event service + List events = this.rmEventService.getEvents(); + List> items = new ArrayList>(events.size()); + for (RecordsManagementEvent event : events) + { + Map item = new HashMap(3); + item.put("label", event.getDisplayLabel()); + item.put("value", event.getName()); + item.put("automatic", + this.rmEventService.getEventType(event.getType()).isAutomaticEvent()); + items.add(item); + } + + // create the model + Map model = new HashMap(2); + model.put("url", baseUrl + "/events"); + model.put("items", items); + + return model; + } + + /** + * Creates the model for the list of period types. + * + * @param baseUrl The base URL of the service + * @return model of period types list + */ + protected Map createPeriodTypesModel(String baseUrl) + { + // iterate over all period provides, but ignore 'cron' + Set providers = Period.getProviderNames(); + List> items = new ArrayList>(providers.size()); + for (String provider : providers) + { + PeriodProvider pp = Period.getProvider(provider); + if (!pp.getPeriodType().equals("cron")) + { + Map item = new HashMap(2); + item.put("label", pp.getDisplayLabel()); + item.put("value", pp.getPeriodType()); + items.add(item); + } + } + + // create the model + Map model = new HashMap(2); + model.put("url", baseUrl + "/periodtypes"); + model.put("items", items); + + return model; + } + + /** + * Creates the model for the list of period properties. + * + * @param baseUrl The base URL of the service + * @return model of period properties list + */ + protected Map createPeriodPropertiesModel(String baseUrl) + { + // iterate over all period properties and get the label from their type definition + Collection dispositionProperties = dispositionService.getDispositionProperties(); + List> items = new ArrayList>(dispositionProperties.size()); + for (DispositionProperty dispositionProperty : dispositionProperties) + { + PropertyDefinition propDef = dispositionProperty.getPropertyDefinition(); + QName propName = dispositionProperty.getQName(); + + if (propDef != null) + { + Map item = new HashMap(2); + String propTitle = propDef.getTitle(ddService); + if (propTitle == null || propTitle.length() == 0) + { + propTitle = StringUtils.capitalize(propName.getLocalName()); + } + item.put("label", propTitle); + item.put("value", propName.toPrefixString(this.namespaceService)); + items.add(item); + } + } + + // create the model + Map model = new HashMap(2); + model.put("url", baseUrl + "/periodproperties"); + model.put("items", items); + + return model; + } + + /** + * Creates the model for the list of audit events. + * + * @param baseUrl The base URL of the service + * @return model of audit events list + */ + protected Map createAuditEventsModel(String baseUrl) + { + // iterate over all audit events + List auditEvents = this.rmAuditService.getAuditEvents(); + List> items = new ArrayList>(auditEvents.size()); + for (AuditEvent event : auditEvents) + { + Map item = new HashMap(2); + item.put("label", event.getLabel()); + item.put("value", event.getName()); + items.add(item); + } + + // create the model + Map model = new HashMap(2); + model.put("url", baseUrl + "/auditevents"); + model.put("items", items); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RMConstraintGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RMConstraintGet.java index 2db0f32022..d0702a7cbe 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RMConstraintGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RMConstraintGet.java @@ -1,79 +1,79 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return - * the values for an RM constraint. - */ -public class RMConstraintGet extends DeclarativeWebScript -{ - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - String extensionPath = req.getExtensionPath(); - - String constraintName = extensionPath.replace('_', ':'); - - List values = caveatConfigService.getRMAllowedValues(constraintName); - - // create model object with the lists model - Map model = new HashMap(1); - model.put("allowedValuesForCurrentUser", values); - model.put("constraintName", extensionPath); - - return model; - } - - public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) - { - this.caveatConfigService = caveatConfigService; - } - - public RMCaveatConfigService getCaveatConfigService() - { - return caveatConfigService; - } - - private RMCaveatConfigService caveatConfigService; - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return + * the values for an RM constraint. + */ +public class RMConstraintGet extends DeclarativeWebScript +{ + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + String extensionPath = req.getExtensionPath(); + + String constraintName = extensionPath.replace('_', ':'); + + List values = caveatConfigService.getRMAllowedValues(constraintName); + + // create model object with the lists model + Map model = new HashMap(1); + model.put("allowedValuesForCurrentUser", values); + model.put("constraintName", extensionPath); + + return model; + } + + public void setCaveatConfigService(RMCaveatConfigService caveatConfigService) + { + this.caveatConfigService = caveatConfigService; + } + + public RMCaveatConfigService getCaveatConfigService() + { + return caveatConfigService; + } + + private RMCaveatConfigService caveatConfigService; + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RecordMetaDataAspectsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RecordMetaDataAspectsGet.java index 592a167ac7..e79510978a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RecordMetaDataAspectsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RecordMetaDataAspectsGet.java @@ -1,150 +1,150 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Record metadata aspects GET - * - * @author Roy Wetherall - */ -public class RecordMetaDataAspectsGet extends DeclarativeWebScript -{ - /** parameters */ - private static final String PARAM_NODEREF = "noderef"; - - protected DictionaryService dictionaryService; - protected NamespaceService namespaceService; - protected RecordService recordService; - protected FilePlanService filePlanService; - - /** - * Set the dictionary service instance - * - * @param dictionaryService the {@link DictionaryService} instance - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Sets the {@link NamespaceService} instance - * - * @param namespaceService The {@link NamespaceService} instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Get the nodeRef and confirm it is valid - NodeRef nodeRef = null; - String nodeRefValue = req.getParameter(PARAM_NODEREF); - if (nodeRefValue == null || nodeRefValue.trim().length() == 0) - { - // get the file plan if a node ref hasn't been specified - // TODO will need to remove when multi file plans supported - nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - } - else - { - nodeRef = new NodeRef(nodeRefValue); - } - - // Get the details of all the aspects - Set aspectQNames = recordService.getRecordMetadataAspects(nodeRef); - List> aspects = new ArrayList>(aspectQNames.size()+1); - for (QName aspectQName : aspectQNames) - { - // Get the prefix aspect and default the label to the localname - String prefixString = aspectQName.toPrefixString(namespaceService); - String label = aspectQName.getLocalName(); - - Map aspect = new HashMap(2); - aspect.put("id", prefixString); - - // Try and get the aspect definition - AspectDefinition aspectDefinition = dictionaryService.getAspect(aspectQName); - if (aspectDefinition != null) - { - // Fet the label from the aspect definition - label = aspectDefinition.getTitle(dictionaryService); - } - aspect.put("value", label); - - // Add the aspect details to the aspects list - aspects.add(aspect); - } - - // create model object with the lists model - Map model = new HashMap(1); - model.put("aspects", aspects); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Record metadata aspects GET + * + * @author Roy Wetherall + */ +public class RecordMetaDataAspectsGet extends DeclarativeWebScript +{ + /** parameters */ + private static final String PARAM_NODEREF = "noderef"; + + protected DictionaryService dictionaryService; + protected NamespaceService namespaceService; + protected RecordService recordService; + protected FilePlanService filePlanService; + + /** + * Set the dictionary service instance + * + * @param dictionaryService the {@link DictionaryService} instance + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * Sets the {@link NamespaceService} instance + * + * @param namespaceService The {@link NamespaceService} instance + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // Get the nodeRef and confirm it is valid + NodeRef nodeRef = null; + String nodeRefValue = req.getParameter(PARAM_NODEREF); + if (nodeRefValue == null || nodeRefValue.trim().length() == 0) + { + // get the file plan if a node ref hasn't been specified + // TODO will need to remove when multi file plans supported + nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + + } + else + { + nodeRef = new NodeRef(nodeRefValue); + } + + // Get the details of all the aspects + Set aspectQNames = recordService.getRecordMetadataAspects(nodeRef); + List> aspects = new ArrayList>(aspectQNames.size()+1); + for (QName aspectQName : aspectQNames) + { + // Get the prefix aspect and default the label to the localname + String prefixString = aspectQName.toPrefixString(namespaceService); + String label = aspectQName.getLocalName(); + + Map aspect = new HashMap(2); + aspect.put("id", prefixString); + + // Try and get the aspect definition + AspectDefinition aspectDefinition = dictionaryService.getAspect(aspectQName); + if (aspectDefinition != null) + { + // Fet the label from the aspect definition + label = aspectDefinition.getTitle(dictionaryService); + } + aspect.put("value", label); + + // Add the aspect details to the aspects list + aspects.add(aspect); + } + + // create model object with the lists model + Map model = new HashMap(1); + model.put("aspects", aspects); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java index 820a183a37..9511781a5d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java @@ -1,125 +1,125 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; -import static org.alfresco.util.WebScriptUtils.getTemplateVars; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to delete a relationship from a node. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipDelete extends AbstractRmWebScript -{ - /** Constants */ - private static final String STORE_TYPE = "target_store_type"; - private static final String STORE_ID = "target_store_id"; - private static final String ID = "target_id"; - private static final String UNIQUE_NAME = "uniqueName"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** - * Gets the relationship service - * - * @return The relationship service - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service - * - * @param relationshipService The relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - String uniqueName = getRequestParameterValue(req, UNIQUE_NAME); - NodeRef source = parseRequestForNodeRef(req); - NodeRef target = parseRequestForTargetNodeRef(req); - - getRelationshipService().removeRelationship(uniqueName, source, target); - getRelationshipService().removeRelationship(uniqueName, target, source); - - Map model = new HashMap(1); - model.put(SUCCESS, true); - return model; - } - - /** - * Gets the node reference of target - * - * @param req The webscript request - * @return The node reference of the target - */ - private NodeRef parseRequestForTargetNodeRef(WebScriptRequest req) - { - Map templateVars = getTemplateVars(req); - String storeType = templateVars.get(STORE_TYPE); - String storeId = templateVars.get(STORE_ID); - String nodeId = templateVars.get(ID); - - NodeRef nodeRef = new NodeRef(storeType, storeId, nodeId); - - if (!getNodeService().exists(nodeRef)) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: '" + - nodeRef.toString() + "'."); - } - - return nodeRef; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; +import static org.alfresco.util.WebScriptUtils.getTemplateVars; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to delete a relationship from a node. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RelationshipDelete extends AbstractRmWebScript +{ + /** Constants */ + private static final String STORE_TYPE = "target_store_type"; + private static final String STORE_ID = "target_store_id"; + private static final String ID = "target_id"; + private static final String UNIQUE_NAME = "uniqueName"; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** + * Gets the relationship service + * + * @return The relationship service + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Sets the relationship service + * + * @param relationshipService The relationship service + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + String uniqueName = getRequestParameterValue(req, UNIQUE_NAME); + NodeRef source = parseRequestForNodeRef(req); + NodeRef target = parseRequestForTargetNodeRef(req); + + getRelationshipService().removeRelationship(uniqueName, source, target); + getRelationshipService().removeRelationship(uniqueName, target, source); + + Map model = new HashMap(1); + model.put(SUCCESS, true); + return model; + } + + /** + * Gets the node reference of target + * + * @param req The webscript request + * @return The node reference of the target + */ + private NodeRef parseRequestForTargetNodeRef(WebScriptRequest req) + { + Map templateVars = getTemplateVars(req); + String storeType = templateVars.get(STORE_TYPE); + String storeId = templateVars.get(STORE_ID); + String nodeId = templateVars.get(ID); + + NodeRef nodeRef = new NodeRef(storeType, storeId, nodeId); + + if (!getNodeService().exists(nodeRef)) + { + throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: '" + + nodeRef.toString() + "'."); + } + + return nodeRef; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java index c5ab7aefbb..9f72d91857 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java @@ -1,227 +1,227 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get the relationship labels. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipLabelsGet extends AbstractRmWebScript -{ - /** Constants */ - private static final String RELATIONSHIP_LABELS = "relationshipLabels"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** - * Gets the relationship service - * - * @return The relationship service - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service - * - * @param relationshipService The relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - model.put(RELATIONSHIP_LABELS, getRelationshipsLabels()); - return model; - } - - /** - * Gets the list of available relationship labels - * - * @return The list of available relationship labels - */ - private List getRelationshipsLabels() - { - List relationshipLabels = new ArrayList(); - - Set relationshipDefinitions = getRelationshipService().getRelationshipDefinitions(); - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) - { - RelationshipType type = relationshipDefinition.getType(); - String uniqueName = relationshipDefinition.getUniqueName(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - - if (RelationshipType.PARENTCHILD.equals(type)) - { - relationshipLabels.add(new RelationshipLabel(sourceText, uniqueName + INVERT)); - relationshipLabels.add(new RelationshipLabel(targetText, uniqueName)); - } - else if (RelationshipType.BIDIRECTIONAL.equals(type)) - { - if (!sourceText.equals(targetText)) - { - throw new WebScriptException( - Status.STATUS_BAD_REQUEST, - "The source '" - + sourceText - + "' and target text '" - + targetText - + "' must be the same for a bidirectional relationship."); - } - relationshipLabels.add(new RelationshipLabel(sourceText, uniqueName)); - } - else - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unknown relationship type '" + type + "'."); - } - } - - return sortRelationshipLabelsByName(relationshipLabels); - } - - /** - * Helper method to sort the relationship labels by their names - * - * @param relationshipLabels Relationship labels to sort - * @return Sorted list of relationship labels - */ - private List sortRelationshipLabelsByName(List relationshipLabels) - { - Collections.sort(relationshipLabels, new Comparator() - { - @Override - public int compare(RelationshipLabel r1, RelationshipLabel r2) - { - return r1.getLabel().toLowerCase().compareTo(r2.getLabel().toLowerCase()); - } - }); - return relationshipLabels; - } - - /** - * Relationship label helper class - */ - public class RelationshipLabel - { - /** Label of the relationship */ - private String label; - - /** Unique name of the relationship */ - private String uniqueName; - - /** - * Constructor - * - * @param label Label of the relationship - * @param uniqueName Unique name of the relationship - */ - public RelationshipLabel(String label, String uniqueName) - { - mandatoryString("label", label); - mandatoryString("uniqueName", uniqueName); - - setLabel(label); - setUniqueName(uniqueName); - } - - /** - * Gets the label of the relationship - * - * @return The label of the relationship - */ - public String getLabel() - { - return this.label; - } - - /** - * Sets the label of the relationship - * - * @param label The label of the relationship - */ - private void setLabel(String label) - { - this.label = label; - } - - /** - * Gets the unique name of the relationship - * - * @return The unique name of the relationship - */ - public String getUniqueName() - { - return this.uniqueName; - } - - /** - * Sets the unique name of the relationship - * - * @param uniqueName The unique name of the relationship - */ - private void setUniqueName(String uniqueName) - { - this.uniqueName = uniqueName; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import static org.alfresco.util.ParameterCheck.mandatoryString; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to get the relationship labels. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RelationshipLabelsGet extends AbstractRmWebScript +{ + /** Constants */ + private static final String RELATIONSHIP_LABELS = "relationshipLabels"; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** + * Gets the relationship service + * + * @return The relationship service + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Sets the relationship service + * + * @param relationshipService The relationship service + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1); + model.put(RELATIONSHIP_LABELS, getRelationshipsLabels()); + return model; + } + + /** + * Gets the list of available relationship labels + * + * @return The list of available relationship labels + */ + private List getRelationshipsLabels() + { + List relationshipLabels = new ArrayList(); + + Set relationshipDefinitions = getRelationshipService().getRelationshipDefinitions(); + for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) + { + RelationshipType type = relationshipDefinition.getType(); + String uniqueName = relationshipDefinition.getUniqueName(); + RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); + String sourceText = displayName.getSourceText(); + String targetText = displayName.getTargetText(); + + if (RelationshipType.PARENTCHILD.equals(type)) + { + relationshipLabels.add(new RelationshipLabel(sourceText, uniqueName + INVERT)); + relationshipLabels.add(new RelationshipLabel(targetText, uniqueName)); + } + else if (RelationshipType.BIDIRECTIONAL.equals(type)) + { + if (!sourceText.equals(targetText)) + { + throw new WebScriptException( + Status.STATUS_BAD_REQUEST, + "The source '" + + sourceText + + "' and target text '" + + targetText + + "' must be the same for a bidirectional relationship."); + } + relationshipLabels.add(new RelationshipLabel(sourceText, uniqueName)); + } + else + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unknown relationship type '" + type + "'."); + } + } + + return sortRelationshipLabelsByName(relationshipLabels); + } + + /** + * Helper method to sort the relationship labels by their names + * + * @param relationshipLabels Relationship labels to sort + * @return Sorted list of relationship labels + */ + private List sortRelationshipLabelsByName(List relationshipLabels) + { + Collections.sort(relationshipLabels, new Comparator() + { + @Override + public int compare(RelationshipLabel r1, RelationshipLabel r2) + { + return r1.getLabel().toLowerCase().compareTo(r2.getLabel().toLowerCase()); + } + }); + return relationshipLabels; + } + + /** + * Relationship label helper class + */ + public class RelationshipLabel + { + /** Label of the relationship */ + private String label; + + /** Unique name of the relationship */ + private String uniqueName; + + /** + * Constructor + * + * @param label Label of the relationship + * @param uniqueName Unique name of the relationship + */ + public RelationshipLabel(String label, String uniqueName) + { + mandatoryString("label", label); + mandatoryString("uniqueName", uniqueName); + + setLabel(label); + setUniqueName(uniqueName); + } + + /** + * Gets the label of the relationship + * + * @return The label of the relationship + */ + public String getLabel() + { + return this.label; + } + + /** + * Sets the label of the relationship + * + * @param label The label of the relationship + */ + private void setLabel(String label) + { + this.label = label; + } + + /** + * Gets the unique name of the relationship + * + * @return The unique name of the relationship + */ + public String getUniqueName() + { + return this.uniqueName; + } + + /** + * Sets the unique name of the relationship + * + * @param uniqueName The unique name of the relationship + */ + private void setUniqueName(String uniqueName) + { + this.uniqueName = uniqueName; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java index 3260848356..2f3fbb98ee 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java @@ -1,193 +1,193 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.JSONConversionComponent; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.WebScriptUtils; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get the relationships for a node. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipsGet extends AbstractRmWebScript -{ - /** Constants */ - private static final String RELATIONSHIPS = "relationships"; - private static final String RELATIONSHIP_LABEL = "relationshipLabel"; - private static final String RELATIONSHIP_UNIQUE_NAME = "relationshipUniqueName"; - - /** The relationship end point */ - private enum RelationshipEndPoint - { - SOURCE, TARGET - }; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** JSON conversion component */ - private JSONConversionComponent jsonConversionComponent; - - /** - * Gets the relationship service - * - * @return The relationship service - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Gets the JSON conversion component - * - * @return The JSON conversion component - */ - protected JSONConversionComponent getJsonConversionComponent() - { - return this.jsonConversionComponent; - } - - /** - * Sets the relationship service - * - * @param relationshipService The relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Sets the JSON conversion component - * - * @param jsonConversionComponent The JSON conversion component - */ - public void setJsonConversionComponent(JSONConversionComponent jsonConversionComponent) - { - this.jsonConversionComponent = jsonConversionComponent; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - NodeRef nodeRef = parseRequestForNodeRef(req); - model.put(RELATIONSHIPS, getRelationships(nodeRef)); - return model; - } - - /** - * Gets the relationships of a node - * - * @param nodeRef The node reference - * - * @return The list of relationships of a node - */ - private List getRelationships(NodeRef nodeRef) - { - List relationships = new ArrayList(); - - Set relationshipsFrom = getRelationshipService().getRelationshipsFrom(nodeRef); - relationships.addAll(buildRelationshipData(relationshipsFrom, RelationshipEndPoint.TARGET)); - - Set relationshipsTo = getRelationshipService().getRelationshipsTo(nodeRef); - relationships.addAll(buildRelationshipData(relationshipsTo, RelationshipEndPoint.SOURCE)); - - return relationships; - } - - /** - * Creates the relationship data - * - * @param relationships The {@link Set} of relationships - * @param relationshipEndPoint The end point of the relationship, which is either {@link RelationshipEndpoint#SOURCE} or {@link RelationshipEndpoint#TARGET} - * @return The relationship data as {@link List} - */ - private List buildRelationshipData(Set relationships, RelationshipEndPoint relationshipEndPoint) - { - List result = new ArrayList(); - - for (Relationship relationship : relationships) - { - String uniqueName = relationship.getUniqueName(); - RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); - if (relationshipDefinition != null) - { - NodeRef node; - String label; - - if (RelationshipEndPoint.SOURCE.equals(relationshipEndPoint)) - { - node = relationship.getSource(); - label = relationshipDefinition.getDisplayName().getSourceText(); - } - else if (RelationshipEndPoint.TARGET.equals(relationshipEndPoint)) - { - node = relationship.getTarget(); - label = relationshipDefinition.getDisplayName().getTargetText(); - } - else - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unknown relationship end point type '" + relationshipEndPoint + "'."); - } - - String nodeDetails = getJsonConversionComponent().toJSON(node, true); - JSONObject jsonObject = WebScriptUtils.createJSONObject(nodeDetails); - WebScriptUtils.putValueToJSONObject(jsonObject, RELATIONSHIP_LABEL, label); - WebScriptUtils.putValueToJSONObject(jsonObject, RELATIONSHIP_UNIQUE_NAME, relationshipDefinition.getUniqueName()); - - result.add(jsonObject.toString()); - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.jscript.app.JSONConversionComponent; +import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.WebScriptUtils; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to get the relationships for a node. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RelationshipsGet extends AbstractRmWebScript +{ + /** Constants */ + private static final String RELATIONSHIPS = "relationships"; + private static final String RELATIONSHIP_LABEL = "relationshipLabel"; + private static final String RELATIONSHIP_UNIQUE_NAME = "relationshipUniqueName"; + + /** The relationship end point */ + private enum RelationshipEndPoint + { + SOURCE, TARGET + }; + + /** Relationship service */ + private RelationshipService relationshipService; + + /** JSON conversion component */ + private JSONConversionComponent jsonConversionComponent; + + /** + * Gets the relationship service + * + * @return The relationship service + */ + protected RelationshipService getRelationshipService() + { + return this.relationshipService; + } + + /** + * Gets the JSON conversion component + * + * @return The JSON conversion component + */ + protected JSONConversionComponent getJsonConversionComponent() + { + return this.jsonConversionComponent; + } + + /** + * Sets the relationship service + * + * @param relationshipService The relationship service + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * Sets the JSON conversion component + * + * @param jsonConversionComponent The JSON conversion component + */ + public void setJsonConversionComponent(JSONConversionComponent jsonConversionComponent) + { + this.jsonConversionComponent = jsonConversionComponent; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1); + NodeRef nodeRef = parseRequestForNodeRef(req); + model.put(RELATIONSHIPS, getRelationships(nodeRef)); + return model; + } + + /** + * Gets the relationships of a node + * + * @param nodeRef The node reference + * + * @return The list of relationships of a node + */ + private List getRelationships(NodeRef nodeRef) + { + List relationships = new ArrayList(); + + Set relationshipsFrom = getRelationshipService().getRelationshipsFrom(nodeRef); + relationships.addAll(buildRelationshipData(relationshipsFrom, RelationshipEndPoint.TARGET)); + + Set relationshipsTo = getRelationshipService().getRelationshipsTo(nodeRef); + relationships.addAll(buildRelationshipData(relationshipsTo, RelationshipEndPoint.SOURCE)); + + return relationships; + } + + /** + * Creates the relationship data + * + * @param relationships The {@link Set} of relationships + * @param relationshipEndPoint The end point of the relationship, which is either {@link RelationshipEndpoint#SOURCE} or {@link RelationshipEndpoint#TARGET} + * @return The relationship data as {@link List} + */ + private List buildRelationshipData(Set relationships, RelationshipEndPoint relationshipEndPoint) + { + List result = new ArrayList(); + + for (Relationship relationship : relationships) + { + String uniqueName = relationship.getUniqueName(); + RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); + if (relationshipDefinition != null) + { + NodeRef node; + String label; + + if (RelationshipEndPoint.SOURCE.equals(relationshipEndPoint)) + { + node = relationship.getSource(); + label = relationshipDefinition.getDisplayName().getSourceText(); + } + else if (RelationshipEndPoint.TARGET.equals(relationshipEndPoint)) + { + node = relationship.getTarget(); + label = relationshipDefinition.getDisplayName().getTargetText(); + } + else + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unknown relationship end point type '" + relationshipEndPoint + "'."); + } + + String nodeDetails = getJsonConversionComponent().toJSON(node, true); + JSONObject jsonObject = WebScriptUtils.createJSONObject(nodeDetails); + WebScriptUtils.putValueToJSONObject(jsonObject, RELATIONSHIP_LABEL, label); + WebScriptUtils.putValueToJSONObject(jsonObject, RELATIONSHIP_UNIQUE_NAME, relationshipDefinition.getUniqueName()); + + result.add(jsonObject.toString()); + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java index 63ecedf611..71770ea629 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java @@ -1,228 +1,228 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * This class provides the implementation for the rmaction webscript. - * - * @author Neil McErlean - */ -public class RmActionPost extends DeclarativeWebScript -{ - private static Log logger = LogFactory.getLog(RmActionPost.class); - - private static final String PARAM_NAME = "name"; - private static final String PARAM_NODE_REF = "nodeRef"; - private static final String PARAM_NODE_REFS = "nodeRefs"; - private static final String PARAM_PARAMS = "params"; - - private NodeService nodeService; - private RecordsManagementActionService rmActionService; - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - @SuppressWarnings("unchecked") - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - String reqContentAsString; - try - { - reqContentAsString = req.getContent().getContent(); - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - - String actionName = null; - List targetNodeRefs = new ArrayList(1); - Map actionParams = new HashMap(3); - - try - { - JSONObject jsonObj = new JSONObject(new JSONTokener(reqContentAsString)); - - // Get the action name - if (jsonObj.has(PARAM_NAME)) - { - actionName = jsonObj.getString(PARAM_NAME); - } - - // Get the target references - if (jsonObj.has(PARAM_NODE_REF)) - { - NodeRef nodeRef = new NodeRef(jsonObj.getString(PARAM_NODE_REF)); - targetNodeRefs.add(nodeRef); - } - if (jsonObj.has(PARAM_NODE_REFS)) - { - JSONArray jsonArray = jsonObj.getJSONArray(PARAM_NODE_REFS); - if (jsonArray.length() != 0) - { - targetNodeRefs = new ArrayList(jsonArray.length()); - for (int i = 0; i < jsonArray.length(); i++) - { - NodeRef nodeRef = new NodeRef(jsonArray.getString(i)); - targetNodeRefs.add(nodeRef); - } - } - } - - // params are optional. - if (jsonObj.has(PARAM_PARAMS)) - { - JSONObject paramsObj = jsonObj.getJSONObject(PARAM_PARAMS); - for (Iterator iter = paramsObj.keys(); iter.hasNext(); ) - { - String nextKeyString = iter.next(); - Object nextValue = paramsObj.get(nextKeyString); - - // Check for date values - if ((nextValue instanceof JSONObject) && ((JSONObject)nextValue).has("iso8601")) - { - String dateStringValue = ((JSONObject)nextValue).getString("iso8601"); - nextValue = ISO8601DateFormat.parse(dateStringValue); - } - - actionParams.put(nextKeyString, (Serializable)nextValue); - } - } - } - catch (JSONException exception) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to parse request JSON.", exception); - } - - // validate input: check for mandatory params. - // Some RM actions can be posted without a nodeRef. - if (actionName == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "A mandatory parameter has not been provided in URL"); - } - - // Check that all the nodes provided exist and build report string - StringBuilder targetNodeRefsString = new StringBuilder(30); - boolean firstTime = true; - for (NodeRef targetNodeRef : targetNodeRefs) - { - if (!nodeService.exists(targetNodeRef)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "The targetNode does not exist (" + targetNodeRef.toString() + ")"); - } - - // Build the string - if (firstTime) - { - firstTime = false; - } - else - { - targetNodeRefsString.append(", "); - } - targetNodeRefsString.append(targetNodeRef.toString()); - } - - // Proceed to execute the specified action on the specified node. - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Executing Record Action ") - .append(actionName) - .append(", (") - .append(targetNodeRefsString.toString()) - .append("), ") - .append(actionParams); - logger.debug(msg.toString()); - } - - Map model = new HashMap(); - if (targetNodeRefs.isEmpty()) - { - RecordsManagementActionResult result = this.rmActionService.executeRecordsManagementAction(actionName, actionParams); - if (result.getValue() != null) - { - model.put("result", result.getValue().toString()); - } - } - else - { - Map resultMap = this.rmActionService.executeRecordsManagementAction(targetNodeRefs, actionName, actionParams); - Map results = new HashMap(resultMap.size()); - for (Map.Entry entry : resultMap.entrySet()) - { - Object value = entry.getValue().getValue(); - if (value != null) - { - results.put(entry.getKey().toString(), value.toString()); - } - } - model.put("results", results); - } - - model.put("message", "Successfully queued action [" + actionName + "] on " + targetNodeRefsString.toString()); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.surf.util.ISO8601DateFormat; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * This class provides the implementation for the rmaction webscript. + * + * @author Neil McErlean + */ +public class RmActionPost extends DeclarativeWebScript +{ + private static Log logger = LogFactory.getLog(RmActionPost.class); + + private static final String PARAM_NAME = "name"; + private static final String PARAM_NODE_REF = "nodeRef"; + private static final String PARAM_NODE_REFS = "nodeRefs"; + private static final String PARAM_PARAMS = "params"; + + private NodeService nodeService; + private RecordsManagementActionService rmActionService; + + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) + { + this.rmActionService = rmActionService; + } + + @SuppressWarnings("unchecked") + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + String reqContentAsString; + try + { + reqContentAsString = req.getContent().getContent(); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + + String actionName = null; + List targetNodeRefs = new ArrayList(1); + Map actionParams = new HashMap(3); + + try + { + JSONObject jsonObj = new JSONObject(new JSONTokener(reqContentAsString)); + + // Get the action name + if (jsonObj.has(PARAM_NAME)) + { + actionName = jsonObj.getString(PARAM_NAME); + } + + // Get the target references + if (jsonObj.has(PARAM_NODE_REF)) + { + NodeRef nodeRef = new NodeRef(jsonObj.getString(PARAM_NODE_REF)); + targetNodeRefs.add(nodeRef); + } + if (jsonObj.has(PARAM_NODE_REFS)) + { + JSONArray jsonArray = jsonObj.getJSONArray(PARAM_NODE_REFS); + if (jsonArray.length() != 0) + { + targetNodeRefs = new ArrayList(jsonArray.length()); + for (int i = 0; i < jsonArray.length(); i++) + { + NodeRef nodeRef = new NodeRef(jsonArray.getString(i)); + targetNodeRefs.add(nodeRef); + } + } + } + + // params are optional. + if (jsonObj.has(PARAM_PARAMS)) + { + JSONObject paramsObj = jsonObj.getJSONObject(PARAM_PARAMS); + for (Iterator iter = paramsObj.keys(); iter.hasNext(); ) + { + String nextKeyString = iter.next(); + Object nextValue = paramsObj.get(nextKeyString); + + // Check for date values + if ((nextValue instanceof JSONObject) && ((JSONObject)nextValue).has("iso8601")) + { + String dateStringValue = ((JSONObject)nextValue).getString("iso8601"); + nextValue = ISO8601DateFormat.parse(dateStringValue); + } + + actionParams.put(nextKeyString, (Serializable)nextValue); + } + } + } + catch (JSONException exception) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to parse request JSON.", exception); + } + + // validate input: check for mandatory params. + // Some RM actions can be posted without a nodeRef. + if (actionName == null) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "A mandatory parameter has not been provided in URL"); + } + + // Check that all the nodes provided exist and build report string + StringBuilder targetNodeRefsString = new StringBuilder(30); + boolean firstTime = true; + for (NodeRef targetNodeRef : targetNodeRefs) + { + if (!nodeService.exists(targetNodeRef)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, + "The targetNode does not exist (" + targetNodeRef.toString() + ")"); + } + + // Build the string + if (firstTime) + { + firstTime = false; + } + else + { + targetNodeRefsString.append(", "); + } + targetNodeRefsString.append(targetNodeRef.toString()); + } + + // Proceed to execute the specified action on the specified node. + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Executing Record Action ") + .append(actionName) + .append(", (") + .append(targetNodeRefsString.toString()) + .append("), ") + .append(actionParams); + logger.debug(msg.toString()); + } + + Map model = new HashMap(); + if (targetNodeRefs.isEmpty()) + { + RecordsManagementActionResult result = this.rmActionService.executeRecordsManagementAction(actionName, actionParams); + if (result.getValue() != null) + { + model.put("result", result.getValue().toString()); + } + } + else + { + Map resultMap = this.rmActionService.executeRecordsManagementAction(targetNodeRefs, actionName, actionParams); + Map results = new HashMap(resultMap.size()); + for (Map.Entry entry : resultMap.entrySet()) + { + Object value = entry.getValue().getValue(); + if (value != null) + { + results.put(entry.getKey().toString(), value.toString()); + } + } + model.put("results", results); + } + + model.put("message", "Successfully queued action [" + actionName + "] on " + targetNodeRefsString.toString()); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferGet.java index 548a4a2ca2..619069c53f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferGet.java @@ -1,107 +1,107 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.File; -import java.io.IOException; - -import org.alfresco.model.ContentModel; -import org.alfresco.model.RenditionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.view.ExporterCrawlerParameters; -import org.alfresco.service.cmr.view.Location; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Streams the nodes of a transfer object to the client in the form of an - * ACP file. - * - * @author Gavin Cornwell - */ -@Deprecated -public class TransferGet extends BaseTransferWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(TransferGet.class); - - /** Content Streamer */ - private ContentStreamer contentStreamer; - - /** - * @param contentStreamer - */ - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - @Override - protected File executeTransfer(NodeRef transferNode, - WebScriptRequest req, WebScriptResponse res, - Status status, Cache cache) throws IOException - { - // get all 'transferred' nodes - NodeRef[] itemsToTransfer = getTransferNodes(transferNode); - - // setup the ACP parameters - ExporterCrawlerParameters params = new ExporterCrawlerParameters(); - params.setCrawlSelf(true); - params.setCrawlChildNodes(true); - params.setExportFrom(new Location(itemsToTransfer)); - QName[] excludedAspects = new QName[] { - RenditionModel.ASPECT_RENDITIONED, - ContentModel.ASPECT_THUMBNAILED, - RecordsManagementModel.ASPECT_DISPOSITION_LIFECYCLE, - RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH}; - params.setExcludeAspects(excludedAspects); - - // create an archive of all the nodes to transfer - File tempFile = createACP(params, ZIP_EXTENSION, true); - - if (logger.isDebugEnabled()) - { - logger.debug("Creating transfer archive for " + itemsToTransfer.length + - " items into file: " + tempFile.getAbsolutePath()); - } - - // stream the archive back to the client as an attachment (forcing save as) - contentStreamer.streamContent(req, res, tempFile, null, true, tempFile.getName(), null); - - // return the temp file for deletion - return tempFile; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.File; +import java.io.IOException; + +import org.alfresco.model.ContentModel; +import org.alfresco.model.RenditionModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; +import org.alfresco.repo.web.scripts.content.ContentStreamer; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.view.ExporterCrawlerParameters; +import org.alfresco.service.cmr.view.Location; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; + +/** + * Streams the nodes of a transfer object to the client in the form of an + * ACP file. + * + * @author Gavin Cornwell + */ +@Deprecated +public class TransferGet extends BaseTransferWebScript +{ + /** Logger */ + private static Log logger = LogFactory.getLog(TransferGet.class); + + /** Content Streamer */ + private ContentStreamer contentStreamer; + + /** + * @param contentStreamer + */ + public void setContentStreamer(ContentStreamer contentStreamer) + { + this.contentStreamer = contentStreamer; + } + + @Override + protected File executeTransfer(NodeRef transferNode, + WebScriptRequest req, WebScriptResponse res, + Status status, Cache cache) throws IOException + { + // get all 'transferred' nodes + NodeRef[] itemsToTransfer = getTransferNodes(transferNode); + + // setup the ACP parameters + ExporterCrawlerParameters params = new ExporterCrawlerParameters(); + params.setCrawlSelf(true); + params.setCrawlChildNodes(true); + params.setExportFrom(new Location(itemsToTransfer)); + QName[] excludedAspects = new QName[] { + RenditionModel.ASPECT_RENDITIONED, + ContentModel.ASPECT_THUMBNAILED, + RecordsManagementModel.ASPECT_DISPOSITION_LIFECYCLE, + RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH}; + params.setExcludeAspects(excludedAspects); + + // create an archive of all the nodes to transfer + File tempFile = createACP(params, ZIP_EXTENSION, true); + + if (logger.isDebugEnabled()) + { + logger.debug("Creating transfer archive for " + itemsToTransfer.length + + " items into file: " + tempFile.getAbsolutePath()); + } + + // stream the archive back to the client as an attachment (forcing save as) + contentStreamer.streamContent(req, res, tempFile, null, true, tempFile.getName(), null); + + // return the temp file for deletion + return tempFile; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportGet.java index 9beb7787e4..0478484e0d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportGet.java @@ -1,297 +1,297 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.Date; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.web.scripts.content.ContentStreamer; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.TempFileProvider; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Returns a JSON representation of a transfer report. - * - * @author Gavin Cornwell - */ -@Deprecated -public class TransferReportGet extends BaseTransferWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(TransferReportGet.class); - - protected static final String REPORT_FILE_PREFIX = "report_"; - protected static final String REPORT_FILE_SUFFIX = ".json"; - - protected DictionaryService ddService; - protected DispositionService dispositionService; - protected ContentStreamer contentStreamer; - - /** - * Sets the DictionaryService instance - * - * @param ddService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService ddService) - { - this.ddService = ddService; - } - - /** - * Sets the disposition service - * - * @param dispositionService the disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param contentStreamer - */ - public void setContentStreamer(ContentStreamer contentStreamer) - { - this.contentStreamer = contentStreamer; - } - - @Override - protected File executeTransfer(NodeRef transferNode, - WebScriptRequest req, WebScriptResponse res, - Status status, Cache cache) throws IOException - { - // generate the report (will be in JSON format) - File report = generateJSONTransferReport(transferNode); - - // stream the report back to the client - contentStreamer.streamContent(req, res, report, null, false, null, null); - - // return the file for deletion - return report; - } - - /** - * Generates a File containing the JSON representation of a transfer report. - * - * @param transferNode The transfer node - * @return File containing JSON representation of a transfer report - * @throws IOException - */ - File generateJSONTransferReport(NodeRef transferNode) throws IOException - { - File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX); - Writer writer = null; - try - { - // get all 'transferred' nodes - NodeRef[] itemsToTransfer = getTransferNodes(transferNode); - - if (logger.isDebugEnabled()) - { - logger.debug("Generating JSON transfer report for " + itemsToTransfer.length + - " items into file: " + report.getAbsolutePath()); - } - - // create the writer - writer = new OutputStreamWriter(new FileOutputStream(report), Charset.forName("UTF-8")); - - // use RMService to get disposition authority - String dispositionAuthority = null; - if (itemsToTransfer.length > 0) - { - // use the first transfer item to get to disposition schedule - DispositionSchedule ds = dispositionService.getDispositionSchedule(itemsToTransfer[0]); - if (ds != null) - { - dispositionAuthority = ds.getDispositionAuthority(); - } - } - - // write the JSON header - writer.write("{\n\t\"data\":\n\t{"); - writer.write("\n\t\t\"transferDate\": \""); - writer.write(ISO8601DateFormat.format( - (Date)this.nodeService.getProperty(transferNode, ContentModel.PROP_CREATED))); - writer.write("\",\n\t\t\"transferPerformedBy\": \""); - writer.write(AuthenticationUtil.getRunAsUser()); - writer.write("\",\n\t\t\"dispositionAuthority\": \""); - writer.write(dispositionAuthority != null ? dispositionAuthority : ""); - writer.write("\",\n\t\t\"items\":\n\t\t["); - - // write out JSON representation of items to transfer - generateTransferItemsJSON(writer, itemsToTransfer); - - // write the JSON footer - writer.write("\n\t\t]\n\t}\n}"); - } - finally - { - if (writer != null) - { - try { writer.close(); } catch (IOException ioe) {} - } - } - - return report; - } - - /** - * Generates the JSON to represent the given NodeRefs - * - * @param writer Writer to write to - * @param itemsToTransfer NodeRefs being transferred - * @throws IOException - */ - protected void generateTransferItemsJSON(Writer writer, NodeRef[] itemsToTransfer) - throws IOException - { - boolean first = true; - for (NodeRef item : itemsToTransfer) - { - if (first) - { - first = false; - } - else - { - writer.write(","); - } - - if (ddService.isSubClass(nodeService.getType(item), ContentModel.TYPE_FOLDER)) - { - generateTransferFolderJSON(writer, item); - } - else - { - generateTransferRecordJSON(writer, item); - } - } - } - - /** - * Generates the JSON to represent the given folder. - * - * @param writer Writer to write to - * @param folderNode Folder being transferred - * @throws IOException - */ - protected void generateTransferFolderJSON(Writer writer, NodeRef folderNode) - throws IOException - { - // TODO: Add identation - - writer.write("\n{\n\"type\":\"folder\",\n"); - writer.write("\"name\":\""); - writer.write((String)nodeService.getProperty(folderNode, ContentModel.PROP_NAME)); - writer.write("\",\n\"nodeRef\":\""); - writer.write(folderNode.toString()); - writer.write("\",\n\"id\":\""); - writer.write((String)nodeService.getProperty(folderNode, RecordsManagementModel.PROP_IDENTIFIER)); - writer.write("\",\n\"children\":\n["); - - boolean first = true; - List assocs = this.nodeService.getChildAssocs(folderNode, - ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : assocs) - { - if (first) - { - first = false; - } - else - { - writer.write(","); - } - - NodeRef childRef = child.getChildRef(); - if (ddService.isSubClass(nodeService.getType(childRef), ContentModel.TYPE_FOLDER)) - { - generateTransferFolderJSON(writer, childRef); - } - else - { - generateTransferRecordJSON(writer, childRef); - } - } - - writer.write("\n]\n}"); - } - - /** - * Generates the JSON to represent the given record. - * - * @param writer Writer to write to - * @param recordNode Record being transferred - * @throws IOException - */ - protected void generateTransferRecordJSON(Writer writer, NodeRef recordNode) - throws IOException - { - writer.write("\n{\n\"type\":\"record\",\n"); - writer.write("\"name\":\""); - writer.write((String)nodeService.getProperty(recordNode, ContentModel.PROP_NAME)); - writer.write("\",\n\"nodeRef\":\""); - writer.write(recordNode.toString()); - writer.write("\",\n\"id\":\""); - writer.write((String)nodeService.getProperty(recordNode, RecordsManagementModel.PROP_IDENTIFIER)); - writer.write("\""); - - if (this.nodeService.hasAspect(recordNode, RecordsManagementModel.ASPECT_DECLARED_RECORD)) - { - writer.write(",\n\"declaredBy\":\""); - writer.write((String)nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_BY)); - writer.write("\",\n\"declaredAt\":\""); - writer.write(ISO8601DateFormat.format( - (Date)this.nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_AT))); - writer.write("\""); - } - - writer.write("\n}"); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.nio.charset.Charset; +import java.util.Date; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.web.scripts.content.ContentStreamer; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.TempFileProvider; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.extensions.surf.util.ISO8601DateFormat; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; + +/** + * Returns a JSON representation of a transfer report. + * + * @author Gavin Cornwell + */ +@Deprecated +public class TransferReportGet extends BaseTransferWebScript +{ + /** Logger */ + private static Log logger = LogFactory.getLog(TransferReportGet.class); + + protected static final String REPORT_FILE_PREFIX = "report_"; + protected static final String REPORT_FILE_SUFFIX = ".json"; + + protected DictionaryService ddService; + protected DispositionService dispositionService; + protected ContentStreamer contentStreamer; + + /** + * Sets the DictionaryService instance + * + * @param ddService The DictionaryService instance + */ + public void setDictionaryService(DictionaryService ddService) + { + this.ddService = ddService; + } + + /** + * Sets the disposition service + * + * @param dispositionService the disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param contentStreamer + */ + public void setContentStreamer(ContentStreamer contentStreamer) + { + this.contentStreamer = contentStreamer; + } + + @Override + protected File executeTransfer(NodeRef transferNode, + WebScriptRequest req, WebScriptResponse res, + Status status, Cache cache) throws IOException + { + // generate the report (will be in JSON format) + File report = generateJSONTransferReport(transferNode); + + // stream the report back to the client + contentStreamer.streamContent(req, res, report, null, false, null, null); + + // return the file for deletion + return report; + } + + /** + * Generates a File containing the JSON representation of a transfer report. + * + * @param transferNode The transfer node + * @return File containing JSON representation of a transfer report + * @throws IOException + */ + File generateJSONTransferReport(NodeRef transferNode) throws IOException + { + File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX); + Writer writer = null; + try + { + // get all 'transferred' nodes + NodeRef[] itemsToTransfer = getTransferNodes(transferNode); + + if (logger.isDebugEnabled()) + { + logger.debug("Generating JSON transfer report for " + itemsToTransfer.length + + " items into file: " + report.getAbsolutePath()); + } + + // create the writer + writer = new OutputStreamWriter(new FileOutputStream(report), Charset.forName("UTF-8")); + + // use RMService to get disposition authority + String dispositionAuthority = null; + if (itemsToTransfer.length > 0) + { + // use the first transfer item to get to disposition schedule + DispositionSchedule ds = dispositionService.getDispositionSchedule(itemsToTransfer[0]); + if (ds != null) + { + dispositionAuthority = ds.getDispositionAuthority(); + } + } + + // write the JSON header + writer.write("{\n\t\"data\":\n\t{"); + writer.write("\n\t\t\"transferDate\": \""); + writer.write(ISO8601DateFormat.format( + (Date)this.nodeService.getProperty(transferNode, ContentModel.PROP_CREATED))); + writer.write("\",\n\t\t\"transferPerformedBy\": \""); + writer.write(AuthenticationUtil.getRunAsUser()); + writer.write("\",\n\t\t\"dispositionAuthority\": \""); + writer.write(dispositionAuthority != null ? dispositionAuthority : ""); + writer.write("\",\n\t\t\"items\":\n\t\t["); + + // write out JSON representation of items to transfer + generateTransferItemsJSON(writer, itemsToTransfer); + + // write the JSON footer + writer.write("\n\t\t]\n\t}\n}"); + } + finally + { + if (writer != null) + { + try { writer.close(); } catch (IOException ioe) {} + } + } + + return report; + } + + /** + * Generates the JSON to represent the given NodeRefs + * + * @param writer Writer to write to + * @param itemsToTransfer NodeRefs being transferred + * @throws IOException + */ + protected void generateTransferItemsJSON(Writer writer, NodeRef[] itemsToTransfer) + throws IOException + { + boolean first = true; + for (NodeRef item : itemsToTransfer) + { + if (first) + { + first = false; + } + else + { + writer.write(","); + } + + if (ddService.isSubClass(nodeService.getType(item), ContentModel.TYPE_FOLDER)) + { + generateTransferFolderJSON(writer, item); + } + else + { + generateTransferRecordJSON(writer, item); + } + } + } + + /** + * Generates the JSON to represent the given folder. + * + * @param writer Writer to write to + * @param folderNode Folder being transferred + * @throws IOException + */ + protected void generateTransferFolderJSON(Writer writer, NodeRef folderNode) + throws IOException + { + // TODO: Add identation + + writer.write("\n{\n\"type\":\"folder\",\n"); + writer.write("\"name\":\""); + writer.write((String)nodeService.getProperty(folderNode, ContentModel.PROP_NAME)); + writer.write("\",\n\"nodeRef\":\""); + writer.write(folderNode.toString()); + writer.write("\",\n\"id\":\""); + writer.write((String)nodeService.getProperty(folderNode, RecordsManagementModel.PROP_IDENTIFIER)); + writer.write("\",\n\"children\":\n["); + + boolean first = true; + List assocs = this.nodeService.getChildAssocs(folderNode, + ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef child : assocs) + { + if (first) + { + first = false; + } + else + { + writer.write(","); + } + + NodeRef childRef = child.getChildRef(); + if (ddService.isSubClass(nodeService.getType(childRef), ContentModel.TYPE_FOLDER)) + { + generateTransferFolderJSON(writer, childRef); + } + else + { + generateTransferRecordJSON(writer, childRef); + } + } + + writer.write("\n]\n}"); + } + + /** + * Generates the JSON to represent the given record. + * + * @param writer Writer to write to + * @param recordNode Record being transferred + * @throws IOException + */ + protected void generateTransferRecordJSON(Writer writer, NodeRef recordNode) + throws IOException + { + writer.write("\n{\n\"type\":\"record\",\n"); + writer.write("\"name\":\""); + writer.write((String)nodeService.getProperty(recordNode, ContentModel.PROP_NAME)); + writer.write("\",\n\"nodeRef\":\""); + writer.write(recordNode.toString()); + writer.write("\",\n\"id\":\""); + writer.write((String)nodeService.getProperty(recordNode, RecordsManagementModel.PROP_IDENTIFIER)); + writer.write("\""); + + if (this.nodeService.hasAspect(recordNode, RecordsManagementModel.ASPECT_DECLARED_RECORD)) + { + writer.write(",\n\"declaredBy\":\""); + writer.write((String)nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_BY)); + writer.write("\",\n\"declaredAt\":\""); + writer.write(ISO8601DateFormat.format( + (Date)this.nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_AT))); + writer.write("\""); + } + + writer.write("\n}"); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java index 2dc96d1e37..0f102628e9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java @@ -1,462 +1,462 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Serializable; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -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.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.TempFileProvider; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.ParameterCheck; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; - -/** - * Files a transfer report as a record. - * - * @author Gavin Cornwell - */ -@Deprecated -public class TransferReportPost extends BaseTransferWebScript -{ - /** Logger */ - private static Log logger = LogFactory.getLog(TransferReportPost.class); - - protected static final String REPORT_FILE_PREFIX = "report_"; - protected static final String REPORT_FILE_SUFFIX = ".html"; - protected static final String PARAM_DESTINATION = "destination"; - protected static final String RESPONSE_SUCCESS = "success"; - protected static final String RESPONSE_RECORD = "record"; - protected static final String RESPONSE_RECORD_NAME = "recordName"; - - protected DictionaryService ddService; - protected RecordsManagementActionService rmActionService; - protected DispositionService dispositionService; - protected ContentService contentService; - - /** - * Sets the DictionaryService instance - * - * @param ddService The DictionaryService instance - */ - public void setDictionaryService(DictionaryService ddService) - { - this.ddService = ddService; - } - - /** - * Sets the disposition service - * - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Sets the RecordsManagementActionService instance - * - * @param rmActionService RecordsManagementActionService instance - */ - public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) - { - this.rmActionService = rmActionService; - } - - /** - * Sets the ContentSerivce instance - * - * @param contentService ContentService instance - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - @Override - protected File executeTransfer(NodeRef transferNode, - WebScriptRequest req, WebScriptResponse res, - Status status, Cache cache) throws IOException - { - File report = null; - - // retrieve requested format - String format = req.getFormat(); - Map model = new HashMap(); - model.put("status", status); - model.put("cache", cache); - - try - { - // extract the destination parameter, ensure it's present and it is - // a record folder - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - if (!json.has(PARAM_DESTINATION)) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST, - "Mandatory '" + PARAM_DESTINATION + "' parameter has not been supplied"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return null; - } - - String destinationParam = json.getString(PARAM_DESTINATION); - NodeRef destination = new NodeRef(destinationParam); - - if (!this.nodeService.exists(destination)) - { - status.setCode(HttpServletResponse.SC_NOT_FOUND, - "Node " + destination.toString() + " does not exist"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return null; - } - - // ensure the node is a filePlan object - if (!RecordsManagementModel.TYPE_RECORD_FOLDER.equals(this.nodeService.getType(destination))) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST, - "Node " + destination.toString() + " is not a record folder"); - Map templateModel = createTemplateParameters(req, res, model); - sendStatus(req, res, status, cache, format, templateModel); - return null; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Filing transfer report as record in record folder: " + destination); - } - - // generate the report (will be in JSON format) - report = generateHTMLTransferReport(transferNode); - - // file the report as a record - NodeRef record = fileTransferReport(report, destination); - - if (logger.isDebugEnabled()) - { - logger.debug("Filed transfer report as new record: " + record); - } - - // return success flag and record noderef as JSON - JSONObject responseJSON = new JSONObject(); - responseJSON.put(RESPONSE_SUCCESS, (record != null)); - if (record != null) - { - responseJSON.put(RESPONSE_RECORD, record.toString()); - responseJSON.put(RESPONSE_RECORD_NAME, - (String)nodeService.getProperty(record, ContentModel.PROP_NAME)); - } - - // setup response - String jsonString = responseJSON.toString(); - res.setContentType(MimetypeMap.MIMETYPE_JSON); - res.setContentEncoding("UTF-8"); - res.setHeader("Content-Length", Long.toString(jsonString.length())); - - // write the JSON response - res.getWriter().write(jsonString); - } - catch (JSONException je) - { - throw createStatusException(je, req, res); - } - - // return the file for deletion - return report; - } - - /** - * Generates a File containing the JSON representation of a transfer report. - * - * @param transferNode The transfer node - * @return File containing JSON representation of a transfer report - * @throws IOException - */ - File generateHTMLTransferReport(NodeRef transferNode) throws IOException - { - File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX); - Writer writer = null; - try - { - // get all 'transferred' nodes - NodeRef[] itemsToTransfer = getTransferNodes(transferNode); - - if (logger.isDebugEnabled()) - { - logger.debug("Generating HTML transfer report for " + itemsToTransfer.length + - " items into file: " + report.getAbsolutePath()); - } - - // create the writer - writer = new OutputStreamWriter(new FileOutputStream(report), Charset.forName("UTF-8")); - - // use RMService to get disposition authority - String dispositionAuthority = null; - if (itemsToTransfer.length > 0) - { - // use the first transfer item to get to disposition schedule - DispositionSchedule ds = dispositionService.getDispositionSchedule(itemsToTransfer[0]); - if (ds != null) - { - dispositionAuthority = ds.getDispositionAuthority(); - } - } - - // write the HTML header - writer.write("\n"); - writer.write("\n\n"); - Boolean isAccession = (Boolean)this.nodeService.getProperty(transferNode, PROP_TRANSFER_ACCESSION_INDICATOR); - if (isAccession) - { - writer.write("Accession Report\n"); - } - else - { - writer.write("Transfer Report\n"); - } - writer.write("\n"); - if (isAccession) - { - writer.write("\n

Accession Report

\n"); - } - else - { - writer.write("\n

Transfer Report

\n"); - } - - writer.write(""); - writer.write(""); - writer.write(""); - writer.write(""); - writer.write("
Transfer Date:"); - Date transferDate = (Date)this.nodeService.getProperty(transferNode, ContentModel.PROP_CREATED); - writer.write(StringEscapeUtils.escapeHtml(transferDate.toString())); - writer.write("
Transfer Location:"); - if (isAccession) - { - writer.write("NARA"); - } - else - { - writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(transferNode, - RecordsManagementModel.PROP_TRANSFER_LOCATION))); - } - writer.write("
Performed By:"); - writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(transferNode, - ContentModel.PROP_CREATOR))); - writer.write("
Disposition Authority:"); - writer.write(dispositionAuthority != null ? StringEscapeUtils.escapeHtml(dispositionAuthority) : ""); - writer.write("
\n"); - - writer.write("

Transferred Items

\n"); - - // write out HTML representation of items to transfer - generateTransferItemsHTML(writer, itemsToTransfer); - - // write the HTML footer - writer.write(""); - } - finally - { - if (writer != null) - { - try { writer.close(); } catch (IOException ioe) {} - } - } - - return report; - } - - /** - * Generates the JSON to represent the given NodeRefs - * - * @param writer Writer to write to - * @param itemsToTransfer NodeRefs being transferred - * @throws IOException - */ - protected void generateTransferItemsHTML(Writer writer, NodeRef[] itemsToTransfer) - throws IOException - { - for (NodeRef item : itemsToTransfer) - { - writer.write("
\n"); - if (ddService.isSubClass(nodeService.getType(item), ContentModel.TYPE_FOLDER)) - { - generateTransferFolderHTML(writer, item); - } - else - { - generateTransferRecordHTML(writer, item); - } - writer.write("
\n"); - } - } - - /** - * Generates the JSON to represent the given folder. - * - * @param writer Writer to write to - * @param folderNode Folder being transferred - * @throws IOException - */ - protected void generateTransferFolderHTML(Writer writer, NodeRef folderNode) - throws IOException - { - writer.write(""); - writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(folderNode, - ContentModel.PROP_NAME))); - writer.write(" (Unique Folder Identifier: "); - writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(folderNode, - RecordsManagementModel.PROP_IDENTIFIER))); - writer.write(")\n"); - - writer.write("
\n"); - - // NOTE: we don't expect any nested folder structures so just render - // the records contained in the folder. - - List assocs = this.nodeService.getChildAssocs(folderNode, - ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef child : assocs) - { - NodeRef childRef = child.getChildRef(); - if (this.nodeService.hasAspect(childRef, RecordsManagementModel.ASPECT_RECORD)) - { - generateTransferRecordHTML(writer, childRef); - } - } - - writer.write("\n
\n"); - } - - /** - * Generates the JSON to represent the given record. - * - * @param writer Writer to write to - * @param recordNode Record being transferred - * @throws IOException - */ - protected void generateTransferRecordHTML(Writer writer, NodeRef recordNode) - throws IOException - { - writer.write("
\n"); - writer.write(" "); - writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode, - ContentModel.PROP_NAME))); - writer.write(" (Unique Record Identifier: "); - writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode, - RecordsManagementModel.PROP_IDENTIFIER))); - writer.write(")"); - - if (this.nodeService.hasAspect(recordNode, RecordsManagementModel.ASPECT_DECLARED_RECORD)) - { - Date declaredOn = (Date)this.nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_AT); - writer.write(" declared by "); - writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode, - RecordsManagementModel.PROP_DECLARED_BY))); - writer.write(" on "); - writer.write(StringEscapeUtils.escapeHtml(declaredOn.toString())); - } - - writer.write("\n
\n"); - } - - /** - * Files the given transfer report as a record in the given record folder. - * - * @param report Report to file - * @param destination The destination record folder - * @return NodeRef of the created record - */ - protected NodeRef fileTransferReport(File report, NodeRef destination) - { - ParameterCheck.mandatory("report", report); - ParameterCheck.mandatory("destination", destination); - - NodeRef record = null; - - Map properties = new HashMap(1); - properties.put(ContentModel.PROP_NAME, report.getName()); - - // file the transfer report as an undeclared record - record = this.nodeService.createNode(destination, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, - QName.createValidLocalName(report.getName())), - ContentModel.TYPE_CONTENT, properties).getChildRef(); - - // Set the content - ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_HTML); - writer.setEncoding("UTF-8"); - writer.putContent(report); - - return record; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Serializable; +import java.io.Writer; +import java.nio.charset.Charset; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +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.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.TempFileProvider; +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.surf.util.ParameterCheck; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; + +/** + * Files a transfer report as a record. + * + * @author Gavin Cornwell + */ +@Deprecated +public class TransferReportPost extends BaseTransferWebScript +{ + /** Logger */ + private static Log logger = LogFactory.getLog(TransferReportPost.class); + + protected static final String REPORT_FILE_PREFIX = "report_"; + protected static final String REPORT_FILE_SUFFIX = ".html"; + protected static final String PARAM_DESTINATION = "destination"; + protected static final String RESPONSE_SUCCESS = "success"; + protected static final String RESPONSE_RECORD = "record"; + protected static final String RESPONSE_RECORD_NAME = "recordName"; + + protected DictionaryService ddService; + protected RecordsManagementActionService rmActionService; + protected DispositionService dispositionService; + protected ContentService contentService; + + /** + * Sets the DictionaryService instance + * + * @param ddService The DictionaryService instance + */ + public void setDictionaryService(DictionaryService ddService) + { + this.ddService = ddService; + } + + /** + * Sets the disposition service + * + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Sets the RecordsManagementActionService instance + * + * @param rmActionService RecordsManagementActionService instance + */ + public void setRecordsManagementActionService(RecordsManagementActionService rmActionService) + { + this.rmActionService = rmActionService; + } + + /** + * Sets the ContentSerivce instance + * + * @param contentService ContentService instance + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + @Override + protected File executeTransfer(NodeRef transferNode, + WebScriptRequest req, WebScriptResponse res, + Status status, Cache cache) throws IOException + { + File report = null; + + // retrieve requested format + String format = req.getFormat(); + Map model = new HashMap(); + model.put("status", status); + model.put("cache", cache); + + try + { + // extract the destination parameter, ensure it's present and it is + // a record folder + JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); + if (!json.has(PARAM_DESTINATION)) + { + status.setCode(HttpServletResponse.SC_BAD_REQUEST, + "Mandatory '" + PARAM_DESTINATION + "' parameter has not been supplied"); + Map templateModel = createTemplateParameters(req, res, model); + sendStatus(req, res, status, cache, format, templateModel); + return null; + } + + String destinationParam = json.getString(PARAM_DESTINATION); + NodeRef destination = new NodeRef(destinationParam); + + if (!this.nodeService.exists(destination)) + { + status.setCode(HttpServletResponse.SC_NOT_FOUND, + "Node " + destination.toString() + " does not exist"); + Map templateModel = createTemplateParameters(req, res, model); + sendStatus(req, res, status, cache, format, templateModel); + return null; + } + + // ensure the node is a filePlan object + if (!RecordsManagementModel.TYPE_RECORD_FOLDER.equals(this.nodeService.getType(destination))) + { + status.setCode(HttpServletResponse.SC_BAD_REQUEST, + "Node " + destination.toString() + " is not a record folder"); + Map templateModel = createTemplateParameters(req, res, model); + sendStatus(req, res, status, cache, format, templateModel); + return null; + } + + if (logger.isDebugEnabled()) + { + logger.debug("Filing transfer report as record in record folder: " + destination); + } + + // generate the report (will be in JSON format) + report = generateHTMLTransferReport(transferNode); + + // file the report as a record + NodeRef record = fileTransferReport(report, destination); + + if (logger.isDebugEnabled()) + { + logger.debug("Filed transfer report as new record: " + record); + } + + // return success flag and record noderef as JSON + JSONObject responseJSON = new JSONObject(); + responseJSON.put(RESPONSE_SUCCESS, (record != null)); + if (record != null) + { + responseJSON.put(RESPONSE_RECORD, record.toString()); + responseJSON.put(RESPONSE_RECORD_NAME, + (String)nodeService.getProperty(record, ContentModel.PROP_NAME)); + } + + // setup response + String jsonString = responseJSON.toString(); + res.setContentType(MimetypeMap.MIMETYPE_JSON); + res.setContentEncoding("UTF-8"); + res.setHeader("Content-Length", Long.toString(jsonString.length())); + + // write the JSON response + res.getWriter().write(jsonString); + } + catch (JSONException je) + { + throw createStatusException(je, req, res); + } + + // return the file for deletion + return report; + } + + /** + * Generates a File containing the JSON representation of a transfer report. + * + * @param transferNode The transfer node + * @return File containing JSON representation of a transfer report + * @throws IOException + */ + File generateHTMLTransferReport(NodeRef transferNode) throws IOException + { + File report = TempFileProvider.createTempFile(REPORT_FILE_PREFIX, REPORT_FILE_SUFFIX); + Writer writer = null; + try + { + // get all 'transferred' nodes + NodeRef[] itemsToTransfer = getTransferNodes(transferNode); + + if (logger.isDebugEnabled()) + { + logger.debug("Generating HTML transfer report for " + itemsToTransfer.length + + " items into file: " + report.getAbsolutePath()); + } + + // create the writer + writer = new OutputStreamWriter(new FileOutputStream(report), Charset.forName("UTF-8")); + + // use RMService to get disposition authority + String dispositionAuthority = null; + if (itemsToTransfer.length > 0) + { + // use the first transfer item to get to disposition schedule + DispositionSchedule ds = dispositionService.getDispositionSchedule(itemsToTransfer[0]); + if (ds != null) + { + dispositionAuthority = ds.getDispositionAuthority(); + } + } + + // write the HTML header + writer.write("\n"); + writer.write("\n\n"); + Boolean isAccession = (Boolean)this.nodeService.getProperty(transferNode, PROP_TRANSFER_ACCESSION_INDICATOR); + if (isAccession) + { + writer.write("Accession Report\n"); + } + else + { + writer.write("Transfer Report\n"); + } + writer.write("\n"); + if (isAccession) + { + writer.write("\n

Accession Report

\n"); + } + else + { + writer.write("\n

Transfer Report

\n"); + } + + writer.write(""); + writer.write(""); + writer.write(""); + writer.write(""); + writer.write("
Transfer Date:"); + Date transferDate = (Date)this.nodeService.getProperty(transferNode, ContentModel.PROP_CREATED); + writer.write(StringEscapeUtils.escapeHtml(transferDate.toString())); + writer.write("
Transfer Location:"); + if (isAccession) + { + writer.write("NARA"); + } + else + { + writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(transferNode, + RecordsManagementModel.PROP_TRANSFER_LOCATION))); + } + writer.write("
Performed By:"); + writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(transferNode, + ContentModel.PROP_CREATOR))); + writer.write("
Disposition Authority:"); + writer.write(dispositionAuthority != null ? StringEscapeUtils.escapeHtml(dispositionAuthority) : ""); + writer.write("
\n"); + + writer.write("

Transferred Items

\n"); + + // write out HTML representation of items to transfer + generateTransferItemsHTML(writer, itemsToTransfer); + + // write the HTML footer + writer.write(""); + } + finally + { + if (writer != null) + { + try { writer.close(); } catch (IOException ioe) {} + } + } + + return report; + } + + /** + * Generates the JSON to represent the given NodeRefs + * + * @param writer Writer to write to + * @param itemsToTransfer NodeRefs being transferred + * @throws IOException + */ + protected void generateTransferItemsHTML(Writer writer, NodeRef[] itemsToTransfer) + throws IOException + { + for (NodeRef item : itemsToTransfer) + { + writer.write("
\n"); + if (ddService.isSubClass(nodeService.getType(item), ContentModel.TYPE_FOLDER)) + { + generateTransferFolderHTML(writer, item); + } + else + { + generateTransferRecordHTML(writer, item); + } + writer.write("
\n"); + } + } + + /** + * Generates the JSON to represent the given folder. + * + * @param writer Writer to write to + * @param folderNode Folder being transferred + * @throws IOException + */ + protected void generateTransferFolderHTML(Writer writer, NodeRef folderNode) + throws IOException + { + writer.write(""); + writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(folderNode, + ContentModel.PROP_NAME))); + writer.write(" (Unique Folder Identifier: "); + writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(folderNode, + RecordsManagementModel.PROP_IDENTIFIER))); + writer.write(")\n"); + + writer.write("
\n"); + + // NOTE: we don't expect any nested folder structures so just render + // the records contained in the folder. + + List assocs = this.nodeService.getChildAssocs(folderNode, + ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef child : assocs) + { + NodeRef childRef = child.getChildRef(); + if (this.nodeService.hasAspect(childRef, RecordsManagementModel.ASPECT_RECORD)) + { + generateTransferRecordHTML(writer, childRef); + } + } + + writer.write("\n
\n"); + } + + /** + * Generates the JSON to represent the given record. + * + * @param writer Writer to write to + * @param recordNode Record being transferred + * @throws IOException + */ + protected void generateTransferRecordHTML(Writer writer, NodeRef recordNode) + throws IOException + { + writer.write("
\n"); + writer.write(" "); + writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode, + ContentModel.PROP_NAME))); + writer.write(" (Unique Record Identifier: "); + writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode, + RecordsManagementModel.PROP_IDENTIFIER))); + writer.write(")"); + + if (this.nodeService.hasAspect(recordNode, RecordsManagementModel.ASPECT_DECLARED_RECORD)) + { + Date declaredOn = (Date)this.nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_AT); + writer.write(" declared by "); + writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode, + RecordsManagementModel.PROP_DECLARED_BY))); + writer.write(" on "); + writer.write(StringEscapeUtils.escapeHtml(declaredOn.toString())); + } + + writer.write("\n
\n"); + } + + /** + * Files the given transfer report as a record in the given record folder. + * + * @param report Report to file + * @param destination The destination record folder + * @return NodeRef of the created record + */ + protected NodeRef fileTransferReport(File report, NodeRef destination) + { + ParameterCheck.mandatory("report", report); + ParameterCheck.mandatory("destination", destination); + + NodeRef record = null; + + Map properties = new HashMap(1); + properties.put(ContentModel.PROP_NAME, report.getName()); + + // file the transfer report as an undeclared record + record = this.nodeService.createNode(destination, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, + QName.createValidLocalName(report.getName())), + ContentModel.TYPE_CONTENT, properties).getChildRef(); + + // Set the content + ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_HTML); + writer.setEncoding("UTF-8"); + writer.putContent(report); + + return record; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java index 53f42dc0c6..1b2659db9c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java @@ -1,354 +1,354 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.model.ContentModel; -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.repository.NodeService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PersonService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return user rights report. - * - * @author Gavin Cornwell - */ -public class UserRightsReportGet extends DeclarativeWebScript -{ - protected AuthorityService authorityService; - protected PersonService personService; - protected NodeService nodeService; - protected FilePlanRoleService filePlanRoleService; - protected FilePlanService filePlanService; - - /** - * Sets the AuthorityService instance - * - * @param authorityService AuthorityService instance - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * Sets the PersonService instance - * - * @param personService PersonService instance - */ - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - /** - * Sets the NodeService instance - * - * @param nodeService NodeService instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - NodeRef filePlanNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - if (filePlanNode == null) - { - status.setCode(HttpServletResponse.SC_BAD_REQUEST, - "The default RM site could not be found."); - return null; - } - - // construct all the maps etc. needed to build the model - Map usersMap = new HashMap(8); - Map rolesMap = new HashMap(8); - Map groupsMap = new HashMap(8); - - // iterate over all the roles for the file plan and construct models - Set roles = filePlanRoleService.getRoles(filePlanNode); - for (Role role : roles) - { - // get or create the RoleModel object for current role - String roleName = role.getName(); - RoleModel roleModel = rolesMap.get(roleName); - if (roleModel == null) - { - roleModel = new RoleModel(role); - rolesMap.put(roleName, roleModel); - } - - // get the users for the current RM role - String group = role.getRoleGroupName(); - Set users = authorityService.getContainedAuthorities(AuthorityType.USER, group, false); - roleModel.setUsers(users); - - // setup a user model object for each user - for (String userName : users) - { - UserModel userModel = usersMap.get(userName); - if (userModel == null) - { - NodeRef userRef = this.personService.getPerson(userName); - userModel = new UserModel(userName, - (String)this.nodeService.getProperty(userRef, ContentModel.PROP_FIRSTNAME), - (String)this.nodeService.getProperty(userRef, ContentModel.PROP_LASTNAME)); - usersMap.put(userName, userModel); - } - - userModel.addRole(roleName); - } - - // get the groups for the cuurent RM role - Set groups = authorityService.getContainedAuthorities(AuthorityType.GROUP, group, false); - roleModel.setGroups(groups); - - // setup a user model object for each user in each group - for (String groupName : groups) - { - GroupModel groupModel = groupsMap.get(groupName); - if (groupModel == null) - { - groupModel = new GroupModel(groupName, - authorityService.getAuthorityDisplayName(groupName)); - groupsMap.put(groupName, groupModel); - } - - // get users in each group - Set groupUsers = this.authorityService.getContainedAuthorities(AuthorityType.USER, groupName, true); - for (String userName : groupUsers) - { - UserModel userModel = usersMap.get(userName); - if (userModel == null) - { - NodeRef userRef = this.personService.getPerson(userName); - userModel = new UserModel(userName, - (String)this.nodeService.getProperty(userRef, ContentModel.PROP_FIRSTNAME), - (String)this.nodeService.getProperty(userRef, ContentModel.PROP_LASTNAME)); - usersMap.put(userName, userModel); - } - - userModel.addGroup(groupName); - userModel.addRole(roleName); - groupModel.addUser(userName); - } - } - } - - // add all the lists data to a Map - Map reportModel = new HashMap(4); - reportModel.put("users", usersMap); - reportModel.put("roles", rolesMap); - reportModel.put("groups", groupsMap); - - // create model object with the lists model - Map model = new HashMap(1); - model.put("report", reportModel); - return model; - } - - /** - * Class to represent a role for use in a Freemarker template. - * - * @author Gavin Cornwell - */ - public class RoleModel extends Role - { - private Set users = new HashSet(8); - private Set groups = new HashSet(8); - - public RoleModel(Role role) - { - super(role.getName(), role.getDisplayLabel(), role.getCapabilities(), role.getRoleGroupName()); - } - - public void addUser(String username) - { - this.users.add(username); - } - - public void addGroup(String groupName) - { - this.groups.add(groupName); - } - - public void setUsers(Set users) - { - this.users = users; - } - - public void setGroups(Set groups) - { - this.groups = groups; - } - - public Set getUsers() - { - return this.users; - } - - public Set getGroups() - { - return this.groups; - } - } - - /** - * Class to represent a user for use in a Freemarker template. - * - * @author Gavin Cornwell - */ - public class UserModel - { - private String userName; - private String firstName; - private String lastName; - private Set roles; - private Set groups; - - public UserModel(String userName, String firstName, String lastName) - { - this.userName = userName; - this.firstName = firstName; - this.lastName = lastName; - this.roles = new HashSet(2); - this.groups = new HashSet(2); - } - - public String getUserName() - { - return this.userName; - } - - public String getFirstName() - { - return this.firstName; - } - - public String getLastName() - { - return this.lastName; - } - - public Set getRoles() - { - return this.roles; - } - - public Set getGroups() - { - return this.groups; - } - - public void addRole(String roleName) - { - this.roles.add(roleName); - } - - public void addGroup(String groupName) - { - this.groups.add(groupName); - } - } - - /** - * Class to represent a group for use in a Freemarker template. - * - * @author Gavin Cornwell - */ - public class GroupModel - { - private String name; - private String label; - private Set users; - - public GroupModel(String name, String label) - { - this.name = name; - this.label = label; - this.users = new HashSet(4); - } - - public String getName() - { - return this.name; - } - - public String getDisplayLabel() - { - return this.label; - } - - public Set getUsers() - { - return this.users; - } - - public void addUser(String userName) - { - this.users.add(userName); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.model.ContentModel; +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.repository.NodeService; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.PersonService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return user rights report. + * + * @author Gavin Cornwell + */ +public class UserRightsReportGet extends DeclarativeWebScript +{ + protected AuthorityService authorityService; + protected PersonService personService; + protected NodeService nodeService; + protected FilePlanRoleService filePlanRoleService; + protected FilePlanService filePlanService; + + /** + * Sets the AuthorityService instance + * + * @param authorityService AuthorityService instance + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * Sets the PersonService instance + * + * @param personService PersonService instance + */ + public void setPersonService(PersonService personService) + { + this.personService = personService; + } + + /** + * Sets the NodeService instance + * + * @param nodeService NodeService instance + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + NodeRef filePlanNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + + if (filePlanNode == null) + { + status.setCode(HttpServletResponse.SC_BAD_REQUEST, + "The default RM site could not be found."); + return null; + } + + // construct all the maps etc. needed to build the model + Map usersMap = new HashMap(8); + Map rolesMap = new HashMap(8); + Map groupsMap = new HashMap(8); + + // iterate over all the roles for the file plan and construct models + Set roles = filePlanRoleService.getRoles(filePlanNode); + for (Role role : roles) + { + // get or create the RoleModel object for current role + String roleName = role.getName(); + RoleModel roleModel = rolesMap.get(roleName); + if (roleModel == null) + { + roleModel = new RoleModel(role); + rolesMap.put(roleName, roleModel); + } + + // get the users for the current RM role + String group = role.getRoleGroupName(); + Set users = authorityService.getContainedAuthorities(AuthorityType.USER, group, false); + roleModel.setUsers(users); + + // setup a user model object for each user + for (String userName : users) + { + UserModel userModel = usersMap.get(userName); + if (userModel == null) + { + NodeRef userRef = this.personService.getPerson(userName); + userModel = new UserModel(userName, + (String)this.nodeService.getProperty(userRef, ContentModel.PROP_FIRSTNAME), + (String)this.nodeService.getProperty(userRef, ContentModel.PROP_LASTNAME)); + usersMap.put(userName, userModel); + } + + userModel.addRole(roleName); + } + + // get the groups for the cuurent RM role + Set groups = authorityService.getContainedAuthorities(AuthorityType.GROUP, group, false); + roleModel.setGroups(groups); + + // setup a user model object for each user in each group + for (String groupName : groups) + { + GroupModel groupModel = groupsMap.get(groupName); + if (groupModel == null) + { + groupModel = new GroupModel(groupName, + authorityService.getAuthorityDisplayName(groupName)); + groupsMap.put(groupName, groupModel); + } + + // get users in each group + Set groupUsers = this.authorityService.getContainedAuthorities(AuthorityType.USER, groupName, true); + for (String userName : groupUsers) + { + UserModel userModel = usersMap.get(userName); + if (userModel == null) + { + NodeRef userRef = this.personService.getPerson(userName); + userModel = new UserModel(userName, + (String)this.nodeService.getProperty(userRef, ContentModel.PROP_FIRSTNAME), + (String)this.nodeService.getProperty(userRef, ContentModel.PROP_LASTNAME)); + usersMap.put(userName, userModel); + } + + userModel.addGroup(groupName); + userModel.addRole(roleName); + groupModel.addUser(userName); + } + } + } + + // add all the lists data to a Map + Map reportModel = new HashMap(4); + reportModel.put("users", usersMap); + reportModel.put("roles", rolesMap); + reportModel.put("groups", groupsMap); + + // create model object with the lists model + Map model = new HashMap(1); + model.put("report", reportModel); + return model; + } + + /** + * Class to represent a role for use in a Freemarker template. + * + * @author Gavin Cornwell + */ + public class RoleModel extends Role + { + private Set users = new HashSet(8); + private Set groups = new HashSet(8); + + public RoleModel(Role role) + { + super(role.getName(), role.getDisplayLabel(), role.getCapabilities(), role.getRoleGroupName()); + } + + public void addUser(String username) + { + this.users.add(username); + } + + public void addGroup(String groupName) + { + this.groups.add(groupName); + } + + public void setUsers(Set users) + { + this.users = users; + } + + public void setGroups(Set groups) + { + this.groups = groups; + } + + public Set getUsers() + { + return this.users; + } + + public Set getGroups() + { + return this.groups; + } + } + + /** + * Class to represent a user for use in a Freemarker template. + * + * @author Gavin Cornwell + */ + public class UserModel + { + private String userName; + private String firstName; + private String lastName; + private Set roles; + private Set groups; + + public UserModel(String userName, String firstName, String lastName) + { + this.userName = userName; + this.firstName = firstName; + this.lastName = lastName; + this.roles = new HashSet(2); + this.groups = new HashSet(2); + } + + public String getUserName() + { + return this.userName; + } + + public String getFirstName() + { + return this.firstName; + } + + public String getLastName() + { + return this.lastName; + } + + public Set getRoles() + { + return this.roles; + } + + public Set getGroups() + { + return this.groups; + } + + public void addRole(String roleName) + { + this.roles.add(roleName); + } + + public void addGroup(String groupName) + { + this.groups.add(groupName); + } + } + + /** + * Class to represent a group for use in a Freemarker template. + * + * @author Gavin Cornwell + */ + public class GroupModel + { + private String name; + private String label; + private Set users; + + public GroupModel(String name, String label) + { + this.name = name; + this.label = label; + this.users = new HashSet(4); + } + + public String getName() + { + return this.name; + } + + public String getDisplayLabel() + { + return this.label; + } + + public Set getUsers() + { + return this.users; + } + + public void addUser(String userName) + { + this.users.add(userName); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java index c915abe7bd..d247b228a4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java @@ -1,76 +1,76 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import org.apache.commons.lang.StringUtils; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; - -/** - * Base class for Records management event web scripts - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RMEventBase extends DeclarativeWebScript -{ - /** - * Helper method for getting the value for a key from a JSON object - * - * @param json The request content as JSON object - * @param key The key for which the value should be retrieved (e.g. "eventName") - * @return String The value for the provided key if the key exists, null otherwise - * @throws JSONException If there is no string value for the key - */ - protected String getValue(JSONObject json, String key) throws JSONException - { - String result = null; - if (json.has(key)) - { - result = json.getString(key); - } - return result; - } - - /** - * Helper method for checking the key (e.g. "eventName") - * - * @param key String The key which will be checked - * @param msg String The error message to throw if the key doesn't have a value - */ - protected void doCheck(String key, String msg) - { - if (StringUtils.isBlank(key)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, msg); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import org.apache.commons.lang.StringUtils; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; + +/** + * Base class for Records management event web scripts + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RMEventBase extends DeclarativeWebScript +{ + /** + * Helper method for getting the value for a key from a JSON object + * + * @param json The request content as JSON object + * @param key The key for which the value should be retrieved (e.g. "eventName") + * @return String The value for the provided key if the key exists, null otherwise + * @throws JSONException If there is no string value for the key + */ + protected String getValue(JSONObject json, String key) throws JSONException + { + String result = null; + if (json.has(key)) + { + result = json.getString(key); + } + return result; + } + + /** + * Helper method for checking the key (e.g. "eventName") + * + * @param key String The key which will be checked + * @param msg String The error message to throw if the key doesn't have a value + */ + protected void doCheck(String key, String msg) + { + if (StringUtils.isBlank(key)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, msg); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java index 2f8e529701..de1d4d76d8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventDelete.java @@ -1,87 +1,87 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management event delete web script - * - * @author Roy Wetherall - */ -public class RmEventDelete extends DeclarativeWebScript -{ - /** Reccords management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - // Event name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String eventName = templateVars.get("eventname"); - if (eventName == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided on the URL."); - } - - // Check the event exists - if (!rmEventService.existsEvent(eventName)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The event " + eventName + " does not exist."); - } - - // Remove the event - rmEventService.removeEvent(eventName); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Records management event delete web script + * + * @author Roy Wetherall + */ +public class RmEventDelete extends DeclarativeWebScript +{ + /** Reccords management event service */ + private RecordsManagementEventService rmEventService; + + /** + * Set the records management event service + * + * @param rmEventService + */ + public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) + { + this.rmEventService = rmEventService; + } + + /** + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + // Event name + Map templateVars = req.getServiceMatch().getTemplateVars(); + String eventName = templateVars.get("eventname"); + if (eventName == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided on the URL."); + } + + // Check the event exists + if (!rmEventService.existsEvent(eventName)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "The event " + eventName + " does not exist."); + } + + // Remove the event + rmEventService.removeEvent(eventName); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventGet.java index 7ef655bd5c..695eb73372 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventGet.java @@ -1,86 +1,86 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management event GET web script - * - * @author Roy Wetherall - */ -public class RmEventGet extends DeclarativeWebScript -{ - /** Reccords management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - // Event name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String eventName = templateVars.get("eventname"); - if (eventName == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided on the URL."); - } - - // Check the event exists - if (!rmEventService.existsEvent(eventName)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The event " + eventName + " does not exist."); - } - - // Get the event - RecordsManagementEvent event = rmEventService.getEvent(eventName); - model.put("event", event); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Records management event GET web script + * + * @author Roy Wetherall + */ +public class RmEventGet extends DeclarativeWebScript +{ + /** Reccords management event service */ + private RecordsManagementEventService rmEventService; + + /** + * Set the records management event service + * + * @param rmEventService + */ + public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) + { + this.rmEventService = rmEventService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + // Event name + Map templateVars = req.getServiceMatch().getTemplateVars(); + String eventName = templateVars.get("eventname"); + if (eventName == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided on the URL."); + } + + // Check the event exists + if (!rmEventService.existsEvent(eventName)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "The event " + eventName + " does not exist."); + } + + // Get the event + RecordsManagementEvent event = rmEventService.getEvent(eventName); + model.put("event", event); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java index d9c1737a14..fe303544df 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java @@ -1,157 +1,157 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.util.ParameterCheck; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management event PUT web script - * - * @author Roy Wetherall - */ -public class RmEventPut extends RMEventBase -{ - /** Parameter names */ - public static final String PARAM_EVENTNAME = "eventname"; - - /** Records management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - ParameterCheck.mandatory("req", req); - - Map model = new HashMap(); - JSONObject json = null; - try - { - // Convert the request content to JSON - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // Check the event name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String eventName = templateVars.get(PARAM_EVENTNAME); - if (eventName == null || - eventName.isEmpty() || - !rmEventService.existsEvent(eventName)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided."); - } - - // Check the event display label - String eventDisplayLabel = getValue(json, "eventDisplayLabel"); - doCheck(eventDisplayLabel, "No event display label was provided."); - - // Check the event type - String eventType = getValue(json, "eventType"); - doCheck(eventType, "No event type was provided."); - - // Check if the event can be edited or not - RecordsManagementEvent event = null; - if (canEditEvent(eventDisplayLabel, eventName, eventType)) - { - // Create event - event = rmEventService.addEvent(eventType, eventName, eventDisplayLabel); - } - else - { - // Get event - event = rmEventService.getEvent(eventName); - } - - model.put("event", event); - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - return model; - } - - /** - * Helper method for checking if an event can be edited or not. Throws an - * error if an event with the same display label already exists. - * - * @param eventDisplayLabel The display label of the event - * @param eventName The name of the event - * @param eventType The type of the event - * @return true if the event can be edited, false otherwise - */ - private boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType) - { - boolean canEditEvent; - - try - { - canEditEvent = rmEventService.canEditEvent(eventDisplayLabel, eventName, eventType); - } - catch (AlfrescoRuntimeException are) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, are.getLocalizedMessage(), are); - } - - return canEditEvent; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.util.ParameterCheck; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Records management event PUT web script + * + * @author Roy Wetherall + */ +public class RmEventPut extends RMEventBase +{ + /** Parameter names */ + public static final String PARAM_EVENTNAME = "eventname"; + + /** Records management event service */ + private RecordsManagementEventService rmEventService; + + /** + * Set the records management event service + * + * @param rmEventService + */ + public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) + { + this.rmEventService = rmEventService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + ParameterCheck.mandatory("req", req); + + Map model = new HashMap(); + JSONObject json = null; + try + { + // Convert the request content to JSON + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + + // Check the event name + Map templateVars = req.getServiceMatch().getTemplateVars(); + String eventName = templateVars.get(PARAM_EVENTNAME); + if (eventName == null || + eventName.isEmpty() || + !rmEventService.existsEvent(eventName)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "No event name was provided."); + } + + // Check the event display label + String eventDisplayLabel = getValue(json, "eventDisplayLabel"); + doCheck(eventDisplayLabel, "No event display label was provided."); + + // Check the event type + String eventType = getValue(json, "eventType"); + doCheck(eventType, "No event type was provided."); + + // Check if the event can be edited or not + RecordsManagementEvent event = null; + if (canEditEvent(eventDisplayLabel, eventName, eventType)) + { + // Create event + event = rmEventService.addEvent(eventType, eventName, eventDisplayLabel); + } + else + { + // Get event + event = rmEventService.getEvent(eventName); + } + + model.put("event", event); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + return model; + } + + /** + * Helper method for checking if an event can be edited or not. Throws an + * error if an event with the same display label already exists. + * + * @param eventDisplayLabel The display label of the event + * @param eventName The name of the event + * @param eventType The type of the event + * @return true if the event can be edited, false otherwise + */ + private boolean canEditEvent(String eventDisplayLabel, String eventName, String eventType) + { + boolean canEditEvent; + + try + { + canEditEvent = rmEventService.canEditEvent(eventDisplayLabel, eventName, eventType); + } + catch (AlfrescoRuntimeException are) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, are.getLocalizedMessage(), are); + } + + return canEditEvent; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventTypesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventTypesGet.java index 88722eaa7f..6da4fe179c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventTypesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventTypesGet.java @@ -1,72 +1,72 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management event types GET web script - * - * @author Roy Wetherall - */ -public class RmEventTypesGet extends DeclarativeWebScript -{ - /** Reccords management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - // Get the events - List events = rmEventService.getEventTypes(); - model.put("eventtypes", events); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Records management event types GET web script + * + * @author Roy Wetherall + */ +public class RmEventTypesGet extends DeclarativeWebScript +{ + /** Reccords management event service */ + private RecordsManagementEventService rmEventService; + + /** + * Set the records management event service + * + * @param rmEventService + */ + public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) + { + this.rmEventService = rmEventService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + // Get the events + List events = rmEventService.getEventTypes(); + model.put("eventtypes", events); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsGet.java index 12de528ce1..85a050665c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsGet.java @@ -1,72 +1,72 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management events GET web script - * - * @author Roy Wetherall - */ -public class RmEventsGet extends DeclarativeWebScript -{ - /** Reccords management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - // Get the events - List events = rmEventService.getEvents(); - model.put("events", events); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Records management events GET web script + * + * @author Roy Wetherall + */ +public class RmEventsGet extends DeclarativeWebScript +{ + /** Reccords management event service */ + private RecordsManagementEventService rmEventService; + + /** + * Set the records management event service + * + * @param rmEventService + */ + public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) + { + this.rmEventService = rmEventService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + // Get the events + List events = rmEventService.getEvents(); + model.put("events", events); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsPost.java index 8cb968452e..c8e5b107fc 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventsPost.java @@ -1,157 +1,157 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.util.GUID; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang.StringUtils; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management event POST web script - * - * @author Roy Wetherall - */ -public class RmEventsPost extends RMEventBase -{ - /** Records management event service */ - private RecordsManagementEventService rmEventService; - - /** - * Set the records management event service - * - * @param rmEventService - */ - public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) - { - this.rmEventService = rmEventService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - ParameterCheck.mandatory("req", req); - - Map model = new HashMap(); - JSONObject json = null; - try - { - // Convert the request content to JSON - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // Get the event name - String eventName = getEventName(json); - - // Check the event display label - String eventDisplayLabel = getValue(json, "eventDisplayLabel"); - doCheck(eventDisplayLabel, "No event display label was provided."); - - // Check if the event can be created - canCreateEvent(eventDisplayLabel, eventName); - - // Check the event type - String eventType = getValue(json, "eventType"); - doCheck(eventType, "No event type was provided."); - - // Create event - RecordsManagementEvent event = rmEventService.addEvent(eventType, eventName, eventDisplayLabel); - - model.put("event", event); - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - return model; - } - - /** - * Helper method for getting the event name - * - * @param json The request content as JSON object - * @return String The event name. A generated GUID if it doesn't exist - * @throws JSONException If there is no string value for the key - */ - private String getEventName(JSONObject json) throws JSONException - { - String eventName = getValue(json, "eventName"); - - if (StringUtils.isBlank(eventName)) - { - // Generate the event name - eventName = GUID.generate(); - } - - return eventName; - } - - /** - * Helper method for checking if an event can be created or not. Throws an - * error if the event already exists. - * - * @param eventDisplayLabel The display label of the event - * @param eventName The name of the event - */ - private boolean canCreateEvent(String eventDisplayLabel, String eventName) - { - boolean canCreateEvent = true; - - if (!rmEventService.canCreateEvent(eventDisplayLabel, eventName)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Cannot create event. An event with the display label '" - + eventDisplayLabel + "' already exists."); - } - - return canCreateEvent; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.util.GUID; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Records management event POST web script + * + * @author Roy Wetherall + */ +public class RmEventsPost extends RMEventBase +{ + /** Records management event service */ + private RecordsManagementEventService rmEventService; + + /** + * Set the records management event service + * + * @param rmEventService + */ + public void setRecordsManagementEventService(RecordsManagementEventService rmEventService) + { + this.rmEventService = rmEventService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + ParameterCheck.mandatory("req", req); + + Map model = new HashMap(); + JSONObject json = null; + try + { + // Convert the request content to JSON + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + + // Get the event name + String eventName = getEventName(json); + + // Check the event display label + String eventDisplayLabel = getValue(json, "eventDisplayLabel"); + doCheck(eventDisplayLabel, "No event display label was provided."); + + // Check if the event can be created + canCreateEvent(eventDisplayLabel, eventName); + + // Check the event type + String eventType = getValue(json, "eventType"); + doCheck(eventType, "No event type was provided."); + + // Create event + RecordsManagementEvent event = rmEventService.addEvent(eventType, eventName, eventDisplayLabel); + + model.put("event", event); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + return model; + } + + /** + * Helper method for getting the event name + * + * @param json The request content as JSON object + * @return String The event name. A generated GUID if it doesn't exist + * @throws JSONException If there is no string value for the key + */ + private String getEventName(JSONObject json) throws JSONException + { + String eventName = getValue(json, "eventName"); + + if (StringUtils.isBlank(eventName)) + { + // Generate the event name + eventName = GUID.generate(); + } + + return eventName; + } + + /** + * Helper method for checking if an event can be created or not. Throws an + * error if the event already exists. + * + * @param eventDisplayLabel The display label of the event + * @param eventName The name of the event + */ + private boolean canCreateEvent(String eventDisplayLabel, String eventName) + { + boolean canCreateEvent = true; + + if (!rmEventService.canCreateEvent(eventDisplayLabel, eventName)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Cannot create event. An event with the display label '" + + eventDisplayLabel + "' already exists."); + } + + return canCreateEvent; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleDelete.java index cc133df49a..3f6072ba9e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleDelete.java @@ -1,81 +1,81 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Delete role web script - * - * @author Roy Wetherall - */ -public class RmRoleDelete extends RoleDeclarativeWebScript -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - // Role name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String roleParam = templateVars.get("rolename"); - if (StringUtils.isBlank(roleParam)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); - } - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); - } - - // Check that the role exists - if (!filePlanRoleService.existsRole(filePlan, roleParam)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "The role " + roleParam + " does not exist on the records managment root " + filePlan.toString()); - } - - filePlanRoleService.deleteRole(filePlan, roleParam); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Delete role web script + * + * @author Roy Wetherall + */ +public class RmRoleDelete extends RoleDeclarativeWebScript +{ + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + // Role name + Map templateVars = req.getServiceMatch().getTemplateVars(); + String roleParam = templateVars.get("rolename"); + if (StringUtils.isBlank(roleParam)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); + } + + // get the file plan + NodeRef filePlan = getFilePlan(req); + if (filePlan == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); + } + + // Check that the role exists + if (!filePlanRoleService.existsRole(filePlan, roleParam)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, + "The role " + roleParam + " does not exist on the records managment root " + filePlan.toString()); + } + + filePlanRoleService.deleteRole(filePlan, roleParam); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleGet.java index 6cc826b761..baf8ca9bd5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRoleGet.java @@ -1,78 +1,78 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Role GET web script API - * - * @author Roy Wetherall - */ -public class RmRoleGet extends RoleDeclarativeWebScript -{ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - - // Role name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String roleParam = templateVars.get("rolename"); - if (roleParam == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); - } - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); - } - - // Check that the role exists - if (!filePlanRoleService.existsRole(filePlan, roleParam)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "The role " + roleParam + " does not exist on the records managment root " + filePlan); - } - - RoleItem item = new RoleItem(filePlanRoleService.getRole(filePlan, roleParam)); - model.put("role", item); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Role GET web script API + * + * @author Roy Wetherall + */ +public class RmRoleGet extends RoleDeclarativeWebScript +{ + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + + // Role name + Map templateVars = req.getServiceMatch().getTemplateVars(); + String roleParam = templateVars.get("rolename"); + if (roleParam == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); + } + + // get the file plan + NodeRef filePlan = getFilePlan(req); + if (filePlan == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); + } + + // Check that the role exists + if (!filePlanRoleService.existsRole(filePlan, roleParam)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, + "The role " + roleParam + " does not exist on the records managment root " + filePlan); + } + + RoleItem item = new RoleItem(filePlanRoleService.getRole(filePlan, roleParam)); + model.put("role", item); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolePut.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolePut.java index 3d27e86bb6..4462ce3fcf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolePut.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolePut.java @@ -1,123 +1,123 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.service.cmr.repository.NodeRef; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * - * - * @author Roy Wetherall - */ -public class RmRolePut extends RoleDeclarativeWebScript -{ - private CapabilityService capabilityService; - - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - JSONObject json = null; - try - { - // Role name - Map templateVars = req.getServiceMatch().getTemplateVars(); - String roleParam = templateVars.get("rolename"); - if (roleParam == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); - } - - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - String name = json.getString("name"); - // TODO check - String displayLabel = json.getString("displayLabel"); - // TODO check - - JSONArray capabilitiesArray = json.getJSONArray("capabilities"); - Set capabilites = new HashSet(capabilitiesArray.length()); - for (int i = 0; i < capabilitiesArray.length(); i++) - { - Capability capability = capabilityService.getCapability(capabilitiesArray.getString(i)); - capabilites.add(capability); - } - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); - } - - // Check that the role exists - if (!filePlanRoleService.existsRole(filePlan, roleParam)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, - "The role " + roleParam + " does not exist on the records managment root " + filePlan); - } - - Role role = filePlanRoleService.updateRole(filePlan, name, displayLabel, capabilites); - model.put("role", new RoleItem(role)); - - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.service.cmr.repository.NodeRef; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * + * + * @author Roy Wetherall + */ +public class RmRolePut extends RoleDeclarativeWebScript +{ + private CapabilityService capabilityService; + + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + JSONObject json = null; + try + { + // Role name + Map templateVars = req.getServiceMatch().getTemplateVars(); + String roleParam = templateVars.get("rolename"); + if (roleParam == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "No role name was provided on the URL."); + } + + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + String name = json.getString("name"); + // TODO check + String displayLabel = json.getString("displayLabel"); + // TODO check + + JSONArray capabilitiesArray = json.getJSONArray("capabilities"); + Set capabilites = new HashSet(capabilitiesArray.length()); + for (int i = 0; i < capabilitiesArray.length(); i++) + { + Capability capability = capabilityService.getCapability(capabilitiesArray.getString(i)); + capabilites.add(capability); + } + + // get the file plan + NodeRef filePlan = getFilePlan(req); + if (filePlan == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); + } + + // Check that the role exists + if (!filePlanRoleService.existsRole(filePlan, roleParam)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, + "The role " + roleParam + " does not exist on the records managment root " + filePlan); + } + + Role role = filePlanRoleService.updateRole(filePlan, name, displayLabel, capabilites); + model.put("role", new RoleItem(role)); + + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesGet.java index b0b65c07e6..a14222be73 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesGet.java @@ -1,95 +1,95 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Get information about record management roles - * - * @author Roy Wetherall - */ -public class RmRolesGet extends RoleDeclarativeWebScript -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - Set roles = null; - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_FOUND, "File plan does not exist."); - } - - // get the includesystem parameter - boolean includeSystem = false; - String includeSystemValue = req.getParameter("is"); - if (includeSystemValue != null && includeSystemValue.length() != 0) - { - includeSystem = Boolean.parseBoolean(includeSystemValue); - } - - // get the user filter - String user = req.getParameter("user"); - if (user != null && user.length() != 0) - { - roles = filePlanRoleService.getRolesByUser(filePlan, user, includeSystem); - } - else - { - roles = filePlanRoleService.getRoles(filePlan, includeSystem); - } - - // get the auths parameter - boolean showAuths = false; - String auths = req.getParameter("auths"); - if (auths != null && auths.length() != 0) - { - showAuths = Boolean.parseBoolean(auths); - } - - Set items = createRoleItems(filePlan, roles, showAuths); - model.put("roles", items); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Get information about record management roles + * + * @author Roy Wetherall + */ +public class RmRolesGet extends RoleDeclarativeWebScript +{ + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + Set roles = null; + + // get the file plan + NodeRef filePlan = getFilePlan(req); + if (filePlan == null) + { + throw new WebScriptException(Status.STATUS_FOUND, "File plan does not exist."); + } + + // get the includesystem parameter + boolean includeSystem = false; + String includeSystemValue = req.getParameter("is"); + if (includeSystemValue != null && includeSystemValue.length() != 0) + { + includeSystem = Boolean.parseBoolean(includeSystemValue); + } + + // get the user filter + String user = req.getParameter("user"); + if (user != null && user.length() != 0) + { + roles = filePlanRoleService.getRolesByUser(filePlan, user, includeSystem); + } + else + { + roles = filePlanRoleService.getRoles(filePlan, includeSystem); + } + + // get the auths parameter + boolean showAuths = false; + String auths = req.getParameter("auths"); + if (auths != null && auths.length() != 0) + { + showAuths = Boolean.parseBoolean(auths); + } + + Set items = createRoleItems(filePlan, roles, showAuths); + model.put("roles", items); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesPost.java index 63cb66fa07..825f78c11d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmRolesPost.java @@ -1,108 +1,108 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.service.cmr.repository.NodeRef; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * RM Roles Post implementation - * - * @author Roy Wetherall - */ -public class RmRolesPost extends RoleDeclarativeWebScript -{ - private CapabilityService capabilityService; - - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - @Override - public Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(); - JSONObject json = null; - try - { - json = new JSONObject(new JSONTokener(req.getContent().getContent())); - String name = json.getString("name"); - // TODO check - String displayString = json.getString("displayLabel"); - // TODO check - - JSONArray capabilitiesArray = json.getJSONArray("capabilities"); - Set capabilites = new HashSet(capabilitiesArray.length()); - for (int i = 0; i < capabilitiesArray.length(); i++) - { - Capability capability = capabilityService.getCapability(capabilitiesArray.getString(i)); - capabilites.add(capability); - } - - // get the file plan - NodeRef filePlan = getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); - } - - Role role = filePlanRoleService.createRole(filePlan, name, displayString, capabilites); - model.put("role", new RoleItem(role)); - - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.service.cmr.repository.NodeRef; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * RM Roles Post implementation + * + * @author Roy Wetherall + */ +public class RmRolesPost extends RoleDeclarativeWebScript +{ + private CapabilityService capabilityService; + + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + @Override + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(); + JSONObject json = null; + try + { + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + String name = json.getString("name"); + // TODO check + String displayString = json.getString("displayLabel"); + // TODO check + + JSONArray capabilitiesArray = json.getJSONArray("capabilities"); + Set capabilites = new HashSet(capabilitiesArray.length()); + for (int i = 0; i < capabilitiesArray.length(); i++) + { + Capability capability = capabilityService.getCapability(capabilitiesArray.getString(i)); + capabilites.add(capability); + } + + // get the file plan + NodeRef filePlan = getFilePlan(req); + if (filePlan == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "File plan does not exist."); + } + + Role role = filePlanRoleService.createRole(filePlan, name, displayString, capabilites); + model.put("role", new RoleItem(role)); + + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java index d603b204ee..127a4cef8d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java @@ -1,293 +1,293 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.admin; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -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.repository.StoreRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Base declarative web script for role API. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RoleDeclarativeWebScript extends DeclarativeWebScript -{ - /** File plan service */ - protected FilePlanService filePlanService; - - /** File plan role service */ - protected FilePlanRoleService filePlanRoleService; - - /** Authority service */ - protected AuthorityService authorityService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * Utility method to get the file plan from the passed parameters. - * - * @param req - * @return - */ - protected NodeRef getFilePlan(WebScriptRequest req) - { - NodeRef filePlan = null; - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("siteid"); - if (siteId != null) - { - filePlan = filePlanService.getFilePlanBySiteId(siteId); - } - - if (filePlan == null) - { - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String id = templateVars.get("id"); - - if (!StringUtils.isEmpty(storeType) && - !StringUtils.isEmpty(storeId) && - !StringUtils.isEmpty(id)) - { - StoreRef storeRef = new StoreRef(storeType, storeId); - NodeRef nodeRef = new NodeRef(storeRef, id); - if (filePlanService.isFilePlan(nodeRef)) - { - filePlan = nodeRef; - } - } - } - - if (filePlan == null) - { - // Assume we are in a legacy repository and we will grab the default file plan - filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - - return filePlan; - } - - /** - * Create role items - * - * @param filePlan - * @param roles - * @return - */ - protected Set createRoleItems(NodeRef filePlan, Set roles) - { - return createRoleItems(filePlan, roles, false); - } - - /** - * Create role items - * - * @param filePlan - * @param roles - * @param showAuths - * @return - */ - protected Set createRoleItems(NodeRef filePlan, Set roles, boolean showAuths) - { - Set items = new HashSet(roles.size()); - for (Role role : roles) - { - RoleItem item = null; - if (showAuths) - { - item = new RoleItem(role, - createAuthorityItems(filePlanRoleService.getUsersAssignedToRole(filePlan, role.getName())), - createAuthorityItems(filePlanRoleService.getGroupsAssignedToRole(filePlan, role.getName()))); - } - else - { - item = new RoleItem(role); - } - items.add(item); - } - return items; - } - - /** - * Create authority items - * - * @param authorities - * @return - */ - private Set createAuthorityItems(Set authorities) - { - Set result = new HashSet(authorities.size()); - - for (String authority : authorities) - { - String displayLabel = authority; - if (!AuthorityType.getAuthorityType(authority).equals(AuthorityType.USER)) - { - displayLabel = authorityService.getAuthorityDisplayName(authority); - } - result.add(new AuthorityItem(authority, displayLabel)); - } - - return result; - } - - /** - * Role Item Helper Class - * - * @author Roy Wetherall - * @since 2.1 - */ - public class RoleItem - { - private String name; - private String groupShortName; - private String displayLabel; - private Set capabilities; - private boolean showAuths = false; - private Set assignedUsers; - private Set assignedGroups; - - public RoleItem(Role role) - { - this.name = role.getName(); - this.displayLabel = role.getDisplayLabel(); - this.capabilities = role.getCapabilities(); - } - - public RoleItem(Role role, Set assignedUsers, Set assignedGroups) - { - this.name = role.getName(); - this.groupShortName = role.getGroupShortName(); - this.displayLabel = role.getDisplayLabel(); - this.capabilities = role.getCapabilities(); - this.showAuths = true; - this.assignedUsers = assignedUsers; - this.assignedGroups = assignedGroups; - } - - public String getName() - { - return name; - } - - public String getGroupShortName() - { - return groupShortName; - } - - public String getDisplayLabel() - { - return displayLabel; - } - - public Set getCapabilities() - { - return capabilities; - } - - public boolean getShowAuths() - { - return showAuths; - } - - public Set getAssignedGroups() - { - return assignedGroups; - } - - public Set getAssignedUsers() - { - return assignedUsers; - } - } - - /** - * Authority Item Helper Class - * - * @author Roy Wetherall - * @since 2.1 - */ - public class AuthorityItem - { - private String name; - private String displayLabel; - - public AuthorityItem(String name, String displayLabel) - { - this.name = name; - this.displayLabel = displayLabel; - } - - public String getName() - { - return name; - } - - public String getDisplayLabel() - { - return displayLabel; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.admin; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +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.repository.StoreRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Base declarative web script for role API. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RoleDeclarativeWebScript extends DeclarativeWebScript +{ + /** File plan service */ + protected FilePlanService filePlanService; + + /** File plan role service */ + protected FilePlanRoleService filePlanRoleService; + + /** Authority service */ + protected AuthorityService authorityService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * Utility method to get the file plan from the passed parameters. + * + * @param req + * @return + */ + protected NodeRef getFilePlan(WebScriptRequest req) + { + NodeRef filePlan = null; + + Map templateVars = req.getServiceMatch().getTemplateVars(); + String siteId = templateVars.get("siteid"); + if (siteId != null) + { + filePlan = filePlanService.getFilePlanBySiteId(siteId); + } + + if (filePlan == null) + { + String storeType = templateVars.get("store_type"); + String storeId = templateVars.get("store_id"); + String id = templateVars.get("id"); + + if (!StringUtils.isEmpty(storeType) && + !StringUtils.isEmpty(storeId) && + !StringUtils.isEmpty(id)) + { + StoreRef storeRef = new StoreRef(storeType, storeId); + NodeRef nodeRef = new NodeRef(storeRef, id); + if (filePlanService.isFilePlan(nodeRef)) + { + filePlan = nodeRef; + } + } + } + + if (filePlan == null) + { + // Assume we are in a legacy repository and we will grab the default file plan + filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + } + + return filePlan; + } + + /** + * Create role items + * + * @param filePlan + * @param roles + * @return + */ + protected Set createRoleItems(NodeRef filePlan, Set roles) + { + return createRoleItems(filePlan, roles, false); + } + + /** + * Create role items + * + * @param filePlan + * @param roles + * @param showAuths + * @return + */ + protected Set createRoleItems(NodeRef filePlan, Set roles, boolean showAuths) + { + Set items = new HashSet(roles.size()); + for (Role role : roles) + { + RoleItem item = null; + if (showAuths) + { + item = new RoleItem(role, + createAuthorityItems(filePlanRoleService.getUsersAssignedToRole(filePlan, role.getName())), + createAuthorityItems(filePlanRoleService.getGroupsAssignedToRole(filePlan, role.getName()))); + } + else + { + item = new RoleItem(role); + } + items.add(item); + } + return items; + } + + /** + * Create authority items + * + * @param authorities + * @return + */ + private Set createAuthorityItems(Set authorities) + { + Set result = new HashSet(authorities.size()); + + for (String authority : authorities) + { + String displayLabel = authority; + if (!AuthorityType.getAuthorityType(authority).equals(AuthorityType.USER)) + { + displayLabel = authorityService.getAuthorityDisplayName(authority); + } + result.add(new AuthorityItem(authority, displayLabel)); + } + + return result; + } + + /** + * Role Item Helper Class + * + * @author Roy Wetherall + * @since 2.1 + */ + public class RoleItem + { + private String name; + private String groupShortName; + private String displayLabel; + private Set capabilities; + private boolean showAuths = false; + private Set assignedUsers; + private Set assignedGroups; + + public RoleItem(Role role) + { + this.name = role.getName(); + this.displayLabel = role.getDisplayLabel(); + this.capabilities = role.getCapabilities(); + } + + public RoleItem(Role role, Set assignedUsers, Set assignedGroups) + { + this.name = role.getName(); + this.groupShortName = role.getGroupShortName(); + this.displayLabel = role.getDisplayLabel(); + this.capabilities = role.getCapabilities(); + this.showAuths = true; + this.assignedUsers = assignedUsers; + this.assignedGroups = assignedGroups; + } + + public String getName() + { + return name; + } + + public String getGroupShortName() + { + return groupShortName; + } + + public String getDisplayLabel() + { + return displayLabel; + } + + public Set getCapabilities() + { + return capabilities; + } + + public boolean getShowAuths() + { + return showAuths; + } + + public Set getAssignedGroups() + { + return assignedGroups; + } + + public Set getAssignedUsers() + { + return assignedUsers; + } + } + + /** + * Authority Item Helper Class + * + * @author Roy Wetherall + * @since 2.1 + */ + public class AuthorityItem + { + private String name; + private String displayLabel; + + public AuthorityItem(String name, String displayLabel) + { + this.name = name; + this.displayLabel = displayLabel; + } + + public String getName() + { + return name; + } + + public String getDisplayLabel() + { + return displayLabel; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java index 0ca702a87f..c0326c3836 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java @@ -1,224 +1,224 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.capability; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.Group; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Capabilities GET web service implementation. - */ -public class CapabilitiesGet extends DeclarativeWebScript -{ - /** File plan service */ - private FilePlanService filePlanService; - - /** Capability service */ - private CapabilityService capabilityService; - - /** - * @param capabilityService capability service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.web.scripts.content.StreamContent#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map templateVars = req.getServiceMatch().getTemplateVars(); - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String nodeId = templateVars.get("id"); - - NodeRef nodeRef = null; - if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(nodeId)) - { - nodeRef = new NodeRef(new StoreRef(storeType, storeId), nodeId); - } - else - { - // we are talking about the file plan node - // TODO we are making the assumption there is only one file plan here! - nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (nodeRef == null) - { - throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The default file plan node could not be found."); - } - } - - boolean grouped = false; - String groupedString = req.getParameter("grouped"); - if (StringUtils.isNotBlank(groupedString)) - { - grouped = Boolean.parseBoolean(groupedString); - } - - Map model = new TreeMap(); - if (grouped) - { - // Construct the map which is needed to build the model - Map groupedCapabilitiesMap = new TreeMap(); - - List groups = capabilityService.getGroups(); - for (Group group : groups) - { - String capabilityGroupTitle = group.getTitle(); - if (StringUtils.isNotBlank(capabilityGroupTitle)) - { - String capabilityGroupId = group.getId(); - - List capabilities = capabilityService.getCapabilitiesByGroupId(capabilityGroupId); - for (Capability capability : capabilities) - { - String capabilityName = capability.getName(); - String capabilityTitle = capability.getTitle(); - - if (groupedCapabilitiesMap.containsKey(capabilityGroupId)) - { - groupedCapabilitiesMap.get(capabilityGroupId).addCapability(capabilityName, capabilityTitle); - } - else - { - GroupedCapabilities groupedCapabilities = new GroupedCapabilities(capabilityGroupId, capabilityGroupTitle, capabilityName, capabilityTitle); - groupedCapabilities.addCapability(capabilityName, capabilityTitle); - groupedCapabilitiesMap.put(capabilityGroupId, groupedCapabilities); - } - } - } - } - model.put("groupedCapabilities", groupedCapabilitiesMap); - } - else - { - boolean includePrivate = false; - String includePrivateString = req.getParameter("includeAll"); - if (StringUtils.isNotBlank(includePrivateString)) - { - includePrivate = Boolean.parseBoolean(includePrivateString); - } - - Map map = capabilityService.getCapabilitiesAccessState(nodeRef, includePrivate); - List list = new ArrayList(map.size()); - for (Map.Entry entry : map.entrySet()) - { - AccessStatus accessStatus = entry.getValue(); - if (!AccessStatus.DENIED.equals(accessStatus)) - { - Capability capability = entry.getKey(); - list.add(capability.getName()); - } - } - model.put("capabilities", list); - } - - return model; - } - - /** - * Class to represent grouped capabilities for use in a Freemarker template - * - */ - public class GroupedCapabilities - { - private String capabilityGroupId; - private String capabilityGroupTitle; - private String capabilityName; - private String capabilityTitle; - private Map capabilities; - - public GroupedCapabilities(String capabilityGroupId, String capabilityGroupTitle, String capabilityName, String capabilityTitle) - { - this.capabilityGroupId = capabilityGroupId; - this.capabilityGroupTitle = capabilityGroupTitle; - this.capabilityName = capabilityName; - this.capabilityTitle = capabilityTitle; - this.capabilities = new TreeMap(); - } - - public String getGroupId() - { - return this.capabilityGroupId; - } - - public String getGroupTitle() - { - return this.capabilityGroupTitle; - } - - public String getCapabilityName() - { - return this.capabilityName; - } - - public String getCapabilityTitle() - { - return this.capabilityTitle; - } - - public Map getCapabilities() - { - return this.capabilities; - } - - public void addCapability(String capabilityName, String capabilityTitle) - { - this.capabilities.put(capabilityName, capabilityTitle); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.capability; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.capability.Group; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Capabilities GET web service implementation. + */ +public class CapabilitiesGet extends DeclarativeWebScript +{ + /** File plan service */ + private FilePlanService filePlanService; + + /** Capability service */ + private CapabilityService capabilityService; + + /** + * @param capabilityService capability service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.repo.web.scripts.content.StreamContent#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map templateVars = req.getServiceMatch().getTemplateVars(); + String storeType = templateVars.get("store_type"); + String storeId = templateVars.get("store_id"); + String nodeId = templateVars.get("id"); + + NodeRef nodeRef = null; + if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(nodeId)) + { + nodeRef = new NodeRef(new StoreRef(storeType, storeId), nodeId); + } + else + { + // we are talking about the file plan node + // TODO we are making the assumption there is only one file plan here! + nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (nodeRef == null) + { + throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The default file plan node could not be found."); + } + } + + boolean grouped = false; + String groupedString = req.getParameter("grouped"); + if (StringUtils.isNotBlank(groupedString)) + { + grouped = Boolean.parseBoolean(groupedString); + } + + Map model = new TreeMap(); + if (grouped) + { + // Construct the map which is needed to build the model + Map groupedCapabilitiesMap = new TreeMap(); + + List groups = capabilityService.getGroups(); + for (Group group : groups) + { + String capabilityGroupTitle = group.getTitle(); + if (StringUtils.isNotBlank(capabilityGroupTitle)) + { + String capabilityGroupId = group.getId(); + + List capabilities = capabilityService.getCapabilitiesByGroupId(capabilityGroupId); + for (Capability capability : capabilities) + { + String capabilityName = capability.getName(); + String capabilityTitle = capability.getTitle(); + + if (groupedCapabilitiesMap.containsKey(capabilityGroupId)) + { + groupedCapabilitiesMap.get(capabilityGroupId).addCapability(capabilityName, capabilityTitle); + } + else + { + GroupedCapabilities groupedCapabilities = new GroupedCapabilities(capabilityGroupId, capabilityGroupTitle, capabilityName, capabilityTitle); + groupedCapabilities.addCapability(capabilityName, capabilityTitle); + groupedCapabilitiesMap.put(capabilityGroupId, groupedCapabilities); + } + } + } + } + model.put("groupedCapabilities", groupedCapabilitiesMap); + } + else + { + boolean includePrivate = false; + String includePrivateString = req.getParameter("includeAll"); + if (StringUtils.isNotBlank(includePrivateString)) + { + includePrivate = Boolean.parseBoolean(includePrivateString); + } + + Map map = capabilityService.getCapabilitiesAccessState(nodeRef, includePrivate); + List list = new ArrayList(map.size()); + for (Map.Entry entry : map.entrySet()) + { + AccessStatus accessStatus = entry.getValue(); + if (!AccessStatus.DENIED.equals(accessStatus)) + { + Capability capability = entry.getKey(); + list.add(capability.getName()); + } + } + model.put("capabilities", list); + } + + return model; + } + + /** + * Class to represent grouped capabilities for use in a Freemarker template + * + */ + public class GroupedCapabilities + { + private String capabilityGroupId; + private String capabilityGroupTitle; + private String capabilityName; + private String capabilityTitle; + private Map capabilities; + + public GroupedCapabilities(String capabilityGroupId, String capabilityGroupTitle, String capabilityName, String capabilityTitle) + { + this.capabilityGroupId = capabilityGroupId; + this.capabilityGroupTitle = capabilityGroupTitle; + this.capabilityName = capabilityName; + this.capabilityTitle = capabilityTitle; + this.capabilities = new TreeMap(); + } + + public String getGroupId() + { + return this.capabilityGroupId; + } + + public String getGroupTitle() + { + return this.capabilityGroupTitle; + } + + public String getCapabilityName() + { + return this.capabilityName; + } + + public String getCapabilityTitle() + { + return this.capabilityTitle; + } + + public Map getCapabilities() + { + return this.capabilities; + } + + public void addCapability(String capabilityName, String capabilityTitle) + { + this.capabilities.put(capabilityName, capabilityTitle); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java index d34a8e69d0..c22fa3e116 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHold.java @@ -1,260 +1,260 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Base class for the hold webscripts - * - * @author Tuna Aksoy - * @since 2.2 - */ -public abstract class BaseHold extends DeclarativeWebScript -{ - /** Hold Service */ - private HoldService holdService; - - /** record service */ - private RecordService recordService; - - /** record folder service */ - private RecordFolderService recordFolderService; - - /** node service */ - private NodeService nodeService; - - /** - * Set the hold service - * - * @param holdService the hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Returns the hold service - * - * @return Returns the hold service - */ - protected HoldService getHoldService() - { - return this.holdService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - JSONObject json = getJSONFromContent(req); - List holds = getHolds(json); - List nodeRefs = getItemNodeRefs(json); - doAction(holds, nodeRefs); - return new HashMap(); - } - - /** - * Abstract method which will be implemented in the subclasses. - * It will either add the item(s) to the hold(s) or remove it/them from the hold(s) - * - * @param holds List of hold {@link NodeRef}(s) - * @param nodeRefs List of item {@link NodeRef}(s) (record(s) / record folder(s)) which will be either added to the hold(s) or removed from the hold(s) - */ - abstract void doAction(List holds, List nodeRefs); - - /** - * Helper method the get the json object from the request - * - * @param req The webscript request - * @return The json object which was sent in the request body - */ - protected JSONObject getJSONFromContent(WebScriptRequest req) - { - JSONObject json = null; - try - { - String content = req.getContent().getContent(); - json = new JSONObject(new JSONTokener(content)); - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - return json; - } - - /** - * Helper method to get the {@link NodeRef}s for the items(s) (record(s) / record folder(s)) which will be added to the hold(s) - * - * @param json The request content as JSON object - * @return List of item {@link NodeRef}s which will be added to the hold(s) - */ - protected List getItemNodeRefs(JSONObject json) - { - List nodeRefs = new ArrayList(); - try - { - JSONArray nodeRefsArray = json.getJSONArray("nodeRefs"); - for (int i = 0; i < nodeRefsArray.length(); i++) - { - NodeRef nodeReference = new NodeRef(nodeRefsArray.getString(i)); - checkItemNodeRef(nodeReference); - nodeRefs.add(nodeReference); - } - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not get information from the json array.", je); - } - - return nodeRefs; - } - - /** - * Helper method for checking the node reference for an item - * - * @param nodeRef The {@link NodeRef} of an item (record / record folder) - */ - private void checkItemNodeRef(NodeRef nodeRef) - { - // ensure that the node exists - if (!nodeService.exists(nodeRef)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Item being added to hold does not exist."); - } - - // ensure that the node we are adding to the hold is a record or record folder - if (!recordService.isRecord(nodeRef) && !recordFolderService.isRecordFolder(nodeRef)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items added to a hold must be either a record or record folder."); - } - } - - /** - * Helper method to get the list of {@link NodeRef}(s) for the hold(s) which will contain the item (record / record folder) - * - * @param json The request content as JSON object - * @return List of {@link NodeRef}(s) of the hold(s) - */ - protected List getHolds(JSONObject json) - { - List holds = new ArrayList(); - try - { - JSONArray holdsArray = json.getJSONArray("holds"); - for (int i = 0; i < holdsArray.length(); i++) - { - NodeRef nodeRef = new NodeRef(holdsArray.getString(i)); - checkHoldNodeRef(nodeRef); - holds.add(nodeRef); - } - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not get information from the json array.", je); - } - - return holds; - } - - /** - * Helper method for checking the node reference for a hold - * - * @param nodeRef The {@link NodeRef} of a hold - */ - private void checkHoldNodeRef(NodeRef nodeRef) - { - // check the hold exists - if (!nodeService.exists(nodeRef)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The hold does not exist."); - } - - // check the noderef is actually a hold - if (!holdService.isHold(nodeRef)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items are being added to a node that isn't a hold."); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Base class for the hold webscripts + * + * @author Tuna Aksoy + * @since 2.2 + */ +public abstract class BaseHold extends DeclarativeWebScript +{ + /** Hold Service */ + private HoldService holdService; + + /** record service */ + private RecordService recordService; + + /** record folder service */ + private RecordFolderService recordFolderService; + + /** node service */ + private NodeService nodeService; + + /** + * Set the hold service + * + * @param holdService the hold service + */ + public void setHoldService(HoldService holdService) + { + this.holdService = holdService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Returns the hold service + * + * @return Returns the hold service + */ + protected HoldService getHoldService() + { + return this.holdService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + JSONObject json = getJSONFromContent(req); + List holds = getHolds(json); + List nodeRefs = getItemNodeRefs(json); + doAction(holds, nodeRefs); + return new HashMap(); + } + + /** + * Abstract method which will be implemented in the subclasses. + * It will either add the item(s) to the hold(s) or remove it/them from the hold(s) + * + * @param holds List of hold {@link NodeRef}(s) + * @param nodeRefs List of item {@link NodeRef}(s) (record(s) / record folder(s)) which will be either added to the hold(s) or removed from the hold(s) + */ + abstract void doAction(List holds, List nodeRefs); + + /** + * Helper method the get the json object from the request + * + * @param req The webscript request + * @return The json object which was sent in the request body + */ + protected JSONObject getJSONFromContent(WebScriptRequest req) + { + JSONObject json = null; + try + { + String content = req.getContent().getContent(); + json = new JSONObject(new JSONTokener(content)); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + return json; + } + + /** + * Helper method to get the {@link NodeRef}s for the items(s) (record(s) / record folder(s)) which will be added to the hold(s) + * + * @param json The request content as JSON object + * @return List of item {@link NodeRef}s which will be added to the hold(s) + */ + protected List getItemNodeRefs(JSONObject json) + { + List nodeRefs = new ArrayList(); + try + { + JSONArray nodeRefsArray = json.getJSONArray("nodeRefs"); + for (int i = 0; i < nodeRefsArray.length(); i++) + { + NodeRef nodeReference = new NodeRef(nodeRefsArray.getString(i)); + checkItemNodeRef(nodeReference); + nodeRefs.add(nodeReference); + } + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not get information from the json array.", je); + } + + return nodeRefs; + } + + /** + * Helper method for checking the node reference for an item + * + * @param nodeRef The {@link NodeRef} of an item (record / record folder) + */ + private void checkItemNodeRef(NodeRef nodeRef) + { + // ensure that the node exists + if (!nodeService.exists(nodeRef)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Item being added to hold does not exist."); + } + + // ensure that the node we are adding to the hold is a record or record folder + if (!recordService.isRecord(nodeRef) && !recordFolderService.isRecordFolder(nodeRef)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items added to a hold must be either a record or record folder."); + } + } + + /** + * Helper method to get the list of {@link NodeRef}(s) for the hold(s) which will contain the item (record / record folder) + * + * @param json The request content as JSON object + * @return List of {@link NodeRef}(s) of the hold(s) + */ + protected List getHolds(JSONObject json) + { + List holds = new ArrayList(); + try + { + JSONArray holdsArray = json.getJSONArray("holds"); + for (int i = 0; i < holdsArray.length(); i++) + { + NodeRef nodeRef = new NodeRef(holdsArray.getString(i)); + checkHoldNodeRef(nodeRef); + holds.add(nodeRef); + } + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not get information from the json array.", je); + } + + return holds; + } + + /** + * Helper method for checking the node reference for a hold + * + * @param nodeRef The {@link NodeRef} of a hold + */ + private void checkHoldNodeRef(NodeRef nodeRef) + { + // check the hold exists + if (!nodeService.exists(nodeRef)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The hold does not exist."); + } + + // check the noderef is actually a hold + if (!holdService.isHold(nodeRef)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Items are being added to a node that isn't a hold."); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java index 6360b9b32a..8c74e98f0e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/Hold.java @@ -1,77 +1,77 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Hold POJO - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class Hold -{ - /** Hold name */ - private String name; - - /** Hold node reference */ - private NodeRef nodeRef; - - /** - * Constructor - * - * @param name The name of the hold - * @param nodeRef The {@link NodeRef} of the hold - */ - public Hold(String name, NodeRef nodeRef) - { - this.name = name; - this.nodeRef = nodeRef; - } - - /** - * Gets the hold name - * - * @return The name of the hold - */ - public String getName() - { - return this.name; - } - - /** - * Gets the hold node reference - * - * @return The {@link NodeRef} of the hold - */ - public NodeRef getNodeRef() - { - return this.nodeRef; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Hold POJO + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class Hold +{ + /** Hold name */ + private String name; + + /** Hold node reference */ + private NodeRef nodeRef; + + /** + * Constructor + * + * @param name The name of the hold + * @param nodeRef The {@link NodeRef} of the hold + */ + public Hold(String name, NodeRef nodeRef) + { + this.name = name; + this.nodeRef = nodeRef; + } + + /** + * Gets the hold name + * + * @return The name of the hold + */ + public String getName() + { + return this.name; + } + + /** + * Gets the hold node reference + * + * @return The {@link NodeRef} of the hold + */ + public NodeRef getNodeRef() + { + return this.nodeRef; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPost.java index a861890f07..3d55409377 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPost.java @@ -1,50 +1,50 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Implementation for Java backed webscript to add an item to the given hold(s) in the hold container. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class HoldPost extends BaseHold -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, java.util.List) - */ - @Override - void doAction(List holds, List nodeRefs) - { - getHoldService().addToHolds(holds, nodeRefs); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import java.util.List; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Implementation for Java backed webscript to add an item to the given hold(s) in the hold container. + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class HoldPost extends BaseHold +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, java.util.List) + */ + @Override + void doAction(List holds, List nodeRefs) + { + getHoldService().addToHolds(holds, nodeRefs); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPut.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPut.java index 04a6322069..dcd863fe23 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPut.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPut.java @@ -1,50 +1,50 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Implementation for Java backed webscript to remove an item from the given hold(s) in the hold container. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class HoldPut extends BaseHold -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, java.util.List) - */ - @Override - void doAction(List holds, List nodeRefs) - { - getHoldService().removeFromHolds(holds, nodeRefs); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import java.util.List; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Implementation for Java backed webscript to remove an item from the given hold(s) in the hold container. + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class HoldPut extends BaseHold +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.script.hold.BaseHold#doAction(java.util.List, java.util.List) + */ + @Override + void doAction(List holds, List nodeRefs) + { + getHoldService().removeFromHolds(holds, nodeRefs); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java index bd2951a39c..7481edbb3e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGet.java @@ -1,250 +1,250 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to return the list of holds in the hold container. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class HoldsGet extends DeclarativeWebScript -{ - /** File Plan Service */ - private FilePlanService filePlanService; - - /** Node Service */ - private NodeService nodeService; - - /** Hold Service */ - private HoldService holdService; - - /** permission service */ - private PermissionService permissionService; - - /** - * Set the file plan service - * - * @param filePlanService the file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Set the node service - * - * @param nodeService the node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Set the hold service - * - * @param holdService the hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } - - /** - * Set the permission service - * - * @param permissionService the permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - boolean fileOnly = getFileOnly(req); - NodeRef itemNodeRef = getItemNodeRef(req); - List holds = new ArrayList(); - - if (itemNodeRef == null) - { - NodeRef filePlan = getFilePlan(req); - holds.addAll(holdService.getHolds(filePlan)); - } - else - { - boolean includedInHold = getIncludedInHold(req); - holds.addAll(holdService.heldBy(itemNodeRef, includedInHold)); - } - - List holdObjects = new ArrayList(holds.size()); - for (NodeRef nodeRef : holds) - { - // only add if user has filling permisson on the hold - if (!fileOnly || permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED) - { - String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - holdObjects.add(new Hold(name, nodeRef)); - } - } - - Map model = new HashMap(1); - sortHoldByName(holdObjects); - model.put("holds", holdObjects); - - return model; - } - - /** - * Helper method to get the file plan from the request - * - * @param req The webscript request - * @return The {@link NodeRef} of the file plan - */ - private NodeRef getFilePlan(WebScriptRequest req) - { - NodeRef filePlan = null; - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String id = templateVars.get("id"); - - if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(id)) - { - filePlan = new NodeRef(new StoreRef(storeType, storeId), id); - - // check that this node is actually a file plan - if (!nodeService.exists(filePlan) || !filePlanService.isFilePlan(filePlan)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The file plan provided could not be found."); - } - } - else - { - filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The default file plan node could not be found."); - } - } - - return filePlan; - } - - /** - * Helper method to get the item node reference from the request - * - * @param req The webscript request - * @return The {@link NodeRef} of the item (record / record folder) or null if the parameter has not been passed - */ - private NodeRef getItemNodeRef(WebScriptRequest req) - { - String nodeRef = req.getParameter("itemNodeRef"); - NodeRef itemNodeRef = null; - if (StringUtils.isNotBlank(nodeRef)) - { - itemNodeRef = new NodeRef(nodeRef); - } - return itemNodeRef; - } - - /** - * Helper method to get the includeInHold parameter value from the request - * - * @param req The webscript request - * @return The value of the includeInHold parameter - */ - private boolean getIncludedInHold(WebScriptRequest req) - { - boolean result = true; - String includedInHold = req.getParameter("includedInHold"); - if (StringUtils.isNotBlank(includedInHold)) - { - result = Boolean.valueOf(includedInHold).booleanValue(); - } - return result; - } - - private boolean getFileOnly(WebScriptRequest req) - { - boolean result = false; - String fillingOnly = req.getParameter("fileOnly"); - if (StringUtils.isNotBlank(fillingOnly)) - { - result = Boolean.valueOf(fillingOnly).booleanValue(); - } - return result; - } - - /** - * Helper method to sort the holds by their names - * - * @param holds List of holds to sort - */ - private void sortHoldByName(List holds) - { - Collections.sort(holds, new Comparator() - { - @Override - public int compare(Hold h1, Hold h2) - { - return h1.getName().toLowerCase().compareTo(h2.getName().toLowerCase()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to return the list of holds in the hold container. + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class HoldsGet extends DeclarativeWebScript +{ + /** File Plan Service */ + private FilePlanService filePlanService; + + /** Node Service */ + private NodeService nodeService; + + /** Hold Service */ + private HoldService holdService; + + /** permission service */ + private PermissionService permissionService; + + /** + * Set the file plan service + * + * @param filePlanService the file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Set the node service + * + * @param nodeService the node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Set the hold service + * + * @param holdService the hold service + */ + public void setHoldService(HoldService holdService) + { + this.holdService = holdService; + } + + /** + * Set the permission service + * + * @param permissionService the permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + boolean fileOnly = getFileOnly(req); + NodeRef itemNodeRef = getItemNodeRef(req); + List holds = new ArrayList(); + + if (itemNodeRef == null) + { + NodeRef filePlan = getFilePlan(req); + holds.addAll(holdService.getHolds(filePlan)); + } + else + { + boolean includedInHold = getIncludedInHold(req); + holds.addAll(holdService.heldBy(itemNodeRef, includedInHold)); + } + + List holdObjects = new ArrayList(holds.size()); + for (NodeRef nodeRef : holds) + { + // only add if user has filling permisson on the hold + if (!fileOnly || permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED) + { + String name = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); + holdObjects.add(new Hold(name, nodeRef)); + } + } + + Map model = new HashMap(1); + sortHoldByName(holdObjects); + model.put("holds", holdObjects); + + return model; + } + + /** + * Helper method to get the file plan from the request + * + * @param req The webscript request + * @return The {@link NodeRef} of the file plan + */ + private NodeRef getFilePlan(WebScriptRequest req) + { + NodeRef filePlan = null; + + Map templateVars = req.getServiceMatch().getTemplateVars(); + String storeType = templateVars.get("store_type"); + String storeId = templateVars.get("store_id"); + String id = templateVars.get("id"); + + if (StringUtils.isNotBlank(storeType) && StringUtils.isNotBlank(storeId) && StringUtils.isNotBlank(id)) + { + filePlan = new NodeRef(new StoreRef(storeType, storeId), id); + + // check that this node is actually a file plan + if (!nodeService.exists(filePlan) || !filePlanService.isFilePlan(filePlan)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "The file plan provided could not be found."); + } + } + else + { + filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (filePlan == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "The default file plan node could not be found."); + } + } + + return filePlan; + } + + /** + * Helper method to get the item node reference from the request + * + * @param req The webscript request + * @return The {@link NodeRef} of the item (record / record folder) or null if the parameter has not been passed + */ + private NodeRef getItemNodeRef(WebScriptRequest req) + { + String nodeRef = req.getParameter("itemNodeRef"); + NodeRef itemNodeRef = null; + if (StringUtils.isNotBlank(nodeRef)) + { + itemNodeRef = new NodeRef(nodeRef); + } + return itemNodeRef; + } + + /** + * Helper method to get the includeInHold parameter value from the request + * + * @param req The webscript request + * @return The value of the includeInHold parameter + */ + private boolean getIncludedInHold(WebScriptRequest req) + { + boolean result = true; + String includedInHold = req.getParameter("includedInHold"); + if (StringUtils.isNotBlank(includedInHold)) + { + result = Boolean.valueOf(includedInHold).booleanValue(); + } + return result; + } + + private boolean getFileOnly(WebScriptRequest req) + { + boolean result = false; + String fillingOnly = req.getParameter("fileOnly"); + if (StringUtils.isNotBlank(fillingOnly)) + { + result = Boolean.valueOf(fillingOnly).booleanValue(); + } + return result; + } + + /** + * Helper method to sort the holds by their names + * + * @param holds List of holds to sort + */ + private void sortHoldByName(List holds) + { + Collections.sort(holds, new Comparator() + { + @Override + public int compare(Hold h1, Hold h2) + { + return h1.getName().toLowerCase().compareTo(h2.getName().toLowerCase()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesDelete.java index c24cad213e..d40bf76ada 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesDelete.java @@ -1,104 +1,104 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.service.cmr.site.SiteService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records Management saved search DELETE web script - * - * @author Roy Wetherall - */ -public class RMSavedSearchesDelete extends DeclarativeWebScript -{ - /** Records management search service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - protected SiteService siteService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map templateVars = req.getServiceMatch().getTemplateVars(); - - // Get the site id and confirm it's valid - String siteId = templateVars.get("site"); - if (siteId == null || siteId.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); - } - if (siteService.getSite(siteId) == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); - } - - // Get the name of the saved search - String name = templateVars.get("name"); - if (name == null || name.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Saved search name not provided."); - } - - // Delete the saved search - recordsManagementSearchService.deleteSavedSearch(siteId, name); - - // Indicate success in the model - Map model = new HashMap(1); - model.put("success", true); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; +import org.alfresco.service.cmr.site.SiteService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Records Management saved search DELETE web script + * + * @author Roy Wetherall + */ +public class RMSavedSearchesDelete extends DeclarativeWebScript +{ + /** Records management search service */ + protected RecordsManagementSearchService recordsManagementSearchService; + + /** Site service */ + protected SiteService siteService; + + /** + * @param recordsManagementSearchService records management search service + */ + public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) + { + this.recordsManagementSearchService = recordsManagementSearchService; + } + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map templateVars = req.getServiceMatch().getTemplateVars(); + + // Get the site id and confirm it's valid + String siteId = templateVars.get("site"); + if (siteId == null || siteId.length() == 0) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); + } + if (siteService.getSite(siteId) == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); + } + + // Get the name of the saved search + String name = templateVars.get("name"); + if (name == null || name.length() == 0) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Saved search name not provided."); + } + + // Delete the saved search + recordsManagementSearchService.deleteSavedSearch(siteId, name); + + // Indicate success in the model + Map model = new HashMap(1); + model.put("success", true); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesGet.java index e672b25144..006d246156 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesGet.java @@ -1,158 +1,158 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; -import org.alfresco.service.cmr.site.SiteService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * RM saved searches GET web script - * - * @author Roy Wetherall - */ -public class RMSavedSearchesGet extends DeclarativeWebScript -{ - /** Records management search service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - protected SiteService siteService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // create model object with the lists model - Map model = new HashMap(13); - - // Get the site id and confirm it is valid - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("site"); - if (siteId == null || siteId.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); - } - if (siteService.getSite(siteId) == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); - } - - // Get the saved search details - List details = recordsManagementSearchService.getSavedSearches(siteId); - List items = new ArrayList(); - for (SavedSearchDetails savedSearchDetails : details) - { - String name = savedSearchDetails.getName(); - String description = savedSearchDetails.getDescription(); - String query = savedSearchDetails.getCompatibility().getQuery(); - String params = savedSearchDetails.getCompatibility().getParams(); - String sort = savedSearchDetails.getCompatibility().getSort(); - - Item item = new Item(name, description, query, params, sort); - items.add(item); - } - - model.put("savedSearches", items); - return model; - } - - /** - * Item class to contain information about items being placed in model. - */ - public class Item - { - private String name; - private String description; - private String query; - private String params; - private String sort; - - public Item(String name, String description, String query, String params, String sort) - { - this.name = name; - this.description = description; - this.query = query; - this.params = params; - this.sort = sort; - } - - public String getName() - { - return name; - } - - public String getDescription() - { - return description; - } - - public String getQuery() - { - return query; - } - - public String getParams() - { - return params; - } - - public String getSort() - { - return sort; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; +import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; +import org.alfresco.service.cmr.site.SiteService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * RM saved searches GET web script + * + * @author Roy Wetherall + */ +public class RMSavedSearchesGet extends DeclarativeWebScript +{ + /** Records management search service */ + protected RecordsManagementSearchService recordsManagementSearchService; + + /** Site service */ + protected SiteService siteService; + + /** + * @param recordsManagementSearchService records management search service + */ + public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) + { + this.recordsManagementSearchService = recordsManagementSearchService; + } + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // create model object with the lists model + Map model = new HashMap(13); + + // Get the site id and confirm it is valid + Map templateVars = req.getServiceMatch().getTemplateVars(); + String siteId = templateVars.get("site"); + if (siteId == null || siteId.length() == 0) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); + } + if (siteService.getSite(siteId) == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); + } + + // Get the saved search details + List details = recordsManagementSearchService.getSavedSearches(siteId); + List items = new ArrayList(); + for (SavedSearchDetails savedSearchDetails : details) + { + String name = savedSearchDetails.getName(); + String description = savedSearchDetails.getDescription(); + String query = savedSearchDetails.getCompatibility().getQuery(); + String params = savedSearchDetails.getCompatibility().getParams(); + String sort = savedSearchDetails.getCompatibility().getSort(); + + Item item = new Item(name, description, query, params, sort); + items.add(item); + } + + model.put("savedSearches", items); + return model; + } + + /** + * Item class to contain information about items being placed in model. + */ + public class Item + { + private String name; + private String description; + private String query; + private String params; + private String sort; + + public Item(String name, String description, String query, String params, String sort) + { + this.name = name; + this.description = description; + this.query = query; + this.params = params; + this.sort = sort; + } + + public String getName() + { + return name; + } + + public String getDescription() + { + return description; + } + + public String getQuery() + { + return query; + } + + public String getParams() + { + return params; + } + + public String getSort() + { + return sort; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java index 52ac90561c..fa6546cf8f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java @@ -1,168 +1,168 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetailsCompatibility; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Records management saved search POST web script. - * - * @author Roy Wetherall - */ -public class RMSavedSearchesPost extends DeclarativeWebScript -{ - /** Records management search service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - protected SiteService siteService; - - /** Namespace service */ - protected NamespaceService namespaceService; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // Get the site id and confirm it is valid - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("site"); - if (siteId == null || siteId.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); - } - if (siteService.getSite(siteId) == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); - } - - try - { - // Parse the JSON passed in the request - JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - - // Get the details of the saved search - if (!json.has("name")) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'name' parameter was not provided in request body"); - } - String name = json.getString("name"); - String description = null; - if (json.has("description")) - { - description = json.getString("description"); - } - boolean isPublic = true; - if (json.has("public")) - { - isPublic = json.getBoolean("public"); - } - // NOTE: we do not need to worry about the query - if (!json.has("params")) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'params' parameter was not provided in request body"); - } - String params = json.getString("params"); - String sort = null; - if (json.has("sort")) - { - sort = json.getString("sort"); - } - - // Use the compatibility class to create a saved search details and save - String search = SavedSearchDetailsCompatibility.getSearchFromParams(params); - if (search == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Mandatory 'terms' was not provided in 'params' parameter found in the request body"); - } - RecordsManagementSearchParameters searchParameters = SavedSearchDetailsCompatibility.createSearchParameters(params, sort, namespaceService); - recordsManagementSearchService.saveSearch(siteId, name, description, search, searchParameters, isPublic); - - } - catch (IOException iox) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not read content from req.", iox); - } - catch (JSONException je) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, - "Could not parse JSON from req.", je); - } - - // Indicate success in the model - Map model = new HashMap(1); - model.put("success", true); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters; +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; +import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetailsCompatibility; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.NamespaceService; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Records management saved search POST web script. + * + * @author Roy Wetherall + */ +public class RMSavedSearchesPost extends DeclarativeWebScript +{ + /** Records management search service */ + protected RecordsManagementSearchService recordsManagementSearchService; + + /** Site service */ + protected SiteService siteService; + + /** Namespace service */ + protected NamespaceService namespaceService; + + /** + * @param recordsManagementSearchService records management search service + */ + public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) + { + this.recordsManagementSearchService = recordsManagementSearchService; + } + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // Get the site id and confirm it is valid + Map templateVars = req.getServiceMatch().getTemplateVars(); + String siteId = templateVars.get("site"); + if (siteId == null || siteId.length() == 0) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); + } + if (siteService.getSite(siteId) == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); + } + + try + { + // Parse the JSON passed in the request + JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); + + // Get the details of the saved search + if (!json.has("name")) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory 'name' parameter was not provided in request body"); + } + String name = json.getString("name"); + String description = null; + if (json.has("description")) + { + description = json.getString("description"); + } + boolean isPublic = true; + if (json.has("public")) + { + isPublic = json.getBoolean("public"); + } + // NOTE: we do not need to worry about the query + if (!json.has("params")) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory 'params' parameter was not provided in request body"); + } + String params = json.getString("params"); + String sort = null; + if (json.has("sort")) + { + sort = json.getString("sort"); + } + + // Use the compatibility class to create a saved search details and save + String search = SavedSearchDetailsCompatibility.getSearchFromParams(params); + if (search == null) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory 'terms' was not provided in 'params' parameter found in the request body"); + } + RecordsManagementSearchParameters searchParameters = SavedSearchDetailsCompatibility.createSearchParameters(params, sort, namespaceService); + recordsManagementSearchService.saveSearch(siteId, name, description, search, searchParameters, isPublic); + + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + + // Indicate success in the model + Map model = new HashMap(1); + model.put("success", true); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java index cc47d3fa42..887a56b4ec 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java @@ -1,442 +1,442 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot; - -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetailsCompatibility; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * RM search GET web script - * - * @author Roy Wetherall - */ -public class RMSearchGet extends DeclarativeWebScript -{ - /** URL Parameters */ - private static final String PARAM_QUERY = "query"; - private static final String PARAM_SORTBY = "sortby"; - private static final String PARAM_FILTERS = "filters"; - private static final String PARAM_MAX_ITEMS = "maxitems"; - - /** Records management search service */ - protected RecordsManagementSearchService recordsManagementSearchService; - - /** Site service */ - protected SiteService siteService; - - /** Namespace service */ - protected NamespaceService namespaceService; - - /** Node serivce */ - protected NodeService nodeService; - - /** Dictionary service */ - protected DictionaryService dictionaryService; - - /** Permission service */ - protected PermissionService permissionService; - - /** Person service */ - protected PersonService personService; - - /** Person data cache */ - private Map personDataCache = null; - - /** - * @param recordsManagementSearchService records management search service - */ - public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) - { - this.recordsManagementSearchService = recordsManagementSearchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param personService person service - */ - public void setPersonService(PersonService personService) - { - this.personService = personService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - try - { - // Get the site id and confirm it is valid - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("site"); - if (siteId == null || siteId.length() == 0) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); - } - if (siteService.getSite(siteId) == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); - } - - // Get the query parameter - String query = req.getParameter(PARAM_QUERY); - // TODO check that this is there - - String sortby = req.getParameter(PARAM_SORTBY); - // TODO this is optional - - String filters = req.getParameter(PARAM_FILTERS); - // TODO this is optional - - // Convert into a rm search parameter object - RecordsManagementSearchParameters searchParameters = - SavedSearchDetailsCompatibility.createSearchParameters(filters, new String[]{",", "/"}, sortby, namespaceService); - - // Set the max results - String maxItems = req.getParameter(PARAM_MAX_ITEMS); - if (maxItems != null && maxItems.length() != 0) - { - searchParameters.setMaxItems(Integer.parseInt(maxItems)); - } - - // Execute search - List> results = recordsManagementSearchService.search(siteId, query, searchParameters); - - // Reset person data cache - personDataCache = new HashMap(57); - - // Process the result items - List items = new ArrayList(results.size()); - for (Pair pair : results) - { - // FIXME: See RM-478 - // TC 3-3 Create User Groups - try - { - Item item = new Item(pair.getFirst(), pair.getSecond()); - items.add(item); - } - catch(Exception e) {} - } - - // Return model - model.put("items", items); - } - catch (Exception ex) - { - model.put("errorMessage", ex.toString()); - } - return model; - - } - - /** - * Item class to contain information about items being placed in model. - */ - public class Item - { - private NodeRef nodeRef; - private String type; - private int size; - private String parentFolder = ""; - private String browseUrl; - private boolean isContainer; - private String modifiedBy; - private String createdBy; - private Map nodeProperties; - private Map properties; - - public Item(NodeRef parent, NodeRef nodeRef) - { - // Set node ref - this.nodeRef = nodeRef; - - // Get type - QName nodeRefType = nodeService.getType(nodeRef); - this.type = nodeRefType.toPrefixString(namespaceService); - - // Get properties - this.nodeProperties = nodeService.getProperties(nodeRef); - - // Determine if container or not - isContainer = true; - if (dictionaryService.isSubClass(nodeRefType, ContentModel.TYPE_CONTENT)) - { - isContainer = false; - } - - // Get parent node reference -// NodeRef parent = null; -// ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); -// if (assoc != null) -// { -// parent = assoc.getParentRef(); -// } - - if (isContainer) - { - this.size = -1; - - String displayPath = nodeService.getPath(nodeRef).toDisplayPath(nodeService, permissionService); - String[] pathElements = displayPath.split("/"); - if (pathElements.length >= 5) - { - if (pathElements.length > 5) - { - this.parentFolder = (String)nodeService.getProperty(parent, ContentModel.PROP_NAME); - } - - pathElements = (String[])ArrayUtils.subarray(pathElements, 5, pathElements.length); - String newPath = StringUtils.join(pathElements, "/"); - StringBuilder relPath = new StringBuilder("/").append(newPath); - if (relPath.length() > 1) - { - relPath.append("/"); - } - relPath.append(getName()); - try - { - this.browseUrl = "documentlibrary?path=" + URLEncoder.encode(relPath.toString(), "UTF-8").replaceAll("\\+","%20"); - } - catch (UnsupportedEncodingException e) - { - throw new AlfrescoRuntimeException("Could not process search results.", e); - } - } - } - else - { - // Get the document size - ContentData contentData = (ContentData)nodeProperties.get(ContentModel.PROP_CONTENT); - this.size = 0; - if (contentData != null) - { - this.size = (int)contentData.getSize(); - } - - // Set the document parent name - if (parent != null) - { - this.parentFolder = (String)nodeService.getProperty(parent, ContentModel.PROP_NAME); - } - - // Set the document browse URL - this.browseUrl = "document-details?nodeRef=" + nodeRef.toString(); - } - - this.modifiedBy = getDisplayName(getModifiedByUser()); - this.createdBy = getDisplayName(getCreatedByUser()); - - // Process the custom properties - properties = new HashMap(nodeProperties.size()); - for (Map.Entry entry : nodeProperties.entrySet()) - { - QName qName = entry.getKey().getPrefixedQName(namespaceService); - if (!NamespaceService.SYSTEM_MODEL_1_0_URI.equals(qName.getNamespaceURI())) - { - String prefixName = qName.getPrefixString().replace(":", "_"); - properties.put(prefixName, entry.getValue()); - } - } - } - - private String getDisplayName(String userName) - { - String result = personDataCache.get(userName); - if (result == null) - { - NodeRef person = personService.getPerson(userName); - if (person != null) - { - StringBuilder displayName = new StringBuilder(128); - displayName.append(nodeService.getProperty(person, ContentModel.PROP_FIRSTNAME)) - .append(" ") - .append(nodeService.getProperty(person, ContentModel.PROP_LASTNAME)); - result = displayName.toString(); - } - else - { - result = userName; - } - personDataCache.put(userName, result); - } - - return result; - } - - public NodeRef getNodeRef() - { - return nodeRef; - } - - public String getType() - { - return type; - } - - public String getName() - { - return (String)nodeProperties.get(ContentModel.PROP_NAME); - } - - public String getTitle() - { - return (String)nodeProperties.get(ContentModel.PROP_TITLE); - } - - public String getDescription() - { - return (String)nodeProperties.get(ContentModel.PROP_DESCRIPTION); - } - - public Date getModifiedOn() - { - return (Date)nodeProperties.get(ContentModel.PROP_MODIFIED); - } - - public String getModifiedByUser() - { - return (String)nodeProperties.get(ContentModel.PROP_MODIFIER); - } - - public String getModifiedBy() - { - return modifiedBy; - } - - public Date getCreatedOn() - { - return (Date)nodeProperties.get(ContentModel.PROP_CREATED); - } - - public String getCreatedByUser() - { - return (String)nodeProperties.get(ContentModel.PROP_CREATOR); - } - - public String getCreatedBy() - { - return createdBy; - } - - public String getAuthor() - { - return (String)nodeProperties.get(ContentModel.PROP_AUTHOR); - } - - public String getParentFolder() - { - return parentFolder; - } - - public int getSize() - { - return size; - } - - public String getBrowseUrl() - { - return browseUrl; - } - - public Map getProperties() - { - return properties; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters; +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; +import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetailsCompatibility; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * RM search GET web script + * + * @author Roy Wetherall + */ +public class RMSearchGet extends DeclarativeWebScript +{ + /** URL Parameters */ + private static final String PARAM_QUERY = "query"; + private static final String PARAM_SORTBY = "sortby"; + private static final String PARAM_FILTERS = "filters"; + private static final String PARAM_MAX_ITEMS = "maxitems"; + + /** Records management search service */ + protected RecordsManagementSearchService recordsManagementSearchService; + + /** Site service */ + protected SiteService siteService; + + /** Namespace service */ + protected NamespaceService namespaceService; + + /** Node serivce */ + protected NodeService nodeService; + + /** Dictionary service */ + protected DictionaryService dictionaryService; + + /** Permission service */ + protected PermissionService permissionService; + + /** Person service */ + protected PersonService personService; + + /** Person data cache */ + private Map personDataCache = null; + + /** + * @param recordsManagementSearchService records management search service + */ + public void setRecordsManagementSearchService(RecordsManagementSearchService recordsManagementSearchService) + { + this.recordsManagementSearchService = recordsManagementSearchService; + } + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param personService person service + */ + public void setPersonService(PersonService personService) + { + this.personService = personService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1); + try + { + // Get the site id and confirm it is valid + Map templateVars = req.getServiceMatch().getTemplateVars(); + String siteId = templateVars.get("site"); + if (siteId == null || siteId.length() == 0) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Site id not provided."); + } + if (siteService.getSite(siteId) == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); + } + + // Get the query parameter + String query = req.getParameter(PARAM_QUERY); + // TODO check that this is there + + String sortby = req.getParameter(PARAM_SORTBY); + // TODO this is optional + + String filters = req.getParameter(PARAM_FILTERS); + // TODO this is optional + + // Convert into a rm search parameter object + RecordsManagementSearchParameters searchParameters = + SavedSearchDetailsCompatibility.createSearchParameters(filters, new String[]{",", "/"}, sortby, namespaceService); + + // Set the max results + String maxItems = req.getParameter(PARAM_MAX_ITEMS); + if (maxItems != null && maxItems.length() != 0) + { + searchParameters.setMaxItems(Integer.parseInt(maxItems)); + } + + // Execute search + List> results = recordsManagementSearchService.search(siteId, query, searchParameters); + + // Reset person data cache + personDataCache = new HashMap(57); + + // Process the result items + List items = new ArrayList(results.size()); + for (Pair pair : results) + { + // FIXME: See RM-478 + // TC 3-3 Create User Groups + try + { + Item item = new Item(pair.getFirst(), pair.getSecond()); + items.add(item); + } + catch(Exception e) {} + } + + // Return model + model.put("items", items); + } + catch (Exception ex) + { + model.put("errorMessage", ex.toString()); + } + return model; + + } + + /** + * Item class to contain information about items being placed in model. + */ + public class Item + { + private NodeRef nodeRef; + private String type; + private int size; + private String parentFolder = ""; + private String browseUrl; + private boolean isContainer; + private String modifiedBy; + private String createdBy; + private Map nodeProperties; + private Map properties; + + public Item(NodeRef parent, NodeRef nodeRef) + { + // Set node ref + this.nodeRef = nodeRef; + + // Get type + QName nodeRefType = nodeService.getType(nodeRef); + this.type = nodeRefType.toPrefixString(namespaceService); + + // Get properties + this.nodeProperties = nodeService.getProperties(nodeRef); + + // Determine if container or not + isContainer = true; + if (dictionaryService.isSubClass(nodeRefType, ContentModel.TYPE_CONTENT)) + { + isContainer = false; + } + + // Get parent node reference +// NodeRef parent = null; +// ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); +// if (assoc != null) +// { +// parent = assoc.getParentRef(); +// } + + if (isContainer) + { + this.size = -1; + + String displayPath = nodeService.getPath(nodeRef).toDisplayPath(nodeService, permissionService); + String[] pathElements = displayPath.split("/"); + if (pathElements.length >= 5) + { + if (pathElements.length > 5) + { + this.parentFolder = (String)nodeService.getProperty(parent, ContentModel.PROP_NAME); + } + + pathElements = (String[])ArrayUtils.subarray(pathElements, 5, pathElements.length); + String newPath = StringUtils.join(pathElements, "/"); + StringBuilder relPath = new StringBuilder("/").append(newPath); + if (relPath.length() > 1) + { + relPath.append("/"); + } + relPath.append(getName()); + try + { + this.browseUrl = "documentlibrary?path=" + URLEncoder.encode(relPath.toString(), "UTF-8").replaceAll("\\+","%20"); + } + catch (UnsupportedEncodingException e) + { + throw new AlfrescoRuntimeException("Could not process search results.", e); + } + } + } + else + { + // Get the document size + ContentData contentData = (ContentData)nodeProperties.get(ContentModel.PROP_CONTENT); + this.size = 0; + if (contentData != null) + { + this.size = (int)contentData.getSize(); + } + + // Set the document parent name + if (parent != null) + { + this.parentFolder = (String)nodeService.getProperty(parent, ContentModel.PROP_NAME); + } + + // Set the document browse URL + this.browseUrl = "document-details?nodeRef=" + nodeRef.toString(); + } + + this.modifiedBy = getDisplayName(getModifiedByUser()); + this.createdBy = getDisplayName(getCreatedByUser()); + + // Process the custom properties + properties = new HashMap(nodeProperties.size()); + for (Map.Entry entry : nodeProperties.entrySet()) + { + QName qName = entry.getKey().getPrefixedQName(namespaceService); + if (!NamespaceService.SYSTEM_MODEL_1_0_URI.equals(qName.getNamespaceURI())) + { + String prefixName = qName.getPrefixString().replace(":", "_"); + properties.put(prefixName, entry.getValue()); + } + } + } + + private String getDisplayName(String userName) + { + String result = personDataCache.get(userName); + if (result == null) + { + NodeRef person = personService.getPerson(userName); + if (person != null) + { + StringBuilder displayName = new StringBuilder(128); + displayName.append(nodeService.getProperty(person, ContentModel.PROP_FIRSTNAME)) + .append(" ") + .append(nodeService.getProperty(person, ContentModel.PROP_LASTNAME)); + result = displayName.toString(); + } + else + { + result = userName; + } + personDataCache.put(userName, result); + } + + return result; + } + + public NodeRef getNodeRef() + { + return nodeRef; + } + + public String getType() + { + return type; + } + + public String getName() + { + return (String)nodeProperties.get(ContentModel.PROP_NAME); + } + + public String getTitle() + { + return (String)nodeProperties.get(ContentModel.PROP_TITLE); + } + + public String getDescription() + { + return (String)nodeProperties.get(ContentModel.PROP_DESCRIPTION); + } + + public Date getModifiedOn() + { + return (Date)nodeProperties.get(ContentModel.PROP_MODIFIED); + } + + public String getModifiedByUser() + { + return (String)nodeProperties.get(ContentModel.PROP_MODIFIER); + } + + public String getModifiedBy() + { + return modifiedBy; + } + + public Date getCreatedOn() + { + return (Date)nodeProperties.get(ContentModel.PROP_CREATED); + } + + public String getCreatedByUser() + { + return (String)nodeProperties.get(ContentModel.PROP_CREATOR); + } + + public String getCreatedBy() + { + return createdBy; + } + + public String getAuthor() + { + return (String)nodeProperties.get(ContentModel.PROP_AUTHOR); + } + + public String getParentFolder() + { + return parentFolder; + } + + public int getSize() + { + return size; + } + + public String getBrowseUrl() + { + return browseUrl; + } + + public Map getProperties() + { + return properties; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java index 55f1d60578..5862fea42d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchPropertiesGet.java @@ -1,219 +1,219 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * RM search properties GET web script - * - * @author Roy Wetherall - */ -public class RMSearchPropertiesGet extends DeclarativeWebScript -{ - /** Services */ - private RecordsManagementAdminService adminService; - private RecordService recordService; - private DictionaryService dictionaryService; - private NamespaceService namespaceService; - private FilePlanService filePlanService; - - /** - * @param adminService records management admin service - */ - public void setAdminService(RecordsManagementAdminService adminService) - { - this.adminService = adminService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(13); - - List groups = new ArrayList(5); - - // get the file plan - // TODO the file plan should be passed to this web script - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // get the record metadata aspects - Set aspects = recordService.getRecordMetadataAspects(filePlan); - for (QName aspect : aspects) - { - Map properties = dictionaryService.getPropertyDefs(aspect); - Property[] propObjs = new Property[properties.size()]; - int index = 0; - for (PropertyDefinition propertyDefinition : properties.values()) - { - Property propObj = new Property(propertyDefinition); - propObjs[index] = propObj; - index ++; - } - - AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect); - Group group = new Group(aspect.getLocalName(), aspectDefinition.getTitle(dictionaryService), propObjs); - groups.add(group); - } - - Map customProps = adminService.getCustomPropertyDefinitions(); - Property[] propObjs = new Property[customProps.size()]; - int index = 0; - for (PropertyDefinition propertyDefinition : customProps.values()) - { - Property propObj = new Property(propertyDefinition); - propObjs[index] = propObj; - index ++; - } - - Group group = new Group("rmcustom", "Custom", propObjs); - groups.add(group); - - model.put("groups", groups); - return model; - } - - public class Group - { - private String id; - private String label; - private Property[] properties; - - public Group(String id, String label, Property[] properties) - { - this.id = id; - this.label = label; - this.properties = properties.clone(); - } - - public String getId() - { - return id; - } - - public String getLabel() - { - return label; - } - - public Property[] getProperties() - { - return properties; - } - } - - public class Property - { - private String prefix; - private String shortName; - private String label; - private String type; - - public Property(PropertyDefinition propertyDefinition) - { - QName qName = propertyDefinition.getName().getPrefixedQName(namespaceService); - this.prefix = QName.splitPrefixedQName(qName.toPrefixString())[0]; - this.shortName = qName.getLocalName(); - this.label = propertyDefinition.getTitle(dictionaryService); - this.type = propertyDefinition.getDataType().getName().getLocalName(); - } - - public String getPrefix() - { - return prefix; - } - - public String getShortName() - { - return shortName; - } - - public String getLabel() - { - return label; - } - - public String getType() - { - return type; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * RM search properties GET web script + * + * @author Roy Wetherall + */ +public class RMSearchPropertiesGet extends DeclarativeWebScript +{ + /** Services */ + private RecordsManagementAdminService adminService; + private RecordService recordService; + private DictionaryService dictionaryService; + private NamespaceService namespaceService; + private FilePlanService filePlanService; + + /** + * @param adminService records management admin service + */ + public void setAdminService(RecordsManagementAdminService adminService) + { + this.adminService = adminService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(13); + + List groups = new ArrayList(5); + + // get the file plan + // TODO the file plan should be passed to this web script + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + + // get the record metadata aspects + Set aspects = recordService.getRecordMetadataAspects(filePlan); + for (QName aspect : aspects) + { + Map properties = dictionaryService.getPropertyDefs(aspect); + Property[] propObjs = new Property[properties.size()]; + int index = 0; + for (PropertyDefinition propertyDefinition : properties.values()) + { + Property propObj = new Property(propertyDefinition); + propObjs[index] = propObj; + index ++; + } + + AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect); + Group group = new Group(aspect.getLocalName(), aspectDefinition.getTitle(dictionaryService), propObjs); + groups.add(group); + } + + Map customProps = adminService.getCustomPropertyDefinitions(); + Property[] propObjs = new Property[customProps.size()]; + int index = 0; + for (PropertyDefinition propertyDefinition : customProps.values()) + { + Property propObj = new Property(propertyDefinition); + propObjs[index] = propObj; + index ++; + } + + Group group = new Group("rmcustom", "Custom", propObjs); + groups.add(group); + + model.put("groups", groups); + return model; + } + + public class Group + { + private String id; + private String label; + private Property[] properties; + + public Group(String id, String label, Property[] properties) + { + this.id = id; + this.label = label; + this.properties = properties.clone(); + } + + public String getId() + { + return id; + } + + public String getLabel() + { + return label; + } + + public Property[] getProperties() + { + return properties; + } + } + + public class Property + { + private String prefix; + private String shortName; + private String label; + private String type; + + public Property(PropertyDefinition propertyDefinition) + { + QName qName = propertyDefinition.getName().getPrefixedQName(namespaceService); + this.prefix = QName.splitPrefixedQName(qName.toPrefixString())[0]; + this.shortName = qName.getLocalName(); + this.label = propertyDefinition.getTitle(dictionaryService); + this.type = propertyDefinition.getDataType().getName().getLocalName(); + } + + public String getPrefix() + { + return prefix; + } + + public String getShortName() + { + return shortName; + } + + public String getLabel() + { + return label; + } + + public String getType() + { + return type; + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java index 98d9d51d46..93da26e2f2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java @@ -1,84 +1,84 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; -import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * REST API to get the recorded version config for a document - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordedVersionConfigGet extends AbstractRmWebScript -{ - /** Recordable version config service */ - private RecordableVersionConfigService recordableVersionConfigService; - - /** - * Gets the recordable version config service - * - * @return The recordable version config service - */ - protected RecordableVersionConfigService getRecordableVersionConfigService() - { - return this.recordableVersionConfigService; - } - - /** - * Sets the recordable version config service - * - * @param recordableVersionConfigService The recordable version config service - */ - public void setRecordableVersionConfigService(RecordableVersionConfigService recordableVersionConfigService) - { - this.recordableVersionConfigService = recordableVersionConfigService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - NodeRef nodeRef = parseRequestForNodeRef(req); - List recordableVersions = getRecordableVersionConfigService().getVersions(nodeRef); - model.put("recordableVersions", recordableVersions); - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; +import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * REST API to get the recorded version config for a document + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RecordedVersionConfigGet extends AbstractRmWebScript +{ + /** Recordable version config service */ + private RecordableVersionConfigService recordableVersionConfigService; + + /** + * Gets the recordable version config service + * + * @return The recordable version config service + */ + protected RecordableVersionConfigService getRecordableVersionConfigService() + { + return this.recordableVersionConfigService; + } + + /** + * Sets the recordable version config service + * + * @param recordableVersionConfigService The recordable version config service + */ + public void setRecordableVersionConfigService(RecordableVersionConfigService recordableVersionConfigService) + { + this.recordableVersionConfigService = recordableVersionConfigService; + } + + /** + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + Map model = new HashMap(1); + NodeRef nodeRef = parseRequestForNodeRef(req); + List recordableVersions = getRecordableVersionConfigService().getVersions(nodeRef); + model.put("recordableVersions", recordableVersions); + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java index 947440d8c5..60145e54b9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java @@ -1,101 +1,101 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot; - -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; -import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; -import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript; -import org.alfresco.service.cmr.repository.NodeRef; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * REST API to set the recorded version config for a document - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordedVersionConfigPost extends AbstractRmWebScript -{ - /** Constant for recorded version parameter */ - public static final String RECORDED_VERSION = "recordedVersion"; - - /** Recordable version config service */ - private RecordableVersionConfigService recordableVersionConfigService; - - /** - * Gets the recordable version config service - * - * @return The recordable version config service - */ - protected RecordableVersionConfigService getRecordableVersionConfigService() - { - return this.recordableVersionConfigService; - } - - /** - * Sets the recordable version config service - * - * @param recordableVersionConfigService The recordable version config service - */ - public void setRecordableVersionConfigService(RecordableVersionConfigService recordableVersionConfigService) - { - this.recordableVersionConfigService = recordableVersionConfigService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - NodeRef nodeRef = parseRequestForNodeRef(req); - String policy = getRecordableVersionPolicy(req); - getRecordableVersionConfigService().setVersion(nodeRef, policy); - return new HashMap(1); - } - - /** - * Gets the recordable version policy from the request - * - * @param The webscript request - * @return The recordable version policy - */ - private String getRecordableVersionPolicy(WebScriptRequest req) - { - JSONObject requestContent = getRequestContentAsJSONObject(req); - return getStringValueFromJSONObject(requestContent, RECORDED_VERSION); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot; + +import static org.alfresco.util.WebScriptUtils.getRequestContentAsJSONObject; +import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; +import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript; +import org.alfresco.service.cmr.repository.NodeRef; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * REST API to set the recorded version config for a document + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RecordedVersionConfigPost extends AbstractRmWebScript +{ + /** Constant for recorded version parameter */ + public static final String RECORDED_VERSION = "recordedVersion"; + + /** Recordable version config service */ + private RecordableVersionConfigService recordableVersionConfigService; + + /** + * Gets the recordable version config service + * + * @return The recordable version config service + */ + protected RecordableVersionConfigService getRecordableVersionConfigService() + { + return this.recordableVersionConfigService; + } + + /** + * Sets the recordable version config service + * + * @param recordableVersionConfigService The recordable version config service + */ + public void setRecordableVersionConfigService(RecordableVersionConfigService recordableVersionConfigService) + { + this.recordableVersionConfigService = recordableVersionConfigService; + } + + /** + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + NodeRef nodeRef = parseRequestForNodeRef(req); + String policy = getRecordableVersionPolicy(req); + getRecordableVersionConfigService().setVersion(nodeRef, policy); + return new HashMap(1); + } + + /** + * Gets the recordable version policy from the request + * + * @param The webscript request + * @return The recordable version policy + */ + private String getRecordableVersionPolicy(WebScriptRequest req) + { + JSONObject requestContent = getRequestContentAsJSONObject(req); + return getStringValueFromJSONObject(requestContent, RECORDED_VERSION); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java index 4e0798ff1f..574987ee05 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java @@ -1,104 +1,104 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Recordable version class - * - * @author Tuna Aksoy - * @since 2.3 - */ -@AlfrescoPublicApi -public class Version -{ - /** The version policy */ - private String policy; - - /** Is the version selected */ - private boolean selected; - - /** - * Constructor - * - * @param policy The version policy - * @param selected Is the version selected - */ - public Version(String policy, boolean selected) - { - mandatoryString("policy", policy); - mandatory("selected", selected); - - setPolicy(policy); - setSelected(selected); - } - - /** - * Gets the version policy - * - * @return The version policy - */ - public String getPolicy() - { - return this.policy; - } - - /** - * Sets the version policy - * - * @param policy The version policy - */ - private void setPolicy(String policy) - { - this.policy = policy; - } - - /** - * Is the version selected - * - * @return true if the version is selected, false otherwise - */ - public boolean isSelected() - { - return this.selected; - } - - /** - * Sets the version as selected - * - * @param selected true if the version should be selected, false otherwise - */ - private void setSelected(boolean selected) - { - this.selected = selected; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot; + +import static org.alfresco.util.ParameterCheck.mandatory; +import static org.alfresco.util.ParameterCheck.mandatoryString; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Recordable version class + * + * @author Tuna Aksoy + * @since 2.3 + */ +@AlfrescoPublicApi +public class Version +{ + /** The version policy */ + private String policy; + + /** Is the version selected */ + private boolean selected; + + /** + * Constructor + * + * @param policy The version policy + * @param selected Is the version selected + */ + public Version(String policy, boolean selected) + { + mandatoryString("policy", policy); + mandatory("selected", selected); + + setPolicy(policy); + setSelected(selected); + } + + /** + * Gets the version policy + * + * @return The version policy + */ + public String getPolicy() + { + return this.policy; + } + + /** + * Sets the version policy + * + * @param policy The version policy + */ + private void setPolicy(String policy) + { + this.policy = policy; + } + + /** + * Is the version selected + * + * @return true if the version is selected, false otherwise + */ + public boolean isSelected() + { + return this.selected; + } + + /** + * Sets the version as selected + * + * @param selected true if the version should be selected, false otherwise + */ + private void setSelected(boolean selected) + { + this.selected = selected; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java index 242578adce..a9a04c5476 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java @@ -1,225 +1,225 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.slingshot.forms; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * RM metadata used by form extension - * - * @author Roy Wetherall - */ -public class RMMetaDataGet extends DeclarativeWebScript -{ - /** Query parameters */ - private static final String PARAM_NODEREF = "noderef"; - private static final String PARAM_TYPE = "type"; - private static final String PARAM_EXTENDED = "extended"; - - /** NodeRef pattern */ - private static final Pattern NODE_REF_PATTERN = Pattern.compile(".+://.+/.+"); - - /** QName pattern */ - private static final Pattern QNAME_PATTERN = Pattern.compile(".+:[^=,]+"); - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Node service */ - private NodeService nodeService; - - /** File Plan Service */ - private FilePlanService filePlanService; - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /* - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - // create model object with the lists model - Map model = new HashMap(1); - - boolean extended = false; - String result = "NONE"; - - // Get the nodeRef and confirm it is valid - String nodeRef = req.getParameter(PARAM_NODEREF); - if (nodeRef == null || nodeRef.length() == 0) - { - String type = req.getParameter(PARAM_TYPE); - if (type != null && type.length() != 0 && type.indexOf(':') != -1) - { - Matcher m = QNAME_PATTERN.matcher(type); - if (m.matches()) - { - QName qname = QName.createQName(type, namespaceService); - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKindFromType(qname); - if (kind != null) - { - result = kind.toString(); - } - } - } - } - else - { - // quick test before running slow match for full NodeRef pattern - if (nodeRef.indexOf(':') != -1) - { - Matcher m = NODE_REF_PATTERN.matcher(nodeRef); - if (m.matches()) - { - NodeRef nodeRefObj = new NodeRef(nodeRef); - - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRefObj); - if (kind != null) - { - result = kind.toString(); - } - - String extendedValue = req.getParameter(PARAM_EXTENDED); - if (extendedValue != null && extendedValue.length() != 0) - { - extended = Boolean.parseBoolean(extendedValue); - if (extended) - { - // get the aspects of the node - model.put("aspects", getAspects(nodeRefObj)); - } - } - } - } - } - - model.put("kind", result); - model.put("extended", extended); - return model; - } - - /** - * Gets the current node aspects - * - * @return node aspects - */ - public List getAspects(NodeRef nodeRef) - { - Set qnames = nodeService.getAspects(nodeRef); - List aspects = new ArrayList(qnames.size()); - for (QName qname : qnames) - { - aspects.add(new Aspect(qname)); - } - return aspects; - } - - /** - * Qname wrapper class - */ - public class QNameBean implements Serializable - { - private static final long serialVersionUID = 6982292337846270774L; - - protected QName name; - - public QNameBean(QName name) - { - this.name = name; - } - - public String getName() - { - return name.toString(); - } - - public String getPrefixedName() - { - return name.toPrefixString(namespaceService); - } - - public String toString() - { - return getName(); - } - } - - /** - * Aspect wrapper class - */ - public class Aspect extends QNameBean - { - private static final long serialVersionUID = -6448182941386934326L; - - public Aspect(QName name) - { - super(name); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.slingshot.forms; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * RM metadata used by form extension + * + * @author Roy Wetherall + */ +public class RMMetaDataGet extends DeclarativeWebScript +{ + /** Query parameters */ + private static final String PARAM_NODEREF = "noderef"; + private static final String PARAM_TYPE = "type"; + private static final String PARAM_EXTENDED = "extended"; + + /** NodeRef pattern */ + private static final Pattern NODE_REF_PATTERN = Pattern.compile(".+://.+/.+"); + + /** QName pattern */ + private static final Pattern QNAME_PATTERN = Pattern.compile(".+:[^=,]+"); + + /** Namespace service */ + private NamespaceService namespaceService; + + /** Node service */ + private NodeService nodeService; + + /** File Plan Service */ + private FilePlanService filePlanService; + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + // create model object with the lists model + Map model = new HashMap(1); + + boolean extended = false; + String result = "NONE"; + + // Get the nodeRef and confirm it is valid + String nodeRef = req.getParameter(PARAM_NODEREF); + if (nodeRef == null || nodeRef.length() == 0) + { + String type = req.getParameter(PARAM_TYPE); + if (type != null && type.length() != 0 && type.indexOf(':') != -1) + { + Matcher m = QNAME_PATTERN.matcher(type); + if (m.matches()) + { + QName qname = QName.createQName(type, namespaceService); + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKindFromType(qname); + if (kind != null) + { + result = kind.toString(); + } + } + } + } + else + { + // quick test before running slow match for full NodeRef pattern + if (nodeRef.indexOf(':') != -1) + { + Matcher m = NODE_REF_PATTERN.matcher(nodeRef); + if (m.matches()) + { + NodeRef nodeRefObj = new NodeRef(nodeRef); + + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRefObj); + if (kind != null) + { + result = kind.toString(); + } + + String extendedValue = req.getParameter(PARAM_EXTENDED); + if (extendedValue != null && extendedValue.length() != 0) + { + extended = Boolean.parseBoolean(extendedValue); + if (extended) + { + // get the aspects of the node + model.put("aspects", getAspects(nodeRefObj)); + } + } + } + } + } + + model.put("kind", result); + model.put("extended", extended); + return model; + } + + /** + * Gets the current node aspects + * + * @return node aspects + */ + public List getAspects(NodeRef nodeRef) + { + Set qnames = nodeService.getAspects(nodeRef); + List aspects = new ArrayList(qnames.size()); + for (QName qname : qnames) + { + aspects.add(new Aspect(qname)); + } + return aspects; + } + + /** + * Qname wrapper class + */ + public class QNameBean implements Serializable + { + private static final long serialVersionUID = 6982292337846270774L; + + protected QName name; + + public QNameBean(QName name) + { + this.name = name; + } + + public String getName() + { + return name.toString(); + } + + public String getPrefixedName() + { + return name.toPrefixString(namespaceService); + } + + public String toString() + { + return getName(); + } + } + + /** + * Aspect wrapper class + */ + public class Aspect extends QNameBean + { + private static final long serialVersionUID = -6448182941386934326L; + + public Aspect(QName name) + { + super(name); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java index 427832a366..9b137eacda 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java @@ -1,400 +1,400 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.search; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.error.AlfrescoRuntimeException; -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.QName; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -/** - * @author Roy Wetherall - */ -@AlfrescoPublicApi -@SuppressWarnings("serial") -public class RecordsManagementSearchParameters -{ - /** Default sort order */ - private static final List DEFAULT_SORT_ORDER = new ArrayList() - { - { - add(new SortItem(ContentModel.PROP_NAME, Boolean.TRUE)); - } - }; - - /** Default templates */ - private static final Map DEFAULT_TEMPLATES = new HashMap() - { - { - put("keywords", "%(cm:name cm:title cm:description TEXT)"); - put("name", "%(cm:name)"); - put("title", "%(cm:title)"); - put("description", "%(cm:description)"); - put("creator", "%(cm:creator)"); - put("created", "%(cm:created)"); - put("modifier", "%(cm:modifier)"); - put("modified", "%(cm:modified)"); - put("author", "%(cm:author)"); - put("markings", "%(rmc:supplementalMarkingList)"); - put("dispositionEvents", "%(rma:recordSearchDispositionEvents)"); - put("dispositionActionName", "%(rma:recordSearchDispositionActionName)"); - put("dispositionActionAsOf", "%(rma:recordSearchDispositionActionAsOf)"); - put("dispositionEventsEligible", "%(rma:recordSearchDispositionEventsEligible)"); - put("dispositionPeriod", "%(rma:recordSearchDispositionPeriod)"); - put("hasDispositionSchedule", "%(rma:recordSearchHasDispositionSchedule)"); - put("dispositionInstructions", "%(rma:recordSearchDispositionInstructions)"); - put("dispositionAuthority", "%(rma:recordSearchDispositionAuthority)"); - put("vitalRecordReviewPeriod", "%(rma:recordSearchVitalRecordReviewPeriod)"); - } - }; - - /** Default included container types */ - private static final List DEFAULT_INCLUDED_CONTAINER_TYPES = Collections.emptyList(); - - /** Max items */ - private int maxItems = 500; - - private boolean includeRecords = true; - private boolean includeUndeclaredRecords = false; - private boolean includeVitalRecords = false; - private boolean includeRecordFolders = true; - private boolean includeFrozen = false; - private boolean includeCutoff = false; - - private List includedContainerTypes = DEFAULT_INCLUDED_CONTAINER_TYPES; - private List sortOrder = DEFAULT_SORT_ORDER; - private Map templates = DEFAULT_TEMPLATES; - - private static final String JSON_MAXITEMS = "maxitems"; - private static final String JSON_RECORDS = "records"; - private static final String JSON_UNDECLAREDRECORDS = "undeclaredrecords"; - private static final String JSON_VITALRECORDS = "vitalrecords"; - private static final String JSON_RECORDFOLDERES = "recordfolders"; - private static final String JSON_FROZEN = "frozen"; - private static final String JSON_CUTOFF = "cutoff"; - private static final String JSON_CONTAINERTYPES = "containertypes"; - private static final String JSON_SORT = "sort"; - private static final String JSON_FIELD = "field"; - private static final String JSON_ASCENDING = "ascending"; - - /** - * { - * "maxItems" : 500, - * "records" : true, - * "undeclaredrecords" : false, - * "vitalrecords" : false, - * "recordfolders" : false, - * "frozen" : false, - * "cutoff" : false, - * "containertypes" : - * [ - * "rma:recordSeries", - * "rma:recordCategory" - * ] - * "sort" : - * [ - * { - * "field" : "cm:name", - * "ascending" : true - * } - * ] - * } - */ - public static RecordsManagementSearchParameters createFromJSON(String json, NamespaceService namespaceService) - { - try - { - JSONObject jsonObject = new JSONObject(json); - return RecordsManagementSearchParameters.createFromJSON(jsonObject, namespaceService); - } - catch (JSONException e) - { - throw new AlfrescoRuntimeException("Unable to create records management search parameters from json string. " + json, e); - } - } - - /** - * - * @param jsonObject - * @return - */ - public static RecordsManagementSearchParameters createFromJSON(JSONObject jsonObject, NamespaceService namespaceService) - { - try - { - RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); - - // Get the search parameter properties - if (jsonObject.has(JSON_MAXITEMS)) - { - searchParameters.setMaxItems(jsonObject.getInt(JSON_MAXITEMS)); - } - if (jsonObject.has(JSON_RECORDS)) - { - searchParameters.setIncludeRecords(jsonObject.getBoolean(JSON_RECORDS)); - } - if (jsonObject.has(JSON_UNDECLAREDRECORDS)) - { - searchParameters.setIncludeUndeclaredRecords(jsonObject.getBoolean(JSON_UNDECLAREDRECORDS)); - } - if (jsonObject.has(JSON_VITALRECORDS)) - { - searchParameters.setIncludeVitalRecords(jsonObject.getBoolean(JSON_VITALRECORDS)); - } - if (jsonObject.has(JSON_RECORDFOLDERES)) - { - searchParameters.setIncludeRecordFolders(jsonObject.getBoolean(JSON_RECORDFOLDERES)); - } - if (jsonObject.has(JSON_FROZEN)) - { - searchParameters.setIncludeFrozen(jsonObject.getBoolean(JSON_FROZEN)); - } - if (jsonObject.has(JSON_CUTOFF)) - { - searchParameters.setIncludeCutoff(jsonObject.getBoolean(JSON_CUTOFF)); - } - - // Get container types - if (jsonObject.has(JSON_CONTAINERTYPES)) - { - JSONArray jsonArray = jsonObject.getJSONArray(JSON_CONTAINERTYPES); - List containerTypes = new ArrayList(jsonArray.length()); - for (int i = 0; i < jsonArray.length(); i++) - { - String type = jsonArray.getString(i); - containerTypes.add(QName.createQName(type, namespaceService)); - } - searchParameters.setIncludedContainerTypes(containerTypes); - } - - // Get sort details - if (jsonObject.has(JSON_SORT)) - { - JSONArray jsonArray = jsonObject.getJSONArray(JSON_SORT); - List sortOrder = new ArrayList(jsonArray.length()); - for (int i = 0; i < jsonArray.length(); i++) - { - JSONObject sortJSONObject = jsonArray.getJSONObject(i); - if (sortJSONObject.has(JSON_FIELD) && - sortJSONObject.has(JSON_ASCENDING)) - { - sortOrder.add(new SortItem( - QName.createQName(sortJSONObject.getString(JSON_FIELD), namespaceService), - sortJSONObject.getBoolean(JSON_ASCENDING))); - } - } - searchParameters.setSortOrder(sortOrder); - } - - return searchParameters; - } - catch (JSONException e) - { - throw new AlfrescoRuntimeException("Unable to create records management search parameters from json string. " + jsonObject.toString(), e); - } - } - - /** - * - * @return - */ - public String toJSONString(NamespaceService namespaceService) - { - return toJSONObject(namespaceService).toString(); - } - - public JSONObject toJSONObject(NamespaceService namespaceService) - { - try - { - JSONObject jsonObject = new JSONObject(); - jsonObject.put(JSON_MAXITEMS, maxItems); - jsonObject.put(JSON_RECORDS, includeRecords); - jsonObject.put(JSON_UNDECLAREDRECORDS, includeUndeclaredRecords); - jsonObject.put(JSON_VITALRECORDS, includeVitalRecords); - jsonObject.put(JSON_RECORDFOLDERES, includeRecordFolders); - jsonObject.put(JSON_FROZEN, includeFrozen); - jsonObject.put(JSON_CUTOFF, includeCutoff); - - // Included containers - JSONArray jsonArray = new JSONArray(); - for (QName containerType : includedContainerTypes) - { - jsonArray.put(containerType.toPrefixString(namespaceService)); - } - jsonObject.put(JSON_CONTAINERTYPES, jsonArray); - - // Sort - JSONArray jsonSortArray = new JSONArray(); - for (SortItem entry : sortOrder) - { - JSONObject jsonEntry = new JSONObject(); - jsonEntry.put(JSON_FIELD, entry.property.toPrefixString(namespaceService)); - jsonEntry.put(JSON_ASCENDING, entry.assc); - jsonSortArray.put(jsonEntry); - } - jsonObject.put(JSON_SORT, jsonSortArray); - - return jsonObject; - } - catch (JSONException e) - { - throw new AlfrescoRuntimeException("Unable to generate json string for records management search parameters.", e); - } - } - - public void setMaxItems(int maxItems) - { - this.maxItems = maxItems; - } - - public int getMaxItems() - { - return maxItems; - } - - public void setSortOrder(List sortOrder) - { - this.sortOrder = sortOrder; - } - - public List getSortOrder() - { - return sortOrder; - } - - public void setTemplates(Map templates) - { - this.templates = templates; - } - - public Map getTemplates() - { - return templates; - } - - public void setIncludeRecords(boolean includeRecords) - { - this.includeRecords = includeRecords; - } - - public boolean isIncludeRecords() - { - return includeRecords; - } - - public void setIncludeUndeclaredRecords(boolean includeUndeclaredRecords) - { - this.includeUndeclaredRecords = includeUndeclaredRecords; - } - - public boolean isIncludeUndeclaredRecords() - { - return includeUndeclaredRecords; - } - - public void setIncludeVitalRecords(boolean includeVitalRecords) - { - this.includeVitalRecords = includeVitalRecords; - } - - public boolean isIncludeVitalRecords() - { - return includeVitalRecords; - } - - public void setIncludeRecordFolders(boolean includeRecordFolders) - { - this.includeRecordFolders = includeRecordFolders; - } - - public boolean isIncludeRecordFolders() - { - return includeRecordFolders; - } - - public void setIncludeFrozen(boolean includeFrozen) - { - this.includeFrozen = includeFrozen; - } - - public boolean isIncludeFrozen() - { - return includeFrozen; - } - - public void setIncludeCutoff(boolean includeCutoff) - { - this.includeCutoff = includeCutoff; - } - - public boolean isIncludeCutoff() - { - return includeCutoff; - } - - public void setIncludedContainerTypes(List includedContainerTypes) - { - this.includedContainerTypes = includedContainerTypes; - } - - public List getIncludedContainerTypes() - { - 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() - { - public String convert(SearchParameters source) - { - throw new TypeConversionException("Dummy converter! Should throw a TypeConversionException"); - } - } - ); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.search; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.error.AlfrescoRuntimeException; +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.QName; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * @author Roy Wetherall + */ +@AlfrescoPublicApi +@SuppressWarnings("serial") +public class RecordsManagementSearchParameters +{ + /** Default sort order */ + private static final List DEFAULT_SORT_ORDER = new ArrayList() + { + { + add(new SortItem(ContentModel.PROP_NAME, Boolean.TRUE)); + } + }; + + /** Default templates */ + private static final Map DEFAULT_TEMPLATES = new HashMap() + { + { + put("keywords", "%(cm:name cm:title cm:description TEXT)"); + put("name", "%(cm:name)"); + put("title", "%(cm:title)"); + put("description", "%(cm:description)"); + put("creator", "%(cm:creator)"); + put("created", "%(cm:created)"); + put("modifier", "%(cm:modifier)"); + put("modified", "%(cm:modified)"); + put("author", "%(cm:author)"); + put("markings", "%(rmc:supplementalMarkingList)"); + put("dispositionEvents", "%(rma:recordSearchDispositionEvents)"); + put("dispositionActionName", "%(rma:recordSearchDispositionActionName)"); + put("dispositionActionAsOf", "%(rma:recordSearchDispositionActionAsOf)"); + put("dispositionEventsEligible", "%(rma:recordSearchDispositionEventsEligible)"); + put("dispositionPeriod", "%(rma:recordSearchDispositionPeriod)"); + put("hasDispositionSchedule", "%(rma:recordSearchHasDispositionSchedule)"); + put("dispositionInstructions", "%(rma:recordSearchDispositionInstructions)"); + put("dispositionAuthority", "%(rma:recordSearchDispositionAuthority)"); + put("vitalRecordReviewPeriod", "%(rma:recordSearchVitalRecordReviewPeriod)"); + } + }; + + /** Default included container types */ + private static final List DEFAULT_INCLUDED_CONTAINER_TYPES = Collections.emptyList(); + + /** Max items */ + private int maxItems = 500; + + private boolean includeRecords = true; + private boolean includeUndeclaredRecords = false; + private boolean includeVitalRecords = false; + private boolean includeRecordFolders = true; + private boolean includeFrozen = false; + private boolean includeCutoff = false; + + private List includedContainerTypes = DEFAULT_INCLUDED_CONTAINER_TYPES; + private List sortOrder = DEFAULT_SORT_ORDER; + private Map templates = DEFAULT_TEMPLATES; + + private static final String JSON_MAXITEMS = "maxitems"; + private static final String JSON_RECORDS = "records"; + private static final String JSON_UNDECLAREDRECORDS = "undeclaredrecords"; + private static final String JSON_VITALRECORDS = "vitalrecords"; + private static final String JSON_RECORDFOLDERES = "recordfolders"; + private static final String JSON_FROZEN = "frozen"; + private static final String JSON_CUTOFF = "cutoff"; + private static final String JSON_CONTAINERTYPES = "containertypes"; + private static final String JSON_SORT = "sort"; + private static final String JSON_FIELD = "field"; + private static final String JSON_ASCENDING = "ascending"; + + /** + * { + * "maxItems" : 500, + * "records" : true, + * "undeclaredrecords" : false, + * "vitalrecords" : false, + * "recordfolders" : false, + * "frozen" : false, + * "cutoff" : false, + * "containertypes" : + * [ + * "rma:recordSeries", + * "rma:recordCategory" + * ] + * "sort" : + * [ + * { + * "field" : "cm:name", + * "ascending" : true + * } + * ] + * } + */ + public static RecordsManagementSearchParameters createFromJSON(String json, NamespaceService namespaceService) + { + try + { + JSONObject jsonObject = new JSONObject(json); + return RecordsManagementSearchParameters.createFromJSON(jsonObject, namespaceService); + } + catch (JSONException e) + { + throw new AlfrescoRuntimeException("Unable to create records management search parameters from json string. " + json, e); + } + } + + /** + * + * @param jsonObject + * @return + */ + public static RecordsManagementSearchParameters createFromJSON(JSONObject jsonObject, NamespaceService namespaceService) + { + try + { + RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); + + // Get the search parameter properties + if (jsonObject.has(JSON_MAXITEMS)) + { + searchParameters.setMaxItems(jsonObject.getInt(JSON_MAXITEMS)); + } + if (jsonObject.has(JSON_RECORDS)) + { + searchParameters.setIncludeRecords(jsonObject.getBoolean(JSON_RECORDS)); + } + if (jsonObject.has(JSON_UNDECLAREDRECORDS)) + { + searchParameters.setIncludeUndeclaredRecords(jsonObject.getBoolean(JSON_UNDECLAREDRECORDS)); + } + if (jsonObject.has(JSON_VITALRECORDS)) + { + searchParameters.setIncludeVitalRecords(jsonObject.getBoolean(JSON_VITALRECORDS)); + } + if (jsonObject.has(JSON_RECORDFOLDERES)) + { + searchParameters.setIncludeRecordFolders(jsonObject.getBoolean(JSON_RECORDFOLDERES)); + } + if (jsonObject.has(JSON_FROZEN)) + { + searchParameters.setIncludeFrozen(jsonObject.getBoolean(JSON_FROZEN)); + } + if (jsonObject.has(JSON_CUTOFF)) + { + searchParameters.setIncludeCutoff(jsonObject.getBoolean(JSON_CUTOFF)); + } + + // Get container types + if (jsonObject.has(JSON_CONTAINERTYPES)) + { + JSONArray jsonArray = jsonObject.getJSONArray(JSON_CONTAINERTYPES); + List containerTypes = new ArrayList(jsonArray.length()); + for (int i = 0; i < jsonArray.length(); i++) + { + String type = jsonArray.getString(i); + containerTypes.add(QName.createQName(type, namespaceService)); + } + searchParameters.setIncludedContainerTypes(containerTypes); + } + + // Get sort details + if (jsonObject.has(JSON_SORT)) + { + JSONArray jsonArray = jsonObject.getJSONArray(JSON_SORT); + List sortOrder = new ArrayList(jsonArray.length()); + for (int i = 0; i < jsonArray.length(); i++) + { + JSONObject sortJSONObject = jsonArray.getJSONObject(i); + if (sortJSONObject.has(JSON_FIELD) && + sortJSONObject.has(JSON_ASCENDING)) + { + sortOrder.add(new SortItem( + QName.createQName(sortJSONObject.getString(JSON_FIELD), namespaceService), + sortJSONObject.getBoolean(JSON_ASCENDING))); + } + } + searchParameters.setSortOrder(sortOrder); + } + + return searchParameters; + } + catch (JSONException e) + { + throw new AlfrescoRuntimeException("Unable to create records management search parameters from json string. " + jsonObject.toString(), e); + } + } + + /** + * + * @return + */ + public String toJSONString(NamespaceService namespaceService) + { + return toJSONObject(namespaceService).toString(); + } + + public JSONObject toJSONObject(NamespaceService namespaceService) + { + try + { + JSONObject jsonObject = new JSONObject(); + jsonObject.put(JSON_MAXITEMS, maxItems); + jsonObject.put(JSON_RECORDS, includeRecords); + jsonObject.put(JSON_UNDECLAREDRECORDS, includeUndeclaredRecords); + jsonObject.put(JSON_VITALRECORDS, includeVitalRecords); + jsonObject.put(JSON_RECORDFOLDERES, includeRecordFolders); + jsonObject.put(JSON_FROZEN, includeFrozen); + jsonObject.put(JSON_CUTOFF, includeCutoff); + + // Included containers + JSONArray jsonArray = new JSONArray(); + for (QName containerType : includedContainerTypes) + { + jsonArray.put(containerType.toPrefixString(namespaceService)); + } + jsonObject.put(JSON_CONTAINERTYPES, jsonArray); + + // Sort + JSONArray jsonSortArray = new JSONArray(); + for (SortItem entry : sortOrder) + { + JSONObject jsonEntry = new JSONObject(); + jsonEntry.put(JSON_FIELD, entry.property.toPrefixString(namespaceService)); + jsonEntry.put(JSON_ASCENDING, entry.assc); + jsonSortArray.put(jsonEntry); + } + jsonObject.put(JSON_SORT, jsonSortArray); + + return jsonObject; + } + catch (JSONException e) + { + throw new AlfrescoRuntimeException("Unable to generate json string for records management search parameters.", e); + } + } + + public void setMaxItems(int maxItems) + { + this.maxItems = maxItems; + } + + public int getMaxItems() + { + return maxItems; + } + + public void setSortOrder(List sortOrder) + { + this.sortOrder = sortOrder; + } + + public List getSortOrder() + { + return sortOrder; + } + + public void setTemplates(Map templates) + { + this.templates = templates; + } + + public Map getTemplates() + { + return templates; + } + + public void setIncludeRecords(boolean includeRecords) + { + this.includeRecords = includeRecords; + } + + public boolean isIncludeRecords() + { + return includeRecords; + } + + public void setIncludeUndeclaredRecords(boolean includeUndeclaredRecords) + { + this.includeUndeclaredRecords = includeUndeclaredRecords; + } + + public boolean isIncludeUndeclaredRecords() + { + return includeUndeclaredRecords; + } + + public void setIncludeVitalRecords(boolean includeVitalRecords) + { + this.includeVitalRecords = includeVitalRecords; + } + + public boolean isIncludeVitalRecords() + { + return includeVitalRecords; + } + + public void setIncludeRecordFolders(boolean includeRecordFolders) + { + this.includeRecordFolders = includeRecordFolders; + } + + public boolean isIncludeRecordFolders() + { + return includeRecordFolders; + } + + public void setIncludeFrozen(boolean includeFrozen) + { + this.includeFrozen = includeFrozen; + } + + public boolean isIncludeFrozen() + { + return includeFrozen; + } + + public void setIncludeCutoff(boolean includeCutoff) + { + this.includeCutoff = includeCutoff; + } + + public boolean isIncludeCutoff() + { + return includeCutoff; + } + + public void setIncludedContainerTypes(List includedContainerTypes) + { + this.includedContainerTypes = includedContainerTypes; + } + + public List getIncludedContainerTypes() + { + 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() + { + public String convert(SearchParameters source) + { + throw new TypeConversionException("Dummy converter! Should throw a TypeConversionException"); + } + } + ); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java index e7426d7931..e7cfb88f20 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchService.java @@ -1,103 +1,103 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.search; - -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.Pair; - -/** - * Records management search service. - * - * @author Roy Wetherall - */ -// Not @AlfrescoPublicApi at the moment as it requires SavedSearchDetails which is not public API. -public interface RecordsManagementSearchService -{ - /** - * Execute a records management search - * @param siteId the id of the rm site to query - * @param query search query string - * @param searchParameters search parameters - * @return {@link List}<{@link Pair}<{@link NodeRef}, {@link NodeRef}> search results as pairs for parent and child nodes - */ - List> search(String siteId, String query, RecordsManagementSearchParameters searchParameters); - - /** - * Get all the searches saved on the given records management site. - * @param siteId site id - * @return {@link List<{@link SavedSearchDetails}>} list of saved search details - */ - List getSavedSearches(String siteId); - - /** - * Get a named saved search for a given records management site. - * @param siteId site id - * @param name name of search - * @return {@link SavedSearchDetails} saved search details - */ - SavedSearchDetails getSavedSearch(String siteId, String name); - - /** - * Save records management search. - * @param siteId site id - * @param name name - * @param description description - * @param search search string - * @param isPublic indicates whether the saved search is public or not - * @return {@link SavedSearchDetails} details of the saved search - */ - SavedSearchDetails saveSearch(String siteId, String name, String description, String search, RecordsManagementSearchParameters searchParameters, boolean isPublic); - - /** - * Save records management search. - * @param savedSearchDetails details of search to save - * @return {@link SavedSearchDetails} details of the saved search - */ - SavedSearchDetails saveSearch(SavedSearchDetails savedSearchDetails); - - /** - * Delete saved search - * @param siteId site id - * @param name name of saved search - */ - void deleteSavedSearch(String siteId, String name); - - /** - * Delete saved search - * @param savedSearchDetails saved search details - */ - void deleteSavedSearch(SavedSearchDetails savedSearchDetails); - - /** - * Adds the reports as saved searches to a given site. - * @param siteId site id - */ - void addReports(String siteId); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.search; + +import java.util.List; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.Pair; + +/** + * Records management search service. + * + * @author Roy Wetherall + */ +// Not @AlfrescoPublicApi at the moment as it requires SavedSearchDetails which is not public API. +public interface RecordsManagementSearchService +{ + /** + * Execute a records management search + * @param siteId the id of the rm site to query + * @param query search query string + * @param searchParameters search parameters + * @return {@link List}<{@link Pair}<{@link NodeRef}, {@link NodeRef}> search results as pairs for parent and child nodes + */ + List> search(String siteId, String query, RecordsManagementSearchParameters searchParameters); + + /** + * Get all the searches saved on the given records management site. + * @param siteId site id + * @return {@link List<{@link SavedSearchDetails}>} list of saved search details + */ + List getSavedSearches(String siteId); + + /** + * Get a named saved search for a given records management site. + * @param siteId site id + * @param name name of search + * @return {@link SavedSearchDetails} saved search details + */ + SavedSearchDetails getSavedSearch(String siteId, String name); + + /** + * Save records management search. + * @param siteId site id + * @param name name + * @param description description + * @param search search string + * @param isPublic indicates whether the saved search is public or not + * @return {@link SavedSearchDetails} details of the saved search + */ + SavedSearchDetails saveSearch(String siteId, String name, String description, String search, RecordsManagementSearchParameters searchParameters, boolean isPublic); + + /** + * Save records management search. + * @param savedSearchDetails details of search to save + * @return {@link SavedSearchDetails} details of the saved search + */ + SavedSearchDetails saveSearch(SavedSearchDetails savedSearchDetails); + + /** + * Delete saved search + * @param siteId site id + * @param name name of saved search + */ + void deleteSavedSearch(String siteId, String name); + + /** + * Delete saved search + * @param savedSearchDetails saved search details + */ + void deleteSavedSearch(SavedSearchDetails savedSearchDetails); + + /** + * Adds the reports as saved searches to a given site. + * @param siteId site id + */ + void addReports(String siteId); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java index 900b25b474..24f8363f92 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java @@ -1,636 +1,636 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.search; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchParameters; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ISO9075; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Records management search service implementation - * - * @author Roy Wetherall - */ -public class RecordsManagementSearchServiceImpl implements RecordsManagementSearchService -{ - private static final String SITES_SPACE_QNAME_PATH = "/app:company_home/st:sites/"; - - /** Name of the main site container used to store the saved searches within */ - private static final String SEARCH_CONTAINER = "Saved Searches"; - - /** File folder service */ - private FileFolderService fileFolderService; - - /** Search service */ - private SearchService searchService; - - /** Site service */ - private SiteService siteService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** List of report details */ - private List reports = new ArrayList(13); - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @param searchService search service - */ - public void setSearchService(SearchService searchService) - { - this.searchService = searchService; - } - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param reportsJSON - */ - public void setReportsJSON(String reportsJSON) - { - try - { - JSONArray jsonArray = new JSONArray(reportsJSON); - for (int i=0; i < jsonArray.length(); i++) - { - JSONObject report = jsonArray.getJSONObject(i); - - // Get the name - if (!report.has(SavedSearchDetails.NAME)) - { - throw new AlfrescoRuntimeException("Unable to load report details because name has not been specified. \n" + reportsJSON); - } - String name = report.getString(SavedSearchDetails.NAME); - String translatedName = I18NUtil.getMessage(name); - if (translatedName != null) - { - name = translatedName; - } - - // Get the query - if (!report.has(SavedSearchDetails.SEARCH)) - { - throw new AlfrescoRuntimeException("Unable to load report details because search has not been specified for report " + name + ". \n" + reportsJSON); - } - String query = report.getString(SavedSearchDetails.SEARCH); - - // Get the description - String description = ""; - if (report.has(SavedSearchDetails.DESCRIPTION)) - { - description = report.getString(SavedSearchDetails.DESCRIPTION); - String translatedDescription = I18NUtil.getMessage(description); - if (translatedDescription != null) - { - description = translatedDescription; - } - } - - RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); - if (report.has("searchparams")) - { - searchParameters = RecordsManagementSearchParameters.createFromJSON(report.getJSONObject("searchparams"), namespaceService); - } - - // Create the report details and add to list - ReportDetails reportDetails = new ReportDetails(name, description, query, searchParameters); - reports.add(reportDetails); - } - } - catch (JSONException exception) - { - throw new AlfrescoRuntimeException("Unable to load report details.\n" + reportsJSON, exception); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#search(java.lang.String, java.lang.String, org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters) - */ - @Override - public List> search(String siteId, String query, RecordsManagementSearchParameters rmSearchParameters) - { - // build the full RM query - StringBuilder fullQuery = new StringBuilder(1024); - fullQuery.append("PATH:\"") - .append(SITES_SPACE_QNAME_PATH) - .append("cm:").append(ISO9075.encode(siteId)).append("/cm:documentLibrary//*\"") - .append(" AND (") - .append(buildQueryString(query, rmSearchParameters)) - .append(")"); - - // create the search parameters - SearchParameters searchParameters = new SearchParameters(); - searchParameters.setQuery(fullQuery.toString()); - searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); - searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - searchParameters.setMaxItems(rmSearchParameters.getMaxItems()); - searchParameters.setNamespace(RecordsManagementModel.RM_URI); - - // set sort - for(SortItem entry : rmSearchParameters.getSortOrder()) - { - searchParameters.addSort(entry.property.toPrefixString(namespaceService), entry.assc); - } - - // set templates - for (Entry entry : rmSearchParameters.getTemplates().entrySet()) - { - searchParameters.addQueryTemplate(entry.getKey(), entry.getValue()); - } - - // execute query - ResultSet resultSet = searchService.query(searchParameters); - - // process results - List> result = new ArrayList>(resultSet.length()); - for (ChildAssociationRef childAssoc : resultSet.getChildAssocRefs()) - { - result.add(new Pair(childAssoc.getParentRef(), childAssoc.getChildRef())); - } - - // return results - return result; - } - - /** - * - * @param queryTerm - * @param aspects - * @param types - * @return - */ - /*package*/ String buildQueryString(String queryTerm, RecordsManagementSearchParameters searchParameters) - { - StringBuilder aspectQuery = new StringBuilder(); - if (searchParameters.isIncludeRecords()) - { - appendAspect(aspectQuery, "rma:record"); - if (!searchParameters.isIncludeUndeclaredRecords()) - { - appendAspect(aspectQuery, "rma:declaredRecord"); - } - if (searchParameters.isIncludeVitalRecords()) - { - appendAspect(aspectQuery, "rma:vitalRecord"); - } - } - - StringBuilder typeQuery = new StringBuilder(); - if (searchParameters.isIncludeRecordFolders()) - { - appendType(typeQuery, "rma:recordFolder"); - } - List includedContainerTypes = searchParameters.getIncludedContainerTypes(); - if (includedContainerTypes != null && includedContainerTypes.size() != 0) - { - for (QName includedContainerType : includedContainerTypes) - { - appendType(typeQuery, includedContainerType.toPrefixString(namespaceService)); - } - } - - StringBuilder query = new StringBuilder(); - if (queryTerm == null || queryTerm.length() == 0) - { - // Default to search for everything - query.append("ISNODE:T"); - } - else - { - if (isComplexQueryTerm(queryTerm)) - { - query.append(queryTerm); - } - else - { - query.append("keywords:\"" + queryTerm + "\""); - } - } - - StringBuilder fullQuery = new StringBuilder(1024); - if (aspectQuery.length() != 0 || typeQuery.length() != 0) - { - if (aspectQuery.length() != 0 && typeQuery.length() != 0) - { - fullQuery.append("("); - } - - if (aspectQuery.length() != 0) - { - fullQuery.append("(").append(aspectQuery).append(") "); - } - - if (typeQuery.length() != 0) - { - fullQuery.append("(").append(typeQuery).append(")"); - } - - if (aspectQuery.length() != 0 && typeQuery.length() != 0) - { - fullQuery.append(")"); - } - } - - if (searchParameters.isIncludeFrozen()) - { - appendAspect(fullQuery, "rma:frozen"); - } - else - { - appendNotAspect(fullQuery, "rma:frozen"); - } - if (searchParameters.isIncludeCutoff()) - { - appendAspect(fullQuery, "rma:cutOff"); - } - - if (fullQuery.length() != 0) - { - fullQuery.append(" AND "); - } - fullQuery.append(query).append(" AND NOT ASPECT:\"rma:versionedRecord\""); - - return fullQuery.toString(); - } - - private boolean isComplexQueryTerm(String query) - { - return query.matches(".*[\":].*"); - } - - /** - * - * @param sb - * @param aspect - */ - private void appendAspect(StringBuilder sb, String aspect) - { - appendWithJoin(sb, " AND ", "ASPECT:\"", aspect, "\""); - } - - private void appendNotAspect(StringBuilder sb, String aspect) - { - appendWithJoin(sb, " AND ", "NOT ASPECT:\"", aspect, "\""); - } - - /** - * - * @param sb - * @param type - */ - private void appendType(StringBuilder sb, String type) - { - appendWithJoin(sb, " ", "TYPE:\"", type, "\""); - } - - /** - * - * @param sb - * @param withJoin - * @param prefix - * @param value - * @param postfix - */ - private void appendWithJoin(StringBuilder sb, String withJoin, String prefix, String value, String postfix) - { - if (sb.length() != 0) - { - sb.append(withJoin); - } - sb.append(prefix).append(value).append(postfix); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#getSavedSearches(java.lang.String) - */ - @Override - public List getSavedSearches(String siteId) - { - List result = new ArrayList(17); - - NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); - if (container != null) - { - // add the details of all the public saved searches - List searches = fileFolderService.listFiles(container); - for (FileInfo search : searches) - { - addSearchDetailsToList(result, search.getNodeRef()); - } - - // add the details of any "private" searches for the current user - String userName = AuthenticationUtil.getFullyAuthenticatedUser(); - NodeRef userContainer = fileFolderService.searchSimple(container, userName); - if (userContainer != null) - { - List userSearches = fileFolderService.listFiles(userContainer); - for (FileInfo userSearch : userSearches) - { - addSearchDetailsToList(result, userSearch.getNodeRef()); - } - } - } - - return result; - } - - /** - * Add the search details to the list. - * @param searches list of search details - * @param searchNode search node - */ - private void addSearchDetailsToList(List searches, NodeRef searchNode) - { - ContentReader reader = fileFolderService.getReader(searchNode); - String jsonString = reader.getContentString(); - SavedSearchDetails savedSearchDetails = SavedSearchDetails.createFromJSON(jsonString, namespaceService, this, searchNode); - searches.add(savedSearchDetails); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#getSavedSearch(java.lang.String, java.lang.String) - */ - @Override - public SavedSearchDetails getSavedSearch(String siteId, String name) - { - // check for mandatory parameters - ParameterCheck.mandatory("siteId", siteId); - ParameterCheck.mandatory("name", name); - - SavedSearchDetails result = null; - - // get the saved search node - NodeRef searchNode = getSearchNodeRef(siteId, name); - - if (searchNode != null) - { - // get the json content - ContentReader reader = fileFolderService.getReader(searchNode); - String jsonString = reader.getContentString(); - - // create the saved search details - result = SavedSearchDetails.createFromJSON(jsonString, namespaceService, this, searchNode); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#saveSearch(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean) - */ - @Override - public SavedSearchDetails saveSearch(String siteId, String name, String description, String query, RecordsManagementSearchParameters searchParameters, boolean isPublic) - { - // Check for mandatory parameters - ParameterCheck.mandatory("siteId", siteId); - ParameterCheck.mandatory("name", name); - ParameterCheck.mandatory("query", query); - ParameterCheck.mandatory("searchParameters", searchParameters); - - // Create saved search details - SavedSearchDetails savedSearchDetails = new SavedSearchDetails(siteId, name, description, query, searchParameters, isPublic, false, namespaceService, this); - - // Save search details - return saveSearch(savedSearchDetails); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#saveSearch(org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails) - */ - @Override - public SavedSearchDetails saveSearch(final SavedSearchDetails savedSearchDetails) - { - // Check for mandatory parameters - ParameterCheck.mandatory("savedSearchDetails", savedSearchDetails); - - // Get the root saved search container - final String siteId = savedSearchDetails.getSiteId(); - NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); - if (container == null) - { - container = AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return siteService.createContainer(siteId, SEARCH_CONTAINER, null, null); - } - }, AuthenticationUtil.getSystemUserName()); - } - - // Get the private container for the current user - if (!savedSearchDetails.isPublic()) - { - final String userName = AuthenticationUtil.getFullyAuthenticatedUser(); - NodeRef userContainer = fileFolderService.searchSimple(container, userName); - if (userContainer == null) - { - final NodeRef parentContainer = container; - userContainer = AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return fileFolderService.create(parentContainer, userName, ContentModel.TYPE_FOLDER).getNodeRef(); - } - }, AuthenticationUtil.getSystemUserName()); - } - container = userContainer; - } - - // Get the saved search node - NodeRef searchNode = fileFolderService.searchSimple(container, savedSearchDetails.getName()); - if (searchNode == null) - { - final NodeRef searchContainer = container; - searchNode = AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public NodeRef doWork() - { - return fileFolderService.create(searchContainer, savedSearchDetails.getName(), ContentModel.TYPE_CONTENT).getNodeRef(); - } - }, AuthenticationUtil.getSystemUserName()); - } - - // Write the JSON content to search node - final NodeRef writableSearchNode = searchNode; - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - ContentWriter writer = fileFolderService.getWriter(writableSearchNode); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_JSON); - writer.putContent(savedSearchDetails.toJSONString()); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - return savedSearchDetails; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#deleteSavedSearch(java.lang.String, java.lang.String) - */ - @Override - public void deleteSavedSearch(String siteId, String name) - { - // Check parameters - ParameterCheck.mandatory("siteId", siteId); - ParameterCheck.mandatory("name", name); - - // Get the search node for the saved query - NodeRef searchNode = getSearchNodeRef(siteId, name); - if (searchNode != null && fileFolderService.exists(searchNode)) - { - fileFolderService.delete(searchNode); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#deleteSavedSearch(org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails) - */ - @Override - public void deleteSavedSearch(SavedSearchDetails savedSearchDetails) - { - // Check parameters - ParameterCheck.mandatory("savedSearchDetails", savedSearchDetails); - - // Delete the saved search - deleteSavedSearch(savedSearchDetails.getSiteId(), savedSearchDetails.getName()); - } - - /** - * Get the saved search node reference. - * @param siteId site id - * @param name search name - * @return {@link NodeRef} search node reference - */ - private NodeRef getSearchNodeRef(String siteId, String name) - { - NodeRef searchNode = null; - - // Get the root saved search container - NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); - if (container != null) - { - // try and find the search node - searchNode = fileFolderService.searchSimple(container, name); - - // can't find it so check the users container - if (searchNode == null) - { - String userName = AuthenticationUtil.getFullyAuthenticatedUser(); - NodeRef userContainer = fileFolderService.searchSimple(container, userName); - if (userContainer != null) - { - searchNode = fileFolderService.searchSimple(userContainer, name); - } - } - } - - return searchNode; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#addReports(java.lang.String) - */ - @Override - public void addReports(String siteId) - { - for (ReportDetails report : reports) - { - // Create saved search details - SavedSearchDetails savedSearchDetails = new SavedSearchDetails( - siteId, - report.getName(), - report.getDescription(), - report.getSearch(), - report.getSearchParameters(), - true, - true, - namespaceService, - this); - - // Save search details - saveSearch(savedSearchDetails); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.search; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchParameters; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ISO9075; +import org.alfresco.util.Pair; +import org.alfresco.util.ParameterCheck; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Records management search service implementation + * + * @author Roy Wetherall + */ +public class RecordsManagementSearchServiceImpl implements RecordsManagementSearchService +{ + private static final String SITES_SPACE_QNAME_PATH = "/app:company_home/st:sites/"; + + /** Name of the main site container used to store the saved searches within */ + private static final String SEARCH_CONTAINER = "Saved Searches"; + + /** File folder service */ + private FileFolderService fileFolderService; + + /** Search service */ + private SearchService searchService; + + /** Site service */ + private SiteService siteService; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** List of report details */ + private List reports = new ArrayList(13); + + /** + * @param fileFolderService file folder service + */ + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + /** + * @param searchService search service + */ + public void setSearchService(SearchService searchService) + { + this.searchService = searchService; + } + + /** + * @param siteService site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param reportsJSON + */ + public void setReportsJSON(String reportsJSON) + { + try + { + JSONArray jsonArray = new JSONArray(reportsJSON); + for (int i=0; i < jsonArray.length(); i++) + { + JSONObject report = jsonArray.getJSONObject(i); + + // Get the name + if (!report.has(SavedSearchDetails.NAME)) + { + throw new AlfrescoRuntimeException("Unable to load report details because name has not been specified. \n" + reportsJSON); + } + String name = report.getString(SavedSearchDetails.NAME); + String translatedName = I18NUtil.getMessage(name); + if (translatedName != null) + { + name = translatedName; + } + + // Get the query + if (!report.has(SavedSearchDetails.SEARCH)) + { + throw new AlfrescoRuntimeException("Unable to load report details because search has not been specified for report " + name + ". \n" + reportsJSON); + } + String query = report.getString(SavedSearchDetails.SEARCH); + + // Get the description + String description = ""; + if (report.has(SavedSearchDetails.DESCRIPTION)) + { + description = report.getString(SavedSearchDetails.DESCRIPTION); + String translatedDescription = I18NUtil.getMessage(description); + if (translatedDescription != null) + { + description = translatedDescription; + } + } + + RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); + if (report.has("searchparams")) + { + searchParameters = RecordsManagementSearchParameters.createFromJSON(report.getJSONObject("searchparams"), namespaceService); + } + + // Create the report details and add to list + ReportDetails reportDetails = new ReportDetails(name, description, query, searchParameters); + reports.add(reportDetails); + } + } + catch (JSONException exception) + { + throw new AlfrescoRuntimeException("Unable to load report details.\n" + reportsJSON, exception); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#search(java.lang.String, java.lang.String, org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters) + */ + @Override + public List> search(String siteId, String query, RecordsManagementSearchParameters rmSearchParameters) + { + // build the full RM query + StringBuilder fullQuery = new StringBuilder(1024); + fullQuery.append("PATH:\"") + .append(SITES_SPACE_QNAME_PATH) + .append("cm:").append(ISO9075.encode(siteId)).append("/cm:documentLibrary//*\"") + .append(" AND (") + .append(buildQueryString(query, rmSearchParameters)) + .append(")"); + + // create the search parameters + SearchParameters searchParameters = new SearchParameters(); + searchParameters.setQuery(fullQuery.toString()); + searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); + searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); + searchParameters.setMaxItems(rmSearchParameters.getMaxItems()); + searchParameters.setNamespace(RecordsManagementModel.RM_URI); + + // set sort + for(SortItem entry : rmSearchParameters.getSortOrder()) + { + searchParameters.addSort(entry.property.toPrefixString(namespaceService), entry.assc); + } + + // set templates + for (Entry entry : rmSearchParameters.getTemplates().entrySet()) + { + searchParameters.addQueryTemplate(entry.getKey(), entry.getValue()); + } + + // execute query + ResultSet resultSet = searchService.query(searchParameters); + + // process results + List> result = new ArrayList>(resultSet.length()); + for (ChildAssociationRef childAssoc : resultSet.getChildAssocRefs()) + { + result.add(new Pair(childAssoc.getParentRef(), childAssoc.getChildRef())); + } + + // return results + return result; + } + + /** + * + * @param queryTerm + * @param aspects + * @param types + * @return + */ + /*package*/ String buildQueryString(String queryTerm, RecordsManagementSearchParameters searchParameters) + { + StringBuilder aspectQuery = new StringBuilder(); + if (searchParameters.isIncludeRecords()) + { + appendAspect(aspectQuery, "rma:record"); + if (!searchParameters.isIncludeUndeclaredRecords()) + { + appendAspect(aspectQuery, "rma:declaredRecord"); + } + if (searchParameters.isIncludeVitalRecords()) + { + appendAspect(aspectQuery, "rma:vitalRecord"); + } + } + + StringBuilder typeQuery = new StringBuilder(); + if (searchParameters.isIncludeRecordFolders()) + { + appendType(typeQuery, "rma:recordFolder"); + } + List includedContainerTypes = searchParameters.getIncludedContainerTypes(); + if (includedContainerTypes != null && includedContainerTypes.size() != 0) + { + for (QName includedContainerType : includedContainerTypes) + { + appendType(typeQuery, includedContainerType.toPrefixString(namespaceService)); + } + } + + StringBuilder query = new StringBuilder(); + if (queryTerm == null || queryTerm.length() == 0) + { + // Default to search for everything + query.append("ISNODE:T"); + } + else + { + if (isComplexQueryTerm(queryTerm)) + { + query.append(queryTerm); + } + else + { + query.append("keywords:\"" + queryTerm + "\""); + } + } + + StringBuilder fullQuery = new StringBuilder(1024); + if (aspectQuery.length() != 0 || typeQuery.length() != 0) + { + if (aspectQuery.length() != 0 && typeQuery.length() != 0) + { + fullQuery.append("("); + } + + if (aspectQuery.length() != 0) + { + fullQuery.append("(").append(aspectQuery).append(") "); + } + + if (typeQuery.length() != 0) + { + fullQuery.append("(").append(typeQuery).append(")"); + } + + if (aspectQuery.length() != 0 && typeQuery.length() != 0) + { + fullQuery.append(")"); + } + } + + if (searchParameters.isIncludeFrozen()) + { + appendAspect(fullQuery, "rma:frozen"); + } + else + { + appendNotAspect(fullQuery, "rma:frozen"); + } + if (searchParameters.isIncludeCutoff()) + { + appendAspect(fullQuery, "rma:cutOff"); + } + + if (fullQuery.length() != 0) + { + fullQuery.append(" AND "); + } + fullQuery.append(query).append(" AND NOT ASPECT:\"rma:versionedRecord\""); + + return fullQuery.toString(); + } + + private boolean isComplexQueryTerm(String query) + { + return query.matches(".*[\":].*"); + } + + /** + * + * @param sb + * @param aspect + */ + private void appendAspect(StringBuilder sb, String aspect) + { + appendWithJoin(sb, " AND ", "ASPECT:\"", aspect, "\""); + } + + private void appendNotAspect(StringBuilder sb, String aspect) + { + appendWithJoin(sb, " AND ", "NOT ASPECT:\"", aspect, "\""); + } + + /** + * + * @param sb + * @param type + */ + private void appendType(StringBuilder sb, String type) + { + appendWithJoin(sb, " ", "TYPE:\"", type, "\""); + } + + /** + * + * @param sb + * @param withJoin + * @param prefix + * @param value + * @param postfix + */ + private void appendWithJoin(StringBuilder sb, String withJoin, String prefix, String value, String postfix) + { + if (sb.length() != 0) + { + sb.append(withJoin); + } + sb.append(prefix).append(value).append(postfix); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#getSavedSearches(java.lang.String) + */ + @Override + public List getSavedSearches(String siteId) + { + List result = new ArrayList(17); + + NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); + if (container != null) + { + // add the details of all the public saved searches + List searches = fileFolderService.listFiles(container); + for (FileInfo search : searches) + { + addSearchDetailsToList(result, search.getNodeRef()); + } + + // add the details of any "private" searches for the current user + String userName = AuthenticationUtil.getFullyAuthenticatedUser(); + NodeRef userContainer = fileFolderService.searchSimple(container, userName); + if (userContainer != null) + { + List userSearches = fileFolderService.listFiles(userContainer); + for (FileInfo userSearch : userSearches) + { + addSearchDetailsToList(result, userSearch.getNodeRef()); + } + } + } + + return result; + } + + /** + * Add the search details to the list. + * @param searches list of search details + * @param searchNode search node + */ + private void addSearchDetailsToList(List searches, NodeRef searchNode) + { + ContentReader reader = fileFolderService.getReader(searchNode); + String jsonString = reader.getContentString(); + SavedSearchDetails savedSearchDetails = SavedSearchDetails.createFromJSON(jsonString, namespaceService, this, searchNode); + searches.add(savedSearchDetails); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#getSavedSearch(java.lang.String, java.lang.String) + */ + @Override + public SavedSearchDetails getSavedSearch(String siteId, String name) + { + // check for mandatory parameters + ParameterCheck.mandatory("siteId", siteId); + ParameterCheck.mandatory("name", name); + + SavedSearchDetails result = null; + + // get the saved search node + NodeRef searchNode = getSearchNodeRef(siteId, name); + + if (searchNode != null) + { + // get the json content + ContentReader reader = fileFolderService.getReader(searchNode); + String jsonString = reader.getContentString(); + + // create the saved search details + result = SavedSearchDetails.createFromJSON(jsonString, namespaceService, this, searchNode); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#saveSearch(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean) + */ + @Override + public SavedSearchDetails saveSearch(String siteId, String name, String description, String query, RecordsManagementSearchParameters searchParameters, boolean isPublic) + { + // Check for mandatory parameters + ParameterCheck.mandatory("siteId", siteId); + ParameterCheck.mandatory("name", name); + ParameterCheck.mandatory("query", query); + ParameterCheck.mandatory("searchParameters", searchParameters); + + // Create saved search details + SavedSearchDetails savedSearchDetails = new SavedSearchDetails(siteId, name, description, query, searchParameters, isPublic, false, namespaceService, this); + + // Save search details + return saveSearch(savedSearchDetails); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#saveSearch(org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails) + */ + @Override + public SavedSearchDetails saveSearch(final SavedSearchDetails savedSearchDetails) + { + // Check for mandatory parameters + ParameterCheck.mandatory("savedSearchDetails", savedSearchDetails); + + // Get the root saved search container + final String siteId = savedSearchDetails.getSiteId(); + NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); + if (container == null) + { + container = AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public NodeRef doWork() + { + return siteService.createContainer(siteId, SEARCH_CONTAINER, null, null); + } + }, AuthenticationUtil.getSystemUserName()); + } + + // Get the private container for the current user + if (!savedSearchDetails.isPublic()) + { + final String userName = AuthenticationUtil.getFullyAuthenticatedUser(); + NodeRef userContainer = fileFolderService.searchSimple(container, userName); + if (userContainer == null) + { + final NodeRef parentContainer = container; + userContainer = AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public NodeRef doWork() + { + return fileFolderService.create(parentContainer, userName, ContentModel.TYPE_FOLDER).getNodeRef(); + } + }, AuthenticationUtil.getSystemUserName()); + } + container = userContainer; + } + + // Get the saved search node + NodeRef searchNode = fileFolderService.searchSimple(container, savedSearchDetails.getName()); + if (searchNode == null) + { + final NodeRef searchContainer = container; + searchNode = AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public NodeRef doWork() + { + return fileFolderService.create(searchContainer, savedSearchDetails.getName(), ContentModel.TYPE_CONTENT).getNodeRef(); + } + }, AuthenticationUtil.getSystemUserName()); + } + + // Write the JSON content to search node + final NodeRef writableSearchNode = searchNode; + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + ContentWriter writer = fileFolderService.getWriter(writableSearchNode); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_JSON); + writer.putContent(savedSearchDetails.toJSONString()); + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + + return savedSearchDetails; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#deleteSavedSearch(java.lang.String, java.lang.String) + */ + @Override + public void deleteSavedSearch(String siteId, String name) + { + // Check parameters + ParameterCheck.mandatory("siteId", siteId); + ParameterCheck.mandatory("name", name); + + // Get the search node for the saved query + NodeRef searchNode = getSearchNodeRef(siteId, name); + if (searchNode != null && fileFolderService.exists(searchNode)) + { + fileFolderService.delete(searchNode); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#deleteSavedSearch(org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails) + */ + @Override + public void deleteSavedSearch(SavedSearchDetails savedSearchDetails) + { + // Check parameters + ParameterCheck.mandatory("savedSearchDetails", savedSearchDetails); + + // Delete the saved search + deleteSavedSearch(savedSearchDetails.getSiteId(), savedSearchDetails.getName()); + } + + /** + * Get the saved search node reference. + * @param siteId site id + * @param name search name + * @return {@link NodeRef} search node reference + */ + private NodeRef getSearchNodeRef(String siteId, String name) + { + NodeRef searchNode = null; + + // Get the root saved search container + NodeRef container = siteService.getContainer(siteId, SEARCH_CONTAINER); + if (container != null) + { + // try and find the search node + searchNode = fileFolderService.searchSimple(container, name); + + // can't find it so check the users container + if (searchNode == null) + { + String userName = AuthenticationUtil.getFullyAuthenticatedUser(); + NodeRef userContainer = fileFolderService.searchSimple(container, userName); + if (userContainer != null) + { + searchNode = fileFolderService.searchSimple(userContainer, name); + } + } + } + + return searchNode; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService#addReports(java.lang.String) + */ + @Override + public void addReports(String siteId) + { + for (ReportDetails report : reports) + { + // Create saved search details + SavedSearchDetails savedSearchDetails = new SavedSearchDetails( + siteId, + report.getName(), + report.getDescription(), + report.getSearch(), + report.getSearchParameters(), + true, + true, + namespaceService, + this); + + // Save search details + saveSearch(savedSearchDetails); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java index 3018a4bd16..dcb3f4d968 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/ReportDetails.java @@ -1,122 +1,122 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.search; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * Report details. - * - * @author Roy Wetherall - */ -@AlfrescoPublicApi -public class ReportDetails -{ - /** Name */ - protected String name; - - /** Description */ - protected String description; - - /** Search */ - protected String search; - - /** Search parameters */ - protected RecordsManagementSearchParameters searchParameters; - - /** - * - * @param name - * @param description - * @param search - * @param searchParameters - */ - public ReportDetails(String name, String description, String search, RecordsManagementSearchParameters searchParameters) - { - this.name = name; - this.description = description; - this.search = search; - this.searchParameters = searchParameters; - } - - /** - * @return {@link String} name - */ - public String getName() - { - return name; - } - - /** - * @return {@link String} description - */ - public String getDescription() - { - return description; - } - - /** - * @param description description - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * @return {@link String} search string - */ - public String getSearch() - { - return search; - } - - /** - * @param query query string - */ - public void setSearch(String search) - { - this.search = search; - } - - /** - * @return - */ - public RecordsManagementSearchParameters getSearchParameters() - { - return searchParameters; - } - - /** - * @param searchParameters - */ - public void setSearchParameters(RecordsManagementSearchParameters searchParameters) - { - this.searchParameters = searchParameters; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.search; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Report details. + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public class ReportDetails +{ + /** Name */ + protected String name; + + /** Description */ + protected String description; + + /** Search */ + protected String search; + + /** Search parameters */ + protected RecordsManagementSearchParameters searchParameters; + + /** + * + * @param name + * @param description + * @param search + * @param searchParameters + */ + public ReportDetails(String name, String description, String search, RecordsManagementSearchParameters searchParameters) + { + this.name = name; + this.description = description; + this.search = search; + this.searchParameters = searchParameters; + } + + /** + * @return {@link String} name + */ + public String getName() + { + return name; + } + + /** + * @return {@link String} description + */ + public String getDescription() + { + return description; + } + + /** + * @param description description + */ + public void setDescription(String description) + { + this.description = description; + } + + /** + * @return {@link String} search string + */ + public String getSearch() + { + return search; + } + + /** + * @param query query string + */ + public void setSearch(String search) + { + this.search = search; + } + + /** + * @return + */ + public RecordsManagementSearchParameters getSearchParameters() + { + return searchParameters; + } + + /** + * @param searchParameters + */ + public void setSearchParameters(RecordsManagementSearchParameters searchParameters) + { + this.searchParameters = searchParameters; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java index 4c4b66c258..6e6070a0f7 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java @@ -1,320 +1,320 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.search; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.util.ParameterCheck; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Saved search details. - * - * Example format of posted Saved Search JSON: - * - * { - * "siteid" : "rm", - * "name": "search name", - * "description": "the search description", - * "search": "the search sting as entered by the user", - * "public": boolean, - * "searchparams" : - * { - * "maxItems" : 500, - * "records" : true, - * "undeclaredrecords" : false, - * "vitalrecords" : false, - * "recordfolders" : false, - * "frozen" : false, - * "cutoff" : false, - * "containertypes" : - * [ - * "rma:recordSeries", - * "rma:recordCategory" - * ] - * "sort" : - * [ - * { - * "field" : "cm:name", - * "ascending" : true - * } - * ] - * } - * } - * - * where: name and query values are mandatory, - * searchparams contains the filters, sort, etc information about the query - * query is there for backward compatibility - * note: - * "params": "terms=keywords:xyz&undeclared=true", - * "sort": "cm:name/asc" - * "query": "the complete search query string", - * ... are sometimes found in the place of searchparams and are migrated to the new format when re-saved - * params are in URL encoded name/value pair format - * sort is in comma separated "property/dir" packed format i.e. "cm:name/asc,cm:title/desc" - * - * @author Roy Wetherall - */ -// Not @AlfrescoPublicApi at the moment as it requires RecordsManagementSearchServiceImpl which is not public API. -public class SavedSearchDetails extends ReportDetails -{ - // JSON label values - public static final String SITE_ID = "siteid"; - public static final String NAME = "name"; - public static final String DESCRIPTION = "description"; - public static final String SEARCH = "search"; - public static final String PUBLIC = "public"; - public static final String REPORT = "report"; - public static final String SEARCHPARAMS = "searchparams"; - - // JSON values for backwards compatibility - public static final String QUERY = "query"; - public static final String SORT = "sort"; - public static final String PARAMS = "params"; - - private static final String DEFAULT_SITE_ID = "rm"; - - /** Site id */ - private String siteId; - - /** Indicates whether the saved search is public or not */ - private boolean isPublic = true; - - /** Indicates whether the saved search is a report */ - private boolean isReport = false; - - /** Helper method to link to search node ref if provided */ - private NodeRef nodeRef = null; - - /** Namespace service */ - NamespaceService namespaceService; - - /** Records management search service */ - RecordsManagementSearchServiceImpl searchService; - - /** Saves search details compatibility */ - private SavedSearchDetailsCompatibility compatibility; - - /** - * - * @param jsonString - * @return - */ - /*package*/ static SavedSearchDetails createFromJSON(String jsonString, NamespaceService namespaceService, RecordsManagementSearchServiceImpl searchService, NodeRef nodeRef) - { - try - { - JSONObject search = new JSONObject(jsonString); - - // Get the site id - String siteId = DEFAULT_SITE_ID; - if (search.has(SITE_ID)) - { - siteId = search.getString(SITE_ID); - } - - // Get the name - if (!search.has(NAME)) - { - throw new AlfrescoRuntimeException("Can not create saved search details from json, because required name is not present. " + jsonString); - } - String name = search.getString(NAME); - - // Get the description - String description = ""; - if (search.has(DESCRIPTION)) - { - description = search.getString(DESCRIPTION); - String translated = I18NUtil.getMessage(description); - if (translated != null) - { - description = translated; - } - } - - // Get the query - String query = null; - if (!search.has(SEARCH)) - { - // We are probably dealing with a "old" style saved search - if (search.has(PARAMS)) - { - String oldParams = search.getString(PARAMS); - query = SavedSearchDetailsCompatibility.getSearchFromParams(oldParams); - } - else - { - throw new AlfrescoRuntimeException("Can not create saved search details from json, because required search is not present. " + jsonString); - } - - } - else - { - query = search.getString(SEARCH); - } - - // Get the search parameters - RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); - if (search.has(SEARCHPARAMS)) - { - searchParameters = RecordsManagementSearchParameters.createFromJSON(search.getJSONObject(SEARCHPARAMS), namespaceService); - } - else - { - // See if we are dealing with the old style of saved search - if (search.has(PARAMS)) - { - String oldParams = search.getString(PARAMS); - String oldSort = search.getString(SORT); - searchParameters = SavedSearchDetailsCompatibility.createSearchParameters(oldParams, oldSort, namespaceService); - } - } - - // Determine whether the saved query is public or not - boolean isPublic = true; - if (search.has(PUBLIC)) - { - isPublic = search.getBoolean(PUBLIC); - } - - // Determine whether the saved query is a report or not - boolean isReport = false; - if (search.has(REPORT)) - { - isReport = search.getBoolean(REPORT); - } - - // Create the saved search details object - SavedSearchDetails savedSearchDetails = new SavedSearchDetails(siteId, name, description, query, searchParameters, isPublic, isReport, namespaceService, searchService); - savedSearchDetails.nodeRef = nodeRef; - return savedSearchDetails; - } - catch (JSONException exception) - { - throw new AlfrescoRuntimeException("Can not create saved search details from json. " + jsonString, exception); - } - } - - /** - * @param siteId - * @param name - * @param description - * @param isPublic - */ - /*package*/ SavedSearchDetails( - String siteId, - String name, - String description, - String serach, - RecordsManagementSearchParameters searchParameters, - boolean isPublic, - boolean isReport, - NamespaceService namespaceService, - RecordsManagementSearchServiceImpl searchService) - { - super(name, description, serach, searchParameters); - - ParameterCheck.mandatory("siteId", siteId); - ParameterCheck.mandatory("namespaceService", namespaceService); - ParameterCheck.mandatory("searchService", searchService); - - this.siteId = siteId; - this.isPublic = isPublic; - this.isReport = isReport; - this.namespaceService = namespaceService; - this.compatibility = new SavedSearchDetailsCompatibility(this, namespaceService, searchService); - this.searchService = searchService; - } - - /** - * @return - */ - public String getSiteId() - { - return siteId; - } - - /** - * @return - */ - public boolean isPublic() - { - return isPublic; - } - - /** - * @return - */ - public boolean isReport() - { - return isReport; - } - - public SavedSearchDetailsCompatibility getCompatibility() - { - return compatibility; - } - - /** - * @return NodeRef search node ref, null if not set - */ - public NodeRef getNodeRef() - { - return nodeRef; - } - - /** - * @return - */ - public String toJSONString() - { - try - { - JSONObject jsonObject = new JSONObject(); - jsonObject.put(SITE_ID, siteId); - jsonObject.put(NAME, name); - jsonObject.put(DESCRIPTION, description); - jsonObject.put(SEARCH, search); - jsonObject.put(SEARCHPARAMS, searchParameters.toJSONObject(namespaceService)); - jsonObject.put(PUBLIC, isPublic); - - // Add full query for backward compatibility - jsonObject.put(QUERY, searchService.buildQueryString(search, searchParameters)); - jsonObject.put(SORT, compatibility.getSort()); - - return jsonObject.toString(); - } - catch (JSONException exception) - { - throw new AlfrescoRuntimeException("Can not convert saved search details into JSON.", exception); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.search; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.util.ParameterCheck; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Saved search details. + * + * Example format of posted Saved Search JSON: + * + * { + * "siteid" : "rm", + * "name": "search name", + * "description": "the search description", + * "search": "the search sting as entered by the user", + * "public": boolean, + * "searchparams" : + * { + * "maxItems" : 500, + * "records" : true, + * "undeclaredrecords" : false, + * "vitalrecords" : false, + * "recordfolders" : false, + * "frozen" : false, + * "cutoff" : false, + * "containertypes" : + * [ + * "rma:recordSeries", + * "rma:recordCategory" + * ] + * "sort" : + * [ + * { + * "field" : "cm:name", + * "ascending" : true + * } + * ] + * } + * } + * + * where: name and query values are mandatory, + * searchparams contains the filters, sort, etc information about the query + * query is there for backward compatibility + * note: + * "params": "terms=keywords:xyz&undeclared=true", + * "sort": "cm:name/asc" + * "query": "the complete search query string", + * ... are sometimes found in the place of searchparams and are migrated to the new format when re-saved + * params are in URL encoded name/value pair format + * sort is in comma separated "property/dir" packed format i.e. "cm:name/asc,cm:title/desc" + * + * @author Roy Wetherall + */ +// Not @AlfrescoPublicApi at the moment as it requires RecordsManagementSearchServiceImpl which is not public API. +public class SavedSearchDetails extends ReportDetails +{ + // JSON label values + public static final String SITE_ID = "siteid"; + public static final String NAME = "name"; + public static final String DESCRIPTION = "description"; + public static final String SEARCH = "search"; + public static final String PUBLIC = "public"; + public static final String REPORT = "report"; + public static final String SEARCHPARAMS = "searchparams"; + + // JSON values for backwards compatibility + public static final String QUERY = "query"; + public static final String SORT = "sort"; + public static final String PARAMS = "params"; + + private static final String DEFAULT_SITE_ID = "rm"; + + /** Site id */ + private String siteId; + + /** Indicates whether the saved search is public or not */ + private boolean isPublic = true; + + /** Indicates whether the saved search is a report */ + private boolean isReport = false; + + /** Helper method to link to search node ref if provided */ + private NodeRef nodeRef = null; + + /** Namespace service */ + NamespaceService namespaceService; + + /** Records management search service */ + RecordsManagementSearchServiceImpl searchService; + + /** Saves search details compatibility */ + private SavedSearchDetailsCompatibility compatibility; + + /** + * + * @param jsonString + * @return + */ + /*package*/ static SavedSearchDetails createFromJSON(String jsonString, NamespaceService namespaceService, RecordsManagementSearchServiceImpl searchService, NodeRef nodeRef) + { + try + { + JSONObject search = new JSONObject(jsonString); + + // Get the site id + String siteId = DEFAULT_SITE_ID; + if (search.has(SITE_ID)) + { + siteId = search.getString(SITE_ID); + } + + // Get the name + if (!search.has(NAME)) + { + throw new AlfrescoRuntimeException("Can not create saved search details from json, because required name is not present. " + jsonString); + } + String name = search.getString(NAME); + + // Get the description + String description = ""; + if (search.has(DESCRIPTION)) + { + description = search.getString(DESCRIPTION); + String translated = I18NUtil.getMessage(description); + if (translated != null) + { + description = translated; + } + } + + // Get the query + String query = null; + if (!search.has(SEARCH)) + { + // We are probably dealing with a "old" style saved search + if (search.has(PARAMS)) + { + String oldParams = search.getString(PARAMS); + query = SavedSearchDetailsCompatibility.getSearchFromParams(oldParams); + } + else + { + throw new AlfrescoRuntimeException("Can not create saved search details from json, because required search is not present. " + jsonString); + } + + } + else + { + query = search.getString(SEARCH); + } + + // Get the search parameters + RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); + if (search.has(SEARCHPARAMS)) + { + searchParameters = RecordsManagementSearchParameters.createFromJSON(search.getJSONObject(SEARCHPARAMS), namespaceService); + } + else + { + // See if we are dealing with the old style of saved search + if (search.has(PARAMS)) + { + String oldParams = search.getString(PARAMS); + String oldSort = search.getString(SORT); + searchParameters = SavedSearchDetailsCompatibility.createSearchParameters(oldParams, oldSort, namespaceService); + } + } + + // Determine whether the saved query is public or not + boolean isPublic = true; + if (search.has(PUBLIC)) + { + isPublic = search.getBoolean(PUBLIC); + } + + // Determine whether the saved query is a report or not + boolean isReport = false; + if (search.has(REPORT)) + { + isReport = search.getBoolean(REPORT); + } + + // Create the saved search details object + SavedSearchDetails savedSearchDetails = new SavedSearchDetails(siteId, name, description, query, searchParameters, isPublic, isReport, namespaceService, searchService); + savedSearchDetails.nodeRef = nodeRef; + return savedSearchDetails; + } + catch (JSONException exception) + { + throw new AlfrescoRuntimeException("Can not create saved search details from json. " + jsonString, exception); + } + } + + /** + * @param siteId + * @param name + * @param description + * @param isPublic + */ + /*package*/ SavedSearchDetails( + String siteId, + String name, + String description, + String serach, + RecordsManagementSearchParameters searchParameters, + boolean isPublic, + boolean isReport, + NamespaceService namespaceService, + RecordsManagementSearchServiceImpl searchService) + { + super(name, description, serach, searchParameters); + + ParameterCheck.mandatory("siteId", siteId); + ParameterCheck.mandatory("namespaceService", namespaceService); + ParameterCheck.mandatory("searchService", searchService); + + this.siteId = siteId; + this.isPublic = isPublic; + this.isReport = isReport; + this.namespaceService = namespaceService; + this.compatibility = new SavedSearchDetailsCompatibility(this, namespaceService, searchService); + this.searchService = searchService; + } + + /** + * @return + */ + public String getSiteId() + { + return siteId; + } + + /** + * @return + */ + public boolean isPublic() + { + return isPublic; + } + + /** + * @return + */ + public boolean isReport() + { + return isReport; + } + + public SavedSearchDetailsCompatibility getCompatibility() + { + return compatibility; + } + + /** + * @return NodeRef search node ref, null if not set + */ + public NodeRef getNodeRef() + { + return nodeRef; + } + + /** + * @return + */ + public String toJSONString() + { + try + { + JSONObject jsonObject = new JSONObject(); + jsonObject.put(SITE_ID, siteId); + jsonObject.put(NAME, name); + jsonObject.put(DESCRIPTION, description); + jsonObject.put(SEARCH, search); + jsonObject.put(SEARCHPARAMS, searchParameters.toJSONObject(namespaceService)); + jsonObject.put(PUBLIC, isPublic); + + // Add full query for backward compatibility + jsonObject.put(QUERY, searchService.buildQueryString(search, searchParameters)); + jsonObject.put(SORT, compatibility.getSort()); + + return jsonObject.toString(); + } + catch (JSONException exception) + { + throw new AlfrescoRuntimeException("Can not convert saved search details into JSON.", exception); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java index 7da5ccd521..30d9d3eee8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java @@ -1,233 +1,233 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.search; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Compatibility class. - * - * Used to bridge between the old style of saved search passed and required by the UI and the new actual saved search details. - * Eventually will be factored out as web scripts are brought up to date. - */ -// Not @AlfrescoPublicApi at the moment as it requires RecordsManagementSearchServiceImpl which is not public API. -public class SavedSearchDetailsCompatibility implements RecordsManagementModel -{ - /** Saved search details */ - private final SavedSearchDetails savedSearchDetails; - - /** Namespace service */ - private final NamespaceService namespaceService; - - /** Records management search service implementation */ - private final RecordsManagementSearchServiceImpl searchService; - - /** - * Retrieve the search from the parameter string - * @param params parameter string - * @return String search term - */ - public static String getSearchFromParams(String params) - { - String search = null; - String[] values = params.split("&"); - for (String value : values) - { - if (value.startsWith("terms")) - { - String[] terms = value.trim().split("="); - try - { - search = URLDecoder.decode(terms[1], "UTF-8"); - } - catch (UnsupportedEncodingException e) - { - // Do nothing just return null - search = null; - } - break; - } - } - - return search; - } - - public static RecordsManagementSearchParameters createSearchParameters(String params, String sort, NamespaceService namespaceService) - { - return createSearchParameters(params, new String[]{"&", "="}, sort, namespaceService); - } - - /** - * - * @param params - * @param sort - * @param namespaceService - * @return - */ - public static RecordsManagementSearchParameters createSearchParameters(String params, String[] paramsDelim, String sort, NamespaceService namespaceService) - { - RecordsManagementSearchParameters result = new RecordsManagementSearchParameters(); - List includedContainerTypes = new ArrayList(2); - - // Map the param values into the search parameter object - String[] values = params.split(paramsDelim[0]); - for (String value : values) - { - String[] paramValues = value.split(paramsDelim[1]); - String paramName = paramValues[0].trim(); - String paramValue = paramValues[1].trim(); - if ("records".equals(paramName)) - { - result.setIncludeRecords(Boolean.parseBoolean(paramValue)); - } - else if ("undeclared".equals(paramName)) - { - result.setIncludeUndeclaredRecords(Boolean.parseBoolean(paramValue)); - } - else if ("vital".equals(paramName)) - { - result.setIncludeVitalRecords(Boolean.parseBoolean(paramValue)); - } - else if ("folders".equals(paramName)) - { - result.setIncludeRecordFolders(Boolean.parseBoolean(paramValue)); - } - else if ("frozen".equals(paramName)) - { - result.setIncludeFrozen(Boolean.parseBoolean(paramValue)); - } - else if ("cutoff".equals(paramName)) - { - result.setIncludeCutoff(Boolean.parseBoolean(paramValue)); - } - else if ("categories".equals(paramName) && Boolean.parseBoolean(paramValue)) - { - includedContainerTypes.add(TYPE_RECORD_CATEGORY); - } - } - result.setIncludedContainerTypes(includedContainerTypes); - - if (sort != null) - { - // Map the sort string into the search details - String[] sortPairs = sort.split(","); - List sortOrder = new ArrayList(sortPairs.length); - for (String sortPairString : sortPairs) - { - String[] sortPair = sortPairString.split("/"); - QName field = QName.createQName(sortPair[0], namespaceService); - Boolean isAcsending = Boolean.FALSE; - if ("asc".equals(sortPair[1])) - { - isAcsending = Boolean.TRUE; - } - sortOrder.add(new SortItem(field, isAcsending)); - } - result.setSortOrder(sortOrder); - } - - return result; - } - - /** - * Constructor - * @param savedSearchDetails - */ - public SavedSearchDetailsCompatibility(SavedSearchDetails savedSearchDetails, - NamespaceService namespaceService, - RecordsManagementSearchServiceImpl searchService) - { - this.savedSearchDetails = savedSearchDetails; - this.namespaceService = namespaceService; - this.searchService = searchService; - } - - /** - * Get the sort string from the saved search details - * @return - */ - public String getSort() - { - StringBuilder builder = new StringBuilder(64); - - for (SortItem entry : this.savedSearchDetails.getSearchParameters().getSortOrder()) - { - if (builder.length() !=0) - { - builder.append(","); - } - - String order = "desc"; - if (entry.assc) - { - order = "asc"; - } - builder.append(entry.property.toPrefixString(this.namespaceService)) - .append("/") - .append(order); - } - - return builder.toString(); - } - - /** - * Get the parameter string from the saved search details - * @return - */ - public String getParams() - { - List includeContainerTypes = this.savedSearchDetails.getSearchParameters().getIncludedContainerTypes(); - StringBuilder builder = new StringBuilder(128); - builder.append("terms=").append(this.savedSearchDetails.getSearch()).append("&") - .append("records=").append(this.savedSearchDetails.getSearchParameters().isIncludeRecords()).append("&") - .append("undeclared=").append(this.savedSearchDetails.getSearchParameters().isIncludeUndeclaredRecords()).append("&") - .append("vital=").append(this.savedSearchDetails.getSearchParameters().isIncludeVitalRecords()).append("&") - .append("folders=").append(this.savedSearchDetails.getSearchParameters().isIncludeRecordFolders()).append("&") - .append("frozen=").append(this.savedSearchDetails.getSearchParameters().isIncludeFrozen()).append("&") - .append("cutoff=").append(this.savedSearchDetails.getSearchParameters().isIncludeCutoff()).append("&") - .append("categories=").append(includeContainerTypes.contains(TYPE_RECORD_CATEGORY)).append("&") - .append("series=").append(false); - return builder.toString(); - } - - /** - * Build the full query string - * @return - */ - public String getQuery() - { - return searchService.buildQueryString(this.savedSearchDetails.getSearch(), this.savedSearchDetails.getSearchParameters()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.search; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Compatibility class. + * + * Used to bridge between the old style of saved search passed and required by the UI and the new actual saved search details. + * Eventually will be factored out as web scripts are brought up to date. + */ +// Not @AlfrescoPublicApi at the moment as it requires RecordsManagementSearchServiceImpl which is not public API. +public class SavedSearchDetailsCompatibility implements RecordsManagementModel +{ + /** Saved search details */ + private final SavedSearchDetails savedSearchDetails; + + /** Namespace service */ + private final NamespaceService namespaceService; + + /** Records management search service implementation */ + private final RecordsManagementSearchServiceImpl searchService; + + /** + * Retrieve the search from the parameter string + * @param params parameter string + * @return String search term + */ + public static String getSearchFromParams(String params) + { + String search = null; + String[] values = params.split("&"); + for (String value : values) + { + if (value.startsWith("terms")) + { + String[] terms = value.trim().split("="); + try + { + search = URLDecoder.decode(terms[1], "UTF-8"); + } + catch (UnsupportedEncodingException e) + { + // Do nothing just return null + search = null; + } + break; + } + } + + return search; + } + + public static RecordsManagementSearchParameters createSearchParameters(String params, String sort, NamespaceService namespaceService) + { + return createSearchParameters(params, new String[]{"&", "="}, sort, namespaceService); + } + + /** + * + * @param params + * @param sort + * @param namespaceService + * @return + */ + public static RecordsManagementSearchParameters createSearchParameters(String params, String[] paramsDelim, String sort, NamespaceService namespaceService) + { + RecordsManagementSearchParameters result = new RecordsManagementSearchParameters(); + List includedContainerTypes = new ArrayList(2); + + // Map the param values into the search parameter object + String[] values = params.split(paramsDelim[0]); + for (String value : values) + { + String[] paramValues = value.split(paramsDelim[1]); + String paramName = paramValues[0].trim(); + String paramValue = paramValues[1].trim(); + if ("records".equals(paramName)) + { + result.setIncludeRecords(Boolean.parseBoolean(paramValue)); + } + else if ("undeclared".equals(paramName)) + { + result.setIncludeUndeclaredRecords(Boolean.parseBoolean(paramValue)); + } + else if ("vital".equals(paramName)) + { + result.setIncludeVitalRecords(Boolean.parseBoolean(paramValue)); + } + else if ("folders".equals(paramName)) + { + result.setIncludeRecordFolders(Boolean.parseBoolean(paramValue)); + } + else if ("frozen".equals(paramName)) + { + result.setIncludeFrozen(Boolean.parseBoolean(paramValue)); + } + else if ("cutoff".equals(paramName)) + { + result.setIncludeCutoff(Boolean.parseBoolean(paramValue)); + } + else if ("categories".equals(paramName) && Boolean.parseBoolean(paramValue)) + { + includedContainerTypes.add(TYPE_RECORD_CATEGORY); + } + } + result.setIncludedContainerTypes(includedContainerTypes); + + if (sort != null) + { + // Map the sort string into the search details + String[] sortPairs = sort.split(","); + List sortOrder = new ArrayList(sortPairs.length); + for (String sortPairString : sortPairs) + { + String[] sortPair = sortPairString.split("/"); + QName field = QName.createQName(sortPair[0], namespaceService); + Boolean isAcsending = Boolean.FALSE; + if ("asc".equals(sortPair[1])) + { + isAcsending = Boolean.TRUE; + } + sortOrder.add(new SortItem(field, isAcsending)); + } + result.setSortOrder(sortOrder); + } + + return result; + } + + /** + * Constructor + * @param savedSearchDetails + */ + public SavedSearchDetailsCompatibility(SavedSearchDetails savedSearchDetails, + NamespaceService namespaceService, + RecordsManagementSearchServiceImpl searchService) + { + this.savedSearchDetails = savedSearchDetails; + this.namespaceService = namespaceService; + this.searchService = searchService; + } + + /** + * Get the sort string from the saved search details + * @return + */ + public String getSort() + { + StringBuilder builder = new StringBuilder(64); + + for (SortItem entry : this.savedSearchDetails.getSearchParameters().getSortOrder()) + { + if (builder.length() !=0) + { + builder.append(","); + } + + String order = "desc"; + if (entry.assc) + { + order = "asc"; + } + builder.append(entry.property.toPrefixString(this.namespaceService)) + .append("/") + .append(order); + } + + return builder.toString(); + } + + /** + * Get the parameter string from the saved search details + * @return + */ + public String getParams() + { + List includeContainerTypes = this.savedSearchDetails.getSearchParameters().getIncludedContainerTypes(); + StringBuilder builder = new StringBuilder(128); + builder.append("terms=").append(this.savedSearchDetails.getSearch()).append("&") + .append("records=").append(this.savedSearchDetails.getSearchParameters().isIncludeRecords()).append("&") + .append("undeclared=").append(this.savedSearchDetails.getSearchParameters().isIncludeUndeclaredRecords()).append("&") + .append("vital=").append(this.savedSearchDetails.getSearchParameters().isIncludeVitalRecords()).append("&") + .append("folders=").append(this.savedSearchDetails.getSearchParameters().isIncludeRecordFolders()).append("&") + .append("frozen=").append(this.savedSearchDetails.getSearchParameters().isIncludeFrozen()).append("&") + .append("cutoff=").append(this.savedSearchDetails.getSearchParameters().isIncludeCutoff()).append("&") + .append("categories=").append(includeContainerTypes.contains(TYPE_RECORD_CATEGORY)).append("&") + .append("series=").append(false); + return builder.toString(); + } + + /** + * Build the full query string + * @return + */ + public String getQuery() + { + return searchService.buildQueryString(this.savedSearchDetails.getSearch(), this.savedSearchDetails.getSearchParameters()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SortItem.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SortItem.java index 392cbbcef8..d2296e2bc3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SortItem.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/search/SortItem.java @@ -1,44 +1,44 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.search; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.namespace.QName; - -@AlfrescoPublicApi -/*package*/ class SortItem -{ - public QName property = null; - public boolean assc = true; - public SortItem(QName property, boolean assc) - { - this.property = property; - this.assc = assc; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.search; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.namespace.QName; + +@AlfrescoPublicApi +/*package*/ class SortItem +{ + public QName property = null; + public boolean assc = true; + public SortItem(QName property, boolean assc) + { + this.property = property; + this.assc = assc; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java index afa06f4fdb..908f09a2e9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java @@ -1,105 +1,105 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.Set; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.Pair; - -/** - * Extended security service. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface ExtendedSecurityService extends DeprecatedExtendedSecurityService -{ - /** IPR group prefix */ - static final String IPR_GROUP_PREFIX = "IPR"; - - /** - * Indicates whether a node has extended security. - * - * @param nodeRef node reference - * @return boolean true if the node has extended security, false otherwise - */ - boolean hasExtendedSecurity(NodeRef nodeRef); - - /** - * Gets the set of authorities that are extended readers for the given node. - * - * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended readers - */ - Set getReaders(NodeRef nodeRef); - - /** - * Get the set of authorities that are extended writers for the given node. - * - * @param nodeRef node reference - * @return {@link Set}<{@link String}> set of extended writers - */ - Set getWriters(NodeRef nodeRef); - - /** - * Helper to allow caller to provide authority sets as a pair where the - * first is the readers and the second is the writers. - * - * @see #set(NodeRef, Set, Set) - * - * @param nodeRef node reference - * @param readersAndWriters pair where first is the set of readers and the - * second is the set of writers - */ - void set(NodeRef nodeRef, Pair, Set> readersAndWriters); - - /** - * Set extended security for a node, where the readers will be granted ReadRecord - * permission and ViewRecord capability to the node and where the writers will be - * granted Filling permission and Filling capability to the node. - *

- * Note it is vaild to provide 'null' values for readers and/or writers. - * - * @param nodeRef node reference - * @param readers set of readers - * @param writers set of writers - * - * @since 2.5 - */ - void set(NodeRef nodeRef, Set readers, Set writers); - - /** - * Removes all extended security from a node. - * - * @param nodeRef node reference - */ - void remove(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.Pair; + +/** + * Extended security service. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface ExtendedSecurityService extends DeprecatedExtendedSecurityService +{ + /** IPR group prefix */ + static final String IPR_GROUP_PREFIX = "IPR"; + + /** + * Indicates whether a node has extended security. + * + * @param nodeRef node reference + * @return boolean true if the node has extended security, false otherwise + */ + boolean hasExtendedSecurity(NodeRef nodeRef); + + /** + * Gets the set of authorities that are extended readers for the given node. + * + * @param nodeRef node reference + * @return {@link Set}<{@link String}> set of extended readers + */ + Set getReaders(NodeRef nodeRef); + + /** + * Get the set of authorities that are extended writers for the given node. + * + * @param nodeRef node reference + * @return {@link Set}<{@link String}> set of extended writers + */ + Set getWriters(NodeRef nodeRef); + + /** + * Helper to allow caller to provide authority sets as a pair where the + * first is the readers and the second is the writers. + * + * @see #set(NodeRef, Set, Set) + * + * @param nodeRef node reference + * @param readersAndWriters pair where first is the set of readers and the + * second is the set of writers + */ + void set(NodeRef nodeRef, Pair, Set> readersAndWriters); + + /** + * Set extended security for a node, where the readers will be granted ReadRecord + * permission and ViewRecord capability to the node and where the writers will be + * granted Filling permission and Filling capability to the node. + *

+ * Note it is vaild to provide 'null' values for readers and/or writers. + * + * @param nodeRef node reference + * @param readers set of readers + * @param writers set of writers + * + * @since 2.5 + */ + void set(NodeRef nodeRef, Set readers, Set writers); + + /** + * Removes all extended security from a node. + * + * @param nodeRef node reference + */ + void remove(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java index 08ddbd2cd5..1d1525c4ef 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java @@ -1,646 +1,646 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import static org.alfresco.service.cmr.security.PermissionService.GROUP_PREFIX; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.model.RenditionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.extensions.webscripts.ui.common.StringUtils; - -/** - * Extended security service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedSecurityServiceImpl extends ServiceBaseImpl - implements ExtendedSecurityService, - RecordsManagementModel, - ApplicationListener -{ - /** ipr group names */ - static final String ROOT_IPR_GROUP = "INPLACE_RECORD_MANAGEMENT"; - static final String READER_GROUP_PREFIX = ExtendedSecurityService.IPR_GROUP_PREFIX + "R"; - static final String WRITER_GROUP_PREFIX = ExtendedSecurityService.IPR_GROUP_PREFIX + "W"; - - /** max page size for authority query */ - private static final int MAX_ITEMS = 50; - - /** File plan service */ - private FilePlanService filePlanService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** authority service */ - private AuthorityService authorityService; - - /** permission service */ - private PermissionService permissionService; - - /** transaction service */ - private TransactionService transactionService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanRoleService file plan role service - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * @param transactionService transaction service - */ - public void setTransactionService(TransactionService transactionService) - { - this.transactionService = transactionService; - } - - /** - * Application context refresh event handler - */ - @Override - public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) - { - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // if the root group doesn't exist then create it - if (!authorityService.authorityExists(getRootIRPGroup())) - { - authorityService.createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, Collections.singleton(RMAuthority.ZONE_APP_RM)); - } - - return null; - } - }); - } - - /** - * Get root IPR group name - */ - private String getRootIRPGroup() - { - return GROUP_PREFIX + ROOT_IPR_GROUP; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#hasExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean hasExtendedSecurity(NodeRef nodeRef) - { - return (getIPRGroups(nodeRef) != null); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getReaders(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - public Set getReaders(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Set result = Collections.EMPTY_SET; - Pair iprGroups = getIPRGroups(nodeRef); - if (iprGroups != null) - { - result = getAuthorities(iprGroups.getFirst()); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#getWriters(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - public Set getWriters(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Set result = Collections.EMPTY_SET; - Pair iprGroups = getIPRGroups(nodeRef); - if (iprGroups != null) - { - result = getAuthorities(iprGroups.getSecond()); - } - - return result; - } - - /** - * Helper to get authorities for a given group - * - * @param group group name - * @return Set immediate authorities - */ - private Set getAuthorities(String group) - { - Set result = new HashSet(); - result.addAll(authorityService.getContainedAuthorities(null, group, true)); - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#set(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.util.Pair) - */ - @Override - public void set(NodeRef nodeRef, Pair, Set> readersAndWriters) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - set(nodeRef, readersAndWriters.getFirst(), readersAndWriters.getSecond()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#set(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) - */ - @Override - public void set(NodeRef nodeRef, Set readers, Set writers) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // remove existing extended security, assuming there is any - remove(nodeRef); - - // find groups - Pair iprGroups = createOrFindIPRGroups(readers, writers); - - // assign groups to correct fileplan roles - NodeRef filePlan = filePlanService.getFilePlan(nodeRef); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, iprGroups.getFirst()); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, iprGroups.getSecond()); - - // assign groups to node - assignIPRGroupsToNode(iprGroups, nodeRef); - - // apply the readers to any renditions of the content - if (isRecord(nodeRef)) - { - List assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef child = assoc.getChildRef(); - assignIPRGroupsToNode(iprGroups, child); - } - } - } - - /** - * Get the IPR groups associated with a given node reference. - *

- * Return null if none found. - * - * @param nodeRef node reference - * @return Pair where first is the read group and second if the write group, null if none found - */ - private Pair getIPRGroups(NodeRef nodeRef) - { - Pair result = null; - String iprReaderGroup = null; - String iprWriterGroup = null; - - // get all the set permissions - Set permissions = permissionService.getAllSetPermissions(nodeRef); - for (AccessPermission permission : permissions) - { - // look for the presence of the reader group - if (permission.getAuthority().startsWith(GROUP_PREFIX + READER_GROUP_PREFIX)) - { - iprReaderGroup = permission.getAuthority(); - } - // look for the presence of the writer group - else if (permission.getAuthority().startsWith(GROUP_PREFIX + WRITER_GROUP_PREFIX)) - { - iprWriterGroup = permission.getAuthority(); - } - } - - // assuming the are both present then return - if (iprReaderGroup != null && iprWriterGroup != null) - { - result = new Pair(iprReaderGroup, iprWriterGroup); - } - - return result; - } - - /** - * Given a set of readers and writers find or create the appropriate IPR groups. - *

- * The IPR groups are named with hashes of the authority lists in order to reduce - * the set of groups that require exact match. A further index is used to handle - * a situation where there is a hash clash, but a difference in the authority lists. - *

- * When no match is found the groups are created. Once created - * - * @param filePlan file plan - * @param readers authorities with read - * @param writers authorities with write - * @return Pair where first is the full name of the read group and - * second is the full name of the write group - */ - private Pair createOrFindIPRGroups(Set readers, Set writers) - { - return new Pair( - createOrFindIPRGroup(READER_GROUP_PREFIX, readers), - createOrFindIPRGroup(WRITER_GROUP_PREFIX, writers)); - } - - /** - * Create or find an IPR group based on the provided prefix and authorities. - * - * @param groupPrefix group prefix - * @param authorities authorities - * @return String full group name - */ - private String createOrFindIPRGroup(String groupPrefix, Set authorities) - { - String group = null; - - // find group or determine what the next index is if no group exists or there is a clash - Pair groupResult = findIPRGroup(groupPrefix, authorities); - - if (groupResult.getFirst() == null) - { - group = createIPRGroup(groupPrefix, authorities, groupResult.getSecond()); - } - else - { - group = groupResult.getFirst(); - } - - return group; - } - - /** - * Given a group name prefix and the authorities, finds the exact match existing group. - *

- * If the group does not exist then the group returned is null and the index shows the next available - * group index for creation. - * - * @param groupPrefix group name prefix - * @param authorities authorities - * @return Pair where first is the name of the found group, null if none found and second - * if the next available create index - */ - private Pair findIPRGroup(String groupPrefix, Set authorities) - { - String iprGroup = null; - int nextGroupIndex = 0; - boolean hasMoreItems = true; - int pageCount = 0; - - // determine the short name prefix - String groupShortNamePrefix = getIPRGroupPrefixShortName(groupPrefix, authorities); - - // iterate over the authorities to find a match - while (hasMoreItems == true) - { - // get matching authorities - PagingResults results = authorityService.getAuthorities(AuthorityType.GROUP, - RMAuthority.ZONE_APP_RM, - groupShortNamePrefix, - false, - false, - new PagingRequest(MAX_ITEMS*pageCount, MAX_ITEMS)); - - // record the total count - nextGroupIndex = nextGroupIndex + results.getPage().size(); - - // see if any of the matching groups exactly match - for (String group : results.getPage()) - { - // if exists and matches we have found our group - if (isIPRGroupTrueMatch(group, authorities)) - { - iprGroup = group; - break; - } - } - - // determine if there are any more pages to inspect - hasMoreItems = results.hasMoreItems(); - pageCount ++; - } - - return new Pair(iprGroup, nextGroupIndex); - } - - /** - * Determines whether a group exactly matches a list of authorities. - * - * @param authorities list of authorities - * @param group group - * @return - */ - private boolean isIPRGroupTrueMatch(String group, Set authorities) - { - Set contained = authorityService.getContainedAuthorities(null, group, true); - return contained.equals(authorities); - } - - /** - * Get IPR group prefix short name. - *

- * 'package' scope to help testing. - * - * @param prefix prefix - * @param authorities authorities - * @return String group prefix short name - */ - /*package*/ String getIPRGroupPrefixShortName(String prefix, Set authorities) - { - StringBuilder builder = new StringBuilder(128) - .append(prefix) - .append(getAuthoritySetHashCode(authorities)); - - return builder.toString(); - } - - /** - * Get IPR group short name. - *

- * Note this excludes the "GROUP_" prefix. - *

- * 'package' scope to help testing. - * - * @param prefix prefix - * @param readers read authorities - * @param writers write authorities - * @param index group index - * @return String group short name - */ - /*package*/ String getIPRGroupShortName(String prefix, Set authorities, int index) - { - return getIPRGroupShortName(prefix, authorities, Integer.toString(index)); - } - - /** - * Get IPR group short name. - *

- * Note this excludes the "GROUP_" prefix. - * - * @param prefix prefix - * @param readers read authorities - * @param writers write authorities - * @param index group index - * @return String group short name - */ - private String getIPRGroupShortName(String prefix, Set authorities, String index) - { - StringBuilder builder = new StringBuilder(128) - .append(getIPRGroupPrefixShortName(prefix, authorities)) - .append(index); - - return builder.toString(); - } - - /** - * Gets the hashcode value of a set of authorities. - * - * @param authorities set of authorities - * @return int hash code - */ - private int getAuthoritySetHashCode(Set authorities) - { - int result = 0; - if (authorities != null && !authorities.isEmpty()) - { - result = StringUtils.join(authorities.toArray(), "").hashCode(); - } - return result; - } - - /** - * Creates a new IPR group. - * - * @param groupNamePrefix group name prefix - * @param children child authorities - * @param index group index - * @return String full name of created group - */ - private String createIPRGroup(String groupNamePrefix, Set children, int index) - { - ParameterCheck.mandatory("groupNamePrefix", groupNamePrefix); - - // get the group name - String groupShortName = getIPRGroupShortName(groupNamePrefix, children, index); - - // create group - String group = authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, Collections.singleton(RMAuthority.ZONE_APP_RM)); - - // add root parent - authorityService.addAuthority(getRootIRPGroup(), group); - - // add children if provided - if (children != null) - { - for (String child : children) - { - if (authorityService.authorityExists(child) && - !PermissionService.ALL_AUTHORITIES.equals(child)) - { - authorityService.addAuthority(group, child); - } - } - } - - return group; - } - - /** - * Assign IPR groups to a node reference with the correct permissions. - * - * @param iprGroups iprGroups, first read and second write - * @param nodeRef node reference - */ - private void assignIPRGroupsToNode(Pair iprGroups, NodeRef nodeRef) - { - permissionService.setPermission(nodeRef, iprGroups.getFirst(), RMPermissionModel.READ_RECORDS, true); - permissionService.setPermission(nodeRef, iprGroups.getSecond(), RMPermissionModel.FILING, true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#remove(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void remove(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - Pair iprGroups = getIPRGroups(nodeRef); - if (iprGroups != null) - { - // remove any extended security that might be present - clearPermissions(nodeRef, iprGroups); - - // remove the readers from any renditions of the content - if (isRecord(nodeRef)) - { - List assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - NodeRef child = assoc.getChildRef(); - clearPermissions(child, iprGroups); - } - } - } - } - - /** - * Clear the nodes IPR permissions - * - * @param nodeRef node reference - */ - private void clearPermissions(NodeRef nodeRef, Pair iprGroups) - { - // remove group permissions from node - permissionService.clearPermission(nodeRef, iprGroups.getFirst()); - permissionService.clearPermission(nodeRef, iprGroups.getSecond()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#getExtendedReaders(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override @Deprecated public Set getExtendedReaders(NodeRef nodeRef) - { - return getReaders(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#getExtendedWriters(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override @Deprecated public Set getExtendedWriters(NodeRef nodeRef) - { - return getWriters(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#addExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) - */ - @Override @Deprecated public void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers) - { - set(nodeRef, readers, writers); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#addExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set, boolean) - */ - @Override @Deprecated public void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents) - { - set(nodeRef, readers, writers); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeAllExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override @Deprecated public void removeAllExtendedSecurity(NodeRef nodeRef) - { - remove(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) - */ - @Override @Deprecated public void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers) - { - remove(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set, boolean) - */ - @Override @Deprecated public void removeExtendedSecurity(NodeRef nodeRef, Set readers, Setwriters, boolean applyToParents) - { - remove(nodeRef); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeAllExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, boolean) - */ - @Override @Deprecated public void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents) - { - remove(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import static org.alfresco.service.cmr.security.PermissionService.GROUP_PREFIX; + +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.alfresco.model.RenditionModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.query.PagingRequest; +import org.alfresco.query.PagingResults; +import org.alfresco.repo.security.authority.RMAuthority; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessPermission; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.Pair; +import org.alfresco.util.ParameterCheck; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.extensions.webscripts.ui.common.StringUtils; + +/** + * Extended security service implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ExtendedSecurityServiceImpl extends ServiceBaseImpl + implements ExtendedSecurityService, + RecordsManagementModel, + ApplicationListener +{ + /** ipr group names */ + static final String ROOT_IPR_GROUP = "INPLACE_RECORD_MANAGEMENT"; + static final String READER_GROUP_PREFIX = ExtendedSecurityService.IPR_GROUP_PREFIX + "R"; + static final String WRITER_GROUP_PREFIX = ExtendedSecurityService.IPR_GROUP_PREFIX + "W"; + + /** max page size for authority query */ + private static final int MAX_ITEMS = 50; + + /** File plan service */ + private FilePlanService filePlanService; + + /** File plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** authority service */ + private AuthorityService authorityService; + + /** permission service */ + private PermissionService permissionService; + + /** transaction service */ + private TransactionService transactionService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param filePlanRoleService file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * @param authorityService authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * @param transactionService transaction service + */ + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + /** + * Application context refresh event handler + */ + @Override + public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) + { + transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + // if the root group doesn't exist then create it + if (!authorityService.authorityExists(getRootIRPGroup())) + { + authorityService.createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, Collections.singleton(RMAuthority.ZONE_APP_RM)); + } + + return null; + } + }); + } + + /** + * Get root IPR group name + */ + private String getRootIRPGroup() + { + return GROUP_PREFIX + ROOT_IPR_GROUP; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#hasExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean hasExtendedSecurity(NodeRef nodeRef) + { + return (getIPRGroups(nodeRef) != null); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#getReaders(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + @Override + public Set getReaders(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + Set result = Collections.EMPTY_SET; + Pair iprGroups = getIPRGroups(nodeRef); + if (iprGroups != null) + { + result = getAuthorities(iprGroups.getFirst()); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#getWriters(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + @Override + public Set getWriters(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + Set result = Collections.EMPTY_SET; + Pair iprGroups = getIPRGroups(nodeRef); + if (iprGroups != null) + { + result = getAuthorities(iprGroups.getSecond()); + } + + return result; + } + + /** + * Helper to get authorities for a given group + * + * @param group group name + * @return Set immediate authorities + */ + private Set getAuthorities(String group) + { + Set result = new HashSet(); + result.addAll(authorityService.getContainedAuthorities(null, group, true)); + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#set(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.util.Pair) + */ + @Override + public void set(NodeRef nodeRef, Pair, Set> readersAndWriters) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + set(nodeRef, readersAndWriters.getFirst(), readersAndWriters.getSecond()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#set(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) + */ + @Override + public void set(NodeRef nodeRef, Set readers, Set writers) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + // remove existing extended security, assuming there is any + remove(nodeRef); + + // find groups + Pair iprGroups = createOrFindIPRGroups(readers, writers); + + // assign groups to correct fileplan roles + NodeRef filePlan = filePlanService.getFilePlan(nodeRef); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, iprGroups.getFirst()); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, iprGroups.getSecond()); + + // assign groups to node + assignIPRGroupsToNode(iprGroups, nodeRef); + + // apply the readers to any renditions of the content + if (isRecord(nodeRef)) + { + List assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + NodeRef child = assoc.getChildRef(); + assignIPRGroupsToNode(iprGroups, child); + } + } + } + + /** + * Get the IPR groups associated with a given node reference. + *

+ * Return null if none found. + * + * @param nodeRef node reference + * @return Pair where first is the read group and second if the write group, null if none found + */ + private Pair getIPRGroups(NodeRef nodeRef) + { + Pair result = null; + String iprReaderGroup = null; + String iprWriterGroup = null; + + // get all the set permissions + Set permissions = permissionService.getAllSetPermissions(nodeRef); + for (AccessPermission permission : permissions) + { + // look for the presence of the reader group + if (permission.getAuthority().startsWith(GROUP_PREFIX + READER_GROUP_PREFIX)) + { + iprReaderGroup = permission.getAuthority(); + } + // look for the presence of the writer group + else if (permission.getAuthority().startsWith(GROUP_PREFIX + WRITER_GROUP_PREFIX)) + { + iprWriterGroup = permission.getAuthority(); + } + } + + // assuming the are both present then return + if (iprReaderGroup != null && iprWriterGroup != null) + { + result = new Pair(iprReaderGroup, iprWriterGroup); + } + + return result; + } + + /** + * Given a set of readers and writers find or create the appropriate IPR groups. + *

+ * The IPR groups are named with hashes of the authority lists in order to reduce + * the set of groups that require exact match. A further index is used to handle + * a situation where there is a hash clash, but a difference in the authority lists. + *

+ * When no match is found the groups are created. Once created + * + * @param filePlan file plan + * @param readers authorities with read + * @param writers authorities with write + * @return Pair where first is the full name of the read group and + * second is the full name of the write group + */ + private Pair createOrFindIPRGroups(Set readers, Set writers) + { + return new Pair( + createOrFindIPRGroup(READER_GROUP_PREFIX, readers), + createOrFindIPRGroup(WRITER_GROUP_PREFIX, writers)); + } + + /** + * Create or find an IPR group based on the provided prefix and authorities. + * + * @param groupPrefix group prefix + * @param authorities authorities + * @return String full group name + */ + private String createOrFindIPRGroup(String groupPrefix, Set authorities) + { + String group = null; + + // find group or determine what the next index is if no group exists or there is a clash + Pair groupResult = findIPRGroup(groupPrefix, authorities); + + if (groupResult.getFirst() == null) + { + group = createIPRGroup(groupPrefix, authorities, groupResult.getSecond()); + } + else + { + group = groupResult.getFirst(); + } + + return group; + } + + /** + * Given a group name prefix and the authorities, finds the exact match existing group. + *

+ * If the group does not exist then the group returned is null and the index shows the next available + * group index for creation. + * + * @param groupPrefix group name prefix + * @param authorities authorities + * @return Pair where first is the name of the found group, null if none found and second + * if the next available create index + */ + private Pair findIPRGroup(String groupPrefix, Set authorities) + { + String iprGroup = null; + int nextGroupIndex = 0; + boolean hasMoreItems = true; + int pageCount = 0; + + // determine the short name prefix + String groupShortNamePrefix = getIPRGroupPrefixShortName(groupPrefix, authorities); + + // iterate over the authorities to find a match + while (hasMoreItems == true) + { + // get matching authorities + PagingResults results = authorityService.getAuthorities(AuthorityType.GROUP, + RMAuthority.ZONE_APP_RM, + groupShortNamePrefix, + false, + false, + new PagingRequest(MAX_ITEMS*pageCount, MAX_ITEMS)); + + // record the total count + nextGroupIndex = nextGroupIndex + results.getPage().size(); + + // see if any of the matching groups exactly match + for (String group : results.getPage()) + { + // if exists and matches we have found our group + if (isIPRGroupTrueMatch(group, authorities)) + { + iprGroup = group; + break; + } + } + + // determine if there are any more pages to inspect + hasMoreItems = results.hasMoreItems(); + pageCount ++; + } + + return new Pair(iprGroup, nextGroupIndex); + } + + /** + * Determines whether a group exactly matches a list of authorities. + * + * @param authorities list of authorities + * @param group group + * @return + */ + private boolean isIPRGroupTrueMatch(String group, Set authorities) + { + Set contained = authorityService.getContainedAuthorities(null, group, true); + return contained.equals(authorities); + } + + /** + * Get IPR group prefix short name. + *

+ * 'package' scope to help testing. + * + * @param prefix prefix + * @param authorities authorities + * @return String group prefix short name + */ + /*package*/ String getIPRGroupPrefixShortName(String prefix, Set authorities) + { + StringBuilder builder = new StringBuilder(128) + .append(prefix) + .append(getAuthoritySetHashCode(authorities)); + + return builder.toString(); + } + + /** + * Get IPR group short name. + *

+ * Note this excludes the "GROUP_" prefix. + *

+ * 'package' scope to help testing. + * + * @param prefix prefix + * @param readers read authorities + * @param writers write authorities + * @param index group index + * @return String group short name + */ + /*package*/ String getIPRGroupShortName(String prefix, Set authorities, int index) + { + return getIPRGroupShortName(prefix, authorities, Integer.toString(index)); + } + + /** + * Get IPR group short name. + *

+ * Note this excludes the "GROUP_" prefix. + * + * @param prefix prefix + * @param readers read authorities + * @param writers write authorities + * @param index group index + * @return String group short name + */ + private String getIPRGroupShortName(String prefix, Set authorities, String index) + { + StringBuilder builder = new StringBuilder(128) + .append(getIPRGroupPrefixShortName(prefix, authorities)) + .append(index); + + return builder.toString(); + } + + /** + * Gets the hashcode value of a set of authorities. + * + * @param authorities set of authorities + * @return int hash code + */ + private int getAuthoritySetHashCode(Set authorities) + { + int result = 0; + if (authorities != null && !authorities.isEmpty()) + { + result = StringUtils.join(authorities.toArray(), "").hashCode(); + } + return result; + } + + /** + * Creates a new IPR group. + * + * @param groupNamePrefix group name prefix + * @param children child authorities + * @param index group index + * @return String full name of created group + */ + private String createIPRGroup(String groupNamePrefix, Set children, int index) + { + ParameterCheck.mandatory("groupNamePrefix", groupNamePrefix); + + // get the group name + String groupShortName = getIPRGroupShortName(groupNamePrefix, children, index); + + // create group + String group = authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, Collections.singleton(RMAuthority.ZONE_APP_RM)); + + // add root parent + authorityService.addAuthority(getRootIRPGroup(), group); + + // add children if provided + if (children != null) + { + for (String child : children) + { + if (authorityService.authorityExists(child) && + !PermissionService.ALL_AUTHORITIES.equals(child)) + { + authorityService.addAuthority(group, child); + } + } + } + + return group; + } + + /** + * Assign IPR groups to a node reference with the correct permissions. + * + * @param iprGroups iprGroups, first read and second write + * @param nodeRef node reference + */ + private void assignIPRGroupsToNode(Pair iprGroups, NodeRef nodeRef) + { + permissionService.setPermission(nodeRef, iprGroups.getFirst(), RMPermissionModel.READ_RECORDS, true); + permissionService.setPermission(nodeRef, iprGroups.getSecond(), RMPermissionModel.FILING, true); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService#remove(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void remove(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + Pair iprGroups = getIPRGroups(nodeRef); + if (iprGroups != null) + { + // remove any extended security that might be present + clearPermissions(nodeRef, iprGroups); + + // remove the readers from any renditions of the content + if (isRecord(nodeRef)) + { + List assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + NodeRef child = assoc.getChildRef(); + clearPermissions(child, iprGroups); + } + } + } + } + + /** + * Clear the nodes IPR permissions + * + * @param nodeRef node reference + */ + private void clearPermissions(NodeRef nodeRef, Pair iprGroups) + { + // remove group permissions from node + permissionService.clearPermission(nodeRef, iprGroups.getFirst()); + permissionService.clearPermission(nodeRef, iprGroups.getSecond()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#getExtendedReaders(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override @Deprecated public Set getExtendedReaders(NodeRef nodeRef) + { + return getReaders(nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#getExtendedWriters(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override @Deprecated public Set getExtendedWriters(NodeRef nodeRef) + { + return getWriters(nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#addExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) + */ + @Override @Deprecated public void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers) + { + set(nodeRef, readers, writers); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#addExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set, boolean) + */ + @Override @Deprecated public void addExtendedSecurity(NodeRef nodeRef, Set readers, Set writers, boolean applyToParents) + { + set(nodeRef, readers, writers); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeAllExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override @Deprecated public void removeAllExtendedSecurity(NodeRef nodeRef) + { + remove(nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set) + */ + @Override @Deprecated public void removeExtendedSecurity(NodeRef nodeRef, Set readers, Set writers) + { + remove(nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, java.util.Set, java.util.Set, boolean) + */ + @Override @Deprecated public void removeExtendedSecurity(NodeRef nodeRef, Set readers, Setwriters, boolean applyToParents) + { + remove(nodeRef); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.DeprecatedExtendedSecurityService#removeAllExtendedSecurity(org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + @Override @Deprecated public void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents) + { + remove(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java index 69c3006bcd..70dd6f8ea1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java @@ -1,76 +1,76 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * File plan permission service. - * - * @author Roy Wetherall - * @since 2.1 - */ -@AlfrescoPublicApi -public interface FilePlanPermissionService -{ - /** - * Setup permissions for a record category - * - * @param nodeRef record category node reference - */ - void setupRecordCategoryPermissions(NodeRef recordCategory); - - /** - * Setup permissions for an object within a given parent. - * - * @param parent parent node to inherit permissions from - * @param nodeRef node ref to setup permissions on - */ - void setupPermissions(NodeRef parent, NodeRef nodeRef); - - /** - * Sets a permission on a file plan object. Assumes allow is true. Cascades permission down to record folder. - * Cascades ReadRecord up to file plan. - * - * @param nodeRef node reference - * @param authority authority - * @param permission permission - */ - void setPermission(NodeRef nodeRef, String authority, String permission); - - /** - * Deletes a permission from a file plan object. Cascades removal down to record folder. - * - * @param nodeRef node reference - * @param authority authority - * @param permission permission - */ - void deletePermission(NodeRef nodeRef, String authority, String permission); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * File plan permission service. + * + * @author Roy Wetherall + * @since 2.1 + */ +@AlfrescoPublicApi +public interface FilePlanPermissionService +{ + /** + * Setup permissions for a record category + * + * @param nodeRef record category node reference + */ + void setupRecordCategoryPermissions(NodeRef recordCategory); + + /** + * Setup permissions for an object within a given parent. + * + * @param parent parent node to inherit permissions from + * @param nodeRef node ref to setup permissions on + */ + void setupPermissions(NodeRef parent, NodeRef nodeRef); + + /** + * Sets a permission on a file plan object. Assumes allow is true. Cascades permission down to record folder. + * Cascades ReadRecord up to file plan. + * + * @param nodeRef node reference + * @param authority authority + * @param permission permission + */ + void setPermission(NodeRef nodeRef, String authority, String permission); + + /** + * Deletes a permission from a file plan object. Cascades removal down to record folder. + * + * @param nodeRef node reference + * @param authority authority + * @param permission permission + */ + void deletePermission(NodeRef nodeRef, String authority, String permission); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java index 5fab978a41..b66677c863 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java @@ -1,625 +1,625 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.TRANSACTION_COMMIT; -import static org.alfresco.repo.policy.annotation.BehaviourKind.CLASS; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getSystemUserName; -import static org.alfresco.service.cmr.security.OwnableService.NO_OWNER; -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.apache.commons.lang.BooleanUtils.isTrue; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -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.util.ServiceBaseImpl; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * File plan permission service. - * - * @author Roy Wetherall - * @since 2.1 - */ -@BehaviourBean -public class FilePlanPermissionServiceImpl extends ServiceBaseImpl - implements FilePlanPermissionService, - RMPermissionModel, - NodeServicePolicies.OnMoveNodePolicy -{ - /** Permission service */ - private PermissionService permissionService; - - /** Ownable service */ - private OwnableService ownableService; - - /** Policy component */ - private PolicyComponent policyComponent; - - /** Authority service */ - private AuthorityService authorityService; - - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Logger */ - private static final Log LOGGER = LogFactory.getLog(FilePlanPermissionServiceImpl.class); - - /** - * Initialisation method - */ - public void init() - { - getPolicyComponent().bindClassBehaviour( - NodeServicePolicies.OnAddAspectPolicy.QNAME, - ASPECT_RECORD, - new JavaBehaviour(this, "onAddRecord", TRANSACTION_COMMIT)); - getPolicyComponent().bindClassBehaviour( - NodeServicePolicies.OnMoveNodePolicy.QNAME, - ASPECT_RECORD, - new JavaBehaviour(this, "onMoveRecord", TRANSACTION_COMMIT)); - getPolicyComponent().bindClassBehaviour( - NodeServicePolicies.OnMoveNodePolicy.QNAME, - TYPE_RECORD_CATEGORY, - new JavaBehaviour(this, "onMoveNode", TRANSACTION_COMMIT)); - } - - /** - * Gets the permission service - * - * @return The permission service - */ - protected PermissionService getPermissionService() - { - return this.permissionService; - } - - /** - * @param permissionService permission service - */ - public void setPermissionService(PermissionService permissionService) - { - this.permissionService = permissionService; - } - - /** - * Gets the policy component - * - * @return The policy component - */ - protected PolicyComponent getPolicyComponent() - { - return this.policyComponent; - } - - /** - * @param policyComponent policy component - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** - * Gets the ownable service - * - * @return The ownable service - */ - protected OwnableService getOwnableService() - { - return this.ownableService; - } - - /** - * @param ownableService ownable service - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - - /** - * Gets the authority service - * - * @return The authority service - */ - public AuthorityService getAuthorityService() - { - return this.authorityService; - } - - /** - * Sets the authority service - * - * @param authorityService The authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * Gets the file plan role service - * - * @return The file plan role service - */ - public FilePlanRoleService getFilePlanRoleService() - { - return this.filePlanRoleService; - } - - /** - * Sets the file plan role service - * - * @param filePlanRoleService The file plan role service to set - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * Gets the file plan service - * - * @return The file plan service - */ - public FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * Sets the file plan service - * - * @param filePlanService The file plan service to set - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setupRecordCategoryPermissions(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void setupRecordCategoryPermissions(final NodeRef recordCategory) - { - mandatory("recordCategory", recordCategory); - - // assert that we have a record category in our hands - if (!instanceOf(recordCategory, TYPE_RECORD_CATEGORY)) - { - throw new AlfrescoRuntimeException("Unable to setup record category permissions, because node is not a record category."); - } - - // setup category permissions - NodeRef parentNodeRef = nodeService.getPrimaryParent(recordCategory).getParentRef(); - setupPermissions(parentNodeRef, recordCategory); - } - - /** - * Setup permissions on new unfiled record folder - * - * @param childAssocRef child association reference - */ - @Behaviour - ( - type = "rma:unfiledRecordFolder", - kind = CLASS, - policy = "alf:onCreateNode", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onCreateUnfiledRecordFolder(ChildAssociationRef childAssocRef) - { - mandatory("childAssocRef", childAssocRef); - setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef()); - } - - /** - * Setup permissions on new record folder - * - * @param childAssocRef child association reference - */ - @Behaviour - ( - type = "rma:recordFolder", - kind = CLASS, - policy = "alf:onCreateNode", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onCreateRecordFolder(ChildAssociationRef childAssocRef) - { - mandatory("childAssocRef", childAssocRef); - setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef()); - } - - /** - * Setup permissions on newly created hold. - * - * @param childAssocRef child association reference - */ - @Behaviour - ( - type = "rma:hold", - kind = CLASS, - policy = "alf:onCreateNode", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onCreateHold(final ChildAssociationRef childAssocRef) - { - createContainerElement(childAssocRef); - } - - /** - * Setup permissions on newly created transfer. - * - * @param childAssocRef child association reference - */ - @Behaviour - ( - type = "rma:transfer", - kind = CLASS, - policy = "alf:onCreateNode", - notificationFrequency = TRANSACTION_COMMIT - ) - public void onCreateTransfer(final ChildAssociationRef childAssocRef) - { - createContainerElement(childAssocRef); - } - - /** - * Helper method to create a container element, e.g. transfer folder or hold - * - * @param childAssocRef - */ - private void createContainerElement(final ChildAssociationRef childAssocRef) - { - mandatory("childAssocRef", childAssocRef); - NodeRef childRef = childAssocRef.getChildRef(); - setupPermissions(childAssocRef.getParentRef(), childRef); - grantFilingPermissionToCreator(childRef); - } - - /** - * Helper method to give filing permissions to the currently logged in user who creates the node (transfer folder, hold, etc.) - * - * @param nodeRef The node reference of the created object - */ - private void grantFilingPermissionToCreator(final NodeRef nodeRef) - { - final String user = AuthenticationUtil.getFullyAuthenticatedUser(); - - final boolean hasUserPermission = authenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Boolean doWork() - { - return getPermissionService().hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED; - } - }, user); - - if (!hasUserPermission) - { - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - getPermissionService().setPermission(nodeRef, user, RMPermissionModel.FILING, true); - return null; - } - }); - } - } - - /** - * Helper method to setup permissions. - * - * @param parent parent node reference - * @param nodeRef child node reference - */ - public void setupPermissions(final NodeRef parent, final NodeRef nodeRef) - { - mandatory("parent", parent); - mandatory("nodeRef", nodeRef); - - if (nodeService.exists(nodeRef) && nodeService.exists(parent)) - { - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - // set inheritance - boolean isParentNodeFilePlan = isRecordCategory(nodeRef) && isFilePlan(parent); - boolean inheritanceAllowed = isInheritanceAllowed(nodeRef, isParentNodeFilePlan); - getPermissionService().setInheritParentPermissions(nodeRef, inheritanceAllowed); - - Set keepPerms = new HashSet(5); - Set origionalPerms= getPermissionService().getAllSetPermissions(nodeRef); - - for (AccessPermission perm : origionalPerms) - { - if (perm.getAuthority().startsWith(PermissionService.GROUP_PREFIX + ExtendedSecurityService.IPR_GROUP_PREFIX)) - { - // then we can assume this is a permission we want to preserve - keepPerms.add(perm); - } - } - - // clear all existing permissions and start again - getPermissionService().clearPermission(nodeRef, null); - - // re-add keep'er permissions - for (AccessPermission keeper : keepPerms) - { - setPermission(nodeRef, keeper.getAuthority(), keeper.getPermission()); - } - - if (!inheritanceAllowed) - { - String adminRole = getAdminRole(nodeRef); - getPermissionService().setPermission(nodeRef, adminRole, RMPermissionModel.FILING, true); - } - - // remove owner - getOwnableService().setOwner(nodeRef, NO_OWNER); - - if (isParentNodeFilePlan) - { - Set perms = permissionService.getAllSetPermissions(parent); - for (AccessPermission perm : perms) - { - if (RMPermissionModel.FILING.equals(perm.getPermission())) - { - AccessStatus accessStatus = perm.getAccessStatus(); - boolean allow = false; - if (AccessStatus.ALLOWED.equals(accessStatus)) - { - allow = true; - } - permissionService.setPermission( - nodeRef, - perm.getAuthority(), - perm.getPermission(), - allow); - } - } - } - - return null; - } - }); - } - } - - private String getAdminRole(NodeRef nodeRef) - { - NodeRef filePlan = getFilePlan(nodeRef); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("The file plan could not be found for the give node: '" + nodeRef + "'."); - } - return authorityService.getName(AuthorityType.GROUP, FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); - } - - /** - * Indicates whether the default behaviour is to inherit permissions or not. - * - * @param nodeRef node reference - * @param isParentNodeFilePlan true if parent node is a file plan, false otherwise - * @return boolean true if inheritance true, false otherwise - */ - private boolean isInheritanceAllowed(NodeRef nodeRef, Boolean isParentNodeFilePlan) - { - return !(isFilePlan(nodeRef) || - isTransfer(nodeRef) || - isHold(nodeRef) || - isUnfiledRecordsContainer(nodeRef) || - (isRecordCategory(nodeRef) && isTrue(isParentNodeFilePlan))); - } - - /** - * Sets ups records permission when aspect is added. - * - * @see NodeServicePolicies.OnAddAspectPolicy#onAddAspect(NodeRef, QName) - * - * @param record - * @param aspectTypeQName - */ - public void onAddRecord(final NodeRef record, final QName aspectTypeQName) - { - mandatory("childAssocRef", record); - mandatory("childAssocRef", aspectTypeQName); - - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Object doWork() - { - if (nodeService.exists(record) && nodeService.hasAspect(record, aspectTypeQName)) - { - NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); - setupPermissions(recordFolder, record); - } - - return null; - } - }); - } - - /** - * onMoveRecord behaviour - * - * @param sourceAssocRef source association reference - * @param destinationAssocRef destination association reference - */ - public void onMoveRecord(final ChildAssociationRef sourceAssocRef, final ChildAssociationRef destinationAssocRef) - { - mandatory("sourceAssocRef", sourceAssocRef); - mandatory("destinationAssocRef", destinationAssocRef); - - authenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - NodeRef record = sourceAssocRef.getChildRef(); - if (nodeService.exists(record) && nodeService.hasAspect(record, ASPECT_RECORD)) - { - boolean inheritParentPermissions = permissionService.getInheritParentPermissions(record); - - Set keepPerms = new HashSet(5); - Set origionalRecordPerms= permissionService.getAllSetPermissions(record); - - for (AccessPermission recordPermission : origionalRecordPerms) - { - String permission = recordPermission.getPermission(); - if ((RMPermissionModel.FILING.equals(permission) || RMPermissionModel.READ_RECORDS.equals(permission)) && - recordPermission.isSetDirectly()) - { - // then we can assume this is a permission we want to preserve - keepPerms.add(recordPermission); - } - } - - // re-setup the records permissions - setupPermissions(destinationAssocRef.getParentRef(), record); - - // re-add keep'er permissions - for (AccessPermission keeper : keepPerms) - { - setPermission(record, keeper.getAuthority(), keeper.getPermission()); - } - - permissionService.setInheritParentPermissions(record, inheritParentPermissions); - } - - return null; - } - }, getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#setPermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, boolean) - */ - public void setPermission(final NodeRef nodeRef, final String authority, final String permission) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("authority", authority); - ParameterCheck.mandatory("permission", permission); - - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - if (canPerformPermissionAction(nodeRef)) - { - // Set the permission on the node - getPermissionService().setPermission(nodeRef, authority, permission, true); - } - else - { - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn("Setting permissions for this node is not supported. (nodeRef=" + nodeRef + ", authority=" + authority + ", permission=" + permission + ")"); - } - } - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deletePermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) - */ - public void deletePermission(final NodeRef nodeRef, final String authority, final String permission) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("authority", authority); - ParameterCheck.mandatory("permission", permission); - - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - if (canPerformPermissionAction(nodeRef)) - { - // Delete permission on this node - getPermissionService().deletePermission(nodeRef, authority, permission); - } - else - { - if (LOGGER.isWarnEnabled()) - { - LOGGER.warn("Deleting permissions for this node is not supported. (nodeRef=" + nodeRef + ", authority=" + authority + ", permission=" + permission + ")"); - } - } - - return null; - } - }); - } - - private boolean canPerformPermissionAction(NodeRef nodeRef) - { - return isFilePlanContainer(nodeRef) || isRecordFolder(nodeRef) || isRecord(nodeRef) || isTransfer(nodeRef) || isHold(nodeRef); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - if (isFilePlan(newChildAssocRef.getParentRef())) - { - permissionService.setInheritParentPermissions(oldChildAssocRef.getChildRef(), false); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.TRANSACTION_COMMIT; +import static org.alfresco.repo.policy.annotation.BehaviourKind.CLASS; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.getSystemUserName; +import static org.alfresco.service.cmr.security.OwnableService.NO_OWNER; +import static org.alfresco.util.ParameterCheck.mandatory; +import static org.apache.commons.lang.BooleanUtils.isTrue; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +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.util.ServiceBaseImpl; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessPermission; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * File plan permission service. + * + * @author Roy Wetherall + * @since 2.1 + */ +@BehaviourBean +public class FilePlanPermissionServiceImpl extends ServiceBaseImpl + implements FilePlanPermissionService, + RMPermissionModel, + NodeServicePolicies.OnMoveNodePolicy +{ + /** Permission service */ + private PermissionService permissionService; + + /** Ownable service */ + private OwnableService ownableService; + + /** Policy component */ + private PolicyComponent policyComponent; + + /** Authority service */ + private AuthorityService authorityService; + + /** File plan role service */ + private FilePlanRoleService filePlanRoleService; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Logger */ + private static final Log LOGGER = LogFactory.getLog(FilePlanPermissionServiceImpl.class); + + /** + * Initialisation method + */ + public void init() + { + getPolicyComponent().bindClassBehaviour( + NodeServicePolicies.OnAddAspectPolicy.QNAME, + ASPECT_RECORD, + new JavaBehaviour(this, "onAddRecord", TRANSACTION_COMMIT)); + getPolicyComponent().bindClassBehaviour( + NodeServicePolicies.OnMoveNodePolicy.QNAME, + ASPECT_RECORD, + new JavaBehaviour(this, "onMoveRecord", TRANSACTION_COMMIT)); + getPolicyComponent().bindClassBehaviour( + NodeServicePolicies.OnMoveNodePolicy.QNAME, + TYPE_RECORD_CATEGORY, + new JavaBehaviour(this, "onMoveNode", TRANSACTION_COMMIT)); + } + + /** + * Gets the permission service + * + * @return The permission service + */ + protected PermissionService getPermissionService() + { + return this.permissionService; + } + + /** + * @param permissionService permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; + } + + /** + * Gets the policy component + * + * @return The policy component + */ + protected PolicyComponent getPolicyComponent() + { + return this.policyComponent; + } + + /** + * @param policyComponent policy component + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + /** + * Gets the ownable service + * + * @return The ownable service + */ + protected OwnableService getOwnableService() + { + return this.ownableService; + } + + /** + * @param ownableService ownable service + */ + public void setOwnableService(OwnableService ownableService) + { + this.ownableService = ownableService; + } + + /** + * Gets the authority service + * + * @return The authority service + */ + public AuthorityService getAuthorityService() + { + return this.authorityService; + } + + /** + * Sets the authority service + * + * @param authorityService The authority service + */ + public void setAuthorityService(AuthorityService authorityService) + { + this.authorityService = authorityService; + } + + /** + * Gets the file plan role service + * + * @return The file plan role service + */ + public FilePlanRoleService getFilePlanRoleService() + { + return this.filePlanRoleService; + } + + /** + * Sets the file plan role service + * + * @param filePlanRoleService The file plan role service to set + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; + } + + /** + * Gets the file plan service + * + * @return The file plan service + */ + public FilePlanService getFilePlanService() + { + return this.filePlanService; + } + + /** + * Sets the file plan service + * + * @param filePlanService The file plan service to set + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setupRecordCategoryPermissions(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void setupRecordCategoryPermissions(final NodeRef recordCategory) + { + mandatory("recordCategory", recordCategory); + + // assert that we have a record category in our hands + if (!instanceOf(recordCategory, TYPE_RECORD_CATEGORY)) + { + throw new AlfrescoRuntimeException("Unable to setup record category permissions, because node is not a record category."); + } + + // setup category permissions + NodeRef parentNodeRef = nodeService.getPrimaryParent(recordCategory).getParentRef(); + setupPermissions(parentNodeRef, recordCategory); + } + + /** + * Setup permissions on new unfiled record folder + * + * @param childAssocRef child association reference + */ + @Behaviour + ( + type = "rma:unfiledRecordFolder", + kind = CLASS, + policy = "alf:onCreateNode", + notificationFrequency = TRANSACTION_COMMIT + ) + public void onCreateUnfiledRecordFolder(ChildAssociationRef childAssocRef) + { + mandatory("childAssocRef", childAssocRef); + setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef()); + } + + /** + * Setup permissions on new record folder + * + * @param childAssocRef child association reference + */ + @Behaviour + ( + type = "rma:recordFolder", + kind = CLASS, + policy = "alf:onCreateNode", + notificationFrequency = TRANSACTION_COMMIT + ) + public void onCreateRecordFolder(ChildAssociationRef childAssocRef) + { + mandatory("childAssocRef", childAssocRef); + setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef()); + } + + /** + * Setup permissions on newly created hold. + * + * @param childAssocRef child association reference + */ + @Behaviour + ( + type = "rma:hold", + kind = CLASS, + policy = "alf:onCreateNode", + notificationFrequency = TRANSACTION_COMMIT + ) + public void onCreateHold(final ChildAssociationRef childAssocRef) + { + createContainerElement(childAssocRef); + } + + /** + * Setup permissions on newly created transfer. + * + * @param childAssocRef child association reference + */ + @Behaviour + ( + type = "rma:transfer", + kind = CLASS, + policy = "alf:onCreateNode", + notificationFrequency = TRANSACTION_COMMIT + ) + public void onCreateTransfer(final ChildAssociationRef childAssocRef) + { + createContainerElement(childAssocRef); + } + + /** + * Helper method to create a container element, e.g. transfer folder or hold + * + * @param childAssocRef + */ + private void createContainerElement(final ChildAssociationRef childAssocRef) + { + mandatory("childAssocRef", childAssocRef); + NodeRef childRef = childAssocRef.getChildRef(); + setupPermissions(childAssocRef.getParentRef(), childRef); + grantFilingPermissionToCreator(childRef); + } + + /** + * Helper method to give filing permissions to the currently logged in user who creates the node (transfer folder, hold, etc.) + * + * @param nodeRef The node reference of the created object + */ + private void grantFilingPermissionToCreator(final NodeRef nodeRef) + { + final String user = AuthenticationUtil.getFullyAuthenticatedUser(); + + final boolean hasUserPermission = authenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Boolean doWork() + { + return getPermissionService().hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED; + } + }, user); + + if (!hasUserPermission) + { + authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + public Void doWork() + { + getPermissionService().setPermission(nodeRef, user, RMPermissionModel.FILING, true); + return null; + } + }); + } + } + + /** + * Helper method to setup permissions. + * + * @param parent parent node reference + * @param nodeRef child node reference + */ + public void setupPermissions(final NodeRef parent, final NodeRef nodeRef) + { + mandatory("parent", parent); + mandatory("nodeRef", nodeRef); + + if (nodeService.exists(nodeRef) && nodeService.exists(parent)) + { + authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + // set inheritance + boolean isParentNodeFilePlan = isRecordCategory(nodeRef) && isFilePlan(parent); + boolean inheritanceAllowed = isInheritanceAllowed(nodeRef, isParentNodeFilePlan); + getPermissionService().setInheritParentPermissions(nodeRef, inheritanceAllowed); + + Set keepPerms = new HashSet(5); + Set origionalPerms= getPermissionService().getAllSetPermissions(nodeRef); + + for (AccessPermission perm : origionalPerms) + { + if (perm.getAuthority().startsWith(PermissionService.GROUP_PREFIX + ExtendedSecurityService.IPR_GROUP_PREFIX)) + { + // then we can assume this is a permission we want to preserve + keepPerms.add(perm); + } + } + + // clear all existing permissions and start again + getPermissionService().clearPermission(nodeRef, null); + + // re-add keep'er permissions + for (AccessPermission keeper : keepPerms) + { + setPermission(nodeRef, keeper.getAuthority(), keeper.getPermission()); + } + + if (!inheritanceAllowed) + { + String adminRole = getAdminRole(nodeRef); + getPermissionService().setPermission(nodeRef, adminRole, RMPermissionModel.FILING, true); + } + + // remove owner + getOwnableService().setOwner(nodeRef, NO_OWNER); + + if (isParentNodeFilePlan) + { + Set perms = permissionService.getAllSetPermissions(parent); + for (AccessPermission perm : perms) + { + if (RMPermissionModel.FILING.equals(perm.getPermission())) + { + AccessStatus accessStatus = perm.getAccessStatus(); + boolean allow = false; + if (AccessStatus.ALLOWED.equals(accessStatus)) + { + allow = true; + } + permissionService.setPermission( + nodeRef, + perm.getAuthority(), + perm.getPermission(), + allow); + } + } + } + + return null; + } + }); + } + } + + private String getAdminRole(NodeRef nodeRef) + { + NodeRef filePlan = getFilePlan(nodeRef); + if (filePlan == null) + { + throw new AlfrescoRuntimeException("The file plan could not be found for the give node: '" + nodeRef + "'."); + } + return authorityService.getName(AuthorityType.GROUP, FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); + } + + /** + * Indicates whether the default behaviour is to inherit permissions or not. + * + * @param nodeRef node reference + * @param isParentNodeFilePlan true if parent node is a file plan, false otherwise + * @return boolean true if inheritance true, false otherwise + */ + private boolean isInheritanceAllowed(NodeRef nodeRef, Boolean isParentNodeFilePlan) + { + return !(isFilePlan(nodeRef) || + isTransfer(nodeRef) || + isHold(nodeRef) || + isUnfiledRecordsContainer(nodeRef) || + (isRecordCategory(nodeRef) && isTrue(isParentNodeFilePlan))); + } + + /** + * Sets ups records permission when aspect is added. + * + * @see NodeServicePolicies.OnAddAspectPolicy#onAddAspect(NodeRef, QName) + * + * @param record + * @param aspectTypeQName + */ + public void onAddRecord(final NodeRef record, final QName aspectTypeQName) + { + mandatory("childAssocRef", record); + mandatory("childAssocRef", aspectTypeQName); + + authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + public Object doWork() + { + if (nodeService.exists(record) && nodeService.hasAspect(record, aspectTypeQName)) + { + NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); + setupPermissions(recordFolder, record); + } + + return null; + } + }); + } + + /** + * onMoveRecord behaviour + * + * @param sourceAssocRef source association reference + * @param destinationAssocRef destination association reference + */ + public void onMoveRecord(final ChildAssociationRef sourceAssocRef, final ChildAssociationRef destinationAssocRef) + { + mandatory("sourceAssocRef", sourceAssocRef); + mandatory("destinationAssocRef", destinationAssocRef); + + authenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() + { + NodeRef record = sourceAssocRef.getChildRef(); + if (nodeService.exists(record) && nodeService.hasAspect(record, ASPECT_RECORD)) + { + boolean inheritParentPermissions = permissionService.getInheritParentPermissions(record); + + Set keepPerms = new HashSet(5); + Set origionalRecordPerms= permissionService.getAllSetPermissions(record); + + for (AccessPermission recordPermission : origionalRecordPerms) + { + String permission = recordPermission.getPermission(); + if ((RMPermissionModel.FILING.equals(permission) || RMPermissionModel.READ_RECORDS.equals(permission)) && + recordPermission.isSetDirectly()) + { + // then we can assume this is a permission we want to preserve + keepPerms.add(recordPermission); + } + } + + // re-setup the records permissions + setupPermissions(destinationAssocRef.getParentRef(), record); + + // re-add keep'er permissions + for (AccessPermission keeper : keepPerms) + { + setPermission(record, keeper.getAuthority(), keeper.getPermission()); + } + + permissionService.setInheritParentPermissions(record, inheritParentPermissions); + } + + return null; + } + }, getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#setPermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String, boolean) + */ + public void setPermission(final NodeRef nodeRef, final String authority, final String permission) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("authority", authority); + ParameterCheck.mandatory("permission", permission); + + authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + public Void doWork() + { + if (canPerformPermissionAction(nodeRef)) + { + // Set the permission on the node + getPermissionService().setPermission(nodeRef, authority, permission, true); + } + else + { + if (LOGGER.isWarnEnabled()) + { + LOGGER.warn("Setting permissions for this node is not supported. (nodeRef=" + nodeRef + ", authority=" + authority + ", permission=" + permission + ")"); + } + } + + return null; + } + }); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService#deletePermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.lang.String) + */ + public void deletePermission(final NodeRef nodeRef, final String authority, final String permission) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("authority", authority); + ParameterCheck.mandatory("permission", permission); + + authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + { + public Void doWork() + { + if (canPerformPermissionAction(nodeRef)) + { + // Delete permission on this node + getPermissionService().deletePermission(nodeRef, authority, permission); + } + else + { + if (LOGGER.isWarnEnabled()) + { + LOGGER.warn("Deleting permissions for this node is not supported. (nodeRef=" + nodeRef + ", authority=" + authority + ", permission=" + permission + ")"); + } + } + + return null; + } + }); + } + + private boolean canPerformPermissionAction(NodeRef nodeRef) + { + return isFilePlanContainer(nodeRef) || isRecordFolder(nodeRef) || isRecord(nodeRef) || isTransfer(nodeRef) || isHold(nodeRef); + } + + /** + * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) + */ + @Override + public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) + { + if (isFilePlan(newChildAssocRef.getParentRef())) + { + permissionService.setInheritParentPermissions(oldChildAssocRef.getChildRef(), false); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java index c3d8c340b4..86cc9716d4 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java @@ -1,361 +1,361 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor; -import org.alfresco.service.cmr.security.AccessStatus; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import net.sf.acegisecurity.AccessDeniedException; -import net.sf.acegisecurity.intercept.InterceptorStatusToken; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Records Management Method Security Interceptor. - *

- * Provides a way to record information about the capabilities being executed and report - * when an access denied exception is thrown. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor -{ - /** logger */ - protected static final Log LOGGER = LogFactory.getLog(RMMethodSecurityInterceptor.class); - - /** - * Helper class to hold capability report information - */ - private static class CapabilityReport - { - public String name; - public AccessStatus status; - public Map conditions = new HashMap(); - } - - /** - * Helper method to translate vote to access status. - * - * @param vote vote - * @return {@link AccessStatus} access status - */ - private static AccessStatus translate(int vote) - { - switch (vote) - { - case AccessDecisionVoter.ACCESS_ABSTAIN: - return AccessStatus.UNDETERMINED; - case AccessDecisionVoter.ACCESS_GRANTED: - return AccessStatus.ALLOWED; - case AccessDecisionVoter.ACCESS_DENIED: - return AccessStatus.DENIED; - default: - return AccessStatus.UNDETERMINED; - } - } - - /** - * Current capability report details. - *

- * Used to generate the capability error report. - */ - private static final ThreadLocal> CAPABILITIES = new ThreadLocal>() - { - @Override - protected Map initialValue() - { - return new HashMap(); - }; - }; - - /** - * Indicates whether this is an RM security check or not - */ - private static final ThreadLocal IS_RM_SECURITY_CHECK = new ThreadLocal() - { - protected Boolean initialValue() {return false;}; - }; - - /** - * Messages to display in error report. - */ - private static final ThreadLocal> MESSAGES = new ThreadLocal>() - { - protected List initialValue() {return new ArrayList();}; - }; - - /** - * Get capability report object from the thread local, creating one for - * the given capability name if one does not already exist. - * - * @param name capability name - * @return {@link CapabilityReport} object containing information about the capability - */ - private static CapabilityReport getCapabilityReport(String name) - { - Map map = RMMethodSecurityInterceptor.CAPABILITIES.get(); - CapabilityReport capability = map.get(name); - if (capability == null) - { - capability = new CapabilityReport(); - capability.name = name; - - map.put(name, capability); - } - return capability; - } - - /** - * Indicates whether this is a RM security check or not - * - * @param newValue true if RM security check, false otherwise - */ - public static void isRMSecurityChecked(boolean newValue) - { - if (LOGGER.isDebugEnabled()) - { - RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.set(newValue); - } - } - - /** - * Add a message to be displayed in the error report. - * - * @param message error message - */ - public static void addMessage(String message) - { - if (LOGGER.isDebugEnabled()) - { - List messages = RMMethodSecurityInterceptor.MESSAGES.get(); - messages.add(message); - } - } - - public static void addMessage(String message, Object ... params) - { - if (LOGGER.isDebugEnabled()) - { - addMessage(MessageFormat.format(message, params)); - } - } - - /** - * Report capability status. - * - * @param name capability name - * @param status capability status - */ - public static void reportCapabilityStatus(String name, int status) - { - if (LOGGER.isDebugEnabled()) - { - CapabilityReport capability = getCapabilityReport(name); - capability.status = translate(status); - } - } - - /** - * Report capability condition. - * - * @param name capability name - * @param conditionName capability condition name - * @param expected expected value - * @param actual actual value - */ - public static void reportCapabilityCondition(String name, String conditionName, boolean expected, boolean actual) - { - if (LOGGER.isDebugEnabled()) - { - CapabilityReport capability = getCapabilityReport(name); - if (!expected) - { - conditionName = "!" + conditionName; - } - capability.conditions.put(conditionName, (expected == actual)); - } - } - - /** - * Gets the failure report for the currently recorded capabilities. - * - * @return {@link String} capability error report - */ - public String getFailureReport() - { - String result = null; - - if (LOGGER.isDebugEnabled()) - { - Collection capabilities = RMMethodSecurityInterceptor.CAPABILITIES.get().values(); - - if (!capabilities.isEmpty()) - { - StringBuilder buffer = new StringBuilder("\n"); - for (CapabilityReport capability : capabilities) - { - buffer.append(" ").append(capability.name).append(" (").append(capability.status).append(")\n"); - if (!capability.conditions.isEmpty()) - { - for (Map.Entry entry : capability.conditions.entrySet()) - { - buffer.append(" - ").append(entry.getKey()).append(" ("); - if (entry.getValue()) - { - buffer.append("passed"); - } - else - { - buffer.append("failed"); - } - buffer.append(")\n"); - } - } - } - - result = buffer.toString(); - } - } - - return result; - } - - /** - * @see net.sf.acegisecurity.intercept.AbstractSecurityInterceptor#beforeInvocation(java.lang.Object) - */ - @Override - protected InterceptorStatusToken beforeInvocation(Object object) - { - InterceptorStatusToken result = null; - try - { - // clear the capability report information - RMMethodSecurityInterceptor.CAPABILITIES.remove(); - RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.remove(); - RMMethodSecurityInterceptor.MESSAGES.remove(); - - // before invocation (where method security check takes place) - result = super.beforeInvocation(object); - } - catch (AccessDeniedException exception) - { - if (LOGGER.isDebugEnabled()) - { - MethodInvocation mi = (MethodInvocation)object; - - StringBuilder methodDetails = new StringBuilder("\n"); - if (RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.get()) - { - methodDetails.append("RM method security check was performed.\n"); - } - else - { - methodDetails.append("Standard DM method security check was performed.\n"); - } - - boolean first = true; - methodDetails.append("Failed on method: ").append(mi.getMethod().getName()).append("("); - for (Object arg : mi.getArguments()) - { - if (first) - { - first = false; - } - else - { - methodDetails.append(", "); - } - - if (arg != null) - { - methodDetails.append(arg.toString()); - } - else - { - methodDetails.append("null"); - } - } - methodDetails.append(")\n"); - - List messages = RMMethodSecurityInterceptor.MESSAGES.get(); - for (String message : messages) - { - methodDetails.append(message).append("\n"); - } - - String failureReport = getFailureReport(); - if (failureReport == null) - { - // rethrow with additional information - throw new AccessDeniedException(exception.getMessage() + methodDetails, exception); - } - else - { - // rethrow with additional information - throw new AccessDeniedException(exception.getMessage() + methodDetails + getFailureReport(), exception); - } - } - else - { - throw exception; - } - } - return result; - } - - /** - * @see net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor#invoke(org.aopalliance.intercept.MethodInvocation) - */ - @Override - public Object invoke(MethodInvocation mi) throws Throwable - { - Object result = null; - InterceptorStatusToken token = beforeInvocation(mi); - - try - { - result = mi.proceed(); - } - finally - { - result = super.afterInvocation(token, result); - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor; +import org.alfresco.service.cmr.security.AccessStatus; +import org.aopalliance.intercept.MethodInvocation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import net.sf.acegisecurity.AccessDeniedException; +import net.sf.acegisecurity.intercept.InterceptorStatusToken; +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Records Management Method Security Interceptor. + *

+ * Provides a way to record information about the capabilities being executed and report + * when an access denied exception is thrown. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor +{ + /** logger */ + protected static final Log LOGGER = LogFactory.getLog(RMMethodSecurityInterceptor.class); + + /** + * Helper class to hold capability report information + */ + private static class CapabilityReport + { + public String name; + public AccessStatus status; + public Map conditions = new HashMap(); + } + + /** + * Helper method to translate vote to access status. + * + * @param vote vote + * @return {@link AccessStatus} access status + */ + private static AccessStatus translate(int vote) + { + switch (vote) + { + case AccessDecisionVoter.ACCESS_ABSTAIN: + return AccessStatus.UNDETERMINED; + case AccessDecisionVoter.ACCESS_GRANTED: + return AccessStatus.ALLOWED; + case AccessDecisionVoter.ACCESS_DENIED: + return AccessStatus.DENIED; + default: + return AccessStatus.UNDETERMINED; + } + } + + /** + * Current capability report details. + *

+ * Used to generate the capability error report. + */ + private static final ThreadLocal> CAPABILITIES = new ThreadLocal>() + { + @Override + protected Map initialValue() + { + return new HashMap(); + }; + }; + + /** + * Indicates whether this is an RM security check or not + */ + private static final ThreadLocal IS_RM_SECURITY_CHECK = new ThreadLocal() + { + protected Boolean initialValue() {return false;}; + }; + + /** + * Messages to display in error report. + */ + private static final ThreadLocal> MESSAGES = new ThreadLocal>() + { + protected List initialValue() {return new ArrayList();}; + }; + + /** + * Get capability report object from the thread local, creating one for + * the given capability name if one does not already exist. + * + * @param name capability name + * @return {@link CapabilityReport} object containing information about the capability + */ + private static CapabilityReport getCapabilityReport(String name) + { + Map map = RMMethodSecurityInterceptor.CAPABILITIES.get(); + CapabilityReport capability = map.get(name); + if (capability == null) + { + capability = new CapabilityReport(); + capability.name = name; + + map.put(name, capability); + } + return capability; + } + + /** + * Indicates whether this is a RM security check or not + * + * @param newValue true if RM security check, false otherwise + */ + public static void isRMSecurityChecked(boolean newValue) + { + if (LOGGER.isDebugEnabled()) + { + RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.set(newValue); + } + } + + /** + * Add a message to be displayed in the error report. + * + * @param message error message + */ + public static void addMessage(String message) + { + if (LOGGER.isDebugEnabled()) + { + List messages = RMMethodSecurityInterceptor.MESSAGES.get(); + messages.add(message); + } + } + + public static void addMessage(String message, Object ... params) + { + if (LOGGER.isDebugEnabled()) + { + addMessage(MessageFormat.format(message, params)); + } + } + + /** + * Report capability status. + * + * @param name capability name + * @param status capability status + */ + public static void reportCapabilityStatus(String name, int status) + { + if (LOGGER.isDebugEnabled()) + { + CapabilityReport capability = getCapabilityReport(name); + capability.status = translate(status); + } + } + + /** + * Report capability condition. + * + * @param name capability name + * @param conditionName capability condition name + * @param expected expected value + * @param actual actual value + */ + public static void reportCapabilityCondition(String name, String conditionName, boolean expected, boolean actual) + { + if (LOGGER.isDebugEnabled()) + { + CapabilityReport capability = getCapabilityReport(name); + if (!expected) + { + conditionName = "!" + conditionName; + } + capability.conditions.put(conditionName, (expected == actual)); + } + } + + /** + * Gets the failure report for the currently recorded capabilities. + * + * @return {@link String} capability error report + */ + public String getFailureReport() + { + String result = null; + + if (LOGGER.isDebugEnabled()) + { + Collection capabilities = RMMethodSecurityInterceptor.CAPABILITIES.get().values(); + + if (!capabilities.isEmpty()) + { + StringBuilder buffer = new StringBuilder("\n"); + for (CapabilityReport capability : capabilities) + { + buffer.append(" ").append(capability.name).append(" (").append(capability.status).append(")\n"); + if (!capability.conditions.isEmpty()) + { + for (Map.Entry entry : capability.conditions.entrySet()) + { + buffer.append(" - ").append(entry.getKey()).append(" ("); + if (entry.getValue()) + { + buffer.append("passed"); + } + else + { + buffer.append("failed"); + } + buffer.append(")\n"); + } + } + } + + result = buffer.toString(); + } + } + + return result; + } + + /** + * @see net.sf.acegisecurity.intercept.AbstractSecurityInterceptor#beforeInvocation(java.lang.Object) + */ + @Override + protected InterceptorStatusToken beforeInvocation(Object object) + { + InterceptorStatusToken result = null; + try + { + // clear the capability report information + RMMethodSecurityInterceptor.CAPABILITIES.remove(); + RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.remove(); + RMMethodSecurityInterceptor.MESSAGES.remove(); + + // before invocation (where method security check takes place) + result = super.beforeInvocation(object); + } + catch (AccessDeniedException exception) + { + if (LOGGER.isDebugEnabled()) + { + MethodInvocation mi = (MethodInvocation)object; + + StringBuilder methodDetails = new StringBuilder("\n"); + if (RMMethodSecurityInterceptor.IS_RM_SECURITY_CHECK.get()) + { + methodDetails.append("RM method security check was performed.\n"); + } + else + { + methodDetails.append("Standard DM method security check was performed.\n"); + } + + boolean first = true; + methodDetails.append("Failed on method: ").append(mi.getMethod().getName()).append("("); + for (Object arg : mi.getArguments()) + { + if (first) + { + first = false; + } + else + { + methodDetails.append(", "); + } + + if (arg != null) + { + methodDetails.append(arg.toString()); + } + else + { + methodDetails.append("null"); + } + } + methodDetails.append(")\n"); + + List messages = RMMethodSecurityInterceptor.MESSAGES.get(); + for (String message : messages) + { + methodDetails.append(message).append("\n"); + } + + String failureReport = getFailureReport(); + if (failureReport == null) + { + // rethrow with additional information + throw new AccessDeniedException(exception.getMessage() + methodDetails, exception); + } + else + { + // rethrow with additional information + throw new AccessDeniedException(exception.getMessage() + methodDetails + getFailureReport(), exception); + } + } + else + { + throw exception; + } + } + return result; + } + + /** + * @see net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor#invoke(org.aopalliance.intercept.MethodInvocation) + */ + @Override + public Object invoke(MethodInvocation mi) throws Throwable + { + Object result = null; + InterceptorStatusToken token = beforeInvocation(mi); + + try + { + result = mi.proceed(); + } + finally + { + result = super.afterInvocation(token, result); + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java index 37ceb42064..ec628cba3d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java @@ -1,209 +1,209 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.PropertyValue; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.beans.factory.config.TypedStringValue; - -/** - * Records management method security post processor. - *

- * Combines RM method security configuration with that of the core server before the security - * bean is instantiated. - * - * @author Roy Wetherall - */ -public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor -{ - private static Log logger = LogFactory.getLog(RMMethodSecurityPostProcessor.class); - - public static final String PROP_OBJECT_DEFINITION_SOURCE = "objectDefinitionSource"; - public static final String PROPERTY_PREFIX = "rm.methodsecurity."; - public static final String SECURITY_BEAN_POSTFIX = "_security"; - - /** Security bean names */ - private Set securityBeanNames; - private Set securityBeanNameCache; - - /** Configuration properties */ - private Properties properties; - - /** - * Set of security beans to apply RM configuration to. - *

- * Used in the case where the security bean does not follow the standard naming convention. - * - * @param securityBeanNames security bean names - */ - public void setSecurityBeanNames(Set securityBeanNames) - { - this.securityBeanNames = securityBeanNames; - } - - /** - * @param properties configuration properties - */ - public void setProperties(Properties properties) - { - this.properties = properties; - } - - /** - * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) - */ - @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) - { - for (String bean : getSecurityBeanNames(beanFactory)) - { - if (beanFactory.containsBeanDefinition(bean)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Adding RM method security definitions for " + bean); - } - - BeanDefinition beanDef = beanFactory.getBeanDefinition(bean); - PropertyValue beanValue = beanDef.getPropertyValues().getPropertyValue(PROP_OBJECT_DEFINITION_SOURCE); - if (beanValue != null) - { - String beanStringValue = (String)((TypedStringValue)beanValue.getValue()).getValue(); - String mergedStringValue = merge(beanStringValue); - beanDef.getPropertyValues().addPropertyValue(PROP_OBJECT_DEFINITION_SOURCE, new TypedStringValue(mergedStringValue)); - } - } - } - } - - /** - * Get all the security bean names by looking at the property values set. - * - * @param beanFactory - * @return - */ - private Set getSecurityBeanNames(ConfigurableListableBeanFactory beanFactory) - { - if (securityBeanNameCache == null) - { - securityBeanNameCache = new HashSet(21); - if (securityBeanNames != null) - { - securityBeanNameCache.addAll(securityBeanNames); - } - - for (Object key : properties.keySet()) - { - String[] split = ((String)key).split("\\."); - int index = split.length - 2; - String securityBeanName = split[index] + SECURITY_BEAN_POSTFIX; - if (!securityBeanNameCache.contains(securityBeanName) && beanFactory.containsBean(securityBeanName)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Adding " + securityBeanName + " to list from properties."); - } - - securityBeanNameCache.add(securityBeanName); - } - } - } - - return securityBeanNameCache; - } - - /** - * @param beanStringValue - * @param rmBeanStringValue - * @return - */ - private String merge(String beanStringValue) - { - Map map = convertToMap(beanStringValue); - - for (Map.Entry entry : map.entrySet()) - { - String key = entry.getKey(); - String propKey = PROPERTY_PREFIX + key; - if (properties.containsKey(propKey)) - { - map.put(key, entry.getValue() + "," + properties.getProperty(propKey)); - } - else - { - if (logger.isWarnEnabled()) - { - logger.warn("Missing RM security definition for method " + key); - } - } - } - - return convertToString(map); - } - - /** - * @param stringValue - * @return - */ - private Map convertToMap(String stringValue) - { - String[] values = stringValue.trim().split("\n"); - Map map = new HashMap(values.length); - for (String value : values) - { - String[] pair = value.trim().split("="); - map.put(pair[0], pair[1]); - } - return map; - } - - /** - * @param map - * @return - */ - private String convertToString(Map map) - { - StringBuilder buffer = new StringBuilder(256); - for (Map.Entry entry : map.entrySet()) - { - buffer.append(entry.getKey()).append("=").append(entry.getValue()).append("\n"); - } - - return buffer.toString(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.PropertyValue; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.config.TypedStringValue; + +/** + * Records management method security post processor. + *

+ * Combines RM method security configuration with that of the core server before the security + * bean is instantiated. + * + * @author Roy Wetherall + */ +public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor +{ + private static Log logger = LogFactory.getLog(RMMethodSecurityPostProcessor.class); + + public static final String PROP_OBJECT_DEFINITION_SOURCE = "objectDefinitionSource"; + public static final String PROPERTY_PREFIX = "rm.methodsecurity."; + public static final String SECURITY_BEAN_POSTFIX = "_security"; + + /** Security bean names */ + private Set securityBeanNames; + private Set securityBeanNameCache; + + /** Configuration properties */ + private Properties properties; + + /** + * Set of security beans to apply RM configuration to. + *

+ * Used in the case where the security bean does not follow the standard naming convention. + * + * @param securityBeanNames security bean names + */ + public void setSecurityBeanNames(Set securityBeanNames) + { + this.securityBeanNames = securityBeanNames; + } + + /** + * @param properties configuration properties + */ + public void setProperties(Properties properties) + { + this.properties = properties; + } + + /** + * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) + */ + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) + { + for (String bean : getSecurityBeanNames(beanFactory)) + { + if (beanFactory.containsBeanDefinition(bean)) + { + if (logger.isDebugEnabled()) + { + logger.debug("Adding RM method security definitions for " + bean); + } + + BeanDefinition beanDef = beanFactory.getBeanDefinition(bean); + PropertyValue beanValue = beanDef.getPropertyValues().getPropertyValue(PROP_OBJECT_DEFINITION_SOURCE); + if (beanValue != null) + { + String beanStringValue = (String)((TypedStringValue)beanValue.getValue()).getValue(); + String mergedStringValue = merge(beanStringValue); + beanDef.getPropertyValues().addPropertyValue(PROP_OBJECT_DEFINITION_SOURCE, new TypedStringValue(mergedStringValue)); + } + } + } + } + + /** + * Get all the security bean names by looking at the property values set. + * + * @param beanFactory + * @return + */ + private Set getSecurityBeanNames(ConfigurableListableBeanFactory beanFactory) + { + if (securityBeanNameCache == null) + { + securityBeanNameCache = new HashSet(21); + if (securityBeanNames != null) + { + securityBeanNameCache.addAll(securityBeanNames); + } + + for (Object key : properties.keySet()) + { + String[] split = ((String)key).split("\\."); + int index = split.length - 2; + String securityBeanName = split[index] + SECURITY_BEAN_POSTFIX; + if (!securityBeanNameCache.contains(securityBeanName) && beanFactory.containsBean(securityBeanName)) + { + if (logger.isDebugEnabled()) + { + logger.debug("Adding " + securityBeanName + " to list from properties."); + } + + securityBeanNameCache.add(securityBeanName); + } + } + } + + return securityBeanNameCache; + } + + /** + * @param beanStringValue + * @param rmBeanStringValue + * @return + */ + private String merge(String beanStringValue) + { + Map map = convertToMap(beanStringValue); + + for (Map.Entry entry : map.entrySet()) + { + String key = entry.getKey(); + String propKey = PROPERTY_PREFIX + key; + if (properties.containsKey(propKey)) + { + map.put(key, entry.getValue() + "," + properties.getProperty(propKey)); + } + else + { + if (logger.isWarnEnabled()) + { + logger.warn("Missing RM security definition for method " + key); + } + } + } + + return convertToString(map); + } + + /** + * @param stringValue + * @return + */ + private Map convertToMap(String stringValue) + { + String[] values = stringValue.trim().split("\n"); + Map map = new HashMap(values.length); + for (String value : values) + { + String[] pair = value.trim().split("="); + map.put(pair[0], pair[1]); + } + return map; + } + + /** + * @param map + * @return + */ + private String convertToString(Map map) + { + StringBuilder buffer = new StringBuilder(256); + for (Map.Entry entry : map.entrySet()) + { + buffer.append(entry.getKey()).append("=").append(entry.getValue()).append("\n"); + } + + return buffer.toString(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/site/GetChildrenCannedQueryFactory.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/site/GetChildrenCannedQueryFactory.java index 94939bfe98..63dbb47607 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/site/GetChildrenCannedQueryFactory.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/site/GetChildrenCannedQueryFactory.java @@ -1,57 +1,57 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.site; - -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.query.CannedQuery; -import org.alfresco.query.PagingRequest; -import org.alfresco.repo.node.getchildren.FilterProp; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; - -/** - * Override default implementation to add rma:rmsite to list of returned site types. - * - * See https://issues.alfresco.com/jira/browse/RM-387 - * - * @author Roy Wetherall - */ -public class GetChildrenCannedQueryFactory extends org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory - implements RecordsManagementModel -{ - @Override - public CannedQuery getCannedQuery(NodeRef parentRef, String pattern, Set assocTypeQNames, Set childTypeQNames, List filterProps, List> sortProps, PagingRequest pagingRequest) - { - childTypeQNames.add(TYPE_RM_SITE); - return super.getCannedQuery(parentRef, pattern, assocTypeQNames, childTypeQNames, filterProps, sortProps, pagingRequest); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.site; + +import java.util.List; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.query.CannedQuery; +import org.alfresco.query.PagingRequest; +import org.alfresco.repo.node.getchildren.FilterProp; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; + +/** + * Override default implementation to add rma:rmsite to list of returned site types. + * + * See https://issues.alfresco.com/jira/browse/RM-387 + * + * @author Roy Wetherall + */ +public class GetChildrenCannedQueryFactory extends org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory + implements RecordsManagementModel +{ + @Override + public CannedQuery getCannedQuery(NodeRef parentRef, String pattern, Set assocTypeQNames, Set childTypeQNames, List filterProps, List> sortProps, PagingRequest pagingRequest) + { + childTypeQNames.add(TYPE_RM_SITE); + return super.getCannedQuery(parentRef, pattern, assocTypeQNames, childTypeQNames, filterProps, sortProps, pagingRequest); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferService.java index ea9fdd3253..51c0ed2ad9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferService.java @@ -1,71 +1,71 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.transfer; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Transfer Service Interface - * - * @author Tuna Aksoy - * @since 2.2 - */ -@AlfrescoPublicApi -public interface TransferService -{ - /** - * Indicates whether the given node is a transfer (container) or not. - * - * @param nodeRef node reference - * @return boolean true if transfer, false otherwise - * - * @since 2.0 - */ - boolean isTransfer(NodeRef nodeRef); - - /** - * Create the transfer node and link the disposition lifecycle node beneath it - * - * @param nodeRef node reference to transfer - * @param isAccession Indicates whether this transfer is an accession or not - * @return Returns the transfer object node reference - * - * @since 2.2 - */ - NodeRef transfer(NodeRef nodeRef, boolean isAccession); - - /** - * Completes the transfer for the given node. - * - * @param nodeRef node reference to complete the transfer - * - * @since 2.2 - */ - void completeTransfer(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.transfer; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Transfer Service Interface + * + * @author Tuna Aksoy + * @since 2.2 + */ +@AlfrescoPublicApi +public interface TransferService +{ + /** + * Indicates whether the given node is a transfer (container) or not. + * + * @param nodeRef node reference + * @return boolean true if transfer, false otherwise + * + * @since 2.0 + */ + boolean isTransfer(NodeRef nodeRef); + + /** + * Create the transfer node and link the disposition lifecycle node beneath it + * + * @param nodeRef node reference to transfer + * @param isAccession Indicates whether this transfer is an accession or not + * @return Returns the transfer object node reference + * + * @since 2.2 + */ + NodeRef transfer(NodeRef nodeRef, boolean isAccession); + + /** + * Completes the transfer for the given node. + * + * @param nodeRef node reference to complete the transfer + * + * @since 2.2 + */ + void completeTransfer(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java index 239fb1b2b8..8bc00da79d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java @@ -1,321 +1,321 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.transfer; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.AlfrescoTransactionSupport; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.extensions.surf.util.ParameterCheck; - -/** - * Transfer service implementation - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class TransferServiceImpl extends ServiceBaseImpl - implements TransferService, RecordsManagementModel -{ - /** Transfer node reference key */ - public static final String KEY_TRANSFER_NODEREF = "transferNodeRef"; - - /** I18N */ - private static final String MSG_NODE_ALREADY_TRANSFER = "rm.action.node-already-transfer"; - - /** File Plan Service */ - protected FilePlanService filePlanService; - - /** Disposition service */ - protected DispositionService dispositionService; - - /** Record service */ - protected RecordService recordService; - - /** Record folder service */ - protected RecordFolderService recordFolderService; - - /** Freeze Service */ - protected FreezeService freezeService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param recordFolderService record folder service - */ - public void setRecordFolderService(RecordFolderService recordFolderService) - { - this.recordFolderService = recordFolderService; - } - - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#transfer(NodeRef, boolean) - */ - @Override - public NodeRef transfer(NodeRef nodeRef, boolean isAccession) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - // Get the root rm node - NodeRef root = filePlanService.getFilePlan(nodeRef); - - // Get the transfer object - NodeRef transferNodeRef = (NodeRef)AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF); - if (transferNodeRef == null) - { - // Calculate a transfer name - QName nodeDbid = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "node-dbid"); - Long dbId = (Long) nodeService.getProperty(nodeRef, nodeDbid); - String transferName = StringUtils.leftPad(dbId.toString(), 10, "0"); - - // Create the transfer object - Map transferProps = new HashMap(2); - transferProps.put(ContentModel.PROP_NAME, transferName); - transferProps.put(PROP_TRANSFER_ACCESSION_INDICATOR, isAccession); - - // setup location property from disposition schedule - DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); - if (da != null) - { - DispositionActionDefinition actionDef = da.getDispositionActionDefinition(); - if (actionDef != null) - { - transferProps.put(PROP_TRANSFER_LOCATION, actionDef.getLocation()); - } - } - - NodeRef transferContainer = filePlanService.getTransferContainer(root); - transferNodeRef = nodeService.createNode(transferContainer, - ContentModel.ASSOC_CONTAINS, - QName.createQName(RM_URI, transferName), - TYPE_TRANSFER, - transferProps).getChildRef(); - - // Bind the hold node reference to the transaction - AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, transferNodeRef); - } - else - { - // ensure this node has not already in the process of being transferred - List transferredAlready = nodeService.getChildAssocs(transferNodeRef, ASSOC_TRANSFERRED, ASSOC_TRANSFERRED); - for(ChildAssociationRef car : transferredAlready) - { - if(car.getChildRef().equals(nodeRef)) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_ALREADY_TRANSFER, nodeRef.toString())); - - } - } - } - - // Link the record to the trasnfer object - nodeService.addChild(transferNodeRef, - nodeRef, - ASSOC_TRANSFERRED, - ASSOC_TRANSFERRED); - - // Set PDF indicator flag - setPDFIndicationFlag(transferNodeRef, nodeRef); - - // Set the transferring indicator aspect - nodeService.addAspect(nodeRef, ASPECT_TRANSFERRING, null); - if (isRecordFolder(nodeRef)) - { - // add the transferring indicator aspect to all the child records - for (NodeRef record : recordService.getRecords(nodeRef)) - { - nodeService.addAspect(record, ASPECT_TRANSFERRING, null); - } - } - - return transferNodeRef; - } - - /** - * - * @param transferNodeRef - * @param dispositionLifeCycleNodeRef - */ - private void setPDFIndicationFlag(NodeRef transferNodeRef, NodeRef dispositionLifeCycleNodeRef) - { - if (recordFolderService.isRecordFolder(dispositionLifeCycleNodeRef)) - { - List records = recordService.getRecords(dispositionLifeCycleNodeRef); - for (NodeRef record : records) - { - setPDFIndicationFlag(transferNodeRef, record); - } - } - else - { - ContentData contentData = (ContentData)nodeService.getProperty(dispositionLifeCycleNodeRef, ContentModel.PROP_CONTENT); - if (contentData != null && - MimetypeMap.MIMETYPE_PDF.equals(contentData.getMimetype())) - { - // Set the property indicator - nodeService.setProperty(transferNodeRef, PROP_TRANSFER_PDF_INDICATOR, true); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#completeTransfer(NodeRef) - */ - @Override - public void completeTransfer(NodeRef nodeRef) - { - boolean accessionIndicator = ((Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue(); - String transferLocation = nodeService.getProperty(nodeRef, PROP_TRANSFER_LOCATION).toString(); - - List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef assoc : assocs) - { - if(freezeService.isFrozen(assoc.getChildRef())) - { - throw new AlfrescoRuntimeException("Could not complete a transfer that contains held folders"); - } - - if(freezeService.hasFrozenChildren(assoc.getChildRef())) - { - throw new AlfrescoRuntimeException("Cound not complete a transfer that contains folders with held children"); - } - - markComplete(assoc.getChildRef(), accessionIndicator, transferLocation); - } - - // Delete the transfer object - nodeService.deleteNode(nodeRef); - - NodeRef transferNodeRef = (NodeRef) AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF); - if (transferNodeRef != null && transferNodeRef.equals(nodeRef)) - { - AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, null); - } - } - - /** - * Marks the node complete - * - * @param nodeRef - * disposition lifecycle node reference - */ - private void markComplete(NodeRef nodeRef, boolean accessionIndicator, String transferLocation) - { - // Set the completed date - DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); - if (da != null) - { - nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); - nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); - } - - // Remove the transferring indicator aspect - nodeService.removeAspect(nodeRef, ASPECT_TRANSFERRING); - nodeService.setProperty(nodeRef, PROP_LOCATION, transferLocation); - - // Determine which marker aspect to use - QName markerAspectQName = null; - if (accessionIndicator) - { - markerAspectQName = ASPECT_ASCENDED; - } - else - { - markerAspectQName = ASPECT_TRANSFERRED; - } - - // Mark the object and children accordingly - nodeService.addAspect(nodeRef, markerAspectQName, null); - if (recordFolderService.isRecordFolder(nodeRef)) - { - List records = recordService.getRecords(nodeRef); - for (NodeRef record : records) - { - nodeService.addAspect(record, markerAspectQName, null); - nodeService.setProperty(record, PROP_LOCATION, transferLocation); - } - } - - // Update to the next disposition action - dispositionService.updateNextDispositionAction(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.transfer; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.AlfrescoTransactionSupport; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.surf.util.I18NUtil; +import org.springframework.extensions.surf.util.ParameterCheck; + +/** + * Transfer service implementation + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class TransferServiceImpl extends ServiceBaseImpl + implements TransferService, RecordsManagementModel +{ + /** Transfer node reference key */ + public static final String KEY_TRANSFER_NODEREF = "transferNodeRef"; + + /** I18N */ + private static final String MSG_NODE_ALREADY_TRANSFER = "rm.action.node-already-transfer"; + + /** File Plan Service */ + protected FilePlanService filePlanService; + + /** Disposition service */ + protected DispositionService dispositionService; + + /** Record service */ + protected RecordService recordService; + + /** Record folder service */ + protected RecordFolderService recordFolderService; + + /** Freeze Service */ + protected FreezeService freezeService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param dispositionService disposition service + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param recordFolderService record folder service + */ + public void setRecordFolderService(RecordFolderService recordFolderService) + { + this.recordFolderService = recordFolderService; + } + + /** + * @param freezeService freeze service + */ + public void setFreezeService(FreezeService freezeService) + { + this.freezeService = freezeService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#transfer(NodeRef, boolean) + */ + @Override + public NodeRef transfer(NodeRef nodeRef, boolean isAccession) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + // Get the root rm node + NodeRef root = filePlanService.getFilePlan(nodeRef); + + // Get the transfer object + NodeRef transferNodeRef = (NodeRef)AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF); + if (transferNodeRef == null) + { + // Calculate a transfer name + QName nodeDbid = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "node-dbid"); + Long dbId = (Long) nodeService.getProperty(nodeRef, nodeDbid); + String transferName = StringUtils.leftPad(dbId.toString(), 10, "0"); + + // Create the transfer object + Map transferProps = new HashMap(2); + transferProps.put(ContentModel.PROP_NAME, transferName); + transferProps.put(PROP_TRANSFER_ACCESSION_INDICATOR, isAccession); + + // setup location property from disposition schedule + DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); + if (da != null) + { + DispositionActionDefinition actionDef = da.getDispositionActionDefinition(); + if (actionDef != null) + { + transferProps.put(PROP_TRANSFER_LOCATION, actionDef.getLocation()); + } + } + + NodeRef transferContainer = filePlanService.getTransferContainer(root); + transferNodeRef = nodeService.createNode(transferContainer, + ContentModel.ASSOC_CONTAINS, + QName.createQName(RM_URI, transferName), + TYPE_TRANSFER, + transferProps).getChildRef(); + + // Bind the hold node reference to the transaction + AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, transferNodeRef); + } + else + { + // ensure this node has not already in the process of being transferred + List transferredAlready = nodeService.getChildAssocs(transferNodeRef, ASSOC_TRANSFERRED, ASSOC_TRANSFERRED); + for(ChildAssociationRef car : transferredAlready) + { + if(car.getChildRef().equals(nodeRef)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_ALREADY_TRANSFER, nodeRef.toString())); + + } + } + } + + // Link the record to the trasnfer object + nodeService.addChild(transferNodeRef, + nodeRef, + ASSOC_TRANSFERRED, + ASSOC_TRANSFERRED); + + // Set PDF indicator flag + setPDFIndicationFlag(transferNodeRef, nodeRef); + + // Set the transferring indicator aspect + nodeService.addAspect(nodeRef, ASPECT_TRANSFERRING, null); + if (isRecordFolder(nodeRef)) + { + // add the transferring indicator aspect to all the child records + for (NodeRef record : recordService.getRecords(nodeRef)) + { + nodeService.addAspect(record, ASPECT_TRANSFERRING, null); + } + } + + return transferNodeRef; + } + + /** + * + * @param transferNodeRef + * @param dispositionLifeCycleNodeRef + */ + private void setPDFIndicationFlag(NodeRef transferNodeRef, NodeRef dispositionLifeCycleNodeRef) + { + if (recordFolderService.isRecordFolder(dispositionLifeCycleNodeRef)) + { + List records = recordService.getRecords(dispositionLifeCycleNodeRef); + for (NodeRef record : records) + { + setPDFIndicationFlag(transferNodeRef, record); + } + } + else + { + ContentData contentData = (ContentData)nodeService.getProperty(dispositionLifeCycleNodeRef, ContentModel.PROP_CONTENT); + if (contentData != null && + MimetypeMap.MIMETYPE_PDF.equals(contentData.getMimetype())) + { + // Set the property indicator + nodeService.setProperty(transferNodeRef, PROP_TRANSFER_PDF_INDICATOR, true); + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#completeTransfer(NodeRef) + */ + @Override + public void completeTransfer(NodeRef nodeRef) + { + boolean accessionIndicator = ((Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue(); + String transferLocation = nodeService.getProperty(nodeRef, PROP_TRANSFER_LOCATION).toString(); + + List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) + { + if(freezeService.isFrozen(assoc.getChildRef())) + { + throw new AlfrescoRuntimeException("Could not complete a transfer that contains held folders"); + } + + if(freezeService.hasFrozenChildren(assoc.getChildRef())) + { + throw new AlfrescoRuntimeException("Cound not complete a transfer that contains folders with held children"); + } + + markComplete(assoc.getChildRef(), accessionIndicator, transferLocation); + } + + // Delete the transfer object + nodeService.deleteNode(nodeRef); + + NodeRef transferNodeRef = (NodeRef) AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF); + if (transferNodeRef != null && transferNodeRef.equals(nodeRef)) + { + AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, null); + } + } + + /** + * Marks the node complete + * + * @param nodeRef + * disposition lifecycle node reference + */ + private void markComplete(NodeRef nodeRef, boolean accessionIndicator, String transferLocation) + { + // Set the completed date + DispositionAction da = dispositionService.getNextDispositionAction(nodeRef); + if (da != null) + { + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); + } + + // Remove the transferring indicator aspect + nodeService.removeAspect(nodeRef, ASPECT_TRANSFERRING); + nodeService.setProperty(nodeRef, PROP_LOCATION, transferLocation); + + // Determine which marker aspect to use + QName markerAspectQName = null; + if (accessionIndicator) + { + markerAspectQName = ASPECT_ASCENDED; + } + else + { + markerAspectQName = ASPECT_TRANSFERRED; + } + + // Mark the object and children accordingly + nodeService.addAspect(nodeRef, markerAspectQName, null); + if (recordFolderService.isRecordFolder(nodeRef)) + { + List records = recordService.getRecords(nodeRef); + for (NodeRef record : records) + { + nodeService.addAspect(record, markerAspectQName, null); + nodeService.setProperty(record, PROP_LOCATION, transferLocation); + } + } + + // Update to the next disposition action + dispositionService.updateNextDispositionAction(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java index 9f0adeac6b..e97cb73928 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -/** - * Alfresco Transaction Support delegation bean. - * - * @author Roy Wetherall - * @since 2.3 - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport - */ -public class AlfrescoTransactionSupport -{ - /** - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#bindResource(Object, Object) - */ - public void bindResource(Object key, Object resource) - { - org.alfresco.repo.transaction.AlfrescoTransactionSupport.bindResource(key, resource); - } - - /** - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#unbindResource(Object) - */ - public void unbindResource(Object key) - { - org.alfresco.repo.transaction.AlfrescoTransactionSupport.unbindResource(key); - } - - /** - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#getResource(Object) - * @since 2.4.a - */ - public Object getResource(Object key) - { - return org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(key); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +/** + * Alfresco Transaction Support delegation bean. + * + * @author Roy Wetherall + * @since 2.3 + * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport + */ +public class AlfrescoTransactionSupport +{ + /** + * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#bindResource(Object, Object) + */ + public void bindResource(Object key, Object resource) + { + org.alfresco.repo.transaction.AlfrescoTransactionSupport.bindResource(key, resource); + } + + /** + * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#unbindResource(Object) + */ + public void unbindResource(Object key) + { + org.alfresco.repo.transaction.AlfrescoTransactionSupport.unbindResource(key); + } + + /** + * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#getResource(Object) + * @since 2.4.a + */ + public Object getResource(Object key) + { + return org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource(key); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java index 0569450e32..8664fc7756 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java @@ -1,130 +1,130 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import org.alfresco.repo.security.authentication.AuthenticationException; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; - -/** - * Helper bean to allow injection of AuthenticationUtil methods. - *

- * Useful when testing using mocks. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class AuthenticationUtil -{ - /** - * Helper method that executed work as system user. - *

- * Useful when testing using mocks. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#runAsSystem(RunAsWork, String) - */ - public R runAsSystem(RunAsWork runAsWork) - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem(runAsWork); - } - - /** - * Helper method that executed work as given user. - *

- * Useful when testing using mocks. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#runAs(RunAsWork, String) - */ - public R runAs(RunAsWork runAsWork, String uid) - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(runAsWork, uid); - } - - /** - * Helper method that gets the fully authenticated user. - *

- * Useful when testing using mocks. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getFullyAuthenticatedUser() - */ - public String getFullyAuthenticatedUser() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getFullyAuthenticatedUser(); - } - - /** - * Helper method that gets the admin user name. - *

- * Useful when testing using mocks. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getAdminUserName() - */ - public String getAdminUserName() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName(); - } - - /** - * Helper method that gets the system user name. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getSystemUserName() - */ - public String getSystemUserName() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getSystemUserName(); - } - - /** - * Helper method that gets the guest user name. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getGuestUserName() - */ - public String getGuestUserName() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getGuestUserName(); - } - - /** - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#isRunAsUserTheSystemUser() - */ - public boolean isRunAsUserTheSystemUser() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.isRunAsUserTheSystemUser(); - } - - /** - * Helper method to get the user that is currently in effect for purposes of authentication. This includes any - * overlays introduced by {@link #runAs}. - * - * @return Returns the name of the user - * @throws AuthenticationException - */ - public String getRunAsUser() throws AuthenticationException - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getRunAsUser(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import org.alfresco.repo.security.authentication.AuthenticationException; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; + +/** + * Helper bean to allow injection of AuthenticationUtil methods. + *

+ * Useful when testing using mocks. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class AuthenticationUtil +{ + /** + * Helper method that executed work as system user. + *

+ * Useful when testing using mocks. + * + * @see org.alfresco.repo.security.authentication.AuthenticationUtil#runAsSystem(RunAsWork, String) + */ + public R runAsSystem(RunAsWork runAsWork) + { + return org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem(runAsWork); + } + + /** + * Helper method that executed work as given user. + *

+ * Useful when testing using mocks. + * + * @see org.alfresco.repo.security.authentication.AuthenticationUtil#runAs(RunAsWork, String) + */ + public R runAs(RunAsWork runAsWork, String uid) + { + return org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(runAsWork, uid); + } + + /** + * Helper method that gets the fully authenticated user. + *

+ * Useful when testing using mocks. + * + * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getFullyAuthenticatedUser() + */ + public String getFullyAuthenticatedUser() + { + return org.alfresco.repo.security.authentication.AuthenticationUtil.getFullyAuthenticatedUser(); + } + + /** + * Helper method that gets the admin user name. + *

+ * Useful when testing using mocks. + * + * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getAdminUserName() + */ + public String getAdminUserName() + { + return org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName(); + } + + /** + * Helper method that gets the system user name. + * + * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getSystemUserName() + */ + public String getSystemUserName() + { + return org.alfresco.repo.security.authentication.AuthenticationUtil.getSystemUserName(); + } + + /** + * Helper method that gets the guest user name. + * + * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getGuestUserName() + */ + public String getGuestUserName() + { + return org.alfresco.repo.security.authentication.AuthenticationUtil.getGuestUserName(); + } + + /** + * @see org.alfresco.repo.security.authentication.AuthenticationUtil#isRunAsUserTheSystemUser() + */ + public boolean isRunAsUserTheSystemUser() + { + return org.alfresco.repo.security.authentication.AuthenticationUtil.isRunAsUserTheSystemUser(); + } + + /** + * Helper method to get the user that is currently in effect for purposes of authentication. This includes any + * overlays introduced by {@link #runAs}. + * + * @return Returns the name of the user + * @throws AuthenticationException + */ + public String getRunAsUser() throws AuthenticationException + { + return org.alfresco.repo.security.authentication.AuthenticationUtil.getRunAsUser(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java index ce796ffcfc..c407d5c24a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java @@ -1,86 +1,86 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; - -/** - * Utility class with policy helper methods. - * - * @author Roy Wetherall - */ -public final class PoliciesUtil -{ - private PoliciesUtil() - { - // Will not be called - } - - /** - * Get all aspect and node type qualified names - * - * @param nodeRef - * the node we are interested in - * @return Returns a set of qualified names containing the node type and all - * the node aspects, or null if the node no longer exists - */ - public static Set getTypeAndAspectQNames(final NodeService nodeService, final NodeRef nodeRef) - { - return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() - { - public Set doWork() - { - Set qnames = null; - try - { - Set aspectQNames = nodeService.getAspects(nodeRef); - - QName typeQName = nodeService.getType(nodeRef); - - qnames = new HashSet(aspectQNames.size() + 1); - qnames.addAll(aspectQNames); - qnames.add(typeQName); - } - catch (InvalidNodeRefException e) - { - qnames = Collections.emptySet(); - } - // done - return qnames; - } - }, AuthenticationUtil.getAdminUserName()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; + +/** + * Utility class with policy helper methods. + * + * @author Roy Wetherall + */ +public final class PoliciesUtil +{ + private PoliciesUtil() + { + // Will not be called + } + + /** + * Get all aspect and node type qualified names + * + * @param nodeRef + * the node we are interested in + * @return Returns a set of qualified names containing the node type and all + * the node aspects, or null if the node no longer exists + */ + public static Set getTypeAndAspectQNames(final NodeService nodeService, final NodeRef nodeRef) + { + return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork>() + { + public Set doWork() + { + Set qnames = null; + try + { + Set aspectQNames = nodeService.getAspects(nodeRef); + + QName typeQName = nodeService.getType(nodeRef); + + qnames = new HashSet(aspectQNames.size() + 1); + qnames.addAll(aspectQNames); + qnames.add(typeQName); + } + catch (InvalidNodeRefException e) + { + qnames = Collections.emptySet(); + } + // done + return qnames; + } + }, AuthenticationUtil.getAdminUserName()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java index db0ed51f71..19e675e305 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java @@ -1,204 +1,204 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import static org.springframework.util.ObjectUtils.nullSafeEquals; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Various common helper methods for Collections. This class is probably only appropriate for use with relatively - * small collections as it has not been optimised for dealing with large collections. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -// This class should all be moved to core Alfresco whenever possible and reused from there. -public final class RMCollectionUtils -{ - private RMCollectionUtils() { /* Intentionally empty. */} - - /** - * Gets the list of duplicate elements contained within the specified list, if any. - * @param l the list in which to find duplicates. - * @param the element type of the list. - * @return a list of duplicate elements. If there are no duplicates, returns an empty list. - */ - public static List getDuplicateElements(List l) - { - final Set uniqueElems = new HashSet<>(); - final List duplicateElems = new ArrayList<>(); - - for (T elem: l) - { - if (uniqueElems.contains(elem)) - { - if (!duplicateElems.contains(elem)) duplicateElems.add(elem); - } - else - { - uniqueElems.add(elem); - } - } - return duplicateElems; - } - - /** Returns the head (element at index 0) of the provided List. - * - * @param l the list whose head is sought. - * @param the type of the List. - * @return the head element or {@code null} for the empty list. - * @throws NullPointerException if l is {@code null} - */ - public static T head(List l) - { - return l.isEmpty() ? null : l.get(0); - } - - /** - * Returns the tail of the provided List i.e. the sublist which contains - * all elements of the given list except the {@link #head(List) head}. - * - * @param l the list whose tail is sought. - * @param the type of the List. - * @return the tail sublist, which will be an empty list if the provided list had only a single element. - * @throws NullPointerException if l is {@code null} - * @throws UnsupportedOperationException if the provided list was empty. - */ - public static List tail(List l) - { - if (l.isEmpty()) - { - throw new UnsupportedOperationException("Cannot get tail of empty list."); - } - else - { - return l.subList(1, l.size()); - } - } - - /** - * Returns a Serializable List containing all of the provided elements. - * - * @param elements the elements to put in a list. - * @param the element type. - * @return a Serializable List containing all the provided elements. - */ - @SuppressWarnings("unchecked") - @SafeVarargs - public static > - LIST asSerializableList(T... elements) - { - final LIST l = (LIST)new ArrayList(elements.length); - for (T element : elements) - { - l.add(element); - } - return l; - } - - /** - * Returns a Set containing all of the provided elements. Duplicate elements will be removed as per the - * {@code Set} contract. - * - * @param elements the elements to put in a Set. - * @param the element type. - * @return a Set containing all the provided elements (without duplicates). - */ - @SafeVarargs - public static HashSet asSet(T... elements) - { - final HashSet set = new HashSet<>(elements.length); - for (T element : elements) - { - set.add(element); - } - return set; - } - - /** - * Returns a Set containing all of the elements in the provided collection. - * Duplicate elements will be removed as per the - * {@code Set} contract. - * - * @param c the elements to put in a Set. - * @param the element type. - * @return a Set containing all the provided elements (without duplicates). - */ - public static HashSet asSet(Collection c) - { - return new HashSet<>(c); - } - - /** - * This enum represents a change in an entry between 2 collections. - */ - public enum Difference - { - ADDED, REMOVED, CHANGED, UNCHANGED - } - - /** - * Determines the change in a Map entry between two Maps. - * Note that both maps must have the same types of key-value pair. - * - * @param from the first collection. - * @param to the second collection. - * @param key the key identifying the entry. - * @param the type of the key. - * @param the type of the value. - * @return the {@link Difference}. - * - * @throws IllegalArgumentException if {@code key} is {@code null}. - */ - public static Difference diffKey(Map from, Map to, K key) - { - if (key == null) { throw new IllegalArgumentException("Key cannot be null."); } - - if (from.containsKey(key)) - { - if (to.containsKey(key)) - { - if (nullSafeEquals(from.get(key), to.get(key))) { return Difference.UNCHANGED; } - else { return Difference.CHANGED; } - } - else { return Difference.REMOVED; } - } - else - { - if (to.containsKey(key)) { return Difference.ADDED; } - else { return Difference.UNCHANGED; } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import static org.springframework.util.ObjectUtils.nullSafeEquals; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Various common helper methods for Collections. This class is probably only appropriate for use with relatively + * small collections as it has not been optimised for dealing with large collections. + * + * @author Neil Mc Erlean + * @since 2.4.a + */ +// This class should all be moved to core Alfresco whenever possible and reused from there. +public final class RMCollectionUtils +{ + private RMCollectionUtils() { /* Intentionally empty. */} + + /** + * Gets the list of duplicate elements contained within the specified list, if any. + * @param l the list in which to find duplicates. + * @param the element type of the list. + * @return a list of duplicate elements. If there are no duplicates, returns an empty list. + */ + public static List getDuplicateElements(List l) + { + final Set uniqueElems = new HashSet<>(); + final List duplicateElems = new ArrayList<>(); + + for (T elem: l) + { + if (uniqueElems.contains(elem)) + { + if (!duplicateElems.contains(elem)) duplicateElems.add(elem); + } + else + { + uniqueElems.add(elem); + } + } + return duplicateElems; + } + + /** Returns the head (element at index 0) of the provided List. + * + * @param l the list whose head is sought. + * @param the type of the List. + * @return the head element or {@code null} for the empty list. + * @throws NullPointerException if l is {@code null} + */ + public static T head(List l) + { + return l.isEmpty() ? null : l.get(0); + } + + /** + * Returns the tail of the provided List i.e. the sublist which contains + * all elements of the given list except the {@link #head(List) head}. + * + * @param l the list whose tail is sought. + * @param the type of the List. + * @return the tail sublist, which will be an empty list if the provided list had only a single element. + * @throws NullPointerException if l is {@code null} + * @throws UnsupportedOperationException if the provided list was empty. + */ + public static List tail(List l) + { + if (l.isEmpty()) + { + throw new UnsupportedOperationException("Cannot get tail of empty list."); + } + else + { + return l.subList(1, l.size()); + } + } + + /** + * Returns a Serializable List containing all of the provided elements. + * + * @param elements the elements to put in a list. + * @param the element type. + * @return a Serializable List containing all the provided elements. + */ + @SuppressWarnings("unchecked") + @SafeVarargs + public static > + LIST asSerializableList(T... elements) + { + final LIST l = (LIST)new ArrayList(elements.length); + for (T element : elements) + { + l.add(element); + } + return l; + } + + /** + * Returns a Set containing all of the provided elements. Duplicate elements will be removed as per the + * {@code Set} contract. + * + * @param elements the elements to put in a Set. + * @param the element type. + * @return a Set containing all the provided elements (without duplicates). + */ + @SafeVarargs + public static HashSet asSet(T... elements) + { + final HashSet set = new HashSet<>(elements.length); + for (T element : elements) + { + set.add(element); + } + return set; + } + + /** + * Returns a Set containing all of the elements in the provided collection. + * Duplicate elements will be removed as per the + * {@code Set} contract. + * + * @param c the elements to put in a Set. + * @param the element type. + * @return a Set containing all the provided elements (without duplicates). + */ + public static HashSet asSet(Collection c) + { + return new HashSet<>(c); + } + + /** + * This enum represents a change in an entry between 2 collections. + */ + public enum Difference + { + ADDED, REMOVED, CHANGED, UNCHANGED + } + + /** + * Determines the change in a Map entry between two Maps. + * Note that both maps must have the same types of key-value pair. + * + * @param from the first collection. + * @param to the second collection. + * @param key the key identifying the entry. + * @param the type of the key. + * @param the type of the value. + * @return the {@link Difference}. + * + * @throws IllegalArgumentException if {@code key} is {@code null}. + */ + public static Difference diffKey(Map from, Map to, K key) + { + if (key == null) { throw new IllegalArgumentException("Key cannot be null."); } + + if (from.containsKey(key)) + { + if (to.containsKey(key)) + { + if (nullSafeEquals(from.get(key), to.get(key))) { return Difference.UNCHANGED; } + else { return Difference.CHANGED; } + } + else { return Difference.REMOVED; } + } + else + { + if (to.containsKey(key)) { return Difference.ADDED; } + else { return Difference.UNCHANGED; } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheck.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheck.java index 9bb66afcf9..916f6e30d9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheck.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheck.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import org.apache.commons.lang.StringUtils; - -/** - * Utility class that contains validation not present in {@link org.alfresco.util.ParameterCheck}. - * - * @author tpage - */ -public class RMParameterCheck -{ - /** - * Checks that the string parameter with the given name is not blank i.e. it is not null, zero length or entirely - * composed of whitespace. - * - * @param strParamName Name of parameter to check - * @param strParamValue Value of the parameter to check - */ - public static void checkNotBlank(final String strParamName, final String strParamValue) - throws IllegalArgumentException - { - if (StringUtils.isBlank(strParamValue)) { throw new IllegalArgumentException(strParamName - + " is a mandatory parameter"); } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import org.apache.commons.lang.StringUtils; + +/** + * Utility class that contains validation not present in {@link org.alfresco.util.ParameterCheck}. + * + * @author tpage + */ +public class RMParameterCheck +{ + /** + * Checks that the string parameter with the given name is not blank i.e. it is not null, zero length or entirely + * composed of whitespace. + * + * @param strParamName Name of parameter to check + * @param strParamValue Value of the parameter to check + */ + public static void checkNotBlank(final String strParamName, final String strParamValue) + throws IllegalArgumentException + { + if (StringUtils.isBlank(strParamValue)) { throw new IllegalArgumentException(strParamName + + " is a mandatory parameter"); } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java index 904a592d96..dafe861f1a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java @@ -1,540 +1,540 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import java.util.Map; -import java.util.Set; -import java.util.WeakHashMap; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.rendition.RenditionService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Helper base class for service implementations. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ServiceBaseImpl implements RecordsManagementModel, ApplicationContextAware -{ - /** Node service */ - protected NodeService nodeService; - - /** Dictionary service */ - protected DictionaryService dictionaryService; - - /** Rendition service */ - protected RenditionService renditionService; - - /** Application context */ - protected ApplicationContext applicationContext; - - /** internal node service */ - private NodeService internalNodeService; - - /** authentication helper */ - protected AuthenticationUtil authenticationUtil; - - /** transactional resource helper */ - protected TransactionalResourceHelper transactionalResourceHelper; - - /** - * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - this.applicationContext = applicationContext; - } - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param service service - */ - public void setRenditionService(RenditionService service) - { - this.renditionService = service; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param authenticationUtil authentication util helper - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - /** - * Helper to get internal node service. - *

- * Used for performance reasons. - */ - protected NodeService getInternalNodeService() - { - if (internalNodeService == null) - { - internalNodeService = (NodeService)applicationContext.getBean("dbNodeService"); - } - - return internalNodeService; - } - - /** - * Gets the file plan component kind from the given node reference - * - * @see FilePlanService#getFilePlanComponentKind(org.alfresco.service.cmr.repository.NodeRef) - */ - public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef) - { - FilePlanComponentKind result = null; - - Map map = transactionalResourceHelper.getMap("rm.transaction.filePlanComponentByNodeRef"); - if (map.containsKey(nodeRef)) - { - result = map.get(nodeRef); - } - else - { - if (isFilePlanComponent(nodeRef)) - { - result = FilePlanComponentKind.FILE_PLAN_COMPONENT; - - if (isFilePlan(nodeRef)) - { - result = FilePlanComponentKind.FILE_PLAN; - } - else if (isRecordCategory(nodeRef)) - { - result = FilePlanComponentKind.RECORD_CATEGORY; - } - else if (isRecordFolder(nodeRef)) - { - result = FilePlanComponentKind.RECORD_FOLDER; - } - else if (isRecord(nodeRef)) - { - result = FilePlanComponentKind.RECORD; - } - else if (instanceOf(nodeRef, TYPE_HOLD_CONTAINER)) - { - result = FilePlanComponentKind.HOLD_CONTAINER; - } - else if (isHold(nodeRef)) - { - result = FilePlanComponentKind.HOLD; - } - else if (instanceOf(nodeRef, TYPE_TRANSFER_CONTAINER)) - { - result = FilePlanComponentKind.TRANSFER_CONTAINER; - } - else if (isTransfer(nodeRef)) - { - result = FilePlanComponentKind.TRANSFER; - } - else if (instanceOf(nodeRef, TYPE_DISPOSITION_SCHEDULE) || instanceOf(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION)) - { - result = FilePlanComponentKind.DISPOSITION_SCHEDULE; - } - else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER)) - { - result = FilePlanComponentKind.UNFILED_RECORD_CONTAINER; - } - else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_FOLDER)) - { - result = FilePlanComponentKind.UNFILED_RECORD_FOLDER; - } - } - - if (result != null) - { - map.put(nodeRef, result); - } - } - - return result; - } - - /** - * Gets the file plan component kind from the given type. - * - * @see FilePlanService#getFilePlanComponentKindFromType(QName) - */ - public FilePlanComponentKind getFilePlanComponentKindFromType(QName type) - { - FilePlanComponentKind result = null; - - if (ASPECT_FILE_PLAN_COMPONENT.equals(type)) - { - result = FilePlanComponentKind.FILE_PLAN_COMPONENT; - } - else if (instanceOf(type, ASPECT_RECORD)) - { - result = FilePlanComponentKind.RECORD; - } - else if (instanceOf(type, TYPE_FILE_PLAN)) - { - result = FilePlanComponentKind.FILE_PLAN; - } - else if (instanceOf(type, TYPE_RECORD_CATEGORY)) - { - result = FilePlanComponentKind.RECORD_CATEGORY; - } - else if (instanceOf(type, TYPE_RECORD_FOLDER)) - { - result = FilePlanComponentKind.RECORD_FOLDER; - } - else if (instanceOf(type, TYPE_HOLD)) - { - result = FilePlanComponentKind.HOLD; - } - else if (instanceOf(type, TYPE_TRANSFER)) - { - result = FilePlanComponentKind.TRANSFER; - } - else if (instanceOf(type, TYPE_DISPOSITION_SCHEDULE) || - instanceOf(type, TYPE_DISPOSITION_ACTION_DEFINITION)) - { - result = FilePlanComponentKind.DISPOSITION_SCHEDULE; - } - - return result; - } - - /** - * Indicates whether the given node is a file plan component or not. - *

- * Exposed in the FilePlan service. - * - * @see FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isFilePlanComponent(NodeRef nodeRef) - { - boolean result = false; - if (getInternalNodeService().exists(nodeRef) && - getInternalNodeService().hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT)) - { - result = true; - } - return result; - } - - /** - * Indicates whether the given node is a file plan or not. - *

- * Exposed in the FilePlan service. - * - * @see FilePlanService#isFilePlan(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isFilePlan(NodeRef nodeRef) - { - return instanceOf(nodeRef, TYPE_FILE_PLAN); - } - - /** - * Indicates whether the given node is a file plan container or not. - * - * @see FilePlanService#isFilePlanContainer(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isFilePlanContainer(NodeRef nodeRef) - { - return instanceOf(nodeRef, TYPE_RECORDS_MANAGEMENT_CONTAINER); - } - - /** - * Indicates whether the given node is a record category or not. - * - * @see FilePlanService#isRecordCategory(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isRecordCategory(NodeRef nodeRef) - { - return instanceOf(nodeRef, TYPE_RECORD_CATEGORY); - } - - /** - * Indicates whether the given node is a record folder or not. - *

- * Exposed in the RecordFolder service. - * - * @param nodeRef node reference - * @return boolean true if record folder, false otherwise - */ - public boolean isRecordFolder(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - return instanceOf(nodeRef, TYPE_RECORD_FOLDER); - } - - /** - * Indicates whether the given node reference is a record or not. - * - * @param nodeRef node reference - * @return boolean true if node reference is a record, false otherwise - */ - public boolean isRecord(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return getInternalNodeService().hasAspect(nodeRef, ASPECT_RECORD); - } - - /** - * Indicates whether the given node reference is a hold or not. - *

- * Exposed publicly in the {@link HoldService} - * - * @param nodeRef node reference - * @return boolean true if rma:hold or sub-type, false otherwise - */ - public boolean isHold(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - boolean isHold = false; - if (getInternalNodeService().exists(nodeRef) && - instanceOf(nodeRef, TYPE_HOLD)) - { - isHold = true; - } - return isHold; - } - - /** - * Indicates whether the given node reference is a transfer or not. - * - * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#isTransfer(NodeRef) - */ - public boolean isTransfer(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return instanceOf(nodeRef, TYPE_TRANSFER); - } - - /** - * Indicates whether the given node reference is an unfiled records container or not. - * - * @param nodeRef node reference - * @return boolean true if rma:unfiledRecordContainer or sub-type, false otherwise - */ - public boolean isUnfiledRecordsContainer(NodeRef nodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - - return instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER); - } - - /** - * Indicates whether a record is complete or not. - * - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef) - */ - public boolean isDeclared(NodeRef record) - { - ParameterCheck.mandatory("record", record); - - return getInternalNodeService().hasAspect(record, ASPECT_DECLARED_RECORD); - } - - /** - * Gets the file plan that a given file plan component resides within. - * - * @param nodeRef node reference - * @return {@link NodeRef} file plan, null if none - */ - public NodeRef getFilePlan(final NodeRef nodeRef) - { - NodeRef result = null; - if (nodeRef != null) - { - Map transactionCache = transactionalResourceHelper.getMap("rm.servicebase.getFilePlan"); - if (transactionCache.containsKey(nodeRef)) - { - result = transactionCache.get(nodeRef); - } - else - { - result = (NodeRef)getInternalNodeService().getProperty(nodeRef, PROP_ROOT_NODEREF); - if (result == null || !instanceOf(result, TYPE_FILE_PLAN)) - { - if (instanceOf(nodeRef, TYPE_FILE_PLAN)) - { - result = nodeRef; - } - else - { - ChildAssociationRef parentAssocRef = getInternalNodeService().getPrimaryParent(nodeRef); - if (parentAssocRef != null) - { - result = getFilePlan(parentAssocRef.getParentRef()); - } - } - } - - // cache result in transaction if result is not null - if (result != null) - { - transactionCache.put(nodeRef, result); - } - } - } - - return result; - } - - /** - * Utility method to safely and quickly determine if a node is a type (or sub-type) of the one specified. - * - * @param nodeRef node reference - * @param ofClassName class name to check - */ - protected boolean instanceOf(NodeRef nodeRef, QName ofClassName) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("ofClassName", ofClassName); - QName className = getInternalNodeService().getType(nodeRef); - return instanceOf(className, ofClassName); - } - - private static Map instanceOfCache = new WeakHashMap<>(); - - /** - * Utility method to quickly determine whether one class is equal to or sub of another. - * - * @param className class name - * @param ofClassName class name to check against - * @return boolean true if equal to or sub, false otherwise - */ - protected boolean instanceOf(QName className, QName ofClassName) - { - ParameterCheck.mandatory("className", className); - ParameterCheck.mandatory("ofClassName", ofClassName); - - boolean result = false; - - String key = className.toString() + "|" + ofClassName.toString(); - if (instanceOfCache.containsKey(key)) - { - result = instanceOfCache.get(key); - } - else - { - if (ofClassName.equals(className) || - dictionaryService.isSubClass(className, ofClassName)) - { - result = true; - } - - instanceOfCache.put(key, result); - } - - return result; - } - - /** - * Utility method to get the next counter for a node. - *

- * If the node is not already countable, then rma:countable is added and 0 returned. - * - * @param nodeRef node reference - * @return int next counter value - */ - protected int getNextCount(NodeRef nodeRef) - { - int counter = 0; - if (!nodeService.hasAspect(nodeRef, ASPECT_COUNTABLE)) - { - PropertyMap props = new PropertyMap(1); - props.put(PROP_COUNT, 1); - nodeService.addAspect(nodeRef, ASPECT_COUNTABLE, props); - counter = 1; - } - else - { - Integer value = (Integer)this.nodeService.getProperty(nodeRef, PROP_COUNT); - if (value != null) - { - counter = value.intValue() + 1; - } - else - { - counter = 1; - } - nodeService.setProperty(nodeRef, PROP_COUNT, counter); - - } - return counter; - } - - /** - * Helper method to get a set containing the node's type and all it's aspects - * - * @param nodeRef nodeRef - * @return Set set of qname's - */ - protected Set getTypeAndApsects(NodeRef nodeRef) - { - Set result = nodeService.getAspects(nodeRef); - result.add(nodeService.getType(nodeRef)); - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import java.util.Map; +import java.util.Set; +import java.util.WeakHashMap; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.rendition.RenditionService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; +import org.alfresco.util.PropertyMap; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * Helper base class for service implementations. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ServiceBaseImpl implements RecordsManagementModel, ApplicationContextAware +{ + /** Node service */ + protected NodeService nodeService; + + /** Dictionary service */ + protected DictionaryService dictionaryService; + + /** Rendition service */ + protected RenditionService renditionService; + + /** Application context */ + protected ApplicationContext applicationContext; + + /** internal node service */ + private NodeService internalNodeService; + + /** authentication helper */ + protected AuthenticationUtil authenticationUtil; + + /** transactional resource helper */ + protected TransactionalResourceHelper transactionalResourceHelper; + + /** + * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) + { + this.applicationContext = applicationContext; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param service service + */ + public void setRenditionService(RenditionService service) + { + this.renditionService = service; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param authenticationUtil authentication util helper + */ + public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) + { + this.authenticationUtil = authenticationUtil; + } + + /** + * @param transactionalResourceHelper transactional resource helper + */ + public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) + { + this.transactionalResourceHelper = transactionalResourceHelper; + } + + /** + * Helper to get internal node service. + *

+ * Used for performance reasons. + */ + protected NodeService getInternalNodeService() + { + if (internalNodeService == null) + { + internalNodeService = (NodeService)applicationContext.getBean("dbNodeService"); + } + + return internalNodeService; + } + + /** + * Gets the file plan component kind from the given node reference + * + * @see FilePlanService#getFilePlanComponentKind(org.alfresco.service.cmr.repository.NodeRef) + */ + public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef) + { + FilePlanComponentKind result = null; + + Map map = transactionalResourceHelper.getMap("rm.transaction.filePlanComponentByNodeRef"); + if (map.containsKey(nodeRef)) + { + result = map.get(nodeRef); + } + else + { + if (isFilePlanComponent(nodeRef)) + { + result = FilePlanComponentKind.FILE_PLAN_COMPONENT; + + if (isFilePlan(nodeRef)) + { + result = FilePlanComponentKind.FILE_PLAN; + } + else if (isRecordCategory(nodeRef)) + { + result = FilePlanComponentKind.RECORD_CATEGORY; + } + else if (isRecordFolder(nodeRef)) + { + result = FilePlanComponentKind.RECORD_FOLDER; + } + else if (isRecord(nodeRef)) + { + result = FilePlanComponentKind.RECORD; + } + else if (instanceOf(nodeRef, TYPE_HOLD_CONTAINER)) + { + result = FilePlanComponentKind.HOLD_CONTAINER; + } + else if (isHold(nodeRef)) + { + result = FilePlanComponentKind.HOLD; + } + else if (instanceOf(nodeRef, TYPE_TRANSFER_CONTAINER)) + { + result = FilePlanComponentKind.TRANSFER_CONTAINER; + } + else if (isTransfer(nodeRef)) + { + result = FilePlanComponentKind.TRANSFER; + } + else if (instanceOf(nodeRef, TYPE_DISPOSITION_SCHEDULE) || instanceOf(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION)) + { + result = FilePlanComponentKind.DISPOSITION_SCHEDULE; + } + else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER)) + { + result = FilePlanComponentKind.UNFILED_RECORD_CONTAINER; + } + else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_FOLDER)) + { + result = FilePlanComponentKind.UNFILED_RECORD_FOLDER; + } + } + + if (result != null) + { + map.put(nodeRef, result); + } + } + + return result; + } + + /** + * Gets the file plan component kind from the given type. + * + * @see FilePlanService#getFilePlanComponentKindFromType(QName) + */ + public FilePlanComponentKind getFilePlanComponentKindFromType(QName type) + { + FilePlanComponentKind result = null; + + if (ASPECT_FILE_PLAN_COMPONENT.equals(type)) + { + result = FilePlanComponentKind.FILE_PLAN_COMPONENT; + } + else if (instanceOf(type, ASPECT_RECORD)) + { + result = FilePlanComponentKind.RECORD; + } + else if (instanceOf(type, TYPE_FILE_PLAN)) + { + result = FilePlanComponentKind.FILE_PLAN; + } + else if (instanceOf(type, TYPE_RECORD_CATEGORY)) + { + result = FilePlanComponentKind.RECORD_CATEGORY; + } + else if (instanceOf(type, TYPE_RECORD_FOLDER)) + { + result = FilePlanComponentKind.RECORD_FOLDER; + } + else if (instanceOf(type, TYPE_HOLD)) + { + result = FilePlanComponentKind.HOLD; + } + else if (instanceOf(type, TYPE_TRANSFER)) + { + result = FilePlanComponentKind.TRANSFER; + } + else if (instanceOf(type, TYPE_DISPOSITION_SCHEDULE) || + instanceOf(type, TYPE_DISPOSITION_ACTION_DEFINITION)) + { + result = FilePlanComponentKind.DISPOSITION_SCHEDULE; + } + + return result; + } + + /** + * Indicates whether the given node is a file plan component or not. + *

+ * Exposed in the FilePlan service. + * + * @see FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef) + */ + public boolean isFilePlanComponent(NodeRef nodeRef) + { + boolean result = false; + if (getInternalNodeService().exists(nodeRef) && + getInternalNodeService().hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT)) + { + result = true; + } + return result; + } + + /** + * Indicates whether the given node is a file plan or not. + *

+ * Exposed in the FilePlan service. + * + * @see FilePlanService#isFilePlan(org.alfresco.service.cmr.repository.NodeRef) + */ + public boolean isFilePlan(NodeRef nodeRef) + { + return instanceOf(nodeRef, TYPE_FILE_PLAN); + } + + /** + * Indicates whether the given node is a file plan container or not. + * + * @see FilePlanService#isFilePlanContainer(org.alfresco.service.cmr.repository.NodeRef) + */ + public boolean isFilePlanContainer(NodeRef nodeRef) + { + return instanceOf(nodeRef, TYPE_RECORDS_MANAGEMENT_CONTAINER); + } + + /** + * Indicates whether the given node is a record category or not. + * + * @see FilePlanService#isRecordCategory(org.alfresco.service.cmr.repository.NodeRef) + */ + public boolean isRecordCategory(NodeRef nodeRef) + { + return instanceOf(nodeRef, TYPE_RECORD_CATEGORY); + } + + /** + * Indicates whether the given node is a record folder or not. + *

+ * Exposed in the RecordFolder service. + * + * @param nodeRef node reference + * @return boolean true if record folder, false otherwise + */ + public boolean isRecordFolder(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + return instanceOf(nodeRef, TYPE_RECORD_FOLDER); + } + + /** + * Indicates whether the given node reference is a record or not. + * + * @param nodeRef node reference + * @return boolean true if node reference is a record, false otherwise + */ + public boolean isRecord(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + return getInternalNodeService().hasAspect(nodeRef, ASPECT_RECORD); + } + + /** + * Indicates whether the given node reference is a hold or not. + *

+ * Exposed publicly in the {@link HoldService} + * + * @param nodeRef node reference + * @return boolean true if rma:hold or sub-type, false otherwise + */ + public boolean isHold(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + boolean isHold = false; + if (getInternalNodeService().exists(nodeRef) && + instanceOf(nodeRef, TYPE_HOLD)) + { + isHold = true; + } + return isHold; + } + + /** + * Indicates whether the given node reference is a transfer or not. + * + * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#isTransfer(NodeRef) + */ + public boolean isTransfer(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + return instanceOf(nodeRef, TYPE_TRANSFER); + } + + /** + * Indicates whether the given node reference is an unfiled records container or not. + * + * @param nodeRef node reference + * @return boolean true if rma:unfiledRecordContainer or sub-type, false otherwise + */ + public boolean isUnfiledRecordsContainer(NodeRef nodeRef) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + + return instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER); + } + + /** + * Indicates whether a record is complete or not. + * + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef) + */ + public boolean isDeclared(NodeRef record) + { + ParameterCheck.mandatory("record", record); + + return getInternalNodeService().hasAspect(record, ASPECT_DECLARED_RECORD); + } + + /** + * Gets the file plan that a given file plan component resides within. + * + * @param nodeRef node reference + * @return {@link NodeRef} file plan, null if none + */ + public NodeRef getFilePlan(final NodeRef nodeRef) + { + NodeRef result = null; + if (nodeRef != null) + { + Map transactionCache = transactionalResourceHelper.getMap("rm.servicebase.getFilePlan"); + if (transactionCache.containsKey(nodeRef)) + { + result = transactionCache.get(nodeRef); + } + else + { + result = (NodeRef)getInternalNodeService().getProperty(nodeRef, PROP_ROOT_NODEREF); + if (result == null || !instanceOf(result, TYPE_FILE_PLAN)) + { + if (instanceOf(nodeRef, TYPE_FILE_PLAN)) + { + result = nodeRef; + } + else + { + ChildAssociationRef parentAssocRef = getInternalNodeService().getPrimaryParent(nodeRef); + if (parentAssocRef != null) + { + result = getFilePlan(parentAssocRef.getParentRef()); + } + } + } + + // cache result in transaction if result is not null + if (result != null) + { + transactionCache.put(nodeRef, result); + } + } + } + + return result; + } + + /** + * Utility method to safely and quickly determine if a node is a type (or sub-type) of the one specified. + * + * @param nodeRef node reference + * @param ofClassName class name to check + */ + protected boolean instanceOf(NodeRef nodeRef, QName ofClassName) + { + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("ofClassName", ofClassName); + QName className = getInternalNodeService().getType(nodeRef); + return instanceOf(className, ofClassName); + } + + private static Map instanceOfCache = new WeakHashMap<>(); + + /** + * Utility method to quickly determine whether one class is equal to or sub of another. + * + * @param className class name + * @param ofClassName class name to check against + * @return boolean true if equal to or sub, false otherwise + */ + protected boolean instanceOf(QName className, QName ofClassName) + { + ParameterCheck.mandatory("className", className); + ParameterCheck.mandatory("ofClassName", ofClassName); + + boolean result = false; + + String key = className.toString() + "|" + ofClassName.toString(); + if (instanceOfCache.containsKey(key)) + { + result = instanceOfCache.get(key); + } + else + { + if (ofClassName.equals(className) || + dictionaryService.isSubClass(className, ofClassName)) + { + result = true; + } + + instanceOfCache.put(key, result); + } + + return result; + } + + /** + * Utility method to get the next counter for a node. + *

+ * If the node is not already countable, then rma:countable is added and 0 returned. + * + * @param nodeRef node reference + * @return int next counter value + */ + protected int getNextCount(NodeRef nodeRef) + { + int counter = 0; + if (!nodeService.hasAspect(nodeRef, ASPECT_COUNTABLE)) + { + PropertyMap props = new PropertyMap(1); + props.put(PROP_COUNT, 1); + nodeService.addAspect(nodeRef, ASPECT_COUNTABLE, props); + counter = 1; + } + else + { + Integer value = (Integer)this.nodeService.getProperty(nodeRef, PROP_COUNT); + if (value != null) + { + counter = value.intValue() + 1; + } + else + { + counter = 1; + } + nodeService.setProperty(nodeRef, PROP_COUNT, counter); + + } + return counter; + } + + /** + * Helper method to get a set containing the node's type and all it's aspects + * + * @param nodeRef nodeRef + * @return Set set of qname's + */ + protected Set getTypeAndApsects(NodeRef nodeRef) + { + Set result = nodeService.getAspects(nodeRef); + result.add(nodeService.getType(nodeRef)); + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java index b9465e221c..c067b418f9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java @@ -1,115 +1,115 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -/** - * Delegate spring bean for TransactionResourceHelper - * - * @author Roy Wetherall - * @since 2.3 - * @see org.alfresco.repo.transaction.TransactionalResourceHelper - */ -public class TransactionalResourceHelper -{ - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) - */ - public int getCount(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getCount(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) - */ - public void resetCount(Object resourceKey) - { - org.alfresco.repo.transaction.TransactionalResourceHelper.resetCount(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#incrementCount(Object) - */ - public int incrementCount(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.incrementCount(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#decrementCount(Object, boolean) - */ - public int decrementCount(Object resourceKey, boolean allowNegative) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.decrementCount(resourceKey, allowNegative); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) - */ - public boolean isResourcePresent(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.isResourcePresent(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getMap(Object) - */ - public Map getMap(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getMap(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getSet(Object) - */ - public Set getSet(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getSet(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getTreeSet(Object) - */ - public TreeSet getTreeSet(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getTreeSet(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getList(Object) - */ - public List getList(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getList(resourceKey); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +/** + * Delegate spring bean for TransactionResourceHelper + * + * @author Roy Wetherall + * @since 2.3 + * @see org.alfresco.repo.transaction.TransactionalResourceHelper + */ +public class TransactionalResourceHelper +{ + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) + */ + public int getCount(Object resourceKey) + { + return org.alfresco.repo.transaction.TransactionalResourceHelper.getCount(resourceKey); + } + + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) + */ + public void resetCount(Object resourceKey) + { + org.alfresco.repo.transaction.TransactionalResourceHelper.resetCount(resourceKey); + } + + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#incrementCount(Object) + */ + public int incrementCount(Object resourceKey) + { + return org.alfresco.repo.transaction.TransactionalResourceHelper.incrementCount(resourceKey); + } + + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#decrementCount(Object, boolean) + */ + public int decrementCount(Object resourceKey, boolean allowNegative) + { + return org.alfresco.repo.transaction.TransactionalResourceHelper.decrementCount(resourceKey, allowNegative); + } + + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) + */ + public boolean isResourcePresent(Object resourceKey) + { + return org.alfresco.repo.transaction.TransactionalResourceHelper.isResourcePresent(resourceKey); + } + + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getMap(Object) + */ + public Map getMap(Object resourceKey) + { + return org.alfresco.repo.transaction.TransactionalResourceHelper.getMap(resourceKey); + } + + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getSet(Object) + */ + public Set getSet(Object resourceKey) + { + return org.alfresco.repo.transaction.TransactionalResourceHelper.getSet(resourceKey); + } + + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getTreeSet(Object) + */ + public TreeSet getTreeSet(Object resourceKey) + { + return org.alfresco.repo.transaction.TransactionalResourceHelper.getTreeSet(resourceKey); + } + + /** + * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getList(Object) + */ + public List getList(Object resourceKey) + { + return org.alfresco.repo.transaction.TransactionalResourceHelper.getList(resourceKey); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java index ffaba58fc2..ec701a6b36 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java @@ -1,42 +1,42 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import org.alfresco.api.AlfrescoPublicApi; - -/** - * An enumeration for the methods of updating a collection of immutable objects. - * - * @author Tom Page - * @since 2.5 - */ -@AlfrescoPublicApi -public enum UpdateActionType -{ - ADD, - REMOVE; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * An enumeration for the methods of updating a collection of immutable objects. + * + * @author Tom Page + * @since 2.5 + */ +@AlfrescoPublicApi +public enum UpdateActionType +{ + ADD, + REMOVE; +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspect.java index 1607666f0b..fc3c2a880a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspect.java @@ -1,224 +1,224 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.lock.LockUtils; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.annotation.Behaviour; -import org.alfresco.repo.policy.annotation.BehaviourBean; -import org.alfresco.repo.policy.annotation.BehaviourKind; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.lock.LockService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Extend versionable aspect auto-version behaviour to allow versions to be - * created when the content type is changed. - * - * Note: this behaviour should be merged into core asap - * - * @author Roy Wetherall - * @since 2.3.1 - */ -@BehaviourBean -public class ExtendedVersionableAspect implements NodeServicePolicies.OnSetNodeTypePolicy -{ - /** The i18n'ized messages */ - private static final String MSG_AUTO_VERSION = "create_version.auto_version"; - - /** Transaction resource key */ - private static final String KEY_VERSIONED_NODEREFS = "versioned_noderefs"; - - /** node service */ - private NodeService nodeService; - - /** version service */ - private VersionService versionService; - - /** lock service */ - private LockService lockService; - - /** alfresco transaction support */ - private AlfrescoTransactionSupport alfrescoTransactionSupport; - - /** authentication util */ - private AuthenticationUtil authenticationUtil; - - /** indicates whether auto version should be triggered on type change */ - private boolean isAutoVersionOnTypeChange = false; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param versionService version service - */ - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - /** - * @param lockService lock service - */ - public void setLockService(LockService lockService) - { - this.lockService = lockService; - } - - /** - * @param alfrescoTransactionSupport alfresco transaction support - */ - public void setAlfrescoTransactionSupport(AlfrescoTransactionSupport alfrescoTransactionSupport) - { - this.alfrescoTransactionSupport = alfrescoTransactionSupport; - } - - /** - * @param authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @param isAutoVersionOnTypeChange true if auto version on type change, false otherwise - */ - public void setAutoVersionOnTypeChange(boolean isAutoVersionOnTypeChange) - { - this.isAutoVersionOnTypeChange = isAutoVersionOnTypeChange; - } - - /** - * On set node type behaviour - * - * @param nodeRef node reference - * @param oldType old type - * @param newType new type - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - @Behaviour - ( - type="cm:versionable", - kind=BehaviourKind.CLASS, - notificationFrequency=NotificationFrequency.TRANSACTION_COMMIT - ) - public void onSetNodeType(NodeRef nodeRef, QName oldType, QName newType) - { - if (isAutoVersionOnTypeChange && - nodeService.exists(nodeRef) && - !LockUtils.isLockedAndReadOnly(nodeRef, lockService) && - nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) && - !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - { - Map versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS); - if (versionedNodeRefs == null || !versionedNodeRefs.containsKey(nodeRef)) - { - // Determine whether the node is auto versionable (for content updates) or not - boolean autoVersion = false; - Boolean value = (Boolean)nodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION); - if (value != null) - { - // If the value is not null then - autoVersion = value.booleanValue(); - } - - // NOTE: auto version on type change is a global setting, if thins extension was moved into the - // core then cm:versionable could be extended with a property consistent with the current - // implementation - - if (autoVersion) - { - // Create the auto-version - Map versionProperties = new HashMap(1); - versionProperties.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_AUTO_VERSION)); - - createVersionImpl(nodeRef, versionProperties); - } - } - } - } - - /** - * On create version implementation method. - * - * @param nodeRef node reference - * @param versionProperties version properties - */ - private void createVersionImpl(final NodeRef nodeRef, final Map versionProperties) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - recordCreateVersion(nodeRef, null); - versionService.createVersion(nodeRef, versionProperties); - return null; - } - }); - } - - /** - * Record that the new version has been created - * - * @param versionableNode versionable node reference - * @param version version - */ - @SuppressWarnings("unchecked") - private void recordCreateVersion(NodeRef versionableNode, Version version) - { - Map versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS); - if (versionedNodeRefs == null) - { - versionedNodeRefs = new HashMap(); - alfrescoTransactionSupport.bindResource(KEY_VERSIONED_NODEREFS, versionedNodeRefs); - } - versionedNodeRefs.put(versionableNode, versionableNode); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.repo.lock.LockUtils; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.lock.LockService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Extend versionable aspect auto-version behaviour to allow versions to be + * created when the content type is changed. + * + * Note: this behaviour should be merged into core asap + * + * @author Roy Wetherall + * @since 2.3.1 + */ +@BehaviourBean +public class ExtendedVersionableAspect implements NodeServicePolicies.OnSetNodeTypePolicy +{ + /** The i18n'ized messages */ + private static final String MSG_AUTO_VERSION = "create_version.auto_version"; + + /** Transaction resource key */ + private static final String KEY_VERSIONED_NODEREFS = "versioned_noderefs"; + + /** node service */ + private NodeService nodeService; + + /** version service */ + private VersionService versionService; + + /** lock service */ + private LockService lockService; + + /** alfresco transaction support */ + private AlfrescoTransactionSupport alfrescoTransactionSupport; + + /** authentication util */ + private AuthenticationUtil authenticationUtil; + + /** indicates whether auto version should be triggered on type change */ + private boolean isAutoVersionOnTypeChange = false; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param versionService version service + */ + public void setVersionService(VersionService versionService) + { + this.versionService = versionService; + } + + /** + * @param lockService lock service + */ + public void setLockService(LockService lockService) + { + this.lockService = lockService; + } + + /** + * @param alfrescoTransactionSupport alfresco transaction support + */ + public void setAlfrescoTransactionSupport(AlfrescoTransactionSupport alfrescoTransactionSupport) + { + this.alfrescoTransactionSupport = alfrescoTransactionSupport; + } + + /** + * @param authenticationUtil authentication util + */ + public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) + { + this.authenticationUtil = authenticationUtil; + } + + /** + * @param isAutoVersionOnTypeChange true if auto version on type change, false otherwise + */ + public void setAutoVersionOnTypeChange(boolean isAutoVersionOnTypeChange) + { + this.isAutoVersionOnTypeChange = isAutoVersionOnTypeChange; + } + + /** + * On set node type behaviour + * + * @param nodeRef node reference + * @param oldType old type + * @param newType new type + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + @Behaviour + ( + type="cm:versionable", + kind=BehaviourKind.CLASS, + notificationFrequency=NotificationFrequency.TRANSACTION_COMMIT + ) + public void onSetNodeType(NodeRef nodeRef, QName oldType, QName newType) + { + if (isAutoVersionOnTypeChange && + nodeService.exists(nodeRef) && + !LockUtils.isLockedAndReadOnly(nodeRef, lockService) && + nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) && + !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) + { + Map versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS); + if (versionedNodeRefs == null || !versionedNodeRefs.containsKey(nodeRef)) + { + // Determine whether the node is auto versionable (for content updates) or not + boolean autoVersion = false; + Boolean value = (Boolean)nodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION); + if (value != null) + { + // If the value is not null then + autoVersion = value.booleanValue(); + } + + // NOTE: auto version on type change is a global setting, if thins extension was moved into the + // core then cm:versionable could be extended with a property consistent with the current + // implementation + + if (autoVersion) + { + // Create the auto-version + Map versionProperties = new HashMap(1); + versionProperties.put(Version.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_AUTO_VERSION)); + + createVersionImpl(nodeRef, versionProperties); + } + } + } + } + + /** + * On create version implementation method. + * + * @param nodeRef node reference + * @param versionProperties version properties + */ + private void createVersionImpl(final NodeRef nodeRef, final Map versionProperties) + { + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + recordCreateVersion(nodeRef, null); + versionService.createVersion(nodeRef, versionProperties); + return null; + } + }); + } + + /** + * Record that the new version has been created + * + * @param versionableNode versionable node reference + * @param version version + */ + @SuppressWarnings("unchecked") + private void recordCreateVersion(NodeRef versionableNode, Version version) + { + Map versionedNodeRefs = (Map)alfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS); + if (versionedNodeRefs == null) + { + versionedNodeRefs = new HashMap(); + alfrescoTransactionSupport.bindResource(KEY_VERSIONED_NODEREFS, versionedNodeRefs); + } + versionedNodeRefs.put(versionableNode, versionableNode); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java index 8103bbf37f..d3fc7a1dea 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java @@ -1,60 +1,60 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -import org.alfresco.service.namespace.QName; - -/** - * Helper class containing recordable version model qualified names - * - * @author Roy Wetherall - * @since 2.3 - */ -public interface RecordableVersionModel -{ - /** Namespace details */ - String RMV_URI = "http://www.alfresco.org/model/recordableversion/1.0"; - String RMV_PREFIX = "rmv"; - - /** versionable aspect */ - QName ASPECT_VERSIONABLE = QName.createQName(RMV_URI, "versionable"); - QName PROP_RECORDABLE_VERSION_POLICY = QName.createQName(RMV_URI, "recordableVersionPolicy"); - QName PROP_FILE_PLAN = QName.createQName(RMV_URI, "filePlan"); - - /** recorded version aspect */ - QName ASPECT_RECORDED_VERSION = QName.createQName(RMV_URI, "recordedVersion"); - QName PROP_RECORD_NODE_REF = QName.createQName(RMV_URI, "recordNodeRef"); - QName PROP_FROZEN_OWNER = QName.createQName(RMV_URI, "frozenOwner"); - QName PROP_DESTROYED = QName.createQName(RMV_URI, "destroyed"); - - /** version record aspect */ - QName ASPECT_VERSION_RECORD = QName.createQName(RMV_URI, "versionRecord"); - QName PROP_VERSIONED_NODEREF = QName.createQName(RMV_URI, "versionedNodeRef"); - QName PROP_VERSION_LABEL = QName.createQName(RMV_URI, "versionLabel"); - QName PROP_VERSION_DESCRIPTION = QName.createQName(RMV_URI, "versionDescription"); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +import org.alfresco.service.namespace.QName; + +/** + * Helper class containing recordable version model qualified names + * + * @author Roy Wetherall + * @since 2.3 + */ +public interface RecordableVersionModel +{ + /** Namespace details */ + String RMV_URI = "http://www.alfresco.org/model/recordableversion/1.0"; + String RMV_PREFIX = "rmv"; + + /** versionable aspect */ + QName ASPECT_VERSIONABLE = QName.createQName(RMV_URI, "versionable"); + QName PROP_RECORDABLE_VERSION_POLICY = QName.createQName(RMV_URI, "recordableVersionPolicy"); + QName PROP_FILE_PLAN = QName.createQName(RMV_URI, "filePlan"); + + /** recorded version aspect */ + QName ASPECT_RECORDED_VERSION = QName.createQName(RMV_URI, "recordedVersion"); + QName PROP_RECORD_NODE_REF = QName.createQName(RMV_URI, "recordNodeRef"); + QName PROP_FROZEN_OWNER = QName.createQName(RMV_URI, "frozenOwner"); + QName PROP_DESTROYED = QName.createQName(RMV_URI, "destroyed"); + + /** version record aspect */ + QName ASPECT_VERSION_RECORD = QName.createQName(RMV_URI, "versionRecord"); + QName PROP_VERSIONED_NODEREF = QName.createQName(RMV_URI, "versionedNodeRef"); + QName PROP_VERSION_LABEL = QName.createQName(RMV_URI, "versionLabel"); + QName PROP_VERSION_DESCRIPTION = QName.createQName(RMV_URI, "versionDescription"); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java index f55d3fd09e..be1737e467 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java @@ -1,257 +1,257 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -import static org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl.RECORD_MODEL_URIS; - -import java.io.Serializable; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -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.record.RecordService; -import org.alfresco.repo.version.Node2ServiceImpl; -import org.alfresco.repo.version.Version2Model; -import org.alfresco.repo.version.common.VersionUtil; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Extended version node service implementation that supports the retrieval of - * recorded version state. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl - implements RecordableVersionModel -{ - /** record service */ - private RecordService recordService; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @see org.alfresco.repo.version.Node2ServiceImpl#getProperties(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - public Map getProperties(NodeRef nodeRef) throws InvalidNodeRefException - { - // TODO only supported for Version2 - - NodeRef converted = VersionUtil.convertNodeRef(nodeRef); - if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION)) - { - NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF); - if (record != null && dbNodeService.exists(record)) - { - Map properties = dbNodeService.getProperties(record); - return processProperties(converted, properties); - } - else - { - return (Map)Collections.EMPTY_MAP; - } - } - else - { - return super.getProperties(nodeRef); - } - } - - /** - * Process properties map before returning as frozen state. - * - * @param properties properties map - * @return {@link Map}<{@link QName}, {@link Serializable}> processed property map - */ - protected Map processProperties(NodeRef version, Map properties) - { - Map cloneProperties = new HashMap(properties); - - // revert modified record name - properties.put(ContentModel.PROP_NAME, properties.get(RecordsManagementModel.PROP_ORIGIONAL_NAME)); - - // remove all rma, rmc, rmr and rmv properties - for (QName property : cloneProperties.keySet()) - { - if (!PROP_RECORDABLE_VERSION_POLICY.equals(property) && - !PROP_FILE_PLAN.equals(property) && - (recordService.isRecordMetadataProperty(property) || - RECORD_MODEL_URIS.contains(property.getNamespaceURI()))) - { - properties.remove(property); - } - } - - // do standard property processing - processVersionProperties(version, properties); - - return properties; - } - - /** - * Process version properties. - * - * @param version version node reference - * @param properties properties map - */ - protected void processVersionProperties(NodeRef version, Map properties) throws InvalidNodeRefException - { - // get version properties - Map versionProperties = dbNodeService.getProperties(version); - - if (versionProperties != null) - { - String versionLabel = (String)versionProperties.get(Version2Model.PROP_QNAME_VERSION_LABEL); - properties.put(ContentModel.PROP_VERSION_LABEL, versionLabel); - - // Convert frozen sys:referenceable properties - NodeRef nodeRef = (NodeRef)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF); - if (nodeRef != null) - { - properties.put(ContentModel.PROP_STORE_PROTOCOL, nodeRef.getStoreRef().getProtocol()); - properties.put(ContentModel.PROP_STORE_IDENTIFIER, nodeRef.getStoreRef().getIdentifier()); - properties.put(ContentModel.PROP_NODE_UUID, nodeRef.getId()); - } - - Long dbid = (Long)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_DBID); - properties.put(ContentModel.PROP_NODE_DBID, dbid); - - // Convert frozen cm:auditable properties - String creator = (String)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATOR); - if (creator != null) - { - properties.put(ContentModel.PROP_CREATOR, creator); - } - - Date created = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATED); - if (created != null) - { - properties.put(ContentModel.PROP_CREATED, created); - } - - // TODO - check use-cases for get version, revert, restore .... - String modifier = (String)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIER); - if (modifier != null) - { - properties.put(ContentModel.PROP_MODIFIER, modifier); - } - - Date modified = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIED); - if (modified != null) - { - properties.put(ContentModel.PROP_MODIFIED, modified); - } - - Date accessed = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_ACCESSED); - if (accessed != null) - { - properties.put(ContentModel.PROP_ACCESSED, accessed); - } - - String owner = (String)versionProperties.get(PROP_FROZEN_OWNER); - if (owner != null) - { - properties.put(ContentModel.PROP_OWNER, owner); - } - } - } - - /** - * @see org.alfresco.repo.version.Node2ServiceImpl#getAspects(org.alfresco.service.cmr.repository.NodeRef) - */ - @SuppressWarnings("unchecked") - @Override - public Set getAspects(NodeRef nodeRef) throws InvalidNodeRefException - { - // TODO only supported for Version2 - - NodeRef converted = VersionUtil.convertNodeRef(nodeRef); - if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION)) - { - NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF); - if (record != null && dbNodeService.exists(record)) - { - Set aspects = dbNodeService.getAspects(record); - return processAspects(aspects); - } - else - { - return (Set)Collections.EMPTY_SET; - } - } - else - { - return super.getAspects(nodeRef); - } - } - - /** - * Process frozen aspects. - * - * @param aspects aspect set - * @return {@link Set}<{@link QName}> processed aspect set - */ - protected Set processAspects(Set aspects) - { - Set result = new HashSet(aspects); - - // remove version aspects - result.remove(ASPECT_VERSION); - result.remove(ASPECT_RECORDED_VERSION); - - // remove rm aspects - for (QName aspect : aspects) - { - if (!ASPECT_VERSIONABLE.equals(aspect) && - (recordService.isRecordMetadataAspect(aspect) || - RECORD_MODEL_URIS.contains(aspect.getNamespaceURI()))) - { - result.remove(aspect); - } - } - - // remove custom record meta-data aspects - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +import static org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl.RECORD_MODEL_URIS; + +import java.io.Serializable; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +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.record.RecordService; +import org.alfresco.repo.version.Node2ServiceImpl; +import org.alfresco.repo.version.Version2Model; +import org.alfresco.repo.version.common.VersionUtil; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Extended version node service implementation that supports the retrieval of + * recorded version state. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl + implements RecordableVersionModel +{ + /** record service */ + private RecordService recordService; + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @see org.alfresco.repo.version.Node2ServiceImpl#getProperties(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + @Override + public Map getProperties(NodeRef nodeRef) throws InvalidNodeRefException + { + // TODO only supported for Version2 + + NodeRef converted = VersionUtil.convertNodeRef(nodeRef); + if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION)) + { + NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF); + if (record != null && dbNodeService.exists(record)) + { + Map properties = dbNodeService.getProperties(record); + return processProperties(converted, properties); + } + else + { + return (Map)Collections.EMPTY_MAP; + } + } + else + { + return super.getProperties(nodeRef); + } + } + + /** + * Process properties map before returning as frozen state. + * + * @param properties properties map + * @return {@link Map}<{@link QName}, {@link Serializable}> processed property map + */ + protected Map processProperties(NodeRef version, Map properties) + { + Map cloneProperties = new HashMap(properties); + + // revert modified record name + properties.put(ContentModel.PROP_NAME, properties.get(RecordsManagementModel.PROP_ORIGIONAL_NAME)); + + // remove all rma, rmc, rmr and rmv properties + for (QName property : cloneProperties.keySet()) + { + if (!PROP_RECORDABLE_VERSION_POLICY.equals(property) && + !PROP_FILE_PLAN.equals(property) && + (recordService.isRecordMetadataProperty(property) || + RECORD_MODEL_URIS.contains(property.getNamespaceURI()))) + { + properties.remove(property); + } + } + + // do standard property processing + processVersionProperties(version, properties); + + return properties; + } + + /** + * Process version properties. + * + * @param version version node reference + * @param properties properties map + */ + protected void processVersionProperties(NodeRef version, Map properties) throws InvalidNodeRefException + { + // get version properties + Map versionProperties = dbNodeService.getProperties(version); + + if (versionProperties != null) + { + String versionLabel = (String)versionProperties.get(Version2Model.PROP_QNAME_VERSION_LABEL); + properties.put(ContentModel.PROP_VERSION_LABEL, versionLabel); + + // Convert frozen sys:referenceable properties + NodeRef nodeRef = (NodeRef)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF); + if (nodeRef != null) + { + properties.put(ContentModel.PROP_STORE_PROTOCOL, nodeRef.getStoreRef().getProtocol()); + properties.put(ContentModel.PROP_STORE_IDENTIFIER, nodeRef.getStoreRef().getIdentifier()); + properties.put(ContentModel.PROP_NODE_UUID, nodeRef.getId()); + } + + Long dbid = (Long)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_DBID); + properties.put(ContentModel.PROP_NODE_DBID, dbid); + + // Convert frozen cm:auditable properties + String creator = (String)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATOR); + if (creator != null) + { + properties.put(ContentModel.PROP_CREATOR, creator); + } + + Date created = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATED); + if (created != null) + { + properties.put(ContentModel.PROP_CREATED, created); + } + + // TODO - check use-cases for get version, revert, restore .... + String modifier = (String)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIER); + if (modifier != null) + { + properties.put(ContentModel.PROP_MODIFIER, modifier); + } + + Date modified = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIED); + if (modified != null) + { + properties.put(ContentModel.PROP_MODIFIED, modified); + } + + Date accessed = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_ACCESSED); + if (accessed != null) + { + properties.put(ContentModel.PROP_ACCESSED, accessed); + } + + String owner = (String)versionProperties.get(PROP_FROZEN_OWNER); + if (owner != null) + { + properties.put(ContentModel.PROP_OWNER, owner); + } + } + } + + /** + * @see org.alfresco.repo.version.Node2ServiceImpl#getAspects(org.alfresco.service.cmr.repository.NodeRef) + */ + @SuppressWarnings("unchecked") + @Override + public Set getAspects(NodeRef nodeRef) throws InvalidNodeRefException + { + // TODO only supported for Version2 + + NodeRef converted = VersionUtil.convertNodeRef(nodeRef); + if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION)) + { + NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF); + if (record != null && dbNodeService.exists(record)) + { + Set aspects = dbNodeService.getAspects(record); + return processAspects(aspects); + } + else + { + return (Set)Collections.EMPTY_SET; + } + } + else + { + return super.getAspects(nodeRef); + } + } + + /** + * Process frozen aspects. + * + * @param aspects aspect set + * @return {@link Set}<{@link QName}> processed aspect set + */ + protected Set processAspects(Set aspects) + { + Set result = new HashSet(aspects); + + // remove version aspects + result.remove(ASPECT_VERSION); + result.remove(ASPECT_RECORDED_VERSION); + + // remove rm aspects + for (QName aspect : aspects) + { + if (!ASPECT_VERSIONABLE.equals(aspect) && + (recordService.isRecordMetadataAspect(aspect) || + RECORD_MODEL_URIS.contains(aspect.getNamespaceURI()))) + { + result.remove(aspect); + } + } + + // remove custom record meta-data aspects + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java index 887c50f893..df57dbad68 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java @@ -1,39 +1,39 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -/** - * @author Roy Wetherall - * @since 2.3 - */ -public enum RecordableVersionPolicy -{ - NONE, - MAJOR_ONLY, - ALL -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +/** + * @author Roy Wetherall + * @since 2.3 + */ +public enum RecordableVersionPolicy +{ + NONE, + MAJOR_ONLY, + ALL +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java index 6230411094..4a2e9ce666 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java @@ -1,107 +1,107 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; - -/** - * Recordable version service interface. - * - * @author Roy Wetherall - * @since 2.3 - */ -@AlfrescoPublicApi -public interface RecordableVersionService -{ - /** - * Indicates whether the current version of a node is recorded or not. - *

- * Returns false if not versionable or no version. - * - * @param nodeRef node reference - * @return boolean true if latest version recorded, false otherwise - */ - boolean isCurrentVersionRecorded(NodeRef nodeRef); - - /** - * Indicates whether a version is recorded or not. - * - * @param version version - * @return boolean true if recorded version, false otherwise - */ - boolean isRecordedVersion(Version version); - - /** - * If the version is a recorded version, gets the related version - * record. - * - * @param version version - * @return NodeRef node reference of version record - */ - NodeRef getVersionRecord(Version version); - - /** - * Gets the version that relates to the version record - * - * @param versionRecord version record node reference - * @return Version version or null if not found - */ - Version getRecordedVersion(NodeRef record); - - /** - * Creates a record from the latest version, marking it as recorded. - *

- * Does not create a record if the node is not versionable or the latest - * version is already recorded. - * - * @param nodeRef node reference - * @return NodeRef node reference to the created record. - */ - NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef); - - /** - * Indicates whether a record version is destroyed or not. - * - * @param version version - * @return boolean true if destroyed, false otherwise - */ - boolean isRecordedVersionDestroyed(Version version); - - /** - * Marks a recorded version as destroyed. - *

- * Note this method does not destroy the associated record, instead it marks the - * version as destroyed. - * - * @param version version - */ - void destroyRecordedVersion(Version version); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; + +/** + * Recordable version service interface. + * + * @author Roy Wetherall + * @since 2.3 + */ +@AlfrescoPublicApi +public interface RecordableVersionService +{ + /** + * Indicates whether the current version of a node is recorded or not. + *

+ * Returns false if not versionable or no version. + * + * @param nodeRef node reference + * @return boolean true if latest version recorded, false otherwise + */ + boolean isCurrentVersionRecorded(NodeRef nodeRef); + + /** + * Indicates whether a version is recorded or not. + * + * @param version version + * @return boolean true if recorded version, false otherwise + */ + boolean isRecordedVersion(Version version); + + /** + * If the version is a recorded version, gets the related version + * record. + * + * @param version version + * @return NodeRef node reference of version record + */ + NodeRef getVersionRecord(Version version); + + /** + * Gets the version that relates to the version record + * + * @param versionRecord version record node reference + * @return Version version or null if not found + */ + Version getRecordedVersion(NodeRef record); + + /** + * Creates a record from the latest version, marking it as recorded. + *

+ * Does not create a record if the node is not versionable or the latest + * version is already recorded. + * + * @param nodeRef node reference + * @return NodeRef node reference to the created record. + */ + NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef); + + /** + * Indicates whether a record version is destroyed or not. + * + * @param version version + * @return boolean true if destroyed, false otherwise + */ + boolean isRecordedVersionDestroyed(Version version); + + /** + * Marks a recorded version as destroyed. + *

+ * Note this method does not destroy the associated record, instead it marks the + * version as destroyed. + * + * @param version version + */ + void destroyRecordedVersion(Version version); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java index 1ac0b0534a..005b6415c5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java @@ -1,891 +1,891 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel.CUSTOM_REF_VERSIONS; -import static org.codehaus.plexus.util.StringUtils.isNotBlank; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.CmObjectType; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.policy.PolicyScope; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; -import org.alfresco.repo.version.Version2Model; -import org.alfresco.repo.version.Version2ServiceImpl; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.version.ReservedVersionNameException; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.cmr.version.VersionType; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.Pair; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Recordable version service implementation - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordableVersionServiceImpl extends Version2ServiceImpl - implements RecordableVersionModel, - RecordableVersionService -{ - /** share logger with version2ServiceImpl */ - private static Log logger = LogFactory.getLog(Version2ServiceImpl.class); - - /** key used to indicate a recordable version */ - public static final String KEY_RECORDABLE_VERSION = "recordable-version"; - public static final String KEY_FILE_PLAN = "file-plan"; - - /** version record property */ - protected static final String PROP_VERSION_RECORD = "RecordVersion"; - protected static final String PROP_RECORDED_VERSION_DESTROYED = "RecordedVersionDestroyed"; - - /** version aspect property names */ - private static final String[] VERSION_PROPERTY_NAMES = new String[] - { - Version2Model.PROP_CREATED_DATE, - Version2Model.PROP_VERSION_LABEL, - Version2Model.PROP_VERSION_DESCRIPTION, - - Version2Model.PROP_FROZEN_NODE_DBID, - Version2Model.PROP_FROZEN_NODE_REF, - - Version2Model.PROP_FROZEN_CREATED, - Version2Model.PROP_FROZEN_CREATOR, - Version2Model.PROP_FROZEN_MODIFIED, - Version2Model.PROP_FROZEN_MODIFIER, - Version2Model.PROP_FROZEN_ACCESSED - }; - - /** file plan service */ - private FilePlanService filePlanService; - - /** authentication util helper */ - private AuthenticationUtil authenticationUtil; - - /** relationship service */ - private RelationshipService relationshipService; - - /** record service */ - private RecordService recordService; - - /** model security service */ - private ModelSecurityService modelSecurityService; - - /** cm object type */ - private CmObjectType cmObjectType; - - /** extended permission service */ - private ExtendedPermissionService extendedPermissionService; - - /** extended security service */ - private ExtendedSecurityService extendedSecurityService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param authenticationUtil authentication util helper - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @param relationshipService relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param modelSecurityService model security service - */ - public void setModelSecurityService(ModelSecurityService modelSecurityService) - { - this.modelSecurityService = modelSecurityService; - } - - /** - * @param cmObjectType the cmObjectType to set - */ - public void setCmObjectType(CmObjectType cmObjectType) - { - this.cmObjectType = cmObjectType; - } - - /** - * @param extendedPermissionService extended permission service - */ - public void setExtendedPermissionService(ExtendedPermissionService extendedPermissionService) - { - this.extendedPermissionService = extendedPermissionService; - } - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - /** - * @see org.alfresco.repo.version.Version2ServiceImpl#createVersion(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, int) - */ - @Override - protected Version createVersion(NodeRef nodeRef, Map origVersionProperties, int versionNumber) throws ReservedVersionNameException - { - // TODO we only support recorded versions for sub types of cm:content - - // create version properties if null - if (origVersionProperties == null) - { - origVersionProperties = new HashMap(2); - } - - // only need to check the recordable version policy when the recordable version indicator is missing from the version properties - if (!origVersionProperties.containsKey(KEY_RECORDABLE_VERSION)) - { - // get the version type - VersionType versionType = null; - if (origVersionProperties != null) - { - versionType = (VersionType)origVersionProperties.get(VersionModel.PROP_VERSION_TYPE); - } - - // determine whether this is a recorded version or not - if (isCreateRecordedVersion(nodeRef, versionType)) - { - origVersionProperties.put(KEY_RECORDABLE_VERSION, true); - if (!origVersionProperties.containsKey(KEY_FILE_PLAN)) - { - // make sure the file plan is set to the default if not specified - origVersionProperties.put(KEY_FILE_PLAN, getFilePlan(nodeRef)); - } - } - } - else - { - if (!origVersionProperties.containsKey(KEY_FILE_PLAN)) - { - // make sure the file plan is set to the default if not specified - origVersionProperties.put(KEY_FILE_PLAN, getFilePlan(nodeRef)); - } - } - - return super.createVersion(nodeRef, origVersionProperties, versionNumber); - } - - /** - * @param nodeRef node reference - * @return {@link NodeRef} associated file plan, default if none - */ - private NodeRef getFilePlan(NodeRef nodeRef) - { - NodeRef filePlan = (NodeRef)nodeService.getProperty(nodeRef, PROP_FILE_PLAN); - if (filePlan == null) - { - filePlan = getFilePlan(); - } - return filePlan; - } - - /** - * @return {@link NodeRef} default file plan, exception if none - */ - private NodeRef getFilePlan() - { - return authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() throws Exception - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("Can't create a recorded version, because there is no file plan."); - } - return filePlan; - } - }); - } - - /** - * Determine whether this is a recorded version or not. - * - * @param nodeRef - * @return - */ - private boolean isCreateRecordedVersion(NodeRef nodeRef, VersionType versionType) - { - boolean result = false; - if (nodeService.hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE)) - { - String policyString = (String)nodeService.getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); - if (policyString != null) - { - RecordableVersionPolicy policy = RecordableVersionPolicy.valueOf(policyString.toUpperCase()); - if (RecordableVersionPolicy.ALL.equals(policy) || - (RecordableVersionPolicy.MAJOR_ONLY.equals(policy) && - VersionType.MAJOR.equals(versionType))) - { - result = true; - } - } - } - - return result; - } - - /** - * @see org.alfresco.repo.version.Version2ServiceImpl#createNewVersion(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map, int, org.alfresco.repo.policy.PolicyScope) - */ - @Override - protected NodeRef createNewVersion( QName sourceTypeRef, - NodeRef versionHistoryRef, - Map standardVersionProperties, - Map versionProperties, - int versionNumber, - PolicyScope nodeDetails) - { - NodeRef version = null; - - if (versionProperties.containsKey(KEY_RECORDABLE_VERSION) && - ((Boolean)versionProperties.get(KEY_RECORDABLE_VERSION)).booleanValue()) - { - // create a recorded version - version = createNewRecordedVersion(sourceTypeRef, versionHistoryRef, standardVersionProperties, versionProperties, versionNumber, nodeDetails); - } - else - { - // create a normal version - version = super.createNewVersion(sourceTypeRef, versionHistoryRef, standardVersionProperties, versionProperties, versionNumber, nodeDetails); - } - - return version; - } - - /** - * Creates a new recorded version - * - * @param sourceTypeRef source type name - * @param versionHistoryRef version history reference - * @param standardVersionProperties standard version properties - * @param versionProperties version properties - * @param versionNumber version number - * @param nodeDetails policy scope - * @return {@link NodeRef} record version - */ - protected NodeRef createNewRecordedVersion(QName sourceTypeRef, - NodeRef versionHistoryRef, - Map standardVersionProperties, - Map versionProperties, - int versionNumber, - PolicyScope nodeDetails) - { - NodeRef versionNodeRef = null; - - // Disable auto-version behaviour - policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); - - // disable other behaviours that we don't want to trigger during this process - policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); - policyBehaviourFilter.disableBehaviour(ContentModel.TYPE_MULTILINGUAL_CONTAINER); - - // disable model security check - modelSecurityService.disable(); - - // disable property editable check - recordService.disablePropertyEditableCheck(); - - try - { - // get the destination file plan - final NodeRef filePlan = (NodeRef)versionProperties.get(KEY_FILE_PLAN); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("Can't create a new recorded version, because no file plan has been specified in the version properties."); - } - - // create a copy of the source node and place in the file plan - final NodeRef nodeRef = (NodeRef)standardVersionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF); - - cmObjectType.disableCopy(); - try - { - // create record - final NodeRef record = recordService.createRecordFromCopy(filePlan, nodeRef); - - // apply version record aspect to record - final PropertyMap versionRecordProps = new PropertyMap(3); - versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, - standardVersionProperties.get( - QName.createQName(Version2Model.NAMESPACE_URI, - Version2Model.PROP_VERSION_LABEL))); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, - standardVersionProperties.get( - QName.createQName(Version2Model.NAMESPACE_URI, - Version2Model.PROP_VERSION_DESCRIPTION))); - // run as system as we can't be sure if the user has add aspect rights - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps); - return null; - } - }); - - // wire record up to previous record - linkToPreviousVersionRecord(nodeRef, record); - - // create version nodeRef - ChildAssociationRef childAssocRef = dbNodeService.createNode( - versionHistoryRef, - Version2Model.CHILD_QNAME_VERSIONS, - QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS + "-" + versionNumber), - sourceTypeRef, - null); - versionNodeRef = childAssocRef.getChildRef(); - - // add aspect with the standard version properties to the 'version' node - nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, standardVersionProperties); - - // add the recordedVersion aspect with link to record - nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable)record)); - - // freeze auditable aspect information - freezeAuditableAspect(nodeRef, versionNodeRef); - } - finally - { - cmObjectType.enableCopy(); - } - } - finally - { - // enable model security check - modelSecurityService.enable(); - - // enable property editable check - recordService.enablePropertyEditableCheck(); - - // Enable behaviours - this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); - this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); - this.policyBehaviourFilter.enableBehaviour(ContentModel.TYPE_MULTILINGUAL_CONTAINER); - } - - // If the auditable aspect is not there then add it to the 'version' node (after original aspects have been frozen) - if (!dbNodeService.hasAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE)) - { - dbNodeService.addAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE, null); - } - - if (logger.isTraceEnabled()) - { - logger.trace("createNewRecordedVersion created (" + versionNumber + ") " + versionNodeRef); - } - - return versionNodeRef; - } - - /** - * Helper method to link the record to the previous version record - * - * @param nodeRef noderef source node reference - * @param record record record node reference - */ - private void linkToPreviousVersionRecord(final NodeRef nodeRef, final NodeRef record) - { - final NodeRef latestRecordVersion = getLatestVersionRecord(nodeRef); - if (latestRecordVersion != null) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - // indicate that the new record versions the previous record - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), record, latestRecordVersion); - return null; - } - }); - } - } - - /** - * Helper to get the latest version record for a given document (ie non-record) - * - * @param nodeRef node reference - * @return NodeRef latest version record, null otherwise - */ - private NodeRef getLatestVersionRecord(NodeRef nodeRef) - { - NodeRef versionRecord = null; - - // wire record up to previous record - VersionHistory versionHistory = getVersionHistory(nodeRef); - if (versionHistory != null) - { - Collection previousVersions = versionHistory.getAllVersions(); - for (Version previousVersion : previousVersions) - { - // look for the associated record - final NodeRef previousRecord = (NodeRef)previousVersion.getVersionProperties().get(PROP_VERSION_RECORD); - if (previousRecord != null && - nodeService.exists(previousRecord)) - { - versionRecord = previousRecord; - break; - } - } - } - - return versionRecord; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#getRecordedVersion(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Version getRecordedVersion(NodeRef versionRecord) - { - Version version = null; - NodeRef versionedNodeRef = (NodeRef) nodeService.getProperty(versionRecord, RecordableVersionModel.PROP_VERSIONED_NODEREF); - if (versionedNodeRef != null) - { - String versionLabel = (String) nodeService.getProperty(versionRecord, RecordableVersionModel.PROP_VERSION_LABEL); - if (StringUtils.isNotBlank(versionLabel)) - { - VersionHistory versionHistory = getVersionHistory(versionedNodeRef); - if (versionHistory != null) - { - version = versionHistory.getVersion(versionLabel); - } - } - } - return version; - } - - /** - * Freezes audit aspect properties. - * - * @param nodeRef - * @param versionNodeRef - */ - private void freezeAuditableAspect(NodeRef nodeRef, NodeRef versionNodeRef) - { - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUDITABLE)) - { - Map properties = dbNodeService.getProperties(nodeRef); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATOR, properties.get(ContentModel.PROP_CREATOR)); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATED, properties.get(ContentModel.PROP_CREATED)); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIER, properties.get(ContentModel.PROP_MODIFIER)); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIED, properties.get(ContentModel.PROP_MODIFIED)); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_ACCESSED, properties.get(ContentModel.PROP_ACCESSED)); - if (properties.get(ContentModel.PROP_OWNER) != null) - { - dbNodeService.setProperty(versionNodeRef, PROP_FROZEN_OWNER, properties.get(ContentModel.PROP_OWNER)); - } - } - } - - /** - * @see org.alfresco.repo.version.Version2ServiceImpl#getVersion(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected Version getVersion(NodeRef versionRef) - { - Version version = super.getVersion(versionRef); - - // place the version record reference in the version properties - NodeRef record = (NodeRef)dbNodeService.getProperty(versionRef, PROP_RECORD_NODE_REF); - if (record != null) - { - version.getVersionProperties().put(PROP_VERSION_RECORD, record); - } - - // place information about the destruction of the version record in the properties - Boolean destroyed = (Boolean)dbNodeService.getProperty(versionRef, PROP_DESTROYED); - if (destroyed == null) { destroyed = Boolean.FALSE; } - version.getVersionProperties().put(PROP_RECORDED_VERSION_DESTROYED, destroyed); - - return version; - } - - /** - * @see org.alfresco.repo.version.Version2ServiceImpl#revert(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.version.Version, boolean) - */ - @Override - public void revert(NodeRef nodeRef, Version version, boolean deep) - { - String versionPolicy = (String) dbNodeService.getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); - - super.revert(nodeRef, version, deep); - - if (isNotBlank(versionPolicy)) - { - dbNodeService.setProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY, versionPolicy); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isLatestVersionRecorded(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isCurrentVersionRecorded(NodeRef nodeRef) - { - boolean result = false; - Version version = getCurrentVersion(nodeRef); - if (version != null) - { - result = isRecordedVersion(version); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isRecordedVersion(org.alfresco.service.cmr.version.Version) - */ - @Override - public boolean isRecordedVersion(Version version) - { - NodeRef versionNodeRef = getVersionNodeRef(version); - return dbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#getVersionRecord(org.alfresco.service.cmr.version.Version) - */ - @Override - public NodeRef getVersionRecord(Version version) - { - NodeRef result = null; - NodeRef versionNodeRef = getVersionNodeRef(version); - if (dbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - { - // get the version record - result = (NodeRef)dbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF); - - // check that the version record exists - if (result != null && - !dbNodeService.exists(result)) - { - throw new AlfrescoRuntimeException("Version record node doesn't exist. Indicates version has not been updated " - + "when associated version record was deleted. " - + "(nodeRef=" + result.toString() + ")"); - } - } - return result; - } - - /** - * Create Version Store Ref - * - * @param store ref - * @return store ref for version store - */ - public StoreRef convertStoreRef(StoreRef storeRef) - { - return new StoreRef(StoreRef.PROTOCOL_WORKSPACE, storeRef.getIdentifier()); - } - - /** - * Convert the incomming node ref (with the version store protocol specified) - * to the internal representation with the workspace protocol. - * - * @param nodeRef the incomming verison protocol node reference - * @return the internal version node reference - */ - public NodeRef convertNodeRef(NodeRef nodeRef) - { - return new NodeRef(convertStoreRef(nodeRef.getStoreRef()), nodeRef.getId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#createRecordFromLatestVersion(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef createRecordFromLatestVersion(final NodeRef filePlan, final NodeRef nodeRef) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("nodeRef", nodeRef); - - NodeRef record = null; - - // check for versionable aspect - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - { - // get the latest version - final Version currentVersion = getCurrentVersion(nodeRef); - - if (currentVersion != null && - !isRecordedVersion(currentVersion)) - { - // create the record from the current frozen state - record = authenticationUtil.runAsSystem(new RunAsWork() - { - public NodeRef doWork() throws Exception - { - // get the documents readers and writers - Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef); - - // grab the frozen state - NodeRef currentFrozenState = currentVersion.getFrozenStateNodeRef(); - - // determine the type of the object - QName type = nodeService.getType(currentFrozenState); - - // grab all the properties - Map properties = nodeService.getProperties(currentFrozenState); - - // grab all the aspects - Set aspects = nodeService.getAspects(currentFrozenState); - - // create the record - NodeRef record = recordService.createRecordFromContent( - filePlan, - (String)properties.get(ContentModel.PROP_NAME), - type, - properties, - null); - - // apply aspects to record - for (QName aspect : aspects) - { - // add the aspect, properties have already been set - nodeService.addAspect(record, aspect, null); - } - - // apply version record aspect to record - PropertyMap versionRecordProps = new PropertyMap(3); - versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, currentVersion.getVersionLabel()); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, currentVersion.getDescription()); - versionRecordProps.put(ContentModel.PROP_VERSION_TYPE, currentVersion.getVersionType()); - nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps); - - // wire record up to previous record - linkToPreviousVersionRecord(nodeRef, record); - - // set the extended security - extendedSecurityService.set(record, readersAndWriters); - - return record; - } - }); - - // get the version history - NodeRef versionHistoryRef = getVersionHistoryNodeRef(nodeRef); - - // get details from the version before we remove it - int versionNumber = getVersionNumber(currentVersion); - Map versionProperties = getVersionAspectProperties(currentVersion); - QName sourceTypeRef = getVersionType(currentVersion); - - // patch-up owner information, which needs to be frozen for recorded versions - String owner = (String)nodeService.getProperty(currentVersion.getFrozenStateNodeRef(), ContentModel.PROP_OWNER); - if (owner != null) - { - versionProperties.put(PROP_FROZEN_OWNER, owner); - } - - // delete the current version - this.dbNodeService.deleteNode(convertNodeRef(currentVersion.getFrozenStateNodeRef())); - - // create a new version history if we need to - if (!nodeService.exists(versionHistoryRef)) - { - versionHistoryRef = createVersionHistory(nodeRef); - } - - // create recorded version nodeRef - ChildAssociationRef childAssocRef = dbNodeService.createNode( - versionHistoryRef, - Version2Model.CHILD_QNAME_VERSIONS, - QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS + "-" + versionNumber), - sourceTypeRef, - null); - NodeRef versionNodeRef = childAssocRef.getChildRef(); - - // add aspect with the standard version properties to the 'version' node - nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, versionProperties); - - // add the recordedVersion aspect with link to record - nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable)record)); - } - } - - return record; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isRecordedVersionDestroyed(org.alfresco.service.cmr.version.Version) - */ - @Override - public boolean isRecordedVersionDestroyed(Version version) - { - boolean result = false; - - // get the version node reference - NodeRef versionNodeRef = getVersionNodeRef(version); - - // get the destroyed property value - Boolean isDestroyed = (Boolean)dbNodeService.getProperty(versionNodeRef, PROP_DESTROYED); - if (isDestroyed != null) - { - result = isDestroyed.booleanValue(); - } - - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#destroyRecordedVersion(org.alfresco.service.cmr.version.Version) - */ - @Override - public void destroyRecordedVersion(Version version) - { - // get the version node reference - NodeRef versionNodeRef = getVersionNodeRef(version); - - // if it's a recorded version - if (dbNodeService.hasAspect(versionNodeRef, ASPECT_RECORDED_VERSION)) - { - // mark it as destroyed - dbNodeService.setProperty(versionNodeRef, PROP_DESTROYED, true); - - // clear the record node reference property - dbNodeService.setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); - } - } - - /** - * Helper method to get the version number of a given version by inspecting the - * name of the parent association. - * - * @param version version - * @return int version number - */ - private int getVersionNumber(Version version) - { - NodeRef versionNodeRef = getVersionNodeRef(version); - ChildAssociationRef assoc = dbNodeService.getPrimaryParent(versionNodeRef); - String fullVersionNumber = assoc.getQName().getLocalName(); - String versionNumber = fullVersionNumber.substring(fullVersionNumber.indexOf("-") + 1); - return Integer.parseInt(versionNumber); - } - - /** - * Helper method to get all the version aspect properties from an existing version - * - * @param version version - * @return Map property values - */ - private Map getVersionAspectProperties(Version version) - { - NodeRef versionNodeRef = getVersionNodeRef(version); - Map versionProps = dbNodeService.getProperties(versionNodeRef); - Map result = new HashMap(9); - for (String propertyName : VERSION_PROPERTY_NAMES) - { - QName propertyQName = QName.createQName(Version2Model.NAMESPACE_URI, propertyName); - result.put(propertyQName, versionProps.get(propertyQName)); - - if (propertyName.equals(Version2Model.PROP_FROZEN_NODE_DBID)) - { - System.out.println(versionProps.get(propertyQName)); - } - } - return result; - } - - /** - * Helper method to get the type of a versions frozen state - * - * @param currentVersion - * @return - */ - private QName getVersionType(Version version) - { - return nodeService.getType(getVersionNodeRef(version)); - } - - /** - * Helper method to get the internal node reference of a version - * - * @param version version - * @return NodeRef internal node reference to version - */ - private NodeRef getVersionNodeRef(Version version) - { - return convertNodeRef(version.getFrozenStateNodeRef()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel.CUSTOM_REF_VERSIONS; +import static org.codehaus.plexus.util.StringUtils.isNotBlank; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.CmObjectType; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.repo.policy.PolicyScope; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; +import org.alfresco.repo.version.Version2Model; +import org.alfresco.repo.version.Version2ServiceImpl; +import org.alfresco.repo.version.VersionModel; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.version.ReservedVersionNameException; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionHistory; +import org.alfresco.service.cmr.version.VersionType; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.Pair; +import org.alfresco.util.ParameterCheck; +import org.alfresco.util.PropertyMap; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Recordable version service implementation + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RecordableVersionServiceImpl extends Version2ServiceImpl + implements RecordableVersionModel, + RecordableVersionService +{ + /** share logger with version2ServiceImpl */ + private static Log logger = LogFactory.getLog(Version2ServiceImpl.class); + + /** key used to indicate a recordable version */ + public static final String KEY_RECORDABLE_VERSION = "recordable-version"; + public static final String KEY_FILE_PLAN = "file-plan"; + + /** version record property */ + protected static final String PROP_VERSION_RECORD = "RecordVersion"; + protected static final String PROP_RECORDED_VERSION_DESTROYED = "RecordedVersionDestroyed"; + + /** version aspect property names */ + private static final String[] VERSION_PROPERTY_NAMES = new String[] + { + Version2Model.PROP_CREATED_DATE, + Version2Model.PROP_VERSION_LABEL, + Version2Model.PROP_VERSION_DESCRIPTION, + + Version2Model.PROP_FROZEN_NODE_DBID, + Version2Model.PROP_FROZEN_NODE_REF, + + Version2Model.PROP_FROZEN_CREATED, + Version2Model.PROP_FROZEN_CREATOR, + Version2Model.PROP_FROZEN_MODIFIED, + Version2Model.PROP_FROZEN_MODIFIER, + Version2Model.PROP_FROZEN_ACCESSED + }; + + /** file plan service */ + private FilePlanService filePlanService; + + /** authentication util helper */ + private AuthenticationUtil authenticationUtil; + + /** relationship service */ + private RelationshipService relationshipService; + + /** record service */ + private RecordService recordService; + + /** model security service */ + private ModelSecurityService modelSecurityService; + + /** cm object type */ + private CmObjectType cmObjectType; + + /** extended permission service */ + private ExtendedPermissionService extendedPermissionService; + + /** extended security service */ + private ExtendedSecurityService extendedSecurityService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param authenticationUtil authentication util helper + */ + public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) + { + this.authenticationUtil = authenticationUtil; + } + + /** + * @param relationshipService relationship service + */ + public void setRelationshipService(RelationshipService relationshipService) + { + this.relationshipService = relationshipService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param modelSecurityService model security service + */ + public void setModelSecurityService(ModelSecurityService modelSecurityService) + { + this.modelSecurityService = modelSecurityService; + } + + /** + * @param cmObjectType the cmObjectType to set + */ + public void setCmObjectType(CmObjectType cmObjectType) + { + this.cmObjectType = cmObjectType; + } + + /** + * @param extendedPermissionService extended permission service + */ + public void setExtendedPermissionService(ExtendedPermissionService extendedPermissionService) + { + this.extendedPermissionService = extendedPermissionService; + } + + /** + * @param extendedSecurityService extended security service + */ + public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) + { + this.extendedSecurityService = extendedSecurityService; + } + + /** + * @see org.alfresco.repo.version.Version2ServiceImpl#createVersion(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, int) + */ + @Override + protected Version createVersion(NodeRef nodeRef, Map origVersionProperties, int versionNumber) throws ReservedVersionNameException + { + // TODO we only support recorded versions for sub types of cm:content + + // create version properties if null + if (origVersionProperties == null) + { + origVersionProperties = new HashMap(2); + } + + // only need to check the recordable version policy when the recordable version indicator is missing from the version properties + if (!origVersionProperties.containsKey(KEY_RECORDABLE_VERSION)) + { + // get the version type + VersionType versionType = null; + if (origVersionProperties != null) + { + versionType = (VersionType)origVersionProperties.get(VersionModel.PROP_VERSION_TYPE); + } + + // determine whether this is a recorded version or not + if (isCreateRecordedVersion(nodeRef, versionType)) + { + origVersionProperties.put(KEY_RECORDABLE_VERSION, true); + if (!origVersionProperties.containsKey(KEY_FILE_PLAN)) + { + // make sure the file plan is set to the default if not specified + origVersionProperties.put(KEY_FILE_PLAN, getFilePlan(nodeRef)); + } + } + } + else + { + if (!origVersionProperties.containsKey(KEY_FILE_PLAN)) + { + // make sure the file plan is set to the default if not specified + origVersionProperties.put(KEY_FILE_PLAN, getFilePlan(nodeRef)); + } + } + + return super.createVersion(nodeRef, origVersionProperties, versionNumber); + } + + /** + * @param nodeRef node reference + * @return {@link NodeRef} associated file plan, default if none + */ + private NodeRef getFilePlan(NodeRef nodeRef) + { + NodeRef filePlan = (NodeRef)nodeService.getProperty(nodeRef, PROP_FILE_PLAN); + if (filePlan == null) + { + filePlan = getFilePlan(); + } + return filePlan; + } + + /** + * @return {@link NodeRef} default file plan, exception if none + */ + private NodeRef getFilePlan() + { + return authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public NodeRef doWork() throws Exception + { + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (filePlan == null) + { + throw new AlfrescoRuntimeException("Can't create a recorded version, because there is no file plan."); + } + return filePlan; + } + }); + } + + /** + * Determine whether this is a recorded version or not. + * + * @param nodeRef + * @return + */ + private boolean isCreateRecordedVersion(NodeRef nodeRef, VersionType versionType) + { + boolean result = false; + if (nodeService.hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE)) + { + String policyString = (String)nodeService.getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); + if (policyString != null) + { + RecordableVersionPolicy policy = RecordableVersionPolicy.valueOf(policyString.toUpperCase()); + if (RecordableVersionPolicy.ALL.equals(policy) || + (RecordableVersionPolicy.MAJOR_ONLY.equals(policy) && + VersionType.MAJOR.equals(versionType))) + { + result = true; + } + } + } + + return result; + } + + /** + * @see org.alfresco.repo.version.Version2ServiceImpl#createNewVersion(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map, int, org.alfresco.repo.policy.PolicyScope) + */ + @Override + protected NodeRef createNewVersion( QName sourceTypeRef, + NodeRef versionHistoryRef, + Map standardVersionProperties, + Map versionProperties, + int versionNumber, + PolicyScope nodeDetails) + { + NodeRef version = null; + + if (versionProperties.containsKey(KEY_RECORDABLE_VERSION) && + ((Boolean)versionProperties.get(KEY_RECORDABLE_VERSION)).booleanValue()) + { + // create a recorded version + version = createNewRecordedVersion(sourceTypeRef, versionHistoryRef, standardVersionProperties, versionProperties, versionNumber, nodeDetails); + } + else + { + // create a normal version + version = super.createNewVersion(sourceTypeRef, versionHistoryRef, standardVersionProperties, versionProperties, versionNumber, nodeDetails); + } + + return version; + } + + /** + * Creates a new recorded version + * + * @param sourceTypeRef source type name + * @param versionHistoryRef version history reference + * @param standardVersionProperties standard version properties + * @param versionProperties version properties + * @param versionNumber version number + * @param nodeDetails policy scope + * @return {@link NodeRef} record version + */ + protected NodeRef createNewRecordedVersion(QName sourceTypeRef, + NodeRef versionHistoryRef, + Map standardVersionProperties, + Map versionProperties, + int versionNumber, + PolicyScope nodeDetails) + { + NodeRef versionNodeRef = null; + + // Disable auto-version behaviour + policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); + + // disable other behaviours that we don't want to trigger during this process + policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); + policyBehaviourFilter.disableBehaviour(ContentModel.TYPE_MULTILINGUAL_CONTAINER); + + // disable model security check + modelSecurityService.disable(); + + // disable property editable check + recordService.disablePropertyEditableCheck(); + + try + { + // get the destination file plan + final NodeRef filePlan = (NodeRef)versionProperties.get(KEY_FILE_PLAN); + if (filePlan == null) + { + throw new AlfrescoRuntimeException("Can't create a new recorded version, because no file plan has been specified in the version properties."); + } + + // create a copy of the source node and place in the file plan + final NodeRef nodeRef = (NodeRef)standardVersionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF); + + cmObjectType.disableCopy(); + try + { + // create record + final NodeRef record = recordService.createRecordFromCopy(filePlan, nodeRef); + + // apply version record aspect to record + final PropertyMap versionRecordProps = new PropertyMap(3); + versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef); + versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, + standardVersionProperties.get( + QName.createQName(Version2Model.NAMESPACE_URI, + Version2Model.PROP_VERSION_LABEL))); + versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, + standardVersionProperties.get( + QName.createQName(Version2Model.NAMESPACE_URI, + Version2Model.PROP_VERSION_DESCRIPTION))); + // run as system as we can't be sure if the user has add aspect rights + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps); + return null; + } + }); + + // wire record up to previous record + linkToPreviousVersionRecord(nodeRef, record); + + // create version nodeRef + ChildAssociationRef childAssocRef = dbNodeService.createNode( + versionHistoryRef, + Version2Model.CHILD_QNAME_VERSIONS, + QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS + "-" + versionNumber), + sourceTypeRef, + null); + versionNodeRef = childAssocRef.getChildRef(); + + // add aspect with the standard version properties to the 'version' node + nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, standardVersionProperties); + + // add the recordedVersion aspect with link to record + nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable)record)); + + // freeze auditable aspect information + freezeAuditableAspect(nodeRef, versionNodeRef); + } + finally + { + cmObjectType.enableCopy(); + } + } + finally + { + // enable model security check + modelSecurityService.enable(); + + // enable property editable check + recordService.enablePropertyEditableCheck(); + + // Enable behaviours + this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); + this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); + this.policyBehaviourFilter.enableBehaviour(ContentModel.TYPE_MULTILINGUAL_CONTAINER); + } + + // If the auditable aspect is not there then add it to the 'version' node (after original aspects have been frozen) + if (!dbNodeService.hasAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE)) + { + dbNodeService.addAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE, null); + } + + if (logger.isTraceEnabled()) + { + logger.trace("createNewRecordedVersion created (" + versionNumber + ") " + versionNodeRef); + } + + return versionNodeRef; + } + + /** + * Helper method to link the record to the previous version record + * + * @param nodeRef noderef source node reference + * @param record record record node reference + */ + private void linkToPreviousVersionRecord(final NodeRef nodeRef, final NodeRef record) + { + final NodeRef latestRecordVersion = getLatestVersionRecord(nodeRef); + if (latestRecordVersion != null) + { + authenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + // indicate that the new record versions the previous record + relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), record, latestRecordVersion); + return null; + } + }); + } + } + + /** + * Helper to get the latest version record for a given document (ie non-record) + * + * @param nodeRef node reference + * @return NodeRef latest version record, null otherwise + */ + private NodeRef getLatestVersionRecord(NodeRef nodeRef) + { + NodeRef versionRecord = null; + + // wire record up to previous record + VersionHistory versionHistory = getVersionHistory(nodeRef); + if (versionHistory != null) + { + Collection previousVersions = versionHistory.getAllVersions(); + for (Version previousVersion : previousVersions) + { + // look for the associated record + final NodeRef previousRecord = (NodeRef)previousVersion.getVersionProperties().get(PROP_VERSION_RECORD); + if (previousRecord != null && + nodeService.exists(previousRecord)) + { + versionRecord = previousRecord; + break; + } + } + } + + return versionRecord; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#getRecordedVersion(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Version getRecordedVersion(NodeRef versionRecord) + { + Version version = null; + NodeRef versionedNodeRef = (NodeRef) nodeService.getProperty(versionRecord, RecordableVersionModel.PROP_VERSIONED_NODEREF); + if (versionedNodeRef != null) + { + String versionLabel = (String) nodeService.getProperty(versionRecord, RecordableVersionModel.PROP_VERSION_LABEL); + if (StringUtils.isNotBlank(versionLabel)) + { + VersionHistory versionHistory = getVersionHistory(versionedNodeRef); + if (versionHistory != null) + { + version = versionHistory.getVersion(versionLabel); + } + } + } + return version; + } + + /** + * Freezes audit aspect properties. + * + * @param nodeRef + * @param versionNodeRef + */ + private void freezeAuditableAspect(NodeRef nodeRef, NodeRef versionNodeRef) + { + if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUDITABLE)) + { + Map properties = dbNodeService.getProperties(nodeRef); + dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATOR, properties.get(ContentModel.PROP_CREATOR)); + dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATED, properties.get(ContentModel.PROP_CREATED)); + dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIER, properties.get(ContentModel.PROP_MODIFIER)); + dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIED, properties.get(ContentModel.PROP_MODIFIED)); + dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_ACCESSED, properties.get(ContentModel.PROP_ACCESSED)); + if (properties.get(ContentModel.PROP_OWNER) != null) + { + dbNodeService.setProperty(versionNodeRef, PROP_FROZEN_OWNER, properties.get(ContentModel.PROP_OWNER)); + } + } + } + + /** + * @see org.alfresco.repo.version.Version2ServiceImpl#getVersion(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected Version getVersion(NodeRef versionRef) + { + Version version = super.getVersion(versionRef); + + // place the version record reference in the version properties + NodeRef record = (NodeRef)dbNodeService.getProperty(versionRef, PROP_RECORD_NODE_REF); + if (record != null) + { + version.getVersionProperties().put(PROP_VERSION_RECORD, record); + } + + // place information about the destruction of the version record in the properties + Boolean destroyed = (Boolean)dbNodeService.getProperty(versionRef, PROP_DESTROYED); + if (destroyed == null) { destroyed = Boolean.FALSE; } + version.getVersionProperties().put(PROP_RECORDED_VERSION_DESTROYED, destroyed); + + return version; + } + + /** + * @see org.alfresco.repo.version.Version2ServiceImpl#revert(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.version.Version, boolean) + */ + @Override + public void revert(NodeRef nodeRef, Version version, boolean deep) + { + String versionPolicy = (String) dbNodeService.getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); + + super.revert(nodeRef, version, deep); + + if (isNotBlank(versionPolicy)) + { + dbNodeService.setProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY, versionPolicy); + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isLatestVersionRecorded(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public boolean isCurrentVersionRecorded(NodeRef nodeRef) + { + boolean result = false; + Version version = getCurrentVersion(nodeRef); + if (version != null) + { + result = isRecordedVersion(version); + } + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isRecordedVersion(org.alfresco.service.cmr.version.Version) + */ + @Override + public boolean isRecordedVersion(Version version) + { + NodeRef versionNodeRef = getVersionNodeRef(version); + return dbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#getVersionRecord(org.alfresco.service.cmr.version.Version) + */ + @Override + public NodeRef getVersionRecord(Version version) + { + NodeRef result = null; + NodeRef versionNodeRef = getVersionNodeRef(version); + if (dbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) + { + // get the version record + result = (NodeRef)dbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF); + + // check that the version record exists + if (result != null && + !dbNodeService.exists(result)) + { + throw new AlfrescoRuntimeException("Version record node doesn't exist. Indicates version has not been updated " + + "when associated version record was deleted. " + + "(nodeRef=" + result.toString() + ")"); + } + } + return result; + } + + /** + * Create Version Store Ref + * + * @param store ref + * @return store ref for version store + */ + public StoreRef convertStoreRef(StoreRef storeRef) + { + return new StoreRef(StoreRef.PROTOCOL_WORKSPACE, storeRef.getIdentifier()); + } + + /** + * Convert the incomming node ref (with the version store protocol specified) + * to the internal representation with the workspace protocol. + * + * @param nodeRef the incomming verison protocol node reference + * @return the internal version node reference + */ + public NodeRef convertNodeRef(NodeRef nodeRef) + { + return new NodeRef(convertStoreRef(nodeRef.getStoreRef()), nodeRef.getId()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#createRecordFromLatestVersion(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public NodeRef createRecordFromLatestVersion(final NodeRef filePlan, final NodeRef nodeRef) + { + ParameterCheck.mandatory("filePlan", filePlan); + ParameterCheck.mandatory("nodeRef", nodeRef); + + NodeRef record = null; + + // check for versionable aspect + if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) + { + // get the latest version + final Version currentVersion = getCurrentVersion(nodeRef); + + if (currentVersion != null && + !isRecordedVersion(currentVersion)) + { + // create the record from the current frozen state + record = authenticationUtil.runAsSystem(new RunAsWork() + { + public NodeRef doWork() throws Exception + { + // get the documents readers and writers + Pair, Set> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef); + + // grab the frozen state + NodeRef currentFrozenState = currentVersion.getFrozenStateNodeRef(); + + // determine the type of the object + QName type = nodeService.getType(currentFrozenState); + + // grab all the properties + Map properties = nodeService.getProperties(currentFrozenState); + + // grab all the aspects + Set aspects = nodeService.getAspects(currentFrozenState); + + // create the record + NodeRef record = recordService.createRecordFromContent( + filePlan, + (String)properties.get(ContentModel.PROP_NAME), + type, + properties, + null); + + // apply aspects to record + for (QName aspect : aspects) + { + // add the aspect, properties have already been set + nodeService.addAspect(record, aspect, null); + } + + // apply version record aspect to record + PropertyMap versionRecordProps = new PropertyMap(3); + versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef); + versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, currentVersion.getVersionLabel()); + versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, currentVersion.getDescription()); + versionRecordProps.put(ContentModel.PROP_VERSION_TYPE, currentVersion.getVersionType()); + nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps); + + // wire record up to previous record + linkToPreviousVersionRecord(nodeRef, record); + + // set the extended security + extendedSecurityService.set(record, readersAndWriters); + + return record; + } + }); + + // get the version history + NodeRef versionHistoryRef = getVersionHistoryNodeRef(nodeRef); + + // get details from the version before we remove it + int versionNumber = getVersionNumber(currentVersion); + Map versionProperties = getVersionAspectProperties(currentVersion); + QName sourceTypeRef = getVersionType(currentVersion); + + // patch-up owner information, which needs to be frozen for recorded versions + String owner = (String)nodeService.getProperty(currentVersion.getFrozenStateNodeRef(), ContentModel.PROP_OWNER); + if (owner != null) + { + versionProperties.put(PROP_FROZEN_OWNER, owner); + } + + // delete the current version + this.dbNodeService.deleteNode(convertNodeRef(currentVersion.getFrozenStateNodeRef())); + + // create a new version history if we need to + if (!nodeService.exists(versionHistoryRef)) + { + versionHistoryRef = createVersionHistory(nodeRef); + } + + // create recorded version nodeRef + ChildAssociationRef childAssocRef = dbNodeService.createNode( + versionHistoryRef, + Version2Model.CHILD_QNAME_VERSIONS, + QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS + "-" + versionNumber), + sourceTypeRef, + null); + NodeRef versionNodeRef = childAssocRef.getChildRef(); + + // add aspect with the standard version properties to the 'version' node + nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, versionProperties); + + // add the recordedVersion aspect with link to record + nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable)record)); + } + } + + return record; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isRecordedVersionDestroyed(org.alfresco.service.cmr.version.Version) + */ + @Override + public boolean isRecordedVersionDestroyed(Version version) + { + boolean result = false; + + // get the version node reference + NodeRef versionNodeRef = getVersionNodeRef(version); + + // get the destroyed property value + Boolean isDestroyed = (Boolean)dbNodeService.getProperty(versionNodeRef, PROP_DESTROYED); + if (isDestroyed != null) + { + result = isDestroyed.booleanValue(); + } + + return result; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#destroyRecordedVersion(org.alfresco.service.cmr.version.Version) + */ + @Override + public void destroyRecordedVersion(Version version) + { + // get the version node reference + NodeRef versionNodeRef = getVersionNodeRef(version); + + // if it's a recorded version + if (dbNodeService.hasAspect(versionNodeRef, ASPECT_RECORDED_VERSION)) + { + // mark it as destroyed + dbNodeService.setProperty(versionNodeRef, PROP_DESTROYED, true); + + // clear the record node reference property + dbNodeService.setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); + } + } + + /** + * Helper method to get the version number of a given version by inspecting the + * name of the parent association. + * + * @param version version + * @return int version number + */ + private int getVersionNumber(Version version) + { + NodeRef versionNodeRef = getVersionNodeRef(version); + ChildAssociationRef assoc = dbNodeService.getPrimaryParent(versionNodeRef); + String fullVersionNumber = assoc.getQName().getLocalName(); + String versionNumber = fullVersionNumber.substring(fullVersionNumber.indexOf("-") + 1); + return Integer.parseInt(versionNumber); + } + + /** + * Helper method to get all the version aspect properties from an existing version + * + * @param version version + * @return Map property values + */ + private Map getVersionAspectProperties(Version version) + { + NodeRef versionNodeRef = getVersionNodeRef(version); + Map versionProps = dbNodeService.getProperties(versionNodeRef); + Map result = new HashMap(9); + for (String propertyName : VERSION_PROPERTY_NAMES) + { + QName propertyQName = QName.createQName(Version2Model.NAMESPACE_URI, propertyName); + result.put(propertyQName, versionProps.get(propertyQName)); + + if (propertyName.equals(Version2Model.PROP_FROZEN_NODE_DBID)) + { + System.out.println(versionProps.get(propertyQName)); + } + } + return result; + } + + /** + * Helper method to get the type of a versions frozen state + * + * @param currentVersion + * @return + */ + private QName getVersionType(Version version) + { + return nodeService.getType(getVersionNodeRef(version)); + } + + /** + * Helper method to get the internal node reference of a version + * + * @param version version + * @return NodeRef internal node reference to version + */ + private NodeRef getVersionNodeRef(Version version) + { + return convertNodeRef(version.getFrozenStateNodeRef()); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java index a43ac1d9e4..5b65e025c8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version.model; - -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; - -/** - * rmv:versionsable aspect behaviour bean implementation - * - * @author Roy Wetherall - * @since 2.3 - */ -@BehaviourBean -( - defaultType="rmv:versionable" -) -public class VersionableAspect 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(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version.model; + +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; + +/** + * rmv:versionsable aspect behaviour bean implementation + * + * @author Roy Wetherall + * @since 2.3 + */ +@BehaviourBean +( + defaultType="rmv:versionable" +) +public class VersionableAspect 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-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java index db31b8195f..e7df49bed6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java @@ -1,143 +1,143 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.vital; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; - -/** - * Action to implement the consequences of a change to the value of the VitalRecordDefinition properties. When the - * VitalRecordIndicator or the reviewPeriod properties are changed on a record container, then any descendant folders or - * records must be updated as a consequence. Descendant folders should have their reviewPeriods and/or - * vitalRecordIndicators updated to match the new value. Descendant records should have their reviewAsOf date updated. - * - * @author Neil McErlean - */ -public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstractBase -{ - protected FilePlanService filePlanService; - - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, final NodeRef actionedUponNodeRef) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - propagateChangeToChildrenOf(actionedUponNodeRef); - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - /** - * Propagates the changes to the children of the node specified. - * - * @param actionedUponNodeRef actioned upon node reference - */ - private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef) - { - Map parentProps = getNodeService().getProperties(actionedUponNodeRef); - - // parent vital record indicator, default to null if not set - boolean parentVri = false; - Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR); - if (parentVriValue != null) - { - parentVri = parentVriValue.booleanValue(); - } - - Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD); - - List assocs = this.getNodeService().getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - for (ChildAssociationRef nextAssoc : assocs) - { - NodeRef nextChild = nextAssoc.getChildRef(); - - if (filePlanService.isFilePlanComponent(nextChild) && - !getFreezeService().isFrozen(nextChild)) - { - // If the child is a record, then the VitalRecord aspect needs to be applied or updated - if (getRecordService().isRecord(nextChild)) - { - if (parentVri) - { - VitalRecordDefinition vrDefn = getVitalRecordService().getVitalRecordDefinition(nextChild); - Map aspectProps = new HashMap(); - aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate()); - - getNodeService().addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps); - } - else - { - getNodeService().removeAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD); - } - } - else - // copy the vitalRecordDefinition properties from the parent to the child - { - Map childProps = getNodeService().getProperties(nextChild); - childProps.put(PROP_REVIEW_PERIOD, parentReviewPeriod); - childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri); - getNodeService().setProperties(nextChild, childProps); - } - - // Recurse down the containment hierarchy to all containers - if (!getRecordService().isRecord(nextChild)) - { - this.propagateChangeToChildrenOf(nextChild); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.vital; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; + +/** + * Action to implement the consequences of a change to the value of the VitalRecordDefinition properties. When the + * VitalRecordIndicator or the reviewPeriod properties are changed on a record container, then any descendant folders or + * records must be updated as a consequence. Descendant folders should have their reviewPeriods and/or + * vitalRecordIndicators updated to match the new value. Descendant records should have their reviewAsOf date updated. + * + * @author Neil McErlean + */ +public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstractBase +{ + protected FilePlanService filePlanService; + + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, final NodeRef actionedUponNodeRef) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + propagateChangeToChildrenOf(actionedUponNodeRef); + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + + /** + * Propagates the changes to the children of the node specified. + * + * @param actionedUponNodeRef actioned upon node reference + */ + private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef) + { + Map parentProps = getNodeService().getProperties(actionedUponNodeRef); + + // parent vital record indicator, default to null if not set + boolean parentVri = false; + Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR); + if (parentVriValue != null) + { + parentVri = parentVriValue.booleanValue(); + } + + Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD); + + List assocs = this.getNodeService().getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef nextAssoc : assocs) + { + NodeRef nextChild = nextAssoc.getChildRef(); + + if (filePlanService.isFilePlanComponent(nextChild) && + !getFreezeService().isFrozen(nextChild)) + { + // If the child is a record, then the VitalRecord aspect needs to be applied or updated + if (getRecordService().isRecord(nextChild)) + { + if (parentVri) + { + VitalRecordDefinition vrDefn = getVitalRecordService().getVitalRecordDefinition(nextChild); + Map aspectProps = new HashMap(); + aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate()); + + getNodeService().addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps); + } + else + { + getNodeService().removeAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD); + } + } + else + // copy the vitalRecordDefinition properties from the parent to the child + { + Map childProps = getNodeService().getProperties(nextChild); + childProps.put(PROP_REVIEW_PERIOD, parentReviewPeriod); + childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri); + getNodeService().setProperties(nextChild, childProps); + } + + // Recurse down the containment hierarchy to all containers + if (!getRecordService().isRecord(nextChild)) + { + this.propagateChangeToChildrenOf(nextChild); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java index e8d750f53f..dd07a4ebbe 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java @@ -1,99 +1,99 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.vital; - -import java.util.Date; - -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Reviewed action. - * - * @author Neil McErlean - */ -public class ReviewedAction extends RMActionExecuterAbstractBase -{ - private static Log logger = LogFactory.getLog(ReviewedAction.class); - - /** - * - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, - * org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - VitalRecordDefinition vrDef = getVitalRecordService().getVitalRecordDefinition(actionedUponNodeRef); - if (vrDef != null && vrDef.isEnabled()) - { - if (getRecordService().isRecord(actionedUponNodeRef)) - { - reviewRecord(actionedUponNodeRef, vrDef); - } - else if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) - { - for (NodeRef record : getRecordService().getRecords(actionedUponNodeRef)) - { - reviewRecord(record, vrDef); - } - } - } - } - - /** - * Make record as reviewed. - * - * @param nodeRef - * @param vrDef - */ - private void reviewRecord(NodeRef nodeRef, VitalRecordDefinition vrDef) - { - // Calculate the next review date - Date reviewAsOf = vrDef.getNextReviewDate(); - if (reviewAsOf != null) - { - // Log - if (logger.isDebugEnabled()) - { - StringBuilder msg = new StringBuilder(); - msg.append("Setting new reviewAsOf property [") - .append(reviewAsOf) - .append("] on ") - .append(nodeRef); - logger.debug(msg.toString()); - } - - this.getNodeService().setProperty(nodeRef, PROP_REVIEW_AS_OF, reviewAsOf); - //TODO And record previous review date, time, user - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.vital; + +import java.util.Date; + +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Reviewed action. + * + * @author Neil McErlean + */ +public class ReviewedAction extends RMActionExecuterAbstractBase +{ + private static Log logger = LogFactory.getLog(ReviewedAction.class); + + /** + * + * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, + * org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + VitalRecordDefinition vrDef = getVitalRecordService().getVitalRecordDefinition(actionedUponNodeRef); + if (vrDef != null && vrDef.isEnabled()) + { + if (getRecordService().isRecord(actionedUponNodeRef)) + { + reviewRecord(actionedUponNodeRef, vrDef); + } + else if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) + { + for (NodeRef record : getRecordService().getRecords(actionedUponNodeRef)) + { + reviewRecord(record, vrDef); + } + } + } + } + + /** + * Make record as reviewed. + * + * @param nodeRef + * @param vrDef + */ + private void reviewRecord(NodeRef nodeRef, VitalRecordDefinition vrDef) + { + // Calculate the next review date + Date reviewAsOf = vrDef.getNextReviewDate(); + if (reviewAsOf != null) + { + // Log + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Setting new reviewAsOf property [") + .append(reviewAsOf) + .append("] on ") + .append(nodeRef); + logger.debug(msg.toString()); + } + + this.getNodeService().setProperty(nodeRef, PROP_REVIEW_AS_OF, reviewAsOf); + //TODO And record previous review date, time, user + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinition.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinition.java index ebd3b97ba8..83150ce2fe 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinition.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinition.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.vital; - -import java.util.Date; - -import org.alfresco.service.cmr.repository.Period; - -/** - * Vital record definition interface - * - * @author Roy Wetherall - */ -public interface VitalRecordDefinition -{ - /** - * Indicates whether the vital record definition is enabled or not. - *

- * Note: a result of false indicates that the vital record definition is inactive - * therefore does not impose the rules associated with vital record review on - * associated nodes. - * - * @return boolean true if enabled, false otherwise - */ - boolean isEnabled(); - - /** - * Review period for vital records - * - * @return Period review period - */ - Period getReviewPeriod(); - - /** - * Gets the next review date based on the review period - * - * @return Date date of the next review - */ - Date getNextReviewDate(); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.vital; + +import java.util.Date; + +import org.alfresco.service.cmr.repository.Period; + +/** + * Vital record definition interface + * + * @author Roy Wetherall + */ +public interface VitalRecordDefinition +{ + /** + * Indicates whether the vital record definition is enabled or not. + *

+ * Note: a result of false indicates that the vital record definition is inactive + * therefore does not impose the rules associated with vital record review on + * associated nodes. + * + * @return boolean true if enabled, false otherwise + */ + boolean isEnabled(); + + /** + * Review period for vital records + * + * @return Period review period + */ + Period getReviewPeriod(); + + /** + * Gets the next review date based on the review period + * + * @return Date date of the next review + */ + Date getNextReviewDate(); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinitionImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinitionImpl.java index b96db781a6..b12b33e68d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinitionImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordDefinitionImpl.java @@ -1,107 +1,107 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.vital; - -import java.util.Date; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; - -/** - * Vital record definition implementation class - * - * @author Roy Wetherall - */ -public class VitalRecordDefinitionImpl implements VitalRecordDefinition, RecordsManagementModel -{ - /** Indicates whether the vital record definition is enabled or not */ - private boolean enabled = false; - - /** Vital record review period */ - private Period reviewPeriod = new Period("none|0"); - - /** - * Constructor. - * - * @param enabled - * @param reviewPeriod - */ - /* package */ VitalRecordDefinitionImpl(boolean enabled, Period reviewPeriod) - { - this.enabled = enabled; - if (reviewPeriod != null) - { - this.reviewPeriod = reviewPeriod; - } - } - - /** - * Helper method to create vital record definition from node reference. - * - * @param nodeService - * @param nodeRef - * @return - */ - /* package */ static VitalRecordDefinition create(NodeService nodeService, NodeRef nodeRef) - { - Boolean enabled = (Boolean)nodeService.getProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR); - if (enabled == null) - { - enabled = Boolean.FALSE; - } - Period reviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); - return new VitalRecordDefinitionImpl(enabled, reviewPeriod); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#isEnabled() - */ - @Override - public boolean isEnabled() - { - return enabled; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#getNextReviewDate() - */ - public Date getNextReviewDate() - { - return getReviewPeriod().getNextDate(new Date()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#getReviewPeriod() - */ - public Period getReviewPeriod() - { - return reviewPeriod; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.vital; + +import java.util.Date; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.Period; + +/** + * Vital record definition implementation class + * + * @author Roy Wetherall + */ +public class VitalRecordDefinitionImpl implements VitalRecordDefinition, RecordsManagementModel +{ + /** Indicates whether the vital record definition is enabled or not */ + private boolean enabled = false; + + /** Vital record review period */ + private Period reviewPeriod = new Period("none|0"); + + /** + * Constructor. + * + * @param enabled + * @param reviewPeriod + */ + /* package */ VitalRecordDefinitionImpl(boolean enabled, Period reviewPeriod) + { + this.enabled = enabled; + if (reviewPeriod != null) + { + this.reviewPeriod = reviewPeriod; + } + } + + /** + * Helper method to create vital record definition from node reference. + * + * @param nodeService + * @param nodeRef + * @return + */ + /* package */ static VitalRecordDefinition create(NodeService nodeService, NodeRef nodeRef) + { + Boolean enabled = (Boolean)nodeService.getProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR); + if (enabled == null) + { + enabled = Boolean.FALSE; + } + Period reviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); + return new VitalRecordDefinitionImpl(enabled, reviewPeriod); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#isEnabled() + */ + @Override + public boolean isEnabled() + { + return enabled; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#getNextReviewDate() + */ + public Date getNextReviewDate() + { + return getReviewPeriod().getNextDate(new Date()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition#getReviewPeriod() + */ + public Period getReviewPeriod() + { + return reviewPeriod; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordService.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordService.java index a5fd7c5702..2283cdfc51 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordService.java @@ -1,84 +1,84 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.vital; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; - -/** - * Vital Record Service. - * - * @author Roy Wetherall - * @since 2.0 - */ -// Not @AlfrescoPublicApi due to e.g. Period. -public interface VitalRecordService -{ - /** Period 'none' */ - Period PERIOD_NONE = new Period("none|0"); - - /** - * Setup the vital record definition for the given node. - * - * @param nodeRef node reference - */ - void setupVitalRecordDefinition(NodeRef nodeRef); - - /** - * Gets the vital record definition details for the node. - * - * @param nodeRef node reference - * @return VitalRecordDefinition vital record definition details - */ - VitalRecordDefinition getVitalRecordDefinition(NodeRef nodeRef); - - /** - * Sets the vital record definition values for a given node. - * - * @param nodeRef - * @param enabled - * @param reviewPeriod - * @return - */ - VitalRecordDefinition setVitalRecordDefintion(NodeRef nodeRef, boolean enabled, Period reviewPeriod); - - /** - * Indicates whether the record is a vital one or not. - * - * @param nodeRef node reference - * @return boolean true if this is a vital record, false otherwise - */ - boolean isVitalRecord(NodeRef nodeRef); - - /** - * Initialises the vital record details. - * - * @param nodeRef node reference to initialise with vital record details - */ - //void initialiseVitalRecord(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.vital; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; + +/** + * Vital Record Service. + * + * @author Roy Wetherall + * @since 2.0 + */ +// Not @AlfrescoPublicApi due to e.g. Period. +public interface VitalRecordService +{ + /** Period 'none' */ + Period PERIOD_NONE = new Period("none|0"); + + /** + * Setup the vital record definition for the given node. + * + * @param nodeRef node reference + */ + void setupVitalRecordDefinition(NodeRef nodeRef); + + /** + * Gets the vital record definition details for the node. + * + * @param nodeRef node reference + * @return VitalRecordDefinition vital record definition details + */ + VitalRecordDefinition getVitalRecordDefinition(NodeRef nodeRef); + + /** + * Sets the vital record definition values for a given node. + * + * @param nodeRef + * @param enabled + * @param reviewPeriod + * @return + */ + VitalRecordDefinition setVitalRecordDefintion(NodeRef nodeRef, boolean enabled, Period reviewPeriod); + + /** + * Indicates whether the record is a vital one or not. + * + * @param nodeRef node reference + * @return boolean true if this is a vital record, false otherwise + */ + boolean isVitalRecord(NodeRef nodeRef); + + /** + * Initialises the vital record details. + * + * @param nodeRef node reference to initialise with vital record details + */ + //void initialiseVitalRecord(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java index 88cf73d1ef..ffa43d30c6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java @@ -1,213 +1,213 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.vital; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -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.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Vital record service interface implementation. - * - * @author Roy Wetherall - * @since 2.0 - */ -@BehaviourBean -public class VitalRecordServiceImpl extends ServiceBaseImpl - implements VitalRecordService, - RecordsManagementModel, - RecordsManagementPolicies.OnFileRecord -{ - /** file plan service */ - private FilePlanService filePlanService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Behavior to initialize vital record. - * - * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord#onFileRecord(org.alfresco.service.cmr.repository.NodeRef) - * @since 2.2 - */ - @Override - @Behaviour(kind=BehaviourKind.CLASS, type="rma:record") - public void onFileRecord(NodeRef nodeRef) - { - // Calculate the review schedule - VitalRecordDefinition viDef = getVitalRecordDefinition(nodeRef); - if (viDef != null && viDef.isEnabled()) - { - Date reviewAsOf = viDef.getNextReviewDate(); - if (reviewAsOf != null) - { - Map reviewProps = new HashMap(1); - reviewProps.put(RecordsManagementModel.PROP_REVIEW_AS_OF, reviewAsOf); - - if (!nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)) - { - nodeService.addAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD, reviewProps); - } - else - { - Map props = nodeService.getProperties(nodeRef); - props.putAll(reviewProps); - nodeService.setProperties(nodeRef, props); - } - } - } - else - { - // if we are re-filling then remove the vital aspect if it is not longer a vital record - if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)) - { - nodeService.removeAspect(nodeRef, ASPECT_VITAL_RECORD); - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService#setupVitalRecordDefinition(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void setupVitalRecordDefinition(NodeRef nodeRef) - { - // get the current review period value - Period currentReviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); - if (currentReviewPeriod == null || - PERIOD_NONE.equals(currentReviewPeriod)) - { - // get the immediate parent - NodeRef parentRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); - - // is the parent a record category - if (parentRef != null && - FilePlanComponentKind.RECORD_CATEGORY.equals(filePlanService.getFilePlanComponentKind(parentRef))) - { - // is the child a record category or folder - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (kind.equals(FilePlanComponentKind.RECORD_CATEGORY) || - kind.equals(FilePlanComponentKind.RECORD_FOLDER)) - { - // set the vital record definition values to match that of the parent - nodeService.setProperty(nodeRef, - PROP_VITAL_RECORD_INDICATOR, - nodeService.getProperty(parentRef, PROP_VITAL_RECORD_INDICATOR)); - nodeService.setProperty(nodeRef, - PROP_REVIEW_PERIOD, - nodeService.getProperty(parentRef, PROP_REVIEW_PERIOD)); - } - } - } - } - - /** - * @see VitalRecordService#getVitalRecordDefinition(NodeRef) - */ - public VitalRecordDefinition getVitalRecordDefinition(NodeRef nodeRef) - { - VitalRecordDefinition result = null; - - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (FilePlanComponentKind.RECORD.equals(kind)) - { - result = resolveVitalRecordDefinition(nodeRef); - } - else - { - if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION)) - { - result = VitalRecordDefinitionImpl.create(nodeService, nodeRef); - } - } - - return result; - } - - /** - * Resolves the record vital definition. - *

- * NOTE: Currently we only support the resolution of the vital record definition from the - * primary record parent. ie the record folder the record was originally filed within. - *

- * TODO: Add an algorithm to resolve the correct vital record definition when a record is filed in many - * record folders. - * - * @param record - * @return VitalRecordDefinition - */ - private VitalRecordDefinition resolveVitalRecordDefinition(NodeRef record) - { - NodeRef parent = nodeService.getPrimaryParent(record).getParentRef(); - return getVitalRecordDefinition(parent); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService#setVitalRecordDefintion(org.alfresco.service.cmr.repository.NodeRef, boolean, org.alfresco.service.cmr.repository.Period) - */ - @Override - public VitalRecordDefinition setVitalRecordDefintion(NodeRef nodeRef, boolean enabled, Period reviewPeriod) - { - // Check params - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("enabled", enabled); - - // Set the properties (will automatically add the vital record definition aspect) - nodeService.setProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR, enabled); - nodeService.setProperty(nodeRef, PROP_REVIEW_PERIOD, reviewPeriod); - - return new VitalRecordDefinitionImpl(enabled, reviewPeriod); - } - - /** - * @see VitalRecordService#isVitalRecord(NodeRef) - */ - public boolean isVitalRecord(NodeRef nodeRef) - { - return nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.vital; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +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.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; + +/** + * Vital record service interface implementation. + * + * @author Roy Wetherall + * @since 2.0 + */ +@BehaviourBean +public class VitalRecordServiceImpl extends ServiceBaseImpl + implements VitalRecordService, + RecordsManagementModel, + RecordsManagementPolicies.OnFileRecord +{ + /** file plan service */ + private FilePlanService filePlanService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Behavior to initialize vital record. + * + * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord#onFileRecord(org.alfresco.service.cmr.repository.NodeRef) + * @since 2.2 + */ + @Override + @Behaviour(kind=BehaviourKind.CLASS, type="rma:record") + public void onFileRecord(NodeRef nodeRef) + { + // Calculate the review schedule + VitalRecordDefinition viDef = getVitalRecordDefinition(nodeRef); + if (viDef != null && viDef.isEnabled()) + { + Date reviewAsOf = viDef.getNextReviewDate(); + if (reviewAsOf != null) + { + Map reviewProps = new HashMap(1); + reviewProps.put(RecordsManagementModel.PROP_REVIEW_AS_OF, reviewAsOf); + + if (!nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)) + { + nodeService.addAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD, reviewProps); + } + else + { + Map props = nodeService.getProperties(nodeRef); + props.putAll(reviewProps); + nodeService.setProperties(nodeRef, props); + } + } + } + else + { + // if we are re-filling then remove the vital aspect if it is not longer a vital record + if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)) + { + nodeService.removeAspect(nodeRef, ASPECT_VITAL_RECORD); + } + } + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService#setupVitalRecordDefinition(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void setupVitalRecordDefinition(NodeRef nodeRef) + { + // get the current review period value + Period currentReviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); + if (currentReviewPeriod == null || + PERIOD_NONE.equals(currentReviewPeriod)) + { + // get the immediate parent + NodeRef parentRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); + + // is the parent a record category + if (parentRef != null && + FilePlanComponentKind.RECORD_CATEGORY.equals(filePlanService.getFilePlanComponentKind(parentRef))) + { + // is the child a record category or folder + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); + if (kind.equals(FilePlanComponentKind.RECORD_CATEGORY) || + kind.equals(FilePlanComponentKind.RECORD_FOLDER)) + { + // set the vital record definition values to match that of the parent + nodeService.setProperty(nodeRef, + PROP_VITAL_RECORD_INDICATOR, + nodeService.getProperty(parentRef, PROP_VITAL_RECORD_INDICATOR)); + nodeService.setProperty(nodeRef, + PROP_REVIEW_PERIOD, + nodeService.getProperty(parentRef, PROP_REVIEW_PERIOD)); + } + } + } + } + + /** + * @see VitalRecordService#getVitalRecordDefinition(NodeRef) + */ + public VitalRecordDefinition getVitalRecordDefinition(NodeRef nodeRef) + { + VitalRecordDefinition result = null; + + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); + if (FilePlanComponentKind.RECORD.equals(kind)) + { + result = resolveVitalRecordDefinition(nodeRef); + } + else + { + if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION)) + { + result = VitalRecordDefinitionImpl.create(nodeService, nodeRef); + } + } + + return result; + } + + /** + * Resolves the record vital definition. + *

+ * NOTE: Currently we only support the resolution of the vital record definition from the + * primary record parent. ie the record folder the record was originally filed within. + *

+ * TODO: Add an algorithm to resolve the correct vital record definition when a record is filed in many + * record folders. + * + * @param record + * @return VitalRecordDefinition + */ + private VitalRecordDefinition resolveVitalRecordDefinition(NodeRef record) + { + NodeRef parent = nodeService.getPrimaryParent(record).getParentRef(); + return getVitalRecordDefinition(parent); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService#setVitalRecordDefintion(org.alfresco.service.cmr.repository.NodeRef, boolean, org.alfresco.service.cmr.repository.Period) + */ + @Override + public VitalRecordDefinition setVitalRecordDefintion(NodeRef nodeRef, boolean enabled, Period reviewPeriod) + { + // Check params + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("enabled", enabled); + + // Set the properties (will automatically add the vital record definition aspect) + nodeService.setProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR, enabled); + nodeService.setProperty(nodeRef, PROP_REVIEW_PERIOD, reviewPeriod); + + return new VitalRecordDefinitionImpl(enabled, reviewPeriod); + } + + /** + * @see VitalRecordService#isVitalRecord(NodeRef) + */ + public boolean isVitalRecord(NodeRef nodeRef) + { + return nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java index e5b0680d5f..472c9c4a01 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java @@ -1,141 +1,141 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.repo.action.evaluator.ActionConditionEvaluator; -import org.alfresco.service.cmr.action.ActionConditionDefinition; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - * Extended action service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedActionServiceImpl extends ActionServiceImpl implements ApplicationContextAware -{ - /** File plan service */ - private FilePlanService filePlanService; - - /** Application context */ - private ApplicationContext extendedApplicationContext; - - /** - * @see org.alfresco.repo.action.ActionServiceImpl#setApplicationContext(org.springframework.context.ApplicationContext) - */ - public void setApplicationContext(ApplicationContext applicationContext) - { - super.setApplicationContext(applicationContext); - extendedApplicationContext = applicationContext; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @see org.alfresco.repo.action.ActionServiceImpl#getActionConditionDefinition(java.lang.String) - */ - public ActionConditionDefinition getActionConditionDefinition(String name) - { - // get direct access to action condition definition (i.e. ignoring public flag of executer) - ActionConditionDefinition definition = null; - Object bean = extendedApplicationContext.getBean(name); - if (bean instanceof ActionConditionEvaluator) - { - ActionConditionEvaluator evaluator = (ActionConditionEvaluator) bean; - definition = evaluator.getActionConditionDefintion(); - } - return definition; - } - - /** - * @see org.alfresco.repo.action.ActionServiceImpl#getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getActionDefinitions(NodeRef nodeRef) - { - List result = null; - - // first use the base implementation to get the list of action definitions - List actionDefinitions = super.getActionDefinitions(nodeRef); - - if (nodeRef == null) - { - // nothing to filter - result = actionDefinitions; - } - else - { - // get the file component kind of the node reference - FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - result = new ArrayList(actionDefinitions.size()); - - // check each action definition - for (ActionDefinition actionDefinition : actionDefinitions) - { - if (actionDefinition instanceof RecordsManagementActionDefinition) - { - if (kind != null) - { - Set applicableKinds = ((RecordsManagementActionDefinition)actionDefinition).getApplicableKinds(); - if (applicableKinds == null || applicableKinds.size() == 0 || applicableKinds.contains(kind)) - { - // an RM action can only act on a RM artifact - result.add(actionDefinition); - } - } - } - else - { - if (kind == null) - { - // a non-RM action can only act on a non-RM artifact - result.add(actionDefinition); - } - } - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.repo.action.evaluator.ActionConditionEvaluator; +import org.alfresco.service.cmr.action.ActionConditionDefinition; +import org.alfresco.service.cmr.action.ActionDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * Extended action service implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ExtendedActionServiceImpl extends ActionServiceImpl implements ApplicationContextAware +{ + /** File plan service */ + private FilePlanService filePlanService; + + /** Application context */ + private ApplicationContext extendedApplicationContext; + + /** + * @see org.alfresco.repo.action.ActionServiceImpl#setApplicationContext(org.springframework.context.ApplicationContext) + */ + public void setApplicationContext(ApplicationContext applicationContext) + { + super.setApplicationContext(applicationContext); + extendedApplicationContext = applicationContext; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @see org.alfresco.repo.action.ActionServiceImpl#getActionConditionDefinition(java.lang.String) + */ + public ActionConditionDefinition getActionConditionDefinition(String name) + { + // get direct access to action condition definition (i.e. ignoring public flag of executer) + ActionConditionDefinition definition = null; + Object bean = extendedApplicationContext.getBean(name); + if (bean instanceof ActionConditionEvaluator) + { + ActionConditionEvaluator evaluator = (ActionConditionEvaluator) bean; + definition = evaluator.getActionConditionDefintion(); + } + return definition; + } + + /** + * @see org.alfresco.repo.action.ActionServiceImpl#getActionDefinitions(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public List getActionDefinitions(NodeRef nodeRef) + { + List result = null; + + // first use the base implementation to get the list of action definitions + List actionDefinitions = super.getActionDefinitions(nodeRef); + + if (nodeRef == null) + { + // nothing to filter + result = actionDefinitions; + } + else + { + // get the file component kind of the node reference + FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); + result = new ArrayList(actionDefinitions.size()); + + // check each action definition + for (ActionDefinition actionDefinition : actionDefinitions) + { + if (actionDefinition instanceof RecordsManagementActionDefinition) + { + if (kind != null) + { + Set applicableKinds = ((RecordsManagementActionDefinition)actionDefinition).getApplicableKinds(); + if (applicableKinds == null || applicableKinds.size() == 0 || applicableKinds.contains(kind)) + { + // an RM action can only act on a RM artifact + result.add(actionDefinition); + } + } + } + else + { + if (kind == null) + { + // a non-RM action can only act on a non-RM artifact + result.add(actionDefinition); + } + } + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java index 555f6a870b..80f0007258 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java @@ -1,259 +1,259 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action.parameter; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang.StringUtils; - -/** - * Date parameter processor. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class DateParameterProcessor extends ParameterProcessor implements ParameterSubstitutionSuggester -{ - private static final String DAY = "day"; - private static final String WEEK = "week"; - private static final String MONTH = "month"; - private static final String YEAR = "year"; - private static final String SHORT = "short"; - private static final String LONG = "long"; - private static final String NUMBER = "number"; - - private static final String SEP = "."; - - private static final String[] ALL_FIELDS_FOR_SUBSTITUTION_QUERY = { - DAY + SEP + SHORT, - DAY, - DAY + SEP + LONG, - DAY + SEP + NUMBER, - DAY + SEP + MONTH, - DAY + SEP + YEAR, - MONTH + SEP + SHORT, - MONTH, - MONTH + SEP + LONG, - MONTH + SEP + NUMBER, - YEAR + SEP + SHORT, - YEAR, - YEAR + SEP + LONG, - YEAR + SEP + WEEK - }; - - private int maximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS; - - /** - * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String process(String value, NodeRef actionedUponNodeRef) - { - // the default position is to return the value un-changed - String result = value; - - // strip the processor name from the value - value = stripName(value); - - if (!value.isEmpty()) - { - String[] values = value.split("\\.", 2); - String field = values[0].trim(); - - if (DAY.equalsIgnoreCase(field)) - { - result = handleDay(values); - } - else if (MONTH.equalsIgnoreCase(field)) - { - result = handleMonth(values); - } - else if (YEAR.equalsIgnoreCase(field)) - { - result = handleYear(values); - } - else - { - throw new AlfrescoRuntimeException("Cannot process the field '" + field + "'."); - } - } - - return result; - } - - private String handleDay(String[] values) - { - String style = getStyle(values); - String pattern; - - if (SHORT.equalsIgnoreCase(style)) - { - pattern = "EE"; - } - else if (LONG.equalsIgnoreCase(style)) - { - pattern = "EEEE"; - } - else if (NUMBER.equalsIgnoreCase(style)) - { - pattern = "uu"; - } - else if (MONTH.equalsIgnoreCase(style)) - { - pattern = "dd"; - } - else if (YEAR.equalsIgnoreCase(style)) - { - pattern = "DDD"; - } - else - { - throw new AlfrescoRuntimeException("The pattern 'date.day." + style + "' is not supported!"); - } - - return new SimpleDateFormat(pattern).format(new Date()); - } - - private String handleMonth(String[] values) - { - String style = getStyle(values); - String pattern; - - if (SHORT.equalsIgnoreCase(style)) - { - pattern = "MMM"; - } - else if (LONG.equalsIgnoreCase(style)) - { - pattern = "MMMM"; - } - else if (NUMBER.equalsIgnoreCase(style)) - { - pattern = "MM"; - } - else - { - throw new AlfrescoRuntimeException("The pattern 'date.month." + style + "' is not supported!"); - } - - return new SimpleDateFormat(pattern).format(new Date()); - } - - private String handleYear(String[] values) - { - String style = getStyle(values); - String pattern; - - if (SHORT.equalsIgnoreCase(style)) - { - pattern = "yy"; - } - else if (LONG.equalsIgnoreCase(style)) - { - pattern = "yyyy"; - } - else if (WEEK.equalsIgnoreCase(style)) - { - pattern = "ww"; - } - else - { - throw new AlfrescoRuntimeException("The pattern 'date.year." + style + "' is not supported!"); - } - - return new SimpleDateFormat(pattern).format(new Date()); - } - - private String getStyle(String[] values) - { - String style; - - if (values.length == 1) - { - style = SHORT; - } - else - { - style = values[1].trim(); - } - - return style; - } - - /** - * Set the maxmimum number of suggestions returned from the global property - * - * @param maximumNumberSuggestions - */ - public void setMaximumNumberSuggestions(int maximumNumberSuggestions) - { - this.maximumNumberSuggestions = (maximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS: maximumNumberSuggestions); - } - - /* (non-Javadoc) - * @see org.alfresco.repo.action.parameter.ParameterSubstitutionSuggester#getSubstitutionSuggestions(java.lang.String) - */ - @Override - public List getSubstitutionSuggestions(String substitutionFragment) - { - List suggestions = new ArrayList(); - String namePrefix = this.getName() + "."; - if(StringUtils.isBlank(substitutionFragment) || this.getName().toLowerCase().contains(substitutionFragment.toLowerCase())) - { - for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) - { - suggestions.add(namePrefix + field); - if(suggestions.size() >= maximumNumberSuggestions) - { - break; - } - } - } - else - { - for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) - { - String prefixFieldName = namePrefix + field; - if(prefixFieldName.toLowerCase().contains(substitutionFragment.toLowerCase())) - { - suggestions.add(namePrefix + field); - if(suggestions.size() >= maximumNumberSuggestions) - { - break; - } - } - } - } - return suggestions; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action.parameter; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.lang.StringUtils; + +/** + * Date parameter processor. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class DateParameterProcessor extends ParameterProcessor implements ParameterSubstitutionSuggester +{ + private static final String DAY = "day"; + private static final String WEEK = "week"; + private static final String MONTH = "month"; + private static final String YEAR = "year"; + private static final String SHORT = "short"; + private static final String LONG = "long"; + private static final String NUMBER = "number"; + + private static final String SEP = "."; + + private static final String[] ALL_FIELDS_FOR_SUBSTITUTION_QUERY = { + DAY + SEP + SHORT, + DAY, + DAY + SEP + LONG, + DAY + SEP + NUMBER, + DAY + SEP + MONTH, + DAY + SEP + YEAR, + MONTH + SEP + SHORT, + MONTH, + MONTH + SEP + LONG, + MONTH + SEP + NUMBER, + YEAR + SEP + SHORT, + YEAR, + YEAR + SEP + LONG, + YEAR + SEP + WEEK + }; + + private int maximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS; + + /** + * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public String process(String value, NodeRef actionedUponNodeRef) + { + // the default position is to return the value un-changed + String result = value; + + // strip the processor name from the value + value = stripName(value); + + if (!value.isEmpty()) + { + String[] values = value.split("\\.", 2); + String field = values[0].trim(); + + if (DAY.equalsIgnoreCase(field)) + { + result = handleDay(values); + } + else if (MONTH.equalsIgnoreCase(field)) + { + result = handleMonth(values); + } + else if (YEAR.equalsIgnoreCase(field)) + { + result = handleYear(values); + } + else + { + throw new AlfrescoRuntimeException("Cannot process the field '" + field + "'."); + } + } + + return result; + } + + private String handleDay(String[] values) + { + String style = getStyle(values); + String pattern; + + if (SHORT.equalsIgnoreCase(style)) + { + pattern = "EE"; + } + else if (LONG.equalsIgnoreCase(style)) + { + pattern = "EEEE"; + } + else if (NUMBER.equalsIgnoreCase(style)) + { + pattern = "uu"; + } + else if (MONTH.equalsIgnoreCase(style)) + { + pattern = "dd"; + } + else if (YEAR.equalsIgnoreCase(style)) + { + pattern = "DDD"; + } + else + { + throw new AlfrescoRuntimeException("The pattern 'date.day." + style + "' is not supported!"); + } + + return new SimpleDateFormat(pattern).format(new Date()); + } + + private String handleMonth(String[] values) + { + String style = getStyle(values); + String pattern; + + if (SHORT.equalsIgnoreCase(style)) + { + pattern = "MMM"; + } + else if (LONG.equalsIgnoreCase(style)) + { + pattern = "MMMM"; + } + else if (NUMBER.equalsIgnoreCase(style)) + { + pattern = "MM"; + } + else + { + throw new AlfrescoRuntimeException("The pattern 'date.month." + style + "' is not supported!"); + } + + return new SimpleDateFormat(pattern).format(new Date()); + } + + private String handleYear(String[] values) + { + String style = getStyle(values); + String pattern; + + if (SHORT.equalsIgnoreCase(style)) + { + pattern = "yy"; + } + else if (LONG.equalsIgnoreCase(style)) + { + pattern = "yyyy"; + } + else if (WEEK.equalsIgnoreCase(style)) + { + pattern = "ww"; + } + else + { + throw new AlfrescoRuntimeException("The pattern 'date.year." + style + "' is not supported!"); + } + + return new SimpleDateFormat(pattern).format(new Date()); + } + + private String getStyle(String[] values) + { + String style; + + if (values.length == 1) + { + style = SHORT; + } + else + { + style = values[1].trim(); + } + + return style; + } + + /** + * Set the maxmimum number of suggestions returned from the global property + * + * @param maximumNumberSuggestions + */ + public void setMaximumNumberSuggestions(int maximumNumberSuggestions) + { + this.maximumNumberSuggestions = (maximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS: maximumNumberSuggestions); + } + + /* (non-Javadoc) + * @see org.alfresco.repo.action.parameter.ParameterSubstitutionSuggester#getSubstitutionSuggestions(java.lang.String) + */ + @Override + public List getSubstitutionSuggestions(String substitutionFragment) + { + List suggestions = new ArrayList(); + String namePrefix = this.getName() + "."; + if(StringUtils.isBlank(substitutionFragment) || this.getName().toLowerCase().contains(substitutionFragment.toLowerCase())) + { + for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) + { + suggestions.add(namePrefix + field); + if(suggestions.size() >= maximumNumberSuggestions) + { + break; + } + } + } + else + { + for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) + { + String prefixFieldName = namePrefix + field; + if(prefixFieldName.toLowerCase().contains(substitutionFragment.toLowerCase())) + { + suggestions.add(namePrefix + field); + if(suggestions.size() >= maximumNumberSuggestions) + { + break; + } + } + } + } + return suggestions; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/MessageParameterProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/MessageParameterProcessor.java index fcc4a32e29..2464a7a2ae 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/MessageParameterProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/MessageParameterProcessor.java @@ -1,64 +1,64 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action.parameter; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Message parameter processor. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class MessageParameterProcessor extends ParameterProcessor -{ - /** - * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String process(String value, NodeRef actionedUponNodeRef) - { - // the default position is to return the value un-changed - String result = value; - - // strip the processor name from the value - value = stripName(value); - if (!value.isEmpty()) - { - result = I18NUtil.getMessage(value); - if (result == null) - { - throw new AlfrescoRuntimeException("The message parameter processor could not resolve the message for the id " + value); - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action.parameter; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Message parameter processor. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class MessageParameterProcessor extends ParameterProcessor +{ + /** + * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public String process(String value, NodeRef actionedUponNodeRef) + { + // the default position is to return the value un-changed + String result = value; + + // strip the processor name from the value + value = stripName(value); + if (!value.isEmpty()) + { + result = I18NUtil.getMessage(value); + if (result == null) + { + throw new AlfrescoRuntimeException("The message parameter processor could not resolve the message for the id " + value); + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java index d8c33a2978..ddd9e4ad4a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java @@ -1,303 +1,303 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action.parameter; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang.ArrayUtils; - -/** - * Node parameter processor. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class NodeParameterProcessor extends ParameterProcessor implements ParameterSubstitutionSuggester -{ - /** Supported data types */ - private QName[] supportedDataTypes = - { - DataTypeDefinition.TEXT, - DataTypeDefinition.BOOLEAN, - DataTypeDefinition.DATE, - DataTypeDefinition.DATETIME, - DataTypeDefinition.DOUBLE, - DataTypeDefinition.FLOAT, - DataTypeDefinition.INT, - DataTypeDefinition.MLTEXT - }; - - private int maximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS; - - /** Node service */ - private NodeService nodeService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Records management admin service */ - private RecordsManagementAdminService recordsManagementAdminService; - - /** List of definitions (aspects and types) to use for substitution suggestions */ - private List suggestionDefinitions = null; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param recordsManagementAdminService Records management admin service - */ - public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - /** - * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public String process(String value, NodeRef actionedUponNodeRef) - { - // the default position is to return the value un-changed - String result = value; - - // strip the processor name from the value - value = stripName(value); - if (!value.isEmpty()) - { - QName qname = QName.createQName(value, namespaceService); - - PropertyDefinition propertyDefinition = dictionaryService.getProperty(qname); - if (propertyDefinition == null) - { - throw new AlfrescoRuntimeException("The property " + value + " does not have a property definition."); - } - - QName type = propertyDefinition.getDataType().getName(); - if (ArrayUtils.contains(supportedDataTypes, type)) - { - Serializable propertyValue = nodeService.getProperty(actionedUponNodeRef, qname); - if (propertyValue != null) - { - result = propertyValue.toString(); - } - else - { - // set the result to the empty string - result = ""; - } - } - else - { - throw new AlfrescoRuntimeException("The property " + value + " is of type " + type.toString() + " which is not supported by parameter substitution."); - } - } - - return result; - } - - /** - * Set the maxmimum number of suggestions returned from the global property - * - * @param maximumNumberSuggestions - */ - public void setMaximumNumberSuggestions(int maximumNumberSuggestions) - { - this.maximumNumberSuggestions = (maximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS: maximumNumberSuggestions); - } - - /** - * Add suggestion definition to the list used to get properties suggestions from. - * - * @param definition Type or aspect - */ - public void addSuggestionDefinition(QName definition) - { - if(this.suggestionDefinitions == null) - { - this.suggestionDefinitions = Collections.synchronizedList(new ArrayList()); - } - this.suggestionDefinitions.add(definition); - } - - /** - * Get a list of node substitution suggestions for the specified fragment. - * - * @param substitutionFragment The fragment to search for - * @returns A list of node substitution suggestions, for example 'node.cm:title' - * - * @see org.alfresco.repo.action.parameter.ParameterSubstitutionSuggester#getSubstitutionSuggestions(java.lang.String) - */ - @Override - public List getSubstitutionSuggestions(String substitutionFragment) - { - Set suggestionSet = Collections.synchronizedSet(new HashSet()); - if(this.suggestionDefinitions != null) - { - for(QName definition : this.suggestionDefinitions) - { - if(getSubstitutionSuggestions(definition, substitutionFragment.toLowerCase(), suggestionSet)) - { - break; - } - } - } - List suggestions = new ArrayList(); - suggestions.addAll(suggestionSet); - Collections.sort(suggestions); - return suggestions; - } - - /** - * Get a list of node substitution suggestions for the given definition and specified fragment. - * - * @param definitionName Definition (aspect or type) to get properties of and the call this method for associated aspects - * @param substitutionFragment Substitution fragment to search for - * @param suggestions The current list of suggestions to which we will add newly found suggestions - */ - private boolean getSubstitutionSuggestions(QName definitionName, String substitutionFragment, Set suggestions) - { - boolean gotMaximumSuggestions = false; - ClassDefinition definition = this.dictionaryService.getAspect(definitionName); - if(definition == null) - { - definition = this.dictionaryService.getType(definitionName); - } - if(definition != null) - { - gotMaximumSuggestions = getSubstitutionSuggestionsForDefinition(definition, substitutionFragment, suggestions); - } - if(recordsManagementAdminService.isCustomisable(definitionName) && !gotMaximumSuggestions) - { - gotMaximumSuggestions = processPropertyDefinitions(recordsManagementAdminService.getCustomPropertyDefinitions(definitionName), substitutionFragment, suggestions); - } - return gotMaximumSuggestions; - } - - /** - * Get a list of node substitution suggestions for the given definition and specified fragment. Calls itself recursively for - * associated aspects. - * - * @param definition Definition (aspect or type) to get properties of and the call this method for associated aspects - * @param substitutionFragment Substitution fragment to search for - * @param suggestions The current list of suggestions to which we will add newly found suggestions - */ - private boolean getSubstitutionSuggestionsForDefinition(ClassDefinition definition, String substitutionFragment, Set suggestions) - { - boolean gotMaximumSuggestions = processPropertyDefinitions(definition.getProperties(), substitutionFragment, suggestions); - if(!gotMaximumSuggestions) - { - for(QName defaultAspect : definition.getDefaultAspectNames()) - { - gotMaximumSuggestions = getSubstitutionSuggestions(defaultAspect, substitutionFragment, suggestions); - if(gotMaximumSuggestions) - { - break; - } - } - } - return gotMaximumSuggestions; - } - - /** - * Process the supplied map of property definitions and add the ones that match the supplied fragment to the list of suggestions. - * - * @param definition Definition (aspect or type) to get properties of and the call this method for associated aspects - * @param substitutionFragment Substitution fragment to search for - * @param suggestions The current list of suggestions to which we will add newly found suggestions - */ - private boolean processPropertyDefinitions(Map properties, String substitutionFragment, Set suggestions) - { - boolean gotMaximumSuggestions = false; - if (properties != null) - { - for (Map.Entry entry : properties.entrySet()) - { - PropertyDefinition propertyDefinition = entry.getValue(); - QName type = propertyDefinition.getDataType().getName(); - if(ArrayUtils.contains(supportedDataTypes, type)) - { - String suggestion = getName() + "." + entry.getKey().getPrefixString(); - if(suggestion.toLowerCase().contains(substitutionFragment)) - { - if(suggestions.size() < this.maximumNumberSuggestions) - { - suggestions.add(suggestion); - } - else - { - gotMaximumSuggestions = true; - break; - } - } - } - } - } - return gotMaximumSuggestions; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action.parameter; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.cmr.dictionary.ClassDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.lang.ArrayUtils; + +/** + * Node parameter processor. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class NodeParameterProcessor extends ParameterProcessor implements ParameterSubstitutionSuggester +{ + /** Supported data types */ + private QName[] supportedDataTypes = + { + DataTypeDefinition.TEXT, + DataTypeDefinition.BOOLEAN, + DataTypeDefinition.DATE, + DataTypeDefinition.DATETIME, + DataTypeDefinition.DOUBLE, + DataTypeDefinition.FLOAT, + DataTypeDefinition.INT, + DataTypeDefinition.MLTEXT + }; + + private int maximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS; + + /** Node service */ + private NodeService nodeService; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** Records management admin service */ + private RecordsManagementAdminService recordsManagementAdminService; + + /** List of definitions (aspects and types) to use for substitution suggestions */ + private List suggestionDefinitions = null; + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param dictionaryService dictionary service + */ + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + + /** + * @param recordsManagementAdminService Records management admin service + */ + public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) + { + this.recordsManagementAdminService = recordsManagementAdminService; + } + + /** + * @see org.alfresco.repo.action.parameter.ParameterProcessor#process(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public String process(String value, NodeRef actionedUponNodeRef) + { + // the default position is to return the value un-changed + String result = value; + + // strip the processor name from the value + value = stripName(value); + if (!value.isEmpty()) + { + QName qname = QName.createQName(value, namespaceService); + + PropertyDefinition propertyDefinition = dictionaryService.getProperty(qname); + if (propertyDefinition == null) + { + throw new AlfrescoRuntimeException("The property " + value + " does not have a property definition."); + } + + QName type = propertyDefinition.getDataType().getName(); + if (ArrayUtils.contains(supportedDataTypes, type)) + { + Serializable propertyValue = nodeService.getProperty(actionedUponNodeRef, qname); + if (propertyValue != null) + { + result = propertyValue.toString(); + } + else + { + // set the result to the empty string + result = ""; + } + } + else + { + throw new AlfrescoRuntimeException("The property " + value + " is of type " + type.toString() + " which is not supported by parameter substitution."); + } + } + + return result; + } + + /** + * Set the maxmimum number of suggestions returned from the global property + * + * @param maximumNumberSuggestions + */ + public void setMaximumNumberSuggestions(int maximumNumberSuggestions) + { + this.maximumNumberSuggestions = (maximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS: maximumNumberSuggestions); + } + + /** + * Add suggestion definition to the list used to get properties suggestions from. + * + * @param definition Type or aspect + */ + public void addSuggestionDefinition(QName definition) + { + if(this.suggestionDefinitions == null) + { + this.suggestionDefinitions = Collections.synchronizedList(new ArrayList()); + } + this.suggestionDefinitions.add(definition); + } + + /** + * Get a list of node substitution suggestions for the specified fragment. + * + * @param substitutionFragment The fragment to search for + * @returns A list of node substitution suggestions, for example 'node.cm:title' + * + * @see org.alfresco.repo.action.parameter.ParameterSubstitutionSuggester#getSubstitutionSuggestions(java.lang.String) + */ + @Override + public List getSubstitutionSuggestions(String substitutionFragment) + { + Set suggestionSet = Collections.synchronizedSet(new HashSet()); + if(this.suggestionDefinitions != null) + { + for(QName definition : this.suggestionDefinitions) + { + if(getSubstitutionSuggestions(definition, substitutionFragment.toLowerCase(), suggestionSet)) + { + break; + } + } + } + List suggestions = new ArrayList(); + suggestions.addAll(suggestionSet); + Collections.sort(suggestions); + return suggestions; + } + + /** + * Get a list of node substitution suggestions for the given definition and specified fragment. + * + * @param definitionName Definition (aspect or type) to get properties of and the call this method for associated aspects + * @param substitutionFragment Substitution fragment to search for + * @param suggestions The current list of suggestions to which we will add newly found suggestions + */ + private boolean getSubstitutionSuggestions(QName definitionName, String substitutionFragment, Set suggestions) + { + boolean gotMaximumSuggestions = false; + ClassDefinition definition = this.dictionaryService.getAspect(definitionName); + if(definition == null) + { + definition = this.dictionaryService.getType(definitionName); + } + if(definition != null) + { + gotMaximumSuggestions = getSubstitutionSuggestionsForDefinition(definition, substitutionFragment, suggestions); + } + if(recordsManagementAdminService.isCustomisable(definitionName) && !gotMaximumSuggestions) + { + gotMaximumSuggestions = processPropertyDefinitions(recordsManagementAdminService.getCustomPropertyDefinitions(definitionName), substitutionFragment, suggestions); + } + return gotMaximumSuggestions; + } + + /** + * Get a list of node substitution suggestions for the given definition and specified fragment. Calls itself recursively for + * associated aspects. + * + * @param definition Definition (aspect or type) to get properties of and the call this method for associated aspects + * @param substitutionFragment Substitution fragment to search for + * @param suggestions The current list of suggestions to which we will add newly found suggestions + */ + private boolean getSubstitutionSuggestionsForDefinition(ClassDefinition definition, String substitutionFragment, Set suggestions) + { + boolean gotMaximumSuggestions = processPropertyDefinitions(definition.getProperties(), substitutionFragment, suggestions); + if(!gotMaximumSuggestions) + { + for(QName defaultAspect : definition.getDefaultAspectNames()) + { + gotMaximumSuggestions = getSubstitutionSuggestions(defaultAspect, substitutionFragment, suggestions); + if(gotMaximumSuggestions) + { + break; + } + } + } + return gotMaximumSuggestions; + } + + /** + * Process the supplied map of property definitions and add the ones that match the supplied fragment to the list of suggestions. + * + * @param definition Definition (aspect or type) to get properties of and the call this method for associated aspects + * @param substitutionFragment Substitution fragment to search for + * @param suggestions The current list of suggestions to which we will add newly found suggestions + */ + private boolean processPropertyDefinitions(Map properties, String substitutionFragment, Set suggestions) + { + boolean gotMaximumSuggestions = false; + if (properties != null) + { + for (Map.Entry entry : properties.entrySet()) + { + PropertyDefinition propertyDefinition = entry.getValue(); + QName type = propertyDefinition.getDataType().getName(); + if(ArrayUtils.contains(supportedDataTypes, type)) + { + String suggestion = getName() + "." + entry.getKey().getPrefixString(); + if(suggestion.toLowerCase().contains(substitutionFragment)) + { + if(suggestions.size() < this.maximumNumberSuggestions) + { + suggestions.add(suggestion); + } + else + { + gotMaximumSuggestions = true; + break; + } + } + } + } + } + return gotMaximumSuggestions; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java index 22a9588483..54990fedcf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/NodeParameterSuggesterBootstrap.java @@ -1,101 +1,101 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action.parameter; - -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; - -/** - * Record metadata bootstrap bean. - *

- * This method of bootstrapping record metadata aspects into the RecordService deprecates the - * previous practice of extending rma:recordMetaData. - * - * @author Mark Hibbins - * @since 2.2 - */ -public class NodeParameterSuggesterBootstrap -{ - /** namespace service */ - private NamespaceService namespaceService; - - /** configured node parameter processor aspect and type names, comma separated */ - private String nodeParameterProcessorAspectsNames; - - /** node parameter processor */ - private NodeParameterProcessor nodeParameterProcessor; - - /** - * @param recordMetadataAspects map of record metadata aspects against file plan types - */ - public void setNodeParameterProcessorAspects(String nodeParameterProcessorAspectsNames) - { - this.nodeParameterProcessorAspectsNames = nodeParameterProcessorAspectsNames; - } - - /** - * @param namespaceService namespace service - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * @param nodeParameterProcessor Node parameter processor - */ - public void setNodeParameterProcessor(NodeParameterProcessor nodeParameterProcessor) - { - this.nodeParameterProcessor = nodeParameterProcessor; - } - - /** - * Init method - */ - public void init() - { - ParameterCheck.mandatory("namespaceService", namespaceService); - - if (nodeParameterProcessorAspectsNames != null) - { - String[] aspectsNames = this.nodeParameterProcessorAspectsNames.split(","); - for (String name : aspectsNames) - { - if((name != null) && !"".equals(name.trim())) - { - // convert to qname and save it - QName aspect = QName.createQName(name.trim(), namespaceService); - - // register with node parameter processor - this.nodeParameterProcessor.addSuggestionDefinition(aspect); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action.parameter; + +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; + +/** + * Record metadata bootstrap bean. + *

+ * This method of bootstrapping record metadata aspects into the RecordService deprecates the + * previous practice of extending rma:recordMetaData. + * + * @author Mark Hibbins + * @since 2.2 + */ +public class NodeParameterSuggesterBootstrap +{ + /** namespace service */ + private NamespaceService namespaceService; + + /** configured node parameter processor aspect and type names, comma separated */ + private String nodeParameterProcessorAspectsNames; + + /** node parameter processor */ + private NodeParameterProcessor nodeParameterProcessor; + + /** + * @param recordMetadataAspects map of record metadata aspects against file plan types + */ + public void setNodeParameterProcessorAspects(String nodeParameterProcessorAspectsNames) + { + this.nodeParameterProcessorAspectsNames = nodeParameterProcessorAspectsNames; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param nodeParameterProcessor Node parameter processor + */ + public void setNodeParameterProcessor(NodeParameterProcessor nodeParameterProcessor) + { + this.nodeParameterProcessor = nodeParameterProcessor; + } + + /** + * Init method + */ + public void init() + { + ParameterCheck.mandatory("namespaceService", namespaceService); + + if (nodeParameterProcessorAspectsNames != null) + { + String[] aspectsNames = this.nodeParameterProcessorAspectsNames.split(","); + for (String name : aspectsNames) + { + if((name != null) && !"".equals(name.trim())) + { + // convert to qname and save it + QName aspect = QName.createQName(name.trim(), namespaceService); + + // register with node parameter processor + this.nodeParameterProcessor.addSuggestionDefinition(aspect); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessor.java index fb111af516..a6e7fdbe80 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessor.java @@ -1,103 +1,103 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action.parameter; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Abstract parameter processor implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public abstract class ParameterProcessor -{ - /** Processor name */ - private String name; - - /** Parameter processor component */ - private ParameterProcessorComponent parameterProcessorComponent; - - /** - * @return parameter processor name - */ - public String getName() - { - return name; - } - - /** - * @param name parameter processor name - */ - public void setName(String name) - { - this.name = name; - } - - /** - * @param parameterProcessorComponent parameter processor component - */ - public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) - { - this.parameterProcessorComponent = parameterProcessorComponent; - } - - /** - * Init method - */ - public void init() - { - parameterProcessorComponent.register(this); - } - - /** - * Process the parameter value. - * - * @param value substitution value - * @param actionedUponNodeRef actioned upon node reference - * @return String processed string, original string if subs string invalid - */ - public abstract String process(String value, NodeRef actionedUponNodeRef); - - /** - * Strips the name of the processor from the subs value. - * - * @param value subs value - * @return String subs value with the name and '.' delimiter removed - */ - protected String stripName(String value) - { - String result = ""; - String[] values = value.split("\\.", 2); - if (values.length == 2) - { - result = values[1]; - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action.parameter; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Abstract parameter processor implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public abstract class ParameterProcessor +{ + /** Processor name */ + private String name; + + /** Parameter processor component */ + private ParameterProcessorComponent parameterProcessorComponent; + + /** + * @return parameter processor name + */ + public String getName() + { + return name; + } + + /** + * @param name parameter processor name + */ + public void setName(String name) + { + this.name = name; + } + + /** + * @param parameterProcessorComponent parameter processor component + */ + public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) + { + this.parameterProcessorComponent = parameterProcessorComponent; + } + + /** + * Init method + */ + public void init() + { + parameterProcessorComponent.register(this); + } + + /** + * Process the parameter value. + * + * @param value substitution value + * @param actionedUponNodeRef actioned upon node reference + * @return String processed string, original string if subs string invalid + */ + public abstract String process(String value, NodeRef actionedUponNodeRef); + + /** + * Strips the name of the processor from the subs value. + * + * @param value subs value + * @return String subs value with the name and '.' delimiter removed + */ + protected String stripName(String value) + { + String result = ""; + String[] values = value.split("\\.", 2); + if (values.length == 2) + { + result = values[1]; + } + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java index 2aeb1b1bcf..1efdad721e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterProcessorComponent.java @@ -1,175 +1,175 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action.parameter; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.service.cmr.action.ParameterizedItem; -import org.alfresco.service.cmr.action.ParameterizedItemDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Parameter processor component - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ParameterProcessorComponent implements ParameterSubstitutionSuggester -{ - /** regex used to parse parameters */ - private static final String REG_EX_OLD = "\\$\\{([^\\$\\{]+)\\}"; - private static final String REG_EX = "\\{([^\\{]+)\\}"; - - /** registry of parameter processors */ - private Map processors = new HashMap(5); - private List subtitutionSuggesterProcessors = new ArrayList(5); - - /** - * Register parameter processor - * - * @param processor - */ - public void register(ParameterProcessor processor) - { - this.processors.put(processor.getName(), processor); - if(processor instanceof ParameterSubstitutionSuggester) - { - this.subtitutionSuggesterProcessors.add((ParameterSubstitutionSuggester)processor); - } - } - - /** - * - * @param ruleItem - * @param ruleItemDefinition - * @param actionedUponNodeRef - */ - public void process(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition, NodeRef actionedUponNodeRef) - { - for (Map.Entry entry : ruleItem.getParameterValues().entrySet()) - { - String parameterName = entry.getKey(); - Object parameterValue = entry.getValue(); - - // only sub string property values - if (parameterValue instanceof String) - { - // set the updated parameter value - ruleItem.setParameterValue(parameterName, process((String)parameterValue, actionedUponNodeRef)); - } - } - } - - /** - * Process the value for substitution within the context of the provided node. - * - * @param value value - * @param nodeRef node reference - * @return String resulting value - */ - public String process(String value, NodeRef nodeRef) - { - return process(process(value, nodeRef, REG_EX_OLD), nodeRef, REG_EX); - } - - public String process(String value, NodeRef nodeRef, String regExp) - { - // match the substitution pattern - Pattern patt = Pattern.compile(regExp); - Matcher m = patt.matcher(value); - StringBuffer sb = new StringBuffer(value.length()); - - while (m.find()) - { - String text = m.group(1); - - // lookup parameter processor to use - ParameterProcessor processor = lookupProcessor(text); - if (processor == null) - { - throw new AlfrescoRuntimeException("A parameter processor has not been found for the substitution string " + text); - } - else - { - // process each substitution value - text = processor.process(text, nodeRef); - } - - // append new value - m.appendReplacement(sb, Matcher.quoteReplacement(text)); - } - m.appendTail(sb); - return sb.toString(); - } - - /** - * Return a list of substitution suggestions for the passed string fragment. - * - * @param subtitutionFragment Text fragment to search on. - * @return A list of substitutions that match the substitution fragment. - */ - public List getSubstitutionSuggestions(final String substitutionFragment) - { - List suggestions = new ArrayList(); - for (ParameterSubstitutionSuggester suggestor : this.subtitutionSuggesterProcessors) - { - suggestions.addAll(suggestor.getSubstitutionSuggestions(substitutionFragment.toLowerCase())); - } - return suggestions; - } - - /** - * Look up parameter processor - * - * @param value - * @return - */ - private ParameterProcessor lookupProcessor(String value) - { - ParameterProcessor result = null; - - if (value != null && !value.isEmpty()) - { - String[] values = value.split("\\.", 2); - if (values.length != 0) - { - // get the processor from the registered map - result = processors.get(values[0]); - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action.parameter; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.service.cmr.action.ParameterizedItem; +import org.alfresco.service.cmr.action.ParameterizedItemDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Parameter processor component + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ParameterProcessorComponent implements ParameterSubstitutionSuggester +{ + /** regex used to parse parameters */ + private static final String REG_EX_OLD = "\\$\\{([^\\$\\{]+)\\}"; + private static final String REG_EX = "\\{([^\\{]+)\\}"; + + /** registry of parameter processors */ + private Map processors = new HashMap(5); + private List subtitutionSuggesterProcessors = new ArrayList(5); + + /** + * Register parameter processor + * + * @param processor + */ + public void register(ParameterProcessor processor) + { + this.processors.put(processor.getName(), processor); + if(processor instanceof ParameterSubstitutionSuggester) + { + this.subtitutionSuggesterProcessors.add((ParameterSubstitutionSuggester)processor); + } + } + + /** + * + * @param ruleItem + * @param ruleItemDefinition + * @param actionedUponNodeRef + */ + public void process(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition, NodeRef actionedUponNodeRef) + { + for (Map.Entry entry : ruleItem.getParameterValues().entrySet()) + { + String parameterName = entry.getKey(); + Object parameterValue = entry.getValue(); + + // only sub string property values + if (parameterValue instanceof String) + { + // set the updated parameter value + ruleItem.setParameterValue(parameterName, process((String)parameterValue, actionedUponNodeRef)); + } + } + } + + /** + * Process the value for substitution within the context of the provided node. + * + * @param value value + * @param nodeRef node reference + * @return String resulting value + */ + public String process(String value, NodeRef nodeRef) + { + return process(process(value, nodeRef, REG_EX_OLD), nodeRef, REG_EX); + } + + public String process(String value, NodeRef nodeRef, String regExp) + { + // match the substitution pattern + Pattern patt = Pattern.compile(regExp); + Matcher m = patt.matcher(value); + StringBuffer sb = new StringBuffer(value.length()); + + while (m.find()) + { + String text = m.group(1); + + // lookup parameter processor to use + ParameterProcessor processor = lookupProcessor(text); + if (processor == null) + { + throw new AlfrescoRuntimeException("A parameter processor has not been found for the substitution string " + text); + } + else + { + // process each substitution value + text = processor.process(text, nodeRef); + } + + // append new value + m.appendReplacement(sb, Matcher.quoteReplacement(text)); + } + m.appendTail(sb); + return sb.toString(); + } + + /** + * Return a list of substitution suggestions for the passed string fragment. + * + * @param subtitutionFragment Text fragment to search on. + * @return A list of substitutions that match the substitution fragment. + */ + public List getSubstitutionSuggestions(final String substitutionFragment) + { + List suggestions = new ArrayList(); + for (ParameterSubstitutionSuggester suggestor : this.subtitutionSuggesterProcessors) + { + suggestions.addAll(suggestor.getSubstitutionSuggestions(substitutionFragment.toLowerCase())); + } + return suggestions; + } + + /** + * Look up parameter processor + * + * @param value + * @return + */ + private ParameterProcessor lookupProcessor(String value) + { + ParameterProcessor result = null; + + if (value != null && !value.isEmpty()) + { + String[] values = value.split("\\.", 2); + if (values.length != 0) + { + // get the processor from the registered map + result = processors.get(values[0]); + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterSubstitutionSuggester.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterSubstitutionSuggester.java index b9026f84a8..64b4e7415d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterSubstitutionSuggester.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/action/parameter/ParameterSubstitutionSuggester.java @@ -1,37 +1,37 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action.parameter; - -import java.util.List; - -public interface ParameterSubstitutionSuggester -{ - int DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS = 10; - - List getSubstitutionSuggestions(final String substitutionFragment); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action.parameter; + +import java.util.List; + +public interface ParameterSubstitutionSuggester +{ + int DEFAULT_MAXIMUM_NUMBER_SUGGESTIONS = 10; + + List getSubstitutionSuggestions(final String substitutionFragment); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/imap/ExtendedImapServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/imap/ExtendedImapServiceImpl.java index de5bd649aa..974e07e3e5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/imap/ExtendedImapServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/imap/ExtendedImapServiceImpl.java @@ -4,36 +4,36 @@ * %% * Copyright (C) 2005 - 2016 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 + * 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.repo.imap; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; +package org.alfresco.repo.imap; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; /** * Extends the core service ImapServiceImpl functionality @@ -41,17 +41,17 @@ import org.alfresco.service.cmr.repository.NodeService; * @author Ana Bozianu * @since 2.4 * - */ -public class ExtendedImapServiceImpl extends ImapServiceImpl -{ - private NodeService nodeService; - private BehaviourFilter policyBehaviourFilter; + */ +public class ExtendedImapServiceImpl extends ImapServiceImpl +{ + private NodeService nodeService; + private BehaviourFilter policyBehaviourFilter; private DictionaryService dictionaryService; - private AuthenticationUtil authenticationUtil; - - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; + private AuthenticationUtil authenticationUtil; + + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; } public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) @@ -71,46 +71,46 @@ public class ExtendedImapServiceImpl extends ImapServiceImpl { this.nodeService = nodeService; super.setNodeService(nodeService); - } + } /** * Overwrites the core functionality so we can list RM files in IMAP * @see https://issues.alfresco.com/jira/browse/RM-3216 */ - @Override - public String getPathFromSites(final NodeRef ref) - { - return doAsSystem(new RunAsWork() - { - @Override - public String doWork() throws Exception - { - String name = ((String) nodeService.getProperty(ref, ContentModel.PROP_NAME)).toLowerCase(); - if (dictionaryService.isSubClass(nodeService.getType(ref), SiteModel.TYPE_SITE)) - { - return name; - } - else - { - NodeRef parent = nodeService.getPrimaryParent(ref).getParentRef(); - return getPathFromSites(parent) + "/" + name; - } - } - }); - } - - private R doAsSystem(RunAsWork work) - { - policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); - policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); - try - { - return authenticationUtil.runAsSystem(work); - } - finally - { - policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); - policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); - } - } -} + @Override + public String getPathFromSites(final NodeRef ref) + { + return doAsSystem(new RunAsWork() + { + @Override + public String doWork() throws Exception + { + String name = ((String) nodeService.getProperty(ref, ContentModel.PROP_NAME)).toLowerCase(); + if (dictionaryService.isSubClass(nodeService.getType(ref), SiteModel.TYPE_SITE)) + { + return name; + } + else + { + NodeRef parent = nodeService.getPrimaryParent(ref).getParentRef(); + return getPathFromSites(parent) + "/" + name; + } + } + }); + } + + private R doAsSystem(RunAsWork work) + { + policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); + policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); + try + { + return authenticationUtil.runAsSystem(work); + } + finally + { + policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_AUDITABLE); + policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/jscript/ExtendedSearch.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/jscript/ExtendedSearch.java index 53566fb571..1e17453f54 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/jscript/ExtendedSearch.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/jscript/ExtendedSearch.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.jscript; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.ParameterCheck; - -/** - * Extended jscript search implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedSearch extends Search -{ - /** - * Extended to take into account record read permission check. - * - * @see org.alfresco.repo.jscript.Search#findNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public ScriptNode findNode(NodeRef ref) - { - ParameterCheck.mandatory("ref", ref); - if (this.services.getNodeService().exists(ref) && - (this.services.getPermissionService().hasPermission(ref, PermissionService.READ) == AccessStatus.ALLOWED || - this.services.getPermissionService().hasPermission(ref, RMPermissionModel.READ_RECORDS) == AccessStatus.ALLOWED)) - { - return new ScriptNode(ref, this.services, getScope()); - } - return null; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.jscript; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.util.ParameterCheck; + +/** + * Extended jscript search implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ExtendedSearch extends Search +{ + /** + * Extended to take into account record read permission check. + * + * @see org.alfresco.repo.jscript.Search#findNode(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public ScriptNode findNode(NodeRef ref) + { + ParameterCheck.mandatory("ref", ref); + if (this.services.getNodeService().exists(ref) && + (this.services.getPermissionService().hasPermission(ref, PermissionService.READ) == AccessStatus.ALLOWED || + this.services.getPermissionService().hasPermission(ref, RMPermissionModel.READ_RECORDS) == AccessStatus.ALLOWED)) + { + return new ScriptNode(ref, this.services, getScope()); + } + return null; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/model/filefolder/ExtendedFileFolderServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/model/filefolder/ExtendedFileFolderServiceImpl.java index 8733ecfe02..b2783501b2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/model/filefolder/ExtendedFileFolderServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/model/filefolder/ExtendedFileFolderServiceImpl.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.model.filefolder; - -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - */ -public class ExtendedFileFolderServiceImpl extends FileFolderServiceImpl -{ - protected RecordService recordService; - - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - @Override - public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) - { - return create(parentNodeRef, name, typeQName, null); - } - - @Override - public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName, QName assocQName) - { - FileInfo result = null; - - recordService.disablePropertyEditableCheck(); - try - { - result = super.create(parentNodeRef, name, typeQName, assocQName); - } - finally - { - recordService.enablePropertyEditableCheck(); - if (result != null) - { - recordService.disablePropertyEditableCheck(result.getNodeRef()); - } - } - - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.model.filefolder; + +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * @author Roy Wetherall + */ +public class ExtendedFileFolderServiceImpl extends FileFolderServiceImpl +{ + protected RecordService recordService; + + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + @Override + public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) + { + return create(parentNodeRef, name, typeQName, null); + } + + @Override + public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName, QName assocQName) + { + FileInfo result = null; + + recordService.disablePropertyEditableCheck(); + try + { + result = super.create(parentNodeRef, name, typeQName, assocQName); + } + finally + { + recordService.enablePropertyEditableCheck(); + if (result != null) + { + recordService.disablePropertyEditableCheck(result.getNodeRef()); + } + } + + return result; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java index ca39aaa5de..e3a9b8a874 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java @@ -1,227 +1,227 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.rule; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.namespace.QName; - -/** - * Extended rule service implementation. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedRuleServiceImpl extends RuleServiceImpl -{ - /** indicates whether the rules should be run as admin or not */ - private boolean runAsAdmin = true; - - /** ignore types */ - private Set ignoredTypes = new HashSet(); - - /** file plan service */ - private FilePlanService filePlanService; - - /** node service */ - protected NodeService nodeService; - - /** Record service */ - protected RecordService recordService; - - /** - * @param nodeService node service - */ - public void setNodeService2(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param runAsAdmin true if run rules as admin, false otherwise - */ - public void setRunAsAdmin(boolean runAsAdmin) - { - this.runAsAdmin = runAsAdmin; - } - - /** - * Init method - */ - @Override - public void init() - { - super.init(); - - // Specify a set of system types to be ignored by rule executions - ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_SCHEDULE); - ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_ACTION); - ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION); - ignoredTypes.add(RecordsManagementModel.TYPE_EVENT_EXECUTION); - } - - /** - * @see org.alfresco.repo.rule.RuleServiceImpl#saveRule(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.rule.Rule) - */ - @Override - public void saveRule(final NodeRef nodeRef, final Rule rule) - { - if (filePlanService.isFilePlanComponent(nodeRef)) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - ExtendedRuleServiceImpl.super.saveRule(nodeRef, rule); - return null; - } - - }); - } - else - { - super.saveRule(nodeRef, rule); - } - } - - /** - * @see org.alfresco.repo.rule.RuleServiceImpl#removeRule(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.rule.Rule) - */ - @Override - public void removeRule(final NodeRef nodeRef, final Rule rule) - { - if (filePlanService.isFilePlanComponent(nodeRef)) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - ExtendedRuleServiceImpl.super.removeRule(nodeRef, rule); - return null; - } - - }); - } - else - { - super.removeRule(nodeRef, rule); - } - } - - /** - * @see org.alfresco.repo.rule.RuleServiceImpl#executeRule(org.alfresco.service.cmr.rule.Rule, org.alfresco.service.cmr.repository.NodeRef, java.util.Set) - */ - @Override - public void executeRule(final Rule rule, final NodeRef nodeRef, final Set executedRules) - { - if (nodeService.exists(nodeRef)) - { - QName typeQName = nodeService.getType(nodeRef); - - // check if this is a rm rule on a rm artifact - if (filePlanService.isFilePlanComponent(nodeRef) && - isFilePlanComponentRule(rule)) - { - // ignore and - if (!isIgnoredType(typeQName)) - { - if (runAsAdmin) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() - { - ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules); - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - else - { - // run as current user - super.executeRule(rule, nodeRef, executedRules); - } - } - } - else - { - // just execute the rule as the current user - super.executeRule(rule, nodeRef, executedRules); - } - } - } - - /** - * Indicates whether the rule is a file plan component - * - * @param rule rule - * @return boolean true if rule is set on a file plan component, false otherwise - */ - private boolean isFilePlanComponentRule(Rule rule) - { - NodeRef nodeRef = getOwningNodeRef(rule); - return filePlanService.isFilePlanComponent(nodeRef); - } - - /** - * @param typeQName type qname - * @return boolean true if ignore type, false otherwise - */ - private boolean isIgnoredType(QName typeQName) - { - return ignoredTypes.contains(typeQName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.rule; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.rule.Rule; +import org.alfresco.service.namespace.QName; + +/** + * Extended rule service implementation. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ExtendedRuleServiceImpl extends RuleServiceImpl +{ + /** indicates whether the rules should be run as admin or not */ + private boolean runAsAdmin = true; + + /** ignore types */ + private Set ignoredTypes = new HashSet(); + + /** file plan service */ + private FilePlanService filePlanService; + + /** node service */ + protected NodeService nodeService; + + /** Record service */ + protected RecordService recordService; + + /** + * @param nodeService node service + */ + public void setNodeService2(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param recordService record service + */ + public void setRecordService(RecordService recordService) + { + this.recordService = recordService; + } + + /** + * @param runAsAdmin true if run rules as admin, false otherwise + */ + public void setRunAsAdmin(boolean runAsAdmin) + { + this.runAsAdmin = runAsAdmin; + } + + /** + * Init method + */ + @Override + public void init() + { + super.init(); + + // Specify a set of system types to be ignored by rule executions + ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_SCHEDULE); + ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_ACTION); + ignoredTypes.add(RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION); + ignoredTypes.add(RecordsManagementModel.TYPE_EVENT_EXECUTION); + } + + /** + * @see org.alfresco.repo.rule.RuleServiceImpl#saveRule(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.rule.Rule) + */ + @Override + public void saveRule(final NodeRef nodeRef, final Rule rule) + { + if (filePlanService.isFilePlanComponent(nodeRef)) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + ExtendedRuleServiceImpl.super.saveRule(nodeRef, rule); + return null; + } + + }); + } + else + { + super.saveRule(nodeRef, rule); + } + } + + /** + * @see org.alfresco.repo.rule.RuleServiceImpl#removeRule(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.rule.Rule) + */ + @Override + public void removeRule(final NodeRef nodeRef, final Rule rule) + { + if (filePlanService.isFilePlanComponent(nodeRef)) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + ExtendedRuleServiceImpl.super.removeRule(nodeRef, rule); + return null; + } + + }); + } + else + { + super.removeRule(nodeRef, rule); + } + } + + /** + * @see org.alfresco.repo.rule.RuleServiceImpl#executeRule(org.alfresco.service.cmr.rule.Rule, org.alfresco.service.cmr.repository.NodeRef, java.util.Set) + */ + @Override + public void executeRule(final Rule rule, final NodeRef nodeRef, final Set executedRules) + { + if (nodeService.exists(nodeRef)) + { + QName typeQName = nodeService.getType(nodeRef); + + // check if this is a rm rule on a rm artifact + if (filePlanService.isFilePlanComponent(nodeRef) && + isFilePlanComponentRule(rule)) + { + // ignore and + if (!isIgnoredType(typeQName)) + { + if (runAsAdmin) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() + { + ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules); + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + else + { + // run as current user + super.executeRule(rule, nodeRef, executedRules); + } + } + } + else + { + // just execute the rule as the current user + super.executeRule(rule, nodeRef, executedRules); + } + } + } + + /** + * Indicates whether the rule is a file plan component + * + * @param rule rule + * @return boolean true if rule is set on a file plan component, false otherwise + */ + private boolean isFilePlanComponentRule(Rule rule) + { + NodeRef nodeRef = getOwningNodeRef(rule); + return filePlanService.isFilePlanComponent(nodeRef); + } + + /** + * @param typeQName type qname + * @return boolean true if ignore type, false otherwise + */ + private boolean isIgnoredType(QName typeQName) + { + return ignoredTypes.contains(typeQName); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java index 51957d5712..4bc45f2292 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java @@ -1,112 +1,112 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.rule.ruletrigger; - -import java.util.Set; - -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.transaction.TransactionalResourceHelper; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Prevent multiple triggering of outbound rules when moving records. - * - * @author Roy Wetherall - */ -public class ExtendedBeforeDeleteChildAssociationRuleTrigger - extends RuleTriggerAbstractBase - implements NodeServicePolicies.BeforeDeleteChildAssociationPolicy -{ - /** - * The logger - */ - private static Log logger = LogFactory.getLog(BeforeDeleteChildAssociationRuleTrigger.class); - - private static final String POLICY = "beforeDeleteChildAssociation"; - - private boolean isClassBehaviour = false; - - public void setIsClassBehaviour(boolean isClassBehaviour) - { - this.isClassBehaviour = isClassBehaviour; - } - - /** - * @see org.alfresco.repo.rule.ruletrigger.RuleTrigger#registerRuleTrigger() - */ - public void registerRuleTrigger() - { - if (isClassBehaviour) - { - this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), - this, - new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT)); - } - else - { - this.policyComponent.bindAssociationBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), - this, - new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT)); - } - } - - public void beforeDeleteChildAssociation(ChildAssociationRef childAssocRef) - { - // Break out early if rules are not enabled - if (!areRulesEnabled()) - { - return; - } - - NodeRef childNodeRef = childAssocRef.getChildRef(); - - // Avoid renamed nodes - Set renamedNodeRefSet = TransactionalResourceHelper.getSet(RULE_TRIGGER_RENAMED_NODES); - if (renamedNodeRefSet.contains(childNodeRef)) - { - return; - } - - if (logger.isDebugEnabled()) - { - logger.debug("Single child assoc trigger (policy = " + POLICY + ") fired for parent node " + childAssocRef.getParentRef() + " and child node " + childAssocRef.getChildRef()); - } - - triggerRules(childAssocRef.getParentRef(), childNodeRef); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.rule.ruletrigger; + +import java.util.Set; + +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.transaction.TransactionalResourceHelper; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Prevent multiple triggering of outbound rules when moving records. + * + * @author Roy Wetherall + */ +public class ExtendedBeforeDeleteChildAssociationRuleTrigger + extends RuleTriggerAbstractBase + implements NodeServicePolicies.BeforeDeleteChildAssociationPolicy +{ + /** + * The logger + */ + private static Log logger = LogFactory.getLog(BeforeDeleteChildAssociationRuleTrigger.class); + + private static final String POLICY = "beforeDeleteChildAssociation"; + + private boolean isClassBehaviour = false; + + public void setIsClassBehaviour(boolean isClassBehaviour) + { + this.isClassBehaviour = isClassBehaviour; + } + + /** + * @see org.alfresco.repo.rule.ruletrigger.RuleTrigger#registerRuleTrigger() + */ + public void registerRuleTrigger() + { + if (isClassBehaviour) + { + this.policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), + this, + new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT)); + } + else + { + this.policyComponent.bindAssociationBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), + this, + new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT)); + } + } + + public void beforeDeleteChildAssociation(ChildAssociationRef childAssocRef) + { + // Break out early if rules are not enabled + if (!areRulesEnabled()) + { + return; + } + + NodeRef childNodeRef = childAssocRef.getChildRef(); + + // Avoid renamed nodes + Set renamedNodeRefSet = TransactionalResourceHelper.getSet(RULE_TRIGGER_RENAMED_NODES); + if (renamedNodeRefSet.contains(childNodeRef)) + { + return; + } + + if (logger.isDebugEnabled()) + { + logger.debug("Single child assoc trigger (policy = " + POLICY + ") fired for parent node " + childAssocRef.getParentRef() + " and child node " + childAssocRef.getChildRef()); + } + + triggerRules(childAssocRef.getParentRef(), childNodeRef); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthority.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthority.java index 5a75c88640..b6695bbcc5 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthority.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthority.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.authority; - -/** - * Interface for defining constants - * - * @author Tuna Aksoy - * @since 2.1 - */ -public interface RMAuthority -{ - /** - * The default rm zone. - */ - String ZONE_APP_RM = "APP.RM"; - - /** - * The constant for all roles display name - */ - String ALL_ROLES_DISPLAY_NAME = "All Roles"; - - /** - * The constant for all roles prefix - */ - String ALL_ROLES_PREFIX = "AllRoles"; -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.authority; + +/** + * Interface for defining constants + * + * @author Tuna Aksoy + * @since 2.1 + */ +public interface RMAuthority +{ + /** + * The default rm zone. + */ + String ZONE_APP_RM = "APP.RM"; + + /** + * The constant for all roles display name + */ + String ALL_ROLES_DISPLAY_NAME = "All Roles"; + + /** + * The constant for all roles prefix + */ + String ALL_ROLES_PREFIX = "AllRoles"; +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthorityDAOImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthorityDAOImpl.java index c2ef61f507..0387654942 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthorityDAOImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/authority/RMAuthorityDAOImpl.java @@ -1,90 +1,90 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.authority; - -import java.util.Set; -import java.util.regex.Pattern; - -import org.alfresco.service.cmr.security.AuthorityType; - -/** - * This class extends {@link AuthorityDAOImpl}
- * and overrides two methods from the original class
- *
- * addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type)
- *
- * and
- *
- * addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type, Pattern pattern)
- */ -public class RMAuthorityDAOImpl extends AuthorityDAOImpl -{ - protected void addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type) - { - if (isAuthorityNameMatching(authorityName, type)) - { - authorities.add(authorityName); - } - } - - protected void addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type, Pattern pattern) - { - if (isAuthorityNameMatching(authorityName, type)) - { - if (pattern == null) - { - authorities.add(authorityName); - } - else - { - if (pattern.matcher(getShortName(authorityName)).matches()) - { - authorities.add(authorityName); - } - else - { - String displayName = getAuthorityDisplayName(authorityName); - if (displayName != null && pattern.matcher(displayName).matches()) - { - authorities.add(authorityName); - } - } - } - } - } - - private boolean isAuthorityNameMatching(String authorityName, AuthorityType type) - { - boolean isMatching = false; - if (type == null || AuthorityType.getAuthorityType(authorityName).equals(type) && !getAuthorityZones(authorityName).contains("APP.RM")) - { - isMatching = true; - } - return isMatching; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.authority; + +import java.util.Set; +import java.util.regex.Pattern; + +import org.alfresco.service.cmr.security.AuthorityType; + +/** + * This class extends {@link AuthorityDAOImpl}
+ * and overrides two methods from the original class
+ *
+ * addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type)
+ *
+ * and
+ *
+ * addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type, Pattern pattern)
+ */ +public class RMAuthorityDAOImpl extends AuthorityDAOImpl +{ + protected void addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type) + { + if (isAuthorityNameMatching(authorityName, type)) + { + authorities.add(authorityName); + } + } + + protected void addAuthorityNameIfMatches(Set authorities, String authorityName, AuthorityType type, Pattern pattern) + { + if (isAuthorityNameMatching(authorityName, type)) + { + if (pattern == null) + { + authorities.add(authorityName); + } + else + { + if (pattern.matcher(getShortName(authorityName)).matches()) + { + authorities.add(authorityName); + } + else + { + String displayName = getAuthorityDisplayName(authorityName); + if (displayName != null && pattern.matcher(displayName).matches()) + { + authorities.add(authorityName); + } + } + } + } + } + + private boolean isAuthorityNameMatching(String authorityName, AuthorityType type) + { + boolean isMatching = false; + if (type == null || AuthorityType.getAuthorityType(authorityName).equals(type) && !getAuthorityZones(authorityName).contains("APP.RM")) + { + isMatching = true; + } + return isMatching; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java index a7f1e5a5d2..8ebd67cddb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionService.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.impl; - -import java.util.Set; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.Pair; - -/** - * Extended Permission Service Interface used in RM. - * - * @author Roy Wetherall - * @since 2.1 - */ -public interface ExtendedPermissionService extends PermissionService -{ - /** - * Get a set of all the authorities that have write access. - * - * @param aclId acl id - * @return {@link Set}<{@link String}> set of authorities with write access - */ - Set getWriters(Long aclId); - - /** - * Get the readers and writers for a given node. - *

- * The writers list includes the owner for the node. - * - * @param nodeRef node reference - * @return Pair, Set> first is a set containing all the authorities that have read permission on the - * document and second is a set containing all the authorities that have write - * permission on the document, including the owner. - * - * @since 2.5 - */ - Pair, Set> getReadersAndWriters(NodeRef nodeRef); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.impl; + +import java.util.Set; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.util.Pair; + +/** + * Extended Permission Service Interface used in RM. + * + * @author Roy Wetherall + * @since 2.1 + */ +public interface ExtendedPermissionService extends PermissionService +{ + /** + * Get a set of all the authorities that have write access. + * + * @param aclId acl id + * @return {@link Set}<{@link String}> set of authorities with write access + */ + Set getWriters(Long aclId); + + /** + * Get the readers and writers for a given node. + *

+ * The writers list includes the owner for the node. + * + * @param nodeRef node reference + * @return Pair, Set> first is a set containing all the authorities that have read permission on the + * document and second is a set containing all the authorities that have write + * permission on the document, including the owner. + * + * @since 2.5 + */ + Pair, Set> getReadersAndWriters(NodeRef nodeRef); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java index c0ad905d28..8309c84f44 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImpl.java @@ -1,386 +1,386 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.impl; - -import static org.apache.commons.lang.StringUtils.isNotBlank; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.repo.cache.SimpleCache; -import org.alfresco.repo.security.permissions.AccessControlEntry; -import org.alfresco.repo.security.permissions.AccessControlList; -import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; -import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; -import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.Pair; -import org.alfresco.util.PropertyCheck; -import org.apache.commons.lang.StringUtils; -import org.springframework.context.ApplicationEvent; - -/** - * Extends the core permission service implementation allowing the consideration of the read records permission. - *

- * This is required for SOLR support. - * - * @author Roy Wetherall - */ -public class ExtendedPermissionServiceImpl extends PermissionServiceImpl implements ExtendedPermissionService -{ - /** Writers simple cache */ - protected SimpleCache> writersCache; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Permission processor registry */ - private PermissionProcessorRegistry permissionProcessorRegistry; - - /** - * Gets the file plan service - * - * @return the filePlanService - */ - public FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * Sets the file plan service - * - * @param filePlanService the filePlanService to set - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * Sets the permission processor registry - * - * @param permissionProcessorRegistry the permissions processor registry - */ - public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry) - { - this.permissionProcessorRegistry = permissionProcessorRegistry; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setAnyDenyDenies(boolean) - */ - @Override - public void setAnyDenyDenies(boolean anyDenyDenies) - { - super.setAnyDenyDenies(anyDenyDenies); - if (writersCache != null) - { - writersCache.clear(); - } - } - - /** - * @param writersCache the writersCache to set - */ - public void setWritersCache(SimpleCache> writersCache) - { - this.writersCache = writersCache; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#onBootstrap(org.springframework.context.ApplicationEvent) - */ - @Override - protected void onBootstrap(ApplicationEvent event) - { - super.onBootstrap(event); - PropertyCheck.mandatory(this, "writersCache", writersCache); - } - - /** - * Override to deal with the possibility of hard coded permission checks in core code. Note: Eventually we need to - * merge the RM permission model into the core to make this more robust. - * - * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#hasPermission(org.alfresco.service.cmr.repository.NodeRef, - * java.lang.String) - */ - @Override - public AccessStatus hasPermission(NodeRef nodeRef, String perm) - { - AccessStatus result = AccessStatus.UNDETERMINED; - if (nodeService.exists(nodeRef)) - { - // permission pre-processors - List preProcessors = permissionProcessorRegistry.getPermissionPreProcessors(); - for (PermissionPreProcessor preProcessor : preProcessors) - { - // pre process permission - result = preProcessor.process(nodeRef, perm); - - // veto if denied - if (AccessStatus.DENIED.equals(result)) { return result; } - } - - // evaluate permission - result = hasPermissionImpl(nodeRef, perm); - - // permission post-processors - List postProcessors = permissionProcessorRegistry.getPermissionPostProcessors(); - for (PermissionPostProcessor postProcessor : postProcessors) - { - // post process permission - result = postProcessor.process(result, nodeRef, perm); - } - } - return result; - } - - /** - * Implementation of hasPermission method call. - *

- * Separation also convenient for unit testing. - * - * @param nodeRef node reference - * @param perm permission - * @return {@link AccessStatus} access status result - */ - protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) - { - return super.hasPermission(nodeRef, perm); - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#canRead(java.lang.Long) - */ - @Override - protected AccessStatus canRead(Long aclId) - { - Set authorities = getAuthorisations(); - - // test denied - - if (anyDenyDenies) - { - - Set aclReadersDenied = getReadersDenied(aclId); - - for (String auth : aclReadersDenied) - { - if (authorities.contains(auth)) { return AccessStatus.DENIED; } - } - - } - - // test acl readers - Set aclReaders = getReaders(aclId); - - for (String auth : aclReaders) - { - if (authorities.contains(auth)) { return AccessStatus.ALLOWED; } - } - - return AccessStatus.DENIED; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#getReaders(java.lang.Long) - */ - @Override - public Set getReaders(Long aclId) - { - AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); - if (acl == null) { return Collections.emptySet(); } - - Set aclReaders = readersCache.get((Serializable) acl.getProperties()); - if (aclReaders != null) { return aclReaders; } - - HashSet assigned = new HashSet(); - HashSet readers = new HashSet(); - - for (AccessControlEntry ace : acl.getEntries()) - { - assigned.add(ace.getAuthority()); - } - - for (String authority : assigned) - { - UnconditionalAclTest test = new UnconditionalAclTest(getPermissionReference(PermissionService.READ)); - UnconditionalAclTest rmTest = new UnconditionalAclTest( - getPermissionReference(RMPermissionModel.READ_RECORDS)); - if (test.evaluate(authority, aclId) || rmTest.evaluate(authority, aclId)) - { - readers.add(authority); - } - } - - aclReaders = Collections.unmodifiableSet(readers); - readersCache.put((Serializable) acl.getProperties(), aclReaders); - return aclReaders; - } - - /** - * Override with check for RM read - * - * @param aclId - * @return - */ - public Set getReadersDenied(Long aclId) - { - AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); - - if (acl == null) { return Collections.emptySet(); } - Set denied = readersDeniedCache.get(aclId); - if (denied != null) { return denied; } - denied = new HashSet(); - Set assigned = new HashSet(); - - for (AccessControlEntry ace : acl.getEntries()) - { - assigned.add(ace.getAuthority()); - } - - for (String authority : assigned) - { - UnconditionalDeniedAclTest test = new UnconditionalDeniedAclTest( - getPermissionReference(PermissionService.READ)); - UnconditionalDeniedAclTest rmTest = new UnconditionalDeniedAclTest( - getPermissionReference(RMPermissionModel.READ_RECORDS)); - if (test.evaluate(authority, aclId) || rmTest.evaluate(authority, aclId)) - { - denied.add(authority); - } - } - - readersDeniedCache.put((Serializable) acl.getProperties(), denied); - - return denied; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#getWriters(java.lang.Long) - */ - public Set getWriters(Long aclId) - { - AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); - if (acl == null) { return Collections.emptySet(); } - - Set aclWriters = writersCache.get((Serializable) acl.getProperties()); - if (aclWriters != null) { return aclWriters; } - - HashSet assigned = new HashSet(); - HashSet readers = new HashSet(); - - for (AccessControlEntry ace : acl.getEntries()) - { - assigned.add(ace.getAuthority()); - } - - for (String authority : assigned) - { - UnconditionalAclTest test = new UnconditionalAclTest(getPermissionReference(PermissionService.WRITE)); - if (test.evaluate(authority, aclId)) - { - readers.add(authority); - } - } - - aclWriters = Collections.unmodifiableSet(readers); - writersCache.put((Serializable) acl.getProperties(), aclWriters); - return aclWriters; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setInheritParentPermissions(org.alfresco.service.cmr.repository.NodeRef, - * boolean) - */ - @Override - public void setInheritParentPermissions(final NodeRef nodeRef, boolean inheritParentPermissions) - { - final String adminRole = getAdminRole(nodeRef); - if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && isNotBlank(adminRole) - && !inheritParentPermissions) - { - setPermission(nodeRef, adminRole, RMPermissionModel.FILING, true); - } - super.setInheritParentPermissions(nodeRef, inheritParentPermissions); - } - - /** - * Helper method to the RM admin role scoped by the correct file plan. - * - * @param nodeRef node reference - * @return String RM admin role - */ - private String getAdminRole(NodeRef nodeRef) - { - String adminRole = null; - NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); - if (filePlan != null) - { - adminRole = authorityService.getName(AuthorityType.GROUP, - FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); - } - return adminRole; - } - - /** - * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#getReadersAndWriters(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Pair, Set> getReadersAndWriters(NodeRef nodeRef) - { - // get the documents readers - Long aclId = nodeService.getNodeAclId(nodeRef); - Set readers = getReaders(aclId); - Set writers = getWriters(aclId); - - // add the current owner to the list of extended writers - Set modifiedWrtiers = new HashSet(writers); - String owner = ownableService.getOwner(nodeRef); - if (StringUtils.isNotBlank(owner) && - !owner.equals(OwnableService.NO_OWNER) && - authorityService.authorityExists(owner)) - { - modifiedWrtiers.add(owner); - } - - return new Pair, Set> (readers, modifiedWrtiers); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.impl; + +import static org.apache.commons.lang.StringUtils.isNotBlank; + +import java.io.Serializable; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.repo.cache.SimpleCache; +import org.alfresco.repo.security.permissions.AccessControlEntry; +import org.alfresco.repo.security.permissions.AccessControlList; +import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; +import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; +import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.util.Pair; +import org.alfresco.util.PropertyCheck; +import org.apache.commons.lang.StringUtils; +import org.springframework.context.ApplicationEvent; + +/** + * Extends the core permission service implementation allowing the consideration of the read records permission. + *

+ * This is required for SOLR support. + * + * @author Roy Wetherall + */ +public class ExtendedPermissionServiceImpl extends PermissionServiceImpl implements ExtendedPermissionService +{ + /** Writers simple cache */ + protected SimpleCache> writersCache; + + /** File plan service */ + private FilePlanService filePlanService; + + /** Permission processor registry */ + private PermissionProcessorRegistry permissionProcessorRegistry; + + /** + * Gets the file plan service + * + * @return the filePlanService + */ + public FilePlanService getFilePlanService() + { + return this.filePlanService; + } + + /** + * Sets the file plan service + * + * @param filePlanService the filePlanService to set + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * Sets the permission processor registry + * + * @param permissionProcessorRegistry the permissions processor registry + */ + public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry) + { + this.permissionProcessorRegistry = permissionProcessorRegistry; + } + + /** + * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setAnyDenyDenies(boolean) + */ + @Override + public void setAnyDenyDenies(boolean anyDenyDenies) + { + super.setAnyDenyDenies(anyDenyDenies); + if (writersCache != null) + { + writersCache.clear(); + } + } + + /** + * @param writersCache the writersCache to set + */ + public void setWritersCache(SimpleCache> writersCache) + { + this.writersCache = writersCache; + } + + /** + * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#onBootstrap(org.springframework.context.ApplicationEvent) + */ + @Override + protected void onBootstrap(ApplicationEvent event) + { + super.onBootstrap(event); + PropertyCheck.mandatory(this, "writersCache", writersCache); + } + + /** + * Override to deal with the possibility of hard coded permission checks in core code. Note: Eventually we need to + * merge the RM permission model into the core to make this more robust. + * + * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#hasPermission(org.alfresco.service.cmr.repository.NodeRef, + * java.lang.String) + */ + @Override + public AccessStatus hasPermission(NodeRef nodeRef, String perm) + { + AccessStatus result = AccessStatus.UNDETERMINED; + if (nodeService.exists(nodeRef)) + { + // permission pre-processors + List preProcessors = permissionProcessorRegistry.getPermissionPreProcessors(); + for (PermissionPreProcessor preProcessor : preProcessors) + { + // pre process permission + result = preProcessor.process(nodeRef, perm); + + // veto if denied + if (AccessStatus.DENIED.equals(result)) { return result; } + } + + // evaluate permission + result = hasPermissionImpl(nodeRef, perm); + + // permission post-processors + List postProcessors = permissionProcessorRegistry.getPermissionPostProcessors(); + for (PermissionPostProcessor postProcessor : postProcessors) + { + // post process permission + result = postProcessor.process(result, nodeRef, perm); + } + } + return result; + } + + /** + * Implementation of hasPermission method call. + *

+ * Separation also convenient for unit testing. + * + * @param nodeRef node reference + * @param perm permission + * @return {@link AccessStatus} access status result + */ + protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) + { + return super.hasPermission(nodeRef, perm); + } + + /** + * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#canRead(java.lang.Long) + */ + @Override + protected AccessStatus canRead(Long aclId) + { + Set authorities = getAuthorisations(); + + // test denied + + if (anyDenyDenies) + { + + Set aclReadersDenied = getReadersDenied(aclId); + + for (String auth : aclReadersDenied) + { + if (authorities.contains(auth)) { return AccessStatus.DENIED; } + } + + } + + // test acl readers + Set aclReaders = getReaders(aclId); + + for (String auth : aclReaders) + { + if (authorities.contains(auth)) { return AccessStatus.ALLOWED; } + } + + return AccessStatus.DENIED; + } + + /** + * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#getReaders(java.lang.Long) + */ + @Override + public Set getReaders(Long aclId) + { + AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); + if (acl == null) { return Collections.emptySet(); } + + Set aclReaders = readersCache.get((Serializable) acl.getProperties()); + if (aclReaders != null) { return aclReaders; } + + HashSet assigned = new HashSet(); + HashSet readers = new HashSet(); + + for (AccessControlEntry ace : acl.getEntries()) + { + assigned.add(ace.getAuthority()); + } + + for (String authority : assigned) + { + UnconditionalAclTest test = new UnconditionalAclTest(getPermissionReference(PermissionService.READ)); + UnconditionalAclTest rmTest = new UnconditionalAclTest( + getPermissionReference(RMPermissionModel.READ_RECORDS)); + if (test.evaluate(authority, aclId) || rmTest.evaluate(authority, aclId)) + { + readers.add(authority); + } + } + + aclReaders = Collections.unmodifiableSet(readers); + readersCache.put((Serializable) acl.getProperties(), aclReaders); + return aclReaders; + } + + /** + * Override with check for RM read + * + * @param aclId + * @return + */ + public Set getReadersDenied(Long aclId) + { + AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); + + if (acl == null) { return Collections.emptySet(); } + Set denied = readersDeniedCache.get(aclId); + if (denied != null) { return denied; } + denied = new HashSet(); + Set assigned = new HashSet(); + + for (AccessControlEntry ace : acl.getEntries()) + { + assigned.add(ace.getAuthority()); + } + + for (String authority : assigned) + { + UnconditionalDeniedAclTest test = new UnconditionalDeniedAclTest( + getPermissionReference(PermissionService.READ)); + UnconditionalDeniedAclTest rmTest = new UnconditionalDeniedAclTest( + getPermissionReference(RMPermissionModel.READ_RECORDS)); + if (test.evaluate(authority, aclId) || rmTest.evaluate(authority, aclId)) + { + denied.add(authority); + } + } + + readersDeniedCache.put((Serializable) acl.getProperties(), denied); + + return denied; + } + + /** + * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#getWriters(java.lang.Long) + */ + public Set getWriters(Long aclId) + { + AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); + if (acl == null) { return Collections.emptySet(); } + + Set aclWriters = writersCache.get((Serializable) acl.getProperties()); + if (aclWriters != null) { return aclWriters; } + + HashSet assigned = new HashSet(); + HashSet readers = new HashSet(); + + for (AccessControlEntry ace : acl.getEntries()) + { + assigned.add(ace.getAuthority()); + } + + for (String authority : assigned) + { + UnconditionalAclTest test = new UnconditionalAclTest(getPermissionReference(PermissionService.WRITE)); + if (test.evaluate(authority, aclId)) + { + readers.add(authority); + } + } + + aclWriters = Collections.unmodifiableSet(readers); + writersCache.put((Serializable) acl.getProperties(), aclWriters); + return aclWriters; + } + + /** + * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setInheritParentPermissions(org.alfresco.service.cmr.repository.NodeRef, + * boolean) + */ + @Override + public void setInheritParentPermissions(final NodeRef nodeRef, boolean inheritParentPermissions) + { + final String adminRole = getAdminRole(nodeRef); + if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && isNotBlank(adminRole) + && !inheritParentPermissions) + { + setPermission(nodeRef, adminRole, RMPermissionModel.FILING, true); + } + super.setInheritParentPermissions(nodeRef, inheritParentPermissions); + } + + /** + * Helper method to the RM admin role scoped by the correct file plan. + * + * @param nodeRef node reference + * @return String RM admin role + */ + private String getAdminRole(NodeRef nodeRef) + { + String adminRole = null; + NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef); + if (filePlan != null) + { + adminRole = authorityService.getName(AuthorityType.GROUP, + FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); + } + return adminRole; + } + + /** + * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#getReadersAndWriters(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public Pair, Set> getReadersAndWriters(NodeRef nodeRef) + { + // get the documents readers + Long aclId = nodeService.getNodeAclId(nodeRef); + Set readers = getReaders(aclId); + Set writers = getWriters(aclId); + + // add the current owner to the list of extended writers + Set modifiedWrtiers = new HashSet(writers); + String owner = ownableService.getOwner(nodeRef); + if (StringUtils.isNotBlank(owner) && + !owner.equals(OwnableService.NO_OWNER) && + authorityService.authorityExists(owner)) + { + modifiedWrtiers.add(owner); + } + + return new Pair, Set> (readers, modifiedWrtiers); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/acegi/RMACLEntryVoter.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/acegi/RMACLEntryVoter.java index 7b1d481fa2..5049db4359 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/acegi/RMACLEntryVoter.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/impl/acegi/RMACLEntryVoter.java @@ -1,60 +1,60 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.impl.acegi; - -import java.lang.reflect.Method; - -import org.alfresco.service.cmr.security.OwnableService; - -/** - * This is a workaround to make RM 2.1 backwards compatible with the Community version 4.2.d. - * This class will be removed after Community 4.2.e has been released. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RMACLEntryVoter extends ACLEntryVoter -{ - public void setOwnableService(OwnableService ownableService) - { - boolean exists = false; - Method[] declaredMethods = ACLEntryVoter.class.getDeclaredMethods(); - for (Method method : declaredMethods) - { - if (method.getName().equals("setOwnableService")) - { - exists = true; - break; - } - } - if (exists) - { - super.setOwnableService(ownableService); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.impl.acegi; + +import java.lang.reflect.Method; + +import org.alfresco.service.cmr.security.OwnableService; + +/** + * This is a workaround to make RM 2.1 backwards compatible with the Community version 4.2.d. + * This class will be removed after Community 4.2.e has been released. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RMACLEntryVoter extends ACLEntryVoter +{ + public void setOwnableService(OwnableService ownableService) + { + boolean exists = false; + Method[] declaredMethods = ACLEntryVoter.class.getDeclaredMethods(); + for (Method method : declaredMethods) + { + if (method.getName().equals("setOwnableService")) + { + exists = true; + break; + } + } + if (exists) + { + super.setOwnableService(ownableService); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPostProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPostProcessor.java index 5db3ccac0b..5740594975 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPostProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPostProcessor.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - - - -/** - * Permission Post Processor. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public interface PermissionPostProcessor -{ - /** - * Process permission. - * - * @param accessStatus current access status - * @param nodeRef node reference - * @param perm permission - * @return {@link AccessStatus} - */ - AccessStatus process(AccessStatus accessStatus, NodeRef nodeRef, String perm); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; + + + +/** + * Permission Post Processor. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public interface PermissionPostProcessor +{ + /** + * Process permission. + * + * @param accessStatus current access status + * @param nodeRef node reference + * @param perm permission + * @return {@link AccessStatus} + */ + AccessStatus process(AccessStatus accessStatus, NodeRef nodeRef, String perm); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java index 30452c9c42..7af0bcb60f 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionPreProcessor.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - - -/** - * Permission Veto Interface - * - * @author Roy Wetherall - * @since 2.4.a - */ -public interface PermissionPreProcessor -{ - /** - * Process permission. - * - * @param accessStatus current access status - * @param nodeRef node reference - * @param perm permission - * @return {@link AccessStatus} - */ - AccessStatus process(NodeRef nodeRef, String perm); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; + + +/** + * Permission Veto Interface + * + * @author Roy Wetherall + * @since 2.4.a + */ +public interface PermissionPreProcessor +{ + /** + * Process permission. + * + * @param accessStatus current access status + * @param nodeRef node reference + * @param perm permission + * @return {@link AccessStatus} + */ + AccessStatus process(NodeRef nodeRef, String perm); + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java index 3866a943c5..60d4e27f5a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/PermissionProcessorRegistry.java @@ -1,86 +1,86 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor; - -import java.util.ArrayList; -import java.util.List; - -/** - * Permission Processor Registry - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class PermissionProcessorRegistry -{ - /** permission pre-processors */ - private List permissionPreProcessors = new ArrayList(); - - /** permission post-processors */ - private List permissionPostProcessors = new ArrayList(); - - /** - * Add a permission pre-processor. - * - * @param permissionPreProcessor permission pre-processor - */ - public void addPermissionPreProcessor(PermissionPreProcessor permissionPreProcessor) - { - permissionPreProcessors.add(permissionPreProcessor); - } - - /** - * Add a permission post-processor. - * - * @param permissionPostProcessor permission post-processor - */ - public void addPermissionPostProcessor(PermissionPostProcessor permissionPostProcessor) - { - permissionPostProcessors.add(permissionPostProcessor); - } - - /** - * Get a list of the registered permission pre-processors. - * - * @return {@link List}<{@link PermissionPreProcessor}> list of permission pre-processors - */ - public List getPermissionPreProcessors() - { - return permissionPreProcessors; - } - - /** - * Get a list of the registered permission post-processors. - * - * @return <{@link List}>{@link PermissionPreProcessor} list of permission post-processors - */ - public List getPermissionPostProcessors() - { - return permissionPostProcessors; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor; + +import java.util.ArrayList; +import java.util.List; + +/** + * Permission Processor Registry + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class PermissionProcessorRegistry +{ + /** permission pre-processors */ + private List permissionPreProcessors = new ArrayList(); + + /** permission post-processors */ + private List permissionPostProcessors = new ArrayList(); + + /** + * Add a permission pre-processor. + * + * @param permissionPreProcessor permission pre-processor + */ + public void addPermissionPreProcessor(PermissionPreProcessor permissionPreProcessor) + { + permissionPreProcessors.add(permissionPreProcessor); + } + + /** + * Add a permission post-processor. + * + * @param permissionPostProcessor permission post-processor + */ + public void addPermissionPostProcessor(PermissionPostProcessor permissionPostProcessor) + { + permissionPostProcessors.add(permissionPostProcessor); + } + + /** + * Get a list of the registered permission pre-processors. + * + * @return {@link List}<{@link PermissionPreProcessor}> list of permission pre-processors + */ + public List getPermissionPreProcessors() + { + return permissionPreProcessors; + } + + /** + * Get a list of the registered permission post-processors. + * + * @return <{@link List}>{@link PermissionPreProcessor} list of permission post-processors + */ + public List getPermissionPostProcessors() + { + return permissionPostProcessors; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java index d63d6e28e0..77c0e677ff 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPostProcessorBaseImpl.java @@ -1,51 +1,51 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor.impl; - -import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; - -/** - * Permission post processor base implementation. - *

- * Helper class that can be extended when providing a custom permission - * post processor implementation. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public abstract class PermissionPostProcessorBaseImpl extends PermissionProcessorBaseImpl - implements PermissionPostProcessor -{ - /** - * Init method to add this permission extensions to the registry - */ - public void init() - { - getPermissionProcessorRegistry().addPermissionPostProcessor(this); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor.impl; + +import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; + +/** + * Permission post processor base implementation. + *

+ * Helper class that can be extended when providing a custom permission + * post processor implementation. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public abstract class PermissionPostProcessorBaseImpl extends PermissionProcessorBaseImpl + implements PermissionPostProcessor +{ + /** + * Init method to add this permission extensions to the registry + */ + public void init() + { + getPermissionProcessorRegistry().addPermissionPostProcessor(this); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java index ae2fe03677..68694182d3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionPreProcessorBaseImpl.java @@ -1,51 +1,51 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor.impl; - -import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; - -/** - * Permission pre-processor base implementation. - *

- * Helper class that can be extended when providing a custom permission - * pre-processor implementation. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public abstract class PermissionPreProcessorBaseImpl extends PermissionProcessorBaseImpl - implements PermissionPreProcessor -{ - /** - * Init method to add this permission extensions to the registry - */ - public void init() - { - getPermissionProcessorRegistry().addPermissionPreProcessor(this); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor.impl; + +import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; + +/** + * Permission pre-processor base implementation. + *

+ * Helper class that can be extended when providing a custom permission + * pre-processor implementation. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public abstract class PermissionPreProcessorBaseImpl extends PermissionProcessorBaseImpl + implements PermissionPreProcessor +{ + /** + * Init method to add this permission extensions to the registry + */ + public void init() + { + getPermissionProcessorRegistry().addPermissionPreProcessor(this); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java index 75ced4e1dc..0e416b37d8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/security/permissions/processor/impl/PermissionProcessorBaseImpl.java @@ -1,58 +1,58 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor.impl; - -import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; - -/** - * Commonality found in both pre and post permission processor implementations. - * - * @author Roy Wetherall - * @since 2.4.a - */ -/*package*/ abstract class PermissionProcessorBaseImpl -{ - /** permission processor registry */ - private PermissionProcessorRegistry permissionProcessorRegistry; - - /** - * @param PermissionProcessorRegistry permission processor registry - */ - public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry) - { - this.permissionProcessorRegistry = permissionProcessorRegistry; - } - - /** - * @return {@link PermissionProcessorRegistry} permission processor registry - */ - protected PermissionProcessorRegistry getPermissionProcessorRegistry() - { - return permissionProcessorRegistry; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.processor.impl; + +import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; + +/** + * Commonality found in both pre and post permission processor implementations. + * + * @author Roy Wetherall + * @since 2.4.a + */ +/*package*/ abstract class PermissionProcessorBaseImpl +{ + /** permission processor registry */ + private PermissionProcessorRegistry permissionProcessorRegistry; + + /** + * @param PermissionProcessorRegistry permission processor registry + */ + public void setPermissionProcessorRegistry(PermissionProcessorRegistry permissionProcessorRegistry) + { + this.permissionProcessorRegistry = permissionProcessorRegistry; + } + + /** + * @return {@link PermissionProcessorRegistry} permission processor registry + */ + protected PermissionProcessorRegistry getPermissionProcessorRegistry() + { + return permissionProcessorRegistry; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java index 3690d2bedb..3819c2be1e 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java @@ -1,250 +1,250 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.dictionary; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Webscript to get the Classdefinitions using classfilter , namespaceprefix and name - * - * This class makes it possible to get only RM related class definitions - * @see ClassesGet for the original implementation - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmClassesGet extends DictionaryWebServiceBase implements RecordsManagementModel -{ - private static final String MODEL_PROP_KEY_CLASS_DEFS = "classdefs"; - private static final String MODEL_PROP_KEY_PROPERTY_DETAILS = "propertydefs"; - private static final String MODEL_PROP_KEY_ASSOCIATION_DETAILS = "assocdefs"; - - private static final String CLASS_FILTER_OPTION_TYPE1 = "all"; - private static final String CLASS_FILTER_OPTION_TYPE2 = "aspect"; - private static final String CLASS_FILTER_OPTION_TYPE3 = "type"; - - private static final String REQ_URL_TEMPL_VAR_CLASS_FILTER = "cf"; - private static final String REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX = "nsp"; - private static final String REQ_URL_TEMPL_VAR_NAME = "n"; - - /** Site service*/ - private SiteService siteService; - - /** - * @param siteService the site service to set - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - return executeImpl(req, RmDictionaryWebServiceUtils.isRmSite(req, siteService)); - } - - /** - * Execute custom Java logic - * - * @param req Web Script request - * @param isRM indicates whether the request comes from an RM site or not - * @return custom service model - */ - private Map executeImpl(WebScriptRequest req, boolean isRM) - { - String classFilter = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_CLASS_FILTER)); - String namespacePrefix = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX)); - String name = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_NAME)); - String className = null; - - Map classdef = new HashMap(); - Map> propdef = new HashMap>(); - Map> assocdef = new HashMap>(); - Map model = new HashMap(); - - List qnames = new ArrayList(); - QName classQname = null; - QName myModel = null; - - //if classfilter is not given, then it defaults to all - if (classFilter == null) - { - classFilter = "all"; - } - - //validate classfilter - if (!isValidClassFilter(classFilter)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the classfilter - " + classFilter + " provided in the URL"); - } - - //name alone has no meaning without namespaceprefix - if (namespacePrefix == null && name != null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Missing namespaceprefix parameter in the URL - both combination of name and namespaceprefix is needed"); - } - - //validate the namespaceprefix and name parameters => if namespaceprefix is given, then name has to be validated along with it - if (namespacePrefix != null) - { - //validate name parameter if present along with the namespaceprefix - if (name != null) - { - className = namespacePrefix + "_" + name; - if (!isValidClassname(className)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the name - " + name + "parameter in the URL"); - } - classQname = QName.createQName(getFullNamespaceURI(className)); - classdef.put(classQname, this.dictionaryservice.getClass(classQname)); - propdef.put(classQname, this.dictionaryservice.getClass(classQname).getProperties().values()); - assocdef.put(classQname, this.dictionaryservice.getClass(classQname).getAssociations().values()); - } - else - { - //if name is not given then the model is extracted from the namespaceprefix, there can be more than one model associated with one namespaceprefix - String namespaceUri = namespaceService.getNamespaceURI(namespacePrefix); - for (QName qnameObj : this.dictionaryservice.getAllModels()) - { - if (qnameObj.getNamespaceURI().equals(namespaceUri)) - { - name = qnameObj.getLocalName(); - myModel = QName.createQName(getFullNamespaceURI(namespacePrefix + "_" + name)); - - // check the classfilter to pull out either all or type or aspects - if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE1)) - { - qnames.addAll(this.dictionaryservice.getAspects(myModel)); - qnames.addAll(this.dictionaryservice.getTypes(myModel)); - } - else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE3)) - { - qnames.addAll(this.dictionaryservice.getTypes(myModel)); - } - else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE2)) - { - qnames.addAll(this.dictionaryservice.getAspects(myModel)); - } - } - } - } - } - - // if namespacePrefix is null, then check the class filter to pull out either all, type or aspects - if (myModel == null) - { - if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE1)) - { - qnames.addAll(getAspects(isRM)); - qnames.addAll(getTypes(isRM)); - } - else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE3)) - { - qnames.addAll(getTypes(isRM)); - } - else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE2)) - { - qnames.addAll(getAspects(isRM)); - } - } - - if (classdef.isEmpty()) - { - for (QName qnameObj : qnames) - { - classdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj)); - propdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj).getProperties().values()); - assocdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj).getAssociations().values()); - } - } - - List classDefinitions = new ArrayList(classdef.values()); - Collections.sort(classDefinitions, new DictionaryComparators.ClassDefinitionComparator(dictionaryservice)); - model.put(MODEL_PROP_KEY_CLASS_DEFS, classDefinitions); - model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, propdef.values()); - model.put(MODEL_PROP_KEY_ASSOCIATION_DETAILS, assocdef.values()); - model.put(MODEL_PROP_KEY_MESSAGE_LOOKUP, dictionaryservice); - - return model; - } - - /** - * Returns the names of the types depending on {@link isRM} parameter - * - * @param isRM if true only RM related types will be retrieved - * @return The names of the types defined within the specified model or all of them depending on {@link isRM} parameter - */ - private Collection getTypes(boolean isRM) - { - if (isRM) - { - return this.dictionaryservice.getTypes(RM_MODEL); - } - else - { - return this.dictionaryservice.getAllTypes(); - } - } - - /** - * Returns the names of the aspects depending on {@link isRM} parameter - * - * @param isRM if true only RM related aspects will be retrieved - * @return The names of the aspects defined within the specified model or all of them depending on {@link isRM} parameter - */ - private Collection getAspects(boolean isRM) - { - if (isRM) - { - return this.dictionaryservice.getAspects(RM_MODEL); - } - else - { - return this.dictionaryservice.getAllAspects(); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.dictionary; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.ClassDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Webscript to get the Classdefinitions using classfilter , namespaceprefix and name + * + * This class makes it possible to get only RM related class definitions + * @see ClassesGet for the original implementation + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmClassesGet extends DictionaryWebServiceBase implements RecordsManagementModel +{ + private static final String MODEL_PROP_KEY_CLASS_DEFS = "classdefs"; + private static final String MODEL_PROP_KEY_PROPERTY_DETAILS = "propertydefs"; + private static final String MODEL_PROP_KEY_ASSOCIATION_DETAILS = "assocdefs"; + + private static final String CLASS_FILTER_OPTION_TYPE1 = "all"; + private static final String CLASS_FILTER_OPTION_TYPE2 = "aspect"; + private static final String CLASS_FILTER_OPTION_TYPE3 = "type"; + + private static final String REQ_URL_TEMPL_VAR_CLASS_FILTER = "cf"; + private static final String REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX = "nsp"; + private static final String REQ_URL_TEMPL_VAR_NAME = "n"; + + /** Site service*/ + private SiteService siteService; + + /** + * @param siteService the site service to set + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + return executeImpl(req, RmDictionaryWebServiceUtils.isRmSite(req, siteService)); + } + + /** + * Execute custom Java logic + * + * @param req Web Script request + * @param isRM indicates whether the request comes from an RM site or not + * @return custom service model + */ + private Map executeImpl(WebScriptRequest req, boolean isRM) + { + String classFilter = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_CLASS_FILTER)); + String namespacePrefix = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX)); + String name = getValidInput(req.getParameter(REQ_URL_TEMPL_VAR_NAME)); + String className = null; + + Map classdef = new HashMap(); + Map> propdef = new HashMap>(); + Map> assocdef = new HashMap>(); + Map model = new HashMap(); + + List qnames = new ArrayList(); + QName classQname = null; + QName myModel = null; + + //if classfilter is not given, then it defaults to all + if (classFilter == null) + { + classFilter = "all"; + } + + //validate classfilter + if (!isValidClassFilter(classFilter)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the classfilter - " + classFilter + " provided in the URL"); + } + + //name alone has no meaning without namespaceprefix + if (namespacePrefix == null && name != null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Missing namespaceprefix parameter in the URL - both combination of name and namespaceprefix is needed"); + } + + //validate the namespaceprefix and name parameters => if namespaceprefix is given, then name has to be validated along with it + if (namespacePrefix != null) + { + //validate name parameter if present along with the namespaceprefix + if (name != null) + { + className = namespacePrefix + "_" + name; + if (!isValidClassname(className)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the name - " + name + "parameter in the URL"); + } + classQname = QName.createQName(getFullNamespaceURI(className)); + classdef.put(classQname, this.dictionaryservice.getClass(classQname)); + propdef.put(classQname, this.dictionaryservice.getClass(classQname).getProperties().values()); + assocdef.put(classQname, this.dictionaryservice.getClass(classQname).getAssociations().values()); + } + else + { + //if name is not given then the model is extracted from the namespaceprefix, there can be more than one model associated with one namespaceprefix + String namespaceUri = namespaceService.getNamespaceURI(namespacePrefix); + for (QName qnameObj : this.dictionaryservice.getAllModels()) + { + if (qnameObj.getNamespaceURI().equals(namespaceUri)) + { + name = qnameObj.getLocalName(); + myModel = QName.createQName(getFullNamespaceURI(namespacePrefix + "_" + name)); + + // check the classfilter to pull out either all or type or aspects + if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE1)) + { + qnames.addAll(this.dictionaryservice.getAspects(myModel)); + qnames.addAll(this.dictionaryservice.getTypes(myModel)); + } + else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE3)) + { + qnames.addAll(this.dictionaryservice.getTypes(myModel)); + } + else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE2)) + { + qnames.addAll(this.dictionaryservice.getAspects(myModel)); + } + } + } + } + } + + // if namespacePrefix is null, then check the class filter to pull out either all, type or aspects + if (myModel == null) + { + if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE1)) + { + qnames.addAll(getAspects(isRM)); + qnames.addAll(getTypes(isRM)); + } + else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE3)) + { + qnames.addAll(getTypes(isRM)); + } + else if (classFilter.equalsIgnoreCase(CLASS_FILTER_OPTION_TYPE2)) + { + qnames.addAll(getAspects(isRM)); + } + } + + if (classdef.isEmpty()) + { + for (QName qnameObj : qnames) + { + classdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj)); + propdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj).getProperties().values()); + assocdef.put(qnameObj, this.dictionaryservice.getClass(qnameObj).getAssociations().values()); + } + } + + List classDefinitions = new ArrayList(classdef.values()); + Collections.sort(classDefinitions, new DictionaryComparators.ClassDefinitionComparator(dictionaryservice)); + model.put(MODEL_PROP_KEY_CLASS_DEFS, classDefinitions); + model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, propdef.values()); + model.put(MODEL_PROP_KEY_ASSOCIATION_DETAILS, assocdef.values()); + model.put(MODEL_PROP_KEY_MESSAGE_LOOKUP, dictionaryservice); + + return model; + } + + /** + * Returns the names of the types depending on {@link isRM} parameter + * + * @param isRM if true only RM related types will be retrieved + * @return The names of the types defined within the specified model or all of them depending on {@link isRM} parameter + */ + private Collection getTypes(boolean isRM) + { + if (isRM) + { + return this.dictionaryservice.getTypes(RM_MODEL); + } + else + { + return this.dictionaryservice.getAllTypes(); + } + } + + /** + * Returns the names of the aspects depending on {@link isRM} parameter + * + * @param isRM if true only RM related aspects will be retrieved + * @return The names of the aspects defined within the specified model or all of them depending on {@link isRM} parameter + */ + private Collection getAspects(boolean isRM) + { + if (isRM) + { + return this.dictionaryservice.getAspects(RM_MODEL); + } + else + { + return this.dictionaryservice.getAllAspects(); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java index 188f1486aa..3779c0c953 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.dictionary; - -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Util class for dictionary web services - * - * @author Tuna Aksoy - * @since 2.1 - */ -public final class RmDictionaryWebServiceUtils -{ - private static final String SITE_ID = "siteId"; - private static final String SITE_PRESET = "rm-site-dashboard"; - - private RmDictionaryWebServiceUtils() - { - // Will not be called - } - - public static boolean isRmSite(WebScriptRequest req, SiteService siteService) - { - boolean isRmSite = false; - String siteId = req.getParameter(SITE_ID); - if (StringUtils.isNotBlank(siteId)) - { - SiteInfo site = siteService.getSite(siteId); - if (site != null && site.getSitePreset().equals(SITE_PRESET)) - { - isRmSite = true; - } - } - return isRmSite; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.dictionary; + +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Util class for dictionary web services + * + * @author Tuna Aksoy + * @since 2.1 + */ +public final class RmDictionaryWebServiceUtils +{ + private static final String SITE_ID = "siteId"; + private static final String SITE_PRESET = "rm-site-dashboard"; + + private RmDictionaryWebServiceUtils() + { + // Will not be called + } + + public static boolean isRmSite(WebScriptRequest req, SiteService siteService) + { + boolean isRmSite = false; + String siteId = req.getParameter(SITE_ID); + if (StringUtils.isNotBlank(siteId)) + { + SiteInfo site = siteService.getSite(siteId); + if (site != null && site.getSitePreset().equals(SITE_PRESET)) + { + isRmSite = true; + } + } + return isRmSite; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java index 76aa7fddbb..a5c2be97e9 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java @@ -1,184 +1,184 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.dictionary; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Webscript to get the Propertydefinitions for a given classname eg. =>cm_person - * - * This class makes it possible to get only RM related property definitions - * @see PropertiesGet for the original implementation - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmPropertiesGet extends DictionaryWebServiceBase implements RecordsManagementModel -{ - private static final String MODEL_PROP_KEY_PROPERTY_DETAILS = "propertydefs"; - private static final String DICTIONARY_CLASS_NAME = "classname"; - private static final String PARAM_NAME = "name"; - private static final String REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX = "nsp"; - - /** Site service*/ - private SiteService siteService; - - /** - * @param siteService the site service to set - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - return executeImpl(req, RmDictionaryWebServiceUtils.isRmSite(req, siteService)); - } - - /** - * Execute custom Java logic - * - * @param req Web Script request - * @param isRM indicates whether the request comes from an RM site or not - * @return custom service model - */ - private Map executeImpl(WebScriptRequest req, boolean isRM) - { - QName classQName = null; - String className = req.getServiceMatch().getTemplateVars().get(DICTIONARY_CLASS_NAME); - if (className != null && className.length() != 0) - { - classQName = createClassQName(className); - if (classQName == null) - { - // Error - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the className - " + className + " - parameter in the URL"); - } - } - - String[] names = req.getParameterValues(PARAM_NAME); - - String namespacePrefix = req.getParameter(REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX); - String namespaceURI = null; - if (namespacePrefix != null) - { - namespaceURI = this.namespaceService.getNamespaceURI(namespacePrefix); - } - - Map propMap = null; - if (classQName == null) - { - if (names != null) - { - propMap = new HashMap(names.length); - for (String name : names) - { - QName propQName = QName.createQName(name, namespaceService); - PropertyDefinition propDef = dictionaryservice.getProperty(propQName); - if (propDef != null) - { - propMap.put(propQName, propDef); - } - } - } - else - { - Collection propQNames = getProperties(isRM); - propMap = new HashMap(propQNames.size()); - for (QName propQName : propQNames) - { - propMap.put(propQName, dictionaryservice.getProperty(propQName)); - } - } - - } - else - { - // Get all the property definitions for the class - propMap = dictionaryservice.getClass(classQName).getProperties(); - } - - // Filter the properties by URI - List props = new ArrayList(propMap.size()); - for (Map.Entry entry : propMap.entrySet()) - { - if ((namespaceURI != null && - namespaceURI.equals(entry.getKey().getNamespaceURI())) || - namespaceURI == null) - { - props.add(entry.getValue()); - } - } - - // Order property definitions by title - Collections.sort(props, new DictionaryComparators.PropertyDefinitionComparator(dictionaryservice)); - - // Pass list of property definitions to template - Map model = new HashMap(); - model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, props); - model.put(MODEL_PROP_KEY_MESSAGE_LOOKUP, dictionaryservice); - - return model; - } - - /** - * Returns the names of the properties depending on {@link isRM} parameter - * - * @param isRM if true only RM related properties will be retrieved - * @return The names of the properties defined within the specified model or all of them depending on {@link isRM} parameter - */ - private Collection getProperties(boolean isRM) - { - if (isRM) - { - return dictionaryservice.getProperties(RM_MODEL); - } - else - { - return dictionaryservice.getAllProperties(null); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.dictionary; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Webscript to get the Propertydefinitions for a given classname eg. =>cm_person + * + * This class makes it possible to get only RM related property definitions + * @see PropertiesGet for the original implementation + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmPropertiesGet extends DictionaryWebServiceBase implements RecordsManagementModel +{ + private static final String MODEL_PROP_KEY_PROPERTY_DETAILS = "propertydefs"; + private static final String DICTIONARY_CLASS_NAME = "classname"; + private static final String PARAM_NAME = "name"; + private static final String REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX = "nsp"; + + /** Site service*/ + private SiteService siteService; + + /** + * @param siteService the site service to set + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + return executeImpl(req, RmDictionaryWebServiceUtils.isRmSite(req, siteService)); + } + + /** + * Execute custom Java logic + * + * @param req Web Script request + * @param isRM indicates whether the request comes from an RM site or not + * @return custom service model + */ + private Map executeImpl(WebScriptRequest req, boolean isRM) + { + QName classQName = null; + String className = req.getServiceMatch().getTemplateVars().get(DICTIONARY_CLASS_NAME); + if (className != null && className.length() != 0) + { + classQName = createClassQName(className); + if (classQName == null) + { + // Error + throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the className - " + className + " - parameter in the URL"); + } + } + + String[] names = req.getParameterValues(PARAM_NAME); + + String namespacePrefix = req.getParameter(REQ_URL_TEMPL_VAR_NAMESPACE_PREFIX); + String namespaceURI = null; + if (namespacePrefix != null) + { + namespaceURI = this.namespaceService.getNamespaceURI(namespacePrefix); + } + + Map propMap = null; + if (classQName == null) + { + if (names != null) + { + propMap = new HashMap(names.length); + for (String name : names) + { + QName propQName = QName.createQName(name, namespaceService); + PropertyDefinition propDef = dictionaryservice.getProperty(propQName); + if (propDef != null) + { + propMap.put(propQName, propDef); + } + } + } + else + { + Collection propQNames = getProperties(isRM); + propMap = new HashMap(propQNames.size()); + for (QName propQName : propQNames) + { + propMap.put(propQName, dictionaryservice.getProperty(propQName)); + } + } + + } + else + { + // Get all the property definitions for the class + propMap = dictionaryservice.getClass(classQName).getProperties(); + } + + // Filter the properties by URI + List props = new ArrayList(propMap.size()); + for (Map.Entry entry : propMap.entrySet()) + { + if ((namespaceURI != null && + namespaceURI.equals(entry.getKey().getNamespaceURI())) || + namespaceURI == null) + { + props.add(entry.getValue()); + } + } + + // Order property definitions by title + Collections.sort(props, new DictionaryComparators.PropertyDefinitionComparator(dictionaryservice)); + + // Pass list of property definitions to template + Map model = new HashMap(); + model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, props); + model.put(MODEL_PROP_KEY_MESSAGE_LOOKUP, dictionaryservice); + + return model; + } + + /** + * Returns the names of the properties depending on {@link isRM} parameter + * + * @param isRM if true only RM related properties will be retrieved + * @return The names of the properties defined within the specified model or all of them depending on {@link isRM} parameter + */ + private Collection getProperties(boolean isRM) + { + if (isRM) + { + return dictionaryservice.getProperties(RM_MODEL); + } + else + { + return dictionaryservice.getAllProperties(null); + } + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/AbstractRmAuthorities.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/AbstractRmAuthorities.java index 89f2250579..283a2af7fa 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/AbstractRmAuthorities.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/AbstractRmAuthorities.java @@ -1,108 +1,108 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.roles; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.script.admin.RoleDeclarativeWebScript; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Abstract class for adding/removing a user/group to/from a role - * This class contains the common methods needed in the sub classes. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class AbstractRmAuthorities extends RoleDeclarativeWebScript -{ - /** Constants for the url parameters */ - private static final String ROLE_ID = "roleId"; - private static final String AUTHORITY_NAME = "authorityName"; - - /** - * Util method for getting the nodeRef from the request - * - * @param req The webscript request - * @return The nodeRef passed in the request - */ - protected NodeRef getFilePlan(WebScriptRequest req) - { - NodeRef filePlan = super.getFilePlan(req); - if (filePlan == null) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No filePlan was provided on the URL."); - } - return filePlan; - } - - /** - * Util method for getting the roleId from the request - * - * @param req The webscript request - * @return The role id passed in the request - */ - protected String getRoleId(WebScriptRequest req) - { - return getParamValue(req, ROLE_ID); - } - - /** - * Util method for getting the authorityName from the request - * - * @param req The webscript request - * @return The authorityName passed in the request - */ - protected String getAuthorityName(WebScriptRequest req) - { - return getParamValue(req, AUTHORITY_NAME); - } - - /** - * Helper method to get the value of parameter from the request - * - * @param req The webscript request - * @param param The name of the parameter for which the value is requested - * @return The value for the requested parameter - */ - private String getParamValue(WebScriptRequest req, String param) - { - Map templateVars = req.getServiceMatch().getTemplateVars(); - - String authorityName = templateVars.get(param); - if (StringUtils.isBlank(authorityName)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "No '" + param + "' was provided on the URL."); - } - return authorityName; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.roles; + +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.script.admin.RoleDeclarativeWebScript; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Abstract class for adding/removing a user/group to/from a role + * This class contains the common methods needed in the sub classes. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class AbstractRmAuthorities extends RoleDeclarativeWebScript +{ + /** Constants for the url parameters */ + private static final String ROLE_ID = "roleId"; + private static final String AUTHORITY_NAME = "authorityName"; + + /** + * Util method for getting the nodeRef from the request + * + * @param req The webscript request + * @return The nodeRef passed in the request + */ + protected NodeRef getFilePlan(WebScriptRequest req) + { + NodeRef filePlan = super.getFilePlan(req); + if (filePlan == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "No filePlan was provided on the URL."); + } + return filePlan; + } + + /** + * Util method for getting the roleId from the request + * + * @param req The webscript request + * @return The role id passed in the request + */ + protected String getRoleId(WebScriptRequest req) + { + return getParamValue(req, ROLE_ID); + } + + /** + * Util method for getting the authorityName from the request + * + * @param req The webscript request + * @return The authorityName passed in the request + */ + protected String getAuthorityName(WebScriptRequest req) + { + return getParamValue(req, AUTHORITY_NAME); + } + + /** + * Helper method to get the value of parameter from the request + * + * @param req The webscript request + * @param param The name of the parameter for which the value is requested + * @return The value for the requested parameter + */ + private String getParamValue(WebScriptRequest req, String param) + { + Map templateVars = req.getServiceMatch().getTemplateVars(); + + String authorityName = templateVars.get(param); + if (StringUtils.isBlank(authorityName)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "No '" + param + "' was provided on the URL."); + } + return authorityName; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesDelete.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesDelete.java index 070c8526f4..acf693861b 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesDelete.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesDelete.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.roles; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Webscript for removing a user or a group from a role - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmAuthoritiesDelete extends AbstractRmAuthorities -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - NodeRef filePlan = getFilePlan(req); - String roleId = getRoleId(req); - String authorityName = getAuthorityName(req); - - filePlanRoleService.unassignRoleFromAuthority(filePlan, roleId, authorityName); - - return new HashMap(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.roles; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Webscript for removing a user or a group from a role + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmAuthoritiesDelete extends AbstractRmAuthorities +{ + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + NodeRef filePlan = getFilePlan(req); + String roleId = getRoleId(req); + String authorityName = getAuthorityName(req); + + filePlanRoleService.unassignRoleFromAuthority(filePlan, roleId, authorityName); + + return new HashMap(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesPost.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesPost.java index cccacfd536..047c3b1db8 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesPost.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/roles/RmAuthoritiesPost.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.roles; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Webscript for adding a user or a group to a role - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmAuthoritiesPost extends AbstractRmAuthorities -{ - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - NodeRef filePlan = getFilePlan(req); - String roleId = getRoleId(req); - String authorityName = getAuthorityName(req); - - filePlanRoleService.assignRoleToAuthority(filePlan, roleId, authorityName); - - return new HashMap(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.roles; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Webscript for adding a user or a group to a role + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmAuthoritiesPost extends AbstractRmAuthorities +{ + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + NodeRef filePlan = getFilePlan(req); + String roleId = getRoleId(req); + String authorityName = getAuthorityName(req); + + filePlanRoleService.assignRoleToAuthority(filePlan, roleId, authorityName); + + return new HashMap(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java index e6f2e56e37..3bf63e0563 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java @@ -1,90 +1,90 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.rule; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.service.cmr.action.ActionConditionDefinition; -import org.alfresco.service.cmr.action.ActionService; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get the RM related action condition definition list. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RmActionConditionDefinitionsGet extends DeclarativeWebScript -{ - private ActionService actionService; - - private RecordsManagementActionService recordsManagementActionService; - - public void setActionService(ActionService actionService) - { - this.actionService = actionService; - } - - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - List dmDefs = actionService.getActionConditionDefinitions(); - List conditions = recordsManagementActionService.getRecordsManagementActionConditions(); - - List defs = new ArrayList(dmDefs.size()+conditions.size()); - defs.addAll(dmDefs); - for (RecordsManagementActionCondition condition: conditions) - { - if (condition.isPublicCondition()) - { - defs.add(condition.getRecordsManagementActionConditionDefinition()); - } - } - - Map model = new HashMap(); - model.put("actionconditiondefinitions", defs); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.rule; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionCondition; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.service.cmr.action.ActionConditionDefinition; +import org.alfresco.service.cmr.action.ActionService; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to get the RM related action condition definition list. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RmActionConditionDefinitionsGet extends DeclarativeWebScript +{ + private ActionService actionService; + + private RecordsManagementActionService recordsManagementActionService; + + public void setActionService(ActionService actionService) + { + this.actionService = actionService; + } + + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + List dmDefs = actionService.getActionConditionDefinitions(); + List conditions = recordsManagementActionService.getRecordsManagementActionConditions(); + + List defs = new ArrayList(dmDefs.size()+conditions.size()); + defs.addAll(dmDefs); + for (RecordsManagementActionCondition condition: conditions) + { + if (condition.isPublicCondition()) + { + defs.add(condition.getRecordsManagementActionConditionDefinition()); + } + } + + Map model = new HashMap(); + model.put("actionconditiondefinitions", defs); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java index 9e6afe8458..cfb176e6a2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java @@ -1,80 +1,80 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.rule; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get the RM related action definition list. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmActionDefinitionsGet extends DeclarativeWebScript -{ - private RecordsManagementActionService recordsManagementActionService; - - public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) - { - this.recordsManagementActionService = recordsManagementActionService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - List actions = recordsManagementActionService.getRecordsManagementActions(); - Set defs = new HashSet(actions.size()); - for (RecordsManagementAction action : actions) - { - if (action.isPublicAction()) - { - defs.add(action.getRecordsManagementActionDefinition()); - } - } - - Map model = new HashMap(); - model.put("actiondefinitions", defs); - - return model; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.rule; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.service.cmr.action.ActionDefinition; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to get the RM related action definition list. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmActionDefinitionsGet extends DeclarativeWebScript +{ + private RecordsManagementActionService recordsManagementActionService; + + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) + { + this.recordsManagementActionService = recordsManagementActionService; + } + + /** + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + List actions = recordsManagementActionService.getRecordsManagementActions(); + Set defs = new HashSet(actions.size()); + for (RecordsManagementAction action : actions) + { + if (action.isPublicAction()) + { + defs.add(action.getRecordsManagementActionDefinition()); + } + } + + Map model = new HashMap(); + model.put("actiondefinitions", defs); + + return model; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java index 250a9d33b2..45b42eab4d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java @@ -1,316 +1,316 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.web.scripts.substitutionsuggestions; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -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.model.RecordsManagementModel; -import org.alfresco.repo.action.parameter.ParameterProcessorComponent; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get substitution suggestions - * given a text fragment (e.g. date.month for 'mon'). - * - * @author Mark Hibbins - * @since 2.2 - */ -public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript -{ - private static final String FRAGMENT_PARAMETER = "fragment"; - private static final String PATH_PARAMETER = "path"; - private static final String UNFILED_PARAMETER = "unfiled"; - private static final String UNFILED = "true"; - - private static final String SUBSTITUTIONS_MODEL_KEY = "substitutions"; - - private static final String CREATE_CAPABILITY = "Create"; - private static final String VIEW_CAPABILITY = "ViewRecords"; - - private static final int DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH = 0; - private static final int DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS = 10; - - private int pathSubstitutionMaximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS; - private int substitutionMinimumFragmentSize = DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH; - - private ParameterProcessorComponent parameterProcessorComponent; - private NodeService nodeService; - private FilePlanService filePlanService; - private CapabilityService capabilityService; - - /** - * Set the parameter processor component bean - * - * @param parameterProcessorComponent - */ - public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) - { - this.parameterProcessorComponent = parameterProcessorComponent; - } - - /** - * Set the parameter processor component bean - * - * @param parameterProcessorComponent - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param filePlanService file plan service - */ - public void setCapabilityService(CapabilityService capabilityService) - { - this.capabilityService = capabilityService; - } - - /** - * Set the minimum fragment size to process for suggestion processing - * - * @param maximumNumberSuggestions - */ - public void setSubstitutionMinimumFragmentSize(int substitutionMinimumFragmentSize) - { - this.substitutionMinimumFragmentSize = Math.max(substitutionMinimumFragmentSize, DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH); - } - - /** - * Set the maxmimum number of suggestions returned from the global property - * - * @param maximumNumberSuggestions - */ - public void setPathSubstitutionMaximumNumberSuggestions(int pathSubstitutionMaximumNumberSuggestions) - { - this.pathSubstitutionMaximumNumberSuggestions = (pathSubstitutionMaximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS: pathSubstitutionMaximumNumberSuggestions); - } - - /** - * Return a list of substitutions for the given fragment. - * - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - String fragment = req.getParameter(FRAGMENT_PARAMETER); - String path = req.getParameter(PATH_PARAMETER); - String unfiledString = req.getParameter(UNFILED_PARAMETER); - boolean unfiled = (unfiledString != null) && UNFILED.equals(unfiledString); - - List substitutionSuggestions = new ArrayList(); - - if((fragment != null) && (fragment.length() >= this.substitutionMinimumFragmentSize)) - { - substitutionSuggestions.addAll(getSubPathSuggestions(req, path, fragment, unfiled)); - substitutionSuggestions.addAll(this.parameterProcessorComponent.getSubstitutionSuggestions(fragment)); - } - - Map model = new HashMap(); - model.put(SUBSTITUTIONS_MODEL_KEY, substitutionSuggestions); - - return model; - } - - /** - * Return a list of path suggestions for the path fragment supplied. - * - * @param path - * @param fragment - * @return - */ - private List getSubPathSuggestions(WebScriptRequest req, final String path, final String fragment, boolean unfiled) - { - List pathSuggestions = new ArrayList(); - if((path != null) && path.startsWith("/") && (fragment != null)) - { - String[] pathFragments = path.split("/"); - - NodeRef currentNode = getFilePlan(req, unfiled); - for(String pathFragment : pathFragments) - { - // ignore empty elements of the path produced by split - if(!pathFragment.isEmpty()) - { - boolean foundThisPathFragment = false; - List children = nodeService.getChildAssocs(currentNode); - for (ChildAssociationRef childAssoc : children) - { - NodeRef childNodeRef = childAssoc.getChildRef(); - String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); - if(fileName.equals(pathFragment) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled)) - { - foundThisPathFragment = true; - currentNode = childNodeRef; - break; - } - } - if(!foundThisPathFragment) - { - currentNode = null; - break; - } - } - } - - if(currentNode != null) - { - String lowerCaseFragment = fragment.toLowerCase(); - List children = nodeService.getChildAssocs(currentNode); - for (ChildAssociationRef childAssoc : children) - { - NodeRef childNodeRef = childAssoc.getChildRef(); - String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); - if((fragment.isEmpty() || fileName.toLowerCase().startsWith(lowerCaseFragment)) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled)) - { - pathSuggestions.add("/" + fileName); - if(pathSuggestions.size() >= pathSubstitutionMaximumNumberSuggestions) - { - break; - } - } - } - } - } - return pathSuggestions; - } - - /** - * Utility method to get the file plan from the passed parameters. - * - * @param req - * @return - */ - protected NodeRef getFilePlan(WebScriptRequest req, boolean unfiled) - { - NodeRef filePlan = null; - - Map templateVars = req.getServiceMatch().getTemplateVars(); - String siteId = templateVars.get("siteid"); - if (siteId != null) - { - filePlan = filePlanService.getFilePlanBySiteId(siteId); - } - - if (filePlan == null) - { - String storeType = templateVars.get("store_type"); - String storeId = templateVars.get("store_id"); - String id = templateVars.get("id"); - - if (!StringUtils.isEmpty(storeType) && - !StringUtils.isEmpty(storeId) && - !StringUtils.isEmpty(id)) - { - StoreRef storeRef = new StoreRef(storeType, storeId); - NodeRef nodeRef = new NodeRef(storeRef, id); - if (filePlanService.isFilePlan(nodeRef)) - { - filePlan = nodeRef; - } - } - } - - if (filePlan == null) - { - // Assume we are in a legacy repository and we will grab the default file plan - filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - - return unfiled ? filePlanService.getUnfiledContainer(filePlan) : filePlan; - } - - /** - * Identifies record category and record folder types of nodeRef - * - * @param nodeRef Instance of NodeRef to be tested - * @return True if the passed NodeRef instance is a record category or record folder - */ - private boolean isNodeRefAppropriateForPathSuggestion(NodeRef nodeRef, boolean unfiled) - { - // check node type - QName type = nodeService.getType(nodeRef); - boolean isCorrectType = (!unfiled - && (RecordsManagementModel.TYPE_RECORD_FOLDER.equals(type) || RecordsManagementModel.TYPE_RECORD_CATEGORY - .equals(type)) || (unfiled && RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(type))); - - // check permissions - boolean canView = false; - if(isCorrectType) - { - Capability createCapability = capabilityService.getCapability(CREATE_CAPABILITY); - Capability viewCapability = capabilityService.getCapability(VIEW_CAPABILITY); - if ((createCapability != null) && (viewCapability != null)) - { - List requiredCapabilities = new ArrayList(); - requiredCapabilities.add(CREATE_CAPABILITY); - requiredCapabilities.add(VIEW_CAPABILITY); - Map map = capabilityService.getCapabilitiesAccessState(nodeRef, requiredCapabilities); - if (map.containsKey(createCapability) && map.containsKey(viewCapability)) - { - AccessStatus createAccessStatus = map.get(createCapability); - AccessStatus viewAccessStatus = map.get(viewCapability); - if (createAccessStatus.equals(AccessStatus.ALLOWED) && viewAccessStatus.equals(AccessStatus.ALLOWED)) - { - canView = true; - } - } - } - } - - return isCorrectType && canView; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.web.scripts.substitutionsuggestions; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +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.model.RecordsManagementModel; +import org.alfresco.repo.action.parameter.ParameterProcessorComponent; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.QName; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Implementation for Java backed webscript to get substitution suggestions + * given a text fragment (e.g. date.month for 'mon'). + * + * @author Mark Hibbins + * @since 2.2 + */ +public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript +{ + private static final String FRAGMENT_PARAMETER = "fragment"; + private static final String PATH_PARAMETER = "path"; + private static final String UNFILED_PARAMETER = "unfiled"; + private static final String UNFILED = "true"; + + private static final String SUBSTITUTIONS_MODEL_KEY = "substitutions"; + + private static final String CREATE_CAPABILITY = "Create"; + private static final String VIEW_CAPABILITY = "ViewRecords"; + + private static final int DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH = 0; + private static final int DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS = 10; + + private int pathSubstitutionMaximumNumberSuggestions = DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS; + private int substitutionMinimumFragmentSize = DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH; + + private ParameterProcessorComponent parameterProcessorComponent; + private NodeService nodeService; + private FilePlanService filePlanService; + private CapabilityService capabilityService; + + /** + * Set the parameter processor component bean + * + * @param parameterProcessorComponent + */ + public void setParameterProcessorComponent(ParameterProcessorComponent parameterProcessorComponent) + { + this.parameterProcessorComponent = parameterProcessorComponent; + } + + /** + * Set the parameter processor component bean + * + * @param parameterProcessorComponent + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param filePlanService file plan service + */ + public void setCapabilityService(CapabilityService capabilityService) + { + this.capabilityService = capabilityService; + } + + /** + * Set the minimum fragment size to process for suggestion processing + * + * @param maximumNumberSuggestions + */ + public void setSubstitutionMinimumFragmentSize(int substitutionMinimumFragmentSize) + { + this.substitutionMinimumFragmentSize = Math.max(substitutionMinimumFragmentSize, DEFAULT_SUBSTITUTION_MINIMUM_FRAGMENT_LENGTH); + } + + /** + * Set the maxmimum number of suggestions returned from the global property + * + * @param maximumNumberSuggestions + */ + public void setPathSubstitutionMaximumNumberSuggestions(int pathSubstitutionMaximumNumberSuggestions) + { + this.pathSubstitutionMaximumNumberSuggestions = (pathSubstitutionMaximumNumberSuggestions <= 0 ? DEFAULT_MAXIMUM_NUMBER_PATH_SUGGESTIONS: pathSubstitutionMaximumNumberSuggestions); + } + + /** + * Return a list of substitutions for the given fragment. + * + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, + * org.springframework.extensions.webscripts.Status, + * org.springframework.extensions.webscripts.Cache) + */ + @Override + protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + { + String fragment = req.getParameter(FRAGMENT_PARAMETER); + String path = req.getParameter(PATH_PARAMETER); + String unfiledString = req.getParameter(UNFILED_PARAMETER); + boolean unfiled = (unfiledString != null) && UNFILED.equals(unfiledString); + + List substitutionSuggestions = new ArrayList(); + + if((fragment != null) && (fragment.length() >= this.substitutionMinimumFragmentSize)) + { + substitutionSuggestions.addAll(getSubPathSuggestions(req, path, fragment, unfiled)); + substitutionSuggestions.addAll(this.parameterProcessorComponent.getSubstitutionSuggestions(fragment)); + } + + Map model = new HashMap(); + model.put(SUBSTITUTIONS_MODEL_KEY, substitutionSuggestions); + + return model; + } + + /** + * Return a list of path suggestions for the path fragment supplied. + * + * @param path + * @param fragment + * @return + */ + private List getSubPathSuggestions(WebScriptRequest req, final String path, final String fragment, boolean unfiled) + { + List pathSuggestions = new ArrayList(); + if((path != null) && path.startsWith("/") && (fragment != null)) + { + String[] pathFragments = path.split("/"); + + NodeRef currentNode = getFilePlan(req, unfiled); + for(String pathFragment : pathFragments) + { + // ignore empty elements of the path produced by split + if(!pathFragment.isEmpty()) + { + boolean foundThisPathFragment = false; + List children = nodeService.getChildAssocs(currentNode); + for (ChildAssociationRef childAssoc : children) + { + NodeRef childNodeRef = childAssoc.getChildRef(); + String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); + if(fileName.equals(pathFragment) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled)) + { + foundThisPathFragment = true; + currentNode = childNodeRef; + break; + } + } + if(!foundThisPathFragment) + { + currentNode = null; + break; + } + } + } + + if(currentNode != null) + { + String lowerCaseFragment = fragment.toLowerCase(); + List children = nodeService.getChildAssocs(currentNode); + for (ChildAssociationRef childAssoc : children) + { + NodeRef childNodeRef = childAssoc.getChildRef(); + String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); + if((fragment.isEmpty() || fileName.toLowerCase().startsWith(lowerCaseFragment)) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled)) + { + pathSuggestions.add("/" + fileName); + if(pathSuggestions.size() >= pathSubstitutionMaximumNumberSuggestions) + { + break; + } + } + } + } + } + return pathSuggestions; + } + + /** + * Utility method to get the file plan from the passed parameters. + * + * @param req + * @return + */ + protected NodeRef getFilePlan(WebScriptRequest req, boolean unfiled) + { + NodeRef filePlan = null; + + Map templateVars = req.getServiceMatch().getTemplateVars(); + String siteId = templateVars.get("siteid"); + if (siteId != null) + { + filePlan = filePlanService.getFilePlanBySiteId(siteId); + } + + if (filePlan == null) + { + String storeType = templateVars.get("store_type"); + String storeId = templateVars.get("store_id"); + String id = templateVars.get("id"); + + if (!StringUtils.isEmpty(storeType) && + !StringUtils.isEmpty(storeId) && + !StringUtils.isEmpty(id)) + { + StoreRef storeRef = new StoreRef(storeType, storeId); + NodeRef nodeRef = new NodeRef(storeRef, id); + if (filePlanService.isFilePlan(nodeRef)) + { + filePlan = nodeRef; + } + } + } + + if (filePlan == null) + { + // Assume we are in a legacy repository and we will grab the default file plan + filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + } + + return unfiled ? filePlanService.getUnfiledContainer(filePlan) : filePlan; + } + + /** + * Identifies record category and record folder types of nodeRef + * + * @param nodeRef Instance of NodeRef to be tested + * @return True if the passed NodeRef instance is a record category or record folder + */ + private boolean isNodeRefAppropriateForPathSuggestion(NodeRef nodeRef, boolean unfiled) + { + // check node type + QName type = nodeService.getType(nodeRef); + boolean isCorrectType = (!unfiled + && (RecordsManagementModel.TYPE_RECORD_FOLDER.equals(type) || RecordsManagementModel.TYPE_RECORD_CATEGORY + .equals(type)) || (unfiled && RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(type))); + + // check permissions + boolean canView = false; + if(isCorrectType) + { + Capability createCapability = capabilityService.getCapability(CREATE_CAPABILITY); + Capability viewCapability = capabilityService.getCapability(VIEW_CAPABILITY); + if ((createCapability != null) && (viewCapability != null)) + { + List requiredCapabilities = new ArrayList(); + requiredCapabilities.add(CREATE_CAPABILITY); + requiredCapabilities.add(VIEW_CAPABILITY); + Map map = capabilityService.getCapabilitiesAccessState(nodeRef, requiredCapabilities); + if (map.containsKey(createCapability) && map.containsKey(viewCapability)) + { + AccessStatus createAccessStatus = map.get(createCapability); + AccessStatus viewAccessStatus = map.get(viewCapability); + if (createAccessStatus.equals(AccessStatus.ALLOWED) && viewAccessStatus.equals(AccessStatus.ALLOWED)) + { + canView = true; + } + } + } + } + + return isCorrectType && canView; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java b/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java index f7b6f0f728..4f131bcb69 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/util/SortDirection.java @@ -1,80 +1,80 @@ -package org.alfresco.util; - -import org.alfresco.api.AlfrescoPublicApi; - -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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% - */ - -import org.alfresco.error.AlfrescoRuntimeException; - -/** - * Enumeration for sort direction. - * - * @author Tuna Aksoy - * @since 2.5 - */ -@AlfrescoPublicApi -public enum SortDirection -{ - ASC ("asc"), - DESC ("desc"); - - /** A string representation of the sort direction. */ - private final String sortDirection; - - private SortDirection(String sortDirection) - { - this.sortDirection = sortDirection; - } - - /** - * Get the appropriate {@code SortDirection} from a string representation. - * - * @param sortDirectionString A string representation (case will be ignored). - * @return The {@code SortDirection} value. - */ - public static SortDirection getSortDirection(String sortDirectionString) - { - SortDirection sortDirection = null; - - for (SortDirection value : values()) - { - if (value.sortDirection.equalsIgnoreCase(sortDirectionString)) - { - sortDirection = value; - break; - } - } - - if (sortDirection == null) - { - throw new AlfrescoRuntimeException("Sort direction '" + sortDirection +"' unknown."); - } - - return sortDirection; - } -} +package org.alfresco.util; + +import org.alfresco.api.AlfrescoPublicApi; + +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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% + */ + +import org.alfresco.error.AlfrescoRuntimeException; + +/** + * Enumeration for sort direction. + * + * @author Tuna Aksoy + * @since 2.5 + */ +@AlfrescoPublicApi +public enum SortDirection +{ + ASC ("asc"), + DESC ("desc"); + + /** A string representation of the sort direction. */ + private final String sortDirection; + + private SortDirection(String sortDirection) + { + this.sortDirection = sortDirection; + } + + /** + * Get the appropriate {@code SortDirection} from a string representation. + * + * @param sortDirectionString A string representation (case will be ignored). + * @return The {@code SortDirection} value. + */ + public static SortDirection getSortDirection(String sortDirectionString) + { + SortDirection sortDirection = null; + + for (SortDirection value : values()) + { + if (value.sortDirection.equalsIgnoreCase(sortDirectionString)) + { + sortDirection = value; + break; + } + } + + if (sortDirection == null) + { + throw new AlfrescoRuntimeException("Sort direction '" + sortDirection +"' unknown."); + } + + return sortDirection; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/util/WebScriptUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/util/WebScriptUtils.java index cc0ac75830..cbf32f9674 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/util/WebScriptUtils.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/util/WebScriptUtils.java @@ -1,429 +1,429 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang3.StringUtils.isBlank; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.Content; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Utility class for handling webscript requests - * - * @author Tuna Aksoy - * @since 2.3 - */ -public final class WebScriptUtils -{ - private WebScriptUtils() - { - // Will not be called - } - - /** - * Gets the template variable substitutions map - * - * @param req The webscript request - * @return The template variable substitutions - */ - public static Map getTemplateVars(WebScriptRequest req) - { - mandatory("req", req); - - if (req.getServiceMatch() == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The matching API Service for the request is null."); - } - - Map templateVars = req.getServiceMatch().getTemplateVars(); - if (templateVars == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The template variable substitutions map is null"); - } - - return templateVars; - } - - /** - * Gets the value of a request parameter - * - * @param req The webscript request - * @param parameter The request parameter - * @return The value of the request parameter - */ - public static String getRequestParameterValue(WebScriptRequest req, String parameter) - { - mandatory("req", req); - mandatoryString("parameter", parameter); - - return getRequestParameterValue(req, parameter, true); - } - - /** - * Gets the value of a request parameter - * - * @param req The webscript request - * @param parameter The request parameter - * @param checkValue Determines if the value of the parameter should be checked or not - * @return The value of the request parameter - */ - public static String getRequestParameterValue(WebScriptRequest req, String parameter, boolean checkValue) - { - mandatory("req", req); - mandatoryString("parameter", parameter); - - Map templateVars = getTemplateVars(req); - String value = templateVars.get(parameter); - - if (checkValue && isBlank(value)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The value for the parameter '" + parameter + "' is blank."); - } - - return value; - } - - /** - * Gets the request content as JSON object - * - * @param req The webscript request - * @return The request content as JSON object - */ - public static JSONObject getRequestContentAsJSONObject(WebScriptRequest req) - { - mandatory("req", req); - - Content reqContent = req.getContent(); - if (reqContent == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Missing request body."); - } - - String content; - try - { - content = reqContent.getContent(); - } - catch (IOException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get content from the request.", error); - } - - if (isBlank(content)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Content does not exist."); - } - - JSONTokener jsonTokener = new JSONTokener(content); - - JSONObject json; - try - { - json = new JSONObject(jsonTokener); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to parse request body.", error); - } - - return json; - } - - /** - * Checks if the json object contains an entry with the specified parameter name - * - * @param jsonObject The json object - * @param paramName The parameter name to check for - */ - public static void checkMandatoryJSONParam(JSONObject jsonObject, String paramName) - { - mandatory("jsonObject", jsonObject); - mandatoryString("paramName", paramName); - - if (!jsonObject.has(paramName)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The json object does not contain an entry with parameter '" + paramName + "'."); - } - } - - /** - * Checks if the json object contains entries with the specified parameter names - * - * @param jsonObject The json object. - * @param paramNames The parameter names to check for - */ - public static void checkMandatoryJSONParams(JSONObject jsonObject, List paramNames) - { - mandatory("jsonObject", jsonObject); - mandatory("paramNames", paramNames); - - for (String name : paramNames) - { - checkMandatoryJSONParam(jsonObject, name); - } - } - - /** - * Gets the {@link String} value of a given key from a json object - * - * @param jsonObject The json object - * @param key The key - * @return The {@link String} value of the given key from the json object - */ - public static String getStringValueFromJSONObject(JSONObject jsonObject, String key) - { - mandatory("jsonObject", jsonObject); - mandatoryString("key", key); - - return getStringValueFromJSONObject(jsonObject, key, true, true); - } - - /** - * Gets the {@link String} value of a given key from a json object - * - * @param jsonObject The json object - * @param key The key - * @param checkKey Determines if the existence of the key should be checked - * @param checkValue Determines if the value should be checked if it is blank or not - * @return The {@link String} value of the given key from the json object - */ - public static String getStringValueFromJSONObject(JSONObject jsonObject, String key, boolean checkKey, boolean checkValue) - { - mandatory("jsonObject", jsonObject); - mandatoryString("key", key); - - if (checkKey) - { - checkMandatoryJSONParam(jsonObject, key); - } - - String value = null; - - try - { - value = jsonObject.getString(key); - if (checkValue && isBlank(value)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The value is missing for the key '" + key + "'."); - } - } - catch (JSONException error) - { - if (checkValue) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the key '" + key + "'.", error); - } - } - - return value; - } - - /** - * Puts the given key and value to the json object - * - * @param jsonObject The json object - * @param key The key - * @param value The value - */ - public static void putValueToJSONObject(JSONObject jsonObject, String key, Object value) - { - mandatory("jsonObject", jsonObject); - mandatoryString("key", key); - mandatory("value", value); - - try - { - jsonObject.put(key, value); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not put the key '" + key + "' with the value '" + value + "' to the json object.", error); - } - } - - /** - * Gets the value of an element from a json array at the given index - * - * @param jsonArray The json array - * @param index The index - * @return The value of the element - */ - public static Object getJSONArrayValue(JSONArray jsonArray, int index) - { - mandatory("jsonArray", jsonArray); - - Object value; - - try - { - value = jsonArray.get(index); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the index '" + index + "' from the JSON Array.", error); - } - - return value; - } - - /** - * Creates a json object from the given {@link String} - * - * @param json The json object as {@link String} - * @return The json object created from the given {@link String} - */ - public static JSONObject createJSONObject(String json) - { - mandatory("json", json); - - JSONObject jsonObject; - - try - { - jsonObject = new JSONObject(json); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Cannot create a json object from the given string '" + json + "'.", error); - } - - return jsonObject; - } - - /** - * Creates a json array from the given {@link String} - * - * @param json The json array as {@link String} - * @return The json array created from the given {@link String} - */ - public static JSONArray createJSONArray(String json) - { - mandatory("json", json); - - JSONArray jsonArray; - - try - { - jsonArray = new JSONArray(json); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Cannot create a json array from the given string '" + json + "'.", error); - } - - return jsonArray; - } - - /** - * Gets the {@link JSONArray} value of a given key from a json object - * - * @param jsonObject The json object - * @param key The key - * @return The {@link JSONArray} value of the given key from the json object - */ - public static JSONArray getJSONArrayFromJSONObject(JSONObject jsonObject, String key) - { - JSONArray jsonArray; - - mandatory("jsonObject", jsonObject); - mandatory("key", key); - - try - { - jsonArray = jsonObject.getJSONArray(key); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get the json array for the key '" + key + "'.", error); - } - - return jsonArray; - } - - /** - * Returns {@code true} if the provided {@link WebScriptException} - * represents an HTTP 4xx error, else {@code false}. - */ - public static boolean is4xxError(WebScriptException e) - { - return isStatusInRange(e, 400, 500); - } - - /** - * Returns {@code true} if the provided {@link WebScriptException} - * represents an HTTP 5xx error, else {@code false}. - */ - public static boolean is5xxError(WebScriptException e) - { - return isStatusInRange(e, 500, 600); - } - - private static boolean isStatusInRange(WebScriptException e, int lowerLimitInclusive, int upperLimitExclusive) - { - final int status = e.getStatus(); - return status >= lowerLimitInclusive && status < upperLimitExclusive; - } - - /** - * Gets the {@link JSONObject} value of a given key from a json object - * - * @param jsonObject The json object - * @param key The key - * @return The {@link JSONObject} value of the given key from the json object - */ - public static JSONObject getValueFromJSONObject(JSONObject jsonObject, String key) - { - mandatory("jsonObject", jsonObject); - mandatoryString("key", key); - - JSONObject value = null; - - try - { - value = jsonObject.getJSONObject(key); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the key '" + key + "'.", error); - } - - return value; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import static org.alfresco.util.ParameterCheck.mandatory; +import static org.alfresco.util.ParameterCheck.mandatoryString; +import static org.apache.commons.lang3.StringUtils.isBlank; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.surf.util.Content; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; +import org.springframework.extensions.webscripts.WebScriptRequest; + +/** + * Utility class for handling webscript requests + * + * @author Tuna Aksoy + * @since 2.3 + */ +public final class WebScriptUtils +{ + private WebScriptUtils() + { + // Will not be called + } + + /** + * Gets the template variable substitutions map + * + * @param req The webscript request + * @return The template variable substitutions + */ + public static Map getTemplateVars(WebScriptRequest req) + { + mandatory("req", req); + + if (req.getServiceMatch() == null) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The matching API Service for the request is null."); + } + + Map templateVars = req.getServiceMatch().getTemplateVars(); + if (templateVars == null) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The template variable substitutions map is null"); + } + + return templateVars; + } + + /** + * Gets the value of a request parameter + * + * @param req The webscript request + * @param parameter The request parameter + * @return The value of the request parameter + */ + public static String getRequestParameterValue(WebScriptRequest req, String parameter) + { + mandatory("req", req); + mandatoryString("parameter", parameter); + + return getRequestParameterValue(req, parameter, true); + } + + /** + * Gets the value of a request parameter + * + * @param req The webscript request + * @param parameter The request parameter + * @param checkValue Determines if the value of the parameter should be checked or not + * @return The value of the request parameter + */ + public static String getRequestParameterValue(WebScriptRequest req, String parameter, boolean checkValue) + { + mandatory("req", req); + mandatoryString("parameter", parameter); + + Map templateVars = getTemplateVars(req); + String value = templateVars.get(parameter); + + if (checkValue && isBlank(value)) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, "The value for the parameter '" + parameter + "' is blank."); + } + + return value; + } + + /** + * Gets the request content as JSON object + * + * @param req The webscript request + * @return The request content as JSON object + */ + public static JSONObject getRequestContentAsJSONObject(WebScriptRequest req) + { + mandatory("req", req); + + Content reqContent = req.getContent(); + if (reqContent == null) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Missing request body."); + } + + String content; + try + { + content = reqContent.getContent(); + } + catch (IOException error) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get content from the request.", error); + } + + if (isBlank(content)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Content does not exist."); + } + + JSONTokener jsonTokener = new JSONTokener(content); + + JSONObject json; + try + { + json = new JSONObject(jsonTokener); + } + catch (JSONException error) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to parse request body.", error); + } + + return json; + } + + /** + * Checks if the json object contains an entry with the specified parameter name + * + * @param jsonObject The json object + * @param paramName The parameter name to check for + */ + public static void checkMandatoryJSONParam(JSONObject jsonObject, String paramName) + { + mandatory("jsonObject", jsonObject); + mandatoryString("paramName", paramName); + + if (!jsonObject.has(paramName)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The json object does not contain an entry with parameter '" + paramName + "'."); + } + } + + /** + * Checks if the json object contains entries with the specified parameter names + * + * @param jsonObject The json object. + * @param paramNames The parameter names to check for + */ + public static void checkMandatoryJSONParams(JSONObject jsonObject, List paramNames) + { + mandatory("jsonObject", jsonObject); + mandatory("paramNames", paramNames); + + for (String name : paramNames) + { + checkMandatoryJSONParam(jsonObject, name); + } + } + + /** + * Gets the {@link String} value of a given key from a json object + * + * @param jsonObject The json object + * @param key The key + * @return The {@link String} value of the given key from the json object + */ + public static String getStringValueFromJSONObject(JSONObject jsonObject, String key) + { + mandatory("jsonObject", jsonObject); + mandatoryString("key", key); + + return getStringValueFromJSONObject(jsonObject, key, true, true); + } + + /** + * Gets the {@link String} value of a given key from a json object + * + * @param jsonObject The json object + * @param key The key + * @param checkKey Determines if the existence of the key should be checked + * @param checkValue Determines if the value should be checked if it is blank or not + * @return The {@link String} value of the given key from the json object + */ + public static String getStringValueFromJSONObject(JSONObject jsonObject, String key, boolean checkKey, boolean checkValue) + { + mandatory("jsonObject", jsonObject); + mandatoryString("key", key); + + if (checkKey) + { + checkMandatoryJSONParam(jsonObject, key); + } + + String value = null; + + try + { + value = jsonObject.getString(key); + if (checkValue && isBlank(value)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The value is missing for the key '" + key + "'."); + } + } + catch (JSONException error) + { + if (checkValue) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the key '" + key + "'.", error); + } + } + + return value; + } + + /** + * Puts the given key and value to the json object + * + * @param jsonObject The json object + * @param key The key + * @param value The value + */ + public static void putValueToJSONObject(JSONObject jsonObject, String key, Object value) + { + mandatory("jsonObject", jsonObject); + mandatoryString("key", key); + mandatory("value", value); + + try + { + jsonObject.put(key, value); + } + catch (JSONException error) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not put the key '" + key + "' with the value '" + value + "' to the json object.", error); + } + } + + /** + * Gets the value of an element from a json array at the given index + * + * @param jsonArray The json array + * @param index The index + * @return The value of the element + */ + public static Object getJSONArrayValue(JSONArray jsonArray, int index) + { + mandatory("jsonArray", jsonArray); + + Object value; + + try + { + value = jsonArray.get(index); + } + catch (JSONException error) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the index '" + index + "' from the JSON Array.", error); + } + + return value; + } + + /** + * Creates a json object from the given {@link String} + * + * @param json The json object as {@link String} + * @return The json object created from the given {@link String} + */ + public static JSONObject createJSONObject(String json) + { + mandatory("json", json); + + JSONObject jsonObject; + + try + { + jsonObject = new JSONObject(json); + } + catch (JSONException error) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Cannot create a json object from the given string '" + json + "'.", error); + } + + return jsonObject; + } + + /** + * Creates a json array from the given {@link String} + * + * @param json The json array as {@link String} + * @return The json array created from the given {@link String} + */ + public static JSONArray createJSONArray(String json) + { + mandatory("json", json); + + JSONArray jsonArray; + + try + { + jsonArray = new JSONArray(json); + } + catch (JSONException error) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Cannot create a json array from the given string '" + json + "'.", error); + } + + return jsonArray; + } + + /** + * Gets the {@link JSONArray} value of a given key from a json object + * + * @param jsonObject The json object + * @param key The key + * @return The {@link JSONArray} value of the given key from the json object + */ + public static JSONArray getJSONArrayFromJSONObject(JSONObject jsonObject, String key) + { + JSONArray jsonArray; + + mandatory("jsonObject", jsonObject); + mandatory("key", key); + + try + { + jsonArray = jsonObject.getJSONArray(key); + } + catch (JSONException error) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get the json array for the key '" + key + "'.", error); + } + + return jsonArray; + } + + /** + * Returns {@code true} if the provided {@link WebScriptException} + * represents an HTTP 4xx error, else {@code false}. + */ + public static boolean is4xxError(WebScriptException e) + { + return isStatusInRange(e, 400, 500); + } + + /** + * Returns {@code true} if the provided {@link WebScriptException} + * represents an HTTP 5xx error, else {@code false}. + */ + public static boolean is5xxError(WebScriptException e) + { + return isStatusInRange(e, 500, 600); + } + + private static boolean isStatusInRange(WebScriptException e, int lowerLimitInclusive, int upperLimitExclusive) + { + final int status = e.getStatus(); + return status >= lowerLimitInclusive && status < upperLimitExclusive; + } + + /** + * Gets the {@link JSONObject} value of a given key from a json object + * + * @param jsonObject The json object + * @param key The key + * @return The {@link JSONObject} value of the given key from the json object + */ + public static JSONObject getValueFromJSONObject(JSONObject jsonObject, String key) + { + mandatory("jsonObject", jsonObject); + mandatoryString("key", key); + + JSONObject value = null; + + try + { + value = jsonObject.getJSONObject(key); + } + catch (JSONException error) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the key '" + key + "'.", error); + } + + return value; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/RMWorkflowModel.java b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/RMWorkflowModel.java index e5af601ff7..16823ddc8d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/RMWorkflowModel.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/RMWorkflowModel.java @@ -1,54 +1,54 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.workflow; - -import org.alfresco.service.namespace.QName; - -/** - * Workflow Constants for Records Management - * - * @author Tuna Aksoy - * @since 2.1 - */ -public interface RMWorkflowModel -{ - // Namespace URI - String RM_WORKFLOW_URI = "http://www.alfresco.org/model/rmworkflow/1.0"; - - // Namespace prefix - String RM_WORKFLOW_PREFIX = "rmwf"; - - // Mixed Assignees - QName RM_MIXED_ASSIGNEES = QName.createQName(RM_WORKFLOW_URI, "mixedAssignees"); - - // Requested Information - QName RM_REQUESTED_INFORMATION = QName.createQName(RM_WORKFLOW_URI, "requestedInformation"); - - // Rule creator - QName RM_RULE_CREATOR = QName.createQName(RM_WORKFLOW_URI, "ruleCreator"); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.workflow; + +import org.alfresco.service.namespace.QName; + +/** + * Workflow Constants for Records Management + * + * @author Tuna Aksoy + * @since 2.1 + */ +public interface RMWorkflowModel +{ + // Namespace URI + String RM_WORKFLOW_URI = "http://www.alfresco.org/model/rmworkflow/1.0"; + + // Namespace prefix + String RM_WORKFLOW_PREFIX = "rmwf"; + + // Mixed Assignees + QName RM_MIXED_ASSIGNEES = QName.createQName(RM_WORKFLOW_URI, "mixedAssignees"); + + // Requested Information + QName RM_REQUESTED_INFORMATION = QName.createQName(RM_WORKFLOW_URI, "requestedInformation"); + + // Rule creator + QName RM_RULE_CREATOR = QName.createQName(RM_WORKFLOW_URI, "ruleCreator"); +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java index 987c02585f..2c91448563 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoAssignmentHandler.java @@ -1,140 +1,140 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.workflow.requestInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.activiti.engine.delegate.DelegateTask; -import org.activiti.engine.delegate.TaskListener; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.workflow.activiti.ActivitiScriptNode; -import org.alfresco.repo.workflow.activiti.ActivitiScriptNodeList; -import org.alfresco.util.ParameterCheck; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * An assignment handler for the request info workflow. - * An RM manager/admin can select one or more user(s) and/or - * one or more group(s) when starting the request info workflow. - * This assignment handler assigns for everyone a task (it is a pooled task). - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RequestInfoAssignmentHandler implements TaskListener -{ - private static final long serialVersionUID = -3179929030094957978L; - - /** - * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) - */ - @Override - public void notify(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - // Set the workflow description for the task - delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(RequestInfoUtils.getRecordName(delegateTask))); - - // Get the list of user(s) and/or group(s) - ActivitiScriptNodeList usersAndGroups = (ActivitiScriptNodeList) delegateTask.getVariable("rmwf_mixedAssignees"); - - // Check if it was possible to extract the user(s) and/or group(s) - if (usersAndGroups == null) - { - throw new AlfrescoRuntimeException("It was not possible to extract the user(s) and/or group(s)!!!"); - } - - // Define lists for candidate user(s)/group(s) - List candidateUsers = new ArrayList(); - List candidateGroups = new ArrayList(); - - // Iterate through the list add user(s)/group(s) to the lists - for (ActivitiScriptNode activitiScriptNode : usersAndGroups) - { - // Get the node type - String type = activitiScriptNode.getType(); - // Get the properties - Map properties = activitiScriptNode.getProperties(); - - // Check if it is a user or a group - if (type.equalsIgnoreCase(ContentModel.TYPE_PERSON.toString())) - { - // Add the user - candidateUsers.add((String) properties.get(ContentModel.PROP_USERNAME.toString())); - } - else if (type.equalsIgnoreCase(ContentModel.TYPE_AUTHORITY_CONTAINER.toString())) - { - // Add the group - candidateGroups.add((String) properties.get(ContentModel.PROP_AUTHORITY_NAME.toString())); - } - else - { - throw new AlfrescoRuntimeException("The type '" + type + "' is neither a user nor a group!!!"); - } - } - - // Check if there is at least one user or one group - if (candidateUsers.size() == 0 && candidateGroups.size() == 0) - { - throw new AlfrescoRuntimeException("Neither a user nor a group was found!!!"); - } - - // Add the user(s) to the task - if (candidateUsers.size() > 0) - { - delegateTask.addCandidateUsers(candidateUsers); - } - - // Add the group(s) to the task - if (candidateGroups.size() > 0) - { - delegateTask.addCandidateGroups(candidateGroups); - } - } - - /** - * Helper method for building the workflow description - * - * @param recordName The name of the record - * @return Returns the workflow description - */ - private String getWorkflowDescription(String recordName) - { - StringBuilder sb = new StringBuilder(); - sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.info.requested")); - sb.append(" '"); - sb.append(recordName); - sb.append("'"); - return sb.toString(); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.workflow.requestInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.activiti.engine.delegate.DelegateTask; +import org.activiti.engine.delegate.TaskListener; +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.workflow.activiti.ActivitiScriptNode; +import org.alfresco.repo.workflow.activiti.ActivitiScriptNodeList; +import org.alfresco.util.ParameterCheck; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * An assignment handler for the request info workflow. + * An RM manager/admin can select one or more user(s) and/or + * one or more group(s) when starting the request info workflow. + * This assignment handler assigns for everyone a task (it is a pooled task). + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RequestInfoAssignmentHandler implements TaskListener +{ + private static final long serialVersionUID = -3179929030094957978L; + + /** + * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) + */ + @Override + public void notify(DelegateTask delegateTask) + { + ParameterCheck.mandatory("delegateTask", delegateTask); + + // Set the workflow description for the task + delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(RequestInfoUtils.getRecordName(delegateTask))); + + // Get the list of user(s) and/or group(s) + ActivitiScriptNodeList usersAndGroups = (ActivitiScriptNodeList) delegateTask.getVariable("rmwf_mixedAssignees"); + + // Check if it was possible to extract the user(s) and/or group(s) + if (usersAndGroups == null) + { + throw new AlfrescoRuntimeException("It was not possible to extract the user(s) and/or group(s)!!!"); + } + + // Define lists for candidate user(s)/group(s) + List candidateUsers = new ArrayList(); + List candidateGroups = new ArrayList(); + + // Iterate through the list add user(s)/group(s) to the lists + for (ActivitiScriptNode activitiScriptNode : usersAndGroups) + { + // Get the node type + String type = activitiScriptNode.getType(); + // Get the properties + Map properties = activitiScriptNode.getProperties(); + + // Check if it is a user or a group + if (type.equalsIgnoreCase(ContentModel.TYPE_PERSON.toString())) + { + // Add the user + candidateUsers.add((String) properties.get(ContentModel.PROP_USERNAME.toString())); + } + else if (type.equalsIgnoreCase(ContentModel.TYPE_AUTHORITY_CONTAINER.toString())) + { + // Add the group + candidateGroups.add((String) properties.get(ContentModel.PROP_AUTHORITY_NAME.toString())); + } + else + { + throw new AlfrescoRuntimeException("The type '" + type + "' is neither a user nor a group!!!"); + } + } + + // Check if there is at least one user or one group + if (candidateUsers.size() == 0 && candidateGroups.size() == 0) + { + throw new AlfrescoRuntimeException("Neither a user nor a group was found!!!"); + } + + // Add the user(s) to the task + if (candidateUsers.size() > 0) + { + delegateTask.addCandidateUsers(candidateUsers); + } + + // Add the group(s) to the task + if (candidateGroups.size() > 0) + { + delegateTask.addCandidateGroups(candidateGroups); + } + } + + /** + * Helper method for building the workflow description + * + * @param recordName The name of the record + * @return Returns the workflow description + */ + private String getWorkflowDescription(String recordName) + { + StringBuilder sb = new StringBuilder(); + sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.info.requested")); + sb.append(" '"); + sb.append(recordName); + sb.append("'"); + return sb.toString(); + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java index 19bd75f680..a0e877a6cb 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java @@ -1,81 +1,81 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.workflow.requestInfo; - -import org.activiti.engine.delegate.DelegateTask; -import org.activiti.engine.delegate.TaskListener; -import org.alfresco.util.ParameterCheck; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Request info workflow notifier. - * After the pooled task has been finished the initiator of the workflow will - * get a task to verify the information. The initiator will also receive an email. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RequestInfoNotifier implements TaskListener -{ - private static final long serialVersionUID = -7169400062409052556L; - - /** - * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) - */ - @Override - public void notify(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - // Get the record name - String recordName = RequestInfoUtils.getRecordName(delegateTask); - - // Set the workflow description for the task - delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(recordName)); - - // Assign the task to the initiator - String initiator = RequestInfoUtils.getInitiator(delegateTask); - delegateTask.setAssignee(initiator); - } - - /** - * Helper method for building the workflow description - * - * @param recordName The name of the record - * @return Returns the workflow description - */ - private String getWorkflowDescription(String recordName) - { - StringBuilder sb = new StringBuilder(); - sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.info.provided")); - sb.append(" '"); - sb.append(recordName); - sb.append("'"); - return sb.toString(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.workflow.requestInfo; + +import org.activiti.engine.delegate.DelegateTask; +import org.activiti.engine.delegate.TaskListener; +import org.alfresco.util.ParameterCheck; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Request info workflow notifier. + * After the pooled task has been finished the initiator of the workflow will + * get a task to verify the information. The initiator will also receive an email. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RequestInfoNotifier implements TaskListener +{ + private static final long serialVersionUID = -7169400062409052556L; + + /** + * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) + */ + @Override + public void notify(DelegateTask delegateTask) + { + ParameterCheck.mandatory("delegateTask", delegateTask); + + // Get the record name + String recordName = RequestInfoUtils.getRecordName(delegateTask); + + // Set the workflow description for the task + delegateTask.setVariable("bpm_workflowDescription", getWorkflowDescription(recordName)); + + // Assign the task to the initiator + String initiator = RequestInfoUtils.getInitiator(delegateTask); + delegateTask.setAssignee(initiator); + } + + /** + * Helper method for building the workflow description + * + * @param recordName The name of the record + * @return Returns the workflow description + */ + private String getWorkflowDescription(String recordName) + { + StringBuilder sb = new StringBuilder(); + sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.info.provided")); + sb.append(" '"); + sb.append(recordName); + sb.append("'"); + return sb.toString(); + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java index 8b9e68df76..6d0dbfb830 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java @@ -1,146 +1,146 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.workflow.requestInfo; - -import java.util.List; - -import org.activiti.engine.delegate.DelegateTask; -import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.activiti.engine.impl.context.Context; -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.workflow.activiti.ActivitiConstants; -import org.alfresco.repo.workflow.activiti.ActivitiScriptNode; -import org.alfresco.service.ServiceRegistry; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.util.ParameterCheck; -import org.apache.commons.lang.StringUtils; - -/** - * Util class for the request info workflow - * - * @author Tuna Aksoy - * @since 2.1 - */ -public final class RequestInfoUtils -{ - private RequestInfoUtils() - { - // Will not be called - } - - /** - * Helper method to get the service registry in order to call services - * - * @return Returns the service registry - */ - public static ServiceRegistry getServiceRegistry() - { - ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration(); - if (config != null) - { - // Fetch the registry that is injected in the activiti spring-configuration - ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY); - if (registry == null) - { - throw new AlfrescoRuntimeException( - "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" + - ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY); - } - return registry; - } - throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context"); - } - - /** - * Helper method to extract the record name from the task - * - * @param delegateTask The delegate task - * @return Returns the name of the record or an empty string if the record name could not be found - (may be because the record has been deleted in the mean time) - */ - public static String getRecordName(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - String recordName = StringUtils.EMPTY; - - NodeService nodeService = getServiceRegistry().getNodeService(); - ActivitiScriptNode scriptNode = (ActivitiScriptNode) delegateTask.getVariable("bpm_package"); - List childAssocs = nodeService.getChildAssocs(scriptNode.getNodeRef()); - - if (childAssocs.size() > 0) - { - NodeRef docRef= childAssocs.get(0).getChildRef(); - recordName = (String) nodeService.getProperty(docRef, ContentModel.PROP_NAME); - } - - return recordName; - } - - /** - * Helper method to extract the initiator from the task - * - * @param delegateTask The delegate task - * @return Returns the initiator of the workflow. First it will be checked if - * a rule creator exists, which means the the workflow was started via rule. - * In this case the creator of the rule will receive the review task. - * If a rule creator cannot be found the code will try to find the initiator - * of the workflow. If also this is not the case the admin user will be returned. - */ - public static String getInitiator(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - String userName = null; - - String ruleCreator = (String) delegateTask.getVariable("rmwf_ruleCreator"); - if (StringUtils.isBlank(ruleCreator)) - { - ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator"); - if (initiator.exists()) - { - userName = (String) initiator.getProperties().get(ContentModel.PROP_USERNAME.toString()); - } - else - { - userName = AuthenticationUtil.getAdminUserName(); - } - } - else - { - userName = ruleCreator; - } - - return userName; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.workflow.requestInfo; + +import java.util.List; + +import org.activiti.engine.delegate.DelegateTask; +import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.activiti.engine.impl.context.Context; +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.workflow.activiti.ActivitiConstants; +import org.alfresco.repo.workflow.activiti.ActivitiScriptNode; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; + +/** + * Util class for the request info workflow + * + * @author Tuna Aksoy + * @since 2.1 + */ +public final class RequestInfoUtils +{ + private RequestInfoUtils() + { + // Will not be called + } + + /** + * Helper method to get the service registry in order to call services + * + * @return Returns the service registry + */ + public static ServiceRegistry getServiceRegistry() + { + ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration(); + if (config != null) + { + // Fetch the registry that is injected in the activiti spring-configuration + ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY); + if (registry == null) + { + throw new AlfrescoRuntimeException( + "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" + + ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY); + } + return registry; + } + throw new IllegalStateException("No ProcessEngineCOnfiguration found in active context"); + } + + /** + * Helper method to extract the record name from the task + * + * @param delegateTask The delegate task + * @return Returns the name of the record or an empty string if the record name could not be found + (may be because the record has been deleted in the mean time) + */ + public static String getRecordName(DelegateTask delegateTask) + { + ParameterCheck.mandatory("delegateTask", delegateTask); + + String recordName = StringUtils.EMPTY; + + NodeService nodeService = getServiceRegistry().getNodeService(); + ActivitiScriptNode scriptNode = (ActivitiScriptNode) delegateTask.getVariable("bpm_package"); + List childAssocs = nodeService.getChildAssocs(scriptNode.getNodeRef()); + + if (childAssocs.size() > 0) + { + NodeRef docRef= childAssocs.get(0).getChildRef(); + recordName = (String) nodeService.getProperty(docRef, ContentModel.PROP_NAME); + } + + return recordName; + } + + /** + * Helper method to extract the initiator from the task + * + * @param delegateTask The delegate task + * @return Returns the initiator of the workflow. First it will be checked if + * a rule creator exists, which means the the workflow was started via rule. + * In this case the creator of the rule will receive the review task. + * If a rule creator cannot be found the code will try to find the initiator + * of the workflow. If also this is not the case the admin user will be returned. + */ + public static String getInitiator(DelegateTask delegateTask) + { + ParameterCheck.mandatory("delegateTask", delegateTask); + + String userName = null; + + String ruleCreator = (String) delegateTask.getVariable("rmwf_ruleCreator"); + if (StringUtils.isBlank(ruleCreator)) + { + ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator"); + if (initiator.exists()) + { + userName = (String) initiator.getProperties().get(ContentModel.PROP_USERNAME.toString()); + } + else + { + userName = AuthenticationUtil.getAdminUserName(); + } + } + else + { + userName = ruleCreator; + } + + return userName; + } + +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoVariableHandler.java b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoVariableHandler.java index db92c9a4e3..55cd20bab1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoVariableHandler.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/workflow/requestInfo/RequestInfoVariableHandler.java @@ -1,59 +1,59 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.workflow.requestInfo; - -import org.activiti.engine.delegate.DelegateExecution; -import org.activiti.engine.delegate.DelegateTask; -import org.activiti.engine.delegate.TaskListener; -import org.alfresco.util.ParameterCheck; - -/** - * A variable handler for saving the task variables to the execution context. - * Some of the information will be needed in other tasks (e.g. "rmwf_message"). - * This variable handler saves the local task variable to the execution context. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RequestInfoVariableHandler implements TaskListener -{ - private static final long serialVersionUID = -1759557028641631768L; - - /** - * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) - */ - @Override - public void notify(DelegateTask delegateTask) - { - ParameterCheck.mandatory("delegateTask", delegateTask); - - // Save the variable from the task - DelegateExecution execution = delegateTask.getExecution(); - execution.setVariable("rmwf_message", delegateTask.getVariable("rmwf_message")); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.workflow.requestInfo; + +import org.activiti.engine.delegate.DelegateExecution; +import org.activiti.engine.delegate.DelegateTask; +import org.activiti.engine.delegate.TaskListener; +import org.alfresco.util.ParameterCheck; + +/** + * A variable handler for saving the task variables to the execution context. + * Some of the information will be needed in other tasks (e.g. "rmwf_message"). + * This variable handler saves the local task variable to the execution context. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RequestInfoVariableHandler implements TaskListener +{ + private static final long serialVersionUID = -1759557028641631768L; + + /** + * @see org.activiti.engine.delegate.TaskListener#notify(org.activiti.engine.delegate.DelegateTask) + */ + @Override + public void notify(DelegateTask delegateTask) + { + ParameterCheck.mandatory("delegateTask", delegateTask); + + // Save the variable from the task + DelegateExecution execution = delegateTask.getExecution(); + execution.setVariable("rmwf_message", delegateTask.getVariable("rmwf_message")); + } +} diff --git a/rm-community/rm-community-repo/src/test/properties/local/alfresco-global.properties b/rm-community/rm-community-repo/src/test/properties/local/alfresco-global.properties index 7131895122..0d262ecbfc 100644 --- a/rm-community/rm-community-repo/src/test/properties/local/alfresco-global.properties +++ b/rm-community/rm-community-repo/src/test/properties/local/alfresco-global.properties @@ -1,72 +1,72 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# RUN TIME PROPERTIES -# ------------------- - -######################################################################################################################## -# Alfresco configuration for running locally -# -# Configuration when running Tomcat embedded from Maven. -# This will create the alf_data_dev directory relative to Tomcat run folder. -# Property values from the POM but it can also be edited here. -######################################################################################################################## - -dir.root=${alfresco.data.location} - -# Alfresco Repo Webapp (alfresco.war) context, ports etc -alfresco.context=alfresco -alfresco.host=localhost -alfresco.port=8080 -alfresco.protocol=http - -# Alfresco Share Webapp (share.war) context, ports etc -share.context=share -share.host=localhost -share.port=8080 -share.protocol=http - -# Validates and auto-recover if validation fails -index.recovery.mode=AUTO -# As we run embedded, we set Lucene -# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon -index.subsystem.name=buildonly - -# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date -# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597 -# If you want to enable them (and so full WQS functionality), please also set index.subsystem.name=lucene -wcmqs.dynamicCollectionProcessor.schedule=0 30 2 * * ? 2060 -wcmqs.feedbackProcessor.schedule=0 40 2 * * ? 2060 -wcmqs.publishQueueProcessor.schedule=0 50 2 * * ? 2060 - -# Fail or not when there are node integrity checker errors -integrity.failOnError=true - -# Database connection properties -db.driver=${alfresco.db.datasource.class} -db.url=${alfresco.db.url} -db.username=${alfresco.db.username} -db.password=${alfresco.db.password} -db.pool.initial=10 -db.pool.max=100 -hibernate.dialect=${alfresco.db.hibernate.dialect} - -# File servers related properties -# For local runs we disable CIFS and FTP -cifs.enabled=false -ftp.enabled=false - -# Solr config -index.subsystem.name=solr4 +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# RUN TIME PROPERTIES +# ------------------- + +######################################################################################################################## +# Alfresco configuration for running locally +# +# Configuration when running Tomcat embedded from Maven. +# This will create the alf_data_dev directory relative to Tomcat run folder. +# Property values from the POM but it can also be edited here. +######################################################################################################################## + +dir.root=${alfresco.data.location} + +# Alfresco Repo Webapp (alfresco.war) context, ports etc +alfresco.context=alfresco +alfresco.host=localhost +alfresco.port=8080 +alfresco.protocol=http + +# Alfresco Share Webapp (share.war) context, ports etc +share.context=share +share.host=localhost +share.port=8080 +share.protocol=http + +# Validates and auto-recover if validation fails +index.recovery.mode=AUTO +# As we run embedded, we set Lucene +# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon +index.subsystem.name=buildonly + +# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date +# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597 +# If you want to enable them (and so full WQS functionality), please also set index.subsystem.name=lucene +wcmqs.dynamicCollectionProcessor.schedule=0 30 2 * * ? 2060 +wcmqs.feedbackProcessor.schedule=0 40 2 * * ? 2060 +wcmqs.publishQueueProcessor.schedule=0 50 2 * * ? 2060 + +# Fail or not when there are node integrity checker errors +integrity.failOnError=true + +# Database connection properties +db.driver=${alfresco.db.datasource.class} +db.url=${alfresco.db.url} +db.username=${alfresco.db.username} +db.password=${alfresco.db.password} +db.pool.initial=10 +db.pool.max=100 +hibernate.dialect=${alfresco.db.hibernate.dialect} + +# File servers related properties +# For local runs we disable CIFS and FTP +cifs.enabled=false +ftp.enabled=false + +# Solr config +index.subsystem.name=solr4 solr.secureComms=none \ No newline at end of file diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/AllTestSuite.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/AllTestSuite.java index 7d74207bba..e2da099a7a 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/AllTestSuite.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/AllTestSuite.java @@ -1,67 +1,67 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import org.junit.extensions.cpsuite.ClasspathSuite; -import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters; -import org.junit.extensions.cpsuite.ClasspathSuite.SuiteTypes; -import org.junit.extensions.cpsuite.SuiteType; -import org.junit.runner.RunWith; - -/** - * Convenience test suite that runs all the tests. - * - * @author Roy Wetherall - * @since 2.1 - */ -@RunWith(ClasspathSuite.class) -@SuiteTypes({SuiteType.TEST_CLASSES, SuiteType.RUN_WITH_CLASSES, SuiteType.JUNIT38_TEST_CLASSES}) -@ClassnameFilters({ - // Execute all test classes ending with "Test" - ".*Test", - // Exclude the ones ending with "UnitTest" - "!.*UnitTest", - // Put the test classes you want to exclude here - "!.*DataLoadSystemTest", - "!.*RM2072Test", - "!.*RM2190Test", - "!.*RM981SystemTest", - "!.*RM3993Test", - "!.*RecordsManagementEventServiceImplTest", - "!.*RmRestApiTest", - "!.*NotificationServiceHelperSystemTest", - "!.*RetryingTransactionHelperBaseTest", - "!.*RMCaveatConfigServiceImplTest", - // This test is running successfully locally but not on bamboo (if executed as a single test). - // The problem can be reproduced if the whole test suite is run locally as well. - // Tests should not be dependant on other test classes and should run in any order without any problems. - "!.*EmailMapScriptTest" -}) -public class AllTestSuite -{ -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import org.junit.extensions.cpsuite.ClasspathSuite; +import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters; +import org.junit.extensions.cpsuite.ClasspathSuite.SuiteTypes; +import org.junit.extensions.cpsuite.SuiteType; +import org.junit.runner.RunWith; + +/** + * Convenience test suite that runs all the tests. + * + * @author Roy Wetherall + * @since 2.1 + */ +@RunWith(ClasspathSuite.class) +@SuiteTypes({SuiteType.TEST_CLASSES, SuiteType.RUN_WITH_CLASSES, SuiteType.JUNIT38_TEST_CLASSES}) +@ClassnameFilters({ + // Execute all test classes ending with "Test" + ".*Test", + // Exclude the ones ending with "UnitTest" + "!.*UnitTest", + // Put the test classes you want to exclude here + "!.*DataLoadSystemTest", + "!.*RM2072Test", + "!.*RM2190Test", + "!.*RM981SystemTest", + "!.*RM3993Test", + "!.*RecordsManagementEventServiceImplTest", + "!.*RmRestApiTest", + "!.*NotificationServiceHelperSystemTest", + "!.*RetryingTransactionHelperBaseTest", + "!.*RMCaveatConfigServiceImplTest", + // This test is running successfully locally but not on bamboo (if executed as a single test). + // The problem can be reproduced if the whole test suite is run locally as well. + // Tests should not be dependant on other test classes and should run in any order without any problems. + "!.*EmailMapScriptTest" +}) +public class AllTestSuite +{ +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java index 9d10f86033..1126b39a31 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java @@ -1,360 +1,360 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.destroy; - -import java.io.InputStream; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.content.ContentDestructionComponent; -import org.alfresco.module.org_alfresco_module_rm.content.EagerContentStoreCleaner; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestContentCleanser; -import org.alfresco.repo.content.ContentStore; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.rendition.RenditionService; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Acceptance criteria for content destruction and content cleansing. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class DestroyContentTest extends BaseRMTestCase -{ - private static final String BEAN_NAME_CONTENT_CLEANSER = "contentCleanser.test"; - - protected ContentStore contentStore; - protected TestContentCleanser contentCleanser; - protected ContentDestructionComponent contentDestructionComponent; - private EagerContentStoreCleaner eagerContentStoreCleaner; - @SuppressWarnings("unused") - private RenditionService renditionService; - - @Override - protected void initServices() - { - super.initServices(); - contentStore = (ContentStore)applicationContext.getBean("fileContentStore"); - contentCleanser = (TestContentCleanser)applicationContext.getBean(BEAN_NAME_CONTENT_CLEANSER); - eagerContentStoreCleaner = (EagerContentStoreCleaner)applicationContext.getBean("eagerContentStoreCleaner"); - contentDestructionComponent = (ContentDestructionComponent)applicationContext.getBean("contentDestructionComponent"); - renditionService = (RenditionService)applicationContext.getBean("renditionService"); - - // set the test content store cleaner - eagerContentStoreCleaner.setContentCleanser(contentCleanser); - } - - /** - * Given that a record folder is eligible for destruction - * And record ghosting is applied - * When the record folder is destroyed - * Then the record folder and records are ghosted - * And the content is destroyed - */ - public void testRecordFolderDestroy() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef recordCategoryFolderLevel; - private NodeRef destroyableFolder; - private NodeRef subRecord; - - public void given() throws Exception - { - // create destroyable record folder that contains a record - recordCategoryFolderLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule( - recordCategoryFolderLevel, - CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, - CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, - false, - true); - destroyableFolder = recordFolderService.createRecordFolder(recordCategoryFolderLevel, GUID.generate()); - - Map props = new HashMap(1); - props.put(ContentModel.PROP_TITLE, GUID.generate()); - InputStream is = System.class.getResourceAsStream("/alfresco/test/content/Image.jpg"); - - subRecord = utils.createRecord(destroyableFolder, GUID.generate(), props, MimetypeMap.MIMETYPE_IMAGE_JPEG, is); - - // Commented out, because Bamboo doesn't currently support rendition creation - // TODO figure out a way to create renditions that is supported on Bamboo - /* - renditionService.render(subRecord, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "medium")); - */ - - utils.completeRecord(subRecord); - utils.completeEvent(destroyableFolder, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(destroyableFolder, CutOffAction.NAME); - - // assert things are as we expect - assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableFolder).getName()); - assertTrue(dispositionService.isNextDispositionActionEligible(destroyableFolder)); - - // reset test content cleanser - contentCleanser.reset(); - assertFalse(contentDestructionComponent.isCleansingEnabled()); - } - - public void when() throws Exception - { - // destroy the folder - rmActionService.executeRecordsManagementAction(destroyableFolder, DestroyAction.NAME); - } - - public void then() throws Exception - { - // folder and record exist and are ghosted - assertTrue(nodeService.exists(destroyableFolder)); - assertTrue(nodeService.hasAspect(destroyableFolder, ASPECT_GHOSTED)); - assertTrue(nodeService.exists(subRecord)); - assertTrue(nodeService.hasAspect(subRecord, ASPECT_GHOSTED)); - - // record content is destroyed - ContentReader reader = contentService.getReader(subRecord, PROP_CONTENT); - assertNull(reader); - - // content cleansing hasn't taken place - assertFalse(contentCleanser.hasCleansed()); - - // ensure the record isn't in the archive store - NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, subRecord.getId()); - assertFalse(nodeService.exists(archiveNodeRef)); - } - }); - } - - /** - * Given that a record is eligible for destruction - * And record ghosting is applied - * When the record is destroyed - * Then the record is ghosted - * And the content is destroyed - */ - public void testRecordDestroy() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef recordCategoryRecordLevel; - private NodeRef recordFolder; - private NodeRef destroyableRecord; - - public void given() throws Exception - { - // create destroyable record - recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule( - recordCategoryRecordLevel, - CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, - CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, - true, - true); - recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); - destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); - utils.completeRecord(destroyableRecord); - utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME); - - // assert things are as we expect - assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName()); - assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord)); - - // reset test content cleanser - contentCleanser.reset(); - assertFalse(contentDestructionComponent.isCleansingEnabled()); - } - - public void when() throws Exception - { - // destroy the folder - rmActionService.executeRecordsManagementAction(destroyableRecord, DestroyAction.NAME); - } - - public void then() throws Exception - { - // show that record still exists and has the ghosted aspect applied - assertTrue(nodeService.exists(destroyableRecord)); - assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED)); - - // record content is destroyed - ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT); - assertNull(reader); - - // content cleansing hasn't taken place - assertFalse(contentCleanser.hasCleansed()); - - // ensure the record isn't in the archive store - NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId()); - assertFalse(nodeService.exists(archiveNodeRef)); - - } - }); - } - - /** - * Given that a record is eligible for destruction - * And record ghosting is applied - * And cleansing is configured on - * When the record is destroyed - * Then the record is ghosted - * And the content is cleansed - * And then content is destroyed - */ - public void testRecordDestroyAndCleanse() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef recordCategoryRecordLevel; - private NodeRef recordFolder; - private NodeRef destroyableRecord; - - public void given() throws Exception - { - // create destroyable record - recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule( - recordCategoryRecordLevel, - CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, - CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, - true, - true); - recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); - destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); - utils.completeRecord(destroyableRecord); - utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME); - - // assert things are as we expect - assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName()); - assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord)); - - // reset test content cleanser and configure on - contentCleanser.reset(); - contentDestructionComponent.setCleansingEnabled(true); - assertTrue(contentDestructionComponent.isCleansingEnabled()); - } - - public void when() throws Exception - { - // destroy the folder - rmActionService.executeRecordsManagementAction(destroyableRecord, DestroyAction.NAME); - } - - public void then() throws Exception - { - // show that record still exists and has the ghosted aspect applied - assertTrue(nodeService.exists(destroyableRecord)); - assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED)); - - // record content is destroyed - ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT); - assertNull(reader); - - // content cleansing has taken place - assertTrue(contentCleanser.hasCleansed()); - - // ensure the record isn't in the archive store - NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId()); - assertFalse(nodeService.exists(archiveNodeRef)); - } - - public void after() throws Exception - { - // reset cleansing to default - contentDestructionComponent.setCleansingEnabled(false); - } - }); - } - - /** - * When a unclassified document (non-record) is deleted - * Then it is deleted but the the content is not immediately destroyed - */ - public void testContentDelete() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef deleteableContent; - private ContentData contentData; - - public void given() throws Exception - { - // create deletable content - assertTrue(nodeService.exists(folder)); - deleteableContent = fileFolderService.create(folder, "myDocument.txt", TYPE_CONTENT).getNodeRef(); - ContentWriter writer = fileFolderService.getWriter(deleteableContent); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(GUID.generate()); - - contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT); - - // assert things are as we expect - assertNotNull(contentData); - assertTrue(contentStore.exists(contentData.getContentUrl())); - - // reset test content cleanser - contentCleanser.reset(); - assertFalse(contentDestructionComponent.isCleansingEnabled()); - } - - public void when() throws Exception - { - // delete the content - nodeService.deleteNode(deleteableContent); - } - - public void then() throws Exception - { - // content deleted but not destroyed - assertFalse(nodeService.exists(deleteableContent)); - assertTrue(contentStore.exists(contentData.getContentUrl())); - - // content cleansing hasn't taken place - assertFalse(contentCleanser.hasCleansed()); - - // ensure the content is in the archive store - NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId()); - assertTrue(nodeService.exists(archiveNodeRef)); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.destroy; + +import java.io.InputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; +import org.alfresco.module.org_alfresco_module_rm.content.ContentDestructionComponent; +import org.alfresco.module.org_alfresco_module_rm.content.EagerContentStoreCleaner; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.module.org_alfresco_module_rm.test.util.TestContentCleanser; +import org.alfresco.repo.content.ContentStore; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.rendition.RenditionService; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * Acceptance criteria for content destruction and content cleansing. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class DestroyContentTest extends BaseRMTestCase +{ + private static final String BEAN_NAME_CONTENT_CLEANSER = "contentCleanser.test"; + + protected ContentStore contentStore; + protected TestContentCleanser contentCleanser; + protected ContentDestructionComponent contentDestructionComponent; + private EagerContentStoreCleaner eagerContentStoreCleaner; + @SuppressWarnings("unused") + private RenditionService renditionService; + + @Override + protected void initServices() + { + super.initServices(); + contentStore = (ContentStore)applicationContext.getBean("fileContentStore"); + contentCleanser = (TestContentCleanser)applicationContext.getBean(BEAN_NAME_CONTENT_CLEANSER); + eagerContentStoreCleaner = (EagerContentStoreCleaner)applicationContext.getBean("eagerContentStoreCleaner"); + contentDestructionComponent = (ContentDestructionComponent)applicationContext.getBean("contentDestructionComponent"); + renditionService = (RenditionService)applicationContext.getBean("renditionService"); + + // set the test content store cleaner + eagerContentStoreCleaner.setContentCleanser(contentCleanser); + } + + /** + * Given that a record folder is eligible for destruction + * And record ghosting is applied + * When the record folder is destroyed + * Then the record folder and records are ghosted + * And the content is destroyed + */ + public void testRecordFolderDestroy() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef recordCategoryFolderLevel; + private NodeRef destroyableFolder; + private NodeRef subRecord; + + public void given() throws Exception + { + // create destroyable record folder that contains a record + recordCategoryFolderLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createBasicDispositionSchedule( + recordCategoryFolderLevel, + CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, + CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, + false, + true); + destroyableFolder = recordFolderService.createRecordFolder(recordCategoryFolderLevel, GUID.generate()); + + Map props = new HashMap(1); + props.put(ContentModel.PROP_TITLE, GUID.generate()); + InputStream is = System.class.getResourceAsStream("/alfresco/test/content/Image.jpg"); + + subRecord = utils.createRecord(destroyableFolder, GUID.generate(), props, MimetypeMap.MIMETYPE_IMAGE_JPEG, is); + + // Commented out, because Bamboo doesn't currently support rendition creation + // TODO figure out a way to create renditions that is supported on Bamboo + /* + renditionService.render(subRecord, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "medium")); + */ + + utils.completeRecord(subRecord); + utils.completeEvent(destroyableFolder, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(destroyableFolder, CutOffAction.NAME); + + // assert things are as we expect + assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableFolder).getName()); + assertTrue(dispositionService.isNextDispositionActionEligible(destroyableFolder)); + + // reset test content cleanser + contentCleanser.reset(); + assertFalse(contentDestructionComponent.isCleansingEnabled()); + } + + public void when() throws Exception + { + // destroy the folder + rmActionService.executeRecordsManagementAction(destroyableFolder, DestroyAction.NAME); + } + + public void then() throws Exception + { + // folder and record exist and are ghosted + assertTrue(nodeService.exists(destroyableFolder)); + assertTrue(nodeService.hasAspect(destroyableFolder, ASPECT_GHOSTED)); + assertTrue(nodeService.exists(subRecord)); + assertTrue(nodeService.hasAspect(subRecord, ASPECT_GHOSTED)); + + // record content is destroyed + ContentReader reader = contentService.getReader(subRecord, PROP_CONTENT); + assertNull(reader); + + // content cleansing hasn't taken place + assertFalse(contentCleanser.hasCleansed()); + + // ensure the record isn't in the archive store + NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, subRecord.getId()); + assertFalse(nodeService.exists(archiveNodeRef)); + } + }); + } + + /** + * Given that a record is eligible for destruction + * And record ghosting is applied + * When the record is destroyed + * Then the record is ghosted + * And the content is destroyed + */ + public void testRecordDestroy() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef recordCategoryRecordLevel; + private NodeRef recordFolder; + private NodeRef destroyableRecord; + + public void given() throws Exception + { + // create destroyable record + recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createBasicDispositionSchedule( + recordCategoryRecordLevel, + CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, + CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, + true, + true); + recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); + destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); + utils.completeRecord(destroyableRecord); + utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME); + + // assert things are as we expect + assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName()); + assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord)); + + // reset test content cleanser + contentCleanser.reset(); + assertFalse(contentDestructionComponent.isCleansingEnabled()); + } + + public void when() throws Exception + { + // destroy the folder + rmActionService.executeRecordsManagementAction(destroyableRecord, DestroyAction.NAME); + } + + public void then() throws Exception + { + // show that record still exists and has the ghosted aspect applied + assertTrue(nodeService.exists(destroyableRecord)); + assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED)); + + // record content is destroyed + ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT); + assertNull(reader); + + // content cleansing hasn't taken place + assertFalse(contentCleanser.hasCleansed()); + + // ensure the record isn't in the archive store + NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId()); + assertFalse(nodeService.exists(archiveNodeRef)); + + } + }); + } + + /** + * Given that a record is eligible for destruction + * And record ghosting is applied + * And cleansing is configured on + * When the record is destroyed + * Then the record is ghosted + * And the content is cleansed + * And then content is destroyed + */ + public void testRecordDestroyAndCleanse() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef recordCategoryRecordLevel; + private NodeRef recordFolder; + private NodeRef destroyableRecord; + + public void given() throws Exception + { + // create destroyable record + recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createBasicDispositionSchedule( + recordCategoryRecordLevel, + CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, + CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, + true, + true); + recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); + destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); + utils.completeRecord(destroyableRecord); + utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME); + + // assert things are as we expect + assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName()); + assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord)); + + // reset test content cleanser and configure on + contentCleanser.reset(); + contentDestructionComponent.setCleansingEnabled(true); + assertTrue(contentDestructionComponent.isCleansingEnabled()); + } + + public void when() throws Exception + { + // destroy the folder + rmActionService.executeRecordsManagementAction(destroyableRecord, DestroyAction.NAME); + } + + public void then() throws Exception + { + // show that record still exists and has the ghosted aspect applied + assertTrue(nodeService.exists(destroyableRecord)); + assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED)); + + // record content is destroyed + ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT); + assertNull(reader); + + // content cleansing has taken place + assertTrue(contentCleanser.hasCleansed()); + + // ensure the record isn't in the archive store + NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId()); + assertFalse(nodeService.exists(archiveNodeRef)); + } + + public void after() throws Exception + { + // reset cleansing to default + contentDestructionComponent.setCleansingEnabled(false); + } + }); + } + + /** + * When a unclassified document (non-record) is deleted + * Then it is deleted but the the content is not immediately destroyed + */ + public void testContentDelete() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef deleteableContent; + private ContentData contentData; + + public void given() throws Exception + { + // create deletable content + assertTrue(nodeService.exists(folder)); + deleteableContent = fileFolderService.create(folder, "myDocument.txt", TYPE_CONTENT).getNodeRef(); + ContentWriter writer = fileFolderService.getWriter(deleteableContent); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.putContent(GUID.generate()); + + contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT); + + // assert things are as we expect + assertNotNull(contentData); + assertTrue(contentStore.exists(contentData.getContentUrl())); + + // reset test content cleanser + contentCleanser.reset(); + assertFalse(contentDestructionComponent.isCleansingEnabled()); + } + + public void when() throws Exception + { + // delete the content + nodeService.deleteNode(deleteableContent); + } + + public void then() throws Exception + { + // content deleted but not destroyed + assertFalse(nodeService.exists(deleteableContent)); + assertTrue(contentStore.exists(contentData.getContentUrl())); + + // content cleansing hasn't taken place + assertFalse(contentCleanser.hasCleansed()); + + // ensure the content is in the archive store + NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId()); + assertTrue(nodeService.exists(archiveNodeRef)); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/CutOffTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/CutOffTest.java index b912b582cb..b37c078663 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/CutOffTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/CutOffTest.java @@ -1,227 +1,227 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.disposition; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Cut off integration tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class CutOffTest extends BaseRMTestCase -{ - /** - * given we have a record folder that is eligible for cutoff ensure that the - * record can be cut off successfully. - */ - public void testCutOffRecordFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - @Override - public void given() - { - //create record folder - recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - - // TODO add some records - - // make eligible for cutoff - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - @Override - public void when() - { - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); - } - - @Override - public void then() - { - // ensure the record folder is cut off - assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); - } - }); - - } - - /** - * given that we have a closed record folder eligible for cut off ensure that it can - * be cut off. - *

- * relates to https://issues.alfresco.com/jira/browse/RM-1340 - */ - public void testCutOffClosedRecordFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - @Override - public void given() - { - //create record folder - recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - - // TODO add some records - - // make eligible for cutoff - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - - // close the record folder - recordFolderService.closeRecordFolder(recordFolder); - } - - @Override - public void when() - { - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); - } - - @Override - public void then() - { - // ensure the record folder is cut off - assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); - } - }); - } - - /** - * given we have a record folder that is eligible for cutoff ensure that the - * record can be cut off successfully. - */ - public void testCutOffUncutOffRecordFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - @Override - public void given() - { - //create record folder - recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - nodeService.addAspect(recordFolder, ASPECT_UNCUT_OFF, null); - - // TODO add some records - - // make eligible for cutoff - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - @Override - public void when() - { - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); - } - - @Override - public void then() - { - // ensure the record folder is cut off - assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); - } - }); - - } - - /** - * given we have a record folder that is eligible for cutoff ensure that the - * record can be cut off successfully. - */ - public void testCutOffUncutOffRecordFolderFromSchedule() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - @Override - public void given() - { - //create record folder - recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - nodeService.addAspect(recordFolder, ASPECT_UNCUT_OFF, null); - - // TODO add some records - - // make eligible for cutoff - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - @Override - public void when() - { - // complete event - Map params = new HashMap(1); - params.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE); - try - { - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, params); - } - catch(AlfrescoRuntimeException e) { } // expected - } - - @Override - public void then() - { - // ensure the record folder is cut off - assertFalse(dispositionService.isDisposableItemCutoff(recordFolder)); - } - }); - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.disposition; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMDispositionActionExecuterAbstractBase; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.GUID; + +/** + * Cut off integration tests. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class CutOffTest extends BaseRMTestCase +{ + /** + * given we have a record folder that is eligible for cutoff ensure that the + * record can be cut off successfully. + */ + public void testCutOffRecordFolder() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef recordFolder = null; + + @Override + public void given() + { + //create record folder + recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); + + // TODO add some records + + // make eligible for cutoff + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + } + + @Override + public void when() + { + // complete event + rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); + } + + @Override + public void then() + { + // ensure the record folder is cut off + assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); + } + }); + + } + + /** + * given that we have a closed record folder eligible for cut off ensure that it can + * be cut off. + *

+ * relates to https://issues.alfresco.com/jira/browse/RM-1340 + */ + public void testCutOffClosedRecordFolder() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef recordFolder = null; + + @Override + public void given() + { + //create record folder + recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); + + // TODO add some records + + // make eligible for cutoff + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + + // close the record folder + recordFolderService.closeRecordFolder(recordFolder); + } + + @Override + public void when() + { + // complete event + rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); + } + + @Override + public void then() + { + // ensure the record folder is cut off + assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); + } + }); + } + + /** + * given we have a record folder that is eligible for cutoff ensure that the + * record can be cut off successfully. + */ + public void testCutOffUncutOffRecordFolder() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef recordFolder = null; + + @Override + public void given() + { + //create record folder + recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); + nodeService.addAspect(recordFolder, ASPECT_UNCUT_OFF, null); + + // TODO add some records + + // make eligible for cutoff + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + } + + @Override + public void when() + { + // complete event + rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, null); + } + + @Override + public void then() + { + // ensure the record folder is cut off + assertTrue(dispositionService.isDisposableItemCutoff(recordFolder)); + } + }); + + } + + /** + * given we have a record folder that is eligible for cutoff ensure that the + * record can be cut off successfully. + */ + public void testCutOffUncutOffRecordFolderFromSchedule() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef recordFolder = null; + + @Override + public void given() + { + //create record folder + recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); + nodeService.addAspect(recordFolder, ASPECT_UNCUT_OFF, null); + + // TODO add some records + + // make eligible for cutoff + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + } + + @Override + public void when() + { + // complete event + Map params = new HashMap(1); + params.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE); + try + { + rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME, params); + } + catch(AlfrescoRuntimeException e) { } // expected + } + + @Override + public void then() + { + // ensure the record folder is cut off + assertFalse(dispositionService.isDisposableItemCutoff(recordFolder)); + } + }); + + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1147DODRMSiteTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1147DODRMSiteTest.java index 6e24daad5f..cbbfe35122 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1147DODRMSiteTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1147DODRMSiteTest.java @@ -1,185 +1,185 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.dod; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.util.GUID; - - -/** - * Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RM1147DODRMSiteTest extends BaseRMTestCase implements DOD5015Model -{ - /** - * Don't create a RM test site in setup - */ - @Override - protected boolean isRMSiteTest() - { - return false; - } - - /** - * Test the creation of a DOD file plan via the file plan service - */ - public void testCreateDODFilePlan() - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return filePlanService.createFilePlan(folder, "myDODfileplan", TYPE_DOD_5015_FILE_PLAN); - } - - @Override - public void test(NodeRef filePlan) throws Exception - { - assertNotNull(filePlan); - assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan)); - assertTrue(filePlanService.isFilePlanComponent(filePlan)); - assertTrue(filePlanService.isFilePlan(filePlan)); - assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); - assertNotNull(filePlanService.getUnfiledContainer(filePlan)); - assertNotNull(filePlanService.getHoldContainer(filePlan)); - assertNotNull(filePlanService.getTransferContainer(filePlan)); - assertTrue(filePlanService.getFilePlans().contains(filePlan)); - assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty()); - } - }); - } - - /** - * Test the creation of a DOD site via the site service - */ - public void testCreateDODRMSite() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public SiteInfo run() throws Exception - { - return siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); - } - - @Override - public void test(SiteInfo siteInfo) throws Exception - { - assertNotNull(siteInfo); - assertEquals(TYPE_DOD_5015_SITE, nodeService.getType(siteInfo.getNodeRef())); - - NodeRef filePlan = siteService.getContainer(siteId, "documentLibrary"); - assertNotNull(filePlan); - assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan)); - assertTrue(filePlanService.isFilePlanComponent(filePlan)); - assertTrue(filePlanService.isFilePlan(filePlan)); - assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); - assertNotNull(filePlanService.getUnfiledContainer(filePlan)); - assertNotNull(filePlanService.getHoldContainer(filePlan)); - assertNotNull(filePlanService.getTransferContainer(filePlan)); - assertTrue(filePlanService.getFilePlans().contains(filePlan)); - assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty()); - } - }); - } - - /** - * Test to ensure that a record created in the a DOD site does have the DOD meta-data attached - */ - public void testDODRecord() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public NodeRef run() throws Exception - { - siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); - NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); - assertNotNull(filePlan); - - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); - NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertNotNull(record); - assertTrue(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD)); - } - }); - } - - /** - * Test to ensure a record created in a vanilla site does not have the DOD meta-data attached - */ - public void testVanillaRecord() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public NodeRef run() throws Exception - { - siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE); - NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); - assertNotNull(filePlan); - - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); - NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertNotNull(record); - assertFalse(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD)); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.dod; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.util.GUID; + + +/** + * Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RM1147DODRMSiteTest extends BaseRMTestCase implements DOD5015Model +{ + /** + * Don't create a RM test site in setup + */ + @Override + protected boolean isRMSiteTest() + { + return false; + } + + /** + * Test the creation of a DOD file plan via the file plan service + */ + public void testCreateDODFilePlan() + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + return filePlanService.createFilePlan(folder, "myDODfileplan", TYPE_DOD_5015_FILE_PLAN); + } + + @Override + public void test(NodeRef filePlan) throws Exception + { + assertNotNull(filePlan); + assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan)); + assertTrue(filePlanService.isFilePlanComponent(filePlan)); + assertTrue(filePlanService.isFilePlan(filePlan)); + assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); + assertNotNull(filePlanService.getUnfiledContainer(filePlan)); + assertNotNull(filePlanService.getHoldContainer(filePlan)); + assertNotNull(filePlanService.getTransferContainer(filePlan)); + assertTrue(filePlanService.getFilePlans().contains(filePlan)); + assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty()); + } + }); + } + + /** + * Test the creation of a DOD site via the site service + */ + public void testCreateDODRMSite() + { + doTestInTransaction(new Test() + { + String siteId = GUID.generate(); + + @Override + public SiteInfo run() throws Exception + { + return siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); + } + + @Override + public void test(SiteInfo siteInfo) throws Exception + { + assertNotNull(siteInfo); + assertEquals(TYPE_DOD_5015_SITE, nodeService.getType(siteInfo.getNodeRef())); + + NodeRef filePlan = siteService.getContainer(siteId, "documentLibrary"); + assertNotNull(filePlan); + assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan)); + assertTrue(filePlanService.isFilePlanComponent(filePlan)); + assertTrue(filePlanService.isFilePlan(filePlan)); + assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); + assertNotNull(filePlanService.getUnfiledContainer(filePlan)); + assertNotNull(filePlanService.getHoldContainer(filePlan)); + assertNotNull(filePlanService.getTransferContainer(filePlan)); + assertTrue(filePlanService.getFilePlans().contains(filePlan)); + assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty()); + } + }); + } + + /** + * Test to ensure that a record created in the a DOD site does have the DOD meta-data attached + */ + public void testDODRecord() + { + doTestInTransaction(new Test() + { + String siteId = GUID.generate(); + + @Override + public NodeRef run() throws Exception + { + siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); + NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); + assertNotNull(filePlan); + + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); + NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); + NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); + + return record; + } + + @Override + public void test(NodeRef record) throws Exception + { + assertNotNull(record); + assertTrue(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD)); + } + }); + } + + /** + * Test to ensure a record created in a vanilla site does not have the DOD meta-data attached + */ + public void testVanillaRecord() + { + doTestInTransaction(new Test() + { + String siteId = GUID.generate(); + + @Override + public NodeRef run() throws Exception + { + siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE); + NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); + assertNotNull(filePlan); + + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); + NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); + NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); + + return record; + } + + @Override + public void test(NodeRef record) throws Exception + { + assertNotNull(record); + assertFalse(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD)); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java index 220f2339bc..f3e894722b 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java @@ -1,124 +1,124 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.dod; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - - -/** - * Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RM1194ExcludeDoDRecordTypesTest extends BaseRMTestCase implements DOD5015Model -{ - /** - * Don't create a RM test site in setup - */ - @Override - protected boolean isRMSiteTest() - { - return false; - } - - /** - * Ensure that the correct record metadata aspects are available for a DoD record. - */ - public void testDODRecord() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public NodeRef run() throws Exception - { - siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); - NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); - assertNotNull(filePlan); - - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); - NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertNotNull(record); - Set aspects = recordService.getRecordMetadataAspects(record); - assertNotNull(aspects); - assertEquals(5, aspects.size()); - } - }); - } - - /** - * Ensure that the correct record metadata aspects are available for a vanilla record. - */ - public void testVanillaRecord() - { - doTestInTransaction(new Test() - { - String siteId = GUID.generate(); - - @Override - public NodeRef run() throws Exception - { - siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE); - NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); - assertNotNull(filePlan); - - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); - NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertNotNull(record); - Set aspects = recordService.getRecordMetadataAspects(record); - assertNotNull(aspects); - assertEquals(2, aspects.size()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.dod; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + + +/** + * Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RM1194ExcludeDoDRecordTypesTest extends BaseRMTestCase implements DOD5015Model +{ + /** + * Don't create a RM test site in setup + */ + @Override + protected boolean isRMSiteTest() + { + return false; + } + + /** + * Ensure that the correct record metadata aspects are available for a DoD record. + */ + public void testDODRecord() + { + doTestInTransaction(new Test() + { + String siteId = GUID.generate(); + + @Override + public NodeRef run() throws Exception + { + siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE); + NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); + assertNotNull(filePlan); + + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); + NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); + NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); + + return record; + } + + @Override + public void test(NodeRef record) throws Exception + { + assertNotNull(record); + Set aspects = recordService.getRecordMetadataAspects(record); + assertNotNull(aspects); + assertEquals(5, aspects.size()); + } + }); + } + + /** + * Ensure that the correct record metadata aspects are available for a vanilla record. + */ + public void testVanillaRecord() + { + doTestInTransaction(new Test() + { + String siteId = GUID.generate(); + + @Override + public NodeRef run() throws Exception + { + siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE); + NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary"); + assertNotNull(filePlan); + + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne"); + NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne"); + NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One"); + + return record; + } + + @Override + public void test(NodeRef record) throws Exception + { + assertNotNull(record); + Set aspects = recordService.getRecordMetadataAspects(record); + assertNotNull(aspects); + assertEquals(2, aspects.size()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/event/CompleteEventsTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/event/CompleteEventsTest.java index b0d6c91310..5cc60c024f 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/event/CompleteEventsTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/event/CompleteEventsTest.java @@ -1,456 +1,456 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.event; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.GUID; - -/** - * Complete events integration tests. - *

- * Relates to: - * - https://issues.alfresco.com/jira/browse/RM-1341 - * - * @author Roy Wetherall - * @since 2.2 - */ -public class CompleteEventsTest extends BaseRMTestCase -{ - private static final String ANOTHER_EVENT = "abolished"; - - /** - * test completion of a single event on a record level disposition schedule - */ - public void testCompleteSingleEventRecordLevel() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", true, true); - - // create record folder - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - } - - public void when() - { - // build action properties - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(record, CompleteEventAction.NAME, params); - - } - - public void then() - { - // check that the record is now eligible for the next disposition action - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - - // check the next disposition action - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - } - }); - } - - /** - * test completion of a single event at the record level - */ - public void testCompleteSimpleSingleEventRecordFolderLevel() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef recordFolder; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, true); - - // create record folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - - } - - public void when() - { - // build action properties - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - public void then() - { - // check that the record is now eligible for the next disposition action - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - - // check the next disposition action - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - } - }); - } - - /** - * test complete event given at least one event is needed for the disposition action to be eligible - */ - public void testAtLeastOneEventToBeEligible() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); - - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); - - List events = new ArrayList(1); - events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); - events.add(ANOTHER_EVENT); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - dispositionService.addDispositionActionDefinition(mySchedule, adParams); - - // create record folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - - } - public void when() - { - // build action properties - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - public void then() - { - // check that the record is now eligible for the next disposition action - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - - // check the next disposition action - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - - eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); - assertNotNull(eventDetails); - assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); - assertFalse(eventDetails.isEventComplete()); - assertNull(eventDetails.getEventCompletedAt()); - assertNull(eventDetails.getEventCompletedBy()); - } - }); - } - - /** - * test that disposition action is not eligible given all events need to be completed and only has been - */ - public void testOnlyOneOfAllEventsSoNotEligible() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); - - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); - adParams.put(PROP_DISPOSITION_EVENT_COMBINATION, "and"); - - List events = new ArrayList(1); - events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); - events.add(ANOTHER_EVENT); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - dispositionService.addDispositionActionDefinition(mySchedule, adParams); - - // create record folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - } - - public void when() - { - // build action properties - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - public void then() - { - assertFalse(dispositionService.isNextDispositionActionEligible(recordFolder)); - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - - eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); - assertNotNull(eventDetails); - assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); - assertFalse(eventDetails.isEventComplete()); - assertNull(eventDetails.getEventCompletedAt()); - assertNull(eventDetails.getEventCompletedBy()); - } - }); - } - - /** - * test event complete makes disposition eligible given that all events are complete and required - */ - public void testAllEventsSoEligible() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef recordFolder = null; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); - - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); - adParams.put(PROP_DISPOSITION_EVENT_COMBINATION, "and"); - - List events = new ArrayList(1); - events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); - events.add(ANOTHER_EVENT); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - dispositionService.addDispositionActionDefinition(mySchedule, adParams); - - // create record folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // file record - NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); - utils.completeRecord(record); - } - - public void when() - { - // build action properties - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - - // build action properties - params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, ANOTHER_EVENT); - - // complete event - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - } - - public void then() - { - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - - eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); - assertNotNull(eventDetails); - assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - - } - }); - } - - /** - * test complete event works for multi-filed record - */ - public void testCompleteEventWhenCutoffMultiFiled_RM1341() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - - public void given() - { - // create record category - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - NodeRef recordCategory2 = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create disposition schedule - utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", true, true); - - // create record folder - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - NodeRef recordFolder2 = recordFolderService.createRecordFolder(recordCategory2, GUID.generate()); - - // file record - String recordName = GUID.generate(); - record = utils.createRecord(recordFolder, recordName, "title"); - utils.completeRecord(record); - - // link record to second record folder - nodeService.addChild(recordFolder2, record, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, recordName)); - } - - public void when() - { - // build action properties - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - - // complete event - rmActionService.executeRecordsManagementAction(record, CompleteEventAction.NAME, params); - } - - public void then() - { - // check that the record is now eligible for the next disposition action - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - - // check the next disposition action - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - - EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); - assertNotNull(eventDetails); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); - assertTrue(eventDetails.isEventComplete()); - assertNotNull(eventDetails.getEventCompletedAt()); - assertNotNull(eventDetails.getEventCompletedBy()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.event; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.GUID; + +/** + * Complete events integration tests. + *

+ * Relates to: + * - https://issues.alfresco.com/jira/browse/RM-1341 + * + * @author Roy Wetherall + * @since 2.2 + */ +public class CompleteEventsTest extends BaseRMTestCase +{ + private static final String ANOTHER_EVENT = "abolished"; + + /** + * test completion of a single event on a record level disposition schedule + */ + public void testCompleteSingleEventRecordLevel() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + + public void given() + { + // create record category + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + // create disposition schedule + utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", true, true); + + // create record folder + NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + + // file record + record = utils.createRecord(recordFolder, GUID.generate(), "title"); + utils.completeRecord(record); + } + + public void when() + { + // build action properties + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + + // complete event + rmActionService.executeRecordsManagementAction(record, CompleteEventAction.NAME, params); + + } + + public void then() + { + // check that the record is now eligible for the next disposition action + assertTrue(dispositionService.isNextDispositionActionEligible(record)); + + // check the next disposition action + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertEquals("cutoff", dispositionAction.getName()); + + EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); + assertNotNull(eventDetails); + assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); + assertTrue(eventDetails.isEventComplete()); + assertNotNull(eventDetails.getEventCompletedAt()); + assertNotNull(eventDetails.getEventCompletedBy()); + } + }); + } + + /** + * test completion of a single event at the record level + */ + public void testCompleteSimpleSingleEventRecordFolderLevel() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef recordFolder; + + public void given() + { + // create record category + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + // create disposition schedule + utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, true); + + // create record folder + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + + // file record + NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); + utils.completeRecord(record); + + } + + public void when() + { + // build action properties + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + + // complete event + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + } + + public void then() + { + // check that the record is now eligible for the next disposition action + assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); + + // check the next disposition action + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); + assertNotNull(dispositionAction); + assertEquals("cutoff", dispositionAction.getName()); + + EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); + assertNotNull(eventDetails); + assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); + assertTrue(eventDetails.isEventComplete()); + assertNotNull(eventDetails.getEventCompletedAt()); + assertNotNull(eventDetails.getEventCompletedBy()); + } + }); + } + + /** + * test complete event given at least one event is needed for the disposition action to be eligible + */ + public void testAtLeastOneEventToBeEligible() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef recordFolder = null; + + public void given() + { + // create record category + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + // create disposition schedule + DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); + + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); + + List events = new ArrayList(1); + events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); + events.add(ANOTHER_EVENT); + adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); + dispositionService.addDispositionActionDefinition(mySchedule, adParams); + + // create record folder + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + + // file record + NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); + utils.completeRecord(record); + + } + public void when() + { + // build action properties + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + + // complete event + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + } + + public void then() + { + // check that the record is now eligible for the next disposition action + assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); + + // check the next disposition action + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); + assertNotNull(dispositionAction); + assertEquals("cutoff", dispositionAction.getName()); + + EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); + assertNotNull(eventDetails); + assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); + assertTrue(eventDetails.isEventComplete()); + assertNotNull(eventDetails.getEventCompletedAt()); + assertNotNull(eventDetails.getEventCompletedBy()); + + eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); + assertNotNull(eventDetails); + assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); + assertFalse(eventDetails.isEventComplete()); + assertNull(eventDetails.getEventCompletedAt()); + assertNull(eventDetails.getEventCompletedBy()); + } + }); + } + + /** + * test that disposition action is not eligible given all events need to be completed and only has been + */ + public void testOnlyOneOfAllEventsSoNotEligible() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef recordFolder = null; + + public void given() + { + // create record category + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + // create disposition schedule + DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); + + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); + adParams.put(PROP_DISPOSITION_EVENT_COMBINATION, "and"); + + List events = new ArrayList(1); + events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); + events.add(ANOTHER_EVENT); + adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); + dispositionService.addDispositionActionDefinition(mySchedule, adParams); + + // create record folder + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + + // file record + NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); + utils.completeRecord(record); + } + + public void when() + { + // build action properties + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + + // complete event + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + } + + public void then() + { + assertFalse(dispositionService.isNextDispositionActionEligible(recordFolder)); + + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); + assertNotNull(dispositionAction); + assertEquals("cutoff", dispositionAction.getName()); + + EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); + assertNotNull(eventDetails); + assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); + assertTrue(eventDetails.isEventComplete()); + assertNotNull(eventDetails.getEventCompletedAt()); + assertNotNull(eventDetails.getEventCompletedBy()); + + eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); + assertNotNull(eventDetails); + assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); + assertFalse(eventDetails.isEventComplete()); + assertNull(eventDetails.getEventCompletedAt()); + assertNull(eventDetails.getEventCompletedBy()); + } + }); + } + + /** + * test event complete makes disposition eligible given that all events are complete and required + */ + public void testAllEventsSoEligible() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef recordFolder = null; + + public void given() + { + // create record category + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + // create disposition schedule + DispositionSchedule mySchedule = utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", false, false); + + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION); + adParams.put(PROP_DISPOSITION_EVENT_COMBINATION, "and"); + + List events = new ArrayList(1); + events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); + events.add(ANOTHER_EVENT); + adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); + dispositionService.addDispositionActionDefinition(mySchedule, adParams); + + // create record folder + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + + // file record + NodeRef record = utils.createRecord(recordFolder, GUID.generate(), "title"); + utils.completeRecord(record); + } + + public void when() + { + // build action properties + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + + // complete event + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + + // build action properties + params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, ANOTHER_EVENT); + + // complete event + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + } + + public void then() + { + assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); + + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); + assertNotNull(dispositionAction); + assertEquals("cutoff", dispositionAction.getName()); + + EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); + assertNotNull(eventDetails); + assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); + assertTrue(eventDetails.isEventComplete()); + assertNotNull(eventDetails.getEventCompletedAt()); + assertNotNull(eventDetails.getEventCompletedBy()); + + eventDetails = dispositionAction.getEventCompletionDetails(ANOTHER_EVENT); + assertNotNull(eventDetails); + assertEquals(ANOTHER_EVENT, eventDetails.getEventName()); + assertTrue(eventDetails.isEventComplete()); + assertNotNull(eventDetails.getEventCompletedAt()); + assertNotNull(eventDetails.getEventCompletedBy()); + + } + }); + } + + /** + * test complete event works for multi-filed record + */ + public void testCompleteEventWhenCutoffMultiFiled_RM1341() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + + public void given() + { + // create record category + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + NodeRef recordCategory2 = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + // create disposition schedule + utils.createBasicDispositionSchedule(recordCategory, "instructions", "authority", true, true); + + // create record folder + NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + NodeRef recordFolder2 = recordFolderService.createRecordFolder(recordCategory2, GUID.generate()); + + // file record + String recordName = GUID.generate(); + record = utils.createRecord(recordFolder, recordName, "title"); + utils.completeRecord(record); + + // link record to second record folder + nodeService.addChild(recordFolder2, record, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, recordName)); + } + + public void when() + { + // build action properties + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + + // complete event + rmActionService.executeRecordsManagementAction(record, CompleteEventAction.NAME, params); + } + + public void then() + { + // check that the record is now eligible for the next disposition action + assertTrue(dispositionService.isNextDispositionActionEligible(record)); + + // check the next disposition action + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertEquals("cutoff", dispositionAction.getName()); + + EventCompletionDetails eventDetails = dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME); + assertNotNull(eventDetails); + assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, eventDetails.getEventName()); + assertTrue(eventDetails.isEventComplete()); + assertNotNull(eventDetails.getEventCompletedAt()); + assertNotNull(eventDetails.getEventCompletedBy()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddRemoveFromHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddRemoveFromHoldTest.java index e791af8ecf..2d7c491dee 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddRemoveFromHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/AddRemoveFromHoldTest.java @@ -1,424 +1,424 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.hold; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Hold service integration test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class AddRemoveFromHoldTest extends BaseRMTestCase -{ - private static final int RECORD_COUNT = 10; - - public void testAddRecordToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private NodeRef record; - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - record = recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null); - - // assert current states - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.isFrozen(record)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - - public void when() throws Exception - { - // add the record to hold - holdService.addToHold(hold, record); - } - - public void then() - { - // record is held - assertTrue(freezeService.isFrozen(record)); - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertTrue(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - // hold contains record - assertTrue(holdService.getHeld(hold).contains(record)); - assertTrue(holdService.heldBy(record, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(1, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - - } - - public void testAddRecordsToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // assert current states - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - for (NodeRef record : records) - { - assertFalse(freezeService.isFrozen(record)); - } - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - - public void when() throws Exception - { - // add the record to hold - holdService.addToHold(hold, records); - } - - public void then() - { - // record is held - for (NodeRef record : records) - { - assertTrue(freezeService.isFrozen(record)); - } - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertTrue(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - for (NodeRef record : records) - { - // hold contains record - assertTrue(holdService.getHeld(hold).contains(record)); - assertTrue(holdService.heldBy(record, true).contains(hold)); - } - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(RECORD_COUNT, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - public void testAddRecordFolderToHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // assert current states - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - for (NodeRef record : records) - { - assertFalse(freezeService.isFrozen(record)); - } - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - - public void when() throws Exception - { - // add the record to hold - holdService.addToHold(hold, recordFolder); - } - - public void then() - { - for (NodeRef record : records) - { - // record is held - assertTrue(freezeService.isFrozen(record)); - assertFalse(holdService.getHeld(hold).contains(record)); - assertTrue(holdService.heldBy(record, true).contains(hold)); - } - - // record folder has frozen children - assertTrue(freezeService.isFrozen(recordFolder)); - assertTrue(freezeService.hasFrozenChildren(recordFolder)); - - // hold contains record folder - assertTrue(holdService.getHeld(hold).contains(recordFolder)); - assertTrue(holdService.heldBy(recordFolder, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(RECORD_COUNT, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - - } - - public void testRemoveRecordsFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // add records to hold - holdService.addToHold(hold, records); - } - - public void when() throws Exception - { - // remove *some* of the records - holdService.removeFromHold(hold, records.subList(0, 5)); - } - - public void then() - { - // check record state (no longer held) - for (NodeRef record : records.subList(0, 5)) - { - assertFalse(freezeService.isFrozen(record)); - assertFalse(holdService.getHeld(hold).contains(record)); - assertFalse(holdService.heldBy(record, true).contains(hold)); - } - - // check record state (still held) - for (NodeRef record : records.subList(5, 10)) - { - assertTrue(freezeService.isFrozen(record)); - assertTrue(holdService.getHeld(hold).contains(record)); - assertTrue(holdService.heldBy(record, true).contains(hold)); - } - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertTrue(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(5, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - public void testRemoveAllRecordsFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // add records to hold - holdService.addToHold(hold, records); - } - - public void when() throws Exception - { - // remove all of the records - holdService.removeFromHold(hold, records); - } - - public void then() - { - // check record state (no longer held) - for (NodeRef record : records) - { - assertFalse(freezeService.isFrozen(record)); - assertFalse(holdService.getHeld(hold).contains(record)); - assertFalse(holdService.heldBy(record, true).contains(hold)); - } - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } - - public void testRemoveRecordFolderFromHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef hold; - private NodeRef recordCategory; - private NodeRef recordFolder; - private List records = new ArrayList(RECORD_COUNT); - - public void given() - { - // create a hold - hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - - // create a record folder that contains records - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - for (int i = 0; i < RECORD_COUNT; i++) - { - records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); - } - - // add record folder to hold - holdService.addToHold(hold, recordFolder); - } - - public void when() throws Exception - { - // remove record folder from hold - holdService.removeFromHold(hold, recordFolder); - } - - public void then() - { - // check record states - for (NodeRef record : records) - { - assertFalse(freezeService.isFrozen(record)); - assertFalse(holdService.getHeld(hold).contains(record)); - assertFalse(holdService.heldBy(record, true).contains(hold)); - } - - // record folder has frozen children - assertFalse(freezeService.isFrozen(recordFolder)); - assertFalse(freezeService.hasFrozenChildren(recordFolder)); - - // record folder is not held - assertFalse(holdService.getHeld(hold).contains(recordFolder)); - assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); - - // additional check for child held caching - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); - assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.hold; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.GUID; + +/** + * Hold service integration test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class AddRemoveFromHoldTest extends BaseRMTestCase +{ + private static final int RECORD_COUNT = 10; + + public void testAddRecordToHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + private NodeRef recordCategory; + private NodeRef recordFolder; + private NodeRef record; + + public void given() + { + // create a hold + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + + // create a record folder that contains records + recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + record = recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null); + + // assert current states + assertFalse(freezeService.isFrozen(recordFolder)); + assertFalse(freezeService.isFrozen(record)); + assertFalse(freezeService.hasFrozenChildren(recordFolder)); + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + + public void when() throws Exception + { + // add the record to hold + holdService.addToHold(hold, record); + } + + public void then() + { + // record is held + assertTrue(freezeService.isFrozen(record)); + + // record folder has frozen children + assertFalse(freezeService.isFrozen(recordFolder)); + assertTrue(freezeService.hasFrozenChildren(recordFolder)); + + // record folder is not held + assertFalse(holdService.getHeld(hold).contains(recordFolder)); + assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); + + // hold contains record + assertTrue(holdService.getHeld(hold).contains(record)); + assertTrue(holdService.heldBy(record, true).contains(hold)); + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(1, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + }); + + } + + public void testAddRecordsToHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + private NodeRef recordCategory; + private NodeRef recordFolder; + private List records = new ArrayList(RECORD_COUNT); + + public void given() + { + // create a hold + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + + // create a record folder that contains records + recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + for (int i = 0; i < RECORD_COUNT; i++) + { + records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); + } + + // assert current states + assertFalse(freezeService.isFrozen(recordFolder)); + assertFalse(freezeService.hasFrozenChildren(recordFolder)); + for (NodeRef record : records) + { + assertFalse(freezeService.isFrozen(record)); + } + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + + public void when() throws Exception + { + // add the record to hold + holdService.addToHold(hold, records); + } + + public void then() + { + // record is held + for (NodeRef record : records) + { + assertTrue(freezeService.isFrozen(record)); + } + + // record folder has frozen children + assertFalse(freezeService.isFrozen(recordFolder)); + assertTrue(freezeService.hasFrozenChildren(recordFolder)); + + // record folder is not held + assertFalse(holdService.getHeld(hold).contains(recordFolder)); + assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); + + for (NodeRef record : records) + { + // hold contains record + assertTrue(holdService.getHeld(hold).contains(record)); + assertTrue(holdService.heldBy(record, true).contains(hold)); + } + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(RECORD_COUNT, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + }); + } + + public void testAddRecordFolderToHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + private NodeRef recordCategory; + private NodeRef recordFolder; + private List records = new ArrayList(RECORD_COUNT); + + public void given() + { + // create a hold + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + + // create a record folder that contains records + recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + for (int i = 0; i < RECORD_COUNT; i++) + { + records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); + } + + // assert current states + assertFalse(freezeService.isFrozen(recordFolder)); + assertFalse(freezeService.hasFrozenChildren(recordFolder)); + for (NodeRef record : records) + { + assertFalse(freezeService.isFrozen(record)); + } + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + + public void when() throws Exception + { + // add the record to hold + holdService.addToHold(hold, recordFolder); + } + + public void then() + { + for (NodeRef record : records) + { + // record is held + assertTrue(freezeService.isFrozen(record)); + assertFalse(holdService.getHeld(hold).contains(record)); + assertTrue(holdService.heldBy(record, true).contains(hold)); + } + + // record folder has frozen children + assertTrue(freezeService.isFrozen(recordFolder)); + assertTrue(freezeService.hasFrozenChildren(recordFolder)); + + // hold contains record folder + assertTrue(holdService.getHeld(hold).contains(recordFolder)); + assertTrue(holdService.heldBy(recordFolder, true).contains(hold)); + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(RECORD_COUNT, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + }); + + } + + public void testRemoveRecordsFromHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + private NodeRef recordCategory; + private NodeRef recordFolder; + private List records = new ArrayList(RECORD_COUNT); + + public void given() + { + // create a hold + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + + // create a record folder that contains records + recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + for (int i = 0; i < RECORD_COUNT; i++) + { + records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); + } + + // add records to hold + holdService.addToHold(hold, records); + } + + public void when() throws Exception + { + // remove *some* of the records + holdService.removeFromHold(hold, records.subList(0, 5)); + } + + public void then() + { + // check record state (no longer held) + for (NodeRef record : records.subList(0, 5)) + { + assertFalse(freezeService.isFrozen(record)); + assertFalse(holdService.getHeld(hold).contains(record)); + assertFalse(holdService.heldBy(record, true).contains(hold)); + } + + // check record state (still held) + for (NodeRef record : records.subList(5, 10)) + { + assertTrue(freezeService.isFrozen(record)); + assertTrue(holdService.getHeld(hold).contains(record)); + assertTrue(holdService.heldBy(record, true).contains(hold)); + } + + // record folder has frozen children + assertFalse(freezeService.isFrozen(recordFolder)); + assertTrue(freezeService.hasFrozenChildren(recordFolder)); + + // record folder is not held + assertFalse(holdService.getHeld(hold).contains(recordFolder)); + assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(5, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + }); + } + + public void testRemoveAllRecordsFromHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + private NodeRef recordCategory; + private NodeRef recordFolder; + private List records = new ArrayList(RECORD_COUNT); + + public void given() + { + // create a hold + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + + // create a record folder that contains records + recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + for (int i = 0; i < RECORD_COUNT; i++) + { + records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); + } + + // add records to hold + holdService.addToHold(hold, records); + } + + public void when() throws Exception + { + // remove all of the records + holdService.removeFromHold(hold, records); + } + + public void then() + { + // check record state (no longer held) + for (NodeRef record : records) + { + assertFalse(freezeService.isFrozen(record)); + assertFalse(holdService.getHeld(hold).contains(record)); + assertFalse(holdService.heldBy(record, true).contains(hold)); + } + + // record folder has frozen children + assertFalse(freezeService.isFrozen(recordFolder)); + assertFalse(freezeService.hasFrozenChildren(recordFolder)); + + // record folder is not held + assertFalse(holdService.getHeld(hold).contains(recordFolder)); + assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + }); + } + + public void testRemoveRecordFolderFromHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + private NodeRef recordCategory; + private NodeRef recordFolder; + private List records = new ArrayList(RECORD_COUNT); + + public void given() + { + // create a hold + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + + // create a record folder that contains records + recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + for (int i = 0; i < RECORD_COUNT; i++) + { + records.add(recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null)); + } + + // add record folder to hold + holdService.addToHold(hold, recordFolder); + } + + public void when() throws Exception + { + // remove record folder from hold + holdService.removeFromHold(hold, recordFolder); + } + + public void then() + { + // check record states + for (NodeRef record : records) + { + assertFalse(freezeService.isFrozen(record)); + assertFalse(holdService.getHeld(hold).contains(record)); + assertFalse(holdService.heldBy(record, true).contains(hold)); + } + + // record folder has frozen children + assertFalse(freezeService.isFrozen(recordFolder)); + assertFalse(freezeService.hasFrozenChildren(recordFolder)); + + // record folder is not held + assertFalse(holdService.getHeld(hold).contains(recordFolder)); + assertFalse(holdService.heldBy(recordFolder, true).contains(hold)); + + // additional check for child held caching + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)); + assertEquals(0, nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT)); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java index 56472658e5..2b85dd3360 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java @@ -1,137 +1,137 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.hold; - -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.util.GUID.generate; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Tests that the user who created the hold has filing permissions on the created hold. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class CreateHoldTest extends BaseRMTestCase -{ - // Test user - private String testUser = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test user - testUser = generate(); - createPerson(testUser); - - // Join the RM site - siteService.setMembership(siteId, testUser, SITE_CONSUMER); - - // Create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability(VIEW_RECORDS)); - capabilities.add(capabilityService.getCapability(CREATE_HOLD)); - Role role = filePlanRoleService.createRole(filePlan, generate(), generate(), capabilities); - - // Add the test user to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, role.getName(), testUser); - } - - public void testFilingPermissionOnCreatedHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser) - { - // Hold - private NodeRef hold; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() throws Exception - { - // Give test user filing permissions on hold container - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // ensure the user has the correct permission to create the hold - filePlanPermissionService.setPermission(holdsContainer, testUser, FILING); - - return null; - } - }, getAdminUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() throws Exception - { - // Create a hold - hold = holdService.createHold(filePlan, generate(), generate(), generate()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() throws Exception - { - // Check the permission on the hold - assertEquals(ALLOWED, permissionService.hasPermission(hold, FILING)); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.hold; + +import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; +import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; +import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; +import static org.alfresco.util.GUID.generate; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Tests that the user who created the hold has filing permissions on the created hold. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class CreateHoldTest extends BaseRMTestCase +{ + // Test user + private String testUser = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + // Create test user + testUser = generate(); + createPerson(testUser); + + // Join the RM site + siteService.setMembership(siteId, testUser, SITE_CONSUMER); + + // Create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability(VIEW_RECORDS)); + capabilities.add(capabilityService.getCapability(CREATE_HOLD)); + Role role = filePlanRoleService.createRole(filePlan, generate(), generate(), capabilities); + + // Add the test user to RM Records Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, role.getName(), testUser); + } + + public void testFilingPermissionOnCreatedHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(testUser) + { + // Hold + private NodeRef hold; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() + */ + @Override + public void given() throws Exception + { + // Give test user filing permissions on hold container + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // ensure the user has the correct permission to create the hold + filePlanPermissionService.setPermission(holdsContainer, testUser, FILING); + + return null; + } + }, getAdminUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() + */ + @Override + public void when() throws Exception + { + // Create a hold + hold = holdService.createHold(filePlan, generate(), generate(), generate()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() + */ + @Override + public void then() throws Exception + { + // Check the permission on the hold + assertEquals(ALLOWED, permissionService.hasPermission(hold, FILING)); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/DeleteHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/DeleteHoldTest.java index c7b112ed0f..d081db2039 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/DeleteHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/DeleteHoldTest.java @@ -1,222 +1,222 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.hold; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Hold service integration test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DeleteHoldTest extends BaseRMTestCase -{ - /** Constants for the holds */ - protected static final String HOLD1_NAME = "hold one"; - protected static final String HOLD2_NAME = "hold two"; - protected static final String HOLD1_REASON = "I have my reasons"; - protected static final String HOLD2_REASON = "secrets are everything"; - protected static final String HOLD1_DESC = "but I'll not describe them here!"; - protected static final String HOLD2_DESC = "no then! that's just not on!"; - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * Creates a hold and checks if the hold is null or not - * - * @return {@link NodeRef} Node reference of the hold. - */ - protected NodeRef createAndCheckHold() - { - NodeRef hold = holdService.createHold(filePlan, HOLD1_NAME, HOLD1_REASON, HOLD1_DESC); - assertNotNull(hold); - return hold; - } - - /** - * Creates two holds and checks them if they are null or not - * - * @return List of {@link NodeRef}s of the holds. - */ - protected List createAndCheckHolds() - { - List holds = new ArrayList(2); - holds.add(createAndCheckHold()); - NodeRef hold2 = holdService.createHold(filePlan, HOLD2_NAME, HOLD2_REASON, HOLD2_DESC); - assertNotNull(hold2); - holds.add(hold2); - assertEquals(2, holds.size()); - return holds; - } - - public void testDeleteHoldBehaviourForRecordFolder() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // create test holds - NodeRef hold1 = createAndCheckHold(); - - // add the record folder to hold1 - holdService.addToHold(hold1, rmFolder); - - // assert that the folder and records are frozen - assertTrue(freezeService.isFrozen(rmFolder)); - assertTrue(freezeService.isFrozen(recordOne)); - assertTrue(freezeService.isFrozen(recordDeclaredOne)); - - // check the contents of the hold - List frozenNodes = holdService.getHeld(hold1); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - assertEquals(rmFolder, frozenNodes.get(0)); - - // delete the hold - holdService.deleteHold(hold1); - - // assert that the folder and records no longer frozen - assertFalse(freezeService.isFrozen(rmFolder)); - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordDeclaredOne)); - - // confirm the hold has been deleted - assertNull(holdService.getHold(filePlan, "hold one")); - - return null; - } - }); - } - - public void testDeleteHoldBehaviourForMultipleHolds() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // create test holds - List holds = createAndCheckHolds(); - NodeRef hold1 = holds.get(0); - NodeRef hold2 = holds.get(1); - - // add the record folder to hold1 - holdService.addToHold(hold1, rmFolder); - - // assert that the folder and records are frozen - assertTrue(freezeService.isFrozen(rmFolder)); - assertTrue(freezeService.isFrozen(recordOne)); - assertTrue(freezeService.isFrozen(recordDeclaredOne)); - - // check the contents of the hold - List frozenNodes = holdService.getHeld(hold1); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - assertEquals(rmFolder, frozenNodes.get(0)); - - holdService.addToHold(hold2, recordOne); - - // assert that the folder and records are frozen - assertTrue(freezeService.isFrozen(rmFolder)); - assertTrue(freezeService.isFrozen(recordOne)); - assertTrue(freezeService.isFrozen(recordDeclaredOne)); - - // delete the hold - holdService.deleteHold(hold1); - - // assert that the folder and records no longer frozen - assertFalse(freezeService.isFrozen(rmFolder)); - assertTrue(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordDeclaredOne)); - - // confirm the hold has been deleted - assertNull(holdService.getHold(filePlan, "hold one")); - - // delete the hold - holdService.deleteHold(hold2); - - // assert that the folder and records no longer frozen - assertFalse(freezeService.isFrozen(rmFolder)); - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordDeclaredOne)); - - // confirm the hold has been deleted - assertNull(holdService.getHold(filePlan, "hold two")); - - return null; - } - }); - } - - public void testHeldByNothing() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Create the test holds - createAndCheckHolds(); - - // Check that the record folder isn't held by anything - List holds = new ArrayList(); - holds.addAll(holdService.heldBy(rmFolder, true)); - assertTrue(holds.isEmpty()); - holds.clear(); - holds.addAll(holdService.heldBy(rmFolder, false)); - assertEquals(2, holds.size()); - - // Check that record isn't held by anything (recordOne is a child of the rmFolder) - holds.clear(); - holds.addAll(holdService.heldBy(recordOne, true)); - assertTrue(holds.isEmpty()); - holds.clear(); - holds.addAll(holdService.heldBy(recordOne, false)); - assertEquals(2, holds.size()); - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.hold; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Hold service integration test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class DeleteHoldTest extends BaseRMTestCase +{ + /** Constants for the holds */ + protected static final String HOLD1_NAME = "hold one"; + protected static final String HOLD2_NAME = "hold two"; + protected static final String HOLD1_REASON = "I have my reasons"; + protected static final String HOLD2_REASON = "secrets are everything"; + protected static final String HOLD1_DESC = "but I'll not describe them here!"; + protected static final String HOLD2_DESC = "no then! that's just not on!"; + + @Override + protected boolean isRecordTest() + { + return true; + } + + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * Creates a hold and checks if the hold is null or not + * + * @return {@link NodeRef} Node reference of the hold. + */ + protected NodeRef createAndCheckHold() + { + NodeRef hold = holdService.createHold(filePlan, HOLD1_NAME, HOLD1_REASON, HOLD1_DESC); + assertNotNull(hold); + return hold; + } + + /** + * Creates two holds and checks them if they are null or not + * + * @return List of {@link NodeRef}s of the holds. + */ + protected List createAndCheckHolds() + { + List holds = new ArrayList(2); + holds.add(createAndCheckHold()); + NodeRef hold2 = holdService.createHold(filePlan, HOLD2_NAME, HOLD2_REASON, HOLD2_DESC); + assertNotNull(hold2); + holds.add(hold2); + assertEquals(2, holds.size()); + return holds; + } + + public void testDeleteHoldBehaviourForRecordFolder() + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // create test holds + NodeRef hold1 = createAndCheckHold(); + + // add the record folder to hold1 + holdService.addToHold(hold1, rmFolder); + + // assert that the folder and records are frozen + assertTrue(freezeService.isFrozen(rmFolder)); + assertTrue(freezeService.isFrozen(recordOne)); + assertTrue(freezeService.isFrozen(recordDeclaredOne)); + + // check the contents of the hold + List frozenNodes = holdService.getHeld(hold1); + assertNotNull(frozenNodes); + assertEquals(1, frozenNodes.size()); + assertEquals(rmFolder, frozenNodes.get(0)); + + // delete the hold + holdService.deleteHold(hold1); + + // assert that the folder and records no longer frozen + assertFalse(freezeService.isFrozen(rmFolder)); + assertFalse(freezeService.isFrozen(recordOne)); + assertFalse(freezeService.isFrozen(recordDeclaredOne)); + + // confirm the hold has been deleted + assertNull(holdService.getHold(filePlan, "hold one")); + + return null; + } + }); + } + + public void testDeleteHoldBehaviourForMultipleHolds() + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // create test holds + List holds = createAndCheckHolds(); + NodeRef hold1 = holds.get(0); + NodeRef hold2 = holds.get(1); + + // add the record folder to hold1 + holdService.addToHold(hold1, rmFolder); + + // assert that the folder and records are frozen + assertTrue(freezeService.isFrozen(rmFolder)); + assertTrue(freezeService.isFrozen(recordOne)); + assertTrue(freezeService.isFrozen(recordDeclaredOne)); + + // check the contents of the hold + List frozenNodes = holdService.getHeld(hold1); + assertNotNull(frozenNodes); + assertEquals(1, frozenNodes.size()); + assertEquals(rmFolder, frozenNodes.get(0)); + + holdService.addToHold(hold2, recordOne); + + // assert that the folder and records are frozen + assertTrue(freezeService.isFrozen(rmFolder)); + assertTrue(freezeService.isFrozen(recordOne)); + assertTrue(freezeService.isFrozen(recordDeclaredOne)); + + // delete the hold + holdService.deleteHold(hold1); + + // assert that the folder and records no longer frozen + assertFalse(freezeService.isFrozen(rmFolder)); + assertTrue(freezeService.isFrozen(recordOne)); + assertFalse(freezeService.isFrozen(recordDeclaredOne)); + + // confirm the hold has been deleted + assertNull(holdService.getHold(filePlan, "hold one")); + + // delete the hold + holdService.deleteHold(hold2); + + // assert that the folder and records no longer frozen + assertFalse(freezeService.isFrozen(rmFolder)); + assertFalse(freezeService.isFrozen(recordOne)); + assertFalse(freezeService.isFrozen(recordDeclaredOne)); + + // confirm the hold has been deleted + assertNull(holdService.getHold(filePlan, "hold two")); + + return null; + } + }); + } + + public void testHeldByNothing() + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // Create the test holds + createAndCheckHolds(); + + // Check that the record folder isn't held by anything + List holds = new ArrayList(); + holds.addAll(holdService.heldBy(rmFolder, true)); + assertTrue(holds.isEmpty()); + holds.clear(); + holds.addAll(holdService.heldBy(rmFolder, false)); + assertEquals(2, holds.size()); + + // Check that record isn't held by anything (recordOne is a child of the rmFolder) + holds.clear(); + holds.addAll(holdService.heldBy(recordOne, true)); + assertTrue(holds.isEmpty()); + holds.clear(); + holds.addAll(holdService.heldBy(recordOne, false)); + assertEquals(2, holds.size()); + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1008Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1008Test.java index 36a616dbdb..c361b844e0 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1008Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1008Test.java @@ -1,368 +1,368 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.GUID; - - -/** - * Test for RM-1008 - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM1008Test extends BaseRMTestCase -{ - private String myUser; - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - myUser = GUID.generate(); - createPerson(myUser); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, myUser); - } - - public void testContainers() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(holdContainer)); - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transferContainer)); - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(holdContainer)); - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transferContainer)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - } - - public void testHold() - { - final NodeRef hold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create hold object - NodeRef hold = holdService.createHold(filePlan, "my hold", "my reason", "my description"); - holdService.addToHold(hold, rmFolder); - return hold; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(hold)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(filePlan, myUser, FILING); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.deletePermission(filePlan, myUser, FILING); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - } - - public void testTransfer() - { - final NodeRef transferFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - NodeRef transferCat = filePlanService.createRecordCategory(filePlan, "transferCat"); - - Map dsProps = new HashMap(3); - dsProps.put(PROP_DISPOSITION_AUTHORITY, "test"); - dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, "test"); - dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, false); - DispositionSchedule dispositionSchedule = dispositionService.createDispositionSchedule(transferCat, dsProps); - - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, "cutoff"); - adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); - adParams.put(PROP_DISPOSITION_PERIOD, "immediately|0"); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - - adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, "transfer"); - adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); - adParams.put(PROP_DISPOSITION_PERIOD, "immediately|0"); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - - return recordFolderService.createRecordFolder(transferCat, "transferFolder"); - } - }); - - final NodeRef transfer = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - rmActionService.executeRecordsManagementAction(transferFolder, "cutoff"); - rmActionService.executeRecordsManagementAction(transferFolder, "transfer"); - - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - List childAssocs = nodeService.getChildAssocs(transferContainer, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - return childAssocs.get(0).getChildRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertEquals(TYPE_TRANSFER, nodeService.getType(result)); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transfer)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(filePlan, myUser, FILING); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.deletePermission(filePlan, myUser, FILING); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Capability viewRecords = capabilityService.getCapability("ViewRecords"); - assertNotNull(viewRecords); - - assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); - - return null; - } - }, myUser); - - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.GUID; + + +/** + * Test for RM-1008 + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RM1008Test extends BaseRMTestCase +{ + private String myUser; + + @Override + protected boolean isRecordTest() + { + return true; + } + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + myUser = GUID.generate(); + createPerson(myUser); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, myUser); + } + + public void testContainers() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + assertNotNull(holdContainer); + NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); + assertNotNull(transferContainer); + + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(holdContainer)); + assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transferContainer)); + + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + assertNotNull(holdContainer); + NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); + assertNotNull(transferContainer); + + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(holdContainer)); + assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transferContainer)); + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); + + return null; + } + }, myUser); + } + + public void testHold() + { + final NodeRef hold = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create hold object + NodeRef hold = holdService.createHold(filePlan, "my hold", "my reason", "my description"); + holdService.addToHold(hold, rmFolder); + return hold; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(hold)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); + + return null; + } + }, myUser); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanPermissionService.setPermission(filePlan, myUser, FILING); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); + + return null; + } + }, myUser); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanPermissionService.deletePermission(filePlan, myUser, FILING); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(hold)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(hold, RMPermissionModel.FILING)); + + return null; + } + }, myUser); + } + + public void testTransfer() + { + final NodeRef transferFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + NodeRef transferCat = filePlanService.createRecordCategory(filePlan, "transferCat"); + + Map dsProps = new HashMap(3); + dsProps.put(PROP_DISPOSITION_AUTHORITY, "test"); + dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, "test"); + dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, false); + DispositionSchedule dispositionSchedule = dispositionService.createDispositionSchedule(transferCat, dsProps); + + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, "cutoff"); + adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); + adParams.put(PROP_DISPOSITION_PERIOD, "immediately|0"); + + dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); + + adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, "transfer"); + adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); + adParams.put(PROP_DISPOSITION_PERIOD, "immediately|0"); + + dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); + + return recordFolderService.createRecordFolder(transferCat, "transferFolder"); + } + }); + + final NodeRef transfer = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + rmActionService.executeRecordsManagementAction(transferFolder, "cutoff"); + rmActionService.executeRecordsManagementAction(transferFolder, "transfer"); + + NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); + List childAssocs = nodeService.getChildAssocs(transferContainer, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + return childAssocs.get(0).getChildRef(); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertNotNull(result); + assertEquals(TYPE_TRANSFER, nodeService.getType(result)); + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.ALLOWED, viewRecords.hasPermission(transfer)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); + + return null; + } + }, myUser); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanPermissionService.setPermission(filePlan, myUser, FILING); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); + + return null; + } + }, myUser); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanPermissionService.deletePermission(filePlan, myUser, FILING); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Capability viewRecords = capabilityService.getCapability("ViewRecords"); + assertNotNull(viewRecords); + + assertEquals(AccessStatus.DENIED, viewRecords.hasPermission(transfer)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(transfer, RMPermissionModel.FILING)); + + return null; + } + }, myUser); + + + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1027Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1027Test.java index 01a5998302..e0161bad29 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1027Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1027Test.java @@ -1,126 +1,126 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; - - -/** - * Unit test for RM-1027 .. can't copy a closed folder - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM1027Test extends BaseRMTestCase -{ - public void testCopyingAClosedFolder() throws Exception - { - final NodeRef recordFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a folder and close it - NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, "My Closed Record Folder"); - utils.closeFolder(recordFolder); - - assertTrue((Boolean)nodeService.getProperty(recordFolder, PROP_IS_CLOSED)); - - return recordFolder; - } - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - // create a destination for the copy - NodeRef destination = filePlanService.createRecordCategory(filePlan, "Copy Destination"); - - // try and copy the closed record folder - FileInfo copyInfo = fileFolderService.copy(recordFolder, destination, null); - - return copyInfo.getNodeRef(); - } - - @Override - public void test(NodeRef copy) throws Exception - { - assertNotNull(copy); - - assertNotNull(nodeService.getProperty(copy, PROP_IDENTIFIER)); - assertFalse((Boolean)nodeService.getProperty(copy, PROP_IS_CLOSED)); - } - }); - } - - public void testCopyingAFolderWithADispositionSchedule() throws Exception - { - final NodeRef recordFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a folder - NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, "My Closed Record Folder"); - - // show that the default disposition schedule has been applied - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - return recordFolder; - } - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - // create a destination for the copy - NodeRef destination = filePlanService.createRecordCategory(filePlan, "Copy Destination"); - - // try and copy the closed record folder - FileInfo copyInfo = fileFolderService.copy(recordFolder, destination, null); - - return copyInfo.getNodeRef(); - } - - @Override - public void test(NodeRef copy) throws Exception - { - assertNotNull(copy); - - assertNotNull(nodeService.getProperty(copy, PROP_IDENTIFIER)); - assertFalse(nodeService.hasAspect(copy, ASPECT_DISPOSITION_LIFECYCLE)); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; + + +/** + * Unit test for RM-1027 .. can't copy a closed folder + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RM1027Test extends BaseRMTestCase +{ + public void testCopyingAClosedFolder() throws Exception + { + final NodeRef recordFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a folder and close it + NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, "My Closed Record Folder"); + utils.closeFolder(recordFolder); + + assertTrue((Boolean)nodeService.getProperty(recordFolder, PROP_IS_CLOSED)); + + return recordFolder; + } + }); + + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + // create a destination for the copy + NodeRef destination = filePlanService.createRecordCategory(filePlan, "Copy Destination"); + + // try and copy the closed record folder + FileInfo copyInfo = fileFolderService.copy(recordFolder, destination, null); + + return copyInfo.getNodeRef(); + } + + @Override + public void test(NodeRef copy) throws Exception + { + assertNotNull(copy); + + assertNotNull(nodeService.getProperty(copy, PROP_IDENTIFIER)); + assertFalse((Boolean)nodeService.getProperty(copy, PROP_IS_CLOSED)); + } + }); + } + + public void testCopyingAFolderWithADispositionSchedule() throws Exception + { + final NodeRef recordFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a folder + NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, "My Closed Record Folder"); + + // show that the default disposition schedule has been applied + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + + return recordFolder; + } + }); + + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + // create a destination for the copy + NodeRef destination = filePlanService.createRecordCategory(filePlan, "Copy Destination"); + + // try and copy the closed record folder + FileInfo copyInfo = fileFolderService.copy(recordFolder, destination, null); + + return copyInfo.getNodeRef(); + } + + @Override + public void test(NodeRef copy) throws Exception + { + assertNotNull(copy); + + assertNotNull(nodeService.getProperty(copy, PROP_IDENTIFIER)); + assertFalse(nodeService.hasAspect(copy, ASPECT_DISPOSITION_LIFECYCLE)); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java index baac880f74..290b5524e9 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java @@ -1,164 +1,164 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; - - -/** - * Unit test for RM-1030 .. can't freeze a record folder that already has a frozen record contained within - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM1030Test extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRM1030() throws Exception - { - final NodeRef recordHold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - Set auths = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_ADMIN); - for (String auth : auths) - { - System.out.println(auth); - } - - // show there are no holds when we start - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(0, holds.size()); - - // freeze record contained within the record folder - NodeRef hold = holdService.createHold(filePlan, "my hold 2", "in true life for serious", "my decription"); - holdService.addToHold(hold, recordOne); - assertNotNull(hold); - - return hold; - } - - @Override - public void test(NodeRef hold) throws Exception - { - // show the record is frozen - assertTrue(freezeService.isFrozen(recordOne)); - - // count the number of holds - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(1, holds.size()); - } - - }); - - final NodeRef recordFolderHold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // freeze the record folder that contains the frozen record - NodeRef folderHold = holdService.createHold(filePlan, "my hold 3", "innit but", "my decription"); - holdService.addToHold(folderHold, rmFolder); - assertNotNull(folderHold); - - return folderHold; - } - - @Override - public void test(NodeRef hold) throws Exception - { - // show that the record and the record folder are frozen - assertTrue(freezeService.isFrozen(recordOne)); - assertTrue(freezeService.isFrozen(rmFolder)); - - // count the number of holds - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(2, holds.size()); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // relinquish the record folder hold - holdService.deleteHold(recordFolderHold); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertTrue(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(rmFolder)); - - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(1, holds.size()); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // relinquish the record hold - holdService.deleteHold(recordHold); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(rmFolder)); - - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(0, holds.size()); - } - }); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import java.util.List; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; + + +/** + * Unit test for RM-1030 .. can't freeze a record folder that already has a frozen record contained within + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RM1030Test extends BaseRMTestCase +{ + @Override + protected boolean isRecordTest() + { + return true; + } + + public void testRM1030() throws Exception + { + final NodeRef recordHold = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + Set auths = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_ADMIN); + for (String auth : auths) + { + System.out.println(auth); + } + + // show there are no holds when we start + List holds = holdService.getHolds(filePlan); + assertNotNull(holds); + assertEquals(0, holds.size()); + + // freeze record contained within the record folder + NodeRef hold = holdService.createHold(filePlan, "my hold 2", "in true life for serious", "my decription"); + holdService.addToHold(hold, recordOne); + assertNotNull(hold); + + return hold; + } + + @Override + public void test(NodeRef hold) throws Exception + { + // show the record is frozen + assertTrue(freezeService.isFrozen(recordOne)); + + // count the number of holds + List holds = holdService.getHolds(filePlan); + assertNotNull(holds); + assertEquals(1, holds.size()); + } + + }); + + final NodeRef recordFolderHold = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // freeze the record folder that contains the frozen record + NodeRef folderHold = holdService.createHold(filePlan, "my hold 3", "innit but", "my decription"); + holdService.addToHold(folderHold, rmFolder); + assertNotNull(folderHold); + + return folderHold; + } + + @Override + public void test(NodeRef hold) throws Exception + { + // show that the record and the record folder are frozen + assertTrue(freezeService.isFrozen(recordOne)); + assertTrue(freezeService.isFrozen(rmFolder)); + + // count the number of holds + List holds = holdService.getHolds(filePlan); + assertNotNull(holds); + assertEquals(2, holds.size()); + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // relinquish the record folder hold + holdService.deleteHold(recordFolderHold); + return null; + } + + @Override + public void test(Void result) throws Exception + { + assertTrue(freezeService.isFrozen(recordOne)); + assertFalse(freezeService.isFrozen(rmFolder)); + + List holds = holdService.getHolds(filePlan); + assertNotNull(holds); + assertEquals(1, holds.size()); + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // relinquish the record hold + holdService.deleteHold(recordHold); + return null; + } + + @Override + public void test(Void result) throws Exception + { + assertFalse(freezeService.isFrozen(recordOne)); + assertFalse(freezeService.isFrozen(rmFolder)); + + List holds = holdService.getHolds(filePlan); + assertNotNull(holds); + assertEquals(0, holds.size()); + } + }); + + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1039Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1039Test.java index 6abacea5fd..204c4a9c25 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1039Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1039Test.java @@ -1,195 +1,195 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - - -/** - * Unit test for RM-1039 ... can't move a folder into a category with a disposition schedule - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM1039Test extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - // try and move a folder from no disposition schedule to a disposition schedule - public void testMoveRecordFolderFromNoDisToDis() throws Exception - { - final NodeRef recordFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category (no disposition schedule) - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); - - // create a record folder - return recordFolderService.createRecordFolder(recordCategory, "Grace Wetherall"); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNull(dispositionService.getDispositionSchedule(result)); - assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - } - }); - - final NodeRef record = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record - return fileFolderService.create(recordFolder, "mytest.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNull(dispositionService.getDispositionSchedule(result)); - assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - } - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - Capability capability = capabilityService.getCapability("CreateModifyDestroyFolders"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder)); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder, rmContainer)); - - // take a look at the move capability - Capability moveCapability = capabilityService.getCapability("Move"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(recordFolder, rmContainer)); - - // move the node - return fileFolderService.move(recordFolder, rmContainer, null).getNodeRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNotNull(dispositionService.getDispositionSchedule(result)); - assertTrue(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(result); - assertNotNull(dispositionAction); - - assertNull(dispositionAction.getAsOfDate()); - assertEquals("cutoff", dispositionAction.getName()); - assertEquals(1, dispositionAction.getEventCompletionDetails().size()); - - // take a look at the record and check things are as we would expect - assertFalse(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - } - }); - } - - // move from a disposition schedule to another .. both record folder level - - // move from a disposition schedule to another .. from record to folder level - - - // try and move a cutoff folder - public void testMoveCutoffRecordFolder() throws Exception - { - final NodeRef destination = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category (no disposition schedule) - return filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); - } - }); - - final NodeRef testFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create folder - NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); - - // complete event - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); - - // cutoff folder - rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); - - return testFolder; - } - - @Override - public void test(NodeRef result) throws Exception - { - // take a look at the move capability - Capability moveCapability = capabilityService.getCapability("Move"); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, moveCapability.evaluate(result, destination)); - - } - }); - - doTestInTransaction(new FailureTest() - { - @Override - public void run() throws Exception - { - fileFolderService.move(testFolder, destination, null).getNodeRef(); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + + +/** + * Unit test for RM-1039 ... can't move a folder into a category with a disposition schedule + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RM1039Test extends BaseRMTestCase +{ + @Override + protected boolean isRecordTest() + { + return true; + } + + // try and move a folder from no disposition schedule to a disposition schedule + public void testMoveRecordFolderFromNoDisToDis() throws Exception + { + final NodeRef recordFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a record category (no disposition schedule) + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); + + // create a record folder + return recordFolderService.createRecordFolder(recordCategory, "Grace Wetherall"); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertNotNull(result); + assertNull(dispositionService.getDispositionSchedule(result)); + assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); + } + }); + + final NodeRef record = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a record + return fileFolderService.create(recordFolder, "mytest.txt", ContentModel.TYPE_CONTENT).getNodeRef(); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertNotNull(result); + assertNull(dispositionService.getDispositionSchedule(result)); + assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); + } + }); + + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + Capability capability = capabilityService.getCapability("CreateModifyDestroyFolders"); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder)); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder, rmContainer)); + + // take a look at the move capability + Capability moveCapability = capabilityService.getCapability("Move"); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(recordFolder, rmContainer)); + + // move the node + return fileFolderService.move(recordFolder, rmContainer, null).getNodeRef(); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertNotNull(result); + assertNotNull(dispositionService.getDispositionSchedule(result)); + assertTrue(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); + + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(result); + assertNotNull(dispositionAction); + + assertNull(dispositionAction.getAsOfDate()); + assertEquals("cutoff", dispositionAction.getName()); + assertEquals(1, dispositionAction.getEventCompletionDetails().size()); + + // take a look at the record and check things are as we would expect + assertFalse(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + } + }); + } + + // move from a disposition schedule to another .. both record folder level + + // move from a disposition schedule to another .. from record to folder level + + + // try and move a cutoff folder + public void testMoveCutoffRecordFolder() throws Exception + { + final NodeRef destination = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a record category (no disposition schedule) + return filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); + } + }); + + final NodeRef testFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create folder + NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); + + // complete event + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); + + // cutoff folder + rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); + + return testFolder; + } + + @Override + public void test(NodeRef result) throws Exception + { + // take a look at the move capability + Capability moveCapability = capabilityService.getCapability("Move"); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, moveCapability.evaluate(result, destination)); + + } + }); + + doTestInTransaction(new FailureTest() + { + @Override + public void run() throws Exception + { + fileFolderService.move(testFolder, destination, null).getNodeRef(); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1424Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1424Test.java index db3dc61eca..531f11289f 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1424Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1424Test.java @@ -1,128 +1,128 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unit test for https://issues.alfresco.com/jira/browse/RM-1424 - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class RM1424Test extends DeleteHoldTest -{ - public void testGettingHolds() - { - final List listWithTwoHolds = new ArrayList(2); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // No holds - List emptyHoldList = holdService.getHolds(filePlan); - assertNotNull(emptyHoldList); - assertTrue(emptyHoldList.isEmpty()); - - // Create 2 holds - createAndCheckHolds(); - - // Check the list of holds - listWithTwoHolds.addAll(holdService.getHolds(filePlan)); - assertNotNull(listWithTwoHolds); - assertEquals(2, listWithTwoHolds.size()); - - // Check the first hold - NodeRef hold1 = listWithTwoHolds.get(0); - assertEquals(RecordsManagementModel.TYPE_HOLD, nodeService.getType(hold1)); - assertEquals(HOLD1_NAME, (String) nodeService.getProperty(hold1, PROP_NAME)); - assertEquals(HOLD1_REASON, (String) nodeService.getProperty(hold1, PROP_HOLD_REASON)); - assertEquals(HOLD1_DESC, (String) nodeService.getProperty(hold1, PROP_DESCRIPTION)); - - // Add the user to the RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Get the holds the test user without having any permissions on the holds - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(0, holds.size()); - - return null; - } - }, userName); - - final NodeRef hold2 = listWithTwoHolds.get(1); - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Give the user read permissions on the hold - permissionService.setPermission(hold2, userName, RMPermissionModel.FILING, true); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List holds = holdService.getHolds(filePlan); - assertNotNull(holds); - assertEquals(1, holds.size()); - assertEquals(RecordsManagementModel.TYPE_HOLD, nodeService.getType(hold2)); - assertEquals(HOLD2_NAME, (String) nodeService.getProperty(hold2, PROP_NAME)); - assertEquals(HOLD2_REASON, (String) nodeService.getProperty(hold2, PROP_HOLD_REASON)); - assertEquals(HOLD2_DESC, (String) nodeService.getProperty(hold2, PROP_DESCRIPTION)); - - return null; - } - }, userName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Unit test for https://issues.alfresco.com/jira/browse/RM-1424 + * + * @author Tuna Aksoy + * @since 2.2 + * @version 1.0 + */ +public class RM1424Test extends DeleteHoldTest +{ + public void testGettingHolds() + { + final List listWithTwoHolds = new ArrayList(2); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // No holds + List emptyHoldList = holdService.getHolds(filePlan); + assertNotNull(emptyHoldList); + assertTrue(emptyHoldList.isEmpty()); + + // Create 2 holds + createAndCheckHolds(); + + // Check the list of holds + listWithTwoHolds.addAll(holdService.getHolds(filePlan)); + assertNotNull(listWithTwoHolds); + assertEquals(2, listWithTwoHolds.size()); + + // Check the first hold + NodeRef hold1 = listWithTwoHolds.get(0); + assertEquals(RecordsManagementModel.TYPE_HOLD, nodeService.getType(hold1)); + assertEquals(HOLD1_NAME, (String) nodeService.getProperty(hold1, PROP_NAME)); + assertEquals(HOLD1_REASON, (String) nodeService.getProperty(hold1, PROP_HOLD_REASON)); + assertEquals(HOLD1_DESC, (String) nodeService.getProperty(hold1, PROP_DESCRIPTION)); + + // Add the user to the RM Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); + + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Get the holds the test user without having any permissions on the holds + List holds = holdService.getHolds(filePlan); + assertNotNull(holds); + assertEquals(0, holds.size()); + + return null; + } + }, userName); + + final NodeRef hold2 = listWithTwoHolds.get(1); + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Give the user read permissions on the hold + permissionService.setPermission(hold2, userName, RMPermissionModel.FILING, true); + + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + List holds = holdService.getHolds(filePlan); + assertNotNull(holds); + assertEquals(1, holds.size()); + assertEquals(RecordsManagementModel.TYPE_HOLD, nodeService.getType(hold2)); + assertEquals(HOLD2_NAME, (String) nodeService.getProperty(hold2, PROP_NAME)); + assertEquals(HOLD2_REASON, (String) nodeService.getProperty(hold2, PROP_HOLD_REASON)); + assertEquals(HOLD2_DESC, (String) nodeService.getProperty(hold2, PROP_DESCRIPTION)); + + return null; + } + }, userName); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1429Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1429Test.java index 6c7560402b..eafb0d9ac7 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1429Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1429Test.java @@ -1,80 +1,80 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unit test for https://issues.alfresco.com/jira/browse/RM-1429 - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class RM1429Test extends DeleteHoldTest -{ - public void testDeleteHoldWithoutPermissionsOnChildren() - { - final NodeRef hold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // Create the test hold - NodeRef hold = createAndCheckHold(); - - // Add the user to the RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); - - // Give the user filing permissions on the hold - permissionService.setPermission(hold, userName, RMPermissionModel.FILING, true); - - // Give the user read permissions on the record folder - permissionService.setPermission(rmFolder, userName, RMPermissionModel.READ_RECORDS, true); - - // Add record folder to the hold - holdService.addToHold(hold, rmFolder); - - return hold; - } - }); - - doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) - { - @Override - public void run() - { - holdService.deleteHold(hold); - } - }, userName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Unit test for https://issues.alfresco.com/jira/browse/RM-1429 + * + * @author Tuna Aksoy + * @since 2.2 + * @version 1.0 + */ +public class RM1429Test extends DeleteHoldTest +{ + public void testDeleteHoldWithoutPermissionsOnChildren() + { + final NodeRef hold = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // Create the test hold + NodeRef hold = createAndCheckHold(); + + // Add the user to the RM Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); + + // Give the user filing permissions on the hold + permissionService.setPermission(hold, userName, RMPermissionModel.FILING, true); + + // Give the user read permissions on the record folder + permissionService.setPermission(rmFolder, userName, RMPermissionModel.READ_RECORDS, true); + + // Add record folder to the hold + holdService.addToHold(hold, rmFolder); + + return hold; + } + }); + + doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) + { + @Override + public void run() + { + holdService.deleteHold(hold); + } + }, userName); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1463Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1463Test.java index 3ed864a61f..e6ee5358d2 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1463Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1463Test.java @@ -1,77 +1,77 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unit test for https://issues.alfresco.com/jira/browse/RM-1463 - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class RM1463Test extends DeleteHoldTest -{ - public void testAddRecordFolderToHoldWithoutFilingPermissionOnRecordFolder() - { - final NodeRef hold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // Create hold - NodeRef hold = createAndCheckHold(); - - // Add the user to the RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); - - // Give the user filing permissions on the hold - permissionService.setPermission(hold, userName, RMPermissionModel.FILING, true); - - // Give the user only read permissions on the record folder - permissionService.setPermission(rmFolder, userName, RMPermissionModel.READ_RECORDS, true); - - return hold; - } - }); - - doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) - { - @Override - public void run() - { - holdService.addToHold(hold, rmFolder); - } - }, userName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Unit test for https://issues.alfresco.com/jira/browse/RM-1463 + * + * @author Tuna Aksoy + * @since 2.2 + * @version 1.0 + */ +public class RM1463Test extends DeleteHoldTest +{ + public void testAddRecordFolderToHoldWithoutFilingPermissionOnRecordFolder() + { + final NodeRef hold = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // Create hold + NodeRef hold = createAndCheckHold(); + + // Add the user to the RM Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); + + // Give the user filing permissions on the hold + permissionService.setPermission(hold, userName, RMPermissionModel.FILING, true); + + // Give the user only read permissions on the record folder + permissionService.setPermission(rmFolder, userName, RMPermissionModel.READ_RECORDS, true); + + return hold; + } + }); + + doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) + { + @Override + public void run() + { + holdService.addToHold(hold, rmFolder); + } + }, userName); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1464Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1464Test.java index 4a9dfa3ccf..87a6f72cd5 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1464Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1464Test.java @@ -1,77 +1,77 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unit test for https://issues.alfresco.com/jira/browse/RM-1464 - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class RM1464Test extends DeleteHoldTest -{ - public void testAddRecordFolderToHoldWithoutFilingPermissionOnHold() - { - final NodeRef hold = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // Create hold - NodeRef hold = createAndCheckHold(); - - // Add the user to the RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); - - // Give the user read permissions on the hold - permissionService.setPermission(hold, userName, RMPermissionModel.READ_RECORDS, true); - - // Give the user filing permissions on the record folder - permissionService.setPermission(rmFolder, userName, RMPermissionModel.FILING, true); - - return hold; - } - }); - - doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) - { - @Override - public void run() - { - holdService.addToHold(hold, rmFolder); - } - }, userName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.integration.hold.DeleteHoldTest; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Unit test for https://issues.alfresco.com/jira/browse/RM-1464 + * + * @author Tuna Aksoy + * @since 2.2 + * @version 1.0 + */ +public class RM1464Test extends DeleteHoldTest +{ + public void testAddRecordFolderToHoldWithoutFilingPermissionOnHold() + { + final NodeRef hold = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // Create hold + NodeRef hold = createAndCheckHold(); + + // Add the user to the RM Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, userName); + + // Give the user read permissions on the hold + permissionService.setPermission(hold, userName, RMPermissionModel.READ_RECORDS, true); + + // Give the user filing permissions on the record folder + permissionService.setPermission(rmFolder, userName, RMPermissionModel.FILING, true); + + return hold; + } + }); + + doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class) + { + @Override + public void run() + { + holdService.addToHold(hold, rmFolder); + } + }, userName); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java index 4dc5cd06e8..293a948e8a 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java @@ -1,120 +1,120 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementNodeFormFilter; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.forms.Form; -import org.alfresco.repo.forms.Item; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Test for RM-1727 - * - * @author Tatsiana Shalima - * @since 2.3 - */ -public class RM1727Test extends BaseRMTestCase -{ - private String myUser; - private NodeRef folder; - private NodeRef record; - - private RecordsManagementNodeFormFilter nodeFormFilter; - private Form form; - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - nodeFormFilter = (RecordsManagementNodeFormFilter)applicationContext.getBean("rmNodeFormFilter"); - //create user - myUser = GUID.generate(); - createPerson(myUser); - //give user RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, myUser); - //create category > folder > record - NodeRef category = filePlanService.createRecordCategory(filePlan, GUID.generate()); - folder = recordFolderService.createRecordFolder(category, GUID.generate()); - record = recordService.createRecordFromContent(folder, GUID.generate(), TYPE_CONTENT, null, null); - } - - public void testRM1727() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - //set read and file permissions for folder - filePlanPermissionService.setPermission(folder, myUser, RMPermissionModel.FILING); - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Item item = new Item("node",folder.toString()); - item.setType("rma:recordFolder"); - form = new Form(item); - nodeFormFilter.afterGenerate(folder, null, null, form, null); - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Item item = new Item("node",record.toString()); - item.setType("rma:record"); - form = new Form(item); - nodeFormFilter.afterGenerate(record, null, null, form, null); - return null; - } - }, myUser); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementNodeFormFilter; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.forms.Form; +import org.alfresco.repo.forms.Item; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.GUID; + +/** + * Test for RM-1727 + * + * @author Tatsiana Shalima + * @since 2.3 + */ +public class RM1727Test extends BaseRMTestCase +{ + private String myUser; + private NodeRef folder; + private NodeRef record; + + private RecordsManagementNodeFormFilter nodeFormFilter; + private Form form; + + @Override + protected boolean isRecordTest() + { + return true; + } + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + nodeFormFilter = (RecordsManagementNodeFormFilter)applicationContext.getBean("rmNodeFormFilter"); + //create user + myUser = GUID.generate(); + createPerson(myUser); + //give user RM Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, myUser); + //create category > folder > record + NodeRef category = filePlanService.createRecordCategory(filePlan, GUID.generate()); + folder = recordFolderService.createRecordFolder(category, GUID.generate()); + record = recordService.createRecordFromContent(folder, GUID.generate(), TYPE_CONTENT, null, null); + } + + public void testRM1727() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + //set read and file permissions for folder + filePlanPermissionService.setPermission(folder, myUser, RMPermissionModel.FILING); + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Item item = new Item("node",folder.toString()); + item.setType("rma:recordFolder"); + form = new Form(item); + nodeFormFilter.afterGenerate(folder, null, null, form, null); + return null; + } + }, myUser); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Item item = new Item("node",record.toString()); + item.setType("rma:record"); + form = new Form(item); + nodeFormFilter.afterGenerate(record, null, null, form, null); + return null; + } + }, myUser); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1799Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1799Test.java index 3732df77fe..0302534bfb 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1799Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1799Test.java @@ -1,102 +1,102 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.util.GUID; - -/** - * Test for RM-1799 - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RM1799Test extends BaseRMTestCase -{ - private String myUser; - private NodeRef category; - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - myUser = GUID.generate(); - createPerson(myUser); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, myUser); - } - - public void testRM1799() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(filePlan, myUser, RMPermissionModel.FILING); - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - category = filePlanService.createRecordCategory(filePlan, GUID.generate()); - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category, RMPermissionModel.FILING)); - return null; - } - }, myUser); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.util.GUID; + +/** + * Test for RM-1799 + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RM1799Test extends BaseRMTestCase +{ + private String myUser; + private NodeRef category; + + @Override + protected boolean isRecordTest() + { + return true; + } + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + myUser = GUID.generate(); + createPerson(myUser); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, myUser); + } + + public void testRM1799() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanPermissionService.setPermission(filePlan, myUser, RMPermissionModel.FILING); + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + category = filePlanService.createRecordCategory(filePlan, GUID.generate()); + return null; + } + }, myUser); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category, RMPermissionModel.FILING)); + return null; + } + }, myUser); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java index 8061408125..0037f6e537 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java @@ -1,93 +1,93 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Test for RM-1814 - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RM1814Test extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRM1814() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - holdService.addToHold(hold, recordTwo); - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), recordOne, recordThree); - return null; - } - }); - - doTestInTransaction(new FailureTest - ( - "Target node is in a hold." - ) - { - @Override - public void run() throws Exception - { - relationshipService.addRelationship(CUSTOM_REF_OBSOLETES.getLocalName(), recordOne, recordTwo); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - relationshipService.addRelationship(CUSTOM_REF_SUPPORTS.getLocalName(), recordOne, recordFour); - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.GUID; + +/** + * Test for RM-1814 + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RM1814Test extends BaseRMTestCase +{ + @Override + protected boolean isRecordTest() + { + return true; + } + + public void testRM1814() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + NodeRef hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + holdService.addToHold(hold, recordTwo); + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), recordOne, recordThree); + return null; + } + }); + + doTestInTransaction(new FailureTest + ( + "Target node is in a hold." + ) + { + @Override + public void run() throws Exception + { + relationshipService.addRelationship(CUSTOM_REF_OBSOLETES.getLocalName(), recordOne, recordTwo); + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + relationshipService.addRelationship(CUSTOM_REF_SUPPORTS.getLocalName(), recordOne, recordFour); + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java index 9331f77c29..df9764bfb4 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java @@ -1,90 +1,90 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Integration test for RM-1887 - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RM1887Test extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Given that a record is unfiled - * And an unfiled folder has been created - * When I move the unfiled record into the unfiled folder - * Then the filed date of the unfiled record remains unset - */ - public void testMoveUnfiledRecord() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef unfiledRecordFolder; - private NodeRef unfiledRecord; - - public void given() throws Exception - { - // create unfiled folder - unfiledRecordFolder = fileFolderService.create(filePlanService.getUnfiledContainer(filePlan), "my test folder", TYPE_UNFILED_RECORD_FOLDER).getNodeRef(); - - // crate unfiled record - unfiledRecord = recordService.createRecordFromContent(filePlan, "test.txt", TYPE_CONTENT, null, null); - - // check the record - assertTrue(recordService.isRecord(unfiledRecord)); - assertFalse(recordService.isFiled(unfiledRecord)); - } - - public void when() throws Exception - { - // move the record into the unfiled folder - fileFolderService.move(unfiledRecord, unfiledRecordFolder, null); - } - - public void then() - { - // check the record - assertTrue(recordService.isRecord(unfiledRecord)); - assertFalse(recordService.isFiled(unfiledRecord)); - } - }); - - } - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Integration test for RM-1887 + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RM1887Test extends BaseRMTestCase +{ + @Override + protected boolean isRecordTest() + { + return true; + } + + /** + * Given that a record is unfiled + * And an unfiled folder has been created + * When I move the unfiled record into the unfiled folder + * Then the filed date of the unfiled record remains unset + */ + public void testMoveUnfiledRecord() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef unfiledRecordFolder; + private NodeRef unfiledRecord; + + public void given() throws Exception + { + // create unfiled folder + unfiledRecordFolder = fileFolderService.create(filePlanService.getUnfiledContainer(filePlan), "my test folder", TYPE_UNFILED_RECORD_FOLDER).getNodeRef(); + + // crate unfiled record + unfiledRecord = recordService.createRecordFromContent(filePlan, "test.txt", TYPE_CONTENT, null, null); + + // check the record + assertTrue(recordService.isRecord(unfiledRecord)); + assertFalse(recordService.isFiled(unfiledRecord)); + } + + public void when() throws Exception + { + // move the record into the unfiled folder + fileFolderService.move(unfiledRecord, unfiledRecordFolder, null); + } + + public void then() + { + // check the record + assertTrue(recordService.isRecord(unfiledRecord)); + assertFalse(recordService.isFiled(unfiledRecord)); + } + }); + + } + + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java index 5681fe4680..24b63acfc5 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java @@ -1,148 +1,148 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferCompleteAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; -import org.apache.commons.lang.StringUtils; - -/** - * - * @author Ana Bozianu - * @since 2.3 - */ -public class RM1914Test extends BaseRMTestCase -{ - - public void testRM1914() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - - NodeRef record1; - NodeRef record2; - - public void given() - { - // 1. Any Category1, Category2 are created - NodeRef category1 = filePlanService.createRecordCategory(filePlan, GUID.generate()); - NodeRef category2 = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - - // 2. Disposition schedule is created for the Category1: - // - applied on Record - Map dsProps = new HashMap(3); - dsProps.put(PROP_DISPOSITION_AUTHORITY, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY); - dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, GUID.generate()); - dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, true); - - DispositionSchedule dispositionSchedule1 = dispositionService.createDispositionSchedule(category1, dsProps); - - // - add cutoff after "Related Record Transferred To Inactive Storage" completion event - Map dispositionAction1 = new HashMap(3); - dispositionAction1.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - dispositionAction1.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - - List events = new ArrayList(1); - events.add("related_record_trasfered_inactive_storage"); - dispositionAction1.put(PROP_DISPOSITION_EVENT, (Serializable)events); - - dispositionService.addDispositionActionDefinition(dispositionSchedule1, dispositionAction1); - - - // 3. Folder1 > Record1 is created inside Category1 - NodeRef folder1 = recordFolderService.createRecordFolder(category1, GUID.generate()); - record1 = recordService.createRecordFromContent(folder1, GUID.generate(), TYPE_CONTENT, null, null); - - - // 4. Disposition schedule is created for the Category2: - // applied on Record - DispositionSchedule dispositionSchedule2 = dispositionService.createDispositionSchedule(category2, dsProps); - - // - cutoff immediatelly - Map dispositionAction2_1 = new HashMap(3); - dispositionAction2_1.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - dispositionAction2_1.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - dispositionAction2_1.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule2, dispositionAction2_1); - - // - Transfer Immediatelly - Map dispositionAction2_2 = new HashMap(4); - dispositionAction2_2.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); - dispositionAction2_2.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - dispositionAction2_2.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionAction2_2.put(PROP_DISPOSITION_LOCATION, StringUtils.EMPTY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule2, dispositionAction2_2); - - // 5. Folder2 > Record2 is created inside Category2 - NodeRef folder2 = recordFolderService.createRecordFolder(category2, GUID.generate()); - record2 = recordService.createRecordFromContent(folder2, GUID.generate(), TYPE_CONTENT, null, null); - - // 6. Record1 and Record2 are completed - utils.completeRecord(record1); - utils.completeRecord(record2); - - // 7. Create Cross-Reference link from Record1 to Record2 - relationshipService.addRelationship(CUSTOM_REF_CROSSREFERENCE.getLocalName(), record1, record2); - - - } - - public void when() - { - // 8. Cut off and transfer Record2 - rmActionService.executeRecordsManagementAction(record2, CutOffAction.NAME, null); - NodeRef transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(record2, TransferAction.NAME).getValue(); - rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); - - } - - public void then() - { - // 9. Verify Record1 - assertTrue(dispositionService.isNextDispositionActionEligible(record1)); - - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferCompleteAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; +import org.apache.commons.lang.StringUtils; + +/** + * + * @author Ana Bozianu + * @since 2.3 + */ +public class RM1914Test extends BaseRMTestCase +{ + + public void testRM1914() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + + NodeRef record1; + NodeRef record2; + + public void given() + { + // 1. Any Category1, Category2 are created + NodeRef category1 = filePlanService.createRecordCategory(filePlan, GUID.generate()); + NodeRef category2 = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + + // 2. Disposition schedule is created for the Category1: + // - applied on Record + Map dsProps = new HashMap(3); + dsProps.put(PROP_DISPOSITION_AUTHORITY, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY); + dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, GUID.generate()); + dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, true); + + DispositionSchedule dispositionSchedule1 = dispositionService.createDispositionSchedule(category1, dsProps); + + // - add cutoff after "Related Record Transferred To Inactive Storage" completion event + Map dispositionAction1 = new HashMap(3); + dispositionAction1.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + dispositionAction1.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); + + List events = new ArrayList(1); + events.add("related_record_trasfered_inactive_storage"); + dispositionAction1.put(PROP_DISPOSITION_EVENT, (Serializable)events); + + dispositionService.addDispositionActionDefinition(dispositionSchedule1, dispositionAction1); + + + // 3. Folder1 > Record1 is created inside Category1 + NodeRef folder1 = recordFolderService.createRecordFolder(category1, GUID.generate()); + record1 = recordService.createRecordFromContent(folder1, GUID.generate(), TYPE_CONTENT, null, null); + + + // 4. Disposition schedule is created for the Category2: + // applied on Record + DispositionSchedule dispositionSchedule2 = dispositionService.createDispositionSchedule(category2, dsProps); + + // - cutoff immediatelly + Map dispositionAction2_1 = new HashMap(3); + dispositionAction2_1.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + dispositionAction2_1.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); + dispositionAction2_1.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); + + dispositionService.addDispositionActionDefinition(dispositionSchedule2, dispositionAction2_1); + + // - Transfer Immediatelly + Map dispositionAction2_2 = new HashMap(4); + dispositionAction2_2.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); + dispositionAction2_2.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); + dispositionAction2_2.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); + dispositionAction2_2.put(PROP_DISPOSITION_LOCATION, StringUtils.EMPTY); + + dispositionService.addDispositionActionDefinition(dispositionSchedule2, dispositionAction2_2); + + // 5. Folder2 > Record2 is created inside Category2 + NodeRef folder2 = recordFolderService.createRecordFolder(category2, GUID.generate()); + record2 = recordService.createRecordFromContent(folder2, GUID.generate(), TYPE_CONTENT, null, null); + + // 6. Record1 and Record2 are completed + utils.completeRecord(record1); + utils.completeRecord(record2); + + // 7. Create Cross-Reference link from Record1 to Record2 + relationshipService.addRelationship(CUSTOM_REF_CROSSREFERENCE.getLocalName(), record1, record2); + + + } + + public void when() + { + // 8. Cut off and transfer Record2 + rmActionService.executeRecordsManagementAction(record2, CutOffAction.NAME, null); + NodeRef transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(record2, TransferAction.NAME).getValue(); + rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); + + } + + public void then() + { + // 9. Verify Record1 + assertTrue(dispositionService.isNextDispositionActionEligible(record1)); + + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2072Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2072Test.java index bbc7b965b8..0c0ea81f93 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2072Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2072Test.java @@ -1,190 +1,190 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; -import org.alfresco.service.cmr.rule.RuleType; - -/** - * System test for RM-2072: Concurrency exceptions and deadlocks on Records Management "File to" rule - * - * @author Roy Wetherall - * @since 2.2.1.1 - */ -public class RM2072Test extends BaseRMTestCase -{ - private static final int NUMBER_OF_BATCHES = 1; - private static final int NUMBER_IN_BATCH = 500; - - private RuleService ruleService; - private NodeRef ruleFolder; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService)applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Given that I have auto declare configured - * And that I have auto file configured to a path where only the record folder needs to be created - * When I add lots of documents in the same transaction - * Then the rules should fire - * And the documents should be filed in the new record folder - */ - public void testAutoDeclareAutoFileCreateRecordFolderOnly() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // create the folder - ruleFolder = fileFolderService.create(documentLibrary, "mytestfolder", ContentModel.TYPE_FOLDER).getNodeRef(); - - // create record category - NodeRef nodeRefA = filePlanService.createRecordCategory(filePlan, "A"); - NodeRef nodeRefB = filePlanService.createRecordCategory(nodeRefA, "B"); - filePlanService.createRecordCategory(nodeRefB, "C"); - - Action action = actionService.createAction(CreateRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule rule = new Rule(); - rule.setRuleType(RuleType.INBOUND); - rule.setTitle("my rule"); - rule.setAction(action); - rule.setExecuteAsynchronously(true); - ruleService.saveRule(ruleFolder, rule); - - Action fileAction = actionService.createAction(FileToAction.NAME); - fileAction.setParameterValue(FileToAction.PARAM_PATH, "/A/B/C/{date.year.long}/{date.month.long}/{date.day.month}"); - fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - Rule fileRule = new Rule(); - fileRule.setRuleType(RuleType.INBOUND); - fileRule.setTitle("my rule"); - fileRule.setAction(fileAction); - fileRule.setExecuteAsynchronously(true); - ruleService.saveRule(filePlanService.getUnfiledContainer(filePlan), fileRule); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(ruleService.getRules(ruleFolder).isEmpty()); - } - }); - - List records = new ArrayList(NUMBER_OF_BATCHES*NUMBER_IN_BATCH); - - for (int i = 0; i < NUMBER_OF_BATCHES; i++) - { - final int finali = i; - records.addAll(doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - List records = new ArrayList(NUMBER_IN_BATCH); - for (int j = 0; j < NUMBER_IN_BATCH; j++) - { - int count = (finali+1)*(j+1); - String name = "content" + count + ".txt"; - System.out.println(name + " - creating"); - - NodeRef record = fileFolderService.create(ruleFolder, name, ContentModel.TYPE_CONTENT).getNodeRef(); - records.add(record); - } - return records; - } - })); - } - - try - { - while(!records.isEmpty()) - { - Thread.sleep(1000); - - final Iterator temp = records.iterator(); - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - while (temp.hasNext()) - { - NodeRef record = temp.next(); - if (nodeService.hasAspect(record, ASPECT_RECORD) && recordService.isFiled(record)) - { - String name = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); - System.out.println(name + " - complete"); - temp.remove(); - } - } - - return null; - } - }); - } - } - catch (Exception exception) - { - exception.printStackTrace(); - throw exception; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.rule.Rule; +import org.alfresco.service.cmr.rule.RuleService; +import org.alfresco.service.cmr.rule.RuleType; + +/** + * System test for RM-2072: Concurrency exceptions and deadlocks on Records Management "File to" rule + * + * @author Roy Wetherall + * @since 2.2.1.1 + */ +public class RM2072Test extends BaseRMTestCase +{ + private static final int NUMBER_OF_BATCHES = 1; + private static final int NUMBER_IN_BATCH = 500; + + private RuleService ruleService; + private NodeRef ruleFolder; + + @Override + protected void initServices() + { + super.initServices(); + + ruleService = (RuleService)applicationContext.getBean("RuleService"); + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isRecordTest() + { + return true; + } + + /** + * Given that I have auto declare configured + * And that I have auto file configured to a path where only the record folder needs to be created + * When I add lots of documents in the same transaction + * Then the rules should fire + * And the documents should be filed in the new record folder + */ + public void testAutoDeclareAutoFileCreateRecordFolderOnly() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // create the folder + ruleFolder = fileFolderService.create(documentLibrary, "mytestfolder", ContentModel.TYPE_FOLDER).getNodeRef(); + + // create record category + NodeRef nodeRefA = filePlanService.createRecordCategory(filePlan, "A"); + NodeRef nodeRefB = filePlanService.createRecordCategory(nodeRefA, "B"); + filePlanService.createRecordCategory(nodeRefB, "C"); + + Action action = actionService.createAction(CreateRecordAction.NAME); + action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + + Rule rule = new Rule(); + rule.setRuleType(RuleType.INBOUND); + rule.setTitle("my rule"); + rule.setAction(action); + rule.setExecuteAsynchronously(true); + ruleService.saveRule(ruleFolder, rule); + + Action fileAction = actionService.createAction(FileToAction.NAME); + fileAction.setParameterValue(FileToAction.PARAM_PATH, "/A/B/C/{date.year.long}/{date.month.long}/{date.day.month}"); + fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); + + Rule fileRule = new Rule(); + fileRule.setRuleType(RuleType.INBOUND); + fileRule.setTitle("my rule"); + fileRule.setAction(fileAction); + fileRule.setExecuteAsynchronously(true); + ruleService.saveRule(filePlanService.getUnfiledContainer(filePlan), fileRule); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + assertFalse(ruleService.getRules(ruleFolder).isEmpty()); + } + }); + + List records = new ArrayList(NUMBER_OF_BATCHES*NUMBER_IN_BATCH); + + for (int i = 0; i < NUMBER_OF_BATCHES; i++) + { + final int finali = i; + records.addAll(doTestInTransaction(new Test>() + { + @Override + public List run() throws Exception + { + List records = new ArrayList(NUMBER_IN_BATCH); + for (int j = 0; j < NUMBER_IN_BATCH; j++) + { + int count = (finali+1)*(j+1); + String name = "content" + count + ".txt"; + System.out.println(name + " - creating"); + + NodeRef record = fileFolderService.create(ruleFolder, name, ContentModel.TYPE_CONTENT).getNodeRef(); + records.add(record); + } + return records; + } + })); + } + + try + { + while(!records.isEmpty()) + { + Thread.sleep(1000); + + final Iterator temp = records.iterator(); + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + while (temp.hasNext()) + { + NodeRef record = temp.next(); + if (nodeService.hasAspect(record, ASPECT_RECORD) && recordService.isFiled(record)) + { + String name = (String) nodeService.getProperty(record, ContentModel.PROP_NAME); + System.out.println(name + " - complete"); + temp.remove(); + } + } + + return null; + } + }); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + throw exception; + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2190Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2190Test.java index e6ce97850c..a182ad85e6 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2190Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2190Test.java @@ -1,229 +1,229 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import static java.util.Arrays.asList; - -import static org.alfresco.service.cmr.rule.RuleType.INBOUND; -import static org.alfresco.util.GUID.generate; -import static org.springframework.util.StringUtils.tokenizeToStringArray; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; - -/** - * System test for RM-2190: Concurrency exception when upload document to several folders with rules configured to file records - * - * @author Tuna Aksoy - * @since 2.2.1.1 - */ -public class RM2190Test extends BaseRMTestCase -{ - private static final int NUMBER_OF_BATCHES = 1; - private static final int NUMBER_IN_BATCH = 10; - - private static final String PATH = "/111/222/333"; - - private RuleService ruleService; - - private NodeRef rootFolder; - private NodeRef folder1; - private NodeRef folder2; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService) applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testUploadDocumentsSimultaneouslyWithRules() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - rootFolder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); - - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule declareRule = new Rule(); - declareRule.setRuleType(INBOUND); - declareRule.setTitle(generate()); - declareRule.setAction(createAction); - declareRule.setExecuteAsynchronously(true); - declareRule.applyToChildren(true); - ruleService.saveRule(rootFolder, declareRule); - - folder1 = fileFolderService.create(rootFolder, generate(), TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(rootFolder, generate(), TYPE_FOLDER).getNodeRef(); - - Action fileAction = actionService.createAction(FileToAction.NAME); - fileAction.setParameterValue(FileToAction.PARAM_PATH, PATH); - fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - Rule fileRule = new Rule(); - fileRule.setRuleType(INBOUND); - fileRule.setTitle(generate()); - fileRule.setAction(fileAction); - fileRule.setExecuteAsynchronously(true); - ruleService.saveRule(unfiledContainer, fileRule); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(ruleService.getRules(rootFolder).isEmpty()); - assertFalse(ruleService.getRules(unfiledContainer).isEmpty()); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws FileNotFoundException, InterruptedException - { - Thread thread1 = new Thread() - { - public void run() { - List files = addFilesToFolder(folder1); - waitForFilesToBeDeclared(files); - } - }; - - Thread thread2 = new Thread() - { - public void run() { - List files = addFilesToFolder(folder2); - waitForFilesToBeDeclared(files); - } - }; - - thread1.start(); - thread2.start(); - - thread1.join(300000); - thread2.join(300000); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - FileInfo category = fileFolderService.resolveNamePath(filePlan, asList(tokenizeToStringArray(PATH, "/", false, true))); - assertEquals(NUMBER_IN_BATCH * 2, nodeService.getChildAssocs(category.getNodeRef()).size()); - } - }); - } - - private List addFilesToFolder(final NodeRef folder) - { - List records = new ArrayList(NUMBER_OF_BATCHES * NUMBER_IN_BATCH); - - for (int i = 0; i < NUMBER_OF_BATCHES; i++) - { - final int finali = i; - records.addAll(doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - List files = new ArrayList(NUMBER_IN_BATCH); - for (int j = 0; j < NUMBER_IN_BATCH; j++) - { - int count = (finali+1)*(j+1); - String name = folder.getId() + " - content" + count + ".txt"; - System.out.println(name + " - creating"); - - NodeRef file = fileFolderService.create(folder, name, TYPE_CONTENT).getNodeRef(); - files.add(file); - } - return files; - } - })); - } - - return records; - } - - private void waitForFilesToBeDeclared(List files) - { - while (!files.isEmpty()) - { - final Iterator temp = files.iterator(); - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - while (temp.hasNext()) - { - NodeRef record = temp.next(); - if (nodeService.hasAspect(record, ASPECT_RECORD) && recordService.isFiled(record)) - { - String name = (String) nodeService.getProperty(record, PROP_NAME); - System.out.println(name + " - complete"); - temp.remove(); - } - } - - return null; - } - }); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import static java.util.Arrays.asList; + +import static org.alfresco.service.cmr.rule.RuleType.INBOUND; +import static org.alfresco.util.GUID.generate; +import static org.springframework.util.StringUtils.tokenizeToStringArray; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.model.FileNotFoundException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.rule.Rule; +import org.alfresco.service.cmr.rule.RuleService; + +/** + * System test for RM-2190: Concurrency exception when upload document to several folders with rules configured to file records + * + * @author Tuna Aksoy + * @since 2.2.1.1 + */ +public class RM2190Test extends BaseRMTestCase +{ + private static final int NUMBER_OF_BATCHES = 1; + private static final int NUMBER_IN_BATCH = 10; + + private static final String PATH = "/111/222/333"; + + private RuleService ruleService; + + private NodeRef rootFolder; + private NodeRef folder1; + private NodeRef folder2; + + @Override + protected void initServices() + { + super.initServices(); + + ruleService = (RuleService) applicationContext.getBean("RuleService"); + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isRecordTest() + { + return true; + } + + public void testUploadDocumentsSimultaneouslyWithRules() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + rootFolder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); + + Action createAction = actionService.createAction(CreateRecordAction.NAME); + createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + + Rule declareRule = new Rule(); + declareRule.setRuleType(INBOUND); + declareRule.setTitle(generate()); + declareRule.setAction(createAction); + declareRule.setExecuteAsynchronously(true); + declareRule.applyToChildren(true); + ruleService.saveRule(rootFolder, declareRule); + + folder1 = fileFolderService.create(rootFolder, generate(), TYPE_FOLDER).getNodeRef(); + folder2 = fileFolderService.create(rootFolder, generate(), TYPE_FOLDER).getNodeRef(); + + Action fileAction = actionService.createAction(FileToAction.NAME); + fileAction.setParameterValue(FileToAction.PARAM_PATH, PATH); + fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); + + Rule fileRule = new Rule(); + fileRule.setRuleType(INBOUND); + fileRule.setTitle(generate()); + fileRule.setAction(fileAction); + fileRule.setExecuteAsynchronously(true); + ruleService.saveRule(unfiledContainer, fileRule); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + assertFalse(ruleService.getRules(rootFolder).isEmpty()); + assertFalse(ruleService.getRules(unfiledContainer).isEmpty()); + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws FileNotFoundException, InterruptedException + { + Thread thread1 = new Thread() + { + public void run() { + List files = addFilesToFolder(folder1); + waitForFilesToBeDeclared(files); + } + }; + + Thread thread2 = new Thread() + { + public void run() { + List files = addFilesToFolder(folder2); + waitForFilesToBeDeclared(files); + } + }; + + thread1.start(); + thread2.start(); + + thread1.join(300000); + thread2.join(300000); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + FileInfo category = fileFolderService.resolveNamePath(filePlan, asList(tokenizeToStringArray(PATH, "/", false, true))); + assertEquals(NUMBER_IN_BATCH * 2, nodeService.getChildAssocs(category.getNodeRef()).size()); + } + }); + } + + private List addFilesToFolder(final NodeRef folder) + { + List records = new ArrayList(NUMBER_OF_BATCHES * NUMBER_IN_BATCH); + + for (int i = 0; i < NUMBER_OF_BATCHES; i++) + { + final int finali = i; + records.addAll(doTestInTransaction(new Test>() + { + @Override + public List run() throws Exception + { + List files = new ArrayList(NUMBER_IN_BATCH); + for (int j = 0; j < NUMBER_IN_BATCH; j++) + { + int count = (finali+1)*(j+1); + String name = folder.getId() + " - content" + count + ".txt"; + System.out.println(name + " - creating"); + + NodeRef file = fileFolderService.create(folder, name, TYPE_CONTENT).getNodeRef(); + files.add(file); + } + return files; + } + })); + } + + return records; + } + + private void waitForFilesToBeDeclared(List files) + { + while (!files.isEmpty()) + { + final Iterator temp = files.iterator(); + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + while (temp.hasNext()) + { + NodeRef record = temp.next(); + if (nodeService.hasAspect(record, ASPECT_RECORD) && recordService.isFiled(record)) + { + String name = (String) nodeService.getProperty(record, PROP_NAME); + System.out.println(name + " - complete"); + temp.remove(); + } + } + + return null; + } + }); + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2192Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2192Test.java index e16cc0d2c1..1e513d7364 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2192Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2192Test.java @@ -1,182 +1,182 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.repo.site.SiteModel.SITE_MANAGER; -import static org.alfresco.repo.site.SiteServiceImpl.getSiteContainer; -import static org.alfresco.service.cmr.rule.RuleType.INBOUND; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.service.cmr.site.SiteService.DOCUMENT_LIBRARY; -import static org.alfresco.service.cmr.site.SiteVisibility.PUBLIC; -import static org.alfresco.util.GUID.generate; - -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.jscript.app.JSONConversionComponent; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; - -/** - * Integration test for RM-2192 - * - * @author Tuna Aksoy - * @since 2.2.1.1 - */ -public class RM2192Test extends BaseRMTestCase -{ - private static final String PATH = "/111/222/333"; - - private RuleService ruleService; - private JSONConversionComponent converter; - - private NodeRef folder; - private String user; - private NodeRef documentLibrary2; - - @Override - protected void initServices() - { - super.initServices(); - - ruleService = (RuleService) applicationContext.getBean("RuleService"); - converter = (JSONConversionComponent) applicationContext.getBean("jsonConversionComponent"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupCollaborationSiteTestDataImpl() - { - super.setupCollaborationSiteTestDataImpl(); - - String collabSiteId2 = generate(); - siteService.createSite("site-dashboard", collabSiteId2, generate(), generate(), PUBLIC); - documentLibrary2 = getSiteContainer( - collabSiteId2, - DOCUMENT_LIBRARY, - true, - siteService, - transactionService, - taggingService); - - assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary2); - - user = generate(); - createPerson(user); - - siteService.setMembership(collabSiteId2, user, SITE_MANAGER); - - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, user); - } - - public void testAccessToRecordAfterDeclaring() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - folder = fileFolderService.create(documentLibrary2, generate(), TYPE_FOLDER).getNodeRef(); - - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - - Rule declareRule = new Rule(); - declareRule.setRuleType(INBOUND); - declareRule.setTitle(generate()); - declareRule.setAction(createAction); - declareRule.setExecuteAsynchronously(true); - declareRule.applyToChildren(true); - ruleService.saveRule(folder, declareRule); - - Action fileAction = actionService.createAction(FileToAction.NAME); - fileAction.setParameterValue(FileToAction.PARAM_PATH, PATH); - fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - Rule fileRule = new Rule(); - fileRule.setRuleType(INBOUND); - fileRule.setTitle(generate()); - fileRule.setAction(fileAction); - fileRule.setExecuteAsynchronously(true); - ruleService.saveRule(unfiledContainer, fileRule); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertFalse(ruleService.getRules(folder).isEmpty()); - assertFalse(ruleService.getRules(unfiledContainer).isEmpty()); - } - }); - - doTestInTransaction(new Test() - { - NodeRef document; - - @Override - public Void run() - { - document = fileFolderService.create(folder, generate(), TYPE_CONTENT).getNodeRef(); - - return null; - } - - @Override - public void test(Void result) throws InterruptedException - { - Thread.sleep(10000); - - assertEquals(permissionService.hasPermission(document, READ_RECORDS), ALLOWED); - assertTrue(recordService.isFiled(document)); - assertNotNull(converter.toJSON(document, true)); - } - }, user); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; +import static org.alfresco.repo.site.SiteModel.SITE_MANAGER; +import static org.alfresco.repo.site.SiteServiceImpl.getSiteContainer; +import static org.alfresco.service.cmr.rule.RuleType.INBOUND; +import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; +import static org.alfresco.service.cmr.site.SiteService.DOCUMENT_LIBRARY; +import static org.alfresco.service.cmr.site.SiteVisibility.PUBLIC; +import static org.alfresco.util.GUID.generate; + +import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.jscript.app.JSONConversionComponent; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.rule.Rule; +import org.alfresco.service.cmr.rule.RuleService; + +/** + * Integration test for RM-2192 + * + * @author Tuna Aksoy + * @since 2.2.1.1 + */ +public class RM2192Test extends BaseRMTestCase +{ + private static final String PATH = "/111/222/333"; + + private RuleService ruleService; + private JSONConversionComponent converter; + + private NodeRef folder; + private String user; + private NodeRef documentLibrary2; + + @Override + protected void initServices() + { + super.initServices(); + + ruleService = (RuleService) applicationContext.getBean("RuleService"); + converter = (JSONConversionComponent) applicationContext.getBean("jsonConversionComponent"); + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isRecordTest() + { + return true; + } + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected void setupCollaborationSiteTestDataImpl() + { + super.setupCollaborationSiteTestDataImpl(); + + String collabSiteId2 = generate(); + siteService.createSite("site-dashboard", collabSiteId2, generate(), generate(), PUBLIC); + documentLibrary2 = getSiteContainer( + collabSiteId2, + DOCUMENT_LIBRARY, + true, + siteService, + transactionService, + taggingService); + + assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary2); + + user = generate(); + createPerson(user); + + siteService.setMembership(collabSiteId2, user, SITE_MANAGER); + + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, user); + } + + public void testAccessToRecordAfterDeclaring() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + folder = fileFolderService.create(documentLibrary2, generate(), TYPE_FOLDER).getNodeRef(); + + Action createAction = actionService.createAction(CreateRecordAction.NAME); + createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + + Rule declareRule = new Rule(); + declareRule.setRuleType(INBOUND); + declareRule.setTitle(generate()); + declareRule.setAction(createAction); + declareRule.setExecuteAsynchronously(true); + declareRule.applyToChildren(true); + ruleService.saveRule(folder, declareRule); + + Action fileAction = actionService.createAction(FileToAction.NAME); + fileAction.setParameterValue(FileToAction.PARAM_PATH, PATH); + fileAction.setParameterValue(FileToAction.PARAM_CREATE_RECORD_PATH, true); + + Rule fileRule = new Rule(); + fileRule.setRuleType(INBOUND); + fileRule.setTitle(generate()); + fileRule.setAction(fileAction); + fileRule.setExecuteAsynchronously(true); + ruleService.saveRule(unfiledContainer, fileRule); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + assertFalse(ruleService.getRules(folder).isEmpty()); + assertFalse(ruleService.getRules(unfiledContainer).isEmpty()); + } + }); + + doTestInTransaction(new Test() + { + NodeRef document; + + @Override + public Void run() + { + document = fileFolderService.create(folder, generate(), TYPE_CONTENT).getNodeRef(); + + return null; + } + + @Override + public void test(Void result) throws InterruptedException + { + Thread.sleep(10000); + + assertEquals(permissionService.hasPermission(document, READ_RECORDS), ALLOWED); + assertTrue(recordService.isFiled(document)); + assertNotNull(converter.toJSON(document, true)); + } + }, user); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java index fdf38a09f2..a65ce84be5 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java @@ -1,122 +1,122 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Unit test for RM-3341 .. can copy to hold and transfer folder - * - * @since 2.4 - */ -public class RM3341Test extends BaseRMTestCase -{ - - private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; - - public void testCopyingContentsInHoldandTransfer() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - - assertEquals(AccessStatus.ALLOWED, - permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, - permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - - public Void run() - { - - NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdContainer); - - try - { - FileInfo copyInfo = fileFolderService.create(holdContainer, "test file", ContentModel.TYPE_CONTENT); - fail("This should have thrown an exception"); - } - catch (AlfrescoRuntimeException e) - { - // ("Content can't be added to a record container. Use record folders to file content.") - assertEquals(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER), e.getMsgId()); - } - return null; - } - - }); - doTestInTransaction(new Test() - { - @Override - - public Void run() - { - - NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transferContainer); - - try - { - - fileFolderService.create(transferContainer, "test content", ContentModel.TYPE_CONTENT); - - fail("This should have thrown an exception"); - - } - catch (AlfrescoRuntimeException e) - { - // ("Content can't be added to a record container. Use record folders to file content.") - assertEquals(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER), e.getMsgId()); - } - return null; - } - - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Unit test for RM-3341 .. can copy to hold and transfer folder + * + * @since 2.4 + */ +public class RM3341Test extends BaseRMTestCase +{ + + private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; + + public void testCopyingContentsInHoldandTransfer() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + assertNotNull(holdContainer); + NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); + assertNotNull(transferContainer); + + assertEquals(AccessStatus.ALLOWED, + permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, + permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + + public Void run() + { + + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + assertNotNull(holdContainer); + + try + { + FileInfo copyInfo = fileFolderService.create(holdContainer, "test file", ContentModel.TYPE_CONTENT); + fail("This should have thrown an exception"); + } + catch (AlfrescoRuntimeException e) + { + // ("Content can't be added to a record container. Use record folders to file content.") + assertEquals(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER), e.getMsgId()); + } + return null; + } + + }); + doTestInTransaction(new Test() + { + @Override + + public Void run() + { + + NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); + assertNotNull(transferContainer); + + try + { + + fileFolderService.create(transferContainer, "test content", ContentModel.TYPE_CONTENT); + + fail("This should have thrown an exception"); + + } + catch (AlfrescoRuntimeException e) + { + // ("Content can't be added to a record container. Use record folders to file content.") + assertEquals(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER), e.getMsgId()); + } + return null; + } + + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM452Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM452Test.java index 1873d0e9c5..580067e44c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM452Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM452Test.java @@ -1,106 +1,106 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestService; - -/** - * System test for RM-452 - * - * See alfresco.extension.rm-method-security.properties - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM452Test extends BaseRMTestCase -{ - private TestService testService; - - @Override - protected void initServices() - { - super.initServices(); - - testService = (TestService)applicationContext.getBean("TestService"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRM452() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertNotNull(folder); - assertNotNull(recordOne); - assertFalse(filePlanService.isFilePlanComponent(folder)); - assertTrue(filePlanService.isFilePlanComponent(recordOne)); - - // call methodOne with non-RM artifact .. expect success - testService.testMethodOne(folder); - - // call methodTwo with non-RM artifact .. expect success - testService.testMethodTwo(folder); - - // call methodOne with an RM artifact .. expect success - testService.testMethodOne(recordOne); - - return null; - } - }); - - doTestInTransaction(new FailureTest - ( - "Shouldn't be able to call testMethodTwo on TestService, because override RM security for method is not configred.", - AlfrescoRuntimeException.class - ) - { - - @Override - public void run() throws Exception - { - // call methodTwo with an RM artifact .. expect failure - testService.testMethodTwo(recordOne); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.TestService; + +/** + * System test for RM-452 + * + * See alfresco.extension.rm-method-security.properties + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RM452Test extends BaseRMTestCase +{ + private TestService testService; + + @Override + protected void initServices() + { + super.initServices(); + + testService = (TestService)applicationContext.getBean("TestService"); + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isRecordTest() + { + return true; + } + + public void testRM452() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertNotNull(folder); + assertNotNull(recordOne); + assertFalse(filePlanService.isFilePlanComponent(folder)); + assertTrue(filePlanService.isFilePlanComponent(recordOne)); + + // call methodOne with non-RM artifact .. expect success + testService.testMethodOne(folder); + + // call methodTwo with non-RM artifact .. expect success + testService.testMethodTwo(folder); + + // call methodOne with an RM artifact .. expect success + testService.testMethodOne(recordOne); + + return null; + } + }); + + doTestInTransaction(new FailureTest + ( + "Shouldn't be able to call testMethodTwo on TestService, because override RM security for method is not configred.", + AlfrescoRuntimeException.class + ) + { + + @Override + public void run() throws Exception + { + // call methodTwo with an RM artifact .. expect failure + testService.testMethodTwo(recordOne); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM804Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM804Test.java index 721afdab08..8faaf116b7 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM804Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM804Test.java @@ -1,198 +1,198 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.site.SiteRole; - -/** - * Unit test for RM-804 .. site managers are able to delete file plans - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM804Test extends BaseRMTestCase -{ - @Override - protected void initServices() - { - super.initServices(); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - public void testUsersHaveDeletePermissionsOnFilePlan() throws Exception - { - // as rmuser - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, rmUserName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); - - return null; - } - }, userName); - } - - public void testTryAndDeleteSiteAsSiteManagerOnly() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - siteService.setMembership(siteId, userName, SiteRole.SiteManager.toString()); - - return null; - } - }, "admin"); - - doTestInTransaction(new FailureTest - ( - "Should not be able to delete site as a site manager only.", - AlfrescoRuntimeException.class - ) - { - @Override - public void run() throws Exception - { - siteService.deleteSite(siteId); - - } - }, userName); - - // give the user a RM role (but not sufficient to delete the file plan node ref) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, userName); - - return null; - } - }, "admin"); - - doTestInTransaction(new FailureTest - ( - "Should not be able to delete site as a site manager with an RM role that doesn't have the capability.", - AlfrescoRuntimeException.class - ) - { - @Override - public void run() throws Exception - { - siteService.deleteSite(siteId); - - } - }, userName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_ADMIN, userName); - - return null; - } - }, "admin"); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - siteService.deleteSite(siteId); - - return null; - } - }, userName); - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.site.SiteRole; + +/** + * Unit test for RM-804 .. site managers are able to delete file plans + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RM804Test extends BaseRMTestCase +{ + @Override + protected void initServices() + { + super.initServices(); + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isUserTest() + { + return true; + } + + public void testUsersHaveDeletePermissionsOnFilePlan() throws Exception + { + // as rmuser + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); + + return null; + } + }, rmUserName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, capabilityService.getCapabilityAccessState(filePlan, "Delete")); + + return null; + } + }, userName); + } + + public void testTryAndDeleteSiteAsSiteManagerOnly() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + siteService.setMembership(siteId, userName, SiteRole.SiteManager.toString()); + + return null; + } + }, "admin"); + + doTestInTransaction(new FailureTest + ( + "Should not be able to delete site as a site manager only.", + AlfrescoRuntimeException.class + ) + { + @Override + public void run() throws Exception + { + siteService.deleteSite(siteId); + + } + }, userName); + + // give the user a RM role (but not sufficient to delete the file plan node ref) + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, userName); + + return null; + } + }, "admin"); + + doTestInTransaction(new FailureTest + ( + "Should not be able to delete site as a site manager with an RM role that doesn't have the capability.", + AlfrescoRuntimeException.class + ) + { + @Override + public void run() throws Exception + { + siteService.deleteSite(siteId); + + } + }, userName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_ADMIN, userName); + + return null; + } + }, "admin"); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + siteService.deleteSite(siteId); + + return null; + } + }, userName); + + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java index e162f97506..688e11280d 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java @@ -1,877 +1,877 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.repo.site.SiteServiceImpl; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.util.GUID; - -/** - * Test for RM-978 - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RM978Test extends BaseRMTestCase -{ - private NodeRef documentLibrary2; - private String user; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupCollaborationSiteTestDataImpl() - */ - @Override - protected void setupCollaborationSiteTestDataImpl() - { - super.setupCollaborationSiteTestDataImpl(); - - String collabSiteId2 = GUID.generate(); - siteService.createSite("site-dashboard", collabSiteId2, GUID.generate(), GUID.generate(), SiteVisibility.PUBLIC); - documentLibrary2 = SiteServiceImpl.getSiteContainer( - collabSiteId2, - SiteService.DOCUMENT_LIBRARY, - true, - siteService, - transactionService, - taggingService); - - assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary2); - - user = GUID.generate(); - createPerson(user); - siteService.setMembership(collabSiteId, user, SiteModel.SITE_CONTRIBUTOR); - siteService.setMembership(collabSiteId2, user, SiteModel.SITE_CONTRIBUTOR); - siteService.setMembership(siteId, user, SiteModel.SITE_CONSUMER); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_POWER_USER, user); - } - - public void testMoveDocumentToFolderInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, folder2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertNotNull(folder2ChildAssocs); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testMoveDocumentToDocumentLibraryInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, documentLibrary, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List childAssocs = nodeService.getChildAssocs(documentLibrary); - assertNotNull(childAssocs); - - List childNames = new ArrayList(); - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef childRef = childAssociationRef.getChildRef(); - childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); - } - - assertTrue(childNames.contains(document1Name)); - } - }); - } - - public void testMoveFolderToFolderInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private String folder1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, folder2, null); - } - - public void then() - { - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); - assertEquals(folder1Name, movedDocumentName); - } - }); - } - - public void testMoveDocumentToFolderInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, folder2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertNotNull(folder2ChildAssocs); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testMoveDocumentToDocumentLibraryInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, documentLibrary2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List childAssocs = nodeService.getChildAssocs(documentLibrary2); - assertNotNull(childAssocs); - - List childNames = new ArrayList(); - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef childRef = childAssociationRef.getChildRef(); - childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); - } - - assertTrue(childNames.contains(document1Name)); - } - }); - } - - public void testMoveFolderToFolderInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private String folder1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, folder2, null); - } - - public void then() - { - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); - assertEquals(folder1Name, movedDocumentName); - } - }); - } - - public void testMoveDocumentInFilePlanInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, filePlan, GUID.generate()); - } - }); - } - - public void testMoveDocumentInCategoryInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - private NodeRef rmCategory; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, rmCategory, GUID.generate()); - } - }); - } - - public void testMoveDocumentInFolderInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - private NodeRef rmCategory; - private NodeRef rmFolder; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); - - return null; - } - }, getAdminUserName()); - - fileFolderService.move(document1, rmFolder, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List rmFolderChildAssocs = nodeService.getChildAssocs(rmFolder); - assertEquals(1, rmFolderChildAssocs.size()); - NodeRef movedDocument = rmFolderChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testMoveFolderInFilePlanInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, filePlan, GUID.generate()); - } - }); - } - - public void testMoveFolderInCategoryInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef rmCategory; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, rmCategory, GUID.generate()); - } - }); - } - - public void testMoveFolderInFolderInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef rmCategory; - private NodeRef rmFolder; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, rmFolder, GUID.generate()); - } - }); - } - - public void testCopyDocumentToFolderInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, folder2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(1, folder1ChildAssocs.size()); - - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertNotNull(folder2ChildAssocs); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testCopyDocumentToDocumentLibraryInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, documentLibrary, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(1, folder1ChildAssocs.size()); - - List childAssocs = nodeService.getChildAssocs(documentLibrary); - assertNotNull(childAssocs); - - List childNames = new ArrayList(); - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef childRef = childAssociationRef.getChildRef(); - childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); - } - - assertTrue(childNames.contains(document1Name)); - } - }); - } - - public void testCopyFolderToFolderInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private String folder1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, folder2, null); - } - - public void then() - { - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); - assertEquals(folder1Name, movedDocumentName); - } - }); - } - - public void testCopyDocumentToFolderInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, folder2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(1, folder1ChildAssocs.size()); - - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertNotNull(folder2ChildAssocs); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testCopyDocumentToDocumentLibraryInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, documentLibrary2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(1, folder1ChildAssocs.size()); - - List childAssocs = nodeService.getChildAssocs(documentLibrary2); - assertNotNull(childAssocs); - - List childNames = new ArrayList(); - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef childRef = childAssociationRef.getChildRef(); - childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); - } - - assertTrue(childNames.contains(document1Name)); - } - }); - } - - public void testCopyFolderToFolderInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private String folder1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, folder2, null); - } - - public void then() - { - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); - assertEquals(folder1Name, movedDocumentName); - } - }); - } - - public void testCopyDocumentInFilePlanInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, filePlan, GUID.generate()); - } - }); - } - - public void testCopyDocumentInCategoryInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - private NodeRef rmCategory; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, rmCategory, GUID.generate()); - } - }); - } - - public void testCopyDocumentInFolderInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - private NodeRef rmCategory; - private NodeRef rmFolder; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); - - return null; - } - }, getAdminUserName()); - - fileFolderService.copy(document1, rmFolder, null); - } - }); - } - - public void testCopyFolderInFilePlanInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, filePlan, GUID.generate()); - } - }); - } - - public void testCopyFolderInCategoryInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef rmCategory; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, rmCategory, GUID.generate()); - } - }); - } - - public void testCopyFolderInFolderInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef rmCategory; - private NodeRef rmFolder; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, rmFolder, GUID.generate()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.repo.site.SiteServiceImpl; +import org.alfresco.service.cmr.model.FileExistsException; +import org.alfresco.service.cmr.model.FileNotFoundException; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.util.GUID; + +/** + * Test for RM-978 + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RM978Test extends BaseRMTestCase +{ + private NodeRef documentLibrary2; + private String user; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupCollaborationSiteTestDataImpl() + */ + @Override + protected void setupCollaborationSiteTestDataImpl() + { + super.setupCollaborationSiteTestDataImpl(); + + String collabSiteId2 = GUID.generate(); + siteService.createSite("site-dashboard", collabSiteId2, GUID.generate(), GUID.generate(), SiteVisibility.PUBLIC); + documentLibrary2 = SiteServiceImpl.getSiteContainer( + collabSiteId2, + SiteService.DOCUMENT_LIBRARY, + true, + siteService, + transactionService, + taggingService); + + assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary2); + + user = GUID.generate(); + createPerson(user); + siteService.setMembership(collabSiteId, user, SiteModel.SITE_CONTRIBUTOR); + siteService.setMembership(collabSiteId2, user, SiteModel.SITE_CONTRIBUTOR); + siteService.setMembership(siteId, user, SiteModel.SITE_CONSUMER); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_POWER_USER, user); + } + + public void testMoveDocumentToFolderInCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef folder2; + private NodeRef document1; + private String document1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(document1, folder2, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(0, folder1ChildAssocs.size()); + + List folder2ChildAssocs = nodeService.getChildAssocs(folder2); + assertNotNull(folder2ChildAssocs); + assertEquals(1, folder2ChildAssocs.size()); + NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); + assertEquals(document1Name, movedDocumentName); + } + }); + } + + public void testMoveDocumentToDocumentLibraryInCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef document1; + private String document1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(document1, documentLibrary, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(0, folder1ChildAssocs.size()); + + List childAssocs = nodeService.getChildAssocs(documentLibrary); + assertNotNull(childAssocs); + + List childNames = new ArrayList(); + for (ChildAssociationRef childAssociationRef : childAssocs) + { + NodeRef childRef = childAssociationRef.getChildRef(); + childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); + } + + assertTrue(childNames.contains(document1Name)); + } + }); + } + + public void testMoveFolderToFolderInCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef folder2; + private String folder1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); + folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(folder1, folder2, null); + } + + public void then() + { + List folder2ChildAssocs = nodeService.getChildAssocs(folder2); + assertEquals(1, folder2ChildAssocs.size()); + NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); + assertEquals(folder1Name, movedDocumentName); + } + }); + } + + public void testMoveDocumentToFolderInDifferentCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef folder2; + private NodeRef document1; + private String document1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(document1, folder2, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(0, folder1ChildAssocs.size()); + + List folder2ChildAssocs = nodeService.getChildAssocs(folder2); + assertNotNull(folder2ChildAssocs); + assertEquals(1, folder2ChildAssocs.size()); + NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); + assertEquals(document1Name, movedDocumentName); + } + }); + } + + public void testMoveDocumentToDocumentLibraryInDifferentCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef document1; + private String document1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(document1, documentLibrary2, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(0, folder1ChildAssocs.size()); + + List childAssocs = nodeService.getChildAssocs(documentLibrary2); + assertNotNull(childAssocs); + + List childNames = new ArrayList(); + for (ChildAssociationRef childAssociationRef : childAssocs) + { + NodeRef childRef = childAssociationRef.getChildRef(); + childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); + } + + assertTrue(childNames.contains(document1Name)); + } + }); + } + + public void testMoveFolderToFolderInDifferentCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef folder2; + private String folder1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); + folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(folder1, folder2, null); + } + + public void then() + { + List folder2ChildAssocs = nodeService.getChildAssocs(folder2); + assertEquals(1, folder2ChildAssocs.size()); + NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); + assertEquals(folder1Name, movedDocumentName); + } + }); + } + + public void testMoveDocumentInFilePlanInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef document1; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(document1, filePlan, GUID.generate()); + } + }); + } + + public void testMoveDocumentInCategoryInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef document1; + private NodeRef rmCategory; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + return null; + } + }, getAdminUserName()); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(document1, rmCategory, GUID.generate()); + } + }); + } + + public void testMoveDocumentInFolderInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef document1; + private String document1Name = GUID.generate(); + private NodeRef rmCategory; + private NodeRef rmFolder; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); + + return null; + } + }, getAdminUserName()); + } + + public void when() throws FileExistsException, FileNotFoundException + { + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); + + return null; + } + }, getAdminUserName()); + + fileFolderService.move(document1, rmFolder, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(0, folder1ChildAssocs.size()); + + List rmFolderChildAssocs = nodeService.getChildAssocs(rmFolder); + assertEquals(1, rmFolderChildAssocs.size()); + NodeRef movedDocument = rmFolderChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); + assertEquals(document1Name, movedDocumentName); + } + }); + } + + public void testMoveFolderInFilePlanInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(folder1, filePlan, GUID.generate()); + } + }); + } + + public void testMoveFolderInCategoryInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef rmCategory; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + return null; + } + }, getAdminUserName()); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(folder1, rmCategory, GUID.generate()); + } + }); + } + + public void testMoveFolderInFolderInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef rmCategory; + private NodeRef rmFolder; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); + + return null; + } + }, getAdminUserName()); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.move(folder1, rmFolder, GUID.generate()); + } + }); + } + + public void testCopyDocumentToFolderInCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef folder2; + private NodeRef document1; + private String document1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(document1, folder2, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(1, folder1ChildAssocs.size()); + + List folder2ChildAssocs = nodeService.getChildAssocs(folder2); + assertNotNull(folder2ChildAssocs); + assertEquals(1, folder2ChildAssocs.size()); + NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); + assertEquals(document1Name, movedDocumentName); + } + }); + } + + public void testCopyDocumentToDocumentLibraryInCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef document1; + private String document1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(document1, documentLibrary, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(1, folder1ChildAssocs.size()); + + List childAssocs = nodeService.getChildAssocs(documentLibrary); + assertNotNull(childAssocs); + + List childNames = new ArrayList(); + for (ChildAssociationRef childAssociationRef : childAssocs) + { + NodeRef childRef = childAssociationRef.getChildRef(); + childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); + } + + assertTrue(childNames.contains(document1Name)); + } + }); + } + + public void testCopyFolderToFolderInCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef folder2; + private String folder1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); + folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(folder1, folder2, null); + } + + public void then() + { + List folder2ChildAssocs = nodeService.getChildAssocs(folder2); + assertEquals(1, folder2ChildAssocs.size()); + NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); + assertEquals(folder1Name, movedDocumentName); + } + }); + } + + public void testCopyDocumentToFolderInDifferentCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef folder2; + private NodeRef document1; + private String document1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(document1, folder2, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(1, folder1ChildAssocs.size()); + + List folder2ChildAssocs = nodeService.getChildAssocs(folder2); + assertNotNull(folder2ChildAssocs); + assertEquals(1, folder2ChildAssocs.size()); + NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); + assertEquals(document1Name, movedDocumentName); + } + }); + } + + public void testCopyDocumentToDocumentLibraryInDifferentCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef document1; + private String document1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(document1, documentLibrary2, null); + } + + public void then() + { + List folder1ChildAssocs = nodeService.getChildAssocs(folder1); + assertEquals(1, folder1ChildAssocs.size()); + + List childAssocs = nodeService.getChildAssocs(documentLibrary2); + assertNotNull(childAssocs); + + List childNames = new ArrayList(); + for (ChildAssociationRef childAssociationRef : childAssocs) + { + NodeRef childRef = childAssociationRef.getChildRef(); + childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); + } + + assertTrue(childNames.contains(document1Name)); + } + }); + } + + public void testCopyFolderToFolderInDifferentCollabSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(user) + { + private NodeRef folder1; + private NodeRef folder2; + private String folder1Name = GUID.generate(); + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); + folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(folder1, folder2, null); + } + + public void then() + { + List folder2ChildAssocs = nodeService.getChildAssocs(folder2); + assertEquals(1, folder2ChildAssocs.size()); + NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); + String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); + assertEquals(folder1Name, movedDocumentName); + } + }); + } + + public void testCopyDocumentInFilePlanInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef document1; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(document1, filePlan, GUID.generate()); + } + }); + } + + public void testCopyDocumentInCategoryInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef document1; + private NodeRef rmCategory; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + return null; + } + }, getAdminUserName()); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(document1, rmCategory, GUID.generate()); + } + }); + } + + public void testCopyDocumentInFolderInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef document1; + private String document1Name = GUID.generate(); + private NodeRef rmCategory; + private NodeRef rmFolder; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); + + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); + + return null; + } + }, getAdminUserName()); + } + + public void when() throws FileExistsException, FileNotFoundException + { + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); + + return null; + } + }, getAdminUserName()); + + fileFolderService.copy(document1, rmFolder, null); + } + }); + } + + public void testCopyFolderInFilePlanInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(folder1, filePlan, GUID.generate()); + } + }); + } + + public void testCopyFolderInCategoryInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef rmCategory; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + return null; + } + }, getAdminUserName()); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(folder1, rmCategory, GUID.generate()); + } + }); + } + + public void testCopyFolderInFolderInRmSite() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) + { + private NodeRef folder1; + private NodeRef rmCategory; + private NodeRef rmFolder; + + public void given() + { + folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); + + runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); + + return null; + } + }, getAdminUserName()); + } + + public void when() throws FileExistsException, FileNotFoundException + { + fileFolderService.copy(folder1, rmFolder, GUID.generate()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM981SystemTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM981SystemTest.java index 4b51355f45..3df583343c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM981SystemTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM981SystemTest.java @@ -1,125 +1,125 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.security.SecureRandom; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -import junit.framework.TestCase; - -/** - * See https://issues.alfresco.com/jira/browse/RM-981. - * - * Instance of the repository needs to be running on localhost:8080 before executing this - * system test. - * - * @author Roy Wetherall - */ -public class RM981SystemTest extends TestCase -{ - public void testRM981() throws Exception - { - ExecutorService pool = Executors.newFixedThreadPool(2); - SecureRandom rnd = new SecureRandom(); - List data = new ArrayList(); - for (int i = 0; i < 100; i++) - { - String definitionname = "test_" + i + "_" + rnd.nextInt(Integer.MAX_VALUE); - data.add(definitionname); - } - - for (String definitionname : data) - { - pool.submit(new SendRequest(definitionname)); - } - pool.shutdown(); - pool.awaitTermination(60L, TimeUnit.SECONDS); - } - - - class SendRequest implements Runnable - { - - private String definitionname; - - public SendRequest(String definitionname) - { - this.definitionname = definitionname; - } - - @Override - public void run() - { - try - { - URL url = new URL("http://localhost:8080/alfresco/service/api/rma/admin/customreferencedefinitions"); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod("POST"); - conn.setDoOutput(true); - conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); - conn.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4="); - String body = "{\"referenceType\":\"bidirectional\",\"label\":\"" + definitionname + "\"}"; - OutputStream out = conn.getOutputStream(); - - out.write(body.getBytes("UTF-8")); - out.flush(); - out.close(); - - int status = conn.getResponseCode(); - - if (status != 200) - { - System.out.println("Reproduced"); - System.out.println("---------------------------------"); - String line; - BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); - while ((line = reader.readLine()) != null) - { - System.out.println(line); - } - reader.close(); - System.exit(0); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.security.SecureRandom; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import junit.framework.TestCase; + +/** + * See https://issues.alfresco.com/jira/browse/RM-981. + * + * Instance of the repository needs to be running on localhost:8080 before executing this + * system test. + * + * @author Roy Wetherall + */ +public class RM981SystemTest extends TestCase +{ + public void testRM981() throws Exception + { + ExecutorService pool = Executors.newFixedThreadPool(2); + SecureRandom rnd = new SecureRandom(); + List data = new ArrayList(); + for (int i = 0; i < 100; i++) + { + String definitionname = "test_" + i + "_" + rnd.nextInt(Integer.MAX_VALUE); + data.add(definitionname); + } + + for (String definitionname : data) + { + pool.submit(new SendRequest(definitionname)); + } + pool.shutdown(); + pool.awaitTermination(60L, TimeUnit.SECONDS); + } + + + class SendRequest implements Runnable + { + + private String definitionname; + + public SendRequest(String definitionname) + { + this.definitionname = definitionname; + } + + @Override + public void run() + { + try + { + URL url = new URL("http://localhost:8080/alfresco/service/api/rma/admin/customreferencedefinitions"); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("POST"); + conn.setDoOutput(true); + conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); + conn.setRequestProperty("Authorization", "Basic YWRtaW46YWRtaW4="); + String body = "{\"referenceType\":\"bidirectional\",\"label\":\"" + definitionname + "\"}"; + OutputStream out = conn.getOutputStream(); + + out.write(body.getBytes("UTF-8")); + out.flush(); + out.close(); + + int status = conn.getResponseCode(); + + if (status != 200) + { + System.out.println("Reproduced"); + System.out.println("---------------------------------"); + String line; + BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); + while ((line = reader.readLine()) != null) + { + System.out.println(line); + } + reader.close(); + System.exit(0); + } + } + catch (Exception ex) + { + ex.printStackTrace(); + + } + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM994Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM994Test.java index 5267aee1a2..bee27d7824 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM994Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM994Test.java @@ -1,134 +1,134 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; - -/** - * System test for RM-994 - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RM994Test extends BaseRMTestCase -{ - @Override - protected void initServices() - { - super.initServices(); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRM944() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - checkVitalRecordNotSet(rmContainer); - checkVitalRecordNotSet(rmFolder); - checkVitalRecordNotSet(recordOne); - assertNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF)); - - vitalRecordService.setVitalRecordDefintion(rmContainer, true, new Period("month|1")); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - checkVitalRecordSet(rmContainer); - checkVitalRecordSet(rmFolder); - checkVitalRecordSet(recordOne); - assertNotNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF)); - - recordService.createRecord(filePlan, dmDocument, true); - - assertTrue(recordService.isRecord(dmDocument)); - checkVitalRecordNotSet(dmDocument); - - fileFolderService.move(dmDocument, rmFolder, null); - - checkVitalRecordSet(dmDocument); - - return null; - } - }, "admin"); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - checkVitalRecordSet(dmDocument); - - return null; - } - }); - - } - - private void checkVitalRecordSet(NodeRef nodeRef) - { - VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef); - assertNotNull(def); - assertTrue(def.isEnabled()); - assertEquals("month", def.getReviewPeriod().getPeriodType()); - assertEquals("1", def.getReviewPeriod().getExpression()); - } - - private void checkVitalRecordNotSet(NodeRef nodeRef) - { - VitalRecordDefinition recordDef = vitalRecordService.getVitalRecordDefinition(nodeRef); - if (recordDef != null) - { - assertFalse(recordDef.isEnabled()); - assertEquals("none", recordDef.getReviewPeriod().getPeriodType()); - assertNull(recordDef.getNextReviewDate()); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; + +/** + * System test for RM-994 + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RM994Test extends BaseRMTestCase +{ + @Override + protected void initServices() + { + super.initServices(); + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isRecordTest() + { + return true; + } + + public void testRM944() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + checkVitalRecordNotSet(rmContainer); + checkVitalRecordNotSet(rmFolder); + checkVitalRecordNotSet(recordOne); + assertNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF)); + + vitalRecordService.setVitalRecordDefintion(rmContainer, true, new Period("month|1")); + + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + checkVitalRecordSet(rmContainer); + checkVitalRecordSet(rmFolder); + checkVitalRecordSet(recordOne); + assertNotNull(nodeService.getProperty(recordOne, PROP_REVIEW_AS_OF)); + + recordService.createRecord(filePlan, dmDocument, true); + + assertTrue(recordService.isRecord(dmDocument)); + checkVitalRecordNotSet(dmDocument); + + fileFolderService.move(dmDocument, rmFolder, null); + + checkVitalRecordSet(dmDocument); + + return null; + } + }, "admin"); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + checkVitalRecordSet(dmDocument); + + return null; + } + }); + + } + + private void checkVitalRecordSet(NodeRef nodeRef) + { + VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef); + assertNotNull(def); + assertTrue(def.isEnabled()); + assertEquals("month", def.getReviewPeriod().getPeriodType()); + assertEquals("1", def.getReviewPeriod().getExpression()); + } + + private void checkVitalRecordNotSet(NodeRef nodeRef) + { + VitalRecordDefinition recordDef = vitalRecordService.getVitalRecordDefinition(nodeRef); + if (recordDef != null) + { + assertFalse(recordDef.isEnabled()); + assertEquals("none", recordDef.getReviewPeriod().getPeriodType()); + assertNull(recordDef.getNextReviewDate()); + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314Test.java index e924d66670..0aaf87d84b 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314Test.java @@ -1,80 +1,80 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue.rm3314; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * Test for https://issues.alfresco.com/jira/browse/RM-3114 - * - * @author Roy Wetherall - * @since 2.2.1.5 - */ -public class RM3314Test extends BaseRMTestCase -{ - /** Application context */ - protected String[] getConfigLocations() - { - return new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:test-context.xml", - "classpath:test-rm3314-context.xml" - }; - } - - /** registry to record callback from test beans "test.rm3114.1" and "test.rm3114.2" */ - public static Map callback = new HashMap(2); - - /** - * Given that the custom model hasn't been initialised - * When an aspect is added - * Then nothing happens - * - * Given that the custom model has been initialised - * When an aspect is added - * Then something happens - */ - public void testListenersExecutedInTheCorrectOrder() - { - /** - * The related test beans will call back into the callback map showing - * whether at the end of their execution whether the custom model has been - * initialised or not. Given the order in which these test beans are executed - * on spring context load, we would expect that .1 executes with the custom - * map unloaded, and the .2 with it loaded. - */ - - assertFalse(callback.isEmpty()); - assertFalse(callback.get("test.rm3314.1")); - assertTrue(callback.get("test.rm3314.2")); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue.rm3314; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; + +/** + * Test for https://issues.alfresco.com/jira/browse/RM-3114 + * + * @author Roy Wetherall + * @since 2.2.1.5 + */ +public class RM3314Test extends BaseRMTestCase +{ + /** Application context */ + protected String[] getConfigLocations() + { + return new String[] + { + "classpath:alfresco/application-context.xml", + "classpath:test-context.xml", + "classpath:test-rm3314-context.xml" + }; + } + + /** registry to record callback from test beans "test.rm3114.1" and "test.rm3114.2" */ + public static Map callback = new HashMap(2); + + /** + * Given that the custom model hasn't been initialised + * When an aspect is added + * Then nothing happens + * + * Given that the custom model has been initialised + * When an aspect is added + * Then something happens + */ + public void testListenersExecutedInTheCorrectOrder() + { + /** + * The related test beans will call back into the callback map showing + * whether at the end of their execution whether the custom model has been + * initialised or not. Given the order in which these test beans are executed + * on spring context load, we would expect that .1 executes with the custom + * map unloaded, and the .2 with it loaded. + */ + + assertFalse(callback.isEmpty()); + assertFalse(callback.get("test.rm3314.1")); + assertTrue(callback.get("test.rm3314.2")); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314TestListener.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314TestListener.java index d54d6f585c..ebd2dd3aba 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314TestListener.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/rm3314/RM3314TestListener.java @@ -1,147 +1,147 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.issue.rm3314; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl; -import org.alfresco.repo.model.Repository; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.springframework.beans.factory.BeanNameAware; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.core.Ordered; -import org.springframework.jdbc.BadSqlGrammarException; - -/** - * Simple bean used to test RM-3314 - * - * @author rwetherall - * @since 2.2.1.5 - */ -public class RM3314TestListener implements ApplicationListener, - Ordered, - BeanNameAware -{ - private RecordsManagementAdminServiceImpl recordsManagementAdminService; - private NodeService nodeService; - private FileFolderService fileFolderService; - private Repository repository; - - private String name; - private int order = Ordered.LOWEST_PRECEDENCE; - - public void setRecordsManagementAdminService(RecordsManagementAdminServiceImpl recordsManagementAdminService) - { - this.recordsManagementAdminService = recordsManagementAdminService; - } - - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - public void setRepository(Repository repository) - { - this.repository = repository; - } - - @Override - public void setBeanName(String name) - { - this.name = name; - } - - public void setOrder(int order) - { - this.order = order; - } - - @Override - public void onApplicationEvent(ContextRefreshedEvent event) - { - // call back to show whether the custom map is initialised or not - RM3314Test.callback.put(name, recordsManagementAdminService.isCustomMapInit()); - - // Do some work on a node to show that reguardless of whether the custom map is - // init or not, things still work. - // Note: using public services to ensure new transaction for each service call - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - try - { - NodeRef companyHome = repository.getCompanyHome(); - - if (fileFolderService.searchSimple(companyHome, name) == null) - { - // create node - NodeRef folder = fileFolderService.create( - repository.getCompanyHome(), - name, - ContentModel.TYPE_FOLDER).getNodeRef(); - try - { - // add aspect - nodeService.addAspect(folder, ContentModel.ASPECT_CLASSIFIABLE, null); - - // remove aspect - nodeService.removeAspect(folder, ContentModel.ASPECT_CLASSIFIABLE); - } - finally - { - // delete node - nodeService.deleteNode(folder); - } - } - } - catch (BadSqlGrammarException e) - { - // ignore and carry on - } - - return null; - } - }); - } - - @Override - public int getOrder() - { - return order; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.issue.rm3314; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl; +import org.alfresco.repo.model.Repository; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.springframework.beans.factory.BeanNameAware; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.core.Ordered; +import org.springframework.jdbc.BadSqlGrammarException; + +/** + * Simple bean used to test RM-3314 + * + * @author rwetherall + * @since 2.2.1.5 + */ +public class RM3314TestListener implements ApplicationListener, + Ordered, + BeanNameAware +{ + private RecordsManagementAdminServiceImpl recordsManagementAdminService; + private NodeService nodeService; + private FileFolderService fileFolderService; + private Repository repository; + + private String name; + private int order = Ordered.LOWEST_PRECEDENCE; + + public void setRecordsManagementAdminService(RecordsManagementAdminServiceImpl recordsManagementAdminService) + { + this.recordsManagementAdminService = recordsManagementAdminService; + } + + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + public void setFileFolderService(FileFolderService fileFolderService) + { + this.fileFolderService = fileFolderService; + } + + public void setRepository(Repository repository) + { + this.repository = repository; + } + + @Override + public void setBeanName(String name) + { + this.name = name; + } + + public void setOrder(int order) + { + this.order = order; + } + + @Override + public void onApplicationEvent(ContextRefreshedEvent event) + { + // call back to show whether the custom map is initialised or not + RM3314Test.callback.put(name, recordsManagementAdminService.isCustomMapInit()); + + // Do some work on a node to show that reguardless of whether the custom map is + // init or not, things still work. + // Note: using public services to ensure new transaction for each service call + AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Void doWork() throws Exception + { + try + { + NodeRef companyHome = repository.getCompanyHome(); + + if (fileFolderService.searchSimple(companyHome, name) == null) + { + // create node + NodeRef folder = fileFolderService.create( + repository.getCompanyHome(), + name, + ContentModel.TYPE_FOLDER).getNodeRef(); + try + { + // add aspect + nodeService.addAspect(folder, ContentModel.ASPECT_CLASSIFIABLE, null); + + // remove aspect + nodeService.removeAspect(folder, ContentModel.ASPECT_CLASSIFIABLE); + } + finally + { + // delete node + nodeService.deleteNode(folder); + } + } + } + catch (BadSqlGrammarException e) + { + // ignore and carry on + } + + return null; + } + }); + } + + @Override + public int getOrder() + { + return order; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/job/AutomaticDispositionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/job/AutomaticDispositionTest.java index 23826ea933..bd754e2898 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/job/AutomaticDispositionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/job/AutomaticDispositionTest.java @@ -1,141 +1,141 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.job; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Test automatic disposition via scheduled job. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class AutomaticDispositionTest extends BaseRMTestCase -{ - @SuppressWarnings("unused") - private RecordsManagementAuditService auditService; - - /** additional job context to override job frequency */ - protected String[] getConfigLocations() - { - return new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:test-context.xml", - "classpath:test-job-context.xml" - }; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - auditService = (RecordsManagementAuditService)applicationContext.getBean("recordsManagementAuditService"); - } - - /** - * Given there is a complete record eligible for cut off, when the correct frequency of time passes, then - * the record will be automatically cut off - */ - public void testAutomaticCutOff() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef sourceCategory; - NodeRef sourceRecordFolder; - NodeRef record; - - public void given() - { - // create test data - sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - DispositionSchedule dis = utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, false); - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dis, adParams); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); - - // create and complete record - record = utils.createRecord(sourceRecordFolder, GUID.generate()); - utils.completeRecord(record); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - } - - public void when() throws Exception - { - // sleep .. allowing the job time to execute - Thread.sleep(30000); - } - - public void then() - { - // record should now be cut off - assertTrue(dispositionService.isDisposableItemCutoff(record)); - - // TODO .. automatic dispoistion does not log entry in audit - // .. the following test checks for this, but is currently commented out - // .. because it doesn't work! -// RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); -// params.setEvent(CutOffAction.NAME); -// params.setMaxEntries(1); -// List entries = auditService.getAuditTrail(params); -// assertNotNull(entries); -// assertEquals(1, entries.size()); -// -// RecordsManagementAuditEntry entry = entries.get(0); -// assertEquals(record, entry.getNodeRef()); - } - }); - } - - // TODO automatic retain - - // TODO automatic destroy -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.job; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * Test automatic disposition via scheduled job. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class AutomaticDispositionTest extends BaseRMTestCase +{ + @SuppressWarnings("unused") + private RecordsManagementAuditService auditService; + + /** additional job context to override job frequency */ + protected String[] getConfigLocations() + { + return new String[] + { + "classpath:alfresco/application-context.xml", + "classpath:test-context.xml", + "classpath:test-job-context.xml" + }; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() + */ + @Override + protected void initServices() + { + super.initServices(); + auditService = (RecordsManagementAuditService)applicationContext.getBean("recordsManagementAuditService"); + } + + /** + * Given there is a complete record eligible for cut off, when the correct frequency of time passes, then + * the record will be automatically cut off + */ + public void testAutomaticCutOff() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef sourceCategory; + NodeRef sourceRecordFolder; + NodeRef record; + + public void given() + { + // create test data + sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + DispositionSchedule dis = utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, false); + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); + adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); + dispositionService.addDispositionActionDefinition(dis, adParams); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); + + // create and complete record + record = utils.createRecord(sourceRecordFolder, GUID.generate()); + utils.completeRecord(record); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertTrue(dispositionService.isNextDispositionActionEligible(record)); + } + + public void when() throws Exception + { + // sleep .. allowing the job time to execute + Thread.sleep(30000); + } + + public void then() + { + // record should now be cut off + assertTrue(dispositionService.isDisposableItemCutoff(record)); + + // TODO .. automatic dispoistion does not log entry in audit + // .. the following test checks for this, but is currently commented out + // .. because it doesn't work! +// RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); +// params.setEvent(CutOffAction.NAME); +// params.setMaxEntries(1); +// List entries = auditService.getAuditTrail(params); +// assertNotNull(entries); +// assertEquals(1, entries.size()); +// +// RecordsManagementAuditEntry entry = entries.get(0); +// assertEquals(record, entry.getNodeRef()); + } + }); + } + + // TODO automatic retain + + // TODO automatic destroy +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java index 7d46e8ff11..f59a9f9d1c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java @@ -1,242 +1,242 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Complete record tests. - * - * @author Roy Wetherall - * @since 2.2.1 - */ -public class CompleteRecordTest extends BaseRMTestCase -{ - private static final QName ASPECT_TEST = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "recordMetaDataWithProperty"); - private static final QName PROP_TEST = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customMandatoryProperty"); - - /** complete record action */ - private DeclareRecordAction action; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - - // get the action - action = (DeclareRecordAction)applicationContext.getBean("declareRecord"); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // ensure action is returned to original state - action.setCheckMandatoryPropertiesEnabled(true); - } - - /** - * Given the the application is configured to check for mandatory values before complete - * And a filed record is missing mandatory values - * When I try to complete the record - * Then the missing properties parameter of the action will be populated - * And the record will not be complete - */ - public void testCheckForMandatoryValuesMissing() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private RecordsManagementActionResult result; - - public void given() - { - // enable mandatory parameter check - action.setCheckMandatoryPropertiesEnabled(true); - - // create a record - record = utils.createRecord(rmFolder, "record.txt", "title"); - - // add the record aspect (that has a mandatory property) - nodeService.addAspect(record, ASPECT_TEST, null); - } - - public void when() - { - // complete record - result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); - } - - public void then() - { - assertNotNull(result); - assertNotNull(result.getValue()); - assertFalse(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); - } - }); - } - - /** - * Given the the application is configured to check for mandatory values before complete - * And a filed record has all mandatory values - * When I try to complete the record - * Then the record is completed - */ - public void testCheckForMandatoryValuePresent() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private RecordsManagementActionResult result; - - public void given() - { - // enable mandatory parameter check - action.setCheckMandatoryPropertiesEnabled(true); - - // create a record - record = utils.createRecord(rmFolder, "record.txt", "title"); - - // add the record aspect (that has a mandatory property) - Map properties = new HashMap(1); - properties.put(PROP_TEST, "something"); - nodeService.addAspect(record, ASPECT_TEST, properties); - } - - public void when() - { - // complete record - result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); - } - - public void then() - { - assertNotNull(result); - assertNull(result.getValue()); - assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); - } - }); - } - - /** - * Given the the application is configured not to check for mandatory values before complete - * And a filed record is missing mandatory values - * When I try to complete the record - * Then the record is completed - */ - public void testDontCheckForMandatoryValuesMissing() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private RecordsManagementActionResult result; - - public void given() - { - // disable mandatory parameter check - action.setCheckMandatoryPropertiesEnabled(false); - - // create a record - record = utils.createRecord(rmFolder, "record.txt", "title"); - - // add the record aspect (that has a mandatory property) - nodeService.addAspect(record, ASPECT_TEST, null); - } - - public void when() - { - // complete record - result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); - } - - public void then() - { - assertNotNull(result); - assertNull(result.getValue()); - assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); - } - }); - } - - /** - * Given the the application is configured to not to check for mandatory values before complete - * And a filed record has all mandatory values - * When I try to complete the record - * Then the record is completed - */ - public void testDontCheckForMandatoryValuePresent() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef record; - private RecordsManagementActionResult result; - - public void given() - { - // enable mandatory parameter check - action.setCheckMandatoryPropertiesEnabled(false); - - // create a record - record = utils.createRecord(rmFolder, "record.txt", "title"); - - // add the record aspect (that has a mandatory property) - Map properties = new HashMap(1); - properties.put(PROP_TEST, "something"); - nodeService.addAspect(record, ASPECT_TEST, properties); - } - - public void when() - { - // complete record - result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); - } - - public void then() - { - assertNotNull(result); - assertNull(result.getValue()); - assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Complete record tests. + * + * @author Roy Wetherall + * @since 2.2.1 + */ +public class CompleteRecordTest extends BaseRMTestCase +{ + private static final QName ASPECT_TEST = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "recordMetaDataWithProperty"); + private static final QName PROP_TEST = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customMandatoryProperty"); + + /** complete record action */ + private DeclareRecordAction action; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() + */ + @Override + protected void initServices() + { + super.initServices(); + + // get the action + action = (DeclareRecordAction)applicationContext.getBean("declareRecord"); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() + */ + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + + // ensure action is returned to original state + action.setCheckMandatoryPropertiesEnabled(true); + } + + /** + * Given the the application is configured to check for mandatory values before complete + * And a filed record is missing mandatory values + * When I try to complete the record + * Then the missing properties parameter of the action will be populated + * And the record will not be complete + */ + public void testCheckForMandatoryValuesMissing() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + private RecordsManagementActionResult result; + + public void given() + { + // enable mandatory parameter check + action.setCheckMandatoryPropertiesEnabled(true); + + // create a record + record = utils.createRecord(rmFolder, "record.txt", "title"); + + // add the record aspect (that has a mandatory property) + nodeService.addAspect(record, ASPECT_TEST, null); + } + + public void when() + { + // complete record + result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); + } + + public void then() + { + assertNotNull(result); + assertNotNull(result.getValue()); + assertFalse(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); + } + }); + } + + /** + * Given the the application is configured to check for mandatory values before complete + * And a filed record has all mandatory values + * When I try to complete the record + * Then the record is completed + */ + public void testCheckForMandatoryValuePresent() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + private RecordsManagementActionResult result; + + public void given() + { + // enable mandatory parameter check + action.setCheckMandatoryPropertiesEnabled(true); + + // create a record + record = utils.createRecord(rmFolder, "record.txt", "title"); + + // add the record aspect (that has a mandatory property) + Map properties = new HashMap(1); + properties.put(PROP_TEST, "something"); + nodeService.addAspect(record, ASPECT_TEST, properties); + } + + public void when() + { + // complete record + result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); + } + + public void then() + { + assertNotNull(result); + assertNull(result.getValue()); + assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); + } + }); + } + + /** + * Given the the application is configured not to check for mandatory values before complete + * And a filed record is missing mandatory values + * When I try to complete the record + * Then the record is completed + */ + public void testDontCheckForMandatoryValuesMissing() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + private RecordsManagementActionResult result; + + public void given() + { + // disable mandatory parameter check + action.setCheckMandatoryPropertiesEnabled(false); + + // create a record + record = utils.createRecord(rmFolder, "record.txt", "title"); + + // add the record aspect (that has a mandatory property) + nodeService.addAspect(record, ASPECT_TEST, null); + } + + public void when() + { + // complete record + result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); + } + + public void then() + { + assertNotNull(result); + assertNull(result.getValue()); + assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); + } + }); + } + + /** + * Given the the application is configured to not to check for mandatory values before complete + * And a filed record has all mandatory values + * When I try to complete the record + * Then the record is completed + */ + public void testDontCheckForMandatoryValuePresent() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + private RecordsManagementActionResult result; + + public void given() + { + // enable mandatory parameter check + action.setCheckMandatoryPropertiesEnabled(false); + + // create a record + record = utils.createRecord(rmFolder, "record.txt", "title"); + + // add the record aspect (that has a mandatory property) + Map properties = new HashMap(1); + properties.put(PROP_TEST, "something"); + nodeService.addAspect(record, ASPECT_TEST, properties); + } + + public void when() + { + // complete record + result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); + } + + public void then() + { + assertNotNull(result); + assertNull(result.getValue()); + assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java index 0a5ed70352..2cb3c69efc 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java @@ -1,296 +1,296 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Create record tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class CreateRecordTest extends BaseRMTestCase -{ - public void testCreateRecordCapabilityOnly() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef recordFolder; - NodeRef record; - - public void given() - { - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("CreateRecords")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create file plan structure - NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); - } - - public void when() - { - // give read and file permissions to user - filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - record = recordService.createRecordFromContent(recordFolder, GUID.generate(), TYPE_CONTENT, null, null); - - return null; - } - }, user); - } - - public void then() - { - // check the details of the record - assertTrue(recordService.isRecord(record)); - } - }); - } - - /** - * - */ - public void testCreateRecordCapabilityOnlyFromFileFolderService() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef recordFolder; - NodeRef record; - - public void given() - { - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("CreateRecords")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create file plan structure - NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); - } - - public void when() - { - // give read and file permissions to user - filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - record = fileFolderService.create(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - ContentWriter writer = contentService.getWriter(record, ContentModel.TYPE_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent("Lucy Wetherall"); - - return null; - } - }, user); - } - - public void then() - { - // check the details of the record - assertTrue(recordService.isRecord(record)); - } - }); - } - - /** - * unit test for RM1649 fix - * test if a user with create record permissions and without file record permission is able to create a record within unfiled record container - */ - public void testCreateRecordCapabilityInsideUnfiledRecordsContainer() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef record; - - public void given() - { - // create a role with view and create capabilities - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("CreateRecords")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - //give read and file permission to user on unfiled records container - filePlanPermissionService.setPermission(unfiledContainer , user, RMPermissionModel.FILING); - } - - public void when() - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - record = recordService.createRecordFromContent(unfiledContainer, GUID.generate(), TYPE_CONTENT, null, null); - - return null; - } - }, user); - } - - public void then() - { - // check the details of the record - assertTrue(recordService.isRecord(record)); - - } - }); - } - - /** - * Given I have ViewRecord and CreateRecord capabilities - * And I have filling on a record folder - * When I create content via ScriptNode (simulated) - * Then the record is successfully created - * - * @see https://issues.alfresco.com/jira/browse/RM-1956 - */ - public void testCreateRecordViaCoreServices() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef recordFolder; - NodeRef record; - - public void given() - { - // create a role with view and create capabilities - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("CreateRecords")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create file plan structure - NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); - } - - public void when() - { - // give read and file permissions to user - filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); - - record = AuthenticationUtil.runAs(new RunAsWork() - { - public NodeRef doWork() throws Exception - { - NodeRef record = fileFolderService.create(recordFolder, "testRecord.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - ContentData content = (ContentData)nodeService.getProperty(record, PROP_CONTENT); - nodeService.setProperty(record, PROP_CONTENT, ContentData.setMimetype(content, MimetypeMap.MIMETYPE_TEXT_PLAIN)); - return record; - } - }, user); - } - - public void then() - { - // check the details of the record - assertTrue(recordService.isRecord(record)); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // we are expecting an expception here - try - { - ContentData content = (ContentData)nodeService.getProperty(record, PROP_CONTENT); - nodeService.setProperty(record, PROP_CONTENT, ContentData.setMimetype(content, MimetypeMap.MIMETYPE_TEXT_PLAIN)); - fail("Expecting access denied exception"); - } - catch (AccessDeniedException exception) - { - // expceted - } - - return null; - } - }, user); - } - - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.GUID; + +/** + * Create record tests. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class CreateRecordTest extends BaseRMTestCase +{ + public void testCreateRecordCapabilityOnly() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + /** test data */ + String roleName = GUID.generate(); + String user = GUID.generate(); + NodeRef recordFolder; + NodeRef record; + + public void given() + { + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("CreateRecords")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + // create file plan structure + NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); + } + + public void when() + { + // give read and file permissions to user + filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + record = recordService.createRecordFromContent(recordFolder, GUID.generate(), TYPE_CONTENT, null, null); + + return null; + } + }, user); + } + + public void then() + { + // check the details of the record + assertTrue(recordService.isRecord(record)); + } + }); + } + + /** + * + */ + public void testCreateRecordCapabilityOnlyFromFileFolderService() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + /** test data */ + String roleName = GUID.generate(); + String user = GUID.generate(); + NodeRef recordFolder; + NodeRef record; + + public void given() + { + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("CreateRecords")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + // create file plan structure + NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); + } + + public void when() + { + // give read and file permissions to user + filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + record = fileFolderService.create(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + ContentWriter writer = contentService.getWriter(record, ContentModel.TYPE_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.setEncoding("UTF-8"); + writer.putContent("Lucy Wetherall"); + + return null; + } + }, user); + } + + public void then() + { + // check the details of the record + assertTrue(recordService.isRecord(record)); + } + }); + } + + /** + * unit test for RM1649 fix + * test if a user with create record permissions and without file record permission is able to create a record within unfiled record container + */ + public void testCreateRecordCapabilityInsideUnfiledRecordsContainer() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + /** test data */ + String roleName = GUID.generate(); + String user = GUID.generate(); + NodeRef record; + + public void given() + { + // create a role with view and create capabilities + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("CreateRecords")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + //give read and file permission to user on unfiled records container + filePlanPermissionService.setPermission(unfiledContainer , user, RMPermissionModel.FILING); + } + + public void when() + { + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + record = recordService.createRecordFromContent(unfiledContainer, GUID.generate(), TYPE_CONTENT, null, null); + + return null; + } + }, user); + } + + public void then() + { + // check the details of the record + assertTrue(recordService.isRecord(record)); + + } + }); + } + + /** + * Given I have ViewRecord and CreateRecord capabilities + * And I have filling on a record folder + * When I create content via ScriptNode (simulated) + * Then the record is successfully created + * + * @see https://issues.alfresco.com/jira/browse/RM-1956 + */ + public void testCreateRecordViaCoreServices() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + /** test data */ + String roleName = GUID.generate(); + String user = GUID.generate(); + NodeRef recordFolder; + NodeRef record; + + public void given() + { + // create a role with view and create capabilities + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("CreateRecords")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + // create file plan structure + NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); + } + + public void when() + { + // give read and file permissions to user + filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); + + record = AuthenticationUtil.runAs(new RunAsWork() + { + public NodeRef doWork() throws Exception + { + NodeRef record = fileFolderService.create(recordFolder, "testRecord.txt", ContentModel.TYPE_CONTENT).getNodeRef(); + ContentData content = (ContentData)nodeService.getProperty(record, PROP_CONTENT); + nodeService.setProperty(record, PROP_CONTENT, ContentData.setMimetype(content, MimetypeMap.MIMETYPE_TEXT_PLAIN)); + return record; + } + }, user); + } + + public void then() + { + // check the details of the record + assertTrue(recordService.isRecord(record)); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // we are expecting an expception here + try + { + ContentData content = (ContentData)nodeService.getProperty(record, PROP_CONTENT); + nodeService.setProperty(record, PROP_CONTENT, ContentData.setMimetype(content, MimetypeMap.MIMETYPE_TEXT_PLAIN)); + fail("Expecting access denied exception"); + } + catch (AccessDeniedException exception) + { + // expceted + } + + return null; + } + }, user); + } + + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java index 86d9caf1d3..65c0149146 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java @@ -1,107 +1,107 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; - -/** - * Hide Inplace Record Test - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class HideInplaceRecordTest extends BaseRMTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * Tests hiding inplace records - */ - public void testHideInplaceRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // Check that the document is not a record - assertFalse(recordService.isRecord(dmDocument)); - - // Check that the record has one parent association - assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); - - // Declare the document as a record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Declare record - recordService.createRecord(filePlan, dmDocument); - - return null; - } - }, dmCollaborator); - - // Check that the document is a record - assertTrue(recordService.isRecord(dmDocument)); - - // Check that the record has two parent associations - assertEquals(2, nodeService.getParentAssocs(dmDocument).size()); - } - - public void when() - { - // Hide the document - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Hide record - inplaceRecordService.hideRecord(dmDocument); - - return null; - } - }, dmCollaborator); - } - - public void then() - { - // Check that the record has one parent association - assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; + +/** + * Hide Inplace Record Test + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class HideInplaceRecordTest extends BaseRMTestCase +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** + * Tests hiding inplace records + */ + public void testHideInplaceRecord() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + public void given() + { + // Check that the document is not a record + assertFalse(recordService.isRecord(dmDocument)); + + // Check that the record has one parent association + assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); + + // Declare the document as a record + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // Declare record + recordService.createRecord(filePlan, dmDocument); + + return null; + } + }, dmCollaborator); + + // Check that the document is a record + assertTrue(recordService.isRecord(dmDocument)); + + // Check that the record has two parent associations + assertEquals(2, nodeService.getParentAssocs(dmDocument).size()); + } + + public void when() + { + // Hide the document + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // Hide record + inplaceRecordService.hideRecord(dmDocument); + + return null; + } + }, dmCollaborator); + } + + public void then() + { + // Check that the record has one parent association + assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java index d94d0aeda1..b16c1472c3 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java @@ -1,952 +1,952 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.test; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.util.GUID; - -/** - * In-place record permission integration test. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class InplaceRecordPermissionTest extends BaseRMTestCase -{ - /** capability list */ - private static final List CAPABILITIES = Stream - .of(RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_NON_RECORD_METADATA, - RMPermissionModel.EDIT_RECORD_METADATA) - .collect(Collectors.toList()); - - /** test data */ - private NodeRef contribDoc; - private NodeRef deleteUserDoc; - private NodeRef copiedDoc; - private NodeRef copyDoc; - private String deletedUser; - - /** services */ - private NodeService dbNodeService; - - /** capabilities */ - private Capability viewRecordsCapability; - private Capability editNonRecordMetadataCapability; - private Capability editRecordMetadataCapability; - - /** test characteristics */ - @Override protected boolean isCollaborationSiteTest() { return true; } - @Override protected boolean isUserTest() { return true; } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - - // initialise behaviour tests - BehaviourTest.initBehaviourTests(retryingTransactionHelper); - - // get services - dbNodeService = (NodeService)applicationContext.getBean("dbNodeService"); - - // get capability references - viewRecordsCapability = capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS); - editNonRecordMetadataCapability = capabilityService.getCapability(RMPermissionModel.EDIT_NON_RECORD_METADATA); - editRecordMetadataCapability = capabilityService.getCapability(RMPermissionModel.EDIT_RECORD_METADATA); - } - - /** - * Given a document in a collaboration site - * When a user without write permissions on the document tries to declare it as a record - * Then the declaration fails - * And the document does not become a record - */ - public void testUserWithOutWriteCantDeclareInPlaceRecord() - { - test() - .given() - - // Given a document in a collaboration site that is not a record - .expect(false) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is not a record.") - - // And a user with no write permission on the document - .as(userName) - .expect(AccessStatus.DENIED.toString()) - .from(() -> permissionService.hasPermission(dmDocument, PermissionService.WRITE).toString()) - .because("User does not have write access to document.") - - // When the user tries to declare the record - // Then we expect this to fail - .when() - .as(userName) - .expectException(AccessDeniedException.class) - .from(() -> recordService.createRecord(filePlan, dmDocument)) - .because("The user does not have write permission on the document."); - } - - /** - * Given a document in a collaboration site that is not a record - * And a contributor the didn't create the document - * When the contributor tries to declare the document as a record - * Then the document does not become a record - */ - public void testContributorThatIsntOwnerDeclareInPlaceRecord() - { - test() - .given() - - // Given a document in a collaboration site that is not a record - .expect(false) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is not a record.") - - // And a contributor the didn't create the document - .as(dmContributor) - .expect(AccessStatus.DENIED.toString()) - .from(() -> permissionService.hasPermission(dmDocument, PermissionService.WRITE).toString()) - .because("Contributor does not have write access to document.") - - // When the user tries to declare the record - // When the contributor tries to declare the document as a record - .when() - .as(dmContributor) - .expectException(AccessDeniedException.class) - .from(() -> recordService.createRecord(filePlan, dmDocument)) - .because("The contributor does not have write permission on the document."); - } - - /** - * Given a document in a collaboration site is not a record - * When the document is declared by a site collaborator - * Then the document becomes a record - * And the site users have the appropriate in-place permissions on the record - */ - public void testCreateInplaceRecordFromCollabSite() - { - test() - - // Given that a document in a collaboration site is not a record - .given() - .asAdmin() - .expect(false) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is not a record") - - // When it is declared as an inplace record - .when() - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - - .then() - .asAdmin() - // Then it becomes a record - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is a record") - - // And it isn't filed - .expect(false) - .from(() -> recordService.isFiled(dmDocument)) - .because("The record is not filed") - - // And a site collaborator has filling permissions and filling capability on the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site consumer has read permissions and view record capability on the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not a member of the site has no access to the inplace record - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Helper method to check in place access for a user on a record. - */ - private void checkInPlaceAccess(NodeRef nodeRef, AccessStatus ... accessStatus) - { - // check permission access - assertEquals("Incorrect read record permission access.", accessStatus[0], permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS)); - assertEquals("Incorrect filling permission access.", accessStatus[1], permissionService.hasPermission(nodeRef, RMPermissionModel.FILING)); - - // check capability access - Map access = capabilityService.getCapabilitiesAccessState(nodeRef, CAPABILITIES); - assertEquals("Incorrect view records capability access", accessStatus[2], access.get(viewRecordsCapability)); - assertEquals("Incorrect edit non record metadata capability access", accessStatus[3], access.get(editNonRecordMetadataCapability)); - assertEquals("Incorrect edit record metadata capability access", accessStatus[4], access.get(editRecordMetadataCapability)); - } - - /** - * Given that a document is created by contributor - * When it is declared as an inplace record - * Then it becomes a record - * And it isn't filed - * And a site collaborator has filling permissions and filling capability on the record - * And a site contributor has filling capability and permissions - * And a site consumer has read permissions and view record capability on the record - * And a user that is not a member of the site has no access to the inplace record - */ - public void testCreateInplaceRecordFromCollabSiteWhenContribIsCreatorOfDocument() - { - test() - - // Given that a document is created by contributor - .given() - .as(dmContributor) - .perform(() -> - { - contribDoc = fileFolderService.create(dmFolder, "contrib.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); - dbNodeService.addAspect(contribDoc, ContentModel.ASPECT_AUDITABLE, null); - }) - .expect(false) - .from(() -> recordService.isRecord(contribDoc)) - .because("It is not a record.") - .asAdmin() - .expect(dmContributor) - .from(() -> ownableService.getOwner(contribDoc)) - .because("As the creator of the document the contributor is also the owner") - .as(dmContributor) - .expect(AccessStatus.ALLOWED.toString()) - .from(() -> permissionService.hasPermission(contribDoc, PermissionService.WRITE).toString()) - .because("Contrib user has write permissions on created document as the owner.") - - // When it is declared as an inplace record - .when() - .as(dmContributor) - .perform(() -> recordService.createRecord(filePlan, contribDoc)) - - .then() - .asAdmin() - // Then it becomes a record - .expect(true) - .from(() -> recordService.isRecord(contribDoc)) - .because("The document is a record") - - // And it isn't filed - .expect(false) - .from(() -> recordService.isFiled(contribDoc)) - .because("The record is not filed") - - // And a site collaborator has filling permissions and filling capability on the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(contribDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has filling capability and permissions - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(contribDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site consumer has read permissions and view record capability on the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(contribDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not a member of the site has no access to the inplace record - .as(userName) - .perform(() -> - checkInPlaceAccess(contribDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an unfiled in-place record - * When the record is moved to the file plan (ie filed) - * Then the site users still have the appropriate in-place permissions on the record - */ - public void testFileInplaceRecordFromCollabSite() throws Exception - { - test() - - // Given an unfiled inplace record - .given() - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("The document is a record.") - .expect(false) - .from(() -> recordService.isFiled(dmDocument)) - .because("The record is not filed") - - // When the record is filed - .when() - .asAdmin() - .perform(() -> fileFolderService.move(dmDocument, rmFolder, null)) - - .then() - - // Then the record is filed - .asAdmin() - .expect(true) - .from(() -> recordService.isFiled(dmDocument)) - .because("The record is filed.") - - // And the collaborator has filling permissions and filling capability on the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has read permissions and view record capability on the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions on the record - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an incomplete inplace record - * When it is completed - * Then the inplace users still have access to the record - * And can't edit the records meta-data - */ - public void testCompletedInPlaceRecord() - { - test() - - // Given an incomplete record - .given() - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(false) - .from(() -> recordService.isDeclared(dmDocument)) - .because("Record is not complete.") - - // When it is completed - .when() - .asAdmin() - .perform(() -> rmActionService.executeRecordsManagementAction(dmDocument, DeclareRecordAction.NAME)) - .expect(true) - .from(() -> recordService.isDeclared(dmDocument)) - .because("Record is complete.") - - .then() - - // Then the collaborator has filling permissions, view record capability, but not edit non-record metadata - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has read permissions and view record capability on the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions on the record - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an inplace record ready for destruction - * When it is destroyed - * And it's metadata is maintained - * Then the inplace users will no longer see the record - */ - // FIXME: See RM-4095 - public void ztestDestroyedRecordInplacePermissions() - { - test() - .given() - - // Given that a record is declared by a collaborator - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("Document is a record.") - - // And it is filed into the file plan - // And eligible for destruction - .asAdmin() - .perform(() -> - { - // create record category and disposition schedule - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(recordCategory, GUID.generate(), GUID.generate(), true, true); - - // create record folder and file record - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - fileFolderService.move(dmDocument, recordFolder, null); - - // cut off record - rmActionService.executeRecordsManagementAction(dmDocument, DeclareRecordAction.NAME); - utils.completeEvent(dmDocument, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(dmDocument, CutOffAction.NAME); - }) - .expect("destroy") - .from(() -> dispositionService.getNextDispositionAction(dmDocument).getName()) - .because("The next action is destroy.") - .expect(true) - .from(() -> dispositionService.isNextDispositionActionEligible(dmDocument)) - .because("The next action is eligible.") - - // When the record is destroyed - .when(() -> rmActionService.executeRecordsManagementAction(dmDocument, DestroyAction.NAME)) - - .then() - .expect(true) - .from(() -> recordService.isMetadataStub(dmDocument)) - .because("The record has been destroyed and the meta-stub remains.") - - // Then the collaborator has no permissions or capabilities - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has no permissions or capabilities - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has no permissions or capabilities - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions or capabilities - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - } - - /** - * Given an inplace record - * And the collaborator has view and edit non-record capability - * And doesn't have edit record capability - * When we add edit record metadata capability to the extended writer role - * Then the collaborator now has edit record metadata capability - */ - public void testAddUserToRole() - { - test() - .given() - .as(dmCollaborator) - - // Given an inplace record - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("Document is a record.") - - // And the collaborator has view and edit non-record capability - // And doesn't have edit record capability - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - .when() - .asAdmin() - - // When we add edit record metadata capability to the extended writer role - .perform(() -> filePlanRoleService.updateRole(filePlan, - FilePlanRoleService.ROLE_EXTENDED_WRITERS, - "", - Stream - .of(viewRecordsCapability, editNonRecordMetadataCapability, editRecordMetadataCapability) - .collect(Collectors.toSet()))) - - .then() - .as(dmCollaborator) - - // Then the collaborator now has edit record metadata capability - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.ALLOWED)) // edit record metadata capability - ; - } - - /** - * Given an inplace record - * When the record is hidden - * Then the collaborator has no access to the record - * And the consumer has no access to the record - * And a user that is not in the site has no permissions or capabilities - */ - public void testNoPermissionsAfterHide() - { - test() - .given() - .as(dmCollaborator) - - // Given an inplace record - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("Document is a record.") - .when() - .asAdmin() - - // When the record is hidden - .perform(() -> inplaceRecordService.hideRecord(dmDocument)) - - .then() - - // Then the collaborator has no access to the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has no access to the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions or capabilities - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - ; - } - - /** - * Given an inplace record - * When the record is rejected - * Then the collaborator has no access to the record - * And the consumer has no access to the record - * And a user that is not in the site has no permissions or capabilities - */ - public void testNoPermissionsAfterReject() - { - test() - .given() - .as(dmCollaborator) - - // Given an inplace record - .perform(() -> recordService.createRecord(filePlan, dmDocument)) - .expect(true) - .from(() -> recordService.isRecord(dmDocument)) - .because("Document is a record.") - .when() - .asAdmin() - - // When the record is rejected - .perform(() -> recordService.rejectRecord(dmDocument, GUID.generate())) - - .then() - - // Then the collaborator has no access to the record - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has read and view - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has no access to the record - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no permissions or capabilities - .as(userName) - .perform(() -> - checkInPlaceAccess(dmDocument, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - ; - } - - /** - * Given a user is the cm:creator of a document - * And the user is deleted - * When the document is declared as a record by a manager - * Then it successfully becomes a record - */ - public void testCmCreatorDeletedBeforeRecordDeclaration() - { - test() - .given() - .asAdmin() - .perform(() -> - { - deletedUser = GUID.generate(); - createPerson(deletedUser); - siteService.setMembership(collabSiteId, deletedUser, SiteModel.SITE_CONTRIBUTOR); - }) - .as(deletedUser) - .perform(() -> - { - deleteUserDoc = fileFolderService.create(dmFolder, "deleteUserDoc.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); - dbNodeService.addAspect(deleteUserDoc, ContentModel.ASPECT_AUDITABLE, null); - }) - .asAdmin() - .perform(() -> personService.deletePerson(deletedUser)) - .when() - .as(dmCollaborator) - .perform(() -> recordService.createRecord(filePlan, deleteUserDoc)) - .then() - .expect(true) - .from(() -> recordService.isRecord(deleteUserDoc)) - .because("The document is now a record.") - ; - } - - /** - * Given a document created by the collaborator - * And declared as a record by the collaborator - * And filed by the records manager - * When the records manager copies the record - * Then the collaborator has no access to the record copy - * And a site contributor has no access to the record copy - * And the consumer has no access to the record copy - * And a user that is not in the site has no access to the record copy - */ - public void testNoPermissionsOnCopy() - { - test() - .given() - .as(dmCollaborator) - .perform(() -> - { - // Given a document created by the collaborator - copiedDoc = fileFolderService.create(dmFolder, "copiedDoc.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); - dbNodeService.addAspect(copiedDoc, ContentModel.ASPECT_AUDITABLE, null); - - // And declared as a record by the collaborator - recordService.createRecord(filePlan, copiedDoc); - }) - .asAdmin() - - // And filed by the records manager - .perform(() -> fileFolderService.move(copiedDoc, rmFolder, null)) - - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(copiedDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - .when() - .asAdmin() - - // When the records manager copies the record - .perform(() -> copyDoc = fileFolderService.copy(copiedDoc, rmFolder, "newRecord.txt").getNodeRef()) - - .then() - - // Then the collaborator has no access to the record copy - .as(dmCollaborator) - .perform(() -> - checkInPlaceAccess(copyDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - .perform(() -> - checkInPlaceAccess(copiedDoc, - AccessStatus.ALLOWED, // read record permission - AccessStatus.ALLOWED, // filing permission - AccessStatus.ALLOWED, // view record capability - AccessStatus.ALLOWED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a site contributor has no access to the record copy - .as(dmContributor) - .perform(() -> - checkInPlaceAccess(copyDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And the consumer has no access to the record copy - .as(dmConsumer) - .perform(() -> - checkInPlaceAccess(copyDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)) // edit record metadata capability - - // And a user that is not in the site has no access to the record copy - .as(userName) - .perform(() -> - checkInPlaceAccess(copyDoc, - AccessStatus.DENIED, // read record permission - AccessStatus.DENIED, // filing permission - AccessStatus.DENIED, // view record capability - AccessStatus.DENIED, // edit non record metadata capability - AccessStatus.DENIED)); // edit record metadata capability - ; - } - - /** - * Test group reuse - */ - public void testGroupReuse() - { - test() - .when() - .as(dmCollaborator) - .perform(50, () -> - { - NodeRef newDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.createRecord(filePlan, newDocument); - }) - .as(dmContributor) - .perform(50, () -> - { - NodeRef newDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.createRecord(filePlan, newDocument); - }) - .then() - .asAdmin() - .expect(101) - .from(() -> nodeService.getChildAssocs(dmFolder).size()) - .because("One hundred inplace records have been created.") - .expect(3) - .from(() -> authorityService.getContainedAuthorities(null, "GROUP_INPLACE_RECORD_MANAGEMENT", true).size()) - .because("The read and write groups are reused."); - ; - } - - /** - * Test tear down - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // clear up groups - authorityService.getContainedAuthorities(null, "GROUP_INPLACE_RECORD_MANAGEMENT", true) - .stream() - .forEach((group) -> authorityService.deleteAuthority(group)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.test; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.util.GUID; + +/** + * In-place record permission integration test. + * + * @author Roy Wetherall + * @since 2.5 + */ +public class InplaceRecordPermissionTest extends BaseRMTestCase +{ + /** capability list */ + private static final List CAPABILITIES = Stream + .of(RMPermissionModel.VIEW_RECORDS, + RMPermissionModel.EDIT_NON_RECORD_METADATA, + RMPermissionModel.EDIT_RECORD_METADATA) + .collect(Collectors.toList()); + + /** test data */ + private NodeRef contribDoc; + private NodeRef deleteUserDoc; + private NodeRef copiedDoc; + private NodeRef copyDoc; + private String deletedUser; + + /** services */ + private NodeService dbNodeService; + + /** capabilities */ + private Capability viewRecordsCapability; + private Capability editNonRecordMetadataCapability; + private Capability editRecordMetadataCapability; + + /** test characteristics */ + @Override protected boolean isCollaborationSiteTest() { return true; } + @Override protected boolean isUserTest() { return true; } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() + */ + @Override + protected void initServices() + { + super.initServices(); + + // initialise behaviour tests + BehaviourTest.initBehaviourTests(retryingTransactionHelper); + + // get services + dbNodeService = (NodeService)applicationContext.getBean("dbNodeService"); + + // get capability references + viewRecordsCapability = capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS); + editNonRecordMetadataCapability = capabilityService.getCapability(RMPermissionModel.EDIT_NON_RECORD_METADATA); + editRecordMetadataCapability = capabilityService.getCapability(RMPermissionModel.EDIT_RECORD_METADATA); + } + + /** + * Given a document in a collaboration site + * When a user without write permissions on the document tries to declare it as a record + * Then the declaration fails + * And the document does not become a record + */ + public void testUserWithOutWriteCantDeclareInPlaceRecord() + { + test() + .given() + + // Given a document in a collaboration site that is not a record + .expect(false) + .from(() -> recordService.isRecord(dmDocument)) + .because("The document is not a record.") + + // And a user with no write permission on the document + .as(userName) + .expect(AccessStatus.DENIED.toString()) + .from(() -> permissionService.hasPermission(dmDocument, PermissionService.WRITE).toString()) + .because("User does not have write access to document.") + + // When the user tries to declare the record + // Then we expect this to fail + .when() + .as(userName) + .expectException(AccessDeniedException.class) + .from(() -> recordService.createRecord(filePlan, dmDocument)) + .because("The user does not have write permission on the document."); + } + + /** + * Given a document in a collaboration site that is not a record + * And a contributor the didn't create the document + * When the contributor tries to declare the document as a record + * Then the document does not become a record + */ + public void testContributorThatIsntOwnerDeclareInPlaceRecord() + { + test() + .given() + + // Given a document in a collaboration site that is not a record + .expect(false) + .from(() -> recordService.isRecord(dmDocument)) + .because("The document is not a record.") + + // And a contributor the didn't create the document + .as(dmContributor) + .expect(AccessStatus.DENIED.toString()) + .from(() -> permissionService.hasPermission(dmDocument, PermissionService.WRITE).toString()) + .because("Contributor does not have write access to document.") + + // When the user tries to declare the record + // When the contributor tries to declare the document as a record + .when() + .as(dmContributor) + .expectException(AccessDeniedException.class) + .from(() -> recordService.createRecord(filePlan, dmDocument)) + .because("The contributor does not have write permission on the document."); + } + + /** + * Given a document in a collaboration site is not a record + * When the document is declared by a site collaborator + * Then the document becomes a record + * And the site users have the appropriate in-place permissions on the record + */ + public void testCreateInplaceRecordFromCollabSite() + { + test() + + // Given that a document in a collaboration site is not a record + .given() + .asAdmin() + .expect(false) + .from(() -> recordService.isRecord(dmDocument)) + .because("The document is not a record") + + // When it is declared as an inplace record + .when() + .as(dmCollaborator) + .perform(() -> recordService.createRecord(filePlan, dmDocument)) + + .then() + .asAdmin() + // Then it becomes a record + .expect(true) + .from(() -> recordService.isRecord(dmDocument)) + .because("The document is a record") + + // And it isn't filed + .expect(false) + .from(() -> recordService.isFiled(dmDocument)) + .because("The record is not filed") + + // And a site collaborator has filling permissions and filling capability on the record + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.ALLOWED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site contributor has read and view + .as(dmContributor) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site consumer has read permissions and view record capability on the record + .as(dmConsumer) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a user that is not a member of the site has no access to the inplace record + .as(userName) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)); // edit record metadata capability + } + + /** + * Helper method to check in place access for a user on a record. + */ + private void checkInPlaceAccess(NodeRef nodeRef, AccessStatus ... accessStatus) + { + // check permission access + assertEquals("Incorrect read record permission access.", accessStatus[0], permissionService.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS)); + assertEquals("Incorrect filling permission access.", accessStatus[1], permissionService.hasPermission(nodeRef, RMPermissionModel.FILING)); + + // check capability access + Map access = capabilityService.getCapabilitiesAccessState(nodeRef, CAPABILITIES); + assertEquals("Incorrect view records capability access", accessStatus[2], access.get(viewRecordsCapability)); + assertEquals("Incorrect edit non record metadata capability access", accessStatus[3], access.get(editNonRecordMetadataCapability)); + assertEquals("Incorrect edit record metadata capability access", accessStatus[4], access.get(editRecordMetadataCapability)); + } + + /** + * Given that a document is created by contributor + * When it is declared as an inplace record + * Then it becomes a record + * And it isn't filed + * And a site collaborator has filling permissions and filling capability on the record + * And a site contributor has filling capability and permissions + * And a site consumer has read permissions and view record capability on the record + * And a user that is not a member of the site has no access to the inplace record + */ + public void testCreateInplaceRecordFromCollabSiteWhenContribIsCreatorOfDocument() + { + test() + + // Given that a document is created by contributor + .given() + .as(dmContributor) + .perform(() -> + { + contribDoc = fileFolderService.create(dmFolder, "contrib.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); + dbNodeService.addAspect(contribDoc, ContentModel.ASPECT_AUDITABLE, null); + }) + .expect(false) + .from(() -> recordService.isRecord(contribDoc)) + .because("It is not a record.") + .asAdmin() + .expect(dmContributor) + .from(() -> ownableService.getOwner(contribDoc)) + .because("As the creator of the document the contributor is also the owner") + .as(dmContributor) + .expect(AccessStatus.ALLOWED.toString()) + .from(() -> permissionService.hasPermission(contribDoc, PermissionService.WRITE).toString()) + .because("Contrib user has write permissions on created document as the owner.") + + // When it is declared as an inplace record + .when() + .as(dmContributor) + .perform(() -> recordService.createRecord(filePlan, contribDoc)) + + .then() + .asAdmin() + // Then it becomes a record + .expect(true) + .from(() -> recordService.isRecord(contribDoc)) + .because("The document is a record") + + // And it isn't filed + .expect(false) + .from(() -> recordService.isFiled(contribDoc)) + .because("The record is not filed") + + // And a site collaborator has filling permissions and filling capability on the record + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(contribDoc, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.ALLOWED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site contributor has filling capability and permissions + .as(dmContributor) + .perform(() -> + checkInPlaceAccess(contribDoc, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.ALLOWED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site consumer has read permissions and view record capability on the record + .as(dmConsumer) + .perform(() -> + checkInPlaceAccess(contribDoc, + AccessStatus.ALLOWED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a user that is not a member of the site has no access to the inplace record + .as(userName) + .perform(() -> + checkInPlaceAccess(contribDoc, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)); // edit record metadata capability + } + + /** + * Given an unfiled in-place record + * When the record is moved to the file plan (ie filed) + * Then the site users still have the appropriate in-place permissions on the record + */ + public void testFileInplaceRecordFromCollabSite() throws Exception + { + test() + + // Given an unfiled inplace record + .given() + .as(dmCollaborator) + .perform(() -> recordService.createRecord(filePlan, dmDocument)) + .expect(true) + .from(() -> recordService.isRecord(dmDocument)) + .because("The document is a record.") + .expect(false) + .from(() -> recordService.isFiled(dmDocument)) + .because("The record is not filed") + + // When the record is filed + .when() + .asAdmin() + .perform(() -> fileFolderService.move(dmDocument, rmFolder, null)) + + .then() + + // Then the record is filed + .asAdmin() + .expect(true) + .from(() -> recordService.isFiled(dmDocument)) + .because("The record is filed.") + + // And the collaborator has filling permissions and filling capability on the record + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.ALLOWED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site contributor has read and view + .as(dmContributor) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And the consumer has read permissions and view record capability on the record + .as(dmConsumer) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a user that is not in the site has no permissions on the record + .as(userName) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)); // edit record metadata capability + } + + /** + * Given an incomplete inplace record + * When it is completed + * Then the inplace users still have access to the record + * And can't edit the records meta-data + */ + public void testCompletedInPlaceRecord() + { + test() + + // Given an incomplete record + .given() + .as(dmCollaborator) + .perform(() -> recordService.createRecord(filePlan, dmDocument)) + .expect(false) + .from(() -> recordService.isDeclared(dmDocument)) + .because("Record is not complete.") + + // When it is completed + .when() + .asAdmin() + .perform(() -> rmActionService.executeRecordsManagementAction(dmDocument, DeclareRecordAction.NAME)) + .expect(true) + .from(() -> recordService.isDeclared(dmDocument)) + .because("Record is complete.") + + .then() + + // Then the collaborator has filling permissions, view record capability, but not edit non-record metadata + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site contributor has read and view + .as(dmContributor) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And the consumer has read permissions and view record capability on the record + .as(dmConsumer) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a user that is not in the site has no permissions on the record + .as(userName) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)); // edit record metadata capability + } + + /** + * Given an inplace record ready for destruction + * When it is destroyed + * And it's metadata is maintained + * Then the inplace users will no longer see the record + */ + // FIXME: See RM-4095 + public void ztestDestroyedRecordInplacePermissions() + { + test() + .given() + + // Given that a record is declared by a collaborator + .as(dmCollaborator) + .perform(() -> recordService.createRecord(filePlan, dmDocument)) + .expect(true) + .from(() -> recordService.isRecord(dmDocument)) + .because("Document is a record.") + + // And it is filed into the file plan + // And eligible for destruction + .asAdmin() + .perform(() -> + { + // create record category and disposition schedule + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createBasicDispositionSchedule(recordCategory, GUID.generate(), GUID.generate(), true, true); + + // create record folder and file record + NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + fileFolderService.move(dmDocument, recordFolder, null); + + // cut off record + rmActionService.executeRecordsManagementAction(dmDocument, DeclareRecordAction.NAME); + utils.completeEvent(dmDocument, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(dmDocument, CutOffAction.NAME); + }) + .expect("destroy") + .from(() -> dispositionService.getNextDispositionAction(dmDocument).getName()) + .because("The next action is destroy.") + .expect(true) + .from(() -> dispositionService.isNextDispositionActionEligible(dmDocument)) + .because("The next action is eligible.") + + // When the record is destroyed + .when(() -> rmActionService.executeRecordsManagementAction(dmDocument, DestroyAction.NAME)) + + .then() + .expect(true) + .from(() -> recordService.isMetadataStub(dmDocument)) + .because("The record has been destroyed and the meta-stub remains.") + + // Then the collaborator has no permissions or capabilities + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site contributor has no permissions or capabilities + .as(dmContributor) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And the consumer has no permissions or capabilities + .as(dmConsumer) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a user that is not in the site has no permissions or capabilities + .as(userName) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)); // edit record metadata capability + } + + /** + * Given an inplace record + * And the collaborator has view and edit non-record capability + * And doesn't have edit record capability + * When we add edit record metadata capability to the extended writer role + * Then the collaborator now has edit record metadata capability + */ + public void testAddUserToRole() + { + test() + .given() + .as(dmCollaborator) + + // Given an inplace record + .perform(() -> recordService.createRecord(filePlan, dmDocument)) + .expect(true) + .from(() -> recordService.isRecord(dmDocument)) + .because("Document is a record.") + + // And the collaborator has view and edit non-record capability + // And doesn't have edit record capability + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.ALLOWED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + .when() + .asAdmin() + + // When we add edit record metadata capability to the extended writer role + .perform(() -> filePlanRoleService.updateRole(filePlan, + FilePlanRoleService.ROLE_EXTENDED_WRITERS, + "", + Stream + .of(viewRecordsCapability, editNonRecordMetadataCapability, editRecordMetadataCapability) + .collect(Collectors.toSet()))) + + .then() + .as(dmCollaborator) + + // Then the collaborator now has edit record metadata capability + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.ALLOWED, // edit non record metadata capability + AccessStatus.ALLOWED)) // edit record metadata capability + ; + } + + /** + * Given an inplace record + * When the record is hidden + * Then the collaborator has no access to the record + * And the consumer has no access to the record + * And a user that is not in the site has no permissions or capabilities + */ + public void testNoPermissionsAfterHide() + { + test() + .given() + .as(dmCollaborator) + + // Given an inplace record + .perform(() -> recordService.createRecord(filePlan, dmDocument)) + .expect(true) + .from(() -> recordService.isRecord(dmDocument)) + .because("Document is a record.") + .when() + .asAdmin() + + // When the record is hidden + .perform(() -> inplaceRecordService.hideRecord(dmDocument)) + + .then() + + // Then the collaborator has no access to the record + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site contributor has read and view + .as(dmContributor) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And the consumer has no access to the record + .as(dmConsumer) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a user that is not in the site has no permissions or capabilities + .as(userName) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)); // edit record metadata capability + ; + } + + /** + * Given an inplace record + * When the record is rejected + * Then the collaborator has no access to the record + * And the consumer has no access to the record + * And a user that is not in the site has no permissions or capabilities + */ + public void testNoPermissionsAfterReject() + { + test() + .given() + .as(dmCollaborator) + + // Given an inplace record + .perform(() -> recordService.createRecord(filePlan, dmDocument)) + .expect(true) + .from(() -> recordService.isRecord(dmDocument)) + .because("Document is a record.") + .when() + .asAdmin() + + // When the record is rejected + .perform(() -> recordService.rejectRecord(dmDocument, GUID.generate())) + + .then() + + // Then the collaborator has no access to the record + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site contributor has read and view + .as(dmContributor) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And the consumer has no access to the record + .as(dmConsumer) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a user that is not in the site has no permissions or capabilities + .as(userName) + .perform(() -> + checkInPlaceAccess(dmDocument, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)); // edit record metadata capability + ; + } + + /** + * Given a user is the cm:creator of a document + * And the user is deleted + * When the document is declared as a record by a manager + * Then it successfully becomes a record + */ + public void testCmCreatorDeletedBeforeRecordDeclaration() + { + test() + .given() + .asAdmin() + .perform(() -> + { + deletedUser = GUID.generate(); + createPerson(deletedUser); + siteService.setMembership(collabSiteId, deletedUser, SiteModel.SITE_CONTRIBUTOR); + }) + .as(deletedUser) + .perform(() -> + { + deleteUserDoc = fileFolderService.create(dmFolder, "deleteUserDoc.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); + dbNodeService.addAspect(deleteUserDoc, ContentModel.ASPECT_AUDITABLE, null); + }) + .asAdmin() + .perform(() -> personService.deletePerson(deletedUser)) + .when() + .as(dmCollaborator) + .perform(() -> recordService.createRecord(filePlan, deleteUserDoc)) + .then() + .expect(true) + .from(() -> recordService.isRecord(deleteUserDoc)) + .because("The document is now a record.") + ; + } + + /** + * Given a document created by the collaborator + * And declared as a record by the collaborator + * And filed by the records manager + * When the records manager copies the record + * Then the collaborator has no access to the record copy + * And a site contributor has no access to the record copy + * And the consumer has no access to the record copy + * And a user that is not in the site has no access to the record copy + */ + public void testNoPermissionsOnCopy() + { + test() + .given() + .as(dmCollaborator) + .perform(() -> + { + // Given a document created by the collaborator + copiedDoc = fileFolderService.create(dmFolder, "copiedDoc.txt" , ContentModel.TYPE_CONTENT).getNodeRef(); + dbNodeService.addAspect(copiedDoc, ContentModel.ASPECT_AUDITABLE, null); + + // And declared as a record by the collaborator + recordService.createRecord(filePlan, copiedDoc); + }) + .asAdmin() + + // And filed by the records manager + .perform(() -> fileFolderService.move(copiedDoc, rmFolder, null)) + + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(copiedDoc, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.ALLOWED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + .when() + .asAdmin() + + // When the records manager copies the record + .perform(() -> copyDoc = fileFolderService.copy(copiedDoc, rmFolder, "newRecord.txt").getNodeRef()) + + .then() + + // Then the collaborator has no access to the record copy + .as(dmCollaborator) + .perform(() -> + checkInPlaceAccess(copyDoc, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + .perform(() -> + checkInPlaceAccess(copiedDoc, + AccessStatus.ALLOWED, // read record permission + AccessStatus.ALLOWED, // filing permission + AccessStatus.ALLOWED, // view record capability + AccessStatus.ALLOWED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a site contributor has no access to the record copy + .as(dmContributor) + .perform(() -> + checkInPlaceAccess(copyDoc, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And the consumer has no access to the record copy + .as(dmConsumer) + .perform(() -> + checkInPlaceAccess(copyDoc, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)) // edit record metadata capability + + // And a user that is not in the site has no access to the record copy + .as(userName) + .perform(() -> + checkInPlaceAccess(copyDoc, + AccessStatus.DENIED, // read record permission + AccessStatus.DENIED, // filing permission + AccessStatus.DENIED, // view record capability + AccessStatus.DENIED, // edit non record metadata capability + AccessStatus.DENIED)); // edit record metadata capability + ; + } + + /** + * Test group reuse + */ + public void testGroupReuse() + { + test() + .when() + .as(dmCollaborator) + .perform(50, () -> + { + NodeRef newDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + recordService.createRecord(filePlan, newDocument); + }) + .as(dmContributor) + .perform(50, () -> + { + NodeRef newDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + recordService.createRecord(filePlan, newDocument); + }) + .then() + .asAdmin() + .expect(101) + .from(() -> nodeService.getChildAssocs(dmFolder).size()) + .because("One hundred inplace records have been created.") + .expect(3) + .from(() -> authorityService.getContainedAuthorities(null, "GROUP_INPLACE_RECORD_MANAGEMENT", true).size()) + .because("The read and write groups are reused."); + ; + } + + /** + * Test tear down + */ + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + + // clear up groups + authorityService.getContainedAuthorities(null, "GROUP_INPLACE_RECORD_MANAGEMENT", true) + .stream() + .forEach((group) -> authorityService.deleteAuthority(group)); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java index d1b1562319..b641134ed5 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java @@ -1,165 +1,165 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Link/Unlink Record Tests - * - * @author Roy Wetherall - * @since 2.3 - */ -public class LinkRecordTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected void initServices() - { - super.initServices(); - } - - /** - * Given source and destination disposition schedules are compatible - * When I link a record to the record folder - * Then it is successful - */ - public void testLinkWithCompatibleDispositionSchedules() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef myRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - myRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - - // create disposition schedules on record folders - utils.createBasicDispositionSchedule( - sourceRecordCategory, - "disposition instructions", - "disposition authority", - false, - true); - utils.createBasicDispositionSchedule( - targetRecordCategory, - "disposition instructions", - "disposition authority", - false, - true); - } - - public void when() throws Exception - { - // link the record into the record folder - recordService.link(myRecord, targetRecordFolder); - } - - public void then() throws Exception - { - // assert that the record now has two parents - List assocs = nodeService.getParentAssocs(myRecord); - assertNotNull(assocs); - assertEquals(2, assocs.size()); - } - }); - } - - /** - * Given source and destination disposition schedules are incompatible - * When I link a record to the record folder - * Then it is fails - */ - public void testLinkWithIncompatibleDispositionSchedules() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class) - { - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef myRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - myRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - - // create disposition schedules on record folders - utils.createBasicDispositionSchedule( - sourceRecordCategory, - "disposition instructions", - "disposition authority", - false, - true); - utils.createBasicDispositionSchedule( - targetRecordCategory, - "disposition instructions", - "disposition authority", - true, - true); - } - - public void when() throws Exception - { - // link the record into the record folder - recordService.link(myRecord, targetRecordFolder); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.GUID; + +/** + * Link/Unlink Record Tests + * + * @author Roy Wetherall + * @since 2.3 + */ +public class LinkRecordTest extends BaseRMTestCase +{ + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected void initServices() + { + super.initServices(); + } + + /** + * Given source and destination disposition schedules are compatible + * When I link a record to the record folder + * Then it is successful + */ + public void testLinkWithCompatibleDispositionSchedules() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef sourceRecordCategory; + private NodeRef targetRecordCategory; + private NodeRef sourceRecordFolder; + private NodeRef targetRecordFolder; + private NodeRef myRecord; + + public void given() throws Exception + { + // test entities + sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); + myRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); + targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); + + // create disposition schedules on record folders + utils.createBasicDispositionSchedule( + sourceRecordCategory, + "disposition instructions", + "disposition authority", + false, + true); + utils.createBasicDispositionSchedule( + targetRecordCategory, + "disposition instructions", + "disposition authority", + false, + true); + } + + public void when() throws Exception + { + // link the record into the record folder + recordService.link(myRecord, targetRecordFolder); + } + + public void then() throws Exception + { + // assert that the record now has two parents + List assocs = nodeService.getParentAssocs(myRecord); + assertNotNull(assocs); + assertEquals(2, assocs.size()); + } + }); + } + + /** + * Given source and destination disposition schedules are incompatible + * When I link a record to the record folder + * Then it is fails + */ + public void testLinkWithIncompatibleDispositionSchedules() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class) + { + private NodeRef sourceRecordCategory; + private NodeRef targetRecordCategory; + private NodeRef sourceRecordFolder; + private NodeRef targetRecordFolder; + private NodeRef myRecord; + + public void given() throws Exception + { + // test entities + sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); + myRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); + targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); + + // create disposition schedules on record folders + utils.createBasicDispositionSchedule( + sourceRecordCategory, + "disposition instructions", + "disposition authority", + false, + true); + utils.createBasicDispositionSchedule( + targetRecordCategory, + "disposition instructions", + "disposition authority", + true, + true); + } + + public void when() throws Exception + { + // link the record into the record folder + recordService.link(myRecord, targetRecordFolder); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java index bee09d18df..2228b96ab3 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java @@ -1,156 +1,156 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import static org.apache.commons.collections.ListUtils.removeAll; - -import java.util.List; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -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; - -/** - * Move Inplace Record Test - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class MoveInplaceRecordTest extends BaseRMTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * Tests moving inplace records - */ - public void testMoveInplaceRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - // The destination folder in collaboration site - private NodeRef destinationDmFolder; - - // Extended Readers/Writers - private Set extendedReadersBeforeMove; - private Set extendedWritersBeforeMove; - - // primary parent of record - private NodeRef primaryParentBeforeMove; - - public void given() - { - // Create the destination folder - destinationDmFolder = fileFolderService.create(documentLibrary, "destinationCollabFolder", ContentModel.TYPE_FOLDER).getNodeRef(); - - // Check that the document is not a record - assertFalse(recordService.isRecord(dmDocument)); - - // Declare the document as a record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Declare record - recordService.createRecord(filePlan, dmDocument); - - return null; - } - }, dmCollaborator); - - // Check that the document is a record now - assertTrue(recordService.isRecord(dmDocument)); - - extendedReadersBeforeMove = extendedSecurityService.getReaders(dmDocument); - extendedWritersBeforeMove = extendedSecurityService.getWriters(dmDocument); - - // get the primary parent and assert that it's a record management artifact - primaryParentBeforeMove = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertTrue("Primary parent of newly created should be a records management artifact.", - filePlanService.isFilePlanComponent(primaryParentBeforeMove)); - - } - - public void when() - { - // Move the document - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Move record - inplaceRecordService.moveRecord(dmDocument, destinationDmFolder); - - return null; - } - }, dmCollaborator); - } - - public void then() - { - // assert that the document is still a record - assertTrue("After move the document should still be a record.", - recordService.isRecord(dmDocument)); - - // Check that the source folder is empty now and the destination folder has the document - assertEquals(0, nodeService.getChildAssocs(dmFolder).size()); - List destinationFolderChildAssocs = nodeService.getChildAssocs(destinationDmFolder); - assertEquals(1, destinationFolderChildAssocs.size()); - assertEquals(dmDocument, destinationFolderChildAssocs.get(0).getChildRef()); - - // Check that the primary parent of the record has remained unchanged - NodeRef primaryParentAfterMove = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertTrue("Primary parent of record after inplace move should be a records management artifact.", - filePlanService.isFilePlanComponent(primaryParentAfterMove)); - assertEquals("Primary parent of record after inplace move should remain the same.", - primaryParentBeforeMove, - primaryParentAfterMove); - - // Check extended readers/writers - Set extendedReadersAfterMove = extendedSecurityService.getReaders(dmDocument); - Set extendedWritersAfterMove = extendedSecurityService.getWriters(dmDocument); - - assertEquals(extendedReadersBeforeMove.size(), extendedReadersAfterMove.size()); - assertEquals(extendedWritersBeforeMove.size(), extendedWritersAfterMove.size()); - - assertEquals(0, removeAll(extendedReadersBeforeMove, extendedReadersAfterMove).size()); - assertEquals(0, removeAll(extendedWritersBeforeMove, extendedWritersAfterMove).size()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import static org.apache.commons.collections.ListUtils.removeAll; + +import java.util.List; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +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; + +/** + * Move Inplace Record Test + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class MoveInplaceRecordTest extends BaseRMTestCase +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** + * Tests moving inplace records + */ + public void testMoveInplaceRecord() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + // The destination folder in collaboration site + private NodeRef destinationDmFolder; + + // Extended Readers/Writers + private Set extendedReadersBeforeMove; + private Set extendedWritersBeforeMove; + + // primary parent of record + private NodeRef primaryParentBeforeMove; + + public void given() + { + // Create the destination folder + destinationDmFolder = fileFolderService.create(documentLibrary, "destinationCollabFolder", ContentModel.TYPE_FOLDER).getNodeRef(); + + // Check that the document is not a record + assertFalse(recordService.isRecord(dmDocument)); + + // Declare the document as a record + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // Declare record + recordService.createRecord(filePlan, dmDocument); + + return null; + } + }, dmCollaborator); + + // Check that the document is a record now + assertTrue(recordService.isRecord(dmDocument)); + + extendedReadersBeforeMove = extendedSecurityService.getReaders(dmDocument); + extendedWritersBeforeMove = extendedSecurityService.getWriters(dmDocument); + + // get the primary parent and assert that it's a record management artifact + primaryParentBeforeMove = nodeService.getPrimaryParent(dmDocument).getParentRef(); + assertTrue("Primary parent of newly created should be a records management artifact.", + filePlanService.isFilePlanComponent(primaryParentBeforeMove)); + + } + + public void when() + { + // Move the document + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // Move record + inplaceRecordService.moveRecord(dmDocument, destinationDmFolder); + + return null; + } + }, dmCollaborator); + } + + public void then() + { + // assert that the document is still a record + assertTrue("After move the document should still be a record.", + recordService.isRecord(dmDocument)); + + // Check that the source folder is empty now and the destination folder has the document + assertEquals(0, nodeService.getChildAssocs(dmFolder).size()); + List destinationFolderChildAssocs = nodeService.getChildAssocs(destinationDmFolder); + assertEquals(1, destinationFolderChildAssocs.size()); + assertEquals(dmDocument, destinationFolderChildAssocs.get(0).getChildRef()); + + // Check that the primary parent of the record has remained unchanged + NodeRef primaryParentAfterMove = nodeService.getPrimaryParent(dmDocument).getParentRef(); + assertTrue("Primary parent of record after inplace move should be a records management artifact.", + filePlanService.isFilePlanComponent(primaryParentAfterMove)); + assertEquals("Primary parent of record after inplace move should remain the same.", + primaryParentBeforeMove, + primaryParentAfterMove); + + // Check extended readers/writers + Set extendedReadersAfterMove = extendedSecurityService.getReaders(dmDocument); + Set extendedWritersAfterMove = extendedSecurityService.getWriters(dmDocument); + + assertEquals(extendedReadersBeforeMove.size(), extendedReadersAfterMove.size()); + assertEquals(extendedWritersBeforeMove.size(), extendedWritersAfterMove.size()); + + assertEquals(0, removeAll(extendedReadersBeforeMove, extendedReadersAfterMove).size()); + assertEquals(0, removeAll(extendedWritersBeforeMove, extendedWritersAfterMove).size()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveRecordTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveRecordTest.java index b6e945d771..d8bbe8f18e 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveRecordTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveRecordTest.java @@ -1,350 +1,350 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.GUID; - -/** - * Move record tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -@SuppressWarnings("unchecked") -public class MoveRecordTest extends BaseRMTestCase -{ - private static final String OTHER_EVENT = "abolished"; - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * Given a record is filed in a event disposition and moved then the - * record no longer has any disposition. - * - * @see https://issues.alfresco.com/jira/browse/RM-1540 - */ - public void testMoveRecordEventDispositinoToNoDisposition() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef sourceCategory; - NodeRef sourceRecordFolder; - NodeRef destinationCategory; - NodeRef destinationRecordFolder; - NodeRef record; - - public void given() - { - // create test data - sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); - destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());; - destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); - - // create record - record = utils.createRecord(sourceRecordFolder, GUID.generate()); - - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNull(dispositionAction.getAsOfDate()); - assertFalse(dispositionService.isNextDispositionActionEligible(record)); - assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - } - - public void when() throws Exception - { - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // move record - fileFolderService.move(record, destinationRecordFolder, null); - } - - public void then() - { - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - assertNull(dispositionService.getNextDispositionAction(record)); - - // check the search aspect properties - assertFalse(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - - } - }); - } - - /** - * Given a record in a event disposition, when it moved to another event disposition then the record should have the - * new events, rather than the old ones. - */ - public void testMoveRecordEventDisToEventDis() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef sourceCategory; - NodeRef sourceRecordFolder; - NodeRef destinationCategory; - NodeRef destinationRecordFolder; - NodeRef record; - - public void given() - { - // create test data - sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); - - destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createDispositionSchedule(destinationCategory, GUID.generate(), GUID.generate(), true, true, false, OTHER_EVENT); - destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); - - // create record - record = utils.createRecord(sourceRecordFolder, GUID.generate()); - - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNull(dispositionAction.getAsOfDate()); - assertFalse(dispositionService.isNextDispositionActionEligible(record)); - assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - assertNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); - } - - public void when() throws Exception - { - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // move record - fileFolderService.move(record, destinationRecordFolder, null); - } - - public void then() - { - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNull(dispositionAction.getAsOfDate()); - assertFalse(dispositionService.isNextDispositionActionEligible(record)); - assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - assertNotNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); - - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(OTHER_EVENT)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_INSTRUCTIONS)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_AUTHORITY)); - assertTrue((Boolean)nodeService.getProperty(record, PROP_RS_HAS_DISPOITION_SCHEDULE)); - } - }); - - } - - /** - * Given a record in a event disposition, when it moved to a time disposition then the record should have the correct as of - * date and no longer have the events. - */ - public void testMoveRecordEventDisToTimeDis() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef sourceCategory; - NodeRef sourceRecordFolder; - NodeRef destinationCategory; - NodeRef destinationRecordFolder; - NodeRef record; - - public void given() - { - // create test data - sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); - - destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - DispositionSchedule dis = utils.createBasicDispositionSchedule(destinationCategory, GUID.generate(), GUID.generate(), true, false); - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dis, adParams); - destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); - - // create record - record = utils.createRecord(sourceRecordFolder, GUID.generate()); - - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNull(dispositionAction.getAsOfDate()); - assertFalse(dispositionService.isNextDispositionActionEligible(record)); - assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - assertNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); - } - - public void when() throws Exception - { - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // move record - fileFolderService.move(record, destinationRecordFolder, null); - } - - public void then() - { - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // check the search aspect details - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertNull(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS))); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_INSTRUCTIONS)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_AUTHORITY)); - assertTrue((Boolean)nodeService.getProperty(record, PROP_RS_HAS_DISPOITION_SCHEDULE)); - } - }); - } - - /** - * See https://issues.alfresco.com/jira/browse/RM-1502 - */ - public void testMoveDMtoRM() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - NodeRef destinationCategory; - NodeRef destinationRecordFolder; - - public void given() - { - // destination category - destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - DispositionSchedule dis = utils.createBasicDispositionSchedule(destinationCategory, GUID.generate(), GUID.generate(), true, false); - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dis, adParams); - destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); - } - - public void when() throws Exception - { - // move document to record folder - fileFolderService.move(dmDocument, destinationRecordFolder, null); - } - - public void then() - { - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(dmDocument, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(dmDocument); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(dmDocument)); - assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); - - // check the search aspect details - assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_ACTION_AS_OF)); - assertNull(((List)nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_EVENTS))); - assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOITION_INSTRUCTIONS)); - assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOITION_AUTHORITY)); - assertTrue((Boolean)nodeService.getProperty(dmDocument, PROP_RS_HAS_DISPOITION_SCHEDULE)); - } - }); - } - - // TODO moveRecordNoDisToEventDis - // TODO moveRecordRecordDisToFolderDis -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.GUID; + +/** + * Move record tests. + * + * @author Roy Wetherall + * @since 2.2 + */ +@SuppressWarnings("unchecked") +public class MoveRecordTest extends BaseRMTestCase +{ + private static final String OTHER_EVENT = "abolished"; + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** + * Given a record is filed in a event disposition and moved then the + * record no longer has any disposition. + * + * @see https://issues.alfresco.com/jira/browse/RM-1540 + */ + public void testMoveRecordEventDispositinoToNoDisposition() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef sourceCategory; + NodeRef sourceRecordFolder; + NodeRef destinationCategory; + NodeRef destinationRecordFolder; + NodeRef record; + + public void given() + { + // create test data + sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); + destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());; + destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); + + // create record + record = utils.createRecord(sourceRecordFolder, GUID.generate()); + + // check for the lifecycle aspect + assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNull(dispositionAction.getAsOfDate()); + assertFalse(dispositionService.isNextDispositionActionEligible(record)); + assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + } + + public void when() throws Exception + { + // check the search aspect details + assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); + assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + + // move record + fileFolderService.move(record, destinationRecordFolder, null); + } + + public void then() + { + // check for the lifecycle aspect + assertFalse(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + assertNull(dispositionService.getNextDispositionAction(record)); + + // check the search aspect properties + assertFalse(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); + + } + }); + } + + /** + * Given a record in a event disposition, when it moved to another event disposition then the record should have the + * new events, rather than the old ones. + */ + public void testMoveRecordEventDisToEventDis() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef sourceCategory; + NodeRef sourceRecordFolder; + NodeRef destinationCategory; + NodeRef destinationRecordFolder; + NodeRef record; + + public void given() + { + // create test data + sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); + + destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createDispositionSchedule(destinationCategory, GUID.generate(), GUID.generate(), true, true, false, OTHER_EVENT); + destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); + + // create record + record = utils.createRecord(sourceRecordFolder, GUID.generate()); + + // check for the lifecycle aspect + assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNull(dispositionAction.getAsOfDate()); + assertFalse(dispositionService.isNextDispositionActionEligible(record)); + assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + assertNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); + } + + public void when() throws Exception + { + // check the search aspect details + assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); + assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + + // move record + fileFolderService.move(record, destinationRecordFolder, null); + } + + public void then() + { + // check for the lifecycle aspect + assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNull(dispositionAction.getAsOfDate()); + assertFalse(dispositionService.isNextDispositionActionEligible(record)); + assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + assertNotNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); + + // check the search aspect details + assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); + assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(OTHER_EVENT)); + assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_INSTRUCTIONS)); + assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_AUTHORITY)); + assertTrue((Boolean)nodeService.getProperty(record, PROP_RS_HAS_DISPOITION_SCHEDULE)); + } + }); + + } + + /** + * Given a record in a event disposition, when it moved to a time disposition then the record should have the correct as of + * date and no longer have the events. + */ + public void testMoveRecordEventDisToTimeDis() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef sourceCategory; + NodeRef sourceRecordFolder; + NodeRef destinationCategory; + NodeRef destinationRecordFolder; + NodeRef record; + + public void given() + { + // create test data + sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, true); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); + + destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + DispositionSchedule dis = utils.createBasicDispositionSchedule(destinationCategory, GUID.generate(), GUID.generate(), true, false); + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); + adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); + dispositionService.addDispositionActionDefinition(dis, adParams); + destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); + + // create record + record = utils.createRecord(sourceRecordFolder, GUID.generate()); + + // check for the lifecycle aspect + assertFalse(nodeService.hasAspect(sourceRecordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNull(dispositionAction.getAsOfDate()); + assertFalse(dispositionService.isNextDispositionActionEligible(record)); + assertNotNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + assertNull(dispositionAction.getEventCompletionDetails(OTHER_EVENT)); + } + + public void when() throws Exception + { + // check the search aspect details + assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); + assertTrue(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + + // move record + fileFolderService.move(record, destinationRecordFolder, null); + } + + public void then() + { + // check for the lifecycle aspect + assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNotNull(dispositionAction.getAsOfDate()); + assertTrue(dispositionService.isNextDispositionActionEligible(record)); + assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + + // check the search aspect details + assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); + assertNull(((List)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS))); + assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_INSTRUCTIONS)); + assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_AUTHORITY)); + assertTrue((Boolean)nodeService.getProperty(record, PROP_RS_HAS_DISPOITION_SCHEDULE)); + } + }); + } + + /** + * See https://issues.alfresco.com/jira/browse/RM-1502 + */ + public void testMoveDMtoRM() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef destinationCategory; + NodeRef destinationRecordFolder; + + public void given() + { + // destination category + destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + DispositionSchedule dis = utils.createBasicDispositionSchedule(destinationCategory, GUID.generate(), GUID.generate(), true, false); + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); + adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); + dispositionService.addDispositionActionDefinition(dis, adParams); + destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate()); + } + + public void when() throws Exception + { + // move document to record folder + fileFolderService.move(dmDocument, destinationRecordFolder, null); + } + + public void then() + { + // check for the lifecycle aspect + assertTrue(nodeService.hasAspect(dmDocument, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(dmDocument); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNotNull(dispositionAction.getAsOfDate()); + assertTrue(dispositionService.isNextDispositionActionEligible(dmDocument)); + assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME)); + + // check the search aspect details + assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_ACTION_AS_OF)); + assertNull(((List)nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_EVENTS))); + assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOITION_INSTRUCTIONS)); + assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOITION_AUTHORITY)); + assertTrue((Boolean)nodeService.getProperty(dmDocument, PROP_RS_HAS_DISPOITION_SCHEDULE)); + } + }); + } + + // TODO moveRecordNoDisToEventDis + // TODO moveRecordRecordDisToFolderDis +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java index 2a0863b869..a6fc44424c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java @@ -1,302 +1,302 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_FILE_PLAN; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; -import static org.alfresco.service.cmr.version.VersionType.MINOR; -import static org.springframework.extensions.webscripts.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.coci.CheckOutCheckInService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.util.PropertyMap; -import org.springframework.extensions.surf.util.I18NUtil; -import org.springframework.extensions.webscripts.GUID; - -/** - * reject record tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RejectRecordTest extends BaseRMTestCase -{ - private VersionService versionService; - private CheckOutCheckInService checkOutCheckInService; - - private static final String REASON = GUID.generate(); - private static final String FINAL_VERSION = "rm.service.final-version"; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected void initServices() - { - super.initServices(); - - versionService = (VersionService) applicationContext.getBean("VersionService"); - checkOutCheckInService = (CheckOutCheckInService) applicationContext.getBean("CheckOutCheckInService"); - } - - /** - * - */ - public void testRejectedRecordInCorrectState() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - assertFalse(recordService.isRecord(dmDocument)); - ownableService.setOwner(dmDocument, userName); - - // document is declared as a record by user - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // declare record - recordService.createRecord(filePlan, dmDocument); - return null; - } - }, userName); - } - - public void when() - { - // sanity checks - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(permissionService.getInheritParentPermissions(dmDocument)); - - // reject record - recordService.rejectRecord(dmDocument, REASON); - } - - public void then() - { - // document is no longer a record - assertFalse(recordService.isRecord(dmDocument)); - - // expected owner has be re-set - assertEquals(userName, ownableService.getOwner(dmDocument)); - assertTrue(permissionService.getInheritParentPermissions(dmDocument)); - assertFalse(nodeService.hasAspect(dmDocument, ASPECT_FILE_PLAN_COMPONENT)); - } - }); - } - - /** - * - */ - public void testRevertAfterReject() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef document; - - public void given() - { - NodeRef folder = fileFolderService.create(documentLibrary, GUID.generate(), TYPE_FOLDER).getNodeRef(); - document = fileFolderService.create(folder, GUID.generate(), TYPE_CONTENT).getNodeRef(); - - assertFalse(recordService.isRecord(document)); - ownableService.setOwner(document, userName); - versionService.ensureVersioningEnabled(document, null); - - // document is declared as a record by user - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // declare record - recordService.createRecord(filePlan, document); - return null; - } - }, userName); - - assertTrue(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); - } - - public void when() - { - // reject the record - recordService.rejectRecord(document, REASON); - assertFalse(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); - - // upload a new version of the document - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - ContentWriter writer = contentService.getWriter(document, ContentModel.PROP_CONTENT, true); - writer.putContent("This is a change to the content and should force a new version"); - versionService.createVersion(document, null); - - return null; - } - }, userName); - - assertFalse(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); - - VersionHistory history = versionService.getVersionHistory(document); - assertEquals(2, history.getAllVersions().size()); - final Version initial = history.getRootVersion(); - - assertFalse(nodeService.hasAspect(initial.getFrozenStateNodeRef(), ASPECT_FILE_PLAN_COMPONENT)); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // revert the document to a previous version - versionService.revert(document, initial); - - return null; - } - }, userName); - } - - public void then() - { - // document is no longer a record - assertFalse(recordService.isRecord(document)); - - // expected owner has be re-set - assertEquals(userName, ownableService.getOwner(document)); - } - }); - } - - public void testRelationshipAfterRevertingRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - // Test document - private NodeRef document; - - public void given() - { - // Create a test document - NodeRef folder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); - document = fileFolderService.create(folder, generate(), TYPE_CONTENT).getNodeRef(); - - // Set Auto-Declare Versions to "For all major and minor versions" - PropertyMap recordableVersionProperties = new PropertyMap(2); - recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); - nodeService.addAspect(document, ASPECT_VERSIONABLE, recordableVersionProperties); - - // Upload New Version - document = checkOutCheckInService.checkout(document); - Map props = new HashMap(2); - props.put(Version.PROP_DESCRIPTION, generate()); - props.put(VersionModel.PROP_VERSION_TYPE, MINOR); - document = checkOutCheckInService.checkin(document, props); - - // Check the declared version - List childAssocs = nodeService.getChildAssocs(unfiledContainer); - assertEquals(1, childAssocs.size()); - - // Declare document as record - recordService.createRecord(filePlan, document); - - // Check the declared versions - childAssocs = nodeService.getChildAssocs(unfiledContainer); - assertEquals(2, childAssocs.size()); - - // Check that the document is a file plan component - assertTrue(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); - - // Get the final version - NodeRef finalVersion = null; - for (ChildAssociationRef childAssociationRef : nodeService.getChildAssocs(unfiledContainer)) - { - NodeRef childRef = childAssociationRef.getChildRef(); - String label = (String) nodeService.getProperty(document, RecordableVersionModel.PROP_VERSION_LABEL); - - if (label.equals(I18NUtil.getMessage(FINAL_VERSION))) - { - finalVersion = childRef; - break; - } - } - - // The final version should be the declared record - assertEquals(document, finalVersion); - - // Check the relationship - Set relationships = relationshipService.getRelationshipsFrom(document); - assertEquals(1, relationships.size()); - Relationship relationship = relationships.iterator().next(); - assertEquals(CUSTOM_REF_VERSIONS.getLocalName(), relationship.getUniqueName()); - } - - public void when() - { - // Reject record - recordService.rejectRecord(document, generate()); - } - - public void then() - { - // Check the relationship - Set relationships = relationshipService.getRelationshipsFrom(document); - assertEquals(0, relationships.size()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_FILE_PLAN; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; +import static org.alfresco.service.cmr.version.VersionType.MINOR; +import static org.springframework.extensions.webscripts.GUID.generate; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.version.VersionModel; +import org.alfresco.service.cmr.coci.CheckOutCheckInService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionHistory; +import org.alfresco.service.cmr.version.VersionService; +import org.alfresco.util.PropertyMap; +import org.springframework.extensions.surf.util.I18NUtil; +import org.springframework.extensions.webscripts.GUID; + +/** + * reject record tests. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RejectRecordTest extends BaseRMTestCase +{ + private VersionService versionService; + private CheckOutCheckInService checkOutCheckInService; + + private static final String REASON = GUID.generate(); + private static final String FINAL_VERSION = "rm.service.final-version"; + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected void initServices() + { + super.initServices(); + + versionService = (VersionService) applicationContext.getBean("VersionService"); + checkOutCheckInService = (CheckOutCheckInService) applicationContext.getBean("CheckOutCheckInService"); + } + + /** + * + */ + public void testRejectedRecordInCorrectState() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + public void given() + { + assertFalse(recordService.isRecord(dmDocument)); + ownableService.setOwner(dmDocument, userName); + + // document is declared as a record by user + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // declare record + recordService.createRecord(filePlan, dmDocument); + return null; + } + }, userName); + } + + public void when() + { + // sanity checks + assertTrue(recordService.isRecord(dmDocument)); + assertTrue(permissionService.getInheritParentPermissions(dmDocument)); + + // reject record + recordService.rejectRecord(dmDocument, REASON); + } + + public void then() + { + // document is no longer a record + assertFalse(recordService.isRecord(dmDocument)); + + // expected owner has be re-set + assertEquals(userName, ownableService.getOwner(dmDocument)); + assertTrue(permissionService.getInheritParentPermissions(dmDocument)); + assertFalse(nodeService.hasAspect(dmDocument, ASPECT_FILE_PLAN_COMPONENT)); + } + }); + } + + /** + * + */ + public void testRevertAfterReject() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef document; + + public void given() + { + NodeRef folder = fileFolderService.create(documentLibrary, GUID.generate(), TYPE_FOLDER).getNodeRef(); + document = fileFolderService.create(folder, GUID.generate(), TYPE_CONTENT).getNodeRef(); + + assertFalse(recordService.isRecord(document)); + ownableService.setOwner(document, userName); + versionService.ensureVersioningEnabled(document, null); + + // document is declared as a record by user + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // declare record + recordService.createRecord(filePlan, document); + return null; + } + }, userName); + + assertTrue(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); + } + + public void when() + { + // reject the record + recordService.rejectRecord(document, REASON); + assertFalse(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); + + // upload a new version of the document + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + ContentWriter writer = contentService.getWriter(document, ContentModel.PROP_CONTENT, true); + writer.putContent("This is a change to the content and should force a new version"); + versionService.createVersion(document, null); + + return null; + } + }, userName); + + assertFalse(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); + + VersionHistory history = versionService.getVersionHistory(document); + assertEquals(2, history.getAllVersions().size()); + final Version initial = history.getRootVersion(); + + assertFalse(nodeService.hasAspect(initial.getFrozenStateNodeRef(), ASPECT_FILE_PLAN_COMPONENT)); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // revert the document to a previous version + versionService.revert(document, initial); + + return null; + } + }, userName); + } + + public void then() + { + // document is no longer a record + assertFalse(recordService.isRecord(document)); + + // expected owner has be re-set + assertEquals(userName, ownableService.getOwner(document)); + } + }); + } + + public void testRelationshipAfterRevertingRecord() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + // Test document + private NodeRef document; + + public void given() + { + // Create a test document + NodeRef folder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); + document = fileFolderService.create(folder, generate(), TYPE_CONTENT).getNodeRef(); + + // Set Auto-Declare Versions to "For all major and minor versions" + PropertyMap recordableVersionProperties = new PropertyMap(2); + recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); + recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); + nodeService.addAspect(document, ASPECT_VERSIONABLE, recordableVersionProperties); + + // Upload New Version + document = checkOutCheckInService.checkout(document); + Map props = new HashMap(2); + props.put(Version.PROP_DESCRIPTION, generate()); + props.put(VersionModel.PROP_VERSION_TYPE, MINOR); + document = checkOutCheckInService.checkin(document, props); + + // Check the declared version + List childAssocs = nodeService.getChildAssocs(unfiledContainer); + assertEquals(1, childAssocs.size()); + + // Declare document as record + recordService.createRecord(filePlan, document); + + // Check the declared versions + childAssocs = nodeService.getChildAssocs(unfiledContainer); + assertEquals(2, childAssocs.size()); + + // Check that the document is a file plan component + assertTrue(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); + + // Get the final version + NodeRef finalVersion = null; + for (ChildAssociationRef childAssociationRef : nodeService.getChildAssocs(unfiledContainer)) + { + NodeRef childRef = childAssociationRef.getChildRef(); + String label = (String) nodeService.getProperty(document, RecordableVersionModel.PROP_VERSION_LABEL); + + if (label.equals(I18NUtil.getMessage(FINAL_VERSION))) + { + finalVersion = childRef; + break; + } + } + + // The final version should be the declared record + assertEquals(document, finalVersion); + + // Check the relationship + Set relationships = relationshipService.getRelationshipsFrom(document); + assertEquals(1, relationships.size()); + Relationship relationship = relationships.iterator().next(); + assertEquals(CUSTOM_REF_VERSIONS.getLocalName(), relationship.getUniqueName()); + } + + public void when() + { + // Reject record + recordService.rejectRecord(document, generate()); + } + + public void then() + { + // Check the relationship + Set relationships = relationshipService.getRelationshipsFrom(document); + assertEquals(0, relationships.size()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java index d82a7288b9..593b3f69a5 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java @@ -1,112 +1,112 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.record; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * View record tests. - * - * @author Ana Bozianu - * @since 2.3 - */ -public class ViewRecordTest extends BaseRMTestCase -{ - /** - * Given a user with read permission on a record and without read permission on the parent folder check if the user can check if the record is filed - * - * @see https://issues.alfresco.com/jira/browse/RM-1738 - */ - public void testReadIsFiledPropertyWithoutReadPermissionOnParentFolder() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef rc; - NodeRef recordFolder; - NodeRef record; - boolean recordIsFiled = false; - - public void given() - { - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create file plan structure - rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - NodeRef rsc = filePlanService.createRecordCategory(rc, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(rsc, GUID.generate()); - record = recordService.createRecordFromContent(recordFolder, GUID.generate(), TYPE_CONTENT, null, null); - } - - public void when() - { - // give read and file permissions on folder and remove permission from parent - filePlanPermissionService.setPermission(rc, user, RMPermissionModel.READ_RECORDS); - permissionService.setInheritParentPermissions(recordFolder, false); - filePlanPermissionService.setPermission(record, user, RMPermissionModel.READ_RECORDS); - - //check if the user can read the isFiled property - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - recordIsFiled = recordService.isFiled(record); - - return null; - } - }, user); - } - - public void then() - { - //check if the property is evaluated correctly - assertTrue(recordIsFiled); - } - - }); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.record; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.GUID; + +/** + * View record tests. + * + * @author Ana Bozianu + * @since 2.3 + */ +public class ViewRecordTest extends BaseRMTestCase +{ + /** + * Given a user with read permission on a record and without read permission on the parent folder check if the user can check if the record is filed + * + * @see https://issues.alfresco.com/jira/browse/RM-1738 + */ + public void testReadIsFiledPropertyWithoutReadPermissionOnParentFolder() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + /** test data */ + String roleName = GUID.generate(); + String user = GUID.generate(); + NodeRef rc; + NodeRef recordFolder; + NodeRef record; + boolean recordIsFiled = false; + + public void given() + { + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + // create file plan structure + rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); + NodeRef rsc = filePlanService.createRecordCategory(rc, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(rsc, GUID.generate()); + record = recordService.createRecordFromContent(recordFolder, GUID.generate(), TYPE_CONTENT, null, null); + } + + public void when() + { + // give read and file permissions on folder and remove permission from parent + filePlanPermissionService.setPermission(rc, user, RMPermissionModel.READ_RECORDS); + permissionService.setInheritParentPermissions(recordFolder, false); + filePlanPermissionService.setPermission(record, user, RMPermissionModel.READ_RECORDS); + + //check if the user can read the isFiled property + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + recordIsFiled = recordService.isFiled(record); + + return null; + } + }, user); + } + + public void then() + { + //check if the property is evaluated correctly + assertTrue(recordIsFiled); + } + + }); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java index b359887c37..d4df18ca80 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java @@ -1,521 +1,521 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.recordfolder; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.GUID; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Move record folder tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class MoveRecordFolderTest extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Given two categories, both with cut off immediately schedules, when the record is move then all the parts of the - * record should be correct based on the new schedule. - * - * @see https://issues.alfresco.com/jira/browse/RM-1345 - */ - public void testMoveRecordFolderBeforeCutOffFolderLevelDisposition() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) - { - NodeRef recordFolder; - NodeRef destinationRecordCategory; - - public void given() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - NodeRef rcOne = createRecordCategory(false); - destinationRecordCategory = createRecordCategory(false); - recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); - - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - } - }); - - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check the search aspect properties - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - - public void when() throws Exception - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // move record folder - fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); - } - }); - } - - public void then() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - - // check the search aspect properties - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - }); - } - - /** - * - */ - public void testMoveRecordFolderBeforeCutOffIntoAFolderWithNoDisposition() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) - { - NodeRef recordFolder; - NodeRef destinationRecordCategory; - - public void given() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - NodeRef rcOne = createRecordCategory(false); - destinationRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); - - // check for the lifecycle aspect - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); - } - }); - - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check the search aspect properties - assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - - public void when() throws Exception - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // move record folder - fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); - } - }); - } - - public void then() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - assertNull(dispositionService.getNextDispositionAction(recordFolder)); - - // check the search aspect properties - assertFalse(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); - } - }); - } - }); - } - - /** - * - */ - public void testMoveRecordFolderWithRecordsBeforeCutOffRecordLevelDisposition() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) - { - NodeRef record; - NodeRef recordFolder; - NodeRef destinationRecordCategory; - - public void given() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - NodeRef rcOne = createRecordCategory(true); - destinationRecordCategory = createRecordCategory(true); - recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); - record = utils.createRecord(recordFolder, GUID.generate()); - - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - assertNull(dispositionService.getNextDispositionAction(recordFolder)); - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - } - }); - - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check the search aspect properties - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - - public void when() throws Exception - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // move record folder - fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); - } - }); - } - - public void then() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // check for the lifecycle aspect - assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); - assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - - // check the disposition action details - assertNull(dispositionService.getNextDispositionAction(recordFolder)); - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); - assertNotNull(dispositionAction); - assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertTrue(dispositionService.isNextDispositionActionEligible(record)); - - // check the search aspect properties - assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); - assertEquals(CutOffAction.NAME, - nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - } - }); - } - - /** - * Try and move a folder from no disposition schedule to a disposition schedule - * - * @see https://issues.alfresco.com/jira/browse/RM-1039 - */ - public void testMoveRecordFolderFromNoDisToDis() throws Exception - { - final NodeRef recordFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category (no disposition schedule) - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); - - // create a record folder - return recordFolderService.createRecordFolder(recordCategory, "Grace Wetherall"); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNull(dispositionService.getDispositionSchedule(result)); - assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(result, FILING)); - } - }); - - final NodeRef record = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record - return fileFolderService.create(recordFolder, "mytest.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNull(dispositionService.getDispositionSchedule(result)); - assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(result, FILING)); - } - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - Capability capability = capabilityService.getCapability("CreateModifyDestroyFolders"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder)); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder, rmContainer)); - - // take a look at the move capability - Capability moveCapability = capabilityService.getCapability("Move"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(recordFolder, rmContainer)); - - // move the node - return fileFolderService.move(recordFolder, rmContainer, null).getNodeRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - assertNotNull(dispositionService.getDispositionSchedule(result)); - assertTrue(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); - - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(result); - assertNotNull(dispositionAction); - - assertNull(dispositionAction.getAsOfDate()); - assertEquals("cutoff", dispositionAction.getName()); - assertEquals(1, dispositionAction.getEventCompletionDetails().size()); - - // take a look at the record and check things are as we would expect - assertFalse(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); - } - }); - } - - // try and move a cutoff folder - public void testMoveCutoffRecordFolder() throws Exception - { - final NodeRef destination = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category (no disposition schedule) - return filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); - } - }); - - final NodeRef testFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create folder - NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); - - // complete event - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); - - // cutoff folder - rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); - - return testFolder; - } - - @Override - public void test(NodeRef testFolder) throws Exception - { - // take a look at the move capability - Capability moveCapability = capabilityService.getCapability("MoveRecordFolder"); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, moveCapability.evaluate(testFolder, destination)); - } - }); - - doTestInTransaction(new FailureTest() - { - @Override - public void run() throws Exception - { - fileFolderService.move(testFolder, destination, null).getNodeRef(); - } - }); - } - - // try and move a destroyed folder - public void testMoveDestroyedRecordFolder() throws Exception - { - final NodeRef destination = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create a record category (no disposition schedule) - return filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); - } - }); - - final NodeRef testFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // create folder - NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); - - // complete event - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); - - // cutoff & destroy folder - rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); - rmActionService.executeRecordsManagementAction(testFolder, DestroyAction.NAME); - - return testFolder; - } - - }); - - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - Capability moveCapability = capabilityService.getCapability("MoveRecordFolder"); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(testFolder, destination)); - - return fileFolderService.move(testFolder, destination, null).getNodeRef(); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertNotNull(result); - } - }); - - } - - private NodeRef createRecordCategory(boolean recordLevel) - { - NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - DispositionSchedule dis = utils.createBasicDispositionSchedule(rc, GUID.generate(), GUID.generate(), - recordLevel, false); - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dis, adParams); - return rc; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.recordfolder; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.GUID; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Move record folder tests. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class MoveRecordFolderTest extends BaseRMTestCase +{ + @Override + protected boolean isRecordTest() + { + return true; + } + + /** + * Given two categories, both with cut off immediately schedules, when the record is move then all the parts of the + * record should be correct based on the new schedule. + * + * @see https://issues.alfresco.com/jira/browse/RM-1345 + */ + public void testMoveRecordFolderBeforeCutOffFolderLevelDisposition() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) + { + NodeRef recordFolder; + NodeRef destinationRecordCategory; + + public void given() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + NodeRef rcOne = createRecordCategory(false); + destinationRecordCategory = createRecordCategory(false); + recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); + + // check for the lifecycle aspect + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNotNull(dispositionAction.getAsOfDate()); + assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); + } + }); + + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // check the search aspect properties + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, + nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); + } + }); + } + + public void when() throws Exception + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // move record folder + fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); + } + }); + } + + public void then() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // check for the lifecycle aspect + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNotNull(dispositionAction.getAsOfDate()); + assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); + + // check the search aspect properties + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, + nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); + } + }); + } + }); + } + + /** + * + */ + public void testMoveRecordFolderBeforeCutOffIntoAFolderWithNoDisposition() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) + { + NodeRef recordFolder; + NodeRef destinationRecordCategory; + + public void given() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + NodeRef rcOne = createRecordCategory(false); + destinationRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); + + // check for the lifecycle aspect + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNotNull(dispositionAction.getAsOfDate()); + assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder)); + } + }); + + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // check the search aspect properties + assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, + nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF)); + } + }); + } + + public void when() throws Exception + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // move record folder + fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); + } + }); + } + + public void then() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // check for the lifecycle aspect + assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + assertNull(dispositionService.getNextDispositionAction(recordFolder)); + + // check the search aspect properties + assertFalse(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH)); + } + }); + } + }); + } + + /** + * + */ + public void testMoveRecordFolderWithRecordsBeforeCutOffRecordLevelDisposition() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) + { + NodeRef record; + NodeRef recordFolder; + NodeRef destinationRecordCategory; + + public void given() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + NodeRef rcOne = createRecordCategory(true); + destinationRecordCategory = createRecordCategory(true); + recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate()); + record = utils.createRecord(recordFolder, GUID.generate()); + + // check for the lifecycle aspect + assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + assertNull(dispositionService.getNextDispositionAction(recordFolder)); + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNotNull(dispositionAction.getAsOfDate()); + assertTrue(dispositionService.isNextDispositionActionEligible(record)); + } + }); + + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // check the search aspect properties + assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, + nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); + } + }); + } + + public void when() throws Exception + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // move record folder + fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate()); + } + }); + } + + public void then() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + // check for the lifecycle aspect + assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE)); + assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + + // check the disposition action details + assertNull(dispositionService.getNextDispositionAction(recordFolder)); + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); + assertNotNull(dispositionAction); + assertNotNull(CutOffAction.NAME, dispositionAction.getName()); + assertNotNull(dispositionAction.getAsOfDate()); + assertTrue(dispositionService.isNextDispositionActionEligible(record)); + + // check the search aspect properties + assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH)); + assertEquals(CutOffAction.NAME, + nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME)); + assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF)); + } + }); + } + }); + } + + /** + * Try and move a folder from no disposition schedule to a disposition schedule + * + * @see https://issues.alfresco.com/jira/browse/RM-1039 + */ + public void testMoveRecordFolderFromNoDisToDis() throws Exception + { + final NodeRef recordFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a record category (no disposition schedule) + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); + + // create a record folder + return recordFolderService.createRecordFolder(recordCategory, "Grace Wetherall"); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertNotNull(result); + assertNull(dispositionService.getDispositionSchedule(result)); + assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(result, FILING)); + } + }); + + final NodeRef record = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a record + return fileFolderService.create(recordFolder, "mytest.txt", ContentModel.TYPE_CONTENT).getNodeRef(); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertNotNull(result); + assertNull(dispositionService.getDispositionSchedule(result)); + assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(result, FILING)); + } + }); + + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + Capability capability = capabilityService.getCapability("CreateModifyDestroyFolders"); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder)); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(recordFolder, rmContainer)); + + // take a look at the move capability + Capability moveCapability = capabilityService.getCapability("Move"); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(recordFolder, rmContainer)); + + // move the node + return fileFolderService.move(recordFolder, rmContainer, null).getNodeRef(); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertNotNull(result); + assertNotNull(dispositionService.getDispositionSchedule(result)); + assertTrue(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE)); + + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(result); + assertNotNull(dispositionAction); + + assertNull(dispositionAction.getAsOfDate()); + assertEquals("cutoff", dispositionAction.getName()); + assertEquals(1, dispositionAction.getEventCompletionDetails().size()); + + // take a look at the record and check things are as we would expect + assertFalse(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE)); + } + }); + } + + // try and move a cutoff folder + public void testMoveCutoffRecordFolder() throws Exception + { + final NodeRef destination = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a record category (no disposition schedule) + return filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); + } + }); + + final NodeRef testFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create folder + NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); + + // complete event + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); + + // cutoff folder + rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); + + return testFolder; + } + + @Override + public void test(NodeRef testFolder) throws Exception + { + // take a look at the move capability + Capability moveCapability = capabilityService.getCapability("MoveRecordFolder"); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, moveCapability.evaluate(testFolder, destination)); + } + }); + + doTestInTransaction(new FailureTest() + { + @Override + public void run() throws Exception + { + fileFolderService.move(testFolder, destination, null).getNodeRef(); + } + }); + } + + // try and move a destroyed folder + public void testMoveDestroyedRecordFolder() throws Exception + { + final NodeRef destination = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create a record category (no disposition schedule) + return filePlanService.createRecordCategory(filePlan, "Caitlin Reed"); + } + }); + + final NodeRef testFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // create folder + NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis"); + + // complete event + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params); + + // cutoff & destroy folder + rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME); + rmActionService.executeRecordsManagementAction(testFolder, DestroyAction.NAME); + + return testFolder; + } + + }); + + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + Capability moveCapability = capabilityService.getCapability("MoveRecordFolder"); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(testFolder, destination)); + + return fileFolderService.move(testFolder, destination, null).getNodeRef(); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertNotNull(result); + } + }); + + } + + private NodeRef createRecordCategory(boolean recordLevel) + { + NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); + DispositionSchedule dis = utils.createBasicDispositionSchedule(rc, GUID.generate(), GUID.generate(), + recordLevel, false); + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); + adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); + dispositionService.addDispositionActionDefinition(dis, adParams); + return rc; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java index b37c1e2267..de7011b99d 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java @@ -1,218 +1,218 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.relationship; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Create relationship integration test. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class CreateRelationshipTest extends BaseRMTestCase -{ - public void testReadOnlyPermissionOnSource() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.READ_RECORDS); - filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - }); - } - - public void testReadOnlyPermissionOnTarget() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.READ_RECORDS); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - }); - } - - public void testFillingPermissionOnSourceAndTarget() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecordCategory, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(targetRecordCategory, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - - @Override - public void then() throws Exception - { - // assert that the relationship exists - assertEquals(1, relationshipService.getRelationshipsFrom(sourceRecord).size()); - assertEquals(0, relationshipService.getRelationshipsTo(sourceRecord).size()); - assertEquals(0, relationshipService.getRelationshipsFrom(targetRecord).size()); - assertEquals(1, relationshipService.getRelationshipsTo(targetRecord).size()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.relationship; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.GUID; + +/** + * Create relationship integration test. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class CreateRelationshipTest extends BaseRMTestCase +{ + public void testReadOnlyPermissionOnSource() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) + { + /** test data */ + private String roleName = GUID.generate(); + private String user = GUID.generate(); + private NodeRef sourceRecordCategory; + private NodeRef targetRecordCategory; + private NodeRef sourceRecordFolder; + private NodeRef targetRecordFolder; + private NodeRef sourceRecord; + private NodeRef targetRecord; + + public void given() throws Exception + { + // test entities + sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); + sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); + targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); + targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); + + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + } + + public void when() + { + // assign permissions + filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.READ_RECORDS); + filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.FILING); + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() throws Exception + { + relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); + return null; + } + }, user); + } + }); + } + + public void testReadOnlyPermissionOnTarget() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) + { + /** test data */ + private String roleName = GUID.generate(); + private String user = GUID.generate(); + private NodeRef sourceRecordCategory; + private NodeRef targetRecordCategory; + private NodeRef sourceRecordFolder; + private NodeRef targetRecordFolder; + private NodeRef sourceRecord; + private NodeRef targetRecord; + + public void given() throws Exception + { + // test entities + sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); + sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); + targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); + targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); + + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + } + + public void when() + { + // assign permissions + filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.READ_RECORDS); + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() throws Exception + { + relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); + return null; + } + }, user); + } + }); + } + + public void testFillingPermissionOnSourceAndTarget() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + /** test data */ + private String roleName = GUID.generate(); + private String user = GUID.generate(); + private NodeRef sourceRecordCategory; + private NodeRef targetRecordCategory; + private NodeRef sourceRecordFolder; + private NodeRef targetRecordFolder; + private NodeRef sourceRecord; + private NodeRef targetRecord; + + public void given() throws Exception + { + // test entities + sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); + sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); + targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); + targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); + + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + } + + public void when() + { + // assign permissions + filePlanPermissionService.setPermission(sourceRecordCategory, user, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(targetRecordCategory, user, RMPermissionModel.FILING); + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() throws Exception + { + relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); + return null; + } + }, user); + } + + @Override + public void then() throws Exception + { + // assert that the relationship exists + assertEquals(1, relationshipService.getRelationshipsFrom(sourceRecord).size()); + assertEquals(0, relationshipService.getRelationshipsTo(sourceRecord).size()); + assertEquals(0, relationshipService.getRelationshipsFrom(targetRecord).size()); + assertEquals(1, relationshipService.getRelationshipsTo(targetRecord).size()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java index 56cb61d92d..ebcc9b9ad8 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java @@ -1,268 +1,268 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.relationship; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Delete relationship test. - * - * @author Ana Bozianu - * @since 2.3 - */ -public class DeleteRelationshipTest extends BaseRMTestCase -{ - public void testDeleteRelationship() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - NodeRef sourceNode; - NodeRef targetNode; - String associationName = CUSTOM_REF_OBSOLETES.getLocalName(); - - public void given() - { - - // create the source record - sourceNode = utils.createRecord(rmFolder, GUID.generate()); - - //create the target record - targetNode = utils.createRecord(rmFolder, GUID.generate()); - - //create relationship - relationshipService.addRelationship(associationName, sourceNode, targetNode); - } - - public void when() - { - //delete relationship - relationshipService.removeRelationship(associationName, sourceNode, targetNode); - } - - public void then() - { - //check if relationship is deleted - Set relationships = relationshipService.getRelationshipsFrom(sourceNode); - for(Relationship r : relationships) - { - assertFalse(r.getTarget().equals(targetNode) && r.getUniqueName().equals(associationName)); - } - } - }); - } - - public void testReadOnlyPermissionOnSource() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // add relationship - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.READ_RECORDS); - filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - }); - } - - public void testReadOnlyPermissionOnTarget() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create relationship - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.READ_RECORDS); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - }); - } - - public void testFillingPermissionOnSourceAndTarget() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create relationship - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecordCategory, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(targetRecordCategory, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - - @Override - public void then() throws Exception - { - // assert that the relationship exists - assertEquals(0, relationshipService.getRelationshipsFrom(sourceRecord).size()); - assertEquals(0, relationshipService.getRelationshipsTo(sourceRecord).size()); - assertEquals(0, relationshipService.getRelationshipsFrom(targetRecord).size()); - assertEquals(0, relationshipService.getRelationshipsTo(targetRecord).size()); - } - }); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.relationship; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.GUID; + +/** + * Delete relationship test. + * + * @author Ana Bozianu + * @since 2.3 + */ +public class DeleteRelationshipTest extends BaseRMTestCase +{ + public void testDeleteRelationship() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + /** test data */ + NodeRef sourceNode; + NodeRef targetNode; + String associationName = CUSTOM_REF_OBSOLETES.getLocalName(); + + public void given() + { + + // create the source record + sourceNode = utils.createRecord(rmFolder, GUID.generate()); + + //create the target record + targetNode = utils.createRecord(rmFolder, GUID.generate()); + + //create relationship + relationshipService.addRelationship(associationName, sourceNode, targetNode); + } + + public void when() + { + //delete relationship + relationshipService.removeRelationship(associationName, sourceNode, targetNode); + } + + public void then() + { + //check if relationship is deleted + Set relationships = relationshipService.getRelationshipsFrom(sourceNode); + for(Relationship r : relationships) + { + assertFalse(r.getTarget().equals(targetNode) && r.getUniqueName().equals(associationName)); + } + } + }); + } + + public void testReadOnlyPermissionOnSource() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) + { + /** test data */ + private String roleName = GUID.generate(); + private String user = GUID.generate(); + private NodeRef sourceRecordCategory; + private NodeRef targetRecordCategory; + private NodeRef sourceRecordFolder; + private NodeRef targetRecordFolder; + private NodeRef sourceRecord; + private NodeRef targetRecord; + + public void given() throws Exception + { + // test entities + sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); + sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); + targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); + targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); + + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + // add relationship + relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); + } + + public void when() + { + // assign permissions + filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.READ_RECORDS); + filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.FILING); + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() throws Exception + { + relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); + return null; + } + }, user); + } + }); + } + + public void testReadOnlyPermissionOnTarget() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) + { + /** test data */ + private String roleName = GUID.generate(); + private String user = GUID.generate(); + private NodeRef sourceRecordCategory; + private NodeRef targetRecordCategory; + private NodeRef sourceRecordFolder; + private NodeRef targetRecordFolder; + private NodeRef sourceRecord; + private NodeRef targetRecord; + + public void given() throws Exception + { + // test entities + sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); + sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); + targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); + targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); + + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + // create relationship + relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); + } + + public void when() + { + // assign permissions + filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.READ_RECORDS); + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() throws Exception + { + relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); + return null; + } + }, user); + } + }); + } + + public void testFillingPermissionOnSourceAndTarget() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + /** test data */ + private String roleName = GUID.generate(); + private String user = GUID.generate(); + private NodeRef sourceRecordCategory; + private NodeRef targetRecordCategory; + private NodeRef sourceRecordFolder; + private NodeRef targetRecordFolder; + private NodeRef sourceRecord; + private NodeRef targetRecord; + + public void given() throws Exception + { + // test entities + sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); + sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); + targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); + targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); + + // create role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability("ViewRecords")); + capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); + filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + + // create user and assign to role + createPerson(user, true); + filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); + + // create relationship + relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); + } + + public void when() + { + // assign permissions + filePlanPermissionService.setPermission(sourceRecordCategory, user, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(targetRecordCategory, user, RMPermissionModel.FILING); + + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Void doWork() throws Exception + { + relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); + return null; + } + }, user); + } + + @Override + public void then() throws Exception + { + // assert that the relationship exists + assertEquals(0, relationshipService.getRelationshipsFrom(sourceRecord).size()); + assertEquals(0, relationshipService.getRelationshipsTo(sourceRecord).size()); + assertEquals(0, relationshipService.getRelationshipsFrom(targetRecord).size()); + assertEquals(0, relationshipService.getRelationshipsTo(targetRecord).size()); + } + }); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/report/HoldReportTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/report/HoldReportTest.java index 80cea881d9..5e6b0b3b1d 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/report/HoldReportTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/report/HoldReportTest.java @@ -1,175 +1,175 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.report; - -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.springframework.extensions.webscripts.GUID; - -/** - * Hold report integration tests. - *

- * Relates to: - * - https://issues.alfresco.com/jira/browse/RM-1211 - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldReportTest extends BaseRMTestCase implements ReportModel -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * ensure that 'rmr:holdReport' is in the list of those available - */ - public void testHoldReportTypeAvailable() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private Set reportTypes; - - public void when() - { - reportTypes = reportService.getReportTypes(); - } - - public void then() - { - assertNotNull(reportTypes); - assertTrue(reportTypes.contains(TYPE_HOLD_REPORT)); - } - }); - } - - /** - * given that the reported upon node is not a hold, ensure that an error is raised when - * the report is generated. - */ - public void testReportedUponNodeIsNotAHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class) - { - private NodeRef reportedUponNodeRef; - - public void given() - { - reportedUponNodeRef = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - } - - public void when() - { - reportService.generateReport(TYPE_HOLD_REPORT, reportedUponNodeRef); - } - - public void after() - { - // remove created folder - nodeService.deleteNode(reportedUponNodeRef); - } - }); - } - - /** - * Given a hold that contains items, ensure the report is generated as expected - */ - public void testGenerateHoldReport() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private static final String HOLD_NAME = "holdName"; - private static final String HOLD_REASON = "holdReason"; - private static final String HOLD_DESCRIPTION = "holdDescription"; - private static final String FOLDER1_NAME = "folder1Name"; - - private NodeRef hold; - private NodeRef folder1; - private Report report; - - public void given() - { - // crate a hold - hold = holdService.createHold(filePlan, HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION); - - // add some items to the hold - folder1 = recordFolderService.createRecordFolder(rmContainer, FOLDER1_NAME); - holdService.addToHold(hold, folder1); - holdService.addToHold(hold, recordOne); - } - - public void when() - { - report = reportService.generateReport(TYPE_HOLD_REPORT, hold, MimetypeMap.MIMETYPE_HTML); - } - - public void then() - { - assertNotNull(report); - assertEquals(TYPE_HOLD_REPORT, report.getReportType()); - assertTrue(report.getReportProperties().isEmpty()); - - // check the name has been generated correctly - assertNotNull(report.getReportName()); - assertTrue(report.getReportName().contains("Hold Report")); - assertTrue(report.getReportName().contains(HOLD_NAME)); - assertTrue(report.getReportName().contains(".html")); - - // check the content reader - ContentReader reader = report.getReportContent(); - assertNotNull(reader); - assertEquals(MimetypeMap.MIMETYPE_HTML, reader.getMimetype()); - - // check the content - String reportContent = reader.getContentString(); - assertNotNull(reportContent); - assertTrue(reportContent.contains(HOLD_NAME)); - assertTrue(reportContent.contains(HOLD_REASON)); - assertTrue(reportContent.contains(HOLD_DESCRIPTION)); - assertTrue(reportContent.contains(FOLDER1_NAME)); - assertTrue(reportContent.contains("one")); - } - - public void after() - { - holdService.deleteHold(hold); - nodeService.deleteNode(folder1); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.report; + +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.report.Report; +import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.webscripts.GUID; + +/** + * Hold report integration tests. + *

+ * Relates to: + * - https://issues.alfresco.com/jira/browse/RM-1211 + * + * @author Roy Wetherall + * @since 2.2 + */ +public class HoldReportTest extends BaseRMTestCase implements ReportModel +{ + @Override + protected boolean isRecordTest() + { + return true; + } + + /** + * ensure that 'rmr:holdReport' is in the list of those available + */ + public void testHoldReportTypeAvailable() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private Set reportTypes; + + public void when() + { + reportTypes = reportService.getReportTypes(); + } + + public void then() + { + assertNotNull(reportTypes); + assertTrue(reportTypes.contains(TYPE_HOLD_REPORT)); + } + }); + } + + /** + * given that the reported upon node is not a hold, ensure that an error is raised when + * the report is generated. + */ + public void testReportedUponNodeIsNotAHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class) + { + private NodeRef reportedUponNodeRef; + + public void given() + { + reportedUponNodeRef = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); + } + + public void when() + { + reportService.generateReport(TYPE_HOLD_REPORT, reportedUponNodeRef); + } + + public void after() + { + // remove created folder + nodeService.deleteNode(reportedUponNodeRef); + } + }); + } + + /** + * Given a hold that contains items, ensure the report is generated as expected + */ + public void testGenerateHoldReport() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private static final String HOLD_NAME = "holdName"; + private static final String HOLD_REASON = "holdReason"; + private static final String HOLD_DESCRIPTION = "holdDescription"; + private static final String FOLDER1_NAME = "folder1Name"; + + private NodeRef hold; + private NodeRef folder1; + private Report report; + + public void given() + { + // crate a hold + hold = holdService.createHold(filePlan, HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION); + + // add some items to the hold + folder1 = recordFolderService.createRecordFolder(rmContainer, FOLDER1_NAME); + holdService.addToHold(hold, folder1); + holdService.addToHold(hold, recordOne); + } + + public void when() + { + report = reportService.generateReport(TYPE_HOLD_REPORT, hold, MimetypeMap.MIMETYPE_HTML); + } + + public void then() + { + assertNotNull(report); + assertEquals(TYPE_HOLD_REPORT, report.getReportType()); + assertTrue(report.getReportProperties().isEmpty()); + + // check the name has been generated correctly + assertNotNull(report.getReportName()); + assertTrue(report.getReportName().contains("Hold Report")); + assertTrue(report.getReportName().contains(HOLD_NAME)); + assertTrue(report.getReportName().contains(".html")); + + // check the content reader + ContentReader reader = report.getReportContent(); + assertNotNull(reader); + assertEquals(MimetypeMap.MIMETYPE_HTML, reader.getMimetype()); + + // check the content + String reportContent = reader.getContentString(); + assertNotNull(reportContent); + assertTrue(reportContent.contains(HOLD_NAME)); + assertTrue(reportContent.contains(HOLD_REASON)); + assertTrue(reportContent.contains(HOLD_DESCRIPTION)); + assertTrue(reportContent.contains(FOLDER1_NAME)); + assertTrue(reportContent.contains("one")); + } + + public void after() + { + holdService.deleteHold(hold); + nodeService.deleteNode(folder1); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java index 3333482516..495b621af5 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java @@ -1,284 +1,284 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.rule; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.rule.Rule; -import org.alfresco.service.cmr.rule.RuleService; -import org.springframework.extensions.webscripts.GUID; - -/** - * File plan rule inheritance test - * - * @author Roy Wetherall - * @since 2.4 - */ -public class FilePlanRuleInheritanceTest extends BaseRMTestCase -{ - private RuleService ruleService; - - @Override - protected void initServices() - { - super.initServices(); - ruleService = (RuleService)applicationContext.getBean("RuleService"); - } - - @Override - protected boolean isRMSiteTest() - { - return false; - } - - private NodeRef createFilePlan() - { - return filePlanService.createFilePlan(folder, "My File Plan"); - } - - /** - * Given that a single rule is set on the parent folder of the file plan root - * And that it is configured to apply to children - * When we ask for the rules on the file plan, including those inherited - * Then it will not include those defined on the parent folder - */ - public void testFilePlanDoesNotInheritRulesFromParentFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private List rules = null; - - public void given() - { - filePlan = createFilePlan(); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - Rule rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - - // save rule on file plan root parent folder - ruleService.saveRule(folder, rule); - } - - public void when() - { - // get rules, including those inherited - rules = ruleService.getRules(filePlan, true); - } - - public void then() - { - // rules aren't inhreited from file plan root parent folder - assertEquals(0, rules.size()); - } - }); - } - - /** - * Given that a single rule is set on the file plan root - * And that it is configured to apply to children - * When we ask for the rules on the unfiled record container including those inherited - * Then it will not include those defined on the file plan root - * - * See https://issues.alfresco.com/jira/browse/RM-3148 - */ - public void testFilePlanRulesInheritedInUnfiledContainer() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private List rules = null; - - public void given() - { - filePlan = createFilePlan(); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - Rule rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - - // save rule on file plan root - ruleService.saveRule(filePlan, rule); - } - - public void when() - { - // get rules, including those inherited - NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan); - rules = ruleService.getRules(unfiledRecordContainer, true); - } - - public void then() - { - // rules aren't inhreited from file plan root - assertEquals(0, rules.size()); - } - }); - } - - /** - * Given that a single rule is set on the file plan root - * And that it is configured to apply to children - * When we ask for the rules on the hold container including those inherited - * Then it will not include those defined on the file plan root - */ - public void testFilePlanRulesInheritedInHoldContainer() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private List rules = null; - - public void given() - { - filePlan = createFilePlan(); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - Rule rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - - // save rule on file plan root - ruleService.saveRule(filePlan, rule); - } - - public void when() - { - // get rules, including those inherited - NodeRef container = filePlanService.getHoldContainer(filePlan); - rules = ruleService.getRules(container, true); - } - - public void then() - { - // rules aren't inhreited from file plan root - assertEquals(0, rules.size()); - } - }); - } - - /** - * Given that a single rule is set on the file plan root - * And that it is configured to apply to children - * When we ask for the rules on the transfer container including those inherited - * Then it will not include those defined on the file plan root - */ - public void testFilePlanRulesInheritedInTransferContainer() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private List rules = null; - - public void given() - { - filePlan = createFilePlan(); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - Rule rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - - // save rule on file plan root - ruleService.saveRule(filePlan, rule); - } - - public void when() - { - // get rules, including those inherited - NodeRef container = filePlanService.getTransferContainer(filePlan); - rules = ruleService.getRules(container, true); - } - - public void then() - { - // rules aren't inhreited from file plan root - assertEquals(0, rules.size()); - } - }); - } - - /** - * Given that a single rule is set on the file plan root - * And that it is configured to apply to children - * When we ask for the rules on a record category including those inherited - * Then it will include those defined on the file plan root - */ - public void testFilePlanRulesInheritedOnRecordCategory() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef filePlan = null; - private NodeRef recordCategory = null; - private List rules = null; - - public void given() - { - filePlan = createFilePlan(); - recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - // create a rule that applies to childre - Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); - Rule rule = new Rule(); - rule.setRuleType("inbound"); - rule.setAction(completeRecordAction); - rule.applyToChildren(true); - - // save rule on file plan root - ruleService.saveRule(filePlan, rule); - } - - public void when() - { - // get rules, including those inherited - rules = ruleService.getRules(recordCategory, true); - } - - public void then() - { - // rules aren't inhreited from file plan root - assertEquals(1, rules.size()); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.rule; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.rule.Rule; +import org.alfresco.service.cmr.rule.RuleService; +import org.springframework.extensions.webscripts.GUID; + +/** + * File plan rule inheritance test + * + * @author Roy Wetherall + * @since 2.4 + */ +public class FilePlanRuleInheritanceTest extends BaseRMTestCase +{ + private RuleService ruleService; + + @Override + protected void initServices() + { + super.initServices(); + ruleService = (RuleService)applicationContext.getBean("RuleService"); + } + + @Override + protected boolean isRMSiteTest() + { + return false; + } + + private NodeRef createFilePlan() + { + return filePlanService.createFilePlan(folder, "My File Plan"); + } + + /** + * Given that a single rule is set on the parent folder of the file plan root + * And that it is configured to apply to children + * When we ask for the rules on the file plan, including those inherited + * Then it will not include those defined on the parent folder + */ + public void testFilePlanDoesNotInheritRulesFromParentFolder() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef filePlan = null; + private List rules = null; + + public void given() + { + filePlan = createFilePlan(); + + // create a rule that applies to childre + Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); + Rule rule = new Rule(); + rule.setRuleType("inbound"); + rule.setAction(completeRecordAction); + rule.applyToChildren(true); + + // save rule on file plan root parent folder + ruleService.saveRule(folder, rule); + } + + public void when() + { + // get rules, including those inherited + rules = ruleService.getRules(filePlan, true); + } + + public void then() + { + // rules aren't inhreited from file plan root parent folder + assertEquals(0, rules.size()); + } + }); + } + + /** + * Given that a single rule is set on the file plan root + * And that it is configured to apply to children + * When we ask for the rules on the unfiled record container including those inherited + * Then it will not include those defined on the file plan root + * + * See https://issues.alfresco.com/jira/browse/RM-3148 + */ + public void testFilePlanRulesInheritedInUnfiledContainer() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef filePlan = null; + private List rules = null; + + public void given() + { + filePlan = createFilePlan(); + + // create a rule that applies to childre + Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); + Rule rule = new Rule(); + rule.setRuleType("inbound"); + rule.setAction(completeRecordAction); + rule.applyToChildren(true); + + // save rule on file plan root + ruleService.saveRule(filePlan, rule); + } + + public void when() + { + // get rules, including those inherited + NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan); + rules = ruleService.getRules(unfiledRecordContainer, true); + } + + public void then() + { + // rules aren't inhreited from file plan root + assertEquals(0, rules.size()); + } + }); + } + + /** + * Given that a single rule is set on the file plan root + * And that it is configured to apply to children + * When we ask for the rules on the hold container including those inherited + * Then it will not include those defined on the file plan root + */ + public void testFilePlanRulesInheritedInHoldContainer() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef filePlan = null; + private List rules = null; + + public void given() + { + filePlan = createFilePlan(); + + // create a rule that applies to childre + Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); + Rule rule = new Rule(); + rule.setRuleType("inbound"); + rule.setAction(completeRecordAction); + rule.applyToChildren(true); + + // save rule on file plan root + ruleService.saveRule(filePlan, rule); + } + + public void when() + { + // get rules, including those inherited + NodeRef container = filePlanService.getHoldContainer(filePlan); + rules = ruleService.getRules(container, true); + } + + public void then() + { + // rules aren't inhreited from file plan root + assertEquals(0, rules.size()); + } + }); + } + + /** + * Given that a single rule is set on the file plan root + * And that it is configured to apply to children + * When we ask for the rules on the transfer container including those inherited + * Then it will not include those defined on the file plan root + */ + public void testFilePlanRulesInheritedInTransferContainer() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef filePlan = null; + private List rules = null; + + public void given() + { + filePlan = createFilePlan(); + + // create a rule that applies to childre + Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); + Rule rule = new Rule(); + rule.setRuleType("inbound"); + rule.setAction(completeRecordAction); + rule.applyToChildren(true); + + // save rule on file plan root + ruleService.saveRule(filePlan, rule); + } + + public void when() + { + // get rules, including those inherited + NodeRef container = filePlanService.getTransferContainer(filePlan); + rules = ruleService.getRules(container, true); + } + + public void then() + { + // rules aren't inhreited from file plan root + assertEquals(0, rules.size()); + } + }); + } + + /** + * Given that a single rule is set on the file plan root + * And that it is configured to apply to children + * When we ask for the rules on a record category including those inherited + * Then it will include those defined on the file plan root + */ + public void testFilePlanRulesInheritedOnRecordCategory() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef filePlan = null; + private NodeRef recordCategory = null; + private List rules = null; + + public void given() + { + filePlan = createFilePlan(); + recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + // create a rule that applies to childre + Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); + Rule rule = new Rule(); + rule.setRuleType("inbound"); + rule.setAction(completeRecordAction); + rule.applyToChildren(true); + + // save rule on file plan root + ruleService.saveRule(filePlan, rule); + } + + public void when() + { + // get rules, including those inherited + rules = ruleService.getRules(recordCategory, true); + } + + public void then() + { + // rules aren't inhreited from file plan root + assertEquals(1, rules.size()); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUserTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUserTest.java index 2625d65e61..23001506bf 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUserTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUserTest.java @@ -1,166 +1,166 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.transfer; - -import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test case which shows that the user who creates the transfer gets filing permissions granted. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class CreateTransferFolderAsNonAdminUserTest extends BaseRMTestCase -{ - // Test user - private String testUser = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test user - testUser = generate(); - createPerson(testUser); - - // Join the RM site - siteService.setMembership(siteId, testUser, SITE_CONSUMER); - - // Add the test user to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser); - } - - public void testCreateTransferFolderAsNonAdminUser() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser) - { - // Records folder - private NodeRef recordsFolder = null; - - // Transfer folder - private NodeRef transferFolder = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() - { - runAs(new RunAsWork() - { - public Void doWork() - { - // Create category - NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); - - // Give filing permissions for the test users on the category - filePlanPermissionService.setPermission(category, testUser, FILING); - - // Create disposition schedule - utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); - - // Create folder - recordsFolder = recordFolderService.createRecordFolder(category, generate()); - - // Make eligible for cut off - Map params = new HashMap(1); - params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); - - return null; - } - }, getAdminUserName()); - - // FIXME: This step should be executed in "when()". - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() - { - // FIXME: If the transfer step is executed here the test fails?!? - //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() - { - // Check transfer folder - assertNotNull(transferFolder); - - // User should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if the user has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.transfer; + +import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; +import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; +import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; +import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; +import static org.alfresco.util.GUID.generate; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Test case which shows that the user who creates the transfer gets filing permissions granted. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class CreateTransferFolderAsNonAdminUserTest extends BaseRMTestCase +{ + // Test user + private String testUser = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + // Create test user + testUser = generate(); + createPerson(testUser); + + // Join the RM site + siteService.setMembership(siteId, testUser, SITE_CONSUMER); + + // Add the test user to RM Records Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser); + } + + public void testCreateTransferFolderAsNonAdminUser() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(testUser) + { + // Records folder + private NodeRef recordsFolder = null; + + // Transfer folder + private NodeRef transferFolder = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() + */ + @Override + public void given() + { + runAs(new RunAsWork() + { + public Void doWork() + { + // Create category + NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); + + // Give filing permissions for the test users on the category + filePlanPermissionService.setPermission(category, testUser, FILING); + + // Create disposition schedule + utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); + + // Create folder + recordsFolder = recordFolderService.createRecordFolder(category, generate()); + + // Make eligible for cut off + Map params = new HashMap(1); + params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); + + // Cut off folder + rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); + + return null; + } + }, getAdminUserName()); + + // FIXME: This step should be executed in "when()". + transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() + */ + @Override + public void when() + { + // FIXME: If the transfer step is executed here the test fails?!? + //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() + */ + @Override + public void then() + { + // Check transfer folder + assertNotNull(transferFolder); + + // User should have read permissions on the transfers container + assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); + + // Check if the user has filing permissions on the transfer folder + assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolderTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolderTest.java index aef3197421..b889fa3d7f 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolderTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolderTest.java @@ -1,200 +1,200 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.transfer; - -import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test case which shows that the user who did not create a transfer folder will - * be able to see and action on it if he gets filing permission on the transfer folder. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class FilingPermissionsOnTransferFolderTest extends BaseRMTestCase -{ - // Test users - private String testUser1 = null; - private String testUser2 = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test users - testUser1 = generate(); - createPerson(testUser1); - testUser2 = generate(); - createPerson(testUser2); - - // Join the RM site - siteService.setMembership(siteId, testUser1, SITE_CONSUMER); - siteService.setMembership(siteId, testUser2, SITE_CONSUMER); - - // Add the test users to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); - } - - public void testFilingPermissionsOnTransferFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) - { - // Records folder - private NodeRef recordsFolder = null; - - // Transfer folder - private NodeRef transferFolder = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() - { - runAs(new RunAsWork() - { - public Void doWork() - { - // Create category - NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); - - // Give filing permissions for the test users on the category - filePlanPermissionService.setPermission(category, testUser1, FILING); - filePlanPermissionService.setPermission(category, testUser2, FILING); - - // Create disposition schedule - utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); - - // Create folder - recordsFolder = recordFolderService.createRecordFolder(category, generate()); - - // Make eligible for cut off - Map params = new HashMap(1); - params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); - - return null; - } - }, getAdminUserName()); - - // FIXME: This step should be executed in "when()". - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() - { - // FIXME: If the transfer step is executed here the test fails. - //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - - // Give testUser2 filing permissions on transfer folder - filePlanPermissionService.setPermission(transferFolder, testUser2, FILING); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser1 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser1 has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - - runAs(new RunAsWork() - { - public Void doWork() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser2 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser2 has read permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, READ_RECORDS)); - - // Check if testUser2 has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - - // FIXME: Should be able to execute the action. Failing intermittently. - // Execute transfer complete action as testUser2 who has filing permissions on the transfer folder - // rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); - - return null; - } - }, testUser2); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.transfer; + +import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; +import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; +import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; +import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; +import static org.alfresco.util.GUID.generate; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Test case which shows that the user who did not create a transfer folder will + * be able to see and action on it if he gets filing permission on the transfer folder. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class FilingPermissionsOnTransferFolderTest extends BaseRMTestCase +{ + // Test users + private String testUser1 = null; + private String testUser2 = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + // Create test users + testUser1 = generate(); + createPerson(testUser1); + testUser2 = generate(); + createPerson(testUser2); + + // Join the RM site + siteService.setMembership(siteId, testUser1, SITE_CONSUMER); + siteService.setMembership(siteId, testUser2, SITE_CONSUMER); + + // Add the test users to RM Records Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); + } + + public void testFilingPermissionsOnTransferFolder() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) + { + // Records folder + private NodeRef recordsFolder = null; + + // Transfer folder + private NodeRef transferFolder = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() + */ + @Override + public void given() + { + runAs(new RunAsWork() + { + public Void doWork() + { + // Create category + NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); + + // Give filing permissions for the test users on the category + filePlanPermissionService.setPermission(category, testUser1, FILING); + filePlanPermissionService.setPermission(category, testUser2, FILING); + + // Create disposition schedule + utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); + + // Create folder + recordsFolder = recordFolderService.createRecordFolder(category, generate()); + + // Make eligible for cut off + Map params = new HashMap(1); + params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); + + // Cut off folder + rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); + + return null; + } + }, getAdminUserName()); + + // FIXME: This step should be executed in "when()". + transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() + */ + @Override + public void when() + { + // FIXME: If the transfer step is executed here the test fails. + //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); + + // Give testUser2 filing permissions on transfer folder + filePlanPermissionService.setPermission(transferFolder, testUser2, FILING); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() + */ + @Override + public void then() + { + // Check transfer folder + assertNotNull(transferFolder); + + // testUser1 should have read permissions on the transfers container + assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); + + // Check if testUser1 has filing permissions on the transfer folder + assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); + + runAs(new RunAsWork() + { + public Void doWork() + { + // Check transfer folder + assertNotNull(transferFolder); + + // testUser2 should have read permissions on the transfers container + assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); + + // Check if testUser2 has read permissions on the transfer folder + assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, READ_RECORDS)); + + // Check if testUser2 has filing permissions on the transfer folder + assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); + + // FIXME: Should be able to execute the action. Failing intermittently. + // Execute transfer complete action as testUser2 who has filing permissions on the transfer folder + // rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); + + return null; + } + }, testUser2); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolderTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolderTest.java index d826a576cb..e9915767ac 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolderTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolderTest.java @@ -1,190 +1,190 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.transfer; - -import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.service.cmr.security.AccessStatus.DENIED; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test case which shows that the user who did not create a transfer folder will not be able to see it. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class NoPermissionsOnTransferFolderTest extends BaseRMTestCase -{ - // Test users - private String testUser1 = null; - private String testUser2 = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test users - testUser1 = generate(); - createPerson(testUser1); - testUser2 = generate(); - createPerson(testUser2); - - // Join the RM site - siteService.setMembership(siteId, testUser1, SITE_CONSUMER); - siteService.setMembership(siteId, testUser2, SITE_CONSUMER); - - // Add the test users to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); - } - - public void testNoPermissionsOnTransferFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) - { - // Records folder - private NodeRef recordsFolder = null; - - // Transfer folder - private NodeRef transferFolder = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() - { - runAs(new RunAsWork() - { - public Void doWork() - { - // Create category - NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); - - // Give filing permissions for the test users on the category - filePlanPermissionService.setPermission(category, testUser1, FILING); - filePlanPermissionService.setPermission(category, testUser2, FILING); - - // Create disposition schedule - utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); - - // Create folder - recordsFolder = recordFolderService.createRecordFolder(category, generate()); - - // Make eligible for cut off - Map params = new HashMap(1); - params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); - - return null; - } - }, getAdminUserName()); - - // FIXME: This step should be executed in "when()". - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() - { - // FIXME: If the transfer step is executed here the test fails. - //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser1 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser1 has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - - runAs(new RunAsWork() - { - public Void doWork() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser2 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser2 has read permissions on the transfer folder - assertEquals(DENIED, permissionService.hasPermission(transferFolder, READ_RECORDS)); - - return null; - } - }, testUser2); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.transfer; + +import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; +import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; +import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; +import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; +import static org.alfresco.service.cmr.security.AccessStatus.DENIED; +import static org.alfresco.util.GUID.generate; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Test case which shows that the user who did not create a transfer folder will not be able to see it. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class NoPermissionsOnTransferFolderTest extends BaseRMTestCase +{ + // Test users + private String testUser1 = null; + private String testUser2 = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + // Create test users + testUser1 = generate(); + createPerson(testUser1); + testUser2 = generate(); + createPerson(testUser2); + + // Join the RM site + siteService.setMembership(siteId, testUser1, SITE_CONSUMER); + siteService.setMembership(siteId, testUser2, SITE_CONSUMER); + + // Add the test users to RM Records Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); + } + + public void testNoPermissionsOnTransferFolder() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) + { + // Records folder + private NodeRef recordsFolder = null; + + // Transfer folder + private NodeRef transferFolder = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() + */ + @Override + public void given() + { + runAs(new RunAsWork() + { + public Void doWork() + { + // Create category + NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); + + // Give filing permissions for the test users on the category + filePlanPermissionService.setPermission(category, testUser1, FILING); + filePlanPermissionService.setPermission(category, testUser2, FILING); + + // Create disposition schedule + utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); + + // Create folder + recordsFolder = recordFolderService.createRecordFolder(category, generate()); + + // Make eligible for cut off + Map params = new HashMap(1); + params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); + + // Cut off folder + rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); + + return null; + } + }, getAdminUserName()); + + // FIXME: This step should be executed in "when()". + transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() + */ + @Override + public void when() + { + // FIXME: If the transfer step is executed here the test fails. + //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() + */ + @Override + public void then() + { + // Check transfer folder + assertNotNull(transferFolder); + + // testUser1 should have read permissions on the transfers container + assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); + + // Check if testUser1 has filing permissions on the transfer folder + assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); + + runAs(new RunAsWork() + { + public Void doWork() + { + // Check transfer folder + assertNotNull(transferFolder); + + // testUser2 should have read permissions on the transfers container + assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); + + // Check if testUser2 has read permissions on the transfer folder + assertEquals(DENIED, permissionService.hasPermission(transferFolder, READ_RECORDS)); + + return null; + } + }, testUser2); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolderTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolderTest.java index f183134b43..67d1b3078c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolderTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolderTest.java @@ -1,210 +1,210 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.transfer; - -import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.service.cmr.security.AccessStatus.DENIED; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferCompleteAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test case which shows that the user who did not create a transfer folder will - * be able to see the transfer folder if he gets read permissions, but will not - * be able to action on it. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class ReadPermissionsOnTransferFolderTest extends BaseRMTestCase -{ - // Test users - private String testUser1 = null; - private String testUser2 = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test users - testUser1 = generate(); - createPerson(testUser1); - testUser2 = generate(); - createPerson(testUser2); - - // Join the RM site - siteService.setMembership(siteId, testUser1, SITE_CONSUMER); - siteService.setMembership(siteId, testUser2, SITE_CONSUMER); - - // Add the users to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); - } - - public void testReadPermissionsOnTransferFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) - { - // Records folder - private NodeRef recordsFolder = null; - - // Transfer folder - private NodeRef transferFolder = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() - { - runAs(new RunAsWork() - { - public Void doWork() - { - // Create category - NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); - - // Give filing permissions for the test users on the category - filePlanPermissionService.setPermission(category, testUser1, FILING); - filePlanPermissionService.setPermission(category, testUser2, FILING); - - // Create disposition schedule - utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); - - // Create folder - recordsFolder = recordFolderService.createRecordFolder(category, generate()); - - // Make eligible for cut off - Map params = new HashMap(1); - params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); - - return null; - } - }, getAdminUserName()); - - // FIXME: This step should be executed in "when()". - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() - { - // FIXME: If the transfer step is executed here the test fails. - //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - - // Give testUser2 read permissions on transfer folder - filePlanPermissionService.setPermission(transferFolder, testUser2, READ_RECORDS); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser1 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser1 has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - - runAs(new RunAsWork() - { - public Void doWork() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser2 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser2 has read permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, READ_RECORDS)); - - // Check if testUser2 filing permissions on the transfer folder - assertEquals(DENIED, permissionService.hasPermission(transferFolder, FILING)); - - // Try to execute transfer complete action as testUser2 who has no filing permissions on the transfer folder - try - { - rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); - } - catch (AccessDeniedException ade) - { - // Expected - } - - return null; - } - }, testUser2); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.transfer; + +import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; +import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; +import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; +import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; +import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; +import static org.alfresco.service.cmr.security.AccessStatus.DENIED; +import static org.alfresco.util.GUID.generate; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferCompleteAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Test case which shows that the user who did not create a transfer folder will + * be able to see the transfer folder if he gets read permissions, but will not + * be able to action on it. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class ReadPermissionsOnTransferFolderTest extends BaseRMTestCase +{ + // Test users + private String testUser1 = null; + private String testUser2 = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + // Create test users + testUser1 = generate(); + createPerson(testUser1); + testUser2 = generate(); + createPerson(testUser2); + + // Join the RM site + siteService.setMembership(siteId, testUser1, SITE_CONSUMER); + siteService.setMembership(siteId, testUser2, SITE_CONSUMER); + + // Add the users to RM Records Manager role + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); + } + + public void testReadPermissionsOnTransferFolder() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) + { + // Records folder + private NodeRef recordsFolder = null; + + // Transfer folder + private NodeRef transferFolder = null; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() + */ + @Override + public void given() + { + runAs(new RunAsWork() + { + public Void doWork() + { + // Create category + NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); + + // Give filing permissions for the test users on the category + filePlanPermissionService.setPermission(category, testUser1, FILING); + filePlanPermissionService.setPermission(category, testUser2, FILING); + + // Create disposition schedule + utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); + + // Create folder + recordsFolder = recordFolderService.createRecordFolder(category, generate()); + + // Make eligible for cut off + Map params = new HashMap(1); + params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); + + // Cut off folder + rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); + + return null; + } + }, getAdminUserName()); + + // FIXME: This step should be executed in "when()". + transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() + */ + @Override + public void when() + { + // FIXME: If the transfer step is executed here the test fails. + //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); + + // Give testUser2 read permissions on transfer folder + filePlanPermissionService.setPermission(transferFolder, testUser2, READ_RECORDS); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() + */ + @Override + public void then() + { + // Check transfer folder + assertNotNull(transferFolder); + + // testUser1 should have read permissions on the transfers container + assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); + + // Check if testUser1 has filing permissions on the transfer folder + assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); + + runAs(new RunAsWork() + { + public Void doWork() + { + // Check transfer folder + assertNotNull(transferFolder); + + // testUser2 should have read permissions on the transfers container + assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); + + // Check if testUser2 has read permissions on the transfer folder + assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, READ_RECORDS)); + + // Check if testUser2 filing permissions on the transfer folder + assertEquals(DENIED, permissionService.hasPermission(transferFolder, FILING)); + + // Try to execute transfer complete action as testUser2 who has no filing permissions on the transfer folder + try + { + rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); + } + catch (AccessDeniedException ade) + { + // Expected + } + + return null; + } + }, testUser2); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java index 93971f9b37..c1e30afc84 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java @@ -1,199 +1,199 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionType; - -/** - * AdHoc Recordable Versions Integration Test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class AdHocRecordableVersionsTest extends RecordableVersionsBaseTest -{ - /** - * Adhoc recorded version creation, with no policy defined as site collaborator - */ - public void testRecordAdHocVersionNoPolicy() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); - } - - public void when() - { - // create version - versionService.createVersion(dmDocument, versionProperties); - } - - public void then() - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - - /** - * Adhoc recordable version with recordable set as false - */ - public void testRecordableVersionFalseNoPolicy() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, false); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); - } - - public void when() - { - // create version - versionService.createVersion(dmDocument, versionProperties); - } - - public void then() - { - // check that the record has been recorded - checkNotRecordedAspect(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - - /** - * Test no file plan specified (and no default available) - */ - public void testNoFilePlan() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, dmCollaborator) - { - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - } - - public void when() - { - // create version - versionService.createVersion(dmDocument, versionProperties); - } - - public void then() - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - - }); - } - - /** - * Test recorded version with record metadata aspect (want to ensure additional non-rm URI properties and aspects - * don't find their way into the frozen state) - */ - public void testRecordedVersionWithRecordMetadataAspect() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); - } - - public void when() - { - // create version - final Version version = versionService.createVersion(dmDocument, versionProperties); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // add custom meta-data to record - NodeRef record = recordableVersionService.getVersionRecord(version); - assertNotNull(record); - recordService.addRecordType(record, TestModel.ASPECT_RECORD_METADATA); - nodeService.setProperty(record, TestModel.PROPERTY_RECORD_METADATA, "Peter Wetherall"); - - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - public void then() - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.version; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.version.VersionModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionType; + +/** + * AdHoc Recordable Versions Integration Test + * + * @author Roy Wetherall + * @since 2.3 + */ +public class AdHocRecordableVersionsTest extends RecordableVersionsBaseTest +{ + /** + * Adhoc recorded version creation, with no policy defined as site collaborator + */ + public void testRecordAdHocVersionNoPolicy() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private Map versionProperties; + + public void given() throws Exception + { + // setup version properties + versionProperties = new HashMap(4); + versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); + versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); + } + + public void when() + { + // create version + versionService.createVersion(dmDocument, versionProperties); + } + + public void then() + { + // check that the record has been recorded + checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); + } + }); + } + + /** + * Adhoc recordable version with recordable set as false + */ + public void testRecordableVersionFalseNoPolicy() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private Map versionProperties; + + public void given() throws Exception + { + // setup version properties + versionProperties = new HashMap(4); + versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, false); + versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); + } + + public void when() + { + // create version + versionService.createVersion(dmDocument, versionProperties); + } + + public void then() + { + // check that the record has been recorded + checkNotRecordedAspect(dmDocument, DESCRIPTION, "0.1"); + } + }); + } + + /** + * Test no file plan specified (and no default available) + */ + public void testNoFilePlan() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, dmCollaborator) + { + private Map versionProperties; + + public void given() throws Exception + { + // setup version properties + versionProperties = new HashMap(4); + versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); + } + + public void when() + { + // create version + versionService.createVersion(dmDocument, versionProperties); + } + + public void then() + { + // check that the record has been recorded + checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); + } + + }); + } + + /** + * Test recorded version with record metadata aspect (want to ensure additional non-rm URI properties and aspects + * don't find their way into the frozen state) + */ + public void testRecordedVersionWithRecordMetadataAspect() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private Map versionProperties; + + public void given() throws Exception + { + // setup version properties + versionProperties = new HashMap(4); + versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); + versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); + } + + public void when() + { + // create version + final Version version = versionService.createVersion(dmDocument, versionProperties); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // add custom meta-data to record + NodeRef record = recordableVersionService.getVersionRecord(version); + assertNotNull(record); + recordService.addRecordType(record, TestModel.ASPECT_RECORD_METADATA); + nodeService.setProperty(record, TestModel.PROPERTY_RECORD_METADATA, "Peter Wetherall"); + + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + + public void then() + { + // check that the record has been recorded + checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); + } + }); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java index ce0316e491..36485a2518 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java @@ -1,179 +1,179 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.version; - -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.util.PropertyMap; - -/** - * Auto Recordable Versions Integration Test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class AutoRecordableVersionsTest extends RecordableVersionsBaseTest -{ - /** example content */ - public final static String MY_NEW_CONTENT = "this is some new content that I have changed to trigger auto version"; - - /** - * Given that all revisions will be recorded, - * When I update the content of a document, - * Then a recorded version will be created - */ - public void testAutoVersionRecordAllRevisions() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - public void given() throws Exception - { - // set the recordable version policy - PropertyMap recordableVersionProperties = new PropertyMap(1); - recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); - nodeService.addAspect(dmDocument, RecordableVersionModel.ASPECT_VERSIONABLE, recordableVersionProperties); - - // make the node versionable - PropertyMap versionableProperties = new PropertyMap(1); - versionableProperties.put(ContentModel.PROP_INITIAL_VERSION, false); - nodeService.addAspect(dmDocument, ContentModel.ASPECT_VERSIONABLE, versionableProperties); - } - - public void when() - { - // generate new version by updating content - ContentWriter writer = contentService.getWriter(dmDocument, ContentModel.PROP_CONTENT, true); - writer.putContent(MY_NEW_CONTENT); - } - - public void then() - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, null, "0.1"); - } - }); - } - - /** - * Given that all revisions will be automatically recorded, - * When I update a document 3 times, - * Then all 3 created records will be related together using the "VersionedBy" relationship - */ - public void testVersionRecordsRelated() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator, false) - { - /** given **/ - public void given() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - // set the recordable version policy - PropertyMap recordableVersionProperties = new PropertyMap(1); - recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); - nodeService.addAspect(dmDocument, RecordableVersionModel.ASPECT_VERSIONABLE, recordableVersionProperties); - - // make the node versionable - PropertyMap versionableProperties = new PropertyMap(1); - versionableProperties.put(ContentModel.PROP_INITIAL_VERSION, false); - nodeService.addAspect(dmDocument, ContentModel.ASPECT_VERSIONABLE, versionableProperties); - } - }); - } - - /** when **/ - public void when() - { - // update the content 3 times - updateContent(); - updateContent(); - updateContent(); - } - - /** then */ - public void then() - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, null, "0.3"); - - Version version = versionService.getCurrentVersion(dmDocument); - NodeRef record = recordableVersionService.getVersionRecord(version); - - boolean foundPrevious = false; - Set relationships = relationshipService.getRelationshipsFrom(record); - assertNotNull(relationships); - assertEquals(1, relationships.size()); - for (Relationship relationship : relationships) - { - if (relationship.getUniqueName().equals(CUSTOM_REF_VERSIONS.getLocalName())) - { - NodeRef previousVersionRecord = relationship.getTarget(); - assertNotNull(previousVersionRecord); - foundPrevious = true; - } - } - assertTrue(foundPrevious); - } - }); - } - - /** - * Helper method to update content of dmDocument - */ - private void updateContent() - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - ContentWriter writer = contentService.getWriter(dmDocument, ContentModel.PROP_CONTENT, true); - writer.putContent(MY_NEW_CONTENT); - } - }); - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.version; + +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.util.PropertyMap; + +/** + * Auto Recordable Versions Integration Test + * + * @author Roy Wetherall + * @since 2.3 + */ +public class AutoRecordableVersionsTest extends RecordableVersionsBaseTest +{ + /** example content */ + public final static String MY_NEW_CONTENT = "this is some new content that I have changed to trigger auto version"; + + /** + * Given that all revisions will be recorded, + * When I update the content of a document, + * Then a recorded version will be created + */ + public void testAutoVersionRecordAllRevisions() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + public void given() throws Exception + { + // set the recordable version policy + PropertyMap recordableVersionProperties = new PropertyMap(1); + recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); + recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); + nodeService.addAspect(dmDocument, RecordableVersionModel.ASPECT_VERSIONABLE, recordableVersionProperties); + + // make the node versionable + PropertyMap versionableProperties = new PropertyMap(1); + versionableProperties.put(ContentModel.PROP_INITIAL_VERSION, false); + nodeService.addAspect(dmDocument, ContentModel.ASPECT_VERSIONABLE, versionableProperties); + } + + public void when() + { + // generate new version by updating content + ContentWriter writer = contentService.getWriter(dmDocument, ContentModel.PROP_CONTENT, true); + writer.putContent(MY_NEW_CONTENT); + } + + public void then() + { + // check that the record has been recorded + checkRecordedVersion(dmDocument, null, "0.1"); + } + }); + } + + /** + * Given that all revisions will be automatically recorded, + * When I update a document 3 times, + * Then all 3 created records will be related together using the "VersionedBy" relationship + */ + public void testVersionRecordsRelated() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator, false) + { + /** given **/ + public void given() throws Exception + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + // set the recordable version policy + PropertyMap recordableVersionProperties = new PropertyMap(1); + recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); + recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); + nodeService.addAspect(dmDocument, RecordableVersionModel.ASPECT_VERSIONABLE, recordableVersionProperties); + + // make the node versionable + PropertyMap versionableProperties = new PropertyMap(1); + versionableProperties.put(ContentModel.PROP_INITIAL_VERSION, false); + nodeService.addAspect(dmDocument, ContentModel.ASPECT_VERSIONABLE, versionableProperties); + } + }); + } + + /** when **/ + public void when() + { + // update the content 3 times + updateContent(); + updateContent(); + updateContent(); + } + + /** then */ + public void then() + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + // check that the record has been recorded + checkRecordedVersion(dmDocument, null, "0.3"); + + Version version = versionService.getCurrentVersion(dmDocument); + NodeRef record = recordableVersionService.getVersionRecord(version); + + boolean foundPrevious = false; + Set relationships = relationshipService.getRelationshipsFrom(record); + assertNotNull(relationships); + assertEquals(1, relationships.size()); + for (Relationship relationship : relationships) + { + if (relationship.getUniqueName().equals(CUSTOM_REF_VERSIONS.getLocalName())) + { + NodeRef previousVersionRecord = relationship.getTarget(); + assertNotNull(previousVersionRecord); + foundPrevious = true; + } + } + assertTrue(foundPrevious); + } + }); + } + + /** + * Helper method to update content of dmDocument + */ + private void updateContent() + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + ContentWriter writer = contentService.getWriter(dmDocument, ContentModel.PROP_CONTENT, true); + writer.putContent(MY_NEW_CONTENT); + } + }); + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoVersionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoVersionTest.java index 4cac9a8a24..ef28e59fe7 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoVersionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoVersionTest.java @@ -1,240 +1,240 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.version.ExtendedVersionableAspect; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Test recorded version histories when interacting with cm:versionable aspect - * and the auto-version behvaiour. - * - * @author Roy Wetherall - * @since 2.3.1 - */ -public class AutoVersionTest extends RecordableVersionsBaseTest -{ - /** - * Given a versionable document - * When I specialise the type of the document - * Then the version history has only one initial version - * And it does not represent the current type of the document - */ - public void testSpecialisedNodeInitialVersionCreated() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef myDocument; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); - } - - public void when() - { - // specialise document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - } - - public void then() - { - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - - assertNotNull(versionHistory); - assertEquals(1, versionHistory.getAllVersions().size()); - - NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); - assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState)); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); - } - }); - } - - /** - * Given a versionable document with initial version turned off - * When I specialise the type of the document - * Then the version history remains empty - */ - public void testSpecialisedNodeInitialVersionNotCreated() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef myDocument; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - Map props = new HashMap(1); - props.put(ContentModel.PROP_INITIAL_VERSION, false); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); - } - - public void when() - { - // specialise document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - } - - public void then() - { - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNull(versionHistory); - } - }); - } - - /** - * Given a versionable document with initial version turned off - * And auto version on type change is set on - * When I specialise the type of the document - * Then the version history contains the initial version - */ - public void testSpecialisedNodeInitialVersionNotCreatedOnTypeChangeOn() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private ExtendedVersionableAspect extendedVersionableAspect; - private NodeRef myDocument; - - public void given() throws Exception - { - // turn auto version on type change on - extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect"); - assertNotNull(extendedVersionableAspect); - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - Map props = new HashMap(1); - props.put(ContentModel.PROP_INITIAL_VERSION, false); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); - } - - public void when() - { - // specialise document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - } - - public void then() - { - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(1, versionHistory.getAllVersions().size()); - - NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState)); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); - } - - public void after() throws Exception - { - // reset auto version on type to default off - extendedVersionableAspect.setAutoVersionOnTypeChange(false); - } - }); - } - - /** - * Given a versionable document with initial version turned on - * And auto version on type change is set on - * When I specialise the type of the document - * Then the version history contains the initial version - */ - public void testSpecialisedNodeInitialVersionCreatedOnTypeChangeOn() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private ExtendedVersionableAspect extendedVersionableAspect; - private NodeRef myDocument; - - public void given() throws Exception - { - // turn auto version on type change on - extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect"); - assertNotNull(extendedVersionableAspect); - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - Map props = new HashMap(1); - props.put(ContentModel.PROP_INITIAL_VERSION, true); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); - } - - public void when() - { - // specialise document - nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); - } - - public void then() - { - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(2, versionHistory.getAllVersions().size()); - - NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState)); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); - - frozenState = versionHistory.getVersion("1.0").getFrozenStateNodeRef(); - assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState)); - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); - } - - public void after() throws Exception - { - // reset auto version on type to default off - extendedVersionableAspect.setAutoVersionOnTypeChange(false); - } - }); - } - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.version; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.version.ExtendedVersionableAspect; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.VersionHistory; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * Test recorded version histories when interacting with cm:versionable aspect + * and the auto-version behvaiour. + * + * @author Roy Wetherall + * @since 2.3.1 + */ +public class AutoVersionTest extends RecordableVersionsBaseTest +{ + /** + * Given a versionable document + * When I specialise the type of the document + * Then the version history has only one initial version + * And it does not represent the current type of the document + */ + public void testSpecialisedNodeInitialVersionCreated() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private NodeRef myDocument; + + public void given() throws Exception + { + // create a document + myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + // make versionable + nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); + } + + public void when() + { + // specialise document + nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); + } + + public void then() + { + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + + assertNotNull(versionHistory); + assertEquals(1, versionHistory.getAllVersions().size()); + + NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); + assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState)); + assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); + } + }); + } + + /** + * Given a versionable document with initial version turned off + * When I specialise the type of the document + * Then the version history remains empty + */ + public void testSpecialisedNodeInitialVersionNotCreated() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private NodeRef myDocument; + + public void given() throws Exception + { + // create a document + myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + // make versionable + Map props = new HashMap(1); + props.put(ContentModel.PROP_INITIAL_VERSION, false); + nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); + } + + public void when() + { + // specialise document + nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); + } + + public void then() + { + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + assertNull(versionHistory); + } + }); + } + + /** + * Given a versionable document with initial version turned off + * And auto version on type change is set on + * When I specialise the type of the document + * Then the version history contains the initial version + */ + public void testSpecialisedNodeInitialVersionNotCreatedOnTypeChangeOn() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private ExtendedVersionableAspect extendedVersionableAspect; + private NodeRef myDocument; + + public void given() throws Exception + { + // turn auto version on type change on + extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect"); + assertNotNull(extendedVersionableAspect); + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // create a document + myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + // make versionable + Map props = new HashMap(1); + props.put(ContentModel.PROP_INITIAL_VERSION, false); + nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); + } + + public void when() + { + // specialise document + nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); + } + + public void then() + { + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + assertNotNull(versionHistory); + assertEquals(1, versionHistory.getAllVersions().size()); + + NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); + assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState)); + assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); + } + + public void after() throws Exception + { + // reset auto version on type to default off + extendedVersionableAspect.setAutoVersionOnTypeChange(false); + } + }); + } + + /** + * Given a versionable document with initial version turned on + * And auto version on type change is set on + * When I specialise the type of the document + * Then the version history contains the initial version + */ + public void testSpecialisedNodeInitialVersionCreatedOnTypeChangeOn() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private ExtendedVersionableAspect extendedVersionableAspect; + private NodeRef myDocument; + + public void given() throws Exception + { + // turn auto version on type change on + extendedVersionableAspect = (ExtendedVersionableAspect)applicationContext.getBean("rm.extendedVersionableAspect"); + assertNotNull(extendedVersionableAspect); + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // create a document + myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + // make versionable + Map props = new HashMap(1); + props.put(ContentModel.PROP_INITIAL_VERSION, true); + nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, props); + } + + public void when() + { + // specialise document + nodeService.setType(myDocument, TYPE_CUSTOM_TYPE); + } + + public void then() + { + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + assertNotNull(versionHistory); + assertEquals(2, versionHistory.getAllVersions().size()); + + NodeRef frozenState = versionHistory.getHeadVersion().getFrozenStateNodeRef(); + assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(frozenState)); + assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); + + frozenState = versionHistory.getVersion("1.0").getFrozenStateNodeRef(); + assertEquals(ContentModel.TYPE_CONTENT, nodeService.getType(frozenState)); + assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(myDocument)); + } + + public void after() throws Exception + { + // reset auto version on type to default off + extendedVersionableAspect.setAutoVersionOnTypeChange(false); + } + }); + } + + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java index 3e644a846f..596d569525 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java @@ -1,217 +1,217 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionType; -import org.alfresco.util.GUID; - -/** - * Declare as record version integration tests - * - * @author Roy Wetherall - * @since 2.3 - */ -public class DeclareAsRecordVersionTest extends RecordableVersionsBaseTest -{ - /** recordable version service */ - private RecordableVersionService recordableVersionService; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - recordableVersionService = (RecordableVersionService)applicationContext.getBean("RecordableVersionService"); - } - - /** - * Given versionable content with a non-recorded latest version - * When I declare a version record - * Then the latest version is recorded and a record is created - */ - public void testDeclareLatestVersionAsRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef versionRecord; - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // create version - versionService.createVersion(dmDocument, versionProperties); - - // assert that the latest version is not recorded - assertFalse(recordableVersionService.isCurrentVersionRecorded(dmDocument)); - } - - public void when() - { - // create version record from latest version - versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, dmDocument); - } - - public void then() - { - // check the created record - assertNotNull(versionRecord); - assertTrue(recordService.isRecord(versionRecord)); - - // assert the current version is recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); - - // check the recorded version - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - - /** - * Given versionable content with a recorded latest version - * When I declare a version record - * Then nothing happens since the latest version is already recorded - * And a warning is logged - */ - public void testDeclareLatestVersionAsRecordButAlreadyRecorded() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef versionRecord; - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); - - // create version - versionService.createVersion(dmDocument, versionProperties); - - // assert that the latest version is not recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); - } - - public void when() - { - // create version record from latest version - versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, dmDocument); - } - - public void then() - { - // check that a record was not created - assertNull(versionRecord); - - // assert the current version is recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); - - // check the recorded version - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - - /** - * Given that a document is a specialized type - * When version is declared as a record - * Then the record is the same type as the source document - * - * @see https://issues.alfresco.com/jira/browse/RM-2194 - */ - public void testSpecializedContentType() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef customDocument; - private NodeRef versionRecord; - private Map versionProperties; - - public void given() throws Exception - { - // create content - customDocument = fileFolderService.create(dmFolder, GUID.generate(), TYPE_CUSTOM_TYPE).getNodeRef(); - prepareContent(customDocument); - - // setup version properties - versionProperties = new HashMap(2); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // create version - versionService.createVersion(customDocument, versionProperties); - - // assert that the latest version is not recorded - assertFalse(recordableVersionService.isCurrentVersionRecorded(customDocument)); - } - - public void when() - { - // create version record from latest version - versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, customDocument); - } - - public void then() - { - // check the created record - assertNotNull(versionRecord); - assertTrue(recordService.isRecord(versionRecord)); - - // check the record type is correct - assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(versionRecord)); - - // assert the current version is recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(customDocument)); - - // check the recorded version - checkRecordedVersion(customDocument, DESCRIPTION, "0.1"); - } - }); - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.version; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; +import org.alfresco.repo.version.VersionModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionType; +import org.alfresco.util.GUID; + +/** + * Declare as record version integration tests + * + * @author Roy Wetherall + * @since 2.3 + */ +public class DeclareAsRecordVersionTest extends RecordableVersionsBaseTest +{ + /** recordable version service */ + private RecordableVersionService recordableVersionService; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() + */ + @Override + protected void initServices() + { + super.initServices(); + recordableVersionService = (RecordableVersionService)applicationContext.getBean("RecordableVersionService"); + } + + /** + * Given versionable content with a non-recorded latest version + * When I declare a version record + * Then the latest version is recorded and a record is created + */ + public void testDeclareLatestVersionAsRecord() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private NodeRef versionRecord; + private Map versionProperties; + + public void given() throws Exception + { + // setup version properties + versionProperties = new HashMap(4); + versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + + // create version + versionService.createVersion(dmDocument, versionProperties); + + // assert that the latest version is not recorded + assertFalse(recordableVersionService.isCurrentVersionRecorded(dmDocument)); + } + + public void when() + { + // create version record from latest version + versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, dmDocument); + } + + public void then() + { + // check the created record + assertNotNull(versionRecord); + assertTrue(recordService.isRecord(versionRecord)); + + // assert the current version is recorded + assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); + + // check the recorded version + checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); + } + }); + } + + /** + * Given versionable content with a recorded latest version + * When I declare a version record + * Then nothing happens since the latest version is already recorded + * And a warning is logged + */ + public void testDeclareLatestVersionAsRecordButAlreadyRecorded() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private NodeRef versionRecord; + private Map versionProperties; + + public void given() throws Exception + { + // setup version properties + versionProperties = new HashMap(4); + versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); + versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); + + // create version + versionService.createVersion(dmDocument, versionProperties); + + // assert that the latest version is not recorded + assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); + } + + public void when() + { + // create version record from latest version + versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, dmDocument); + } + + public void then() + { + // check that a record was not created + assertNull(versionRecord); + + // assert the current version is recorded + assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); + + // check the recorded version + checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); + } + }); + } + + /** + * Given that a document is a specialized type + * When version is declared as a record + * Then the record is the same type as the source document + * + * @see https://issues.alfresco.com/jira/browse/RM-2194 + */ + public void testSpecializedContentType() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) + { + private NodeRef customDocument; + private NodeRef versionRecord; + private Map versionProperties; + + public void given() throws Exception + { + // create content + customDocument = fileFolderService.create(dmFolder, GUID.generate(), TYPE_CUSTOM_TYPE).getNodeRef(); + prepareContent(customDocument); + + // setup version properties + versionProperties = new HashMap(2); + versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + + // create version + versionService.createVersion(customDocument, versionProperties); + + // assert that the latest version is not recorded + assertFalse(recordableVersionService.isCurrentVersionRecorded(customDocument)); + } + + public void when() + { + // create version record from latest version + versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, customDocument); + } + + public void then() + { + // check the created record + assertNotNull(versionRecord); + assertTrue(recordService.isRecord(versionRecord)); + + // check the record type is correct + assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(versionRecord)); + + // assert the current version is recorded + assertTrue(recordableVersionService.isCurrentVersionRecorded(customDocument)); + + // check the recorded version + checkRecordedVersion(customDocument, DESCRIPTION, "0.1"); + } + }); + + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeleteRecordVersionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeleteRecordVersionTest.java index bb60ec9413..c5a948b1bb 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeleteRecordVersionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeleteRecordVersionTest.java @@ -1,513 +1,513 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.version; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Recordable version history integration tests. - * - * @author Roy Wetherall - * @since 2.3.1 - */ -public class DeleteRecordVersionTest extends RecordableVersionsBaseTest -{ - /** - * Given that a document is created - * And the initial version is record - * When I delete the version record - * Then the version is deleted - * And the version history is not deleted - * - * @see https://issues.alfresco.com/jira/browse/RM-2562 - */ - public void testDeleteFirstRecordedVersion() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef myDocument; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - // make versionable - Map props = new HashMap(2); - props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); - nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); - } - - public void when() - { - // check the initial version label - assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); - - // check that the version history contains a single version that is recorded - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(1, versionHistory.getAllVersions().size()); - - // check the recorded version is not marked as destroyed - Version head = versionHistory.getHeadVersion(); - assertNotNull(head); - assertFalse(recordableVersionService.isRecordedVersionDestroyed(head)); - - // check the version record - NodeRef record = recordableVersionService.getVersionRecord(head); - assertTrue(recordService.isRecord(record)); - - // record should not have a version history because it is immutable - assertFalse(nodeService.hasAspect(record, ContentModel.ASPECT_VERSIONABLE)); - VersionHistory recordVersionHistory = versionService.getVersionHistory(record); - assertNull(recordVersionHistory); - - // destroy record - nodeService.deleteNode(record); - } - - public void then() - { - // document is still versionable - assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE)); - - // check the initial version label - assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); - - // still has a version history, but the version is marked as destroyed - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(1, versionHistory.getAllVersions().size()); - - // check the recorded version is marked as destroyed and the record version is not longer available - Version version = versionHistory.getHeadVersion(); - assertNotNull(version); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version)); - assertNull(recordableVersionService.getVersionRecord(version)); - } - }); - } - - /** - * Given that a document is created - * And the initial version is record - * And the associated version record is deleted - * When a new version is created - * Then a new associated version record is created - * And the version is 1.1 (not 1.0 since this was deleted, but the version history maintained) - * - * @see https://issues.alfresco.com/jira/browse/RM-2562 - */ - public void testDeleteFirstRecordedVersionAndCreateNewVersion() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef myDocument; - - public void given() throws Exception - { - // create a document - myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - ContentWriter writer = fileFolderService.getWriter(myDocument); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(GUID.generate()); - - // make versionable - Map props = new HashMap(2); - props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); - nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props); - nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); - } - - public void when() - { - // get the created version record - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - Version head = versionHistory.getHeadVersion(); - NodeRef record = recordableVersionService.getVersionRecord(head); - - // destroy record - nodeService.deleteNode(record); - - // update the content to create a new version (and version record) - ContentWriter writer = fileFolderService.getWriter(myDocument); - writer.putContent(GUID.generate()); - } - - public void then() - { - // document is still versionable - assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE)); - - // check the version number has been incremented - assertEquals("1.1", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); - - // still has a version history, with 2 enties - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - assertEquals(2, versionHistory.getAllVersions().size()); - - // latest version is current - Version head = versionHistory.getHeadVersion(); - assertFalse(recordableVersionService.isRecordedVersionDestroyed(head)); - assertNotNull(recordableVersionService.getVersionRecord(head)); - - // first version is destroyed - Version destroyed = versionHistory.getPredecessor(head); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(destroyed)); - assertNull(recordableVersionService.getVersionRecord(destroyed)); - - // get the version record for the current version - NodeRef versionRecord = recordableVersionService.getVersionRecord(head); - assertNotNull(versionRecord); - assertTrue(nodeService.exists(versionRecord)); - - Set from = relationshipService.getRelationshipsFrom(versionRecord); - assertTrue(from.isEmpty()); - - Set to = relationshipService.getRelationshipsTo(versionRecord); - assertTrue(to.isEmpty()); - } - }); - } - - /** - * Given a chain of version records (1.0, 1.1, 1.2) which are all related - * When I delete version record 1.0 - * Then 1.1 is the oldest version - */ - public void testDeleteOldestVersion() - { - final NodeRef myDocument = createDocumentWithRecordVersions(); - - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private VersionHistory versionHistory; - - public void given() throws Exception - { - // get version history - versionHistory = versionService.getVersionHistory(myDocument); - } - - public void when() - { - Version version10 = versionHistory.getVersion("1.0"); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - - // delete record version 1.0 - nodeService.deleteNode(recordVersion10); - } - - public void then() - { - // check the deleted version - Version version10 = versionHistory.getVersion("1.0"); - assertNotNull(version10); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version10)); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNull(recordVersion10); - - // verify 1.2 setup as expected - Version version12 = versionHistory.getHeadVersion(); - assertEquals("1.2", version12.getVersionLabel()); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - assertNotNull(recordVersion12); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - - Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, from12.size()); - - // verify 1.1 setup as expected - Version version11 = versionHistory.getPredecessor(version12); - assertEquals("1.1", version11.getVersionLabel()); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - assertNotNull(recordVersion11); - - Set to11 = relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, to11.size()); - assertEquals(recordVersion12, to11.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - } - }); - } - - /** - * Given a chain of version records (1.0, 1.1, 1.2) which are all related - * When I delete version record 1.1 - * Then 1.2 now 'versions' 1.0 - */ - public void testDeleteMiddleVersion() - { - final NodeRef myDocument = createDocumentWithRecordVersions(); - - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private VersionHistory versionHistory; - - public void given() throws Exception - { - // get version history - versionHistory = versionService.getVersionHistory(myDocument); - } - - public void when() - { - Version version11 = versionHistory.getVersion("1.1"); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - - // delete record version 1.1 - nodeService.deleteNode(recordVersion11); - } - - public void then() - { - // check the deleted version - Version version11 = versionHistory.getVersion("1.1"); - assertNotNull(version11); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11)); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - assertNull(recordVersion11); - - // verify 1.2 setup as expected - Version version12 = versionHistory.getHeadVersion(); - assertEquals("1.2", version12.getVersionLabel()); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - assertNotNull(recordVersion12); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - - Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, from12.size()); - - // verify 1.0 setup as expected - Version version10 = versionHistory.getVersion("1.0"); - assertEquals("1.0", version10.getVersionLabel()); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNotNull(recordVersion10); - - Set to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, to10.size()); - assertEquals(recordVersion12, to10.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - - } - }); - } - - /** - * Given a chain of version records (1.0, 1.1, 1.2) which are all related - * When I delete version record 1.2 - * Then 1.1 is the most recent version - */ - public void testDeleteCurrentVersion() - { - final NodeRef myDocument = createDocumentWithRecordVersions(); - - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private VersionHistory versionHistory; - - public void given() throws Exception - { - // get version history - versionHistory = versionService.getVersionHistory(myDocument); - } - - public void when() - { - Version version12 = versionHistory.getVersion("1.2"); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - - // delete record version 1.2 - nodeService.deleteNode(recordVersion12); - } - - public void then() - { - // check 1.2 - Version version12 = versionHistory.getVersion("1.2"); - assertNotNull(version12); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version12)); - assertNull(recordableVersionService.getVersionRecord(version12)); - - // verify 1.1 - Version version11 = versionHistory.getVersion("1.1"); - assertNotNull(version11); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - assertNotNull(recordVersion11); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - - Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, from11.size()); - - // verify 1.0 - Version version10 = versionHistory.getVersion("1.0"); - assertNotNull(version10); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNotNull(recordVersion10); - - Set to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS); - assertEquals(1, to10.size()); - assertEquals(recordVersion11, to10.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); - } - }); - } - - /** - * Given that a version record - * When the version record is destroyed whilst retaining the meta data - * Then the version is marked as destroyed in the collab version history - */ - public void testDestroyVersionRecordWithMetadata() - { - final NodeRef myDocument = createDocumentWithRecordVersions(); - - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private VersionHistory versionHistory; - private NodeRef recordVersion11; - - public void given() throws Exception - { - // create file plan structure - NodeRef myCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createBasicDispositionSchedule(myCategory, GUID.generate(), GUID.generate(), true, true); - - NodeRef myRecordFolder = recordFolderService.createRecordFolder(myCategory, GUID.generate()); - - // get version history - versionHistory = versionService.getVersionHistory(myDocument); - - // file and complete all the version records into my record folder - for (Version version : versionHistory.getAllVersions()) - { - NodeRef record = recordableVersionService.getVersionRecord(version); - fileFolderService.move(record, myRecordFolder, null); - utils.completeRecord(record); - } - } - - public void when() - { - Version version11 = versionHistory.getVersion("1.1"); - recordVersion11 = recordableVersionService.getVersionRecord(version11); - - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordVersion11, CompleteEventAction.NAME, params); - - rmActionService.executeRecordsManagementAction(recordVersion11, CutOffAction.NAME); - - rmActionService.executeRecordsManagementAction(recordVersion11, DestroyAction.NAME); - } - - public void then() - { - // verify that the version history looks as expected - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - Collection versions = versionHistory.getAllVersions(); - assertEquals(3, versions.size()); - - // verify 1.2 setup as expected - Version version12 = versionHistory.getHeadVersion(); - assertEquals("1.2", version12.getVersionLabel()); - assertFalse(recordableVersionService.isRecordedVersionDestroyed(version12)); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - assertNotNull(recordVersion12); - assertFalse(recordService.isMetadataStub(recordVersion12)); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion12, "versions").isEmpty()); - - Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, "versions"); - assertEquals(1, from12.size()); - - // verify 1.1 setup as expected - Version version11 = versionHistory.getPredecessor(version12); - assertEquals("1.1", version11.getVersionLabel()); - assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11)); - assertNotNull(recordVersion11); - assertTrue(recordService.isMetadataStub(recordVersion11)); - - Set to11 = relationshipService.getRelationshipsTo(recordVersion11, "versions"); - assertEquals(1, to11.size()); - assertEquals(recordVersion12, to11.iterator().next().getSource()); - - Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, "versions"); - assertEquals(1, from11.size()); - - // verify 1.0 setup as expected - Version version10 = versionHistory.getPredecessor(version11); - assertEquals("1.0", version10.getVersionLabel()); - assertFalse(recordableVersionService.isRecordedVersionDestroyed(version10)); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNotNull(recordVersion10); - assertFalse(recordService.isMetadataStub(recordVersion10)); - - Set to10 = relationshipService.getRelationshipsTo(recordVersion10, "versions"); - assertEquals(1, to10.size()); - assertEquals(recordVersion11, to10.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, "versions").isEmpty()); - - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.version; + +import java.io.Serializable; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; +import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionHistory; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * Recordable version history integration tests. + * + * @author Roy Wetherall + * @since 2.3.1 + */ +public class DeleteRecordVersionTest extends RecordableVersionsBaseTest +{ + /** + * Given that a document is created + * And the initial version is record + * When I delete the version record + * Then the version is deleted + * And the version history is not deleted + * + * @see https://issues.alfresco.com/jira/browse/RM-2562 + */ + public void testDeleteFirstRecordedVersion() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef myDocument; + + public void given() throws Exception + { + // create a document + myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + // make versionable + Map props = new HashMap(2); + props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); + props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); + nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props); + nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); + } + + public void when() + { + // check the initial version label + assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); + + // check that the version history contains a single version that is recorded + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + assertNotNull(versionHistory); + assertEquals(1, versionHistory.getAllVersions().size()); + + // check the recorded version is not marked as destroyed + Version head = versionHistory.getHeadVersion(); + assertNotNull(head); + assertFalse(recordableVersionService.isRecordedVersionDestroyed(head)); + + // check the version record + NodeRef record = recordableVersionService.getVersionRecord(head); + assertTrue(recordService.isRecord(record)); + + // record should not have a version history because it is immutable + assertFalse(nodeService.hasAspect(record, ContentModel.ASPECT_VERSIONABLE)); + VersionHistory recordVersionHistory = versionService.getVersionHistory(record); + assertNull(recordVersionHistory); + + // destroy record + nodeService.deleteNode(record); + } + + public void then() + { + // document is still versionable + assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE)); + + // check the initial version label + assertEquals("1.0", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); + + // still has a version history, but the version is marked as destroyed + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + assertNotNull(versionHistory); + assertEquals(1, versionHistory.getAllVersions().size()); + + // check the recorded version is marked as destroyed and the record version is not longer available + Version version = versionHistory.getHeadVersion(); + assertNotNull(version); + assertTrue(recordableVersionService.isRecordedVersionDestroyed(version)); + assertNull(recordableVersionService.getVersionRecord(version)); + } + }); + } + + /** + * Given that a document is created + * And the initial version is record + * And the associated version record is deleted + * When a new version is created + * Then a new associated version record is created + * And the version is 1.1 (not 1.0 since this was deleted, but the version history maintained) + * + * @see https://issues.alfresco.com/jira/browse/RM-2562 + */ + public void testDeleteFirstRecordedVersionAndCreateNewVersion() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef myDocument; + + public void given() throws Exception + { + // create a document + myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + ContentWriter writer = fileFolderService.getWriter(myDocument); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.putContent(GUID.generate()); + + // make versionable + Map props = new HashMap(2); + props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); + props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); + nodeService.addAspect(myDocument, RecordableVersionModel.ASPECT_VERSIONABLE, props); + nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null); + } + + public void when() + { + // get the created version record + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + Version head = versionHistory.getHeadVersion(); + NodeRef record = recordableVersionService.getVersionRecord(head); + + // destroy record + nodeService.deleteNode(record); + + // update the content to create a new version (and version record) + ContentWriter writer = fileFolderService.getWriter(myDocument); + writer.putContent(GUID.generate()); + } + + public void then() + { + // document is still versionable + assertTrue(nodeService.hasAspect(myDocument, ContentModel.ASPECT_VERSIONABLE)); + + // check the version number has been incremented + assertEquals("1.1", nodeService.getProperty(myDocument, ContentModel.PROP_VERSION_LABEL)); + + // still has a version history, with 2 enties + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + assertNotNull(versionHistory); + assertEquals(2, versionHistory.getAllVersions().size()); + + // latest version is current + Version head = versionHistory.getHeadVersion(); + assertFalse(recordableVersionService.isRecordedVersionDestroyed(head)); + assertNotNull(recordableVersionService.getVersionRecord(head)); + + // first version is destroyed + Version destroyed = versionHistory.getPredecessor(head); + assertTrue(recordableVersionService.isRecordedVersionDestroyed(destroyed)); + assertNull(recordableVersionService.getVersionRecord(destroyed)); + + // get the version record for the current version + NodeRef versionRecord = recordableVersionService.getVersionRecord(head); + assertNotNull(versionRecord); + assertTrue(nodeService.exists(versionRecord)); + + Set from = relationshipService.getRelationshipsFrom(versionRecord); + assertTrue(from.isEmpty()); + + Set to = relationshipService.getRelationshipsTo(versionRecord); + assertTrue(to.isEmpty()); + } + }); + } + + /** + * Given a chain of version records (1.0, 1.1, 1.2) which are all related + * When I delete version record 1.0 + * Then 1.1 is the oldest version + */ + public void testDeleteOldestVersion() + { + final NodeRef myDocument = createDocumentWithRecordVersions(); + + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private VersionHistory versionHistory; + + public void given() throws Exception + { + // get version history + versionHistory = versionService.getVersionHistory(myDocument); + } + + public void when() + { + Version version10 = versionHistory.getVersion("1.0"); + NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); + + // delete record version 1.0 + nodeService.deleteNode(recordVersion10); + } + + public void then() + { + // check the deleted version + Version version10 = versionHistory.getVersion("1.0"); + assertNotNull(version10); + assertTrue(recordableVersionService.isRecordedVersionDestroyed(version10)); + NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); + assertNull(recordVersion10); + + // verify 1.2 setup as expected + Version version12 = versionHistory.getHeadVersion(); + assertEquals("1.2", version12.getVersionLabel()); + NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); + assertNotNull(recordVersion12); + + assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); + + Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS); + assertEquals(1, from12.size()); + + // verify 1.1 setup as expected + Version version11 = versionHistory.getPredecessor(version12); + assertEquals("1.1", version11.getVersionLabel()); + NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); + assertNotNull(recordVersion11); + + Set to11 = relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS); + assertEquals(1, to11.size()); + assertEquals(recordVersion12, to11.iterator().next().getSource()); + + assertTrue(relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); + } + }); + } + + /** + * Given a chain of version records (1.0, 1.1, 1.2) which are all related + * When I delete version record 1.1 + * Then 1.2 now 'versions' 1.0 + */ + public void testDeleteMiddleVersion() + { + final NodeRef myDocument = createDocumentWithRecordVersions(); + + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private VersionHistory versionHistory; + + public void given() throws Exception + { + // get version history + versionHistory = versionService.getVersionHistory(myDocument); + } + + public void when() + { + Version version11 = versionHistory.getVersion("1.1"); + NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); + + // delete record version 1.1 + nodeService.deleteNode(recordVersion11); + } + + public void then() + { + // check the deleted version + Version version11 = versionHistory.getVersion("1.1"); + assertNotNull(version11); + assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11)); + NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); + assertNull(recordVersion11); + + // verify 1.2 setup as expected + Version version12 = versionHistory.getHeadVersion(); + assertEquals("1.2", version12.getVersionLabel()); + NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); + assertNotNull(recordVersion12); + + assertTrue(relationshipService.getRelationshipsTo(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); + + Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, RelationshipService.RELATIONSHIP_VERSIONS); + assertEquals(1, from12.size()); + + // verify 1.0 setup as expected + Version version10 = versionHistory.getVersion("1.0"); + assertEquals("1.0", version10.getVersionLabel()); + NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); + assertNotNull(recordVersion10); + + Set to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS); + assertEquals(1, to10.size()); + assertEquals(recordVersion12, to10.iterator().next().getSource()); + + assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); + + } + }); + } + + /** + * Given a chain of version records (1.0, 1.1, 1.2) which are all related + * When I delete version record 1.2 + * Then 1.1 is the most recent version + */ + public void testDeleteCurrentVersion() + { + final NodeRef myDocument = createDocumentWithRecordVersions(); + + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private VersionHistory versionHistory; + + public void given() throws Exception + { + // get version history + versionHistory = versionService.getVersionHistory(myDocument); + } + + public void when() + { + Version version12 = versionHistory.getVersion("1.2"); + NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); + + // delete record version 1.2 + nodeService.deleteNode(recordVersion12); + } + + public void then() + { + // check 1.2 + Version version12 = versionHistory.getVersion("1.2"); + assertNotNull(version12); + assertTrue(recordableVersionService.isRecordedVersionDestroyed(version12)); + assertNull(recordableVersionService.getVersionRecord(version12)); + + // verify 1.1 + Version version11 = versionHistory.getVersion("1.1"); + assertNotNull(version11); + NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); + assertNotNull(recordVersion11); + + assertTrue(relationshipService.getRelationshipsTo(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); + + Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, RelationshipService.RELATIONSHIP_VERSIONS); + assertEquals(1, from11.size()); + + // verify 1.0 + Version version10 = versionHistory.getVersion("1.0"); + assertNotNull(version10); + NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); + assertNotNull(recordVersion10); + + Set to10 = relationshipService.getRelationshipsTo(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS); + assertEquals(1, to10.size()); + assertEquals(recordVersion11, to10.iterator().next().getSource()); + + assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, RelationshipService.RELATIONSHIP_VERSIONS).isEmpty()); + } + }); + } + + /** + * Given that a version record + * When the version record is destroyed whilst retaining the meta data + * Then the version is marked as destroyed in the collab version history + */ + public void testDestroyVersionRecordWithMetadata() + { + final NodeRef myDocument = createDocumentWithRecordVersions(); + + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private VersionHistory versionHistory; + private NodeRef recordVersion11; + + public void given() throws Exception + { + // create file plan structure + NodeRef myCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createBasicDispositionSchedule(myCategory, GUID.generate(), GUID.generate(), true, true); + + NodeRef myRecordFolder = recordFolderService.createRecordFolder(myCategory, GUID.generate()); + + // get version history + versionHistory = versionService.getVersionHistory(myDocument); + + // file and complete all the version records into my record folder + for (Version version : versionHistory.getAllVersions()) + { + NodeRef record = recordableVersionService.getVersionRecord(version); + fileFolderService.move(record, myRecordFolder, null); + utils.completeRecord(record); + } + } + + public void when() + { + Version version11 = versionHistory.getVersion("1.1"); + recordVersion11 = recordableVersionService.getVersionRecord(version11); + + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordVersion11, CompleteEventAction.NAME, params); + + rmActionService.executeRecordsManagementAction(recordVersion11, CutOffAction.NAME); + + rmActionService.executeRecordsManagementAction(recordVersion11, DestroyAction.NAME); + } + + public void then() + { + // verify that the version history looks as expected + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + assertNotNull(versionHistory); + Collection versions = versionHistory.getAllVersions(); + assertEquals(3, versions.size()); + + // verify 1.2 setup as expected + Version version12 = versionHistory.getHeadVersion(); + assertEquals("1.2", version12.getVersionLabel()); + assertFalse(recordableVersionService.isRecordedVersionDestroyed(version12)); + NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); + assertNotNull(recordVersion12); + assertFalse(recordService.isMetadataStub(recordVersion12)); + + assertTrue(relationshipService.getRelationshipsTo(recordVersion12, "versions").isEmpty()); + + Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, "versions"); + assertEquals(1, from12.size()); + + // verify 1.1 setup as expected + Version version11 = versionHistory.getPredecessor(version12); + assertEquals("1.1", version11.getVersionLabel()); + assertTrue(recordableVersionService.isRecordedVersionDestroyed(version11)); + assertNotNull(recordVersion11); + assertTrue(recordService.isMetadataStub(recordVersion11)); + + Set to11 = relationshipService.getRelationshipsTo(recordVersion11, "versions"); + assertEquals(1, to11.size()); + assertEquals(recordVersion12, to11.iterator().next().getSource()); + + Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, "versions"); + assertEquals(1, from11.size()); + + // verify 1.0 setup as expected + Version version10 = versionHistory.getPredecessor(version11); + assertEquals("1.0", version10.getVersionLabel()); + assertFalse(recordableVersionService.isRecordedVersionDestroyed(version10)); + NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); + assertNotNull(recordVersion10); + assertFalse(recordService.isMetadataStub(recordVersion10)); + + Set to10 = relationshipService.getRelationshipsTo(recordVersion10, "versions"); + assertEquals(1, to10.size()); + assertEquals(recordVersion11, to10.iterator().next().getSource()); + + assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, "versions").isEmpty()); + + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java index d4424d14c6..0ad5f22505 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java @@ -1,413 +1,413 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.integration.version; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; -import org.alfresco.util.PropertyMap; - -/** - * Recordable versions base integration test - * - * @author Roy Wetherall - * @since 2.3 - */ -public abstract class RecordableVersionsBaseTest extends BaseRMTestCase implements RecordableVersionModel -{ - protected static final QName QNAME_PUBLISHER = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "publisher"); - protected static final QName QNAME_SUBJECT = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "subject"); - - protected static final String DESCRIPTION = "description"; - protected static final String PUBLISHER = "publisher"; - protected static final String SUBJECT = "subject"; - protected static final String OWNER = "GracieWetherall"; - - protected static final String CONTENT = - "Simple + Smart. A smarter way to build, a smarter way to deploy. Its simple because we focus on the end " - + "user and smart because we support more open standards than any other ECM platform, while delivering all " - + "the value a traditional platform provides."; - - protected RecordableVersionService recordableVersionService; - - @Override - protected void initServices() - { - super.initServices(); - recordableVersionService = (RecordableVersionService)applicationContext.getBean("RecordableVersionService"); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupCollaborationSiteTestDataImpl() - */ - @Override - protected void setupCollaborationSiteTestDataImpl() - { - super.setupCollaborationSiteTestDataImpl(); - - // create authentication for owner - createPerson(OWNER); - - // prepare content - prepareContent(dmDocument); - } - - protected void prepareContent(NodeRef content) - { - // add titled aspect - PropertyMap titledProperties = new PropertyMap(2); - titledProperties.put(ContentModel.PROP_TITLE, "document title"); - titledProperties.put(ContentModel.PROP_DESCRIPTION, "document description"); - nodeService.addAspect(content, ContentModel.ASPECT_TITLED, titledProperties); - - // add ownable aspect - PropertyMap ownableProperties = new PropertyMap(1); - ownableProperties.put(ContentModel.PROP_OWNER, OWNER); - nodeService.addAspect(content, ContentModel.ASPECT_OWNABLE, ownableProperties); - - // add Dublin core aspect - PropertyMap dublinCoreProperties = new PropertyMap(2); - dublinCoreProperties.put(QNAME_PUBLISHER, PUBLISHER); - dublinCoreProperties.put(QNAME_SUBJECT, SUBJECT); - nodeService.addAspect(content, ContentModel.ASPECT_DUBLINCORE, dublinCoreProperties); - - // add content - ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(CONTENT); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // remove owner - personService.deletePerson(OWNER); - } - - /** - * Helper to check that the current version is recorded - */ - protected void checkRecordedVersion(NodeRef document, String description, String versionLabel) - { - // double check that the document is not a record - assertFalse(recordService.isRecord(document)); - - // store document state - Map beforeProperties = nodeService.getProperties(document); - Set beforeAspects = nodeService.getAspects(document); - - // get the current version - Version version = versionService.getCurrentVersion(document); - - // version has been created - assertNotNull(version); - - // check the version properties - assertEquals(description, version.getDescription()); - assertEquals(versionLabel, version.getVersionLabel()); - - // get the frozen state - NodeRef frozen = version.getFrozenStateNodeRef(); - - // check the properties - checkProperties(frozen, beforeProperties); - - // compare aspects - checkAspects(frozen, beforeAspects); - - // record version node reference is available on version - NodeRef record = recordableVersionService.getVersionRecord(version); - assertNotNull(record); - - // check that the version record information has been added - assertTrue(nodeService.hasAspect(record, ASPECT_VERSION_RECORD)); - assertEquals(versionLabel, nodeService.getProperty(record, RecordableVersionModel.PROP_VERSION_LABEL)); - assertEquals(description, nodeService.getProperty(record, RecordableVersionModel.PROP_VERSION_DESCRIPTION)); - - // record version is an unfiled record - assertTrue(recordService.isRecord(record)); - assertFalse(recordService.isFiled(record)); - - // check that the created record does not have either of the versionable aspects - assertFalse(nodeService.hasAspect(record, RecordableVersionModel.ASPECT_VERSIONABLE)); - - // check the version history - VersionHistory versionHistory = versionService.getVersionHistory(document); - assertNotNull(versionHistory); - Version headVersion = versionHistory.getHeadVersion(); - assertNotNull(headVersion); - } - - /** - * Helper method to check that the current version is not recorded - */ - protected void checkNotRecordedAspect(NodeRef document, String description, String versionLabel) - { - // double check that the document is not a record - assertFalse(recordService.isRecord(document)); - - // get the current version - Version version = versionService.getCurrentVersion(document); - - // version has been created - assertNotNull(version); - - // check the version properties - assertEquals(description, version.getDescription()); - assertEquals(versionLabel, version.getVersionLabel()); - - // record version node reference is available on version - NodeRef record = recordableVersionService.getVersionRecord(version); - assertNull(record); - - // check the version history - VersionHistory versionHistory = versionService.getVersionHistory(document); - assertNotNull(versionHistory); - Version headVersion = versionHistory.getHeadVersion(); - assertNotNull(headVersion); - } - - /** - * Helper to check the properties of a recorded version - */ - protected void checkProperties(NodeRef frozen, Map beforeProperies) - { - Map frozenProperties = nodeService.getProperties(frozen); - Map cloneFrozenProperties = new HashMap(frozenProperties); - for (Map.Entry entry : beforeProperies.entrySet()) - { - QName beforePropertyName = entry.getKey(); - if (frozenProperties.containsKey(beforePropertyName)) - { - Serializable frozenValue = frozenProperties.get(beforePropertyName); - assertEquals("Frozen property " + beforePropertyName.getLocalName() + " value is incorrect.", entry.getValue(), frozenValue); - cloneFrozenProperties.remove(beforePropertyName); - } - else if (!PROP_FILE_PLAN.equals(beforePropertyName) && - !PROP_RECORDABLE_VERSION_POLICY.equals(beforePropertyName) && - !ContentModel.PROP_AUTO_VERSION_PROPS.equals(beforePropertyName) && - !ContentModel.PROP_AUTO_VERSION.equals(beforePropertyName) && - !ContentModel.PROP_INITIAL_VERSION.equals(beforePropertyName) && - !ContentModel.PROP_VERSION_TYPE.equals(beforePropertyName) && - !ContentModel.PROP_VERSION_LABEL.equals(beforePropertyName)) - { - fail("Property missing from frozen state .. " + beforePropertyName); - } - } - - // filter out missing properties with null values - for (Map.Entry entry : frozenProperties.entrySet()) - { - if (entry.getValue() == null) - { - cloneFrozenProperties.remove(entry.getKey()); - } - } - - // remove "owner" from cloneFrozenProperties - cloneFrozenProperties.remove(ContentModel.PROP_OWNER); - - - // frozen properties should be empty - assertTrue("Properties in frozen state, but not in origional. " + cloneFrozenProperties.keySet(), cloneFrozenProperties.isEmpty()); - } - - /** - * Helper to check the aspects of a recorded version - */ - protected void checkAspects(NodeRef frozen, Set beforeAspects) - { - Set cloneBeforeAspects = new HashSet(beforeAspects); - - // compare origional and frozen aspects - Set frozenAspects = nodeService.getAspects(frozen); - cloneBeforeAspects.removeAll(frozenAspects); - cloneBeforeAspects.remove(RecordableVersionModel.ASPECT_VERSIONABLE); - cloneBeforeAspects.remove(ContentModel.ASPECT_VERSIONABLE); - if (!cloneBeforeAspects.isEmpty()) - { - fail("Aspects not present in frozen state. " + cloneBeforeAspects.toString()); - } - - frozenAspects.removeAll(beforeAspects); - if (!frozenAspects.isEmpty()) - { - fail("Aspects in the frozen state, but not in origional. " + frozenAspects.toString()); - } - } - - /** - * Creates a document with three versions (1.0, 1.1, 1.2) all of which - * are recorded. - * - * @return NodeRef node reference - */ - protected NodeRef createDocumentWithRecordVersions() - { - // create document and initial version (1.0) - final NodeRef myDocument = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - // create a document - NodeRef testDoc = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - ContentWriter writer = fileFolderService.getWriter(testDoc); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(GUID.generate()); - - // make versionable - Map props = new HashMap(2); - props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); - nodeService.addAspect(testDoc, RecordableVersionModel.ASPECT_VERSIONABLE, props); - nodeService.addAspect(testDoc, ContentModel.ASPECT_VERSIONABLE, null); - - return testDoc; - } - }); - - // create 1.1 - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // update content - ContentWriter writer = fileFolderService.getWriter(myDocument); - writer.putContent(GUID.generate()); - - return null; - } - }); - - // create 1.2 - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // update content - ContentWriter writer = fileFolderService.getWriter(myDocument); - writer.putContent(GUID.generate()); - - return null; - } - }); - - // we do these checks to ensure that the test data is in the correct state before we - // start to manipulate the versions and execute tests - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // verify that the version history looks as expected - VersionHistory versionHistory = versionService.getVersionHistory(myDocument); - assertNotNull(versionHistory); - Collection versions = versionHistory.getAllVersions(); - assertEquals(3, versions.size()); - - // verify 1.2 setup as expected - Version version12 = versionHistory.getHeadVersion(); - assertEquals("1.2", version12.getVersionLabel()); - NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); - assertNotNull(recordVersion12); - - assertTrue(relationshipService.getRelationshipsTo(recordVersion12, "versions").isEmpty()); - - Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, "versions"); - assertEquals(1, from12.size()); - - // verify 1.1 setup as expected - Version version11 = versionHistory.getPredecessor(version12); - assertEquals("1.1", version11.getVersionLabel()); - NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); - assertNotNull(recordVersion11); - - Set to11 = relationshipService.getRelationshipsTo(recordVersion11, "versions"); - assertEquals(1, to11.size()); - assertEquals(recordVersion12, to11.iterator().next().getSource()); - - Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, "versions"); - assertEquals(1, from11.size()); - - // verify 1.0 setup as expected - Version version10 = versionHistory.getPredecessor(version11); - assertEquals("1.0", version10.getVersionLabel()); - NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); - assertNotNull(recordVersion10); - - Set to10 = relationshipService.getRelationshipsTo(recordVersion10, "versions"); - assertEquals(1, to10.size()); - assertEquals(recordVersion11, to10.iterator().next().getSource()); - - assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, "versions").isEmpty()); - - return null; - } - }); - - return myDocument; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.integration.version; + +import java.io.Serializable; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionHistory; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; +import org.alfresco.util.PropertyMap; + +/** + * Recordable versions base integration test + * + * @author Roy Wetherall + * @since 2.3 + */ +public abstract class RecordableVersionsBaseTest extends BaseRMTestCase implements RecordableVersionModel +{ + protected static final QName QNAME_PUBLISHER = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "publisher"); + protected static final QName QNAME_SUBJECT = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "subject"); + + protected static final String DESCRIPTION = "description"; + protected static final String PUBLISHER = "publisher"; + protected static final String SUBJECT = "subject"; + protected static final String OWNER = "GracieWetherall"; + + protected static final String CONTENT = + "Simple + Smart. A smarter way to build, a smarter way to deploy. Its simple because we focus on the end " + + "user and smart because we support more open standards than any other ECM platform, while delivering all " + + "the value a traditional platform provides."; + + protected RecordableVersionService recordableVersionService; + + @Override + protected void initServices() + { + super.initServices(); + recordableVersionService = (RecordableVersionService)applicationContext.getBean("RecordableVersionService"); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupCollaborationSiteTestDataImpl() + */ + @Override + protected void setupCollaborationSiteTestDataImpl() + { + super.setupCollaborationSiteTestDataImpl(); + + // create authentication for owner + createPerson(OWNER); + + // prepare content + prepareContent(dmDocument); + } + + protected void prepareContent(NodeRef content) + { + // add titled aspect + PropertyMap titledProperties = new PropertyMap(2); + titledProperties.put(ContentModel.PROP_TITLE, "document title"); + titledProperties.put(ContentModel.PROP_DESCRIPTION, "document description"); + nodeService.addAspect(content, ContentModel.ASPECT_TITLED, titledProperties); + + // add ownable aspect + PropertyMap ownableProperties = new PropertyMap(1); + ownableProperties.put(ContentModel.PROP_OWNER, OWNER); + nodeService.addAspect(content, ContentModel.ASPECT_OWNABLE, ownableProperties); + + // add Dublin core aspect + PropertyMap dublinCoreProperties = new PropertyMap(2); + dublinCoreProperties.put(QNAME_PUBLISHER, PUBLISHER); + dublinCoreProperties.put(QNAME_SUBJECT, SUBJECT); + nodeService.addAspect(content, ContentModel.ASPECT_DUBLINCORE, dublinCoreProperties); + + // add content + ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.putContent(CONTENT); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() + */ + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + + // remove owner + personService.deletePerson(OWNER); + } + + /** + * Helper to check that the current version is recorded + */ + protected void checkRecordedVersion(NodeRef document, String description, String versionLabel) + { + // double check that the document is not a record + assertFalse(recordService.isRecord(document)); + + // store document state + Map beforeProperties = nodeService.getProperties(document); + Set beforeAspects = nodeService.getAspects(document); + + // get the current version + Version version = versionService.getCurrentVersion(document); + + // version has been created + assertNotNull(version); + + // check the version properties + assertEquals(description, version.getDescription()); + assertEquals(versionLabel, version.getVersionLabel()); + + // get the frozen state + NodeRef frozen = version.getFrozenStateNodeRef(); + + // check the properties + checkProperties(frozen, beforeProperties); + + // compare aspects + checkAspects(frozen, beforeAspects); + + // record version node reference is available on version + NodeRef record = recordableVersionService.getVersionRecord(version); + assertNotNull(record); + + // check that the version record information has been added + assertTrue(nodeService.hasAspect(record, ASPECT_VERSION_RECORD)); + assertEquals(versionLabel, nodeService.getProperty(record, RecordableVersionModel.PROP_VERSION_LABEL)); + assertEquals(description, nodeService.getProperty(record, RecordableVersionModel.PROP_VERSION_DESCRIPTION)); + + // record version is an unfiled record + assertTrue(recordService.isRecord(record)); + assertFalse(recordService.isFiled(record)); + + // check that the created record does not have either of the versionable aspects + assertFalse(nodeService.hasAspect(record, RecordableVersionModel.ASPECT_VERSIONABLE)); + + // check the version history + VersionHistory versionHistory = versionService.getVersionHistory(document); + assertNotNull(versionHistory); + Version headVersion = versionHistory.getHeadVersion(); + assertNotNull(headVersion); + } + + /** + * Helper method to check that the current version is not recorded + */ + protected void checkNotRecordedAspect(NodeRef document, String description, String versionLabel) + { + // double check that the document is not a record + assertFalse(recordService.isRecord(document)); + + // get the current version + Version version = versionService.getCurrentVersion(document); + + // version has been created + assertNotNull(version); + + // check the version properties + assertEquals(description, version.getDescription()); + assertEquals(versionLabel, version.getVersionLabel()); + + // record version node reference is available on version + NodeRef record = recordableVersionService.getVersionRecord(version); + assertNull(record); + + // check the version history + VersionHistory versionHistory = versionService.getVersionHistory(document); + assertNotNull(versionHistory); + Version headVersion = versionHistory.getHeadVersion(); + assertNotNull(headVersion); + } + + /** + * Helper to check the properties of a recorded version + */ + protected void checkProperties(NodeRef frozen, Map beforeProperies) + { + Map frozenProperties = nodeService.getProperties(frozen); + Map cloneFrozenProperties = new HashMap(frozenProperties); + for (Map.Entry entry : beforeProperies.entrySet()) + { + QName beforePropertyName = entry.getKey(); + if (frozenProperties.containsKey(beforePropertyName)) + { + Serializable frozenValue = frozenProperties.get(beforePropertyName); + assertEquals("Frozen property " + beforePropertyName.getLocalName() + " value is incorrect.", entry.getValue(), frozenValue); + cloneFrozenProperties.remove(beforePropertyName); + } + else if (!PROP_FILE_PLAN.equals(beforePropertyName) && + !PROP_RECORDABLE_VERSION_POLICY.equals(beforePropertyName) && + !ContentModel.PROP_AUTO_VERSION_PROPS.equals(beforePropertyName) && + !ContentModel.PROP_AUTO_VERSION.equals(beforePropertyName) && + !ContentModel.PROP_INITIAL_VERSION.equals(beforePropertyName) && + !ContentModel.PROP_VERSION_TYPE.equals(beforePropertyName) && + !ContentModel.PROP_VERSION_LABEL.equals(beforePropertyName)) + { + fail("Property missing from frozen state .. " + beforePropertyName); + } + } + + // filter out missing properties with null values + for (Map.Entry entry : frozenProperties.entrySet()) + { + if (entry.getValue() == null) + { + cloneFrozenProperties.remove(entry.getKey()); + } + } + + // remove "owner" from cloneFrozenProperties + cloneFrozenProperties.remove(ContentModel.PROP_OWNER); + + + // frozen properties should be empty + assertTrue("Properties in frozen state, but not in origional. " + cloneFrozenProperties.keySet(), cloneFrozenProperties.isEmpty()); + } + + /** + * Helper to check the aspects of a recorded version + */ + protected void checkAspects(NodeRef frozen, Set beforeAspects) + { + Set cloneBeforeAspects = new HashSet(beforeAspects); + + // compare origional and frozen aspects + Set frozenAspects = nodeService.getAspects(frozen); + cloneBeforeAspects.removeAll(frozenAspects); + cloneBeforeAspects.remove(RecordableVersionModel.ASPECT_VERSIONABLE); + cloneBeforeAspects.remove(ContentModel.ASPECT_VERSIONABLE); + if (!cloneBeforeAspects.isEmpty()) + { + fail("Aspects not present in frozen state. " + cloneBeforeAspects.toString()); + } + + frozenAspects.removeAll(beforeAspects); + if (!frozenAspects.isEmpty()) + { + fail("Aspects in the frozen state, but not in origional. " + frozenAspects.toString()); + } + } + + /** + * Creates a document with three versions (1.0, 1.1, 1.2) all of which + * are recorded. + * + * @return NodeRef node reference + */ + protected NodeRef createDocumentWithRecordVersions() + { + // create document and initial version (1.0) + final NodeRef myDocument = doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + // create a document + NodeRef testDoc = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + ContentWriter writer = fileFolderService.getWriter(testDoc); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.putContent(GUID.generate()); + + // make versionable + Map props = new HashMap(2); + props.put(RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); + props.put(RecordableVersionModel.PROP_FILE_PLAN, filePlan); + nodeService.addAspect(testDoc, RecordableVersionModel.ASPECT_VERSIONABLE, props); + nodeService.addAspect(testDoc, ContentModel.ASPECT_VERSIONABLE, null); + + return testDoc; + } + }); + + // create 1.1 + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // update content + ContentWriter writer = fileFolderService.getWriter(myDocument); + writer.putContent(GUID.generate()); + + return null; + } + }); + + // create 1.2 + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // update content + ContentWriter writer = fileFolderService.getWriter(myDocument); + writer.putContent(GUID.generate()); + + return null; + } + }); + + // we do these checks to ensure that the test data is in the correct state before we + // start to manipulate the versions and execute tests + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // verify that the version history looks as expected + VersionHistory versionHistory = versionService.getVersionHistory(myDocument); + assertNotNull(versionHistory); + Collection versions = versionHistory.getAllVersions(); + assertEquals(3, versions.size()); + + // verify 1.2 setup as expected + Version version12 = versionHistory.getHeadVersion(); + assertEquals("1.2", version12.getVersionLabel()); + NodeRef recordVersion12 = recordableVersionService.getVersionRecord(version12); + assertNotNull(recordVersion12); + + assertTrue(relationshipService.getRelationshipsTo(recordVersion12, "versions").isEmpty()); + + Set from12 = relationshipService.getRelationshipsFrom(recordVersion12, "versions"); + assertEquals(1, from12.size()); + + // verify 1.1 setup as expected + Version version11 = versionHistory.getPredecessor(version12); + assertEquals("1.1", version11.getVersionLabel()); + NodeRef recordVersion11 = recordableVersionService.getVersionRecord(version11); + assertNotNull(recordVersion11); + + Set to11 = relationshipService.getRelationshipsTo(recordVersion11, "versions"); + assertEquals(1, to11.size()); + assertEquals(recordVersion12, to11.iterator().next().getSource()); + + Set from11 = relationshipService.getRelationshipsFrom(recordVersion11, "versions"); + assertEquals(1, from11.size()); + + // verify 1.0 setup as expected + Version version10 = versionHistory.getPredecessor(version11); + assertEquals("1.0", version10.getVersionLabel()); + NodeRef recordVersion10 = recordableVersionService.getVersionRecord(version10); + assertNotNull(recordVersion10); + + Set to10 = relationshipService.getRelationshipsTo(recordVersion10, "versions"); + assertEquals(1, to10.size()); + assertEquals(recordVersion11, to10.iterator().next().getSource()); + + assertTrue(relationshipService.getRelationshipsFrom(recordVersion10, "versions").isEmpty()); + + return null; + } + }); + + return myDocument; + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java index e0a5a2cb4d..7334f192db 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java @@ -1,82 +1,82 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.action; - -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Record service implementation unit test. - * - * @author Roy Wetherall - */ -public class CreateRecordActionTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testCreateRecordAction() - { - doTestInTransaction(new Test() - { - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); - - Action action = actionService.createAction(CreateRecordAction.NAME); - action.setParameterValue(CreateRecordAction.PARAM_HIDE_RECORD, false); - action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(action, dmDocument); - - return null; - } - - public void test(Void result) throws Exception - { - assertTrue(recordService.isRecord(dmDocument)); - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); - }; - }, - dmCollaborator); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.action; + +import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.security.AccessStatus; + +/** + * Record service implementation unit test. + * + * @author Roy Wetherall + */ +public class CreateRecordActionTest extends BaseRMTestCase +{ + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + public void testCreateRecordAction() + { + doTestInTransaction(new Test() + { + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); + + Action action = actionService.createAction(CreateRecordAction.NAME); + action.setParameterValue(CreateRecordAction.PARAM_HIDE_RECORD, false); + action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + actionService.executeAction(action, dmDocument); + + return null; + } + + public void test(Void result) throws Exception + { + assertTrue(recordService.isRecord(dmDocument)); + + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); + }; + }, + dmCollaborator); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileReportActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileReportActionTest.java index 31ae795a76..e49fdf0820 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileReportActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileReportActionTest.java @@ -1,116 +1,116 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.action; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang.StringUtils; -import org.springframework.extensions.webscripts.GUID; - -/** - * File report action unit test - * - * @author Tuna Aksoy - * @since 2.2 - * @version 1.0 - */ -public class FileReportActionTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - public void testFileReport() - { - fileReport(MimetypeMap.MIMETYPE_HTML); - } - - public void testfileReportDefaultMimetype() - { - fileReport(null); - } - - private void fileReport(final String mimeType) - { - AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser(); - - // create record folder - final NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); - - // close the record folder - recordFolderService.closeRecordFolder(recordFolder); - - // create hold - final NodeRef hold = holdService.createHold(filePlan, "holdName", "holdReason", "holdDescription"); - - doTestInTransaction(new FailureTest() - { - @Override - public void run() throws Exception - { - // execute action - executeAction(mimeType, recordFolder, hold); - } - }); - - doTestInTransaction(new Test() - { - public Void run() - { - // reopen the record folder - rmActionService.executeRecordsManagementAction(recordFolder, "openRecordFolder"); - return null; - } - - @Override - public void test(Void result) throws Exception - { - // execute action - executeAction(mimeType, recordFolder, hold); - } - }); - } - - private void executeAction(String mimeType, NodeRef recordFolder, NodeRef hold) - { - Action action = actionService.createAction(FileReportAction.NAME); - if (StringUtils.isNotBlank(mimeType)) - { - action.setParameterValue(FileReportAction.MIMETYPE, mimeType); - } - action.setParameterValue(FileReportAction.DESTINATION, recordFolder.toString()); - action.setParameterValue(FileReportAction.REPORT_TYPE, "rmr:destructionReport"); - actionService.executeAction(action, hold); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.action; + +import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.lang.StringUtils; +import org.springframework.extensions.webscripts.GUID; + +/** + * File report action unit test + * + * @author Tuna Aksoy + * @since 2.2 + * @version 1.0 + */ +public class FileReportActionTest extends BaseRMTestCase +{ + @Override + protected boolean isUserTest() + { + return true; + } + + public void testFileReport() + { + fileReport(MimetypeMap.MIMETYPE_HTML); + } + + public void testfileReportDefaultMimetype() + { + fileReport(null); + } + + private void fileReport(final String mimeType) + { + AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser(); + + // create record folder + final NodeRef recordFolder = recordFolderService.createRecordFolder(rmContainer, GUID.generate()); + + // close the record folder + recordFolderService.closeRecordFolder(recordFolder); + + // create hold + final NodeRef hold = holdService.createHold(filePlan, "holdName", "holdReason", "holdDescription"); + + doTestInTransaction(new FailureTest() + { + @Override + public void run() throws Exception + { + // execute action + executeAction(mimeType, recordFolder, hold); + } + }); + + doTestInTransaction(new Test() + { + public Void run() + { + // reopen the record folder + rmActionService.executeRecordsManagementAction(recordFolder, "openRecordFolder"); + return null; + } + + @Override + public void test(Void result) throws Exception + { + // execute action + executeAction(mimeType, recordFolder, hold); + } + }); + } + + private void executeAction(String mimeType, NodeRef recordFolder, NodeRef hold) + { + Action action = actionService.createAction(FileReportAction.NAME); + if (StringUtils.isNotBlank(mimeType)) + { + action.setParameterValue(FileReportAction.MIMETYPE, mimeType); + } + action.setParameterValue(FileReportAction.DESTINATION, recordFolder.toString()); + action.setParameterValue(FileReportAction.REPORT_TYPE, "rmr:destructionReport"); + actionService.executeAction(action, hold); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java index 11020e2c57..771aeb73b1 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java @@ -1,343 +1,343 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.action; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.springframework.util.StringUtils; - -/** - * FileTo action unit test - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FileToActionTest extends BaseRMTestCase -{ - private static final String PATH = "rmContainer/rmFolder"; - private static final String PATH2 = "/rmContainer/rmFolder"; - private static final String PATH_BAD = "monkey/rmFolder"; - private static final String PATH_CREATE = "rmContainer/newRmFolder"; - private static final String LONG_PATH_CREATE = "/rmContainer/one/two/three/four/newRmFolder"; - - private static final String PATH_SUB1 = "rmContainer/${node.cm:title}"; - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - public void testFileToNodeRef() - { - initRecord(); - - doTestInTransaction(new Test() - { - public Void run() - { - NodeRef unfiledContainer = filePlanService.getUnfiledContainer(filePlan); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(unfiledContainer, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmFolder, RMPermissionModel.FILING)); - - Capability capability = capabilityService.getCapability("FileUnfiledRecords"); - assertNotNull(capability); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(dmDocument)); - - // set parameters - Map params = new HashMap(1); - params.put(FileToAction.PARAM_DESTINATION_RECORD_FOLDER, rmFolder); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(recordService.isFiled(dmDocument)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(rmFolder, parent); - - return null; - } - }, ADMIN_USER); - } - - private void initRecord() - { - doTestInTransaction(new Test() - { - public Void run() - { - nodeService.setProperty(dmDocument, ContentModel.PROP_TITLE, "mytestvalue"); - - // create record from document - recordService.createRecord(filePlan, dmDocument); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - AuthenticationUtil.runAs(() -> - { - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - // is the unfiled container the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(filePlanService.getUnfiledContainer(filePlan), parent); - - return null; - }, - AuthenticationUtil.getAdminUserName()); - } - - }, dmCollaborator); - } - - public void testFileToPath() - { - initRecord(); - - doTestInTransaction(new Test() - { - public Void run() - { - // set parameters - Map params = new HashMap(1); - params.put(FileToAction.PARAM_PATH, PATH); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(recordService.isFiled(dmDocument)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(rmFolder, parent); - - return null; - } - }, ADMIN_USER); - } - - public void testFileToPath2() - { - initRecord(); - - doTestInTransaction(new Test() - { - public Void run() - { - // set parameters - Map params = new HashMap(1); - params.put(FileToAction.PARAM_PATH, PATH2); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(recordService.isFiled(dmDocument)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(rmFolder, parent); - - return null; - } - }, ADMIN_USER); - } - - public void testCreate() throws Exception - { - initRecord(); - createRecord(PATH_CREATE, "newRmFolder"); - } - - public void testCreateSub() throws Exception - { - initRecord(); - createRecord(PATH_SUB1, "mytestvalue", "rmContainer/mytestvalue"); - } - - public void testCreatePath() throws Exception - { - initRecord(); - createRecord(LONG_PATH_CREATE, "newRmFolder", "rmContainer/one/two/three/four/newRmFolder"); - } - - private void createRecord(String path, String name) - { - createRecord(path, name, path); - } - - private void createRecord(final String path, final String name, final String resolvedPath) - { - final String[] pathValues = StringUtils.tokenizeToStringArray(resolvedPath, "/"); - - // set parameters - Map params = new HashMap(1); - params.put(FileToAction.PARAM_PATH, path); - params.put(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - // show the folder doesn't exist to begin with - FileInfo createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList(Arrays.asList(pathValues)), false); - assertNull(createdRecordFolder); - - // set parameters - Map params = new HashMap(1); - params.put(FileToAction.PARAM_PATH, path); - params.put(FileToAction.PARAM_CREATE_RECORD_PATH, true); - - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - return null; - } - }); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - // show the folder has now been created - FileInfo createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList(Arrays.asList(pathValues)), false); - assertNotNull(createdRecordFolder); - assertEquals(name, createdRecordFolder.getName()); - NodeRef createdRecordFolderNodeRef = createdRecordFolder.getNodeRef(); - - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(recordService.isFiled(dmDocument)); - - // is the record folder the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(createdRecordFolderNodeRef, parent); - - return null; - } - }, ADMIN_USER); - } - - public void failureTests() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - // create record from document - recordService.createRecord(filePlan, dmDocument); - - // check things have gone according to plan - assertTrue(recordService.isRecord(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - // is the unfiled container the primary parent of the filed record - NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); - assertEquals(filePlanService.getUnfiledContainer(filePlan), parent); - - return null; - } - }, dmCollaborator); - - doTestInTransaction(new FailureTest - ( - "Path is invalid and record create not set." - ) - { - @Override - public void run() throws Exception - { - // set parameters - Map params = new HashMap(1); - params.put(FileToAction.PARAM_PATH, PATH_BAD); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - - } - }); - - doTestInTransaction(new FailureTest - ( - "Path is for a new folder, but create not set." - ) - { - @Override - public void run() throws Exception - { - // set parameters - Map params = new HashMap(1); - params.put(FileToAction.PARAM_PATH, PATH_CREATE); - - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); - - } - }); - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.action; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.springframework.util.StringUtils; + +/** + * FileTo action unit test + * + * @author Roy Wetherall + * @since 2.1 + */ +public class FileToActionTest extends BaseRMTestCase +{ + private static final String PATH = "rmContainer/rmFolder"; + private static final String PATH2 = "/rmContainer/rmFolder"; + private static final String PATH_BAD = "monkey/rmFolder"; + private static final String PATH_CREATE = "rmContainer/newRmFolder"; + private static final String LONG_PATH_CREATE = "/rmContainer/one/two/three/four/newRmFolder"; + + private static final String PATH_SUB1 = "rmContainer/${node.cm:title}"; + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isUserTest() + { + return true; + } + + public void testFileToNodeRef() + { + initRecord(); + + doTestInTransaction(new Test() + { + public Void run() + { + NodeRef unfiledContainer = filePlanService.getUnfiledContainer(filePlan); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(unfiledContainer, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmFolder, RMPermissionModel.FILING)); + + Capability capability = capabilityService.getCapability("FileUnfiledRecords"); + assertNotNull(capability); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(dmDocument)); + + // set parameters + Map params = new HashMap(1); + params.put(FileToAction.PARAM_DESTINATION_RECORD_FOLDER, rmFolder); + + // execute file-to action + rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); + + // check things have gone according to plan + assertTrue(recordService.isRecord(dmDocument)); + assertTrue(recordService.isFiled(dmDocument)); + + // is the record folder the primary parent of the filed record + NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); + assertEquals(rmFolder, parent); + + return null; + } + }, ADMIN_USER); + } + + private void initRecord() + { + doTestInTransaction(new Test() + { + public Void run() + { + nodeService.setProperty(dmDocument, ContentModel.PROP_TITLE, "mytestvalue"); + + // create record from document + recordService.createRecord(filePlan, dmDocument); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + AuthenticationUtil.runAs(() -> + { + // check things have gone according to plan + assertTrue(recordService.isRecord(dmDocument)); + assertFalse(recordService.isFiled(dmDocument)); + + // is the unfiled container the primary parent of the filed record + NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); + assertEquals(filePlanService.getUnfiledContainer(filePlan), parent); + + return null; + }, + AuthenticationUtil.getAdminUserName()); + } + + }, dmCollaborator); + } + + public void testFileToPath() + { + initRecord(); + + doTestInTransaction(new Test() + { + public Void run() + { + // set parameters + Map params = new HashMap(1); + params.put(FileToAction.PARAM_PATH, PATH); + + // execute file-to action + rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); + + // check things have gone according to plan + assertTrue(recordService.isRecord(dmDocument)); + assertTrue(recordService.isFiled(dmDocument)); + + // is the record folder the primary parent of the filed record + NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); + assertEquals(rmFolder, parent); + + return null; + } + }, ADMIN_USER); + } + + public void testFileToPath2() + { + initRecord(); + + doTestInTransaction(new Test() + { + public Void run() + { + // set parameters + Map params = new HashMap(1); + params.put(FileToAction.PARAM_PATH, PATH2); + + // execute file-to action + rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); + + // check things have gone according to plan + assertTrue(recordService.isRecord(dmDocument)); + assertTrue(recordService.isFiled(dmDocument)); + + // is the record folder the primary parent of the filed record + NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); + assertEquals(rmFolder, parent); + + return null; + } + }, ADMIN_USER); + } + + public void testCreate() throws Exception + { + initRecord(); + createRecord(PATH_CREATE, "newRmFolder"); + } + + public void testCreateSub() throws Exception + { + initRecord(); + createRecord(PATH_SUB1, "mytestvalue", "rmContainer/mytestvalue"); + } + + public void testCreatePath() throws Exception + { + initRecord(); + createRecord(LONG_PATH_CREATE, "newRmFolder", "rmContainer/one/two/three/four/newRmFolder"); + } + + private void createRecord(String path, String name) + { + createRecord(path, name, path); + } + + private void createRecord(final String path, final String name, final String resolvedPath) + { + final String[] pathValues = StringUtils.tokenizeToStringArray(resolvedPath, "/"); + + // set parameters + Map params = new HashMap(1); + params.put(FileToAction.PARAM_PATH, path); + params.put(FileToAction.PARAM_CREATE_RECORD_PATH, true); + + doTestInTransaction(new Test() + { + public Void run() throws Exception + { + // show the folder doesn't exist to begin with + FileInfo createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList(Arrays.asList(pathValues)), false); + assertNull(createdRecordFolder); + + // set parameters + Map params = new HashMap(1); + params.put(FileToAction.PARAM_PATH, path); + params.put(FileToAction.PARAM_CREATE_RECORD_PATH, true); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + public Void run() throws Exception + { + // execute file-to action + rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); + return null; + } + }); + + doTestInTransaction(new Test() + { + public Void run() throws Exception + { + // show the folder has now been created + FileInfo createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList(Arrays.asList(pathValues)), false); + assertNotNull(createdRecordFolder); + assertEquals(name, createdRecordFolder.getName()); + NodeRef createdRecordFolderNodeRef = createdRecordFolder.getNodeRef(); + + // check things have gone according to plan + assertTrue(recordService.isRecord(dmDocument)); + assertTrue(recordService.isFiled(dmDocument)); + + // is the record folder the primary parent of the filed record + NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); + assertEquals(createdRecordFolderNodeRef, parent); + + return null; + } + }, ADMIN_USER); + } + + public void failureTests() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + // create record from document + recordService.createRecord(filePlan, dmDocument); + + // check things have gone according to plan + assertTrue(recordService.isRecord(dmDocument)); + assertFalse(recordService.isFiled(dmDocument)); + + // is the unfiled container the primary parent of the filed record + NodeRef parent = nodeService.getPrimaryParent(dmDocument).getParentRef(); + assertEquals(filePlanService.getUnfiledContainer(filePlan), parent); + + return null; + } + }, dmCollaborator); + + doTestInTransaction(new FailureTest + ( + "Path is invalid and record create not set." + ) + { + @Override + public void run() throws Exception + { + // set parameters + Map params = new HashMap(1); + params.put(FileToAction.PARAM_PATH, PATH_BAD); + + // execute file-to action + rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); + + } + }); + + doTestInTransaction(new FailureTest + ( + "Path is for a new folder, but create not set." + ) + { + @Override + public void run() throws Exception + { + // set parameters + Map params = new HashMap(1); + params.put(FileToAction.PARAM_PATH, PATH_CREATE); + + // execute file-to action + rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); + + } + }); + + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java index 9800420830..4cf2f9643f 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java @@ -1,92 +1,92 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.action; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.dm.HideRecordAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Hide Record Action Unit Test - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class HideRecordActionTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testHideRecordAction() - { - doTestInTransaction(new Test() - { - public Void run() - { - // Create a document so that the user has the write permissions for that document - NodeRef doc = fileFolderService.create(dmFolder, "testfile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - - // Create a record from that document - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(createAction, doc); - - // Check if the document is a record now - assertTrue(recordService.isRecord(doc)); - - // The record should have the original location information - assertNotNull(nodeService.getProperty(doc, PROP_RECORD_ORIGINATING_LOCATION)); - - // Check the parents. In this case the document should have two parents (doclib and fileplan) - assertTrue(nodeService.getParentAssocs(doc).size() == 2); - - // Hide the document. The user has the write permissions so he should be able to hide it - Action hideAction = actionService.createAction(HideRecordAction.NAME); - actionService.executeAction(hideAction, doc); - - // The document should be removed from the collaboration site - assertTrue(nodeService.getParentAssocs(doc).size() == 1); - - return null; - } - }, - dmCollaborator); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.action; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; +import org.alfresco.module.org_alfresco_module_rm.action.dm.HideRecordAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Hide Record Action Unit Test + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class HideRecordActionTest extends BaseRMTestCase +{ + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + public void testHideRecordAction() + { + doTestInTransaction(new Test() + { + public Void run() + { + // Create a document so that the user has the write permissions for that document + NodeRef doc = fileFolderService.create(dmFolder, "testfile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); + + // Create a record from that document + Action createAction = actionService.createAction(CreateRecordAction.NAME); + createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + actionService.executeAction(createAction, doc); + + // Check if the document is a record now + assertTrue(recordService.isRecord(doc)); + + // The record should have the original location information + assertNotNull(nodeService.getProperty(doc, PROP_RECORD_ORIGINATING_LOCATION)); + + // Check the parents. In this case the document should have two parents (doclib and fileplan) + assertTrue(nodeService.getParentAssocs(doc).size() == 2); + + // Hide the document. The user has the write permissions so he should be able to hide it + Action hideAction = actionService.createAction(HideRecordAction.NAME); + actionService.executeAction(hideAction, doc); + + // The document should be removed from the collaboration site + assertTrue(nodeService.getParentAssocs(doc).size() == 1); + + return null; + } + }, + dmCollaborator); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java index fc936fca14..81b9c203e2 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java @@ -1,112 +1,112 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.action; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.dm.MoveDmRecordAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Move Record Action Unit Test. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class MoveRecordActionTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testMoveRecordAction() - { - doTestInTransaction(new Test() - { - public Void run() - { - // Create a new folder in a collaboration site - NodeRef testFolder = fileFolderService.create(dmFolder, "myTestFolder", ContentModel.TYPE_FOLDER).getNodeRef(); - - // Create a document so that the user has the write permissions for that document - NodeRef document = fileFolderService.create(testFolder, "moveFile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - - // Create destination folder - String destination = fileFolderService.create(testFolder, "newDest", ContentModel.TYPE_FOLDER).getNodeRef().toString(); - - // Create a record from that document - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(createAction, document); - - // Check if the document is a record now - assertTrue(recordService.isRecord(document)); - - // The record should have the original location information - assertNotNull(nodeService.getProperty(document, PROP_RECORD_ORIGINATING_LOCATION)); - - // Check the parents. In this case the document should have two parents (doclib and fileplan) - assertEquals(nodeService.getParentAssocs(document).size(), 2); - - // Check the number of children of dmFolder before move - assertEquals(nodeService.getChildAssocs(testFolder).size(), 2); - - // Move the record - Action moveRecordAction = actionService.createAction(MoveDmRecordAction.NAME); - moveRecordAction.setParameterValue(MoveDmRecordAction.PARAM_TARGET_NODE_REF, destination); - actionService.executeAction(moveRecordAction, document); - - // Check the number of children of dmFolder after move - assertEquals(nodeService.getChildAssocs(testFolder).size(), 1); - - // Check the new document parent - ChildAssociationRef parent1 = nodeService.getParentAssocs(document).get(0); - ChildAssociationRef parent2 = nodeService.getParentAssocs(document).get(1); - NodeRef newDocParent = (parent1.isPrimary() ? parent2 : parent1).getParentRef(); - assertEquals(destination, newDocParent.toString()); - - // Check if the original location information has been updated - assertEquals((NodeRef) nodeService.getProperty(document, PROP_RECORD_ORIGINATING_LOCATION), newDocParent); - - return null; - } - }, - dmCollaborator); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.action; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; +import org.alfresco.module.org_alfresco_module_rm.action.dm.MoveDmRecordAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Move Record Action Unit Test. + * + * @author Tuna Aksoy + * @since 2.2 + */ +public class MoveRecordActionTest extends BaseRMTestCase +{ + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + public void testMoveRecordAction() + { + doTestInTransaction(new Test() + { + public Void run() + { + // Create a new folder in a collaboration site + NodeRef testFolder = fileFolderService.create(dmFolder, "myTestFolder", ContentModel.TYPE_FOLDER).getNodeRef(); + + // Create a document so that the user has the write permissions for that document + NodeRef document = fileFolderService.create(testFolder, "moveFile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); + + // Create destination folder + String destination = fileFolderService.create(testFolder, "newDest", ContentModel.TYPE_FOLDER).getNodeRef().toString(); + + // Create a record from that document + Action createAction = actionService.createAction(CreateRecordAction.NAME); + createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + actionService.executeAction(createAction, document); + + // Check if the document is a record now + assertTrue(recordService.isRecord(document)); + + // The record should have the original location information + assertNotNull(nodeService.getProperty(document, PROP_RECORD_ORIGINATING_LOCATION)); + + // Check the parents. In this case the document should have two parents (doclib and fileplan) + assertEquals(nodeService.getParentAssocs(document).size(), 2); + + // Check the number of children of dmFolder before move + assertEquals(nodeService.getChildAssocs(testFolder).size(), 2); + + // Move the record + Action moveRecordAction = actionService.createAction(MoveDmRecordAction.NAME); + moveRecordAction.setParameterValue(MoveDmRecordAction.PARAM_TARGET_NODE_REF, destination); + actionService.executeAction(moveRecordAction, document); + + // Check the number of children of dmFolder after move + assertEquals(nodeService.getChildAssocs(testFolder).size(), 1); + + // Check the new document parent + ChildAssociationRef parent1 = nodeService.getParentAssocs(document).get(0); + ChildAssociationRef parent2 = nodeService.getParentAssocs(document).get(1); + NodeRef newDocParent = (parent1.isPrimary() ? parent2 : parent1).getParentRef(); + assertEquals(destination, newDocParent.toString()); + + // Check if the original location information has been updated + assertEquals((NodeRef) nodeService.getProperty(document, PROP_RECORD_ORIGINATING_LOCATION), newDocParent); + + return null; + } + }, + dmCollaborator); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java index 11eca23cc3..050fa94b20 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java @@ -1,152 +1,152 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.action; - -import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordableVersionConfigAction.NAME; -import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordableVersionConfigAction.PARAM_VERSION; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.MAJOR_ONLY; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Recordable version config action test - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordableVersionConfigActionTest extends BaseRMTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testRecordableVersionConfigAction() - { - // Uncommented due to the failures on bamboo. Also this is related to RM-1758 - /* - doTestInTransaction(new Test() - { - final NodeRef document1 = fileFolderService.create(dmFolder, "aDocument", ContentModel.TYPE_CONTENT).getNodeRef(); - public Void run() - { - Action action = actionService.createAction(NAME); - action.setParameterValue(PARAM_VERSION, MAJOR_ONLY.toString()); - actionService.executeAction(action, document1); - return null; - } - - public void test(Void result) throws Exception - { - Serializable version = nodeService.getProperty(document1, PROP_RECORDABLE_VERSION_POLICY); - assertNotNull(version); - assertEquals(MAJOR_ONLY.toString(), (String) version); - }; - }, - dmCollaborator); - */ - - doTestInTransaction(new Test() - { - public Void run() - { - Action action = actionService.createAction(NAME); - action.setParameterValue(PARAM_VERSION, ALL.toString()); - actionService.executeAction(action, dmFolder); - return null; - } - - public void test(Void result) throws Exception - { - assertNull(nodeService.getProperty(dmFolder, PROP_RECORDABLE_VERSION_POLICY)); - }; - }, - dmCollaborator); - - doTestInTransaction(new Test() - { - final NodeRef document2 = fileFolderService.create(dmFolder, "another document", ContentModel.TYPE_CONTENT).getNodeRef(); - public Void run() - { - Action action = actionService.createAction(NAME); - action.setParameterValue(PARAM_VERSION, NONE.toString()); - actionService.executeAction(action, document2); - return null; - } - - public void test(Void result) throws Exception - { - assertNull(nodeService.getProperty(document2, PROP_RECORDABLE_VERSION_POLICY)); - }; - }, - dmCollaborator); - - - doTestInTransaction(new Test() - { - final NodeRef document3 = fileFolderService.create(dmFolder, "testfile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - public Void run() - { - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(createAction, document3); - - Action action = actionService.createAction(NAME); - action.setParameterValue(PARAM_VERSION, MAJOR_ONLY.toString()); - actionService.executeAction(action, document3); - return null; - } - - public void test(Void result) throws Exception - { - assertNull(nodeService.getProperty(document3, PROP_RECORDABLE_VERSION_POLICY)); - }; - }, - dmCollaborator); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.action; + +import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordableVersionConfigAction.NAME; +import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordableVersionConfigAction.PARAM_VERSION; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.MAJOR_ONLY; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Recordable version config action test + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RecordableVersionConfigActionTest extends BaseRMTestCase +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + public void testRecordableVersionConfigAction() + { + // Uncommented due to the failures on bamboo. Also this is related to RM-1758 + /* + doTestInTransaction(new Test() + { + final NodeRef document1 = fileFolderService.create(dmFolder, "aDocument", ContentModel.TYPE_CONTENT).getNodeRef(); + public Void run() + { + Action action = actionService.createAction(NAME); + action.setParameterValue(PARAM_VERSION, MAJOR_ONLY.toString()); + actionService.executeAction(action, document1); + return null; + } + + public void test(Void result) throws Exception + { + Serializable version = nodeService.getProperty(document1, PROP_RECORDABLE_VERSION_POLICY); + assertNotNull(version); + assertEquals(MAJOR_ONLY.toString(), (String) version); + }; + }, + dmCollaborator); + */ + + doTestInTransaction(new Test() + { + public Void run() + { + Action action = actionService.createAction(NAME); + action.setParameterValue(PARAM_VERSION, ALL.toString()); + actionService.executeAction(action, dmFolder); + return null; + } + + public void test(Void result) throws Exception + { + assertNull(nodeService.getProperty(dmFolder, PROP_RECORDABLE_VERSION_POLICY)); + }; + }, + dmCollaborator); + + doTestInTransaction(new Test() + { + final NodeRef document2 = fileFolderService.create(dmFolder, "another document", ContentModel.TYPE_CONTENT).getNodeRef(); + public Void run() + { + Action action = actionService.createAction(NAME); + action.setParameterValue(PARAM_VERSION, NONE.toString()); + actionService.executeAction(action, document2); + return null; + } + + public void test(Void result) throws Exception + { + assertNull(nodeService.getProperty(document2, PROP_RECORDABLE_VERSION_POLICY)); + }; + }, + dmCollaborator); + + + doTestInTransaction(new Test() + { + final NodeRef document3 = fileFolderService.create(dmFolder, "testfile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); + public Void run() + { + Action createAction = actionService.createAction(CreateRecordAction.NAME); + createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + actionService.executeAction(createAction, document3); + + Action action = actionService.createAction(NAME); + action.setParameterValue(PARAM_VERSION, MAJOR_ONLY.toString()); + actionService.executeAction(action, document3); + return null; + } + + public void test(Void result) throws Exception + { + assertNull(nodeService.getProperty(document3, PROP_RECORDABLE_VERSION_POLICY)); + }; + }, + dmCollaborator); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RejectActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RejectActionTest.java index 90a6157024..6b3a5f4e7b 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RejectActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RejectActionTest.java @@ -1,124 +1,124 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.action; - -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; - -/** - * Reject Action Unit Test - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RejectActionTest extends BaseRMTestCase -{ - /** Reject reason */ - private final String REJECT_REASON = "rejectReason:Not valid!£$%^&*()_+"; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testRejectAction() - { - doTestInTransaction(new Test() - { - public Void run() - { - // Create a record from the document - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(createAction, dmDocument); - - // Check if the document is a record now - assertTrue(recordService.isRecord(dmDocument)); - - // The record should have the original location information - assertNotNull(nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); - - // Check the parents. In this case the document should have two parents (doclib and fileplan) - assertTrue(nodeService.getParentAssocs(dmDocument).size() == 2); - - return null; - } - }, - dmCollaborator); - - doTestInTransaction(new FailureTest("Cannot reject a record without a reason.", IllegalArgumentException.class) - { - public void run() - { - // The test should fail if the reject reason is not supplied - Action rejectAction = actionService.createAction(RejectAction.NAME); - actionService.executeAction(rejectAction, dmDocument); - } - }, - dmCollaborator); - - doTestInTransaction(new Test() - { - public Void run() - { - // Create the reject action and add the reject reason - Action rejectAction = actionService.createAction(RejectAction.NAME); - rejectAction.setParameterValue(RejectAction.PARAM_REASON, REJECT_REASON); - actionService.executeAction(rejectAction, dmDocument); - - // The "record" aspect should be removed - assertFalse(nodeService.hasAspect(dmDocument, ASPECT_RECORD)); - - // The "file plan component" should be removed - assertFalse(nodeService.hasAspect(dmDocument, ASPECT_FILE_PLAN_COMPONENT)); - - // The "identifier" property should be removed - assertNull(nodeService.getProperty(dmDocument, PROP_IDENTIFIER)); - - // The record should be removed from the file plan - assertTrue(nodeService.getParentAssocs(dmDocument).size() == 1); - - // The extended reader information should be removed - assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); - assertTrue(extendedSecurityService.getReaders(dmDocument).isEmpty()); - - return null; - } - }, - dmCollaborator); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.action; + +import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.action.Action; + +/** + * Reject Action Unit Test + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RejectActionTest extends BaseRMTestCase +{ + /** Reject reason */ + private final String REJECT_REASON = "rejectReason:Not valid!£$%^&*()_+"; + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + public void testRejectAction() + { + doTestInTransaction(new Test() + { + public Void run() + { + // Create a record from the document + Action createAction = actionService.createAction(CreateRecordAction.NAME); + createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + actionService.executeAction(createAction, dmDocument); + + // Check if the document is a record now + assertTrue(recordService.isRecord(dmDocument)); + + // The record should have the original location information + assertNotNull(nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); + + // Check the parents. In this case the document should have two parents (doclib and fileplan) + assertTrue(nodeService.getParentAssocs(dmDocument).size() == 2); + + return null; + } + }, + dmCollaborator); + + doTestInTransaction(new FailureTest("Cannot reject a record without a reason.", IllegalArgumentException.class) + { + public void run() + { + // The test should fail if the reject reason is not supplied + Action rejectAction = actionService.createAction(RejectAction.NAME); + actionService.executeAction(rejectAction, dmDocument); + } + }, + dmCollaborator); + + doTestInTransaction(new Test() + { + public Void run() + { + // Create the reject action and add the reject reason + Action rejectAction = actionService.createAction(RejectAction.NAME); + rejectAction.setParameterValue(RejectAction.PARAM_REASON, REJECT_REASON); + actionService.executeAction(rejectAction, dmDocument); + + // The "record" aspect should be removed + assertFalse(nodeService.hasAspect(dmDocument, ASPECT_RECORD)); + + // The "file plan component" should be removed + assertFalse(nodeService.hasAspect(dmDocument, ASPECT_FILE_PLAN_COMPONENT)); + + // The "identifier" property should be removed + assertNull(nodeService.getProperty(dmDocument, PROP_IDENTIFIER)); + + // The record should be removed from the file plan + assertTrue(nodeService.getParentAssocs(dmDocument).size() == 1); + + // The extended reader information should be removed + assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); + assertTrue(extendedSecurityService.getReaders(dmDocument).isEmpty()); + + return null; + } + }, + dmCollaborator); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/CompositeCapabilityTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/CompositeCapabilityTest.java index 5c5397f7bf..3435a1fe16 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/CompositeCapabilityTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/CompositeCapabilityTest.java @@ -1,172 +1,172 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.capabilities; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Declarative capability unit test - * - * @author Roy Wetherall - */ -public class CompositeCapabilityTest extends BaseRMTestCase -{ - private NodeRef record; - private NodeRef declaredRecord; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - // Pre-filed content - record = utils.createRecord(rmFolder, "record.txt"); - declaredRecord = utils.createRecord(rmFolder, "declaredRecord.txt"); - } - - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - utils.completeRecord(declaredRecord); - - return null; - } - }); - } - - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Give all the users file permission objects - for (String user : testUsers) - { - filePlanPermissionService.setPermission(rmContainer, user, RMPermissionModel.FILING); - } - } - - public void testUpdate() - { - final Capability capability = capabilityService.getCapability("Update"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(declaredRecord)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - - return null; - } - }, userName); - - - } - - public void testUpdateProperties() - { - final Capability capability = capabilityService.getCapability("UpdateProperties"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(declaredRecord)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - - return null; - } - }, userName); - - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.capabilities; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; + +/** + * Declarative capability unit test + * + * @author Roy Wetherall + */ +public class CompositeCapabilityTest extends BaseRMTestCase +{ + private NodeRef record; + private NodeRef declaredRecord; + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected void setupTestDataImpl() + { + super.setupTestDataImpl(); + + // Pre-filed content + record = utils.createRecord(rmFolder, "record.txt"); + declaredRecord = utils.createRecord(rmFolder, "declaredRecord.txt"); + } + + @Override + protected void setupTestData() + { + super.setupTestData(); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + utils.completeRecord(declaredRecord); + + return null; + } + }); + } + + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + } + + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + // Give all the users file permission objects + for (String user : testUsers) + { + filePlanPermissionService.setPermission(rmContainer, user, RMPermissionModel.FILING); + } + } + + public void testUpdate() + { + final Capability capability = capabilityService.getCapability("Update"); + assertNotNull(capability); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(declaredRecord)); + + return null; + } + }, recordsManagerName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); + + return null; + } + }, userName); + + + } + + public void testUpdateProperties() + { + final Capability capability = capabilityService.getCapability("UpdateProperties"); + assertNotNull(capability); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(declaredRecord)); + + return null; + } + }, recordsManagerName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); + + return null; + } + }, userName); + + + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/DeclarativeCapabilityTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/DeclarativeCapabilityTest.java index a906c8fe85..d56012eebe 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/DeclarativeCapabilityTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/capabilities/DeclarativeCapabilityTest.java @@ -1,502 +1,502 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.capabilities; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCompositeCapability; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.springframework.extensions.webscripts.GUID; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Declarative capability unit test - * - * @author Roy Wetherall - */ -public class DeclarativeCapabilityTest extends BaseRMTestCase -{ - private NodeRef record; - private NodeRef declaredRecord; - private NodeRef undeclaredRecord; - - private NodeRef recordFolderContainsFrozen; - private NodeRef frozenRecord; - private NodeRef frozenRecord2; - private NodeRef frozenRecordFolder; - - private NodeRef closedFolder; - - private NodeRef moveToFolder; - private NodeRef moveToCategory; - - private NodeRef hold; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - // Pre-filed content - record = utils.createRecord(rmFolder, "record.txt"); - declaredRecord = utils.createRecord(rmFolder, "declaredRecord.txt"); - undeclaredRecord = utils.createRecord(rmFolder, "undeclaredRecord.txt"); - - // Closed folder - closedFolder = recordFolderService.createRecordFolder(rmContainer, "closedFolder"); - utils.closeFolder(closedFolder); - - // Frozen artifacts - recordFolderContainsFrozen = recordFolderService.createRecordFolder(rmContainer, "containsFrozen"); - frozenRecord = utils.createRecord(rmFolder, "frozenRecord.txt"); - frozenRecord2 = utils.createRecord(recordFolderContainsFrozen, "frozen2.txt"); - frozenRecordFolder = recordFolderService.createRecordFolder(rmContainer, "frozenRecordFolder"); - - // MoveTo artifacts - moveToFolder = recordFolderService.createRecordFolder(rmContainer, "moveToFolder"); - moveToCategory = filePlanService.createRecordCategory(rmContainer, "moveToCategory"); - } - - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - utils.completeRecord(declaredRecord); - utils.completeRecord(frozenRecord); - utils.completeRecord(frozenRecord2); - - hold = holdService.createHold(filePlan, GUID.generate(), "reason", "description"); - - holdService.addToHold(hold, frozenRecord); - holdService.addToHold(hold, frozenRecordFolder); - holdService.addToHold(hold, frozenRecord2); - - return null; - } - }); - } - - @Override - protected void tearDownImpl() - { - // Unfreeze stuff so it can be deleted - holdService.removeFromHold(hold, frozenRecord); - holdService.removeFromHold(hold, frozenRecordFolder); - holdService.removeFromHold(hold, frozenRecord2); - - super.tearDownImpl(); - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Give all the users file permission objects - for (String user : testUsers) - { - filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmContainer, user, RMPermissionModel.READ_RECORDS); - filePlanPermissionService.setPermission(moveToFolder, user, RMPermissionModel.READ_RECORDS); - filePlanPermissionService.setPermission(moveToCategory, user, RMPermissionModel.READ_RECORDS); - } - } - - public void testDeclarativeCapabilities() - { - Set capabilities = capabilityService.getCapabilities(); - for (Capability capability : capabilities) - { - if (capability instanceof DeclarativeCapability && - !(capability instanceof DeclarativeCompositeCapability) && - !capability.isPrivate() && - !capability.getName().equals("MoveRecords") && - !capability.getName().equals("DeleteLinks") && - !capability.getName().equals("ChangeOrDeleteReferences")) - { - testDeclarativeCapability((DeclarativeCapability)capability); - } - } - } - - private void testDeclarativeCapability(final DeclarativeCapability capability) - { - for (String user : testUsers) - { - testDeclarativeCapability(capability, user, filePlan); - testDeclarativeCapability(capability, user, rmContainer); - testDeclarativeCapability(capability, user, rmFolder); - testDeclarativeCapability(capability, user, record); - } - } - - private void testDeclarativeCapability(final DeclarativeCapability capability, final String userName, final NodeRef filePlanComponent) - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - AccessStatus accessStatus = capability.hasPermission(filePlanComponent); - - Set roles = filePlanRoleService.getRolesByUser(filePlan, userName); - if (roles.isEmpty()) - { - assertEquals("User " + userName + " has no RM role so we expect access to be denied for capability " + capability.getName(), - AccessStatus.DENIED, - accessStatus); - } - else - { - // Do the kind check here ... - FilePlanComponentKind actualKind = filePlanService.getFilePlanComponentKind(filePlanComponent); - List kinds = capability.getKinds(); - - if (kinds == null || - kinds.contains(actualKind.toString())) - { - Map conditions = capability.getConditions(); - boolean conditionResult = getConditionResult(filePlanComponent, conditions); - - assertEquals("User is expected to only have one role.", 1, roles.size()); - Role role = new ArrayList(roles).get(0); - assertNotNull(role); - - Set roleCapabilities = role.getCapabilities(); - if (roleCapabilities.contains(capability) && conditionResult) - { - assertEquals("User " + userName + " has the role " + role.getDisplayLabel() + - " so we expect access to be allowed for capability " + capability.getName() + " on the object " + - (String)nodeService.getProperty(filePlanComponent, ContentModel.PROP_NAME), - AccessStatus.ALLOWED, - accessStatus); - } - else - { - assertEquals("User " + userName + " has the role " + role.getDisplayLabel() + " so we expect access to be denied for capability " + capability.getName(), - AccessStatus.DENIED, - accessStatus); - } - } - else - { - // Expect fail since the kind is not expected by the capability - assertEquals("NodeRef is of kind" + actualKind + " so we expect access to be denied for capability " + capability.getName(), - AccessStatus.DENIED, - accessStatus); - } - } - - return null; - } - }, userName); - } - - private boolean getConditionResult(NodeRef nodeRef, Map conditions) - { - boolean result = true; - - if (conditions != null && conditions.size() != 0) - { - for (Map.Entry entry : conditions.entrySet()) - { - // Get the condition bean - CapabilityCondition condition = (CapabilityCondition)applicationContext.getBean(entry.getKey()); - assertNotNull("Invalid condition name.", condition); - - boolean actual = condition.evaluate(nodeRef); - if (actual != entry.getValue().booleanValue()) - { - result = false; - break; - } - } - } - - return result; - } - - /** Specific declarative capability tests */ - - public void testCreateRecordCapability() - { - final Capability capability = capabilityService.getCapability("CreateRecords"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - - return null; - } - }, rmUserName); - } - - public void testMoveRecordCapability() - { - // grab the move record capability - final Capability capability = capabilityService.getCapability("MoveRecords"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // first take a look at just the record - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(record)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(undeclaredRecord)); - - // now lets take a look when we know what the destination is - // NOTE: should be denied since we do not have file permission on the destination folder - // despite having the capability! - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(record, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(declaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(undeclaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - for (String user : testUsers) - { - filePlanPermissionService.setPermission(moveToFolder, user, RMPermissionModel.FILING); - } - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // first take a look at just the record - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(record)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(undeclaredRecord)); - - // now lets take a look when we know what the destination is - // NOTE: should be allowed now since we have filling permission on the destination folder - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(record, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(declaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(undeclaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // first take a look at just the record - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); - - // now lets take a look when we know what the destination is - // NOTE: should be allowed now since we have filling permission on the destination folder - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(record, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(declaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(undeclaredRecord, moveToFolder)); - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); - - return null; - } - }, rmUserName); - } - - public void testMoveRecordFolderCapability() - { - // grab the move record capability - final Capability capability = capabilityService.getCapability("MoveRecordFolder"); - assertNotNull(capability); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // first take a look at just the record - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); - - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(rmFolder, moveToCategory)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - for (String user : testUsers) - { - filePlanPermissionService.setPermission(moveToCategory, user, RMPermissionModel.FILING); - } - return null; - } - }, ADMIN_USER); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); - - assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(rmFolder, moveToCategory)); - - return null; - } - }, recordsManagerName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); - assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); - - assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(rmFolder, moveToCategory)); - - return null; - } - }, rmUserName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.capabilities; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCompositeCapability; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.springframework.extensions.webscripts.GUID; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Declarative capability unit test + * + * @author Roy Wetherall + */ +public class DeclarativeCapabilityTest extends BaseRMTestCase +{ + private NodeRef record; + private NodeRef declaredRecord; + private NodeRef undeclaredRecord; + + private NodeRef recordFolderContainsFrozen; + private NodeRef frozenRecord; + private NodeRef frozenRecord2; + private NodeRef frozenRecordFolder; + + private NodeRef closedFolder; + + private NodeRef moveToFolder; + private NodeRef moveToCategory; + + private NodeRef hold; + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected void setupTestDataImpl() + { + super.setupTestDataImpl(); + + // Pre-filed content + record = utils.createRecord(rmFolder, "record.txt"); + declaredRecord = utils.createRecord(rmFolder, "declaredRecord.txt"); + undeclaredRecord = utils.createRecord(rmFolder, "undeclaredRecord.txt"); + + // Closed folder + closedFolder = recordFolderService.createRecordFolder(rmContainer, "closedFolder"); + utils.closeFolder(closedFolder); + + // Frozen artifacts + recordFolderContainsFrozen = recordFolderService.createRecordFolder(rmContainer, "containsFrozen"); + frozenRecord = utils.createRecord(rmFolder, "frozenRecord.txt"); + frozenRecord2 = utils.createRecord(recordFolderContainsFrozen, "frozen2.txt"); + frozenRecordFolder = recordFolderService.createRecordFolder(rmContainer, "frozenRecordFolder"); + + // MoveTo artifacts + moveToFolder = recordFolderService.createRecordFolder(rmContainer, "moveToFolder"); + moveToCategory = filePlanService.createRecordCategory(rmContainer, "moveToCategory"); + } + + @Override + protected void setupTestData() + { + super.setupTestData(); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + utils.completeRecord(declaredRecord); + utils.completeRecord(frozenRecord); + utils.completeRecord(frozenRecord2); + + hold = holdService.createHold(filePlan, GUID.generate(), "reason", "description"); + + holdService.addToHold(hold, frozenRecord); + holdService.addToHold(hold, frozenRecordFolder); + holdService.addToHold(hold, frozenRecord2); + + return null; + } + }); + } + + @Override + protected void tearDownImpl() + { + // Unfreeze stuff so it can be deleted + holdService.removeFromHold(hold, frozenRecord); + holdService.removeFromHold(hold, frozenRecordFolder); + holdService.removeFromHold(hold, frozenRecord2); + + super.tearDownImpl(); + } + + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + // Give all the users file permission objects + for (String user : testUsers) + { + filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(rmContainer, user, RMPermissionModel.READ_RECORDS); + filePlanPermissionService.setPermission(moveToFolder, user, RMPermissionModel.READ_RECORDS); + filePlanPermissionService.setPermission(moveToCategory, user, RMPermissionModel.READ_RECORDS); + } + } + + public void testDeclarativeCapabilities() + { + Set capabilities = capabilityService.getCapabilities(); + for (Capability capability : capabilities) + { + if (capability instanceof DeclarativeCapability && + !(capability instanceof DeclarativeCompositeCapability) && + !capability.isPrivate() && + !capability.getName().equals("MoveRecords") && + !capability.getName().equals("DeleteLinks") && + !capability.getName().equals("ChangeOrDeleteReferences")) + { + testDeclarativeCapability((DeclarativeCapability)capability); + } + } + } + + private void testDeclarativeCapability(final DeclarativeCapability capability) + { + for (String user : testUsers) + { + testDeclarativeCapability(capability, user, filePlan); + testDeclarativeCapability(capability, user, rmContainer); + testDeclarativeCapability(capability, user, rmFolder); + testDeclarativeCapability(capability, user, record); + } + } + + private void testDeclarativeCapability(final DeclarativeCapability capability, final String userName, final NodeRef filePlanComponent) + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + AccessStatus accessStatus = capability.hasPermission(filePlanComponent); + + Set roles = filePlanRoleService.getRolesByUser(filePlan, userName); + if (roles.isEmpty()) + { + assertEquals("User " + userName + " has no RM role so we expect access to be denied for capability " + capability.getName(), + AccessStatus.DENIED, + accessStatus); + } + else + { + // Do the kind check here ... + FilePlanComponentKind actualKind = filePlanService.getFilePlanComponentKind(filePlanComponent); + List kinds = capability.getKinds(); + + if (kinds == null || + kinds.contains(actualKind.toString())) + { + Map conditions = capability.getConditions(); + boolean conditionResult = getConditionResult(filePlanComponent, conditions); + + assertEquals("User is expected to only have one role.", 1, roles.size()); + Role role = new ArrayList(roles).get(0); + assertNotNull(role); + + Set roleCapabilities = role.getCapabilities(); + if (roleCapabilities.contains(capability) && conditionResult) + { + assertEquals("User " + userName + " has the role " + role.getDisplayLabel() + + " so we expect access to be allowed for capability " + capability.getName() + " on the object " + + (String)nodeService.getProperty(filePlanComponent, ContentModel.PROP_NAME), + AccessStatus.ALLOWED, + accessStatus); + } + else + { + assertEquals("User " + userName + " has the role " + role.getDisplayLabel() + " so we expect access to be denied for capability " + capability.getName(), + AccessStatus.DENIED, + accessStatus); + } + } + else + { + // Expect fail since the kind is not expected by the capability + assertEquals("NodeRef is of kind" + actualKind + " so we expect access to be denied for capability " + capability.getName(), + AccessStatus.DENIED, + accessStatus); + } + } + + return null; + } + }, userName); + } + + private boolean getConditionResult(NodeRef nodeRef, Map conditions) + { + boolean result = true; + + if (conditions != null && conditions.size() != 0) + { + for (Map.Entry entry : conditions.entrySet()) + { + // Get the condition bean + CapabilityCondition condition = (CapabilityCondition)applicationContext.getBean(entry.getKey()); + assertNotNull("Invalid condition name.", condition); + + boolean actual = condition.evaluate(nodeRef); + if (actual != entry.getValue().booleanValue()) + { + result = false; + break; + } + } + } + + return result; + } + + /** Specific declarative capability tests */ + + public void testCreateRecordCapability() + { + final Capability capability = capabilityService.getCapability("CreateRecords"); + assertNotNull(capability); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.ALLOWED, capability.hasPermission(record)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); + + return null; + } + }, recordsManagerName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); + + return null; + } + }, rmUserName); + } + + public void testMoveRecordCapability() + { + // grab the move record capability + final Capability capability = capabilityService.getCapability("MoveRecords"); + assertNotNull(capability); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // first take a look at just the record + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(record)); + assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(declaredRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); + assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(undeclaredRecord)); + + // now lets take a look when we know what the destination is + // NOTE: should be denied since we do not have file permission on the destination folder + // despite having the capability! + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(record, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(declaredRecord, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(undeclaredRecord, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); + + return null; + } + }, recordsManagerName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + for (String user : testUsers) + { + filePlanPermissionService.setPermission(moveToFolder, user, RMPermissionModel.FILING); + } + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // first take a look at just the record + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(record)); + assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(declaredRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); + assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(undeclaredRecord)); + + // now lets take a look when we know what the destination is + // NOTE: should be allowed now since we have filling permission on the destination folder + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(record, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(declaredRecord, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(undeclaredRecord, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); + + return null; + } + }, recordsManagerName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // first take a look at just the record + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); + + // now lets take a look when we know what the destination is + // NOTE: should be allowed now since we have filling permission on the destination folder + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(record, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(declaredRecord, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(undeclaredRecord, moveToFolder)); + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(frozenRecord, moveToFolder)); + + return null; + } + }, rmUserName); + } + + public void testMoveRecordFolderCapability() + { + // grab the move record capability + final Capability capability = capabilityService.getCapability("MoveRecordFolder"); + assertNotNull(capability); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // first take a look at just the record + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); + + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(rmFolder, moveToCategory)); + + return null; + } + }, recordsManagerName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + for (String user : testUsers) + { + filePlanPermissionService.setPermission(moveToCategory, user, RMPermissionModel.FILING); + } + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.UNDETERMINED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); + + assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(rmFolder, moveToCategory)); + + return null; + } + }, recordsManagerName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmContainer)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(rmFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(record)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(declaredRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecordFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(recordFolderContainsFrozen)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(frozenRecord)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(closedFolder)); + assertEquals(AccessStatus.DENIED, capability.hasPermission(undeclaredRecord)); + + assertEquals(AccessDecisionVoter.ACCESS_DENIED, capability.evaluate(rmFolder, moveToCategory)); + + return null; + } + }, rmUserName); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java index de3b01bc45..df06740745 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java @@ -1,165 +1,165 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.jscript; - -import java.io.Serializable; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.jscript.app.JSONConversionComponent; -import org.alfresco.service.cmr.repository.NodeRef; -import org.apache.commons.lang.ArrayUtils; -import org.json.JSONException; -import org.json.JSONObject; - -/** - * @author Roy Wetherall - */ -public class JSONConversionComponentTest extends BaseRMTestCase -{ - protected JSONConversionComponent converter; - protected NodeRef record; - - @Override - protected void initServices() - { - super.initServices(); - converter = (JSONConversionComponent) applicationContext.getBean("jsonConversionComponent"); - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - // Create records - record = utils.createRecord(rmFolder, "testRecord.txt"); - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testJSON() throws Exception - { - doTestInTransaction(new JSONTest - ( - filePlan, - new String[]{"isRmNode", "true", "boolean"}, - new String[]{"rmNode.kind", "FILE_PLAN"} - ){}); - - doTestInTransaction(new JSONTest - ( - rmContainer, - new String[]{"isRmNode", "true", "boolean"}, - new String[]{"rmNode.kind", "RECORD_CATEGORY"} - ){}); - - doTestInTransaction(new JSONTest - ( - rmFolder, - new String[]{"isRmNode", "true", "boolean"}, - new String[]{"rmNode.kind", "RECORD_FOLDER"} - ){}); - - doTestInTransaction(new JSONTest - ( - record, - new String[]{"isRmNode", "true", "boolean"}, - new String[]{"rmNode.kind", "RECORD"} - ){}); - } - - class JSONTest extends Test - { - private NodeRef nodeRef; - private String[][] testValues; - - public JSONTest(NodeRef nodeRef, String[] ... testValues) - { - this.nodeRef = nodeRef; - this.testValues = testValues; - } - - @Override - public JSONObject run() throws Exception - { - String json = converter.toJSON(nodeRef, true); - //System.out.println(json); - return new JSONObject(json); - } - - @Override - public void test(JSONObject result) throws Exception - { - for (String[] testValue : testValues) - { - String key = testValue[0]; - String type = "string"; - if (testValue.length == 3) - { - type = testValue[2]; - } - Serializable value = convertValue(testValue[1], type); - Serializable actualValue = (Serializable)getValue(result, key); - - assertEquals("The key " + key + " did not have the expected value.", value, actualValue); - } - } - - private Serializable convertValue(String stringValue, String type) - { - Serializable value = stringValue; - if (type.equals("boolean")) - { - value = new Boolean(stringValue); - } - return value; - } - - private Object getValue(JSONObject jsonObject, String key) throws JSONException - { - return getValue(jsonObject, key.split("\\.")); - } - - private Object getValue(JSONObject jsonObject, String[] key) throws JSONException - { - if (key.length == 1) - { - return jsonObject.get(key[0]); - } - else - { - return getValue(jsonObject.getJSONObject(key[0]), - (String[])ArrayUtils.subarray(key, 1, key.length)); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.jscript; + +import java.io.Serializable; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.jscript.app.JSONConversionComponent; +import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.commons.lang.ArrayUtils; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * @author Roy Wetherall + */ +public class JSONConversionComponentTest extends BaseRMTestCase +{ + protected JSONConversionComponent converter; + protected NodeRef record; + + @Override + protected void initServices() + { + super.initServices(); + converter = (JSONConversionComponent) applicationContext.getBean("jsonConversionComponent"); + } + + @Override + protected void setupTestDataImpl() + { + super.setupTestDataImpl(); + + // Create records + record = utils.createRecord(rmFolder, "testRecord.txt"); + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + public void testJSON() throws Exception + { + doTestInTransaction(new JSONTest + ( + filePlan, + new String[]{"isRmNode", "true", "boolean"}, + new String[]{"rmNode.kind", "FILE_PLAN"} + ){}); + + doTestInTransaction(new JSONTest + ( + rmContainer, + new String[]{"isRmNode", "true", "boolean"}, + new String[]{"rmNode.kind", "RECORD_CATEGORY"} + ){}); + + doTestInTransaction(new JSONTest + ( + rmFolder, + new String[]{"isRmNode", "true", "boolean"}, + new String[]{"rmNode.kind", "RECORD_FOLDER"} + ){}); + + doTestInTransaction(new JSONTest + ( + record, + new String[]{"isRmNode", "true", "boolean"}, + new String[]{"rmNode.kind", "RECORD"} + ){}); + } + + class JSONTest extends Test + { + private NodeRef nodeRef; + private String[][] testValues; + + public JSONTest(NodeRef nodeRef, String[] ... testValues) + { + this.nodeRef = nodeRef; + this.testValues = testValues; + } + + @Override + public JSONObject run() throws Exception + { + String json = converter.toJSON(nodeRef, true); + //System.out.println(json); + return new JSONObject(json); + } + + @Override + public void test(JSONObject result) throws Exception + { + for (String[] testValue : testValues) + { + String key = testValue[0]; + String type = "string"; + if (testValue.length == 3) + { + type = testValue[2]; + } + Serializable value = convertValue(testValue[1], type); + Serializable actualValue = (Serializable)getValue(result, key); + + assertEquals("The key " + key + " did not have the expected value.", value, actualValue); + } + } + + private Serializable convertValue(String stringValue, String type) + { + Serializable value = stringValue; + if (type.equals("boolean")) + { + value = new Boolean(stringValue); + } + return value; + } + + private Object getValue(JSONObject jsonObject, String key) throws JSONException + { + return getValue(jsonObject, key.split("\\.")); + } + + private Object getValue(JSONObject jsonObject, String[] key) throws JSONException + { + if (key.length == 1) + { + return jsonObject.get(key[0]); + } + else + { + return getValue(jsonObject.getJSONObject(key[0]), + (String[])ArrayUtils.subarray(key, 1, key.length)); + } + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/security/MethodSecurityTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/security/MethodSecurityTest.java index ace03aa810..b557fb64e3 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/security/MethodSecurityTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/security/MethodSecurityTest.java @@ -1,87 +1,87 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.security; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * Tests method level security of core alfresco services. - * - * @author Roy Wetherall - * @since 2.0 - */ -public class MethodSecurityTest extends BaseRMTestCase implements RMPermissionModel -{ - /** - * Indicate this is a user test. - * - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * Test node service security access - */ - public void testNodeService() - { - doTestInTransaction(new FailureTest - ( - "We don't have permission to access this node." - ) - { - @Override - public void run() - { - nodeService.getProperties(rmContainer); - } - - }, rmUserName); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(rmContainer, rmUserName, READ_RECORDS); - return null; - } - - @Override - public void test(Void result) throws Exception - { - nodeService.getProperties(rmContainer); - } - - }, rmUserName); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.security; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; + +/** + * Tests method level security of core alfresco services. + * + * @author Roy Wetherall + * @since 2.0 + */ +public class MethodSecurityTest extends BaseRMTestCase implements RMPermissionModel +{ + /** + * Indicate this is a user test. + * + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * Test node service security access + */ + public void testNodeService() + { + doTestInTransaction(new FailureTest + ( + "We don't have permission to access this node." + ) + { + @Override + public void run() + { + nodeService.getProperties(rmContainer); + } + + }, rmUserName); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanPermissionService.setPermission(rmContainer, rmUserName, READ_RECORDS); + return null; + } + + @Override + public void test(Void result) throws Exception + { + nodeService.getProperties(rmContainer); + } + + }, rmUserName); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java index 196d76285f..470ad33214 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java @@ -1,144 +1,144 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.Group; -import org.alfresco.module.org_alfresco_module_rm.capability.GroupImpl; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * Test class for testing the methods in {@link CapabilityService} - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class CapabilityServiceImplTest extends BaseRMTestCase -{ - public void testGetAddRemoveGroups() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Group auditGroup = capabilityService.getGroup("audit"); - assertNotNull(auditGroup); - assertEquals(10, auditGroup.getIndex()); - assertEquals("Audit", auditGroup.getTitle()); - assertEquals("audit", auditGroup.getId()); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - int initialSize = capabilityService.getGroups().size(); - - GroupImpl testGroup = new GroupImpl(); - testGroup.setId("testGroup"); - testGroup.setIndex(140); - testGroup.setTitle("Test group"); - capabilityService.addGroup(testGroup); - - assertEquals(initialSize+1, capabilityService.getGroups().size()); - - Group group = capabilityService.getGroup("testGroup"); - assertNotNull(group); - assertTrue(group.getId().equalsIgnoreCase("testGroup")); - assertTrue(group.getTitle().equalsIgnoreCase("Test group")); - assertTrue(group.getIndex() == 140); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Group testGroup = capabilityService.getGroup("testGroup"); - assertNotNull(testGroup); - int initialSize = capabilityService.getGroups().size(); - - capabilityService.removeGroup(testGroup); - assertEquals(initialSize-1, capabilityService.getGroups().size()); - - return null; - } - }); - } - - public void testGetCapabilitiesByGroup() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - List groups = capabilityService.getGroups(); - assertNotNull(groups); - - Group recordsGroup = groups.get(0); - assertNotNull(recordsGroup); - - List recordCapabilities = capabilityService.getCapabilitiesByGroup(recordsGroup); - assertNotNull(recordCapabilities); - - int recordCapabilitiesSize = recordCapabilities.size(); - assertTrue(recordCapabilitiesSize > 1); - - for (int i = 1; i == recordCapabilitiesSize; i++) - { - Capability capability = recordCapabilities.get(i); - assertNotNull(capability); - assertEquals(i * 10, capability.getIndex()); - } - - Group rulesGroup = groups.get(groups.size() - 2); - assertNotNull(rulesGroup); - - List ruleCapabilities = capabilityService.getCapabilitiesByGroupId(rulesGroup.getId()); - assertNotNull(ruleCapabilities); - - int ruleCapabilitiesSize = ruleCapabilities.size(); - assertTrue(ruleCapabilitiesSize > 0); - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.capability.Group; +import org.alfresco.module.org_alfresco_module_rm.capability.GroupImpl; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; + +/** + * Test class for testing the methods in {@link CapabilityService} + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class CapabilityServiceImplTest extends BaseRMTestCase +{ + public void testGetAddRemoveGroups() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + Group auditGroup = capabilityService.getGroup("audit"); + assertNotNull(auditGroup); + assertEquals(10, auditGroup.getIndex()); + assertEquals("Audit", auditGroup.getTitle()); + assertEquals("audit", auditGroup.getId()); + + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + int initialSize = capabilityService.getGroups().size(); + + GroupImpl testGroup = new GroupImpl(); + testGroup.setId("testGroup"); + testGroup.setIndex(140); + testGroup.setTitle("Test group"); + capabilityService.addGroup(testGroup); + + assertEquals(initialSize+1, capabilityService.getGroups().size()); + + Group group = capabilityService.getGroup("testGroup"); + assertNotNull(group); + assertTrue(group.getId().equalsIgnoreCase("testGroup")); + assertTrue(group.getTitle().equalsIgnoreCase("Test group")); + assertTrue(group.getIndex() == 140); + + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + Group testGroup = capabilityService.getGroup("testGroup"); + assertNotNull(testGroup); + int initialSize = capabilityService.getGroups().size(); + + capabilityService.removeGroup(testGroup); + assertEquals(initialSize-1, capabilityService.getGroups().size()); + + return null; + } + }); + } + + public void testGetCapabilitiesByGroup() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + List groups = capabilityService.getGroups(); + assertNotNull(groups); + + Group recordsGroup = groups.get(0); + assertNotNull(recordsGroup); + + List recordCapabilities = capabilityService.getCapabilitiesByGroup(recordsGroup); + assertNotNull(recordCapabilities); + + int recordCapabilitiesSize = recordCapabilities.size(); + assertTrue(recordCapabilitiesSize > 1); + + for (int i = 1; i == recordCapabilitiesSize; i++) + { + Capability capability = recordCapabilities.get(i); + assertNotNull(capability); + assertEquals(i * 10, capability.getIndex()); + } + + Group rulesGroup = groups.get(groups.size() - 2); + assertNotNull(rulesGroup); + + List ruleCapabilities = capabilityService.getCapabilitiesByGroupId(rulesGroup.getId()); + assertNotNull(ruleCapabilities); + + int ruleCapabilitiesSize = ruleCapabilities.size(); + assertTrue(ruleCapabilitiesSize > 0); + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CustomEMailMappingServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CustomEMailMappingServiceImplTest.java index f4df2a54a8..7c0605d129 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CustomEMailMappingServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CustomEMailMappingServiceImplTest.java @@ -1,155 +1,155 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.alfresco.module.org_alfresco_module_rm.email.CustomMapping; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * Custom EMail Mapping Service - * - * @author Roy Wetherall - * @since 2.0 - */ -public class CustomEMailMappingServiceImplTest extends BaseRMTestCase -{ - private CustomEmailMappingService eMailMappingService; - - @Override - protected void initServices() - { - super.initServices(); - - eMailMappingService = (CustomEmailMappingService)applicationContext.getBean("customEmailMappingService"); - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setUp() throws Exception - { - super.setUp(); - eMailMappingService.registerEMailMappingKey("EmailMappingKeyTest1"); - eMailMappingService.registerEMailMappingKey("EmailMappingKeyTest2"); - } - - public void testCRUD() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - // Check the initial custom mapping size - assertTrue(checkCustomMappingsSize(20)); - - String firstKey = eMailMappingService.getEmailMappingKeys().get(0); - - // Add a custom mapping - eMailMappingService.addCustomMapping(firstKey, "cm:monkeyFace"); - - // Check the new size - assertTrue(checkCustomMappingsSize(21)); - - // Check the new added custom mapping - CustomMapping monkeyMapping = getCustomMapping(firstKey, "cm:monkeyFace"); - assertNotNull(monkeyMapping); - assertEquals(firstKey, monkeyMapping.getFrom()); - assertEquals("cm:monkeyFace", monkeyMapping.getTo()); - - // Delete the new added custom mapping - eMailMappingService.deleteCustomMapping(firstKey, "cm:monkeyFace"); - - // Check the size after deletion - assertTrue(checkCustomMappingsSize(20)); - - // Check the custom mapping after deletion if it exists - assertNull(getCustomMapping(firstKey, "cm:monkeyFace")); - - // Check the email mapping keys size - // There are 6 "standard" EmailMappingKeys + 2 CustomEmailMappingKeys are added on setUp - assertTrue(checkEmailMappingKeysSize(8)); - - try - { - eMailMappingService.addCustomMapping(" ", "cm:monkeyFace"); - fail("Should not get here. Invalid data."); - } - catch (AlfrescoRuntimeException are) - { - assertNotNull(are); //Must throw this exception - assertTrue(are.getMessage().contains("Invalid values for")); - } - - try - { - eMailMappingService.addCustomMapping("monkey", " "); - fail("Should not get here. Invalid data."); - } - catch (AlfrescoRuntimeException are) - { - assertNotNull(are); //Must throw this exception - assertTrue(are.getMessage().contains("Invalid values for")); - } - - eMailMappingService.addCustomMapping(firstKey, "cm:monkeyFace"); //valid key - - return null; - } - }, ADMIN_USER); - } - - private CustomMapping getCustomMapping(String from, String to) - { - CustomMapping result = null; - for (CustomMapping customMapping : eMailMappingService.getCustomMappings()) - { - if (customMapping.getFrom().equalsIgnoreCase(from) && customMapping.getTo().equalsIgnoreCase(to)) - { - result = customMapping; - break; - } - } - return result; - } - - private boolean checkCustomMappingsSize(int expected) - { - return expected == eMailMappingService.getCustomMappings().size() ? true : false; - } - - private boolean checkEmailMappingKeysSize(int expected) - { - return expected == eMailMappingService.getEmailMappingKeys().size() ? true : false; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; +import org.alfresco.module.org_alfresco_module_rm.email.CustomMapping; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; + +/** + * Custom EMail Mapping Service + * + * @author Roy Wetherall + * @since 2.0 + */ +public class CustomEMailMappingServiceImplTest extends BaseRMTestCase +{ + private CustomEmailMappingService eMailMappingService; + + @Override + protected void initServices() + { + super.initServices(); + + eMailMappingService = (CustomEmailMappingService)applicationContext.getBean("customEmailMappingService"); + } + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected void setUp() throws Exception + { + super.setUp(); + eMailMappingService.registerEMailMappingKey("EmailMappingKeyTest1"); + eMailMappingService.registerEMailMappingKey("EmailMappingKeyTest2"); + } + + public void testCRUD() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + // Check the initial custom mapping size + assertTrue(checkCustomMappingsSize(20)); + + String firstKey = eMailMappingService.getEmailMappingKeys().get(0); + + // Add a custom mapping + eMailMappingService.addCustomMapping(firstKey, "cm:monkeyFace"); + + // Check the new size + assertTrue(checkCustomMappingsSize(21)); + + // Check the new added custom mapping + CustomMapping monkeyMapping = getCustomMapping(firstKey, "cm:monkeyFace"); + assertNotNull(monkeyMapping); + assertEquals(firstKey, monkeyMapping.getFrom()); + assertEquals("cm:monkeyFace", monkeyMapping.getTo()); + + // Delete the new added custom mapping + eMailMappingService.deleteCustomMapping(firstKey, "cm:monkeyFace"); + + // Check the size after deletion + assertTrue(checkCustomMappingsSize(20)); + + // Check the custom mapping after deletion if it exists + assertNull(getCustomMapping(firstKey, "cm:monkeyFace")); + + // Check the email mapping keys size + // There are 6 "standard" EmailMappingKeys + 2 CustomEmailMappingKeys are added on setUp + assertTrue(checkEmailMappingKeysSize(8)); + + try + { + eMailMappingService.addCustomMapping(" ", "cm:monkeyFace"); + fail("Should not get here. Invalid data."); + } + catch (AlfrescoRuntimeException are) + { + assertNotNull(are); //Must throw this exception + assertTrue(are.getMessage().contains("Invalid values for")); + } + + try + { + eMailMappingService.addCustomMapping("monkey", " "); + fail("Should not get here. Invalid data."); + } + catch (AlfrescoRuntimeException are) + { + assertNotNull(are); //Must throw this exception + assertTrue(are.getMessage().contains("Invalid values for")); + } + + eMailMappingService.addCustomMapping(firstKey, "cm:monkeyFace"); //valid key + + return null; + } + }, ADMIN_USER); + } + + private CustomMapping getCustomMapping(String from, String to) + { + CustomMapping result = null; + for (CustomMapping customMapping : eMailMappingService.getCustomMappings()) + { + if (customMapping.getFrom().equalsIgnoreCase(from) && customMapping.getTo().equalsIgnoreCase(to)) + { + result = customMapping; + break; + } + } + return result; + } + + private boolean checkCustomMappingsSize(int expected) + { + return expected == eMailMappingService.getCustomMappings().size() ? true : false; + } + + private boolean checkEmailMappingKeysSize(int expected) + { + return expected == eMailMappingService.getEmailMappingKeys().size() ? true : false; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DataSetServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DataSetServiceImplTest.java index 4b23890fcd..536bc12a14 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DataSetServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DataSetServiceImplTest.java @@ -1,273 +1,273 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSet; -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Dataset Service Test - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class DataSetServiceImplTest extends BaseRMTestCase -{ - /** Id of the test data set*/ - private static final String DATA_SET_ID = "testExampleData"; - - /** - * @see DataSetService#getDataSets() - */ - public void testGetDataSets() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Map dataSets = dataSetService.getDataSets(); - // Test the data sets - assertNotNull(dataSets); - // At least the test data set must exist - assertTrue(dataSets.size() >= 1); - // The test data set must be in the list of available data sets - assertNotNull(dataSets.get(DATA_SET_ID)); - - for (Map.Entry entry : dataSets.entrySet()) - { - // Test the key - String key = entry.getKey(); - assertNotNull(key); - - // Test the value - DataSet dataSet = entry.getValue(); - assertNotNull(dataSet); - - // Test the id - String id = dataSet.getId(); - assertNotNull(id); - assertEquals(id, key); - - // Test the label - String label = dataSet.getLabel(); - assertNotNull(label); - - // Test the path - String path = dataSet.getPath(); - assertNotNull(path); - } - - return null; - } - }); - } - - /** - * @see DataSetService#loadDataSet(String, org.alfresco.service.cmr.repository.NodeRef) - */ - public void testLoadDataSet() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Test the file plan before importing the data sets - testFilePlanBeforeImportingDataSet(); - - // Load the data set into the specified file plan - dataSetService.loadDataSet(filePlan, DATA_SET_ID); - - // Test the file plan after importing the data sets - testFilePlanAfterImportingDataSet(); - - return null; - } - - /** - * Helper method for testing the test file plan before importing the data - */ - private void testFilePlanBeforeImportingDataSet() - { - // There should not be any categories before importing - assertNull(nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1")); - assertNull(nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory2")); - - // The aspect should exist before loading a data set - assertNull(nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS)); - - // At the beginning the file plan is empty. So there should not be any data sets - assertTrue(dataSetService.getLoadedDataSets(filePlan).size() == 0); - assertFalse(dataSetService.isLoadedDataSet(filePlan, DATA_SET_ID)); - assertTrue(dataSetService.getDataSets(filePlan, true).size() > 0); - assertTrue(dataSetService.getDataSets(filePlan, false).size() > 0); - } - - /** - * Helper method for testing the test file plan after importing the data - */ - private void testFilePlanAfterImportingDataSet() - { - // Test the "first level" categories after importing if they exist - // TestRecordCategory1 - NodeRef recCat1 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1"); - assertNotNull(recCat1); - List recCat1ImmediateChildren = filePlanService.getAllContained(recCat1); - assertTrue(recCat1ImmediateChildren.size() == 3); - List recCat1AllChildren = filePlanService.getAllContained(recCat1, true); - assertTrue(recCat1AllChildren.size() == 6); - DispositionSchedule recCat1DispositionSchedule = dispositionService.getDispositionSchedule(recCat1); - assertNull(recCat1DispositionSchedule); - - // TestRecordCategory2 - NodeRef recCat2 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory2"); - assertNotNull(recCat2); - List recCat2ImmediateChildren = filePlanService.getAllContained(recCat2); - assertTrue(recCat2ImmediateChildren.size() == 2); - List recCat2AllChildren = filePlanService.getAllContained(recCat2, true); - assertTrue(recCat2AllChildren.size() == 4); - DispositionSchedule recCat2DispositionSchedule = dispositionService.getDispositionSchedule(recCat2); - assertNull(recCat2DispositionSchedule); - - // TestRecordCategory1: Test the "second level" categories and record folders - NodeRef recCat11 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory11"); - assertNotNull(recCat11); - List recCat11ImmediateChilderen = filePlanService.getAllContained(recCat11); - assertTrue(recCat11ImmediateChilderen.size() == 2); - List recCat11Childeren = filePlanService.getAllContained(recCat11, true); - assertTrue(recCat11Childeren.size() == 2); - assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder1")); - assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder2")); - VitalRecordDefinition recCat11VitalRecordDefinition = vitalRecordService.getVitalRecordDefinition(recCat11); - assertNotNull(recCat11VitalRecordDefinition); - assertTrue(recCat11VitalRecordDefinition.getReviewPeriod().getExpression().equals("1")); - assertNotNull(recCat11VitalRecordDefinition.getNextReviewDate()); - - NodeRef recCat12 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory12"); - assertNotNull(recCat12); - List recCat12ImmediateChildren = filePlanService.getAllContained(recCat12); - assertTrue(recCat12ImmediateChildren.size() == 1); - List recCat12Children = filePlanService.getAllContained(recCat12, true); - assertTrue(recCat12Children.size() == 1); - assertNotNull(nodeService.getChildByName(recCat12, ContentModel.ASSOC_CONTAINS, "TestRecordFolder3")); - DispositionSchedule recCat12DispositionSchedule = dispositionService.getDispositionSchedule(recCat12); - assertNotNull(recCat12DispositionSchedule); - assertTrue(recCat12DispositionSchedule.getDispositionInstructions().equals("Cut off every 3 months, hold 3 months, then destroy.")); - assertTrue(recCat12DispositionSchedule.getDispositionAuthority().equals("T0-000-00-1 item 002")); - assertTrue(recCat12DispositionSchedule.getDispositionActionDefinitions().size() == 2); - assertNotNull(recCat12DispositionSchedule.getDispositionActionDefinitionByName("cutoff")); - assertNotNull(recCat12DispositionSchedule.getDispositionActionDefinitionByName("destroy")); - - NodeRef recCat13 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory13"); - assertNotNull(recCat13); - List recCat13ImmediateChildren = filePlanService.getAllContained(recCat13); - assertTrue(recCat13ImmediateChildren.size() == 0); - DispositionSchedule recCat13DispositionSchedule = dispositionService.getDispositionSchedule(recCat13); - assertNotNull(recCat13DispositionSchedule); - - // TestRecordCategory2: Test the "second level" categories and record folders - NodeRef recCat21 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory21"); - assertNotNull(recCat21); - List recCat21ImmediateChildren = filePlanService.getAllContained(recCat21); - assertTrue(recCat21ImmediateChildren.size() == 0); - DispositionSchedule recCat21DispositionSchedule = dispositionService.getDispositionSchedule(recCat21); - assertNotNull(recCat21DispositionSchedule); - - NodeRef recCat22 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory22"); - assertNotNull(recCat22); - List recCat22ImmediateChildren = filePlanService.getAllContained(recCat22); - assertTrue(recCat22ImmediateChildren.size() == 2); - List recCat22Children = filePlanService.getAllContained(recCat22, true); - assertTrue(recCat22Children.size() == 2); - assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder4")); - assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder5")); - DispositionSchedule recCat22DispositionSchedule = dispositionService.getDispositionSchedule(recCat22); - assertNotNull(recCat22DispositionSchedule); - - // After loading the data set into the file plan the custom aspect should contain the id of the loaded data set - Serializable nodeProperty = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); - assertNotNull(nodeProperty); - @SuppressWarnings("unchecked") - ArrayList loadedDataSetIds = (ArrayList)nodeProperty; - assertTrue(loadedDataSetIds.size() == 1); - assertTrue(loadedDataSetIds.contains(DATA_SET_ID)); - - // The data set has been loaded into the file plan, so the file plan should contain the data set id - Map loadedDataSets = dataSetService.getLoadedDataSets(filePlan); - assertTrue(loadedDataSets.size() == 1); - assertTrue(loadedDataSets.containsKey(DATA_SET_ID)); - assertTrue(dataSetService.isLoadedDataSet(filePlan, DATA_SET_ID)); - assertTrue(dataSetService.getDataSets(filePlan, true).size() > 0); - assertTrue(dataSetService.getDataSets(filePlan, false).size() > 1); - } - }); - } - - /** - * @see DataSetService#existsDataSet(String) - */ - public void testExistsDataSet() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Test if a data set with the specified data set id exists - assertTrue(dataSetService.existsDataSet(DATA_SET_ID)); - assertFalse(dataSetService.existsDataSet("AnotherDataSetId")); - - return null; - } - }); - } - - /* - * INFO: - * - * The tests for - * - * DataSetService#getDataSets(NodeRef, boolean) - * DataSetService#getLoadedDataSets(NodeRef) - * DataSetService#isLoadedDataSet(NodeRef, String) - * - * will be executed in testFilePlanBeforeImportingDataSet() and testFilePlanAfterImportingDataSet(). - */ - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.dataset.DataSet; +import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Dataset Service Test + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class DataSetServiceImplTest extends BaseRMTestCase +{ + /** Id of the test data set*/ + private static final String DATA_SET_ID = "testExampleData"; + + /** + * @see DataSetService#getDataSets() + */ + public void testGetDataSets() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + Map dataSets = dataSetService.getDataSets(); + // Test the data sets + assertNotNull(dataSets); + // At least the test data set must exist + assertTrue(dataSets.size() >= 1); + // The test data set must be in the list of available data sets + assertNotNull(dataSets.get(DATA_SET_ID)); + + for (Map.Entry entry : dataSets.entrySet()) + { + // Test the key + String key = entry.getKey(); + assertNotNull(key); + + // Test the value + DataSet dataSet = entry.getValue(); + assertNotNull(dataSet); + + // Test the id + String id = dataSet.getId(); + assertNotNull(id); + assertEquals(id, key); + + // Test the label + String label = dataSet.getLabel(); + assertNotNull(label); + + // Test the path + String path = dataSet.getPath(); + assertNotNull(path); + } + + return null; + } + }); + } + + /** + * @see DataSetService#loadDataSet(String, org.alfresco.service.cmr.repository.NodeRef) + */ + public void testLoadDataSet() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // Test the file plan before importing the data sets + testFilePlanBeforeImportingDataSet(); + + // Load the data set into the specified file plan + dataSetService.loadDataSet(filePlan, DATA_SET_ID); + + // Test the file plan after importing the data sets + testFilePlanAfterImportingDataSet(); + + return null; + } + + /** + * Helper method for testing the test file plan before importing the data + */ + private void testFilePlanBeforeImportingDataSet() + { + // There should not be any categories before importing + assertNull(nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1")); + assertNull(nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory2")); + + // The aspect should exist before loading a data set + assertNull(nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS)); + + // At the beginning the file plan is empty. So there should not be any data sets + assertTrue(dataSetService.getLoadedDataSets(filePlan).size() == 0); + assertFalse(dataSetService.isLoadedDataSet(filePlan, DATA_SET_ID)); + assertTrue(dataSetService.getDataSets(filePlan, true).size() > 0); + assertTrue(dataSetService.getDataSets(filePlan, false).size() > 0); + } + + /** + * Helper method for testing the test file plan after importing the data + */ + private void testFilePlanAfterImportingDataSet() + { + // Test the "first level" categories after importing if they exist + // TestRecordCategory1 + NodeRef recCat1 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1"); + assertNotNull(recCat1); + List recCat1ImmediateChildren = filePlanService.getAllContained(recCat1); + assertTrue(recCat1ImmediateChildren.size() == 3); + List recCat1AllChildren = filePlanService.getAllContained(recCat1, true); + assertTrue(recCat1AllChildren.size() == 6); + DispositionSchedule recCat1DispositionSchedule = dispositionService.getDispositionSchedule(recCat1); + assertNull(recCat1DispositionSchedule); + + // TestRecordCategory2 + NodeRef recCat2 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory2"); + assertNotNull(recCat2); + List recCat2ImmediateChildren = filePlanService.getAllContained(recCat2); + assertTrue(recCat2ImmediateChildren.size() == 2); + List recCat2AllChildren = filePlanService.getAllContained(recCat2, true); + assertTrue(recCat2AllChildren.size() == 4); + DispositionSchedule recCat2DispositionSchedule = dispositionService.getDispositionSchedule(recCat2); + assertNull(recCat2DispositionSchedule); + + // TestRecordCategory1: Test the "second level" categories and record folders + NodeRef recCat11 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory11"); + assertNotNull(recCat11); + List recCat11ImmediateChilderen = filePlanService.getAllContained(recCat11); + assertTrue(recCat11ImmediateChilderen.size() == 2); + List recCat11Childeren = filePlanService.getAllContained(recCat11, true); + assertTrue(recCat11Childeren.size() == 2); + assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder1")); + assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder2")); + VitalRecordDefinition recCat11VitalRecordDefinition = vitalRecordService.getVitalRecordDefinition(recCat11); + assertNotNull(recCat11VitalRecordDefinition); + assertTrue(recCat11VitalRecordDefinition.getReviewPeriod().getExpression().equals("1")); + assertNotNull(recCat11VitalRecordDefinition.getNextReviewDate()); + + NodeRef recCat12 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory12"); + assertNotNull(recCat12); + List recCat12ImmediateChildren = filePlanService.getAllContained(recCat12); + assertTrue(recCat12ImmediateChildren.size() == 1); + List recCat12Children = filePlanService.getAllContained(recCat12, true); + assertTrue(recCat12Children.size() == 1); + assertNotNull(nodeService.getChildByName(recCat12, ContentModel.ASSOC_CONTAINS, "TestRecordFolder3")); + DispositionSchedule recCat12DispositionSchedule = dispositionService.getDispositionSchedule(recCat12); + assertNotNull(recCat12DispositionSchedule); + assertTrue(recCat12DispositionSchedule.getDispositionInstructions().equals("Cut off every 3 months, hold 3 months, then destroy.")); + assertTrue(recCat12DispositionSchedule.getDispositionAuthority().equals("T0-000-00-1 item 002")); + assertTrue(recCat12DispositionSchedule.getDispositionActionDefinitions().size() == 2); + assertNotNull(recCat12DispositionSchedule.getDispositionActionDefinitionByName("cutoff")); + assertNotNull(recCat12DispositionSchedule.getDispositionActionDefinitionByName("destroy")); + + NodeRef recCat13 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory13"); + assertNotNull(recCat13); + List recCat13ImmediateChildren = filePlanService.getAllContained(recCat13); + assertTrue(recCat13ImmediateChildren.size() == 0); + DispositionSchedule recCat13DispositionSchedule = dispositionService.getDispositionSchedule(recCat13); + assertNotNull(recCat13DispositionSchedule); + + // TestRecordCategory2: Test the "second level" categories and record folders + NodeRef recCat21 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory21"); + assertNotNull(recCat21); + List recCat21ImmediateChildren = filePlanService.getAllContained(recCat21); + assertTrue(recCat21ImmediateChildren.size() == 0); + DispositionSchedule recCat21DispositionSchedule = dispositionService.getDispositionSchedule(recCat21); + assertNotNull(recCat21DispositionSchedule); + + NodeRef recCat22 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory22"); + assertNotNull(recCat22); + List recCat22ImmediateChildren = filePlanService.getAllContained(recCat22); + assertTrue(recCat22ImmediateChildren.size() == 2); + List recCat22Children = filePlanService.getAllContained(recCat22, true); + assertTrue(recCat22Children.size() == 2); + assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder4")); + assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder5")); + DispositionSchedule recCat22DispositionSchedule = dispositionService.getDispositionSchedule(recCat22); + assertNotNull(recCat22DispositionSchedule); + + // After loading the data set into the file plan the custom aspect should contain the id of the loaded data set + Serializable nodeProperty = nodeService.getProperty(filePlan, PROP_LOADED_DATA_SET_IDS); + assertNotNull(nodeProperty); + @SuppressWarnings("unchecked") + ArrayList loadedDataSetIds = (ArrayList)nodeProperty; + assertTrue(loadedDataSetIds.size() == 1); + assertTrue(loadedDataSetIds.contains(DATA_SET_ID)); + + // The data set has been loaded into the file plan, so the file plan should contain the data set id + Map loadedDataSets = dataSetService.getLoadedDataSets(filePlan); + assertTrue(loadedDataSets.size() == 1); + assertTrue(loadedDataSets.containsKey(DATA_SET_ID)); + assertTrue(dataSetService.isLoadedDataSet(filePlan, DATA_SET_ID)); + assertTrue(dataSetService.getDataSets(filePlan, true).size() > 0); + assertTrue(dataSetService.getDataSets(filePlan, false).size() > 1); + } + }); + } + + /** + * @see DataSetService#existsDataSet(String) + */ + public void testExistsDataSet() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // Test if a data set with the specified data set id exists + assertTrue(dataSetService.existsDataSet(DATA_SET_ID)); + assertFalse(dataSetService.existsDataSet("AnotherDataSetId")); + + return null; + } + }); + } + + /* + * INFO: + * + * The tests for + * + * DataSetService#getDataSets(NodeRef, boolean) + * DataSetService#getLoadedDataSets(NodeRef) + * DataSetService#isLoadedDataSet(NodeRef, String) + * + * will be executed in testFilePlanBeforeImportingDataSet() and testFilePlanAfterImportingDataSet(). + */ + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java index 1f4bfa10d8..65721473d3 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java @@ -1,1032 +1,1032 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; -import org.alfresco.module.org_alfresco_module_rm.job.PublishUpdatesJobExecuter; -import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor; -import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Disposition service implementation unit test. - * - * @author Roy Wetherall - */ -public class DispositionServiceImplTest extends BaseRMTestCase -{ - @Override - protected boolean isMultiHierarchyTest() - { - return true; - } - - public void testGetDispositionProperties() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Collection properties = dispositionService.getDispositionProperties(); - - assertNotNull(properties); - assertEquals(5, properties.size()); - - for (DispositionProperty property : properties) - { - assertNotNull(property.getQName()); - assertNotNull(property.getPropertyDefinition()); - } - - return null; - } - }); - } - - /** - * @see DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testGetDispositionSchedule() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Check for null lookup's - assertNull(dispositionService.getDispositionSchedule(filePlan)); - - // Get the containers disposition schedule - DispositionSchedule ds = dispositionService.getDispositionSchedule(rmContainer); - assertNotNull(ds); - checkDispositionSchedule(ds, false); - - // Get the folders disposition schedule - ds = dispositionService.getDispositionSchedule(rmContainer); - assertNotNull(ds); - checkDispositionSchedule(ds, false); - - return null; - } - - }); - - // Failure: Root node - doTestInTransaction(new FailureTest - ( - "Should not be able to get adisposition schedule for the root node", - AlfrescoRuntimeException.class - ) - { - @Override - public void run() - { - dispositionService.getDispositionSchedule(rootNodeRef); - } - }); - - // Failure: Non-rm node - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - dispositionService.getDispositionSchedule(folder); - } - }); - } - - /** - * @see DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testGetDispositionScheduleMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertNull(dispositionService.getDispositionSchedule(mhContainer)); - - // Level 1 - doCheck(mhContainer11, "ds11", false); - doCheck(mhContainer12, "ds12", false); - - // Level 2 - doCheck(mhContainer21, "ds11", false); - doCheck(mhContainer22, "ds12", false); - doCheck(mhContainer23, "ds23", false); - - // Level 3 - doCheck(mhContainer31, "ds11", false); - doCheck(mhContainer32, "ds12", false); - doCheck(mhContainer33, "ds33", true); - doCheck(mhContainer34, "ds23", false); - doCheck(mhContainer35, "ds35", true); - - // Folders - doCheckFolder(mhRecordFolder41, "ds11", false); - doCheckFolder(mhRecordFolder42, "ds12", false); - doCheckFolder(mhRecordFolder43, "ds33", true); - doCheckFolder(mhRecordFolder44, "ds23", false); - doCheckFolder(mhRecordFolder45, "ds35", true); - - return null; - } - - private void doCheck(NodeRef container, String dispositionInstructions, boolean isRecordLevel) - { - DispositionSchedule ds = dispositionService.getDispositionSchedule(container); - assertNotNull(ds); - checkDispositionSchedule(ds, dispositionInstructions, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); - } - - private void doCheckFolder(NodeRef container, String dispositionInstructions, boolean isRecordLevel) - { - doCheck(container, dispositionInstructions, isRecordLevel); - if (!isRecordLevel) - { - assertNotNull(dispositionService.getNextDispositionAction(container)); - } - } - }); - - } - - /** - * Checks a disposition schedule - * - * @param ds disposition scheduleS - */ - private void checkDispositionSchedule(DispositionSchedule ds, String dispositionInstructions, String dispositionAuthority, boolean isRecordLevel) - { - assertEquals(dispositionAuthority, ds.getDispositionAuthority()); - assertEquals(dispositionInstructions, ds.getDispositionInstructions()); - assertEquals(isRecordLevel, ds.isRecordLevelDisposition()); - - List defs = ds.getDispositionActionDefinitions(); - assertNotNull(defs); - assertEquals(2, defs.size()); - - DispositionActionDefinition defCutoff = ds.getDispositionActionDefinitionByName("cutoff"); - assertNotNull(defCutoff); - assertEquals("cutoff", defCutoff.getName()); - - DispositionActionDefinition defDestroy = ds.getDispositionActionDefinitionByName("destroy"); - assertNotNull(defDestroy); - assertEquals("destroy", defDestroy.getName()); - } - - /** - * - * @param ds - */ - private void checkDispositionSchedule(DispositionSchedule ds, boolean isRecordLevel) - { - checkDispositionSchedule(ds, CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); - } - - /** - * @see DispositionService#getAssociatedDispositionSchedule(NodeRef) - */ - public void testGetAssociatedDispositionSchedule() throws Exception - { - // Get associated disposition schedule for rmContainer - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Get the containers disposition schedule - DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(rmContainer); - assertNotNull(ds); - checkDispositionSchedule(ds, false); - - // Show the null disposition schedules - assertNull(dispositionService.getAssociatedDispositionSchedule(filePlan)); - assertNull(dispositionService.getAssociatedDispositionSchedule(rmFolder)); - - return null; - } - }); - - // Failure: associated disposition schedule for non-rm node - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - dispositionService.getAssociatedDispositionSchedule(folder); - } - }); - } - - /** - * @see DispositionService#getAssociatedDispositionSchedule(NodeRef) - */ - public void testGetAssociatedDispositionScheduleMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer)); - - // Level 1 - doCheck(mhContainer11, "ds11", false); - doCheck(mhContainer12, "ds12", false); - - // Level 2 - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer21)); - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer22)); - doCheck(mhContainer23, "ds23", false); - - // Level 3 - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer31)); - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer32)); - doCheck(mhContainer33, "ds33", true); - assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer34)); - doCheck(mhContainer35, "ds35", true); - - return null; - } - - private void doCheck(NodeRef container, String dispositionInstructions, boolean isRecordLevel) - { - DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(container); - assertNotNull(ds); - checkDispositionSchedule(ds, dispositionInstructions, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); - } - }); - } - - /** - * @see DispositionService#hasDisposableItems(DispositionSchedule) - */ - public void testHasDisposableItems() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add a new disposition schedule - NodeRef container = filePlanService.createRecordCategory(rmContainer, "hasDisposableTest"); - DispositionSchedule ds = utils.createBasicDispositionSchedule(container); - - assertTrue(dispositionService.hasDisposableItems(dispositionSchedule)); - assertFalse(dispositionService.hasDisposableItems(ds)); - - return null; - } - }); - } - - /** - * @see DispositionService#hasDisposableItems(DispositionSchedule) - */ - public void testHasDisposableItemsMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule11)); - assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule12)); - assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule23)); - assertFalse(dispositionService.hasDisposableItems(mhDispositionSchedule33)); - assertFalse(dispositionService.hasDisposableItems(mhDispositionSchedule35)); - - return null; - } - }); - } - - /** - * @see DispositionService#getDisposableItems(DispositionSchedule) - */ - public void testGetDisposableItems() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List nodeRefs = dispositionService.getDisposableItems(dispositionSchedule); - assertNotNull(nodeRefs); - assertEquals(1, nodeRefs.size()); - assertTrue(nodeRefs.contains(rmFolder)); - - return null; - } - }); - } - - /** - * @see DispositionService#getDisposableItems(DispositionSchedule) - */ - public void testGetDisposableItemsMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule11); - assertNotNull(nodeRefs); - assertEquals(1, nodeRefs.size()); - assertTrue(nodeRefs.contains(mhRecordFolder41)); - - nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule12); - assertNotNull(nodeRefs); - assertEquals(1, nodeRefs.size()); - assertTrue(nodeRefs.contains(mhRecordFolder42)); - - nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule23); - assertNotNull(nodeRefs); - assertEquals(1, nodeRefs.size()); - assertTrue(nodeRefs.contains(mhRecordFolder44)); - - nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule33); - assertNotNull(nodeRefs); - assertEquals(0, nodeRefs.size()); - - nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule35); - assertNotNull(nodeRefs); - assertEquals(0, nodeRefs.size()); - - return null; - } - }); - } - - /** - * @see DispositionService#createDispositionSchedule(NodeRef, Map) - */ - public void testCreateDispositionSchedule() throws Exception - { - // Test: simple disposition create - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - // Create a new container - NodeRef container = filePlanService.createRecordCategory(filePlan, "testCreateDispositionSchedule"); - - // Create a new disposition schedule - utils.createBasicDispositionSchedule(container, "testCreateDispositionSchedule", "testCreateDispositionSchedule", false, true); - - return container; - } - - @Override - public void test(NodeRef result) throws Exception - { - // Get the created disposition schedule - DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(result); - assertNotNull(ds); - - // Check the disposition schedule - checkDispositionSchedule(ds, "testCreateDispositionSchedule", "testCreateDispositionSchedule", false); - } - }); - - // Failure: create disposition schedule on container with existing disposition schedule - doTestInTransaction(new FailureTest - ( - "Can not create a disposition schedule on a container with an existing disposition schedule" - ) - { - @Override - public void run() - { - utils.createBasicDispositionSchedule(rmContainer); - } - }); - } - - /** - * @see DispositionService#createDispositionSchedule(NodeRef, Map) - */ - public void testCreateDispositionScheduleMultiHier() throws Exception - { - // Test: simple disposition create - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Create a new structure container - NodeRef testA = filePlanService.createRecordCategory(mhContainer, "testA"); - NodeRef testB = filePlanService.createRecordCategory(testA, "testB"); - - // Create new disposition schedules - utils.createBasicDispositionSchedule(testA, "testA", "testA", false, true); - utils.createBasicDispositionSchedule(testB, "testB", "testB", false, true); - - // Add created containers to model - setNodeRef("testA", testA); - setNodeRef("testB", testB); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Get the created disposition schedule - DispositionSchedule testA = dispositionService.getAssociatedDispositionSchedule(getNodeRef("testA")); - assertNotNull(testA); - DispositionSchedule testB = dispositionService.getAssociatedDispositionSchedule(getNodeRef("testB")); - assertNotNull(testB); - - // Check the disposition schedule - checkDispositionSchedule(testA, "testA", "testA", false); - checkDispositionSchedule(testB, "testB", "testB", false); - } - }); - - // Failure: create disposition schedule on container with existing disposition schedule - doTestInTransaction(new FailureTest - ( - "Can not create a disposition schedule on container with an existing disposition schedule" - ) - { - @Override - public void run() - { - utils.createBasicDispositionSchedule(mhContainer11); - } - }); - - // Failure: create disposition schedule on a container where there are disposable items under management - doTestInTransaction(new FailureTest - ( - "Can not create a disposition schedule on a container where there are already disposable items under management" - ) - { - @Override - public void run() - { - utils.createBasicDispositionSchedule(mhContainer21); - } - }); - } - - /** - * @see DispositionService#getAssociatedRecordsManagementContainer(DispositionSchedule) - */ - public void testGetAssociatedRecordsManagementContainer() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef nodeRef = dispositionService.getAssociatedRecordsManagementContainer(dispositionSchedule); - assertNotNull(nodeRef); - assertEquals(rmContainer, nodeRef); - - return null; - } - }); - } - - /** - * @see DispositionService#getAssociatedRecordsManagementContainer(DispositionSchedule) - */ - public void testGetAssociatedRecordsManagementContainerMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule11); - assertNotNull(nodeRef); - assertEquals(mhContainer11, nodeRef); - - nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule12); - assertNotNull(nodeRef); - assertEquals(mhContainer12, nodeRef); - - nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule23); - assertNotNull(nodeRef); - assertEquals(mhContainer23, nodeRef); - - nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule33); - assertNotNull(nodeRef); - assertEquals(mhContainer33, nodeRef); - - nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule35); - assertNotNull(nodeRef); - assertEquals(mhContainer35, nodeRef); - - return null; - } - }); - } - - // TODO DispositionActionDefinition addDispositionActionDefinition - - // TODO void removeDispositionActionDefinition( - - private NodeRef record43; - private NodeRef record45; - - public void testUpdateDispositionActionDefinitionMultiHier() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - record43 = utils.createRecord(mhRecordFolder43, "record1.txt"); - record45 = utils.createRecord(mhRecordFolder45, "record2.txt"); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Check all the current record folders first - checkDisposableItemUnchanged(mhRecordFolder41); - checkDisposableItemUnchanged(mhRecordFolder42); - checkDisposableItemUnchanged(record43); - checkDisposableItemUnchanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45); - - updateDispositionScheduleOnContainer(mhContainer11); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemUnchanged(mhRecordFolder42); - checkDisposableItemUnchanged(record43); - checkDisposableItemUnchanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45);; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - updateDispositionScheduleOnContainer(mhContainer12); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemChanged(mhRecordFolder42); - checkDisposableItemUnchanged(record43); - checkDisposableItemUnchanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45);; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - updateDispositionScheduleOnContainer(mhContainer33); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemChanged(mhRecordFolder42); - checkDisposableItemChanged(record43); - checkDisposableItemUnchanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45);; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - updateDispositionScheduleOnContainer(mhContainer23); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemChanged(mhRecordFolder42); - checkDisposableItemChanged(record43); - checkDisposableItemChanged(mhRecordFolder44); - checkDisposableItemUnchanged(record45); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - updateDispositionScheduleOnContainer(mhContainer35); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - // Check all the current record folders first - checkDisposableItemChanged(mhRecordFolder41); - checkDisposableItemChanged(mhRecordFolder42); - checkDisposableItemChanged(record43); - checkDisposableItemChanged(mhRecordFolder44); - checkDisposableItemChanged(record45); - } - }); - } - - private void publishDispositionActionDefinitionChange(DispositionActionDefinition dad) - { - PublishExecutorRegistry reg = (PublishExecutorRegistry)applicationContext.getBean("publishExecutorRegistry"); - PublishExecutor pub = reg.get(RecordsManagementModel.UPDATE_TO_DISPOSITION_ACTION_DEFINITION); - assertNotNull(pub); - pub.publish(dad.getNodeRef()); - } - - private void checkDisposableItemUnchanged(NodeRef recordFolder) - { - checkDispositionAction( - dispositionService.getNextDispositionAction(recordFolder), - "cutoff", - new String[]{CommonRMTestUtils.DEFAULT_EVENT_NAME}, - CommonRMTestUtils.PERIOD_NONE); - } - - private void checkDisposableItemChanged(NodeRef recordFolder) throws Exception - { - checkDispositionAction( - dispositionService.getNextDispositionAction(recordFolder), - "cutoff", - new String[]{CommonRMTestUtils.DEFAULT_EVENT_NAME, "abolished"}, - "week|1"); - } - - private void updateDispositionScheduleOnContainer(NodeRef nodeRef) - { - Map updateProps = new HashMap(3); - updateProps.put(PROP_DISPOSITION_PERIOD, "week|1"); - updateProps.put(PROP_DISPOSITION_EVENT, (Serializable)Arrays.asList(CommonRMTestUtils.DEFAULT_EVENT_NAME, "abolished")); - - DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef); - DispositionActionDefinition dad = ds.getDispositionActionDefinitionByName("cutoff"); - dispositionService.updateDispositionActionDefinition(dad, updateProps); - publishDispositionActionDefinitionChange(dad); - } - - /** - * - * @param da - * @param name - * @param arrEventNames - * @param strPeriod - */ - private void checkDispositionAction(DispositionAction da, String name, String[] arrEventNames, String strPeriod) - { - assertNotNull(da); - assertEquals(name, da.getName()); - - List events = da.getEventCompletionDetails(); - assertNotNull(events); - assertEquals(arrEventNames.length, events.size()); - - List origEvents = new ArrayList(events.size()); - for (EventCompletionDetails event : events) - { - origEvents.add(event.getEventName()); - } - - List expectedEvents = Arrays.asList(arrEventNames); - Collection copy = new ArrayList(origEvents); - - for (Iterator i = origEvents.iterator(); i.hasNext(); ) - { - String origEvent = i.next(); - - if (expectedEvents.contains(origEvent)) - { - i.remove(); - copy.remove(origEvent); - } - } - - if (copy.size() != 0 && expectedEvents.size() != 0) - { - StringBuffer buff = new StringBuffer(255); - if (copy.size() != 0) - { - buff.append("The following events where found, but not expected: ("); - for (String eventName : copy) - { - buff.append(eventName).append(", "); - } - buff.append("). "); - } - if (expectedEvents.size() != 0) - { - buff.append("The following events where not found, but expected: ("); - for (String eventName : expectedEvents) - { - buff.append(eventName).append(", "); - } - buff.append(")."); - } - fail(buff.toString()); - } - - if (CommonRMTestUtils.PERIOD_NONE.equals(strPeriod)) - { - assertNull(da.getAsOfDate()); - } - else - { - assertNotNull(da.getAsOfDate()); - } - } - - // TODO boolean isNextDispositionActionEligible(NodeRef nodeRef); - - // TODO DispositionAction getNextDispositionAction(NodeRef nodeRef); - - // TODO List getCompletedDispositionActions(NodeRef nodeRef); - - // TODO DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef); - - // TODO List getDispositionPeriodProperties(); - - /* === Issues === */ - - private NodeRef testRM263RecordCategory; - private DispositionSchedule testRM263DispositionSchedule; - private NodeRef testRM263Record; - - /** - * https://issues.alfresco.com/jira/browse/RM-263 - */ - public void testRM_263() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - testRM263RecordCategory = filePlanService.createRecordCategory(rmContainer, "rm263"); - testRM263DispositionSchedule = utils.createBasicDispositionSchedule( - testRM263RecordCategory, - "test", - "test", - true, - false); - - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, "cutoff"); - adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); - adParams.put(PROP_DISPOSITION_PERIOD, "week|1"); - adParams.put(PROP_DISPOSITION_PERIOD_PROPERTY, DOD5015Model.PROP_PUBLICATION_DATE.toString()); - - dispositionService.addDispositionActionDefinition(testRM263DispositionSchedule, adParams); - - NodeRef recordFolder = recordFolderService.createRecordFolder(testRM263RecordCategory, "testRM263RecordFolder"); - testRM263Record = utils.createRecord(recordFolder, "testRM263Record", "testRM263Record"); - - return null; - } - }); - - doTestInTransaction(new Test() - { - private final QName PROP_SEARCH_ASOF = QName.createQName(RM_URI, "recordSearchDispositionActionAsOf"); - - @Override - public Void run() throws Exception - { - Date pubDate = (Date)nodeService.getProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE); - assertNull(pubDate); - Date asOfDate = (Date)nodeService.getProperty(testRM263Record, PROP_SEARCH_ASOF); - assertNull(asOfDate); - - DispositionAction da = dispositionService.getNextDispositionAction(testRM263Record); - assertNotNull(da); - assertNull(da.getAsOfDate()); - - //rma:recordSearchDispositionActionAsOf" - nodeService.setProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE, new Date()); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - Date pubDate = (Date)nodeService.getProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE); - assertNotNull(pubDate); - Date asOfDate = (Date)nodeService.getProperty(testRM263Record, PROP_SEARCH_ASOF); - assertNotNull(asOfDate); - - DispositionAction da = dispositionService.getNextDispositionAction(testRM263Record); - assertNotNull(da); - assertNotNull(da.getAsOfDate()); - } - }); - } - - private NodeRef testRM386RecordCategory; - private DispositionSchedule testRM386DispositionSchedule; - private NodeRef testRM386Record; - - /** - * Test to make sure all the search rollups are correct after schedule is updated - * @throws Exception - */ - public void testRM386() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - testRM386RecordCategory = filePlanService.createRecordCategory(rmContainer, "RM386"); - testRM386DispositionSchedule = utils.createBasicDispositionSchedule( - testRM386RecordCategory, - "disposition instructions", - "disposition authority", - true, // record level - true); // set the default actions - - NodeRef recordFolder = recordFolderService.createRecordFolder(testRM386RecordCategory, "testRM386RecordFolder"); - testRM386Record = utils.createRecord(recordFolder, "testRM386Record", "testRM386Record"); - - return null; - } - - @SuppressWarnings("unchecked") - @Override - public void test(Void result) throws Exception - { - // Test the rollups for the record - Map properties = nodeService.getProperties(testRM386Record); - - assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE)); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY)); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS)); - - assertEquals("none", properties.get(PROP_RS_DISPOSITION_PERIOD)); - assertEquals("0", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); - - List events = (List)properties.get(PROP_RS_DISPOSITION_EVENTS); - assertNotNull(events); - assertEquals(1, events.size()); - assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, events.get(0)); - assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); - - assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME)); - assertNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - - doTestInTransaction(new Test() - { - @Override - public DispositionActionDefinition run() throws Exception - { - DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff"); - assertNotNull(actionDefinition); - - Map adParams = new HashMap(3); - - List events = new ArrayList(1); - events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); - events.add("obsolete"); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - adParams.put(PROP_DISPOSITION_PERIOD, "week|1"); - - dispositionService.updateDispositionActionDefinition( - actionDefinition, - adParams); - - return actionDefinition; - } - - @SuppressWarnings("unchecked") - @Override - public void test(DispositionActionDefinition result) throws Exception - { - DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff"); - assertNotNull(actionDefinition); - assertTrue(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE)); - - // Publish the updates - PublishUpdatesJobExecuter updater = (PublishUpdatesJobExecuter)applicationContext.getBean("publishUpdatesJobExecuter"); - updater.executeImpl(); - - assertFalse(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE)); - - // Check the record has been updated - DispositionAction dispositionAction = dispositionService.getNextDispositionAction(testRM386Record); - assertNotNull(dispositionAction); - assertEquals("cutoff", dispositionAction.getName()); - assertNotNull(dispositionAction.getAsOfDate()); - assertEquals(2, dispositionAction.getEventCompletionDetails().size()); - - // Test the rollups for the record - Map properties = nodeService.getProperties(testRM386Record); - - assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE)); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY)); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS)); - - assertEquals("week", properties.get(PROP_RS_DISPOSITION_PERIOD)); - assertEquals("1", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); - - List events = (List)properties.get(PROP_RS_DISPOSITION_EVENTS); - assertNotNull(events); - assertEquals(2, events.size()); - assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); - - assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME)); - assertNotNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); - } - }); - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty; +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails; +import org.alfresco.module.org_alfresco_module_rm.job.PublishUpdatesJobExecuter; +import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutor; +import org.alfresco.module.org_alfresco_module_rm.job.publish.PublishExecutorRegistry; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Disposition service implementation unit test. + * + * @author Roy Wetherall + */ +public class DispositionServiceImplTest extends BaseRMTestCase +{ + @Override + protected boolean isMultiHierarchyTest() + { + return true; + } + + public void testGetDispositionProperties() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + Collection properties = dispositionService.getDispositionProperties(); + + assertNotNull(properties); + assertEquals(5, properties.size()); + + for (DispositionProperty property : properties) + { + assertNotNull(property.getQName()); + assertNotNull(property.getPropertyDefinition()); + } + + return null; + } + }); + } + + /** + * @see DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) + */ + public void testGetDispositionSchedule() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Check for null lookup's + assertNull(dispositionService.getDispositionSchedule(filePlan)); + + // Get the containers disposition schedule + DispositionSchedule ds = dispositionService.getDispositionSchedule(rmContainer); + assertNotNull(ds); + checkDispositionSchedule(ds, false); + + // Get the folders disposition schedule + ds = dispositionService.getDispositionSchedule(rmContainer); + assertNotNull(ds); + checkDispositionSchedule(ds, false); + + return null; + } + + }); + + // Failure: Root node + doTestInTransaction(new FailureTest + ( + "Should not be able to get adisposition schedule for the root node", + AlfrescoRuntimeException.class + ) + { + @Override + public void run() + { + dispositionService.getDispositionSchedule(rootNodeRef); + } + }); + + // Failure: Non-rm node + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + dispositionService.getDispositionSchedule(folder); + } + }); + } + + /** + * @see DispositionService#getDispositionSchedule(org.alfresco.service.cmr.repository.NodeRef) + */ + public void testGetDispositionScheduleMultiHier() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertNull(dispositionService.getDispositionSchedule(mhContainer)); + + // Level 1 + doCheck(mhContainer11, "ds11", false); + doCheck(mhContainer12, "ds12", false); + + // Level 2 + doCheck(mhContainer21, "ds11", false); + doCheck(mhContainer22, "ds12", false); + doCheck(mhContainer23, "ds23", false); + + // Level 3 + doCheck(mhContainer31, "ds11", false); + doCheck(mhContainer32, "ds12", false); + doCheck(mhContainer33, "ds33", true); + doCheck(mhContainer34, "ds23", false); + doCheck(mhContainer35, "ds35", true); + + // Folders + doCheckFolder(mhRecordFolder41, "ds11", false); + doCheckFolder(mhRecordFolder42, "ds12", false); + doCheckFolder(mhRecordFolder43, "ds33", true); + doCheckFolder(mhRecordFolder44, "ds23", false); + doCheckFolder(mhRecordFolder45, "ds35", true); + + return null; + } + + private void doCheck(NodeRef container, String dispositionInstructions, boolean isRecordLevel) + { + DispositionSchedule ds = dispositionService.getDispositionSchedule(container); + assertNotNull(ds); + checkDispositionSchedule(ds, dispositionInstructions, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); + } + + private void doCheckFolder(NodeRef container, String dispositionInstructions, boolean isRecordLevel) + { + doCheck(container, dispositionInstructions, isRecordLevel); + if (!isRecordLevel) + { + assertNotNull(dispositionService.getNextDispositionAction(container)); + } + } + }); + + } + + /** + * Checks a disposition schedule + * + * @param ds disposition scheduleS + */ + private void checkDispositionSchedule(DispositionSchedule ds, String dispositionInstructions, String dispositionAuthority, boolean isRecordLevel) + { + assertEquals(dispositionAuthority, ds.getDispositionAuthority()); + assertEquals(dispositionInstructions, ds.getDispositionInstructions()); + assertEquals(isRecordLevel, ds.isRecordLevelDisposition()); + + List defs = ds.getDispositionActionDefinitions(); + assertNotNull(defs); + assertEquals(2, defs.size()); + + DispositionActionDefinition defCutoff = ds.getDispositionActionDefinitionByName("cutoff"); + assertNotNull(defCutoff); + assertEquals("cutoff", defCutoff.getName()); + + DispositionActionDefinition defDestroy = ds.getDispositionActionDefinitionByName("destroy"); + assertNotNull(defDestroy); + assertEquals("destroy", defDestroy.getName()); + } + + /** + * + * @param ds + */ + private void checkDispositionSchedule(DispositionSchedule ds, boolean isRecordLevel) + { + checkDispositionSchedule(ds, CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); + } + + /** + * @see DispositionService#getAssociatedDispositionSchedule(NodeRef) + */ + public void testGetAssociatedDispositionSchedule() throws Exception + { + // Get associated disposition schedule for rmContainer + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Get the containers disposition schedule + DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(rmContainer); + assertNotNull(ds); + checkDispositionSchedule(ds, false); + + // Show the null disposition schedules + assertNull(dispositionService.getAssociatedDispositionSchedule(filePlan)); + assertNull(dispositionService.getAssociatedDispositionSchedule(rmFolder)); + + return null; + } + }); + + // Failure: associated disposition schedule for non-rm node + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + dispositionService.getAssociatedDispositionSchedule(folder); + } + }); + } + + /** + * @see DispositionService#getAssociatedDispositionSchedule(NodeRef) + */ + public void testGetAssociatedDispositionScheduleMultiHier() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer)); + + // Level 1 + doCheck(mhContainer11, "ds11", false); + doCheck(mhContainer12, "ds12", false); + + // Level 2 + assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer21)); + assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer22)); + doCheck(mhContainer23, "ds23", false); + + // Level 3 + assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer31)); + assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer32)); + doCheck(mhContainer33, "ds33", true); + assertNull(dispositionService.getAssociatedDispositionSchedule(mhContainer34)); + doCheck(mhContainer35, "ds35", true); + + return null; + } + + private void doCheck(NodeRef container, String dispositionInstructions, boolean isRecordLevel) + { + DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(container); + assertNotNull(ds); + checkDispositionSchedule(ds, dispositionInstructions, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, isRecordLevel); + } + }); + } + + /** + * @see DispositionService#hasDisposableItems(DispositionSchedule) + */ + public void testHasDisposableItems() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Add a new disposition schedule + NodeRef container = filePlanService.createRecordCategory(rmContainer, "hasDisposableTest"); + DispositionSchedule ds = utils.createBasicDispositionSchedule(container); + + assertTrue(dispositionService.hasDisposableItems(dispositionSchedule)); + assertFalse(dispositionService.hasDisposableItems(ds)); + + return null; + } + }); + } + + /** + * @see DispositionService#hasDisposableItems(DispositionSchedule) + */ + public void testHasDisposableItemsMultiHier() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule11)); + assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule12)); + assertTrue(dispositionService.hasDisposableItems(mhDispositionSchedule23)); + assertFalse(dispositionService.hasDisposableItems(mhDispositionSchedule33)); + assertFalse(dispositionService.hasDisposableItems(mhDispositionSchedule35)); + + return null; + } + }); + } + + /** + * @see DispositionService#getDisposableItems(DispositionSchedule) + */ + public void testGetDisposableItems() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + List nodeRefs = dispositionService.getDisposableItems(dispositionSchedule); + assertNotNull(nodeRefs); + assertEquals(1, nodeRefs.size()); + assertTrue(nodeRefs.contains(rmFolder)); + + return null; + } + }); + } + + /** + * @see DispositionService#getDisposableItems(DispositionSchedule) + */ + public void testGetDisposableItemsMultiHier() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + List nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule11); + assertNotNull(nodeRefs); + assertEquals(1, nodeRefs.size()); + assertTrue(nodeRefs.contains(mhRecordFolder41)); + + nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule12); + assertNotNull(nodeRefs); + assertEquals(1, nodeRefs.size()); + assertTrue(nodeRefs.contains(mhRecordFolder42)); + + nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule23); + assertNotNull(nodeRefs); + assertEquals(1, nodeRefs.size()); + assertTrue(nodeRefs.contains(mhRecordFolder44)); + + nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule33); + assertNotNull(nodeRefs); + assertEquals(0, nodeRefs.size()); + + nodeRefs = dispositionService.getDisposableItems(mhDispositionSchedule35); + assertNotNull(nodeRefs); + assertEquals(0, nodeRefs.size()); + + return null; + } + }); + } + + /** + * @see DispositionService#createDispositionSchedule(NodeRef, Map) + */ + public void testCreateDispositionSchedule() throws Exception + { + // Test: simple disposition create + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + // Create a new container + NodeRef container = filePlanService.createRecordCategory(filePlan, "testCreateDispositionSchedule"); + + // Create a new disposition schedule + utils.createBasicDispositionSchedule(container, "testCreateDispositionSchedule", "testCreateDispositionSchedule", false, true); + + return container; + } + + @Override + public void test(NodeRef result) throws Exception + { + // Get the created disposition schedule + DispositionSchedule ds = dispositionService.getAssociatedDispositionSchedule(result); + assertNotNull(ds); + + // Check the disposition schedule + checkDispositionSchedule(ds, "testCreateDispositionSchedule", "testCreateDispositionSchedule", false); + } + }); + + // Failure: create disposition schedule on container with existing disposition schedule + doTestInTransaction(new FailureTest + ( + "Can not create a disposition schedule on a container with an existing disposition schedule" + ) + { + @Override + public void run() + { + utils.createBasicDispositionSchedule(rmContainer); + } + }); + } + + /** + * @see DispositionService#createDispositionSchedule(NodeRef, Map) + */ + public void testCreateDispositionScheduleMultiHier() throws Exception + { + // Test: simple disposition create + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Create a new structure container + NodeRef testA = filePlanService.createRecordCategory(mhContainer, "testA"); + NodeRef testB = filePlanService.createRecordCategory(testA, "testB"); + + // Create new disposition schedules + utils.createBasicDispositionSchedule(testA, "testA", "testA", false, true); + utils.createBasicDispositionSchedule(testB, "testB", "testB", false, true); + + // Add created containers to model + setNodeRef("testA", testA); + setNodeRef("testB", testB); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + // Get the created disposition schedule + DispositionSchedule testA = dispositionService.getAssociatedDispositionSchedule(getNodeRef("testA")); + assertNotNull(testA); + DispositionSchedule testB = dispositionService.getAssociatedDispositionSchedule(getNodeRef("testB")); + assertNotNull(testB); + + // Check the disposition schedule + checkDispositionSchedule(testA, "testA", "testA", false); + checkDispositionSchedule(testB, "testB", "testB", false); + } + }); + + // Failure: create disposition schedule on container with existing disposition schedule + doTestInTransaction(new FailureTest + ( + "Can not create a disposition schedule on container with an existing disposition schedule" + ) + { + @Override + public void run() + { + utils.createBasicDispositionSchedule(mhContainer11); + } + }); + + // Failure: create disposition schedule on a container where there are disposable items under management + doTestInTransaction(new FailureTest + ( + "Can not create a disposition schedule on a container where there are already disposable items under management" + ) + { + @Override + public void run() + { + utils.createBasicDispositionSchedule(mhContainer21); + } + }); + } + + /** + * @see DispositionService#getAssociatedRecordsManagementContainer(DispositionSchedule) + */ + public void testGetAssociatedRecordsManagementContainer() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + NodeRef nodeRef = dispositionService.getAssociatedRecordsManagementContainer(dispositionSchedule); + assertNotNull(nodeRef); + assertEquals(rmContainer, nodeRef); + + return null; + } + }); + } + + /** + * @see DispositionService#getAssociatedRecordsManagementContainer(DispositionSchedule) + */ + public void testGetAssociatedRecordsManagementContainerMultiHier() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + NodeRef nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule11); + assertNotNull(nodeRef); + assertEquals(mhContainer11, nodeRef); + + nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule12); + assertNotNull(nodeRef); + assertEquals(mhContainer12, nodeRef); + + nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule23); + assertNotNull(nodeRef); + assertEquals(mhContainer23, nodeRef); + + nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule33); + assertNotNull(nodeRef); + assertEquals(mhContainer33, nodeRef); + + nodeRef = dispositionService.getAssociatedRecordsManagementContainer(mhDispositionSchedule35); + assertNotNull(nodeRef); + assertEquals(mhContainer35, nodeRef); + + return null; + } + }); + } + + // TODO DispositionActionDefinition addDispositionActionDefinition + + // TODO void removeDispositionActionDefinition( + + private NodeRef record43; + private NodeRef record45; + + public void testUpdateDispositionActionDefinitionMultiHier() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + record43 = utils.createRecord(mhRecordFolder43, "record1.txt"); + record45 = utils.createRecord(mhRecordFolder45, "record2.txt"); + + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // Check all the current record folders first + checkDisposableItemUnchanged(mhRecordFolder41); + checkDisposableItemUnchanged(mhRecordFolder42); + checkDisposableItemUnchanged(record43); + checkDisposableItemUnchanged(mhRecordFolder44); + checkDisposableItemUnchanged(record45); + + updateDispositionScheduleOnContainer(mhContainer11); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + // Check all the current record folders first + checkDisposableItemChanged(mhRecordFolder41); + checkDisposableItemUnchanged(mhRecordFolder42); + checkDisposableItemUnchanged(record43); + checkDisposableItemUnchanged(mhRecordFolder44); + checkDisposableItemUnchanged(record45);; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + updateDispositionScheduleOnContainer(mhContainer12); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + // Check all the current record folders first + checkDisposableItemChanged(mhRecordFolder41); + checkDisposableItemChanged(mhRecordFolder42); + checkDisposableItemUnchanged(record43); + checkDisposableItemUnchanged(mhRecordFolder44); + checkDisposableItemUnchanged(record45);; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + updateDispositionScheduleOnContainer(mhContainer33); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + // Check all the current record folders first + checkDisposableItemChanged(mhRecordFolder41); + checkDisposableItemChanged(mhRecordFolder42); + checkDisposableItemChanged(record43); + checkDisposableItemUnchanged(mhRecordFolder44); + checkDisposableItemUnchanged(record45);; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + updateDispositionScheduleOnContainer(mhContainer23); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + // Check all the current record folders first + checkDisposableItemChanged(mhRecordFolder41); + checkDisposableItemChanged(mhRecordFolder42); + checkDisposableItemChanged(record43); + checkDisposableItemChanged(mhRecordFolder44); + checkDisposableItemUnchanged(record45); + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + updateDispositionScheduleOnContainer(mhContainer35); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + // Check all the current record folders first + checkDisposableItemChanged(mhRecordFolder41); + checkDisposableItemChanged(mhRecordFolder42); + checkDisposableItemChanged(record43); + checkDisposableItemChanged(mhRecordFolder44); + checkDisposableItemChanged(record45); + } + }); + } + + private void publishDispositionActionDefinitionChange(DispositionActionDefinition dad) + { + PublishExecutorRegistry reg = (PublishExecutorRegistry)applicationContext.getBean("publishExecutorRegistry"); + PublishExecutor pub = reg.get(RecordsManagementModel.UPDATE_TO_DISPOSITION_ACTION_DEFINITION); + assertNotNull(pub); + pub.publish(dad.getNodeRef()); + } + + private void checkDisposableItemUnchanged(NodeRef recordFolder) + { + checkDispositionAction( + dispositionService.getNextDispositionAction(recordFolder), + "cutoff", + new String[]{CommonRMTestUtils.DEFAULT_EVENT_NAME}, + CommonRMTestUtils.PERIOD_NONE); + } + + private void checkDisposableItemChanged(NodeRef recordFolder) throws Exception + { + checkDispositionAction( + dispositionService.getNextDispositionAction(recordFolder), + "cutoff", + new String[]{CommonRMTestUtils.DEFAULT_EVENT_NAME, "abolished"}, + "week|1"); + } + + private void updateDispositionScheduleOnContainer(NodeRef nodeRef) + { + Map updateProps = new HashMap(3); + updateProps.put(PROP_DISPOSITION_PERIOD, "week|1"); + updateProps.put(PROP_DISPOSITION_EVENT, (Serializable)Arrays.asList(CommonRMTestUtils.DEFAULT_EVENT_NAME, "abolished")); + + DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef); + DispositionActionDefinition dad = ds.getDispositionActionDefinitionByName("cutoff"); + dispositionService.updateDispositionActionDefinition(dad, updateProps); + publishDispositionActionDefinitionChange(dad); + } + + /** + * + * @param da + * @param name + * @param arrEventNames + * @param strPeriod + */ + private void checkDispositionAction(DispositionAction da, String name, String[] arrEventNames, String strPeriod) + { + assertNotNull(da); + assertEquals(name, da.getName()); + + List events = da.getEventCompletionDetails(); + assertNotNull(events); + assertEquals(arrEventNames.length, events.size()); + + List origEvents = new ArrayList(events.size()); + for (EventCompletionDetails event : events) + { + origEvents.add(event.getEventName()); + } + + List expectedEvents = Arrays.asList(arrEventNames); + Collection copy = new ArrayList(origEvents); + + for (Iterator i = origEvents.iterator(); i.hasNext(); ) + { + String origEvent = i.next(); + + if (expectedEvents.contains(origEvent)) + { + i.remove(); + copy.remove(origEvent); + } + } + + if (copy.size() != 0 && expectedEvents.size() != 0) + { + StringBuffer buff = new StringBuffer(255); + if (copy.size() != 0) + { + buff.append("The following events where found, but not expected: ("); + for (String eventName : copy) + { + buff.append(eventName).append(", "); + } + buff.append("). "); + } + if (expectedEvents.size() != 0) + { + buff.append("The following events where not found, but expected: ("); + for (String eventName : expectedEvents) + { + buff.append(eventName).append(", "); + } + buff.append(")."); + } + fail(buff.toString()); + } + + if (CommonRMTestUtils.PERIOD_NONE.equals(strPeriod)) + { + assertNull(da.getAsOfDate()); + } + else + { + assertNotNull(da.getAsOfDate()); + } + } + + // TODO boolean isNextDispositionActionEligible(NodeRef nodeRef); + + // TODO DispositionAction getNextDispositionAction(NodeRef nodeRef); + + // TODO List getCompletedDispositionActions(NodeRef nodeRef); + + // TODO DispositionAction getLastCompletedDispostionAction(NodeRef nodeRef); + + // TODO List getDispositionPeriodProperties(); + + /* === Issues === */ + + private NodeRef testRM263RecordCategory; + private DispositionSchedule testRM263DispositionSchedule; + private NodeRef testRM263Record; + + /** + * https://issues.alfresco.com/jira/browse/RM-263 + */ + public void testRM_263() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + testRM263RecordCategory = filePlanService.createRecordCategory(rmContainer, "rm263"); + testRM263DispositionSchedule = utils.createBasicDispositionSchedule( + testRM263RecordCategory, + "test", + "test", + true, + false); + + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, "cutoff"); + adParams.put(PROP_DISPOSITION_DESCRIPTION, "test"); + adParams.put(PROP_DISPOSITION_PERIOD, "week|1"); + adParams.put(PROP_DISPOSITION_PERIOD_PROPERTY, DOD5015Model.PROP_PUBLICATION_DATE.toString()); + + dispositionService.addDispositionActionDefinition(testRM263DispositionSchedule, adParams); + + NodeRef recordFolder = recordFolderService.createRecordFolder(testRM263RecordCategory, "testRM263RecordFolder"); + testRM263Record = utils.createRecord(recordFolder, "testRM263Record", "testRM263Record"); + + return null; + } + }); + + doTestInTransaction(new Test() + { + private final QName PROP_SEARCH_ASOF = QName.createQName(RM_URI, "recordSearchDispositionActionAsOf"); + + @Override + public Void run() throws Exception + { + Date pubDate = (Date)nodeService.getProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE); + assertNull(pubDate); + Date asOfDate = (Date)nodeService.getProperty(testRM263Record, PROP_SEARCH_ASOF); + assertNull(asOfDate); + + DispositionAction da = dispositionService.getNextDispositionAction(testRM263Record); + assertNotNull(da); + assertNull(da.getAsOfDate()); + + //rma:recordSearchDispositionActionAsOf" + nodeService.setProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE, new Date()); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + Date pubDate = (Date)nodeService.getProperty(testRM263Record, DOD5015Model.PROP_PUBLICATION_DATE); + assertNotNull(pubDate); + Date asOfDate = (Date)nodeService.getProperty(testRM263Record, PROP_SEARCH_ASOF); + assertNotNull(asOfDate); + + DispositionAction da = dispositionService.getNextDispositionAction(testRM263Record); + assertNotNull(da); + assertNotNull(da.getAsOfDate()); + } + }); + } + + private NodeRef testRM386RecordCategory; + private DispositionSchedule testRM386DispositionSchedule; + private NodeRef testRM386Record; + + /** + * Test to make sure all the search rollups are correct after schedule is updated + * @throws Exception + */ + public void testRM386() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + testRM386RecordCategory = filePlanService.createRecordCategory(rmContainer, "RM386"); + testRM386DispositionSchedule = utils.createBasicDispositionSchedule( + testRM386RecordCategory, + "disposition instructions", + "disposition authority", + true, // record level + true); // set the default actions + + NodeRef recordFolder = recordFolderService.createRecordFolder(testRM386RecordCategory, "testRM386RecordFolder"); + testRM386Record = utils.createRecord(recordFolder, "testRM386Record", "testRM386Record"); + + return null; + } + + @SuppressWarnings("unchecked") + @Override + public void test(Void result) throws Exception + { + // Test the rollups for the record + Map properties = nodeService.getProperties(testRM386Record); + + assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE)); + assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY)); + assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS)); + + assertEquals("none", properties.get(PROP_RS_DISPOSITION_PERIOD)); + assertEquals("0", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); + + List events = (List)properties.get(PROP_RS_DISPOSITION_EVENTS); + assertNotNull(events); + assertEquals(1, events.size()); + assertEquals(CommonRMTestUtils.DEFAULT_EVENT_NAME, events.get(0)); + assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); + + assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME)); + assertNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); + } + }); + + doTestInTransaction(new Test() + { + @Override + public DispositionActionDefinition run() throws Exception + { + DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff"); + assertNotNull(actionDefinition); + + Map adParams = new HashMap(3); + + List events = new ArrayList(1); + events.add(CommonRMTestUtils.DEFAULT_EVENT_NAME); + events.add("obsolete"); + adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); + adParams.put(PROP_DISPOSITION_PERIOD, "week|1"); + + dispositionService.updateDispositionActionDefinition( + actionDefinition, + adParams); + + return actionDefinition; + } + + @SuppressWarnings("unchecked") + @Override + public void test(DispositionActionDefinition result) throws Exception + { + DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff"); + assertNotNull(actionDefinition); + assertTrue(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE)); + + // Publish the updates + PublishUpdatesJobExecuter updater = (PublishUpdatesJobExecuter)applicationContext.getBean("publishUpdatesJobExecuter"); + updater.executeImpl(); + + assertFalse(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE)); + + // Check the record has been updated + DispositionAction dispositionAction = dispositionService.getNextDispositionAction(testRM386Record); + assertNotNull(dispositionAction); + assertEquals("cutoff", dispositionAction.getName()); + assertNotNull(dispositionAction.getAsOfDate()); + assertEquals(2, dispositionAction.getEventCompletionDetails().size()); + + // Test the rollups for the record + Map properties = nodeService.getProperties(testRM386Record); + + assertEquals(Boolean.TRUE, properties.get(PROP_RS_HAS_DISPOITION_SCHEDULE)); + assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, properties.get(PROP_RS_DISPOITION_AUTHORITY)); + assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, properties.get(PROP_RS_DISPOITION_INSTRUCTIONS)); + + assertEquals("week", properties.get(PROP_RS_DISPOSITION_PERIOD)); + assertEquals("1", properties.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION)); + + List events = (List)properties.get(PROP_RS_DISPOSITION_EVENTS); + assertNotNull(events); + assertEquals(2, events.size()); + assertEquals(Boolean.FALSE, properties.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE)); + + assertEquals("cutoff", properties.get(PROP_RS_DISPOSITION_ACTION_NAME)); + assertNotNull(properties.get(PROP_RS_DISPOSITION_ACTION_AS_OF)); + } + }); + + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedActionServiceTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedActionServiceTest.java index 9d344ab755..c6b3232f56 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedActionServiceTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedActionServiceTest.java @@ -1,232 +1,232 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionPropertySubs; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ActionDefinition; -import org.alfresco.service.cmr.action.ParameterDefinition; - -/** - * Extended action service test. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ExtendedActionServiceTest extends BaseRMTestCase -{ - /** Action names */ - public static final String TEST_ACTION = "testAction"; - public static final String TEST_ACTION_2 = "testAction2"; - public static final String TEST_DM_ACTION = "testDMAction"; - public static final String RECORD_ONLY_ACTION = "recordOnlyAction"; - public static final String RECORD_AND_FOLDER_ONLY_ACTION = "recordandFolderOnlyAction"; - public static final String DELEGATE_ACTION = "rmDelegateAction"; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected boolean isRecordTest() - { - return true; - } - - // NOTE: temporarily disabled test ... now that RM actions are no longer registered with the action service, aplicability - // may no longer be relevant ... possibly something to back out?? - public void xtestAvailableActions() - { - doTestInTransaction(new Test() - { - public Void run() - { - List result = actionService.getActionDefinitions(recordOne); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertTrue(containsAction(result, TEST_ACTION_2)); - assertFalse(containsAction(result, TEST_DM_ACTION)); - assertTrue(containsAction(result, RECORD_ONLY_ACTION)); - assertTrue(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertTrue(containsAction(result, DELEGATE_ACTION)); - - result = actionService.getActionDefinitions(rmFolder); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertTrue(containsAction(result, TEST_ACTION_2)); - assertFalse(containsAction(result, TEST_DM_ACTION)); - assertFalse(containsAction(result, RECORD_ONLY_ACTION)); - assertTrue(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertFalse(containsAction(result, DELEGATE_ACTION)); - - result = actionService.getActionDefinitions(rmContainer); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertTrue(containsAction(result, TEST_ACTION_2)); - assertFalse(containsAction(result, TEST_DM_ACTION)); - assertFalse(containsAction(result, RECORD_ONLY_ACTION)); - assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertFalse(containsAction(result, DELEGATE_ACTION)); - - result = actionService.getActionDefinitions(dmDocument); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertFalse(containsAction(result, TEST_ACTION_2)); - assertTrue(containsAction(result, TEST_DM_ACTION)); - assertFalse(containsAction(result, RECORD_ONLY_ACTION)); - assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertFalse(containsAction(result, DELEGATE_ACTION)); - - result = actionService.getActionDefinitions(dmFolder); - assertNotNull(result); - assertFalse(containsAction(result, TEST_ACTION)); - assertFalse(containsAction(result, TEST_ACTION_2)); - assertTrue(containsAction(result, TEST_DM_ACTION)); - assertFalse(containsAction(result, RECORD_ONLY_ACTION)); - assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); - assertFalse(containsAction(result, DELEGATE_ACTION)); - - return null; - } - }); - } - - private boolean containsAction(List list, String actionName) - { - boolean result = false; - - for (ActionDefinition actionDefinition : list) - { - if (actionDefinition.getName().equals(actionName)) - { - result = true; - break; - } - } - - return result; - } - - public void testActionPropertySubstitution() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Action action = actionService.createAction(TestActionPropertySubs.NAME); - - action.setParameterValue("dayShort", "${date.day.short}"); - action.setParameterValue("dayShort2", "${date.day}"); - action.setParameterValue("dayLong", "${date.day.long}"); - action.setParameterValue("dayNumber", "${date.day.number}"); - action.setParameterValue("dayYear", "${date.day.year}"); - - action.setParameterValue("monthShort", "${date.month.short}"); - action.setParameterValue("monthShort2", "${date.month}"); - action.setParameterValue("monthLong", "${date.month.long}"); - action.setParameterValue("monthNumber", "${date.month.number}"); - - action.setParameterValue("yearShort", "${date.year.short}"); - action.setParameterValue("yearShort2", "${date.year}"); - action.setParameterValue("yearLong", "${date.year.long}"); - action.setParameterValue("yearWeek", "${date.year.week}"); - - action.setParameterValue("name", "${node.cm:name}"); - - action.setParameterValue("company", "${message.test.company}"); - - action.setParameterValue("combo", "${date.year.long}/${date.month.short}/${node.cm:name}-${message.test.company}.txt"); - - actionService.executeAction(action, rmFolder); - - return null; - } - }); - } - - /** - * RM-3000 - * Tests if the actions extending DelegateAction inherit the parameter definitions from their delegate action - */ - public void testDelegateActions() - { - /* - * set-property-value is the delegate action for setPropertyValue. - */ - assertTrue(inheritsAllParameterDefinitions("setPropertyValue", "set-property-value")); - - /* - * rmscript is the delegate action for executeScript. - */ - assertTrue(inheritsAllParameterDefinitions("executeScript", "rmscript")); - - /* - * mail is the delegate action for sendEmail. - */ - assertTrue(inheritsAllParameterDefinitions("sendEmail", "mail")); - } - - /** - * Checks if the action definition rmAction inherits all the parameter definitions from delegateAction. - * @param rmAction The name of the action definition extending DelegateAction. - * @param delegateAction The name of the delegate action. - * @return true if rmAction inherits all the parameter definitions from delegateAction. false otherwise. - */ - private boolean inheritsAllParameterDefinitions(String rmAction, String delegateAction) - { - /* - * Get the parameter definition list for rmAction - */ - ActionDefinition rmActionDefinition = actionService.getActionDefinition(rmAction); - assertNotNull(rmActionDefinition); - List rmParameterDefinitions = rmActionDefinition.getParameterDefinitions(); - - /* - * Get the parameter definition list for the delegate action - */ - ActionDefinition delegateActionDefinition = actionService.getActionDefinition(delegateAction); - assertNotNull(delegateActionDefinition); - List delegateParameterDefinitions = delegateActionDefinition.getParameterDefinitions(); - - /* - * Check if rmActionDefinition contains all the elements in rmActionDefinition - */ - return rmParameterDefinitions.containsAll(delegateParameterDefinitions); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionPropertySubs; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ActionDefinition; +import org.alfresco.service.cmr.action.ParameterDefinition; + +/** + * Extended action service test. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ExtendedActionServiceTest extends BaseRMTestCase +{ + /** Action names */ + public static final String TEST_ACTION = "testAction"; + public static final String TEST_ACTION_2 = "testAction2"; + public static final String TEST_DM_ACTION = "testDMAction"; + public static final String RECORD_ONLY_ACTION = "recordOnlyAction"; + public static final String RECORD_AND_FOLDER_ONLY_ACTION = "recordandFolderOnlyAction"; + public static final String DELEGATE_ACTION = "rmDelegateAction"; + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isRecordTest() + { + return true; + } + + // NOTE: temporarily disabled test ... now that RM actions are no longer registered with the action service, aplicability + // may no longer be relevant ... possibly something to back out?? + public void xtestAvailableActions() + { + doTestInTransaction(new Test() + { + public Void run() + { + List result = actionService.getActionDefinitions(recordOne); + assertNotNull(result); + assertFalse(containsAction(result, TEST_ACTION)); + assertTrue(containsAction(result, TEST_ACTION_2)); + assertFalse(containsAction(result, TEST_DM_ACTION)); + assertTrue(containsAction(result, RECORD_ONLY_ACTION)); + assertTrue(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); + assertTrue(containsAction(result, DELEGATE_ACTION)); + + result = actionService.getActionDefinitions(rmFolder); + assertNotNull(result); + assertFalse(containsAction(result, TEST_ACTION)); + assertTrue(containsAction(result, TEST_ACTION_2)); + assertFalse(containsAction(result, TEST_DM_ACTION)); + assertFalse(containsAction(result, RECORD_ONLY_ACTION)); + assertTrue(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); + assertFalse(containsAction(result, DELEGATE_ACTION)); + + result = actionService.getActionDefinitions(rmContainer); + assertNotNull(result); + assertFalse(containsAction(result, TEST_ACTION)); + assertTrue(containsAction(result, TEST_ACTION_2)); + assertFalse(containsAction(result, TEST_DM_ACTION)); + assertFalse(containsAction(result, RECORD_ONLY_ACTION)); + assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); + assertFalse(containsAction(result, DELEGATE_ACTION)); + + result = actionService.getActionDefinitions(dmDocument); + assertNotNull(result); + assertFalse(containsAction(result, TEST_ACTION)); + assertFalse(containsAction(result, TEST_ACTION_2)); + assertTrue(containsAction(result, TEST_DM_ACTION)); + assertFalse(containsAction(result, RECORD_ONLY_ACTION)); + assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); + assertFalse(containsAction(result, DELEGATE_ACTION)); + + result = actionService.getActionDefinitions(dmFolder); + assertNotNull(result); + assertFalse(containsAction(result, TEST_ACTION)); + assertFalse(containsAction(result, TEST_ACTION_2)); + assertTrue(containsAction(result, TEST_DM_ACTION)); + assertFalse(containsAction(result, RECORD_ONLY_ACTION)); + assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION)); + assertFalse(containsAction(result, DELEGATE_ACTION)); + + return null; + } + }); + } + + private boolean containsAction(List list, String actionName) + { + boolean result = false; + + for (ActionDefinition actionDefinition : list) + { + if (actionDefinition.getName().equals(actionName)) + { + result = true; + break; + } + } + + return result; + } + + public void testActionPropertySubstitution() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + Action action = actionService.createAction(TestActionPropertySubs.NAME); + + action.setParameterValue("dayShort", "${date.day.short}"); + action.setParameterValue("dayShort2", "${date.day}"); + action.setParameterValue("dayLong", "${date.day.long}"); + action.setParameterValue("dayNumber", "${date.day.number}"); + action.setParameterValue("dayYear", "${date.day.year}"); + + action.setParameterValue("monthShort", "${date.month.short}"); + action.setParameterValue("monthShort2", "${date.month}"); + action.setParameterValue("monthLong", "${date.month.long}"); + action.setParameterValue("monthNumber", "${date.month.number}"); + + action.setParameterValue("yearShort", "${date.year.short}"); + action.setParameterValue("yearShort2", "${date.year}"); + action.setParameterValue("yearLong", "${date.year.long}"); + action.setParameterValue("yearWeek", "${date.year.week}"); + + action.setParameterValue("name", "${node.cm:name}"); + + action.setParameterValue("company", "${message.test.company}"); + + action.setParameterValue("combo", "${date.year.long}/${date.month.short}/${node.cm:name}-${message.test.company}.txt"); + + actionService.executeAction(action, rmFolder); + + return null; + } + }); + } + + /** + * RM-3000 + * Tests if the actions extending DelegateAction inherit the parameter definitions from their delegate action + */ + public void testDelegateActions() + { + /* + * set-property-value is the delegate action for setPropertyValue. + */ + assertTrue(inheritsAllParameterDefinitions("setPropertyValue", "set-property-value")); + + /* + * rmscript is the delegate action for executeScript. + */ + assertTrue(inheritsAllParameterDefinitions("executeScript", "rmscript")); + + /* + * mail is the delegate action for sendEmail. + */ + assertTrue(inheritsAllParameterDefinitions("sendEmail", "mail")); + } + + /** + * Checks if the action definition rmAction inherits all the parameter definitions from delegateAction. + * @param rmAction The name of the action definition extending DelegateAction. + * @param delegateAction The name of the delegate action. + * @return true if rmAction inherits all the parameter definitions from delegateAction. false otherwise. + */ + private boolean inheritsAllParameterDefinitions(String rmAction, String delegateAction) + { + /* + * Get the parameter definition list for rmAction + */ + ActionDefinition rmActionDefinition = actionService.getActionDefinition(rmAction); + assertNotNull(rmActionDefinition); + List rmParameterDefinitions = rmActionDefinition.getParameterDefinitions(); + + /* + * Get the parameter definition list for the delegate action + */ + ActionDefinition delegateActionDefinition = actionService.getActionDefinition(delegateAction); + assertNotNull(delegateActionDefinition); + List delegateParameterDefinitions = delegateActionDefinition.getParameterDefinitions(); + + /* + * Check if rmActionDefinition contains all the elements in rmActionDefinition + */ + return rmParameterDefinitions.containsAll(delegateParameterDefinitions); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedSecurityServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedSecurityServiceImplTest.java index 3793ce293c..390895a2de 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedSecurityServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ExtendedSecurityServiceImplTest.java @@ -1,295 +1,295 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.util.GUID; - -/** - * Records management security service test. - * - * @author Roy Wetherall - */ -public class ExtendedSecurityServiceImplTest extends BaseRMTestCase -{ - private NodeRef record; - private NodeRef recordToo; - private NodeRef moveRecordCategory; - private NodeRef moveRecordFolder; - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - record = utils.createRecord(rmFolder, "record.txt"); - recordToo = utils.createRecord(rmFolder, "recordToo.txt"); - - moveRecordCategory = filePlanService.createRecordCategory(filePlan, "moveRecordCategory"); - moveRecordFolder = recordFolderService.createRecordFolder(moveRecordCategory, "moveRecordFolder"); - } - - private String createTestUser() - { - return doTestInTransaction(new Test() - { - public String run() - { - String userName = GUID.generate(); - createPerson(userName); - return userName; - } - }, AuthenticationUtil.getSystemUserName()); - } - - public void testExtendedSecurity() - { - final String monkey = createTestUser(); - final String elephant = createTestUser(); - final String snake = createTestUser(); - - doTestInTransaction(new Test() - { - public Void run() - { - assertFalse(extendedSecurityService.hasExtendedSecurity(filePlan)); - assertFalse(extendedSecurityService.hasExtendedSecurity(rmContainer)); - assertFalse(extendedSecurityService.hasExtendedSecurity(rmFolder)); - assertFalse(extendedSecurityService.hasExtendedSecurity(record)); - - assertTrue(extendedSecurityService.getReaders(record).isEmpty()); - assertTrue(extendedSecurityService.getWriters(record).isEmpty()); - - Set extendedReaders = new HashSet(2); - extendedReaders.add(monkey); - extendedReaders.add(elephant); - - extendedSecurityService.set(record, extendedReaders, null); - checkExtendedReaders(record, extendedReaders); - - Set extendedReadersToo = new HashSet(2); - extendedReadersToo.add(monkey); - extendedReadersToo.add(snake); - - extendedSecurityService.set(recordToo, extendedReadersToo, null); - checkExtendedReaders(recordToo, extendedReadersToo); - - // test remove - extendedSecurityService.remove(recordToo); - - assertFalse(extendedSecurityService.hasExtendedSecurity(recordToo)); - assertTrue(extendedSecurityService.getReaders(recordToo).isEmpty()); - assertTrue(extendedSecurityService.getWriters(recordToo).isEmpty()); - - return null; - } - }); - } - - public void testMove() - { - final String monkey = createTestUser(); - final String elephant = createTestUser(); - - doTestInTransaction(new Test() - { - Set extendedReaders = new HashSet(2);; - - public Void run() throws Exception - { - extendedReaders.add(monkey); - extendedReaders.add(elephant); - - assertFalse(extendedSecurityService.hasExtendedSecurity(filePlan)); - assertFalse(extendedSecurityService.hasExtendedSecurity(rmContainer)); - assertFalse(extendedSecurityService.hasExtendedSecurity(rmFolder)); - assertFalse(extendedSecurityService.hasExtendedSecurity(record)); - assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordCategory)); - assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordFolder)); - - assertTrue(extendedSecurityService.getReaders(record).isEmpty()); - - extendedSecurityService.set(record, extendedReaders, null); - - checkExtendedReaders(record, extendedReaders); - assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordCategory)); - assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordFolder)); - - fileFolderService.move(record, moveRecordFolder, "movedRecord"); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - checkExtendedReaders(record, extendedReaders); - } - }); - } - - /** - * Check extended readers helper method - */ - private void checkExtendedReaders(NodeRef nodeRef, Set testReaders) - { - assertTrue(extendedSecurityService.hasExtendedSecurity(nodeRef)); - - Set readers = extendedSecurityService.getReaders(nodeRef); - assertNotNull(readers); - assertEquals(testReaders, readers); - } - - public void testDifferentUsersDifferentPermissions() - { - final String userNone = createTestUser(); - final String userRead = createTestUser(); - final String userWrite = createTestUser(); - final String siteShortName = GUID.generate(); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - siteService.createSite(null, siteShortName, "test", "test", SiteVisibility.PRIVATE); - return null; - } - }); - - final NodeRef documentLibrary = doTestInTransaction(new Test() - { - public NodeRef run() throws Exception - { - siteService.setMembership(siteShortName, userRead, SiteModel.SITE_CONSUMER); - siteService.setMembership(siteShortName, userWrite, SiteModel.SITE_COLLABORATOR); - return siteService.createContainer(siteShortName, SiteService.DOCUMENT_LIBRARY, null, null); - } - }); - - final NodeRef record = doTestInTransaction(new Test() - { - public NodeRef run() throws Exception - { - NodeRef record = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - recordService.createRecord(filePlan, record); - return record; - } - }); - - doTestInTransaction(new Test() - { - public Void run() throws Exception - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userNone); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userRead); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userWrite); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userNone); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userRead); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // check permissions - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, FILING)); - return null; - } - }, userWrite); - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.util.GUID; + +/** + * Records management security service test. + * + * @author Roy Wetherall + */ +public class ExtendedSecurityServiceImplTest extends BaseRMTestCase +{ + private NodeRef record; + private NodeRef recordToo; + private NodeRef moveRecordCategory; + private NodeRef moveRecordFolder; + + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected void setupTestDataImpl() + { + super.setupTestDataImpl(); + + record = utils.createRecord(rmFolder, "record.txt"); + recordToo = utils.createRecord(rmFolder, "recordToo.txt"); + + moveRecordCategory = filePlanService.createRecordCategory(filePlan, "moveRecordCategory"); + moveRecordFolder = recordFolderService.createRecordFolder(moveRecordCategory, "moveRecordFolder"); + } + + private String createTestUser() + { + return doTestInTransaction(new Test() + { + public String run() + { + String userName = GUID.generate(); + createPerson(userName); + return userName; + } + }, AuthenticationUtil.getSystemUserName()); + } + + public void testExtendedSecurity() + { + final String monkey = createTestUser(); + final String elephant = createTestUser(); + final String snake = createTestUser(); + + doTestInTransaction(new Test() + { + public Void run() + { + assertFalse(extendedSecurityService.hasExtendedSecurity(filePlan)); + assertFalse(extendedSecurityService.hasExtendedSecurity(rmContainer)); + assertFalse(extendedSecurityService.hasExtendedSecurity(rmFolder)); + assertFalse(extendedSecurityService.hasExtendedSecurity(record)); + + assertTrue(extendedSecurityService.getReaders(record).isEmpty()); + assertTrue(extendedSecurityService.getWriters(record).isEmpty()); + + Set extendedReaders = new HashSet(2); + extendedReaders.add(monkey); + extendedReaders.add(elephant); + + extendedSecurityService.set(record, extendedReaders, null); + checkExtendedReaders(record, extendedReaders); + + Set extendedReadersToo = new HashSet(2); + extendedReadersToo.add(monkey); + extendedReadersToo.add(snake); + + extendedSecurityService.set(recordToo, extendedReadersToo, null); + checkExtendedReaders(recordToo, extendedReadersToo); + + // test remove + extendedSecurityService.remove(recordToo); + + assertFalse(extendedSecurityService.hasExtendedSecurity(recordToo)); + assertTrue(extendedSecurityService.getReaders(recordToo).isEmpty()); + assertTrue(extendedSecurityService.getWriters(recordToo).isEmpty()); + + return null; + } + }); + } + + public void testMove() + { + final String monkey = createTestUser(); + final String elephant = createTestUser(); + + doTestInTransaction(new Test() + { + Set extendedReaders = new HashSet(2);; + + public Void run() throws Exception + { + extendedReaders.add(monkey); + extendedReaders.add(elephant); + + assertFalse(extendedSecurityService.hasExtendedSecurity(filePlan)); + assertFalse(extendedSecurityService.hasExtendedSecurity(rmContainer)); + assertFalse(extendedSecurityService.hasExtendedSecurity(rmFolder)); + assertFalse(extendedSecurityService.hasExtendedSecurity(record)); + assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordCategory)); + assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordFolder)); + + assertTrue(extendedSecurityService.getReaders(record).isEmpty()); + + extendedSecurityService.set(record, extendedReaders, null); + + checkExtendedReaders(record, extendedReaders); + assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordCategory)); + assertFalse(extendedSecurityService.hasExtendedSecurity(moveRecordFolder)); + + fileFolderService.move(record, moveRecordFolder, "movedRecord"); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + checkExtendedReaders(record, extendedReaders); + } + }); + } + + /** + * Check extended readers helper method + */ + private void checkExtendedReaders(NodeRef nodeRef, Set testReaders) + { + assertTrue(extendedSecurityService.hasExtendedSecurity(nodeRef)); + + Set readers = extendedSecurityService.getReaders(nodeRef); + assertNotNull(readers); + assertEquals(testReaders, readers); + } + + public void testDifferentUsersDifferentPermissions() + { + final String userNone = createTestUser(); + final String userRead = createTestUser(); + final String userWrite = createTestUser(); + final String siteShortName = GUID.generate(); + + doTestInTransaction(new Test() + { + public Void run() throws Exception + { + siteService.createSite(null, siteShortName, "test", "test", SiteVisibility.PRIVATE); + return null; + } + }); + + final NodeRef documentLibrary = doTestInTransaction(new Test() + { + public NodeRef run() throws Exception + { + siteService.setMembership(siteShortName, userRead, SiteModel.SITE_CONSUMER); + siteService.setMembership(siteShortName, userWrite, SiteModel.SITE_COLLABORATOR); + return siteService.createContainer(siteShortName, SiteService.DOCUMENT_LIBRARY, null, null); + } + }); + + final NodeRef record = doTestInTransaction(new Test() + { + public NodeRef run() throws Exception + { + NodeRef record = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + recordService.createRecord(filePlan, record); + return record; + } + }); + + doTestInTransaction(new Test() + { + public Void run() throws Exception + { + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // check permissions + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); + return null; + } + }, userNone); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // check permissions + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); + return null; + } + }, userRead); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // check permissions + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, FILING)); + return null; + } + }, userWrite); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // check permissions + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); + return null; + } + }, userNone); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // check permissions + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, FILING)); + return null; + } + }, userRead); + + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + // check permissions + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, FILING)); + return null; + } + }, userWrite); + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanPermissionServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanPermissionServiceImplTest.java index b36b0c87a8..7c1855f11b 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanPermissionServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanPermissionServiceImplTest.java @@ -1,1267 +1,1267 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityType; -import org.springframework.extensions.webscripts.GUID; - -/** - * File plan permission service unit test - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanPermissionServiceImplTest extends BaseRMTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest() - */ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Helper to create test user - */ - private String createTestUser() - { - return doTestInTransaction(new Test() - { - @Override - public String run() - { - String userName = GUID.generate(); - createPerson(userName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, userName); - return userName; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Helper to set permission - */ - private void setPermission(final NodeRef nodeRef, final String userName, final String permission) - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.setPermission(nodeRef, userName, permission); - return null; - } - }); - } - - /** - * Helper to delete permission - */ - private void deletePermission(final NodeRef nodeRef, final String userName, final String permission) - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - filePlanPermissionService.deletePermission(nodeRef, userName, permission); - return null; - } - }); - } - - /** - * Test set/delete permissions on file plan - */ - public void testSetDeletePermissionFilePlan() throws Exception - { - String userName = createTestUser(); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - setPermission(filePlan, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.ALLOWED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - deletePermission(filePlan, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - //what happens if we try and remove READ for a normal user on the file plan ??? - deletePermission(filePlan, userName, RMPermissionModel.READ_RECORDS); - - // nothing .. user still has read on file plan .. only removing the user from all roles will remove read on file plan - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - /** - * Test set/delete permission on record categorty - */ - public void testSetDeletePermissionRecordCategory() throws Exception - { - String userName = createTestUser(); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - setPermission(rmContainer, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // category read - AccessStatus.ALLOWED, // category file - AccessStatus.ALLOWED, // record folder read - AccessStatus.ALLOWED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - deletePermission(rmContainer, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - /** - * Test set/delete permission on record folder - */ - public void testSetDeletePermissionRecordFolder() throws Exception - { - String userName = createTestUser(); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - setPermission(rmFolder, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.ALLOWED, // record folder read - AccessStatus.ALLOWED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - deletePermission(rmFolder, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - /** - * Test set/delete permission on record - */ - public void testSetDeletePermissionRecord() throws Exception - { - String userName = createTestUser(); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - setPermission(recordOne, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - deletePermission(recordOne, userName, RMPermissionModel.FILING); - - assertPermissions(userName, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - public void testMoveRecord() throws Exception - { - String userOne = createTestUser(); - String userTwo = createTestUser(); - String userThree = createTestUser(); - - final NodeRef otherFolder = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return recordFolderService.createRecordFolder(rmContainer, "otherFolder"); - } - }); - - assertPermissions(userOne, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userOne); - - assertPermissions(userTwo, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userTwo); - - assertPermissions(userThree, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userThree); - - setPermission(rmFolder, userOne, RMPermissionModel.FILING); - setPermission(otherFolder, userTwo, RMPermissionModel.FILING); - setPermission(recordOne, userThree, RMPermissionModel.FILING); - - assertPermissions(userOne, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.ALLOWED, // record folder read - AccessStatus.ALLOWED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userOne); - - assertPermissions(userTwo, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userTwo); - - assertPermissions(userThree, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userThree); - - // move the record! - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - fileFolderService.move(recordOne, otherFolder, "movedRecord.txt"); - return null; - } - }); - - assertPermissions(userOne, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.ALLOWED, // record folder read - AccessStatus.ALLOWED, // record folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userOne); - - assertPermissions(userTwo, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userTwo); - - assertPermissions(userThree, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.DENIED, // category read - AccessStatus.DENIED, // category file - AccessStatus.DENIED, // record folder read - AccessStatus.DENIED, // record folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); - return null; - } - }, userThree); - - } - - /** - * Helper to assert permissions for passed user - */ - private void assertPermissions(final String userName, final AccessStatus ... accessStatus) - { - assertEquals(8, accessStatus.length); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals("Everyone who has a role has read permissions on the file plan", - accessStatus[0], permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[1], permissionService.hasPermission(filePlan, RMPermissionModel.FILING)); - - assertEquals(accessStatus[2], permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[3], permissionService.hasPermission(rmContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[4], permissionService.hasPermission(rmFolder, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[5], permissionService.hasPermission(rmFolder, RMPermissionModel.FILING)); - - assertEquals(accessStatus[6], permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[7], permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); - - return null; - } - }, userName); - } - - /** - * Helper to assert permissions for the passed user - */ - private void assertPermissionsWithInheritance( - final String userName, - final NodeRef subCategory, - final NodeRef folder, - final NodeRef record, - final AccessStatus ... accessStatus) - { - assertEquals(16, accessStatus.length); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(accessStatus[0], permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[1], permissionService.hasPermission(filePlan, RMPermissionModel.FILING)); - - assertEquals(accessStatus[2], permissionService.hasPermission(transfersContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[3], permissionService.hasPermission(transfersContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[4], permissionService.hasPermission(holdsContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[5], permissionService.hasPermission(holdsContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[6], permissionService.hasPermission(unfiledContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[7], permissionService.hasPermission(unfiledContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[8], permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[9], permissionService.hasPermission(rmContainer, RMPermissionModel.FILING)); - - assertEquals(accessStatus[10], permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[11], permissionService.hasPermission(subCategory, RMPermissionModel.FILING)); - - assertEquals(accessStatus[12], permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[13], permissionService.hasPermission(folder, RMPermissionModel.FILING)); - - assertEquals(accessStatus[14], permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); - assertEquals(accessStatus[15], permissionService.hasPermission(record, RMPermissionModel.FILING)); - - return null; - } - }, userName); - } - - public void testFilePlanComponentInheritance() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Inheritance is turned off for file plan, transfer, holds, unfiled records and root categories - // it is turned on for sub categories, record folders and records - assertFalse(permissionService.getInheritParentPermissions(filePlan)); - assertFalse(permissionService.getInheritParentPermissions(filePlanService.getTransferContainer(filePlan))); - assertFalse(permissionService.getInheritParentPermissions(filePlanService.getHoldContainer(filePlan))); - assertFalse(permissionService.getInheritParentPermissions(unfiledContainer)); - assertFalse(permissionService.getInheritParentPermissions(rmContainer)); - assertTrue(permissionService.getInheritParentPermissions(recordFolderService.createRecordFolder(rmContainer, "subCategory"))); - assertTrue(permissionService.getInheritParentPermissions(rmFolder)); - assertTrue(permissionService.getInheritParentPermissions(recordOne)); - - return null; - } - }, ADMIN_USER); - } - - public void testRolesSetByDefault() - { - NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory1"); - NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder1"); - NodeRef record = utils.createRecord(folder, "record1.txt"); - - // Admin user has read/filing permissions on file plan, transfer, hold, unfiled records, root categories, sub categories, folders and records - assertPermissionsWithInheritance(ADMIN_USER, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.ALLOWED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.ALLOWED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.ALLOWED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.ALLOWED, // root category read - AccessStatus.ALLOWED, // root category file - AccessStatus.ALLOWED, // sub category read - AccessStatus.ALLOWED, // sub category file - AccessStatus.ALLOWED, // folder read - AccessStatus.ALLOWED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - // Test user has read permissions on file plan, transfer, hold and unfiled records as the user will be added in the all records management roles - // which has read permissions on those nodes by default - assertPermissionsWithInheritance(createTestUser(), subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - } - - public void testAddUserToContainers() - { - NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory2"); - NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder2"); - NodeRef record = utils.createRecord(folder, "record2.txt"); - - // The user1 will have read permissions on the file plan - // and read permissions on transfer, hold and unfiled records as the user will be in the all records management users role - String user1 = createTestUser(); - setPermission(filePlan, user1, RMPermissionModel.READ_RECORDS); - assertPermissionsWithInheritance(user1, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - // The user2 will have read and filing permissions on the transfer container - // and read permissions on file plan, hold and unfiled records as the user will be in the all records management users role - String user2 = createTestUser(); - setPermission(transfersContainer, user2, RMPermissionModel.FILING); - assertPermissionsWithInheritance(user2, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.ALLOWED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - // The user3 will have read permissions on file plan, transfer, hold and unfiled records - String user3 = createTestUser(); - setPermission(holdsContainer, user3, RMPermissionModel.READ_RECORDS); - assertPermissionsWithInheritance(user3, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - // The user4 will have read permissions on file plan, transfer, hold - // and read and filing permissions on unfiled records container - String user4 = createTestUser(); - setPermission(unfiledContainer, user4, RMPermissionModel.FILING); - assertPermissionsWithInheritance(user4, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.DENIED, // record read - AccessStatus.DENIED); // record file - - // The user5 will read permissions on the root category - // as the inheritance is turned on for the sub category the user will have also read permissions on sub category, folder and record - // and also read permissions on file plan, transfer, hold and unfiled records - String user5 = createTestUser(); - setPermission(rmContainer, user5, RMPermissionModel.READ_RECORDS); - assertPermissionsWithInheritance(user5, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.ALLOWED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.ALLOWED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.ALLOWED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.DENIED); // record file - - // The user6 will read and filing permissions on the sub category - // as the inheritance is turned on the user will have also read and filing permissions on folder and record - // and also read permissions on file plan, transfer, hold and unfiled records - String user6 = createTestUser(); - setPermission(subCategory, user6, RMPermissionModel.FILING); - assertPermissionsWithInheritance(user6, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.ALLOWED, // sub category read - AccessStatus.ALLOWED, // sub category file - AccessStatus.ALLOWED, // folder read - AccessStatus.ALLOWED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - - // The user7 will read permissions on the folder - // as the inheritance is turned on the user will have also read on record - // and also read permissions on file plan, transfer, hold and unfiled records - String user7 = createTestUser(); - setPermission(folder, user7, RMPermissionModel.READ_RECORDS); - assertPermissionsWithInheritance(user7, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.ALLOWED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.DENIED); // record file - - // The user8 will read and filing permissions on the record - // and also read permissions on file plan, transfer, hold and unfiled records - String user8 = createTestUser(); - setPermission(record, user8, RMPermissionModel.FILING); - assertPermissionsWithInheritance(user8, subCategory, folder, record, - AccessStatus.ALLOWED, // fileplan read - AccessStatus.DENIED, // fileplan file - AccessStatus.ALLOWED, // transfer read - AccessStatus.DENIED, // transfer file - AccessStatus.ALLOWED, // holds read - AccessStatus.DENIED, // holds file - AccessStatus.ALLOWED, // unfiled records file - AccessStatus.DENIED, // unfiled records file - AccessStatus.DENIED, // root category read - AccessStatus.DENIED, // root category file - AccessStatus.DENIED, // sub category read - AccessStatus.DENIED, // sub category file - AccessStatus.DENIED, // folder read - AccessStatus.DENIED, // folder file - AccessStatus.ALLOWED, // record read - AccessStatus.ALLOWED); // record file - } - - public void testAccessPermissionOnSingleRecordWithSeveralUsers() - { - final NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory3"); - final NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder3"); - final NodeRef record = utils.createRecord(folder, "record3.txt"); - - String user1 = createTestUser(); - String user2 = createTestUser(); - - setPermission(rmContainer, user1, RMPermissionModel.READ_RECORDS); - - // user1 will have access to file plan, root category and because of inheritance sub category, folder and record - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); - - return null; - } - }, user1); - - // user2 will have access to file plan - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); - - return null; - } - }, user2); - } - - public void testDenyPermissionsOnRecordsWithSeveralUsers() - { - final NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory4"); - final NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder4"); - final NodeRef record4 = utils.createRecord(folder, "record4.txt"); - final NodeRef record5 = utils.createRecord(folder, "record5.txt"); - - String user1 = createTestUser(); - String user2 = createTestUser(); - - setPermission(rmContainer, user1, RMPermissionModel.READ_RECORDS); - setPermission(rmContainer, user2, RMPermissionModel.READ_RECORDS); - - permissionService.setInheritParentPermissions(record4, false); - permissionService.setInheritParentPermissions(record5, false); - - setPermission(record4, user1, RMPermissionModel.READ_RECORDS); - setPermission(record5, user1, RMPermissionModel.READ_RECORDS); - - // user1 will have access to file plan, root category and because of inheritance sub category, folder, record4 and record5 - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record4, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record5, RMPermissionModel.READ_RECORDS)); - - return null; - } - }, user1); - - // user2 will have access to file plan, root category and because of inheritance sub category and folder - // user2 won't have access to the records as the inheritance is set to false - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record4, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record5, RMPermissionModel.READ_RECORDS)); - - return null; - } - }, user2); - } - - public void testMoveRootCategoryIntoAnotherRootCategory() - { - final NodeRef category5 = filePlanService.createRecordCategory(filePlan, "category5"); - final NodeRef category6 = filePlanService.createRecordCategory(filePlan, "category6"); - - assertFalse(permissionService.getInheritParentPermissions(category5)); - assertFalse(permissionService.getInheritParentPermissions(category6)); - - final String user1 = createTestUser(); - final String user2 = createTestUser(); - - setPermission(category5, user1, RMPermissionModel.READ_RECORDS); - setPermission(category6, user2, RMPermissionModel.FILING); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category5, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); - - return null; - } - }, user1); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); - - return null; - } - }, user2); - - final NodeRef movedCategory5 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return fileFolderService.move(category5, category6, null).getNodeRef(); - } - }); - - assertFalse(permissionService.getInheritParentPermissions(movedCategory5)); - assertFalse(permissionService.getInheritParentPermissions(category6)); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedCategory5, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); - - return null; - } - }, user1); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); - - return null; - } - }, user2); - } - - public void testPermissionsForMovedRecord() - { - final NodeRef category7 = filePlanService.createRecordCategory(filePlan, "category7"); - final NodeRef folder7 = recordFolderService.createRecordFolder(category7, "rmFolder7"); - final NodeRef record7 = utils.createRecord(folder7, "record7.txt"); - - final NodeRef category8 = filePlanService.createRecordCategory(filePlan, "category8"); - final NodeRef folder8 = recordFolderService.createRecordFolder(category8, "rmFolder8"); - final NodeRef record8 = utils.createRecord(folder8, "record8.txt"); - - final String user1 = createTestUser(); - final String user2 = createTestUser(); - final String user3 = createTestUser(); - - setPermission(folder7, user1, RMPermissionModel.FILING); - setPermission(record8, user2, RMPermissionModel.READ_RECORDS); - setPermission(category7, user3, RMPermissionModel.FILING); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); - - return null; - } - }, user1); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); - - return null; - } - }, user2); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); - - return null; - } - }, user3); - - final NodeRef movedRecord8 = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return fileFolderService.move(record8, folder7, null).getNodeRef(); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); - - return null; - } - }, user1); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); - - return null; - } - }, user2); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); - - return null; - } - }, user3); - } - - public void testSpecialRoles() - { - final NodeRef category9 = filePlanService.createRecordCategory(filePlan, "category9"); - final NodeRef subCategory9 = filePlanService.createRecordCategory(category9, "subCategory9"); - final NodeRef folder9 = recordFolderService.createRecordFolder(subCategory9, "rmFolder9"); - final NodeRef record9 = utils.createRecord(folder9, "record9.txt"); - - assertExistenceOfSpecialRolesAndPermissions(category9); - - assertExistenceOfSpecialRolesAndPermissions(subCategory9); - // After setting the permissions off the special roles should be still available as they will be added to the node automatically - permissionService.setInheritParentPermissions(subCategory9, false); - assertExistenceOfSpecialRolesAndPermissions(subCategory9); - permissionService.setInheritParentPermissions(subCategory9, true); - assertExistenceOfSpecialRolesAndPermissions(subCategory9); - - assertExistenceOfSpecialRolesAndPermissions(folder9); - permissionService.setInheritParentPermissions(folder9, false); - assertExistenceOfSpecialRolesAndPermissions(folder9); - permissionService.setInheritParentPermissions(folder9, true); - assertExistenceOfSpecialRolesAndPermissions(folder9); - - assertExistenceOfSpecialRolesAndPermissions(record9); - permissionService.setInheritParentPermissions(record9, false); - assertExistenceOfSpecialRolesAndPermissions(record9); - permissionService.setInheritParentPermissions(record9, true); - assertExistenceOfSpecialRolesAndPermissions(record9); - } - - private void assertExistenceOfSpecialRolesAndPermissions(NodeRef node) - { - Map accessPermissions = new HashMap(); - Set permissions = permissionService.getAllSetPermissions(node); - // FIXME!!! - //assertEquals(3, permissions.size()); - - for (AccessPermission permission : permissions) - { - accessPermissions.put(permission.getAuthority(), permission.getPermission()); - } - - String adminRole = authorityService.getName(AuthorityType.GROUP, FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); - assertTrue(accessPermissions.containsKey(adminRole)); - assertEquals(RMPermissionModel.FILING, accessPermissions.get(adminRole)); - } - - public void testMoveSubCategoryIntoFilePlan() - { - final NodeRef rootCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - final NodeRef subCategory = filePlanService.createRecordCategory(rootCategory, GUID.generate()); - - assertFalse(permissionService.getInheritParentPermissions(rootCategory)); - assertTrue(permissionService.getInheritParentPermissions(subCategory)); - - final NodeRef movedSubCategory = doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return fileFolderService.move(subCategory, filePlan, null).getNodeRef(); - } - }); - - assertFalse(permissionService.getInheritParentPermissions(rootCategory)); - assertFalse(permissionService.getInheritParentPermissions(movedSubCategory)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessPermission; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.AuthorityType; +import org.springframework.extensions.webscripts.GUID; + +/** + * File plan permission service unit test + * + * @author Roy Wetherall + * @since 2.1 + */ +public class FilePlanPermissionServiceImplTest extends BaseRMTestCase +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest() + */ + @Override + protected boolean isRecordTest() + { + return true; + } + + /** + * Helper to create test user + */ + private String createTestUser() + { + return doTestInTransaction(new Test() + { + @Override + public String run() + { + String userName = GUID.generate(); + createPerson(userName); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, userName); + return userName; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Helper to set permission + */ + private void setPermission(final NodeRef nodeRef, final String userName, final String permission) + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanPermissionService.setPermission(nodeRef, userName, permission); + return null; + } + }); + } + + /** + * Helper to delete permission + */ + private void deletePermission(final NodeRef nodeRef, final String userName, final String permission) + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + filePlanPermissionService.deletePermission(nodeRef, userName, permission); + return null; + } + }); + } + + /** + * Test set/delete permissions on file plan + */ + public void testSetDeletePermissionFilePlan() throws Exception + { + String userName = createTestUser(); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + setPermission(filePlan, userName, RMPermissionModel.FILING); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.ALLOWED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + deletePermission(filePlan, userName, RMPermissionModel.FILING); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + //what happens if we try and remove READ for a normal user on the file plan ??? + deletePermission(filePlan, userName, RMPermissionModel.READ_RECORDS); + + // nothing .. user still has read on file plan .. only removing the user from all roles will remove read on file plan + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + } + + /** + * Test set/delete permission on record categorty + */ + public void testSetDeletePermissionRecordCategory() throws Exception + { + String userName = createTestUser(); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + setPermission(rmContainer, userName, RMPermissionModel.FILING); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // category read + AccessStatus.ALLOWED, // category file + AccessStatus.ALLOWED, // record folder read + AccessStatus.ALLOWED, // record folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + deletePermission(rmContainer, userName, RMPermissionModel.FILING); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + } + + /** + * Test set/delete permission on record folder + */ + public void testSetDeletePermissionRecordFolder() throws Exception + { + String userName = createTestUser(); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + setPermission(rmFolder, userName, RMPermissionModel.FILING); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.ALLOWED, // record folder read + AccessStatus.ALLOWED, // record folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + deletePermission(rmFolder, userName, RMPermissionModel.FILING); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + } + + /** + * Test set/delete permission on record + */ + public void testSetDeletePermissionRecord() throws Exception + { + String userName = createTestUser(); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + setPermission(recordOne, userName, RMPermissionModel.FILING); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + deletePermission(recordOne, userName, RMPermissionModel.FILING); + + assertPermissions(userName, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + } + + public void testMoveRecord() throws Exception + { + String userOne = createTestUser(); + String userTwo = createTestUser(); + String userThree = createTestUser(); + + final NodeRef otherFolder = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + return recordFolderService.createRecordFolder(rmContainer, "otherFolder"); + } + }); + + assertPermissions(userOne, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userOne); + + assertPermissions(userTwo, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userTwo); + + assertPermissions(userThree, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userThree); + + setPermission(rmFolder, userOne, RMPermissionModel.FILING); + setPermission(otherFolder, userTwo, RMPermissionModel.FILING); + setPermission(recordOne, userThree, RMPermissionModel.FILING); + + assertPermissions(userOne, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.ALLOWED, // record folder read + AccessStatus.ALLOWED, // record folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userOne); + + assertPermissions(userTwo, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userTwo); + + assertPermissions(userThree, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userThree); + + // move the record! + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + fileFolderService.move(recordOne, otherFolder, "movedRecord.txt"); + return null; + } + }); + + assertPermissions(userOne, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.ALLOWED, // record folder read + AccessStatus.ALLOWED, // record folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userOne); + + assertPermissions(userTwo, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userTwo); + + assertPermissions(userThree, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.DENIED, // category read + AccessStatus.DENIED, // category file + AccessStatus.DENIED, // record folder read + AccessStatus.DENIED, // record folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(otherFolder, RMPermissionModel.FILING)); + return null; + } + }, userThree); + + } + + /** + * Helper to assert permissions for passed user + */ + private void assertPermissions(final String userName, final AccessStatus ... accessStatus) + { + assertEquals(8, accessStatus.length); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals("Everyone who has a role has read permissions on the file plan", + accessStatus[0], permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[1], permissionService.hasPermission(filePlan, RMPermissionModel.FILING)); + + assertEquals(accessStatus[2], permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[3], permissionService.hasPermission(rmContainer, RMPermissionModel.FILING)); + + assertEquals(accessStatus[4], permissionService.hasPermission(rmFolder, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[5], permissionService.hasPermission(rmFolder, RMPermissionModel.FILING)); + + assertEquals(accessStatus[6], permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[7], permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); + + return null; + } + }, userName); + } + + /** + * Helper to assert permissions for the passed user + */ + private void assertPermissionsWithInheritance( + final String userName, + final NodeRef subCategory, + final NodeRef folder, + final NodeRef record, + final AccessStatus ... accessStatus) + { + assertEquals(16, accessStatus.length); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(accessStatus[0], permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[1], permissionService.hasPermission(filePlan, RMPermissionModel.FILING)); + + assertEquals(accessStatus[2], permissionService.hasPermission(transfersContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[3], permissionService.hasPermission(transfersContainer, RMPermissionModel.FILING)); + + assertEquals(accessStatus[4], permissionService.hasPermission(holdsContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[5], permissionService.hasPermission(holdsContainer, RMPermissionModel.FILING)); + + assertEquals(accessStatus[6], permissionService.hasPermission(unfiledContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[7], permissionService.hasPermission(unfiledContainer, RMPermissionModel.FILING)); + + assertEquals(accessStatus[8], permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[9], permissionService.hasPermission(rmContainer, RMPermissionModel.FILING)); + + assertEquals(accessStatus[10], permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[11], permissionService.hasPermission(subCategory, RMPermissionModel.FILING)); + + assertEquals(accessStatus[12], permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[13], permissionService.hasPermission(folder, RMPermissionModel.FILING)); + + assertEquals(accessStatus[14], permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); + assertEquals(accessStatus[15], permissionService.hasPermission(record, RMPermissionModel.FILING)); + + return null; + } + }, userName); + } + + public void testFilePlanComponentInheritance() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Inheritance is turned off for file plan, transfer, holds, unfiled records and root categories + // it is turned on for sub categories, record folders and records + assertFalse(permissionService.getInheritParentPermissions(filePlan)); + assertFalse(permissionService.getInheritParentPermissions(filePlanService.getTransferContainer(filePlan))); + assertFalse(permissionService.getInheritParentPermissions(filePlanService.getHoldContainer(filePlan))); + assertFalse(permissionService.getInheritParentPermissions(unfiledContainer)); + assertFalse(permissionService.getInheritParentPermissions(rmContainer)); + assertTrue(permissionService.getInheritParentPermissions(recordFolderService.createRecordFolder(rmContainer, "subCategory"))); + assertTrue(permissionService.getInheritParentPermissions(rmFolder)); + assertTrue(permissionService.getInheritParentPermissions(recordOne)); + + return null; + } + }, ADMIN_USER); + } + + public void testRolesSetByDefault() + { + NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory1"); + NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder1"); + NodeRef record = utils.createRecord(folder, "record1.txt"); + + // Admin user has read/filing permissions on file plan, transfer, hold, unfiled records, root categories, sub categories, folders and records + assertPermissionsWithInheritance(ADMIN_USER, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.ALLOWED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.ALLOWED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.ALLOWED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.ALLOWED, // root category read + AccessStatus.ALLOWED, // root category file + AccessStatus.ALLOWED, // sub category read + AccessStatus.ALLOWED, // sub category file + AccessStatus.ALLOWED, // folder read + AccessStatus.ALLOWED, // folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + // Test user has read permissions on file plan, transfer, hold and unfiled records as the user will be added in the all records management roles + // which has read permissions on those nodes by default + assertPermissionsWithInheritance(createTestUser(), subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.DENIED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // unfiled records file + AccessStatus.DENIED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.DENIED, // sub category read + AccessStatus.DENIED, // sub category file + AccessStatus.DENIED, // folder read + AccessStatus.DENIED, // folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + } + + public void testAddUserToContainers() + { + NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory2"); + NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder2"); + NodeRef record = utils.createRecord(folder, "record2.txt"); + + // The user1 will have read permissions on the file plan + // and read permissions on transfer, hold and unfiled records as the user will be in the all records management users role + String user1 = createTestUser(); + setPermission(filePlan, user1, RMPermissionModel.READ_RECORDS); + assertPermissionsWithInheritance(user1, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.DENIED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // unfiled records file + AccessStatus.DENIED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.DENIED, // sub category read + AccessStatus.DENIED, // sub category file + AccessStatus.DENIED, // folder read + AccessStatus.DENIED, // folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + // The user2 will have read and filing permissions on the transfer container + // and read permissions on file plan, hold and unfiled records as the user will be in the all records management users role + String user2 = createTestUser(); + setPermission(transfersContainer, user2, RMPermissionModel.FILING); + assertPermissionsWithInheritance(user2, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.ALLOWED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // unfiled records file + AccessStatus.DENIED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.DENIED, // sub category read + AccessStatus.DENIED, // sub category file + AccessStatus.DENIED, // folder read + AccessStatus.DENIED, // folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + // The user3 will have read permissions on file plan, transfer, hold and unfiled records + String user3 = createTestUser(); + setPermission(holdsContainer, user3, RMPermissionModel.READ_RECORDS); + assertPermissionsWithInheritance(user3, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.DENIED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // unfiled records file + AccessStatus.DENIED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.DENIED, // sub category read + AccessStatus.DENIED, // sub category file + AccessStatus.DENIED, // folder read + AccessStatus.DENIED, // folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + // The user4 will have read permissions on file plan, transfer, hold + // and read and filing permissions on unfiled records container + String user4 = createTestUser(); + setPermission(unfiledContainer, user4, RMPermissionModel.FILING); + assertPermissionsWithInheritance(user4, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.DENIED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.DENIED, // sub category read + AccessStatus.DENIED, // sub category file + AccessStatus.DENIED, // folder read + AccessStatus.DENIED, // folder file + AccessStatus.DENIED, // record read + AccessStatus.DENIED); // record file + + // The user5 will read permissions on the root category + // as the inheritance is turned on for the sub category the user will have also read permissions on sub category, folder and record + // and also read permissions on file plan, transfer, hold and unfiled records + String user5 = createTestUser(); + setPermission(rmContainer, user5, RMPermissionModel.READ_RECORDS); + assertPermissionsWithInheritance(user5, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.DENIED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // unfiled records file + AccessStatus.ALLOWED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.ALLOWED, // sub category read + AccessStatus.DENIED, // sub category file + AccessStatus.ALLOWED, // folder read + AccessStatus.DENIED, // folder file + AccessStatus.ALLOWED, // record read + AccessStatus.DENIED); // record file + + // The user6 will read and filing permissions on the sub category + // as the inheritance is turned on the user will have also read and filing permissions on folder and record + // and also read permissions on file plan, transfer, hold and unfiled records + String user6 = createTestUser(); + setPermission(subCategory, user6, RMPermissionModel.FILING); + assertPermissionsWithInheritance(user6, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.DENIED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // unfiled records file + AccessStatus.DENIED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.ALLOWED, // sub category read + AccessStatus.ALLOWED, // sub category file + AccessStatus.ALLOWED, // folder read + AccessStatus.ALLOWED, // folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + + // The user7 will read permissions on the folder + // as the inheritance is turned on the user will have also read on record + // and also read permissions on file plan, transfer, hold and unfiled records + String user7 = createTestUser(); + setPermission(folder, user7, RMPermissionModel.READ_RECORDS); + assertPermissionsWithInheritance(user7, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.DENIED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // unfiled records file + AccessStatus.DENIED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.DENIED, // sub category read + AccessStatus.DENIED, // sub category file + AccessStatus.ALLOWED, // folder read + AccessStatus.DENIED, // folder file + AccessStatus.ALLOWED, // record read + AccessStatus.DENIED); // record file + + // The user8 will read and filing permissions on the record + // and also read permissions on file plan, transfer, hold and unfiled records + String user8 = createTestUser(); + setPermission(record, user8, RMPermissionModel.FILING); + assertPermissionsWithInheritance(user8, subCategory, folder, record, + AccessStatus.ALLOWED, // fileplan read + AccessStatus.DENIED, // fileplan file + AccessStatus.ALLOWED, // transfer read + AccessStatus.DENIED, // transfer file + AccessStatus.ALLOWED, // holds read + AccessStatus.DENIED, // holds file + AccessStatus.ALLOWED, // unfiled records file + AccessStatus.DENIED, // unfiled records file + AccessStatus.DENIED, // root category read + AccessStatus.DENIED, // root category file + AccessStatus.DENIED, // sub category read + AccessStatus.DENIED, // sub category file + AccessStatus.DENIED, // folder read + AccessStatus.DENIED, // folder file + AccessStatus.ALLOWED, // record read + AccessStatus.ALLOWED); // record file + } + + public void testAccessPermissionOnSingleRecordWithSeveralUsers() + { + final NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory3"); + final NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder3"); + final NodeRef record = utils.createRecord(folder, "record3.txt"); + + String user1 = createTestUser(); + String user2 = createTestUser(); + + setPermission(rmContainer, user1, RMPermissionModel.READ_RECORDS); + + // user1 will have access to file plan, root category and because of inheritance sub category, folder and record + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); + + return null; + } + }, user1); + + // user2 will have access to file plan + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record, RMPermissionModel.READ_RECORDS)); + + return null; + } + }, user2); + } + + public void testDenyPermissionsOnRecordsWithSeveralUsers() + { + final NodeRef subCategory = filePlanService.createRecordCategory(rmContainer, "subCategory4"); + final NodeRef folder = recordFolderService.createRecordFolder(subCategory, "rmFolder4"); + final NodeRef record4 = utils.createRecord(folder, "record4.txt"); + final NodeRef record5 = utils.createRecord(folder, "record5.txt"); + + String user1 = createTestUser(); + String user2 = createTestUser(); + + setPermission(rmContainer, user1, RMPermissionModel.READ_RECORDS); + setPermission(rmContainer, user2, RMPermissionModel.READ_RECORDS); + + permissionService.setInheritParentPermissions(record4, false); + permissionService.setInheritParentPermissions(record5, false); + + setPermission(record4, user1, RMPermissionModel.READ_RECORDS); + setPermission(record5, user1, RMPermissionModel.READ_RECORDS); + + // user1 will have access to file plan, root category and because of inheritance sub category, folder, record4 and record5 + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record4, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record5, RMPermissionModel.READ_RECORDS)); + + return null; + } + }, user1); + + // user2 will have access to file plan, root category and because of inheritance sub category and folder + // user2 won't have access to the records as the inheritance is set to false + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(rmContainer, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(subCategory, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record4, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record5, RMPermissionModel.READ_RECORDS)); + + return null; + } + }, user2); + } + + public void testMoveRootCategoryIntoAnotherRootCategory() + { + final NodeRef category5 = filePlanService.createRecordCategory(filePlan, "category5"); + final NodeRef category6 = filePlanService.createRecordCategory(filePlan, "category6"); + + assertFalse(permissionService.getInheritParentPermissions(category5)); + assertFalse(permissionService.getInheritParentPermissions(category6)); + + final String user1 = createTestUser(); + final String user2 = createTestUser(); + + setPermission(category5, user1, RMPermissionModel.READ_RECORDS); + setPermission(category6, user2, RMPermissionModel.FILING); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category5, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); + + return null; + } + }, user1); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category5, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); + + return null; + } + }, user2); + + final NodeRef movedCategory5 = doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + return fileFolderService.move(category5, category6, null).getNodeRef(); + } + }); + + assertFalse(permissionService.getInheritParentPermissions(movedCategory5)); + assertFalse(permissionService.getInheritParentPermissions(category6)); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedCategory5, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); + + return null; + } + }, user1); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedCategory5, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category6, RMPermissionModel.FILING)); + + return null; + } + }, user2); + } + + public void testPermissionsForMovedRecord() + { + final NodeRef category7 = filePlanService.createRecordCategory(filePlan, "category7"); + final NodeRef folder7 = recordFolderService.createRecordFolder(category7, "rmFolder7"); + final NodeRef record7 = utils.createRecord(folder7, "record7.txt"); + + final NodeRef category8 = filePlanService.createRecordCategory(filePlan, "category8"); + final NodeRef folder8 = recordFolderService.createRecordFolder(category8, "rmFolder8"); + final NodeRef record8 = utils.createRecord(folder8, "record8.txt"); + + final String user1 = createTestUser(); + final String user2 = createTestUser(); + final String user3 = createTestUser(); + + setPermission(folder7, user1, RMPermissionModel.FILING); + setPermission(record8, user2, RMPermissionModel.READ_RECORDS); + setPermission(category7, user3, RMPermissionModel.FILING); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); + + return null; + } + }, user1); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); + + return null; + } + }, user2); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record8, RMPermissionModel.FILING)); + + return null; + } + }, user3); + + final NodeRef movedRecord8 = doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + return fileFolderService.move(record8, folder7, null).getNodeRef(); + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); + + return null; + } + }, user1); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); + + return null; + } + }, user2); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(category7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(folder7, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(record7, RMPermissionModel.FILING)); + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(category8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(folder8, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(movedRecord8, RMPermissionModel.FILING)); + + return null; + } + }, user3); + } + + public void testSpecialRoles() + { + final NodeRef category9 = filePlanService.createRecordCategory(filePlan, "category9"); + final NodeRef subCategory9 = filePlanService.createRecordCategory(category9, "subCategory9"); + final NodeRef folder9 = recordFolderService.createRecordFolder(subCategory9, "rmFolder9"); + final NodeRef record9 = utils.createRecord(folder9, "record9.txt"); + + assertExistenceOfSpecialRolesAndPermissions(category9); + + assertExistenceOfSpecialRolesAndPermissions(subCategory9); + // After setting the permissions off the special roles should be still available as they will be added to the node automatically + permissionService.setInheritParentPermissions(subCategory9, false); + assertExistenceOfSpecialRolesAndPermissions(subCategory9); + permissionService.setInheritParentPermissions(subCategory9, true); + assertExistenceOfSpecialRolesAndPermissions(subCategory9); + + assertExistenceOfSpecialRolesAndPermissions(folder9); + permissionService.setInheritParentPermissions(folder9, false); + assertExistenceOfSpecialRolesAndPermissions(folder9); + permissionService.setInheritParentPermissions(folder9, true); + assertExistenceOfSpecialRolesAndPermissions(folder9); + + assertExistenceOfSpecialRolesAndPermissions(record9); + permissionService.setInheritParentPermissions(record9, false); + assertExistenceOfSpecialRolesAndPermissions(record9); + permissionService.setInheritParentPermissions(record9, true); + assertExistenceOfSpecialRolesAndPermissions(record9); + } + + private void assertExistenceOfSpecialRolesAndPermissions(NodeRef node) + { + Map accessPermissions = new HashMap(); + Set permissions = permissionService.getAllSetPermissions(node); + // FIXME!!! + //assertEquals(3, permissions.size()); + + for (AccessPermission permission : permissions) + { + accessPermissions.put(permission.getAuthority(), permission.getPermission()); + } + + String adminRole = authorityService.getName(AuthorityType.GROUP, FilePlanRoleService.ROLE_ADMIN + filePlan.getId()); + assertTrue(accessPermissions.containsKey(adminRole)); + assertEquals(RMPermissionModel.FILING, accessPermissions.get(adminRole)); + } + + public void testMoveSubCategoryIntoFilePlan() + { + final NodeRef rootCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + final NodeRef subCategory = filePlanService.createRecordCategory(rootCategory, GUID.generate()); + + assertFalse(permissionService.getInheritParentPermissions(rootCategory)); + assertTrue(permissionService.getInheritParentPermissions(subCategory)); + + final NodeRef movedSubCategory = doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + return fileFolderService.move(subCategory, filePlan, null).getNodeRef(); + } + }); + + assertFalse(permissionService.getInheritParentPermissions(rootCategory)); + assertFalse(permissionService.getInheritParentPermissions(movedSubCategory)); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanRoleServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanRoleServiceImplTest.java index 717fe5dc74..12a8b4975a 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanRoleServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanRoleServiceImplTest.java @@ -1,231 +1,231 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -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.test.util.BaseRMTestCase; - -/** - * File plan role service unit test - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanRoleServiceImplTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - public void testGetAllRolesContainerGroup() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - String allRolesGroup = filePlanRoleService.getAllRolesContainerGroup(filePlan); - assertNotNull(allRolesGroup); - - return null; - } - }); - } - - public void testGetRoles() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Set roles = filePlanRoleService.getRoles(filePlan); - assertNotNull(roles); - assertTrue(roles.size() != 0); - - Set rolesIncludingSystemRoles = filePlanRoleService.getRoles(filePlan, true); - assertNotNull(rolesIncludingSystemRoles); - assertTrue(roles.size() != 0); - assertTrue(roles.size() == rolesIncludingSystemRoles.size()); - - Set rolesWithoutSystemRoles = filePlanRoleService.getRoles(filePlan, false); - assertNotNull(rolesWithoutSystemRoles); - assertTrue(rolesWithoutSystemRoles.size() != 0); - assertTrue(rolesIncludingSystemRoles.size() > rolesWithoutSystemRoles.size()); - assertTrue(rolesIncludingSystemRoles.size() == rolesWithoutSystemRoles.size() + FilePlanRoleService.SYSTEM_ROLES.size()); - - return null; - } - }); - } - - public void testRolesByUser() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Set roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); - assertNotNull(roles); - assertEquals(1, roles.size()); - - Set rolesIncludingSystemRoles = filePlanRoleService.getRolesByUser(filePlan, rmUserName, true); - assertNotNull(rolesIncludingSystemRoles); - assertEquals(1, rolesIncludingSystemRoles.size()); - assertEquals(roles.size(), rolesIncludingSystemRoles.size()); - - return null; - } - }); - } - - public void testGetRole() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Role role = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_POWER_USER); - assertNotNull(role); - assertEquals(FilePlanRoleService.ROLE_POWER_USER, role.getName()); - - role = filePlanRoleService.getRole(filePlan, "donkey"); - assertNull(role); - - return null; - } - }); - } - - public void testExistsRole() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - assertTrue(filePlanRoleService.existsRole(filePlan, FilePlanRoleService.ROLE_POWER_USER)); - assertFalse(filePlanRoleService.existsRole(filePlan, "donkey")); - - return null; - } - }); - } - - public void testCreateUpdateDeleteRole() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - assertFalse(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); - - Set caps = new HashSet(2); - caps.add(capabilityService.getCapability(RMPermissionModel.ACCESS_AUDIT)); - caps.add(capabilityService.getCapability(RMPermissionModel.ADD_MODIFY_EVENT_DATES)); - - Role role = filePlanRoleService.createRole(filePlan, "Michelle Holt", "Michelle Holt", caps); - assertNotNull(role); - assertEquals("Michelle Holt", role.getName()); - assertEquals(2, role.getCapabilities().size()); - - assertTrue(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); - - caps.add(capabilityService.getCapability(RMPermissionModel.AUTHORIZE_ALL_TRANSFERS)); - - role = filePlanRoleService.updateRole(filePlan, "Michelle Holt", "Michelle Wetherall", caps); - assertNotNull(role); - assertEquals("Michelle Holt", role.getName()); - assertEquals(3, role.getCapabilities().size()); - - assertTrue(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); - - filePlanRoleService.deleteRole(filePlan, "Michelle Holt"); - - assertFalse(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); - - return null; - } - }); - } - - /** - * {@link FilePlanRoleService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, String, String)} - * {@link FilePlanRoleService#getAuthorities(org.alfresco.service.cmr.repository.NodeRef, String) - */ - public void testAuthorityAssignment() throws Exception - { - doTestInTransaction(new Test() - { - public Void run() - { - Set roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); - assertNotNull(roles); - assertEquals(1, roles.size()); - - Set authorities = filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(1, authorities.size()); - - authorities = filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(0, authorities.size()); - - authorities = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(1, authorities.size()); - - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, rmUserName); - - roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); - assertNotNull(roles); - assertEquals(2, roles.size()); - - authorities = filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(2, authorities.size()); - - authorities = filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(0, authorities.size()); - - authorities = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); - assertNotNull(authorities); - assertEquals(2, authorities.size()); - - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +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.test.util.BaseRMTestCase; + +/** + * File plan role service unit test + * + * @author Roy Wetherall + * @since 2.1 + */ +public class FilePlanRoleServiceImplTest extends BaseRMTestCase +{ + @Override + protected boolean isUserTest() + { + return true; + } + + public void testGetAllRolesContainerGroup() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + String allRolesGroup = filePlanRoleService.getAllRolesContainerGroup(filePlan); + assertNotNull(allRolesGroup); + + return null; + } + }); + } + + public void testGetRoles() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + Set roles = filePlanRoleService.getRoles(filePlan); + assertNotNull(roles); + assertTrue(roles.size() != 0); + + Set rolesIncludingSystemRoles = filePlanRoleService.getRoles(filePlan, true); + assertNotNull(rolesIncludingSystemRoles); + assertTrue(roles.size() != 0); + assertTrue(roles.size() == rolesIncludingSystemRoles.size()); + + Set rolesWithoutSystemRoles = filePlanRoleService.getRoles(filePlan, false); + assertNotNull(rolesWithoutSystemRoles); + assertTrue(rolesWithoutSystemRoles.size() != 0); + assertTrue(rolesIncludingSystemRoles.size() > rolesWithoutSystemRoles.size()); + assertTrue(rolesIncludingSystemRoles.size() == rolesWithoutSystemRoles.size() + FilePlanRoleService.SYSTEM_ROLES.size()); + + return null; + } + }); + } + + public void testRolesByUser() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + Set roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); + assertNotNull(roles); + assertEquals(1, roles.size()); + + Set rolesIncludingSystemRoles = filePlanRoleService.getRolesByUser(filePlan, rmUserName, true); + assertNotNull(rolesIncludingSystemRoles); + assertEquals(1, rolesIncludingSystemRoles.size()); + assertEquals(roles.size(), rolesIncludingSystemRoles.size()); + + return null; + } + }); + } + + public void testGetRole() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + Role role = filePlanRoleService.getRole(filePlan, FilePlanRoleService.ROLE_POWER_USER); + assertNotNull(role); + assertEquals(FilePlanRoleService.ROLE_POWER_USER, role.getName()); + + role = filePlanRoleService.getRole(filePlan, "donkey"); + assertNull(role); + + return null; + } + }); + } + + public void testExistsRole() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + assertTrue(filePlanRoleService.existsRole(filePlan, FilePlanRoleService.ROLE_POWER_USER)); + assertFalse(filePlanRoleService.existsRole(filePlan, "donkey")); + + return null; + } + }); + } + + public void testCreateUpdateDeleteRole() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + assertFalse(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); + + Set caps = new HashSet(2); + caps.add(capabilityService.getCapability(RMPermissionModel.ACCESS_AUDIT)); + caps.add(capabilityService.getCapability(RMPermissionModel.ADD_MODIFY_EVENT_DATES)); + + Role role = filePlanRoleService.createRole(filePlan, "Michelle Holt", "Michelle Holt", caps); + assertNotNull(role); + assertEquals("Michelle Holt", role.getName()); + assertEquals(2, role.getCapabilities().size()); + + assertTrue(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); + + caps.add(capabilityService.getCapability(RMPermissionModel.AUTHORIZE_ALL_TRANSFERS)); + + role = filePlanRoleService.updateRole(filePlan, "Michelle Holt", "Michelle Wetherall", caps); + assertNotNull(role); + assertEquals("Michelle Holt", role.getName()); + assertEquals(3, role.getCapabilities().size()); + + assertTrue(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); + + filePlanRoleService.deleteRole(filePlan, "Michelle Holt"); + + assertFalse(filePlanRoleService.existsRole(filePlan, "Michelle Holt")); + + return null; + } + }); + } + + /** + * {@link FilePlanRoleService#assignRoleToAuthority(org.alfresco.service.cmr.repository.NodeRef, String, String)} + * {@link FilePlanRoleService#getAuthorities(org.alfresco.service.cmr.repository.NodeRef, String) + */ + public void testAuthorityAssignment() throws Exception + { + doTestInTransaction(new Test() + { + public Void run() + { + Set roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); + assertNotNull(roles); + assertEquals(1, roles.size()); + + Set authorities = filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); + assertNotNull(authorities); + assertEquals(1, authorities.size()); + + authorities = filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); + assertNotNull(authorities); + assertEquals(0, authorities.size()); + + authorities = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); + assertNotNull(authorities); + assertEquals(1, authorities.size()); + + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, rmUserName); + + roles = filePlanRoleService.getRolesByUser(filePlan, rmUserName); + assertNotNull(roles); + assertEquals(2, roles.size()); + + authorities = filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); + assertNotNull(authorities); + assertEquals(2, authorities.size()); + + authorities = filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); + assertNotNull(authorities); + assertEquals(0, authorities.size()); + + authorities = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER); + assertNotNull(authorities); + assertEquals(2, authorities.size()); + + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanServiceImplTest.java index beb8d379d2..32df166180 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FilePlanServiceImplTest.java @@ -1,546 +1,546 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * File plan service unit test - * - * @author Roy Wetherall - * @since 2.1 - */ -public class FilePlanServiceImplTest extends BaseRMTestCase -{ - /** - * Pull in collaboration test data - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * {@link FilePlanService#isFilePlan(org.alfresco.service.cmr.repository.NodeRef)} - */ - public void testIsFilePlan() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - assertTrue(filePlanService.isFilePlan(filePlan)); - assertFalse(filePlanService.isFilePlan(rmContainer)); - assertFalse(filePlanService.isFilePlan(dmDocument)); - } - }); - } - - /** - * {@link FilePlanService#getFilePlan(org.alfresco.service.cmr.repository.NodeRef)} - */ - public void testGetFilePlans() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - assertEquals(filePlan, filePlanService.getFilePlan(filePlan)); - assertEquals(filePlan, filePlanService.getFilePlan(rmContainer)); - assertEquals(filePlan, filePlanService.getFilePlan(rmFolder)); - assertNull(filePlanService.getFilePlan(dmDocument)); - } - }); - } - - /** - * {@link FilePlanService#getFilePlanBySiteId(String)} - */ - public void testGetFilePlanBySiteId() - { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - assertEquals(filePlan, filePlanService.getFilePlanBySiteId(siteId)); - assertNull(filePlanService.getFilePlanBySiteId("rubbish")); - - String siteId = GUID.generate(); - siteService.createSite("anything", siteId, "title", "descrition", SiteVisibility.PUBLIC); - assertNull(filePlanService.getFilePlanBySiteId(siteId)); - } - }); - - } - - /** - * @see FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testIsFilePlanComponent() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertTrue("The rm root container should be a rm component", filePlanService.isFilePlanComponent(filePlan)); - assertTrue("The rm container should be a rm component", filePlanService.isFilePlanComponent(rmContainer)); - assertTrue("The rm folder should be a rm component", filePlanService.isFilePlanComponent(rmFolder)); - - return null; - } - }); - } - - /** - * @see FilePlanService#getFilePlanComponentKind(NodeRef) - */ - public void testGetFilePlanComponentKind() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return utils.createRecord(rmFolder, "testRecord.txt"); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); - assertEquals(FilePlanComponentKind.RECORD_CATEGORY, filePlanService.getFilePlanComponentKind(rmContainer)); - assertEquals(FilePlanComponentKind.RECORD_FOLDER, filePlanService.getFilePlanComponentKind(rmFolder)); - assertEquals(FilePlanComponentKind.RECORD, filePlanService.getFilePlanComponentKind(result)); - // TODO HOLD and TRANSFER - assertNull(filePlanService.getFilePlanComponentKind(folder)); - } - }); - } - - /** - * @see FilePlanService#isRecordCategory(NodeRef) - */ - public void testIsRecordCategory() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertFalse("This should not be a record category.", filePlanService.isRecordCategory(filePlan)); - assertTrue("This is a record category.", filePlanService.isRecordCategory(rmContainer)); - assertFalse("This should not be a record category.", filePlanService.isRecordCategory(rmFolder)); - - return null; - } - }); - } - - /** - * @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String) - * @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String, org.alfresco.service.namespace.QName) - */ - public void testCreateFilePlan() throws Exception - { - // Create default type of root - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createFilePlan(folder, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management root", result); - basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); - } - }); - - // Create specific type of root - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createFilePlan(folder, id, TYPE_FILE_PLAN); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management root", result); - basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); - } - }); - - // Failure: creating root in existing hierarchy - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createFilePlan(rmContainer, GUID.generate()); - } - }); - - // Failure: type no extended from root container - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createFilePlan(folder, GUID.generate(), TYPE_FOLDER); - } - }); - } - - /** - * A basic test of a records management container - * - * @param nodeRef node reference - * @param name name of the container - * @param type the type of container - */ - private void basicRMContainerCheck(NodeRef nodeRef, String name, QName type) - { - // Check the basic details - assertEquals(name, nodeService.getProperty(nodeRef, PROP_NAME)); - assertNotNull("RM id has not been set", nodeService.getProperty(nodeRef, PROP_IDENTIFIER)); - assertEquals(type, nodeService.getType(nodeRef)); - } - - /** - * @see FilePlanService#createRecordCategory(NodeRef, String) - * @see FilePlanService#createRecordCategory(NodeRef, String, org.alfresco.service.namespace.QName) - */ - public void testCreateRecordCategory() throws Exception - { - // Create container (in root) - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createRecordCategory(filePlan, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management container", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); - } - }); - - // Create container (in container) - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createRecordCategory(rmContainer, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management container", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); - } - }); - - // TODO need a custom type of container! - // Create container of a given type -// doTestInTransaction(new Test() -// { -// @Override -// public NodeRef run() -// { -// String id = setString("id", GUID.generate()); -// return rmService.createRecordCategory(filePlan, id, TYPE_RECORD_SERIES); -// } -// -// @Override -// public void test(NodeRef result) -// { -// assertNotNull("Unable to create records management container", result); -// basicRMContainerCheck(result, getString("id"), TYPE_RECORD_SERIES); -// } -// }); - - // Fail Test: parent is not a container - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createRecordCategory(folder, GUID.generate()); - } - }); - - // Fail Test: type is not a sub-type of rm:recordsManagementContainer - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createRecordCategory(filePlan, GUID.generate(), TYPE_FOLDER); - } - }); - } - - /** - * @see FilePlanService#getAllContained(NodeRef) - * @see FilePlanService#getAllContained(NodeRef, boolean) - */ - public void testGetAllContained() throws Exception - { - // Get all contained test - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getAllContained(rmContainer); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getAllContained(rmContainer, false); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getAllContained(rmContainer, true); - assertNotNull(nodes); - assertEquals(4, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); - assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); - - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getAllContained(rmFolder); - } - }); - } - - /** - * @see FilePlanService#getContainedRecordCategories(NodeRef) - * @see FilePlanService#getContainedRecordCategories(NodeRef, boolean) - */ - public void testGetContainedRecordCategories() throws Exception - { - // Test getting all contained containers - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getContainedRecordCategories(rmContainer); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - - nodes = filePlanService.getContainedRecordCategories(rmContainer, false); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - - nodes = filePlanService.getContainedRecordCategories(rmContainer, true); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getContainedRecordCategories(rmFolder); - } - }); - } - - /** - * @see FilePlanService#getContainedRecordFolders(NodeRef) - * @see FilePlanService#getContainedRecordFolders(NodeRef, boolean) - */ - public void testGetContainedRecordFolders() throws Exception - { - // Test getting all contained record folders - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getContainedRecordFolders(rmContainer); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getContainedRecordFolders(rmContainer, false); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getContainedRecordFolders(rmContainer, true); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getContainedRecordFolders(rmFolder); - } - }); - } - - /** - * Test to create a simple multi-hierarchy record taxonomy - */ - public void testCreateSimpleHierarchy() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Create 3 level hierarchy - NodeRef levelOne = setNodeRef("container1", filePlanService.createRecordCategory(filePlan, "container1")); - assertNotNull("Unable to create container", levelOne); - NodeRef levelTwo = setNodeRef("container2", filePlanService.createRecordCategory(levelOne, "container2")); - assertNotNull("Unable to create container", levelTwo); - NodeRef levelThree = setNodeRef("container3", filePlanService.createRecordCategory(levelTwo, "container3")); - assertNotNull("Unable to create container", levelThree); - NodeRef levelThreeRecordFolder = setNodeRef("recordFolder3", recordFolderService.createRecordFolder(levelThree, "recordFolder3")); - assertNotNull("Unable to create record folder", levelThreeRecordFolder); - - return null; - } - - @Override - public void test(Void result) - { - // Test that the hierarchy has been created correctly - basicRMContainerCheck(getNodeRef("container1"), "container1", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("container2"), "container2", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("container3"), "container3", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("recordFolder3"), "recordFolder3", TYPE_RECORD_FOLDER); - - // TODO need to check that the parents and children can be retrieved correctly - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * File plan service unit test + * + * @author Roy Wetherall + * @since 2.1 + */ +public class FilePlanServiceImplTest extends BaseRMTestCase +{ + /** + * Pull in collaboration test data + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** + * {@link FilePlanService#isFilePlan(org.alfresco.service.cmr.repository.NodeRef)} + */ + public void testIsFilePlan() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + assertTrue(filePlanService.isFilePlan(filePlan)); + assertFalse(filePlanService.isFilePlan(rmContainer)); + assertFalse(filePlanService.isFilePlan(dmDocument)); + } + }); + } + + /** + * {@link FilePlanService#getFilePlan(org.alfresco.service.cmr.repository.NodeRef)} + */ + public void testGetFilePlans() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + assertEquals(filePlan, filePlanService.getFilePlan(filePlan)); + assertEquals(filePlan, filePlanService.getFilePlan(rmContainer)); + assertEquals(filePlan, filePlanService.getFilePlan(rmFolder)); + assertNull(filePlanService.getFilePlan(dmDocument)); + } + }); + } + + /** + * {@link FilePlanService#getFilePlanBySiteId(String)} + */ + public void testGetFilePlanBySiteId() + { + doTestInTransaction(new VoidTest() + { + public void runImpl() throws Exception + { + assertEquals(filePlan, filePlanService.getFilePlanBySiteId(siteId)); + assertNull(filePlanService.getFilePlanBySiteId("rubbish")); + + String siteId = GUID.generate(); + siteService.createSite("anything", siteId, "title", "descrition", SiteVisibility.PUBLIC); + assertNull(filePlanService.getFilePlanBySiteId(siteId)); + } + }); + + } + + /** + * @see FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef) + */ + public void testIsFilePlanComponent() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + assertTrue("The rm root container should be a rm component", filePlanService.isFilePlanComponent(filePlan)); + assertTrue("The rm container should be a rm component", filePlanService.isFilePlanComponent(rmContainer)); + assertTrue("The rm folder should be a rm component", filePlanService.isFilePlanComponent(rmFolder)); + + return null; + } + }); + } + + /** + * @see FilePlanService#getFilePlanComponentKind(NodeRef) + */ + public void testGetFilePlanComponentKind() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + return utils.createRecord(rmFolder, "testRecord.txt"); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); + assertEquals(FilePlanComponentKind.RECORD_CATEGORY, filePlanService.getFilePlanComponentKind(rmContainer)); + assertEquals(FilePlanComponentKind.RECORD_FOLDER, filePlanService.getFilePlanComponentKind(rmFolder)); + assertEquals(FilePlanComponentKind.RECORD, filePlanService.getFilePlanComponentKind(result)); + // TODO HOLD and TRANSFER + assertNull(filePlanService.getFilePlanComponentKind(folder)); + } + }); + } + + /** + * @see FilePlanService#isRecordCategory(NodeRef) + */ + public void testIsRecordCategory() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + assertFalse("This should not be a record category.", filePlanService.isRecordCategory(filePlan)); + assertTrue("This is a record category.", filePlanService.isRecordCategory(rmContainer)); + assertFalse("This should not be a record category.", filePlanService.isRecordCategory(rmFolder)); + + return null; + } + }); + } + + /** + * @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String) + * @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String, org.alfresco.service.namespace.QName) + */ + public void testCreateFilePlan() throws Exception + { + // Create default type of root + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return filePlanService.createFilePlan(folder, id); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create records management root", result); + basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); + } + }); + + // Create specific type of root + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return filePlanService.createFilePlan(folder, id, TYPE_FILE_PLAN); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create records management root", result); + basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); + } + }); + + // Failure: creating root in existing hierarchy + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.createFilePlan(rmContainer, GUID.generate()); + } + }); + + // Failure: type no extended from root container + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.createFilePlan(folder, GUID.generate(), TYPE_FOLDER); + } + }); + } + + /** + * A basic test of a records management container + * + * @param nodeRef node reference + * @param name name of the container + * @param type the type of container + */ + private void basicRMContainerCheck(NodeRef nodeRef, String name, QName type) + { + // Check the basic details + assertEquals(name, nodeService.getProperty(nodeRef, PROP_NAME)); + assertNotNull("RM id has not been set", nodeService.getProperty(nodeRef, PROP_IDENTIFIER)); + assertEquals(type, nodeService.getType(nodeRef)); + } + + /** + * @see FilePlanService#createRecordCategory(NodeRef, String) + * @see FilePlanService#createRecordCategory(NodeRef, String, org.alfresco.service.namespace.QName) + */ + public void testCreateRecordCategory() throws Exception + { + // Create container (in root) + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return filePlanService.createRecordCategory(filePlan, id); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create records management container", result); + basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); + } + }); + + // Create container (in container) + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return filePlanService.createRecordCategory(rmContainer, id); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create records management container", result); + basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); + } + }); + + // TODO need a custom type of container! + // Create container of a given type +// doTestInTransaction(new Test() +// { +// @Override +// public NodeRef run() +// { +// String id = setString("id", GUID.generate()); +// return rmService.createRecordCategory(filePlan, id, TYPE_RECORD_SERIES); +// } +// +// @Override +// public void test(NodeRef result) +// { +// assertNotNull("Unable to create records management container", result); +// basicRMContainerCheck(result, getString("id"), TYPE_RECORD_SERIES); +// } +// }); + + // Fail Test: parent is not a container + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.createRecordCategory(folder, GUID.generate()); + } + }); + + // Fail Test: type is not a sub-type of rm:recordsManagementContainer + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.createRecordCategory(filePlan, GUID.generate(), TYPE_FOLDER); + } + }); + } + + /** + * @see FilePlanService#getAllContained(NodeRef) + * @see FilePlanService#getAllContained(NodeRef, boolean) + */ + public void testGetAllContained() throws Exception + { + // Get all contained test + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Add to the test data + NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); + NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); + NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); + + // Put in model + setNodeRef("series", series); + setNodeRef("seriesChildFolder", seriesChildFolder); + setNodeRef("seriesChildContainer", seriesChildContainer); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + List nodes = filePlanService.getAllContained(rmContainer); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + assertTrue(nodes.contains(rmFolder)); + + nodes = filePlanService.getAllContained(rmContainer, false); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + assertTrue(nodes.contains(rmFolder)); + + nodes = filePlanService.getAllContained(rmContainer, true); + assertNotNull(nodes); + assertEquals(4, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + assertTrue(nodes.contains(rmFolder)); + assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); + assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); + + } + }); + + // Failure: call on record folder + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.getAllContained(rmFolder); + } + }); + } + + /** + * @see FilePlanService#getContainedRecordCategories(NodeRef) + * @see FilePlanService#getContainedRecordCategories(NodeRef, boolean) + */ + public void testGetContainedRecordCategories() throws Exception + { + // Test getting all contained containers + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Add to the test data + NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); + NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); + NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); + + // Put in model + setNodeRef("series", series); + setNodeRef("seriesChildFolder", seriesChildFolder); + setNodeRef("seriesChildContainer", seriesChildContainer); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + List nodes = filePlanService.getContainedRecordCategories(rmContainer); + assertNotNull(nodes); + assertEquals(1, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + + nodes = filePlanService.getContainedRecordCategories(rmContainer, false); + assertNotNull(nodes); + assertEquals(1, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + + nodes = filePlanService.getContainedRecordCategories(rmContainer, true); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); + } + }); + + // Failure: call on record folder + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.getContainedRecordCategories(rmFolder); + } + }); + } + + /** + * @see FilePlanService#getContainedRecordFolders(NodeRef) + * @see FilePlanService#getContainedRecordFolders(NodeRef, boolean) + */ + public void testGetContainedRecordFolders() throws Exception + { + // Test getting all contained record folders + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Add to the test data + NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); + NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); + NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); + + // Put in model + setNodeRef("series", series); + setNodeRef("seriesChildFolder", seriesChildFolder); + setNodeRef("seriesChildContainer", seriesChildContainer); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + List nodes = filePlanService.getContainedRecordFolders(rmContainer); + assertNotNull(nodes); + assertEquals(1, nodes.size()); + assertTrue(nodes.contains(rmFolder)); + + nodes = filePlanService.getContainedRecordFolders(rmContainer, false); + assertNotNull(nodes); + assertEquals(1, nodes.size()); + assertTrue(nodes.contains(rmFolder)); + + nodes = filePlanService.getContainedRecordFolders(rmContainer, true); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertTrue(nodes.contains(rmFolder)); + assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); + } + }); + + // Failure: call on record folder + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.getContainedRecordFolders(rmFolder); + } + }); + } + + /** + * Test to create a simple multi-hierarchy record taxonomy + */ + public void testCreateSimpleHierarchy() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Create 3 level hierarchy + NodeRef levelOne = setNodeRef("container1", filePlanService.createRecordCategory(filePlan, "container1")); + assertNotNull("Unable to create container", levelOne); + NodeRef levelTwo = setNodeRef("container2", filePlanService.createRecordCategory(levelOne, "container2")); + assertNotNull("Unable to create container", levelTwo); + NodeRef levelThree = setNodeRef("container3", filePlanService.createRecordCategory(levelTwo, "container3")); + assertNotNull("Unable to create container", levelThree); + NodeRef levelThreeRecordFolder = setNodeRef("recordFolder3", recordFolderService.createRecordFolder(levelThree, "recordFolder3")); + assertNotNull("Unable to create record folder", levelThreeRecordFolder); + + return null; + } + + @Override + public void test(Void result) + { + // Test that the hierarchy has been created correctly + basicRMContainerCheck(getNodeRef("container1"), "container1", TYPE_RECORD_CATEGORY); + basicRMContainerCheck(getNodeRef("container2"), "container2", TYPE_RECORD_CATEGORY); + basicRMContainerCheck(getNodeRef("container3"), "container3", TYPE_RECORD_CATEGORY); + basicRMContainerCheck(getNodeRef("recordFolder3"), "recordFolder3", TYPE_RECORD_FOLDER); + + // TODO need to check that the parents and children can be retrieved correctly + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FreezeServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FreezeServiceImplTest.java index 72eb2e204d..a1af1ce308 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FreezeServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/FreezeServiceImplTest.java @@ -1,245 +1,245 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Freeze service implementation test. - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class FreezeServiceImplTest extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Test freeze service methods. - * - * @deprecated as of 2.2 - */ - public void testFreezeService() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertTrue(recordService.isRecord(recordOne)); - assertTrue(recordService.isRecord(recordTwo)); - assertTrue(recordService.isRecord(recordThree)); - assertTrue(recordService.isRecord(recordFour)); - assertTrue(filePlanService.isFilePlanComponent(recordOne)); - assertTrue(filePlanService.isFilePlanComponent(recordTwo)); - assertTrue(filePlanService.isFilePlanComponent(recordThree)); - assertTrue(filePlanService.isFilePlanComponent(recordFour)); - - // Freeze a record - NodeRef hold101 = holdService.createHold(filePlan, "freezename 101", "FreezeReason", null); - assertNotNull(hold101); - holdService.addToHold(hold101, recordOne); - //assertTrue(freezeService.hasFrozenChildren(rmFolder)); - - // Check the hold exists - List holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(1, holdAssocs.size()); - NodeRef holdNodeRef = holdAssocs.iterator().next(); - assertEquals(holdNodeRef, hold101); - assertTrue(holdService.isHold(holdNodeRef)); - assertEquals("FreezeReason", holdService.getHoldReason(holdNodeRef)); - List frozenNodes = holdService.getHeld(holdNodeRef); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - - // Check the nodes are frozen - assertTrue(freezeService.isFrozen(recordOne)); - assertNotNull(freezeService.getFreezeDate(recordOne)); - assertNotNull(freezeService.getFreezeInitiator(recordOne)); - assertFalse(freezeService.isFrozen(recordTwo)); - assertFalse(freezeService.isFrozen(recordThree)); - - // Update the freeze reason - holdService.setHoldReason(holdNodeRef, "NewFreezeReason"); - - // Check the hold has been updated - assertEquals("NewFreezeReason", holdService.getHoldReason(holdNodeRef)); - - // Freeze a number of records - List records = new ArrayList(); - records.add(recordOne); - records.add(recordTwo); - records.add(recordThree); - NodeRef newHold = holdService.createHold(filePlan, "Hold 102", "Freeze a set of nodes", null); - holdService.addToHold(newHold, records); - assertNotNull(newHold); - assertTrue(holdService.isHold(newHold)); - - // Check the holds exist - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(2, holdAssocs.size()); - for (NodeRef hold : holdAssocs) - { - String reason = holdService.getHoldReason(hold); - if (reason.equals("Freeze a set of nodes")) - { - assertEquals(newHold, hold); - frozenNodes = holdService.getHeld(hold); - assertNotNull(frozenNodes); - assertEquals(3, frozenNodes.size()); - } - else if (reason.equals("NewFreezeReason")) - { - frozenNodes = holdService.getHeld(hold); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - } - else - { - throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds."); - } - } - - // Check the nodes are frozen - final List testRecords = Arrays.asList(new NodeRef[]{recordOne, recordTwo, recordThree}); - for (NodeRef nr : testRecords) - { - assertTrue(freezeService.isFrozen(nr)); - assertNotNull(freezeService.getFreezeDate(nr)); - assertNotNull(freezeService.getFreezeInitiator(nr)); - } - - // Unfreeze a node - holdService.removeFromAllHolds(recordThree); - - // Check the holds - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(2, holdAssocs.size()); - for (NodeRef hold : holdAssocs) - { - String reason = holdService.getHoldReason(hold); - if (reason.equals("Freeze a set of nodes")) - { - frozenNodes = holdService.getHeld(hold); - assertNotNull(frozenNodes); - assertEquals(2, frozenNodes.size()); - } - else if (reason.equals("NewFreezeReason")) - { - frozenNodes = holdService.getHeld(hold); - assertNotNull(frozenNodes); - assertEquals(1, frozenNodes.size()); - } - else - { - throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds."); - } - } - - // Check the nodes are frozen - assertTrue(freezeService.isFrozen(recordOne)); - assertNotNull(freezeService.getFreezeDate(recordOne)); - assertNotNull(freezeService.getFreezeInitiator(recordOne)); - assertTrue(freezeService.isFrozen(recordTwo)); - assertNotNull(freezeService.getFreezeDate(recordTwo)); - assertNotNull(freezeService.getFreezeInitiator(recordTwo)); - assertFalse(freezeService.isFrozen(recordThree)); - assertFalse(freezeService.isFrozen(recordFour)); - - // Relinquish the first hold - holdNodeRef = holdAssocs.iterator().next(); - holdService.deleteHold(holdNodeRef); - - // Check the existing hold - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(1, holdAssocs.size()); - - // Relinquish the second hold - holdNodeRef = holdAssocs.iterator().next(); - holdService.removeFromAllHolds(holdService.getHeld(holdNodeRef)); - - // hold is not automatically removed - holdAssocs = holdService.getHolds(filePlan); - assertEquals(1, holdAssocs.size()); - - // delete hold - holdService.deleteHold(holdNodeRef); - holdAssocs = holdService.getHolds(filePlan); - assertEquals(0, holdAssocs.size()); - - // Check the nodes are unfrozen - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordTwo)); - assertFalse(freezeService.isFrozen(recordThree)); - assertFalse(freezeService.isFrozen(recordFour)); - //assertFalse(freezeService.hasFrozenChildren(rmFolder)); - - // Test freezing nodes, adding them to an existing hold - NodeRef hold = holdService.createHold(filePlan, "hold 1", "AnotherFreezeReason", "description"); - holdService.addToHold(hold, recordFour); - holdService.addToHold(hold, recordOne); - List nodes = new ArrayList(); - nodes.add(recordTwo); - nodes.add(recordThree); - holdService.addToHold(hold, nodes); - //assertTrue(freezeService.hasFrozenChildren(rmFolder)); - - // Check the hold - holdAssocs = holdService.getHolds(filePlan); - assertNotNull(holdAssocs); - assertEquals(1, holdAssocs.size()); - - // Relinquish the first hold - holdService.deleteHold(holdAssocs.iterator().next()); - - // Check the nodes are unfrozen - assertFalse(freezeService.isFrozen(recordOne)); - assertFalse(freezeService.isFrozen(recordTwo)); - assertFalse(freezeService.isFrozen(recordThree)); - assertFalse(freezeService.isFrozen(recordFour)); - // assertFalse(freezeService.hasFrozenChildren(rmFolder)); - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Freeze service implementation test. + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class FreezeServiceImplTest extends BaseRMTestCase +{ + @Override + protected boolean isRecordTest() + { + return true; + } + + /** + * Test freeze service methods. + * + * @deprecated as of 2.2 + */ + public void testFreezeService() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + assertTrue(recordService.isRecord(recordOne)); + assertTrue(recordService.isRecord(recordTwo)); + assertTrue(recordService.isRecord(recordThree)); + assertTrue(recordService.isRecord(recordFour)); + assertTrue(filePlanService.isFilePlanComponent(recordOne)); + assertTrue(filePlanService.isFilePlanComponent(recordTwo)); + assertTrue(filePlanService.isFilePlanComponent(recordThree)); + assertTrue(filePlanService.isFilePlanComponent(recordFour)); + + // Freeze a record + NodeRef hold101 = holdService.createHold(filePlan, "freezename 101", "FreezeReason", null); + assertNotNull(hold101); + holdService.addToHold(hold101, recordOne); + //assertTrue(freezeService.hasFrozenChildren(rmFolder)); + + // Check the hold exists + List holdAssocs = holdService.getHolds(filePlan); + assertNotNull(holdAssocs); + assertEquals(1, holdAssocs.size()); + NodeRef holdNodeRef = holdAssocs.iterator().next(); + assertEquals(holdNodeRef, hold101); + assertTrue(holdService.isHold(holdNodeRef)); + assertEquals("FreezeReason", holdService.getHoldReason(holdNodeRef)); + List frozenNodes = holdService.getHeld(holdNodeRef); + assertNotNull(frozenNodes); + assertEquals(1, frozenNodes.size()); + + // Check the nodes are frozen + assertTrue(freezeService.isFrozen(recordOne)); + assertNotNull(freezeService.getFreezeDate(recordOne)); + assertNotNull(freezeService.getFreezeInitiator(recordOne)); + assertFalse(freezeService.isFrozen(recordTwo)); + assertFalse(freezeService.isFrozen(recordThree)); + + // Update the freeze reason + holdService.setHoldReason(holdNodeRef, "NewFreezeReason"); + + // Check the hold has been updated + assertEquals("NewFreezeReason", holdService.getHoldReason(holdNodeRef)); + + // Freeze a number of records + List records = new ArrayList(); + records.add(recordOne); + records.add(recordTwo); + records.add(recordThree); + NodeRef newHold = holdService.createHold(filePlan, "Hold 102", "Freeze a set of nodes", null); + holdService.addToHold(newHold, records); + assertNotNull(newHold); + assertTrue(holdService.isHold(newHold)); + + // Check the holds exist + holdAssocs = holdService.getHolds(filePlan); + assertNotNull(holdAssocs); + assertEquals(2, holdAssocs.size()); + for (NodeRef hold : holdAssocs) + { + String reason = holdService.getHoldReason(hold); + if (reason.equals("Freeze a set of nodes")) + { + assertEquals(newHold, hold); + frozenNodes = holdService.getHeld(hold); + assertNotNull(frozenNodes); + assertEquals(3, frozenNodes.size()); + } + else if (reason.equals("NewFreezeReason")) + { + frozenNodes = holdService.getHeld(hold); + assertNotNull(frozenNodes); + assertEquals(1, frozenNodes.size()); + } + else + { + throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds."); + } + } + + // Check the nodes are frozen + final List testRecords = Arrays.asList(new NodeRef[]{recordOne, recordTwo, recordThree}); + for (NodeRef nr : testRecords) + { + assertTrue(freezeService.isFrozen(nr)); + assertNotNull(freezeService.getFreezeDate(nr)); + assertNotNull(freezeService.getFreezeInitiator(nr)); + } + + // Unfreeze a node + holdService.removeFromAllHolds(recordThree); + + // Check the holds + holdAssocs = holdService.getHolds(filePlan); + assertNotNull(holdAssocs); + assertEquals(2, holdAssocs.size()); + for (NodeRef hold : holdAssocs) + { + String reason = holdService.getHoldReason(hold); + if (reason.equals("Freeze a set of nodes")) + { + frozenNodes = holdService.getHeld(hold); + assertNotNull(frozenNodes); + assertEquals(2, frozenNodes.size()); + } + else if (reason.equals("NewFreezeReason")) + { + frozenNodes = holdService.getHeld(hold); + assertNotNull(frozenNodes); + assertEquals(1, frozenNodes.size()); + } + else + { + throw new AlfrescoRuntimeException("The reason '" + reason + "' was not found in the existing holds."); + } + } + + // Check the nodes are frozen + assertTrue(freezeService.isFrozen(recordOne)); + assertNotNull(freezeService.getFreezeDate(recordOne)); + assertNotNull(freezeService.getFreezeInitiator(recordOne)); + assertTrue(freezeService.isFrozen(recordTwo)); + assertNotNull(freezeService.getFreezeDate(recordTwo)); + assertNotNull(freezeService.getFreezeInitiator(recordTwo)); + assertFalse(freezeService.isFrozen(recordThree)); + assertFalse(freezeService.isFrozen(recordFour)); + + // Relinquish the first hold + holdNodeRef = holdAssocs.iterator().next(); + holdService.deleteHold(holdNodeRef); + + // Check the existing hold + holdAssocs = holdService.getHolds(filePlan); + assertNotNull(holdAssocs); + assertEquals(1, holdAssocs.size()); + + // Relinquish the second hold + holdNodeRef = holdAssocs.iterator().next(); + holdService.removeFromAllHolds(holdService.getHeld(holdNodeRef)); + + // hold is not automatically removed + holdAssocs = holdService.getHolds(filePlan); + assertEquals(1, holdAssocs.size()); + + // delete hold + holdService.deleteHold(holdNodeRef); + holdAssocs = holdService.getHolds(filePlan); + assertEquals(0, holdAssocs.size()); + + // Check the nodes are unfrozen + assertFalse(freezeService.isFrozen(recordOne)); + assertFalse(freezeService.isFrozen(recordTwo)); + assertFalse(freezeService.isFrozen(recordThree)); + assertFalse(freezeService.isFrozen(recordFour)); + //assertFalse(freezeService.hasFrozenChildren(rmFolder)); + + // Test freezing nodes, adding them to an existing hold + NodeRef hold = holdService.createHold(filePlan, "hold 1", "AnotherFreezeReason", "description"); + holdService.addToHold(hold, recordFour); + holdService.addToHold(hold, recordOne); + List nodes = new ArrayList(); + nodes.add(recordTwo); + nodes.add(recordThree); + holdService.addToHold(hold, nodes); + //assertTrue(freezeService.hasFrozenChildren(rmFolder)); + + // Check the hold + holdAssocs = holdService.getHolds(filePlan); + assertNotNull(holdAssocs); + assertEquals(1, holdAssocs.size()); + + // Relinquish the first hold + holdService.deleteHold(holdAssocs.iterator().next()); + + // Check the nodes are unfrozen + assertFalse(freezeService.isFrozen(recordOne)); + assertFalse(freezeService.isFrozen(recordTwo)); + assertFalse(freezeService.isFrozen(recordThree)); + assertFalse(freezeService.isFrozen(recordFour)); + // assertFalse(freezeService.hasFrozenChildren(rmFolder)); + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ModelSecurityServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ModelSecurityServiceImplTest.java index f485e7f4f8..45422569d9 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ModelSecurityServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ModelSecurityServiceImplTest.java @@ -1,278 +1,278 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelAccessDeniedException; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedAspect; -import org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedProperty; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.namespace.QName; - -/** - * Model security service test. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class ModelSecurityServiceImplTest extends BaseRMTestCase -{ - private static final QName CUSTOM_ASPECT = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customAspect"); - private static final QName CUSTOM_PROTECTED_ASPECT = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProtectedAspect"); - - private static final QName CUSTOM_PROPERTY = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProperty"); - private static final QName CUSTOM_PROTECTED_PROPERTY = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProtectedProperty"); - - - /** Model security service */ - private ModelSecurityService modelSecurityService; - - private boolean enabled; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isFillingForAllUsers() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - modelSecurityService = (ModelSecurityService)applicationContext.getBean("ModelSecurityService"); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestDataImpl() - */ - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - enabled = modelSecurityService.isEnabled(); - modelSecurityService.setEnabled(true); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - modelSecurityService.setEnabled(enabled); - } - - /** - * test - getProtectedAspects(), isProtectedAspect(), getProtectedAspect() - */ - public void testProtectedAspects() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - Set protectedAspects = modelSecurityService.getProtectedAspects(); - - assertNotNull(protectedAspects); - assertFalse(protectedAspects.isEmpty()); - assertTrue(protectedAspects.contains(CUSTOM_PROTECTED_ASPECT)); - assertFalse(protectedAspects.contains(CUSTOM_ASPECT)); - - assertTrue(modelSecurityService.isProtectedAspect(CUSTOM_PROTECTED_ASPECT)); - assertFalse(modelSecurityService.isProtectedAspect(CUSTOM_ASPECT)); - - ProtectedAspect protectedAspect = modelSecurityService.getProtectedAspect(CUSTOM_ASPECT); - assertNull(protectedAspect); - protectedAspect = modelSecurityService.getProtectedAspect(CUSTOM_PROTECTED_ASPECT); - assertNotNull(protectedAspect); - assertNotNull(protectedAspect.getQName()); - assertNotNull(protectedAspect.getCapabilities()); - } - }); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.isProtectedAspect(CUSTOM_PROTECTED_ASPECT)); - assertFalse(modelSecurityService.canEditProtectedAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); - } - }, powerUserName); - - doTestInTransaction(new FailureTest - ( - "Normal rm user should not have the permissions to add the protected aspect.", - ModelAccessDeniedException.class - ) - { - @Override - public void run() throws Exception - { - // try and add the aspect - nodeService.addAspect(rmFolder, CUSTOM_PROTECTED_ASPECT, null); - } - }, powerUserName); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.canEditProtectedAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); - - // try and add the aspect - nodeService.addAspect(rmFolder, CUSTOM_PROTECTED_ASPECT, null); - assertTrue(nodeService.hasAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); - } - }, ADMIN_USER); - - // check protected aspect via removeAspect - doTestInTransaction(new FailureTest - ( - "Normal rm user should not have the permissions to remove the custom aspect.", - ModelAccessDeniedException.class - ) - { - @Override - public void run() throws Exception - { - nodeService.removeAspect(rmFolder, CUSTOM_PROTECTED_ASPECT); - } - }, powerUserName); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - nodeService.removeAspect(rmFolder, CUSTOM_PROTECTED_ASPECT); - assertFalse(nodeService.hasAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); - } - }, ADMIN_USER); - } - - /** - * test - getProtectedProperties(), isProtectedProperty(), getProtectedProperty() - */ - public void testProtectedProperties() throws Exception - { - doTestInTransaction(new VoidTest() - { - public void runImpl() - { - Set protectedProperties = modelSecurityService.getProtectedProperties(); - - assertNotNull(protectedProperties); - assertFalse(protectedProperties.isEmpty()); - assertTrue(protectedProperties.contains(CUSTOM_PROTECTED_PROPERTY)); - assertFalse(protectedProperties.contains(CUSTOM_PROPERTY)); - - assertTrue(modelSecurityService.isProtectedProperty(CUSTOM_PROTECTED_PROPERTY)); - assertFalse(modelSecurityService.isProtectedProperty(CUSTOM_PROPERTY)); - - ProtectedProperty protectedProperty = modelSecurityService.getProtectedProperty(CUSTOM_PROPERTY); - assertNull(protectedProperty); - protectedProperty = modelSecurityService.getProtectedProperty(CUSTOM_PROTECTED_PROPERTY); - assertNotNull(protectedProperty); - assertNotNull(protectedProperty.getQName()); - assertNotNull(protectedProperty.getCapabilities()); - } - }); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - } - }, ADMIN_USER); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertFalse(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - } - }, powerUserName); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.isProtectedProperty(CUSTOM_PROTECTED_PROPERTY)); - assertFalse(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - } - }, powerUserName); - - doTestInTransaction(new FailureTest - ( - "Should not have the permissions to edit protected property.", - ModelAccessDeniedException.class - ) - { - @Override - public void run() throws Exception - { - nodeService.setProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY, "hello"); - } - }, powerUserName); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - - nodeService.setProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY, "hello"); - assertEquals("hello", nodeService.getProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); - } - }, ADMIN_USER); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelAccessDeniedException; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; +import org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedAspect; +import org.alfresco.module.org_alfresco_module_rm.model.security.ProtectedProperty; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.namespace.QName; + +/** + * Model security service test. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class ModelSecurityServiceImplTest extends BaseRMTestCase +{ + private static final QName CUSTOM_ASPECT = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customAspect"); + private static final QName CUSTOM_PROTECTED_ASPECT = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProtectedAspect"); + + private static final QName CUSTOM_PROPERTY = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProperty"); + private static final QName CUSTOM_PROTECTED_PROPERTY = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customProtectedProperty"); + + + /** Model security service */ + private ModelSecurityService modelSecurityService; + + private boolean enabled; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + @Override + protected boolean isFillingForAllUsers() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() + */ + @Override + protected void initServices() + { + super.initServices(); + modelSecurityService = (ModelSecurityService)applicationContext.getBean("ModelSecurityService"); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestDataImpl() + */ + @Override + protected void setupTestDataImpl() + { + super.setupTestDataImpl(); + + enabled = modelSecurityService.isEnabled(); + modelSecurityService.setEnabled(true); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() + */ + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + modelSecurityService.setEnabled(enabled); + } + + /** + * test - getProtectedAspects(), isProtectedAspect(), getProtectedAspect() + */ + public void testProtectedAspects() throws Exception + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + Set protectedAspects = modelSecurityService.getProtectedAspects(); + + assertNotNull(protectedAspects); + assertFalse(protectedAspects.isEmpty()); + assertTrue(protectedAspects.contains(CUSTOM_PROTECTED_ASPECT)); + assertFalse(protectedAspects.contains(CUSTOM_ASPECT)); + + assertTrue(modelSecurityService.isProtectedAspect(CUSTOM_PROTECTED_ASPECT)); + assertFalse(modelSecurityService.isProtectedAspect(CUSTOM_ASPECT)); + + ProtectedAspect protectedAspect = modelSecurityService.getProtectedAspect(CUSTOM_ASPECT); + assertNull(protectedAspect); + protectedAspect = modelSecurityService.getProtectedAspect(CUSTOM_PROTECTED_ASPECT); + assertNotNull(protectedAspect); + assertNotNull(protectedAspect.getQName()); + assertNotNull(protectedAspect.getCapabilities()); + } + }); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertTrue(modelSecurityService.isProtectedAspect(CUSTOM_PROTECTED_ASPECT)); + assertFalse(modelSecurityService.canEditProtectedAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); + } + }, powerUserName); + + doTestInTransaction(new FailureTest + ( + "Normal rm user should not have the permissions to add the protected aspect.", + ModelAccessDeniedException.class + ) + { + @Override + public void run() throws Exception + { + // try and add the aspect + nodeService.addAspect(rmFolder, CUSTOM_PROTECTED_ASPECT, null); + } + }, powerUserName); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertTrue(modelSecurityService.canEditProtectedAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); + + // try and add the aspect + nodeService.addAspect(rmFolder, CUSTOM_PROTECTED_ASPECT, null); + assertTrue(nodeService.hasAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); + } + }, ADMIN_USER); + + // check protected aspect via removeAspect + doTestInTransaction(new FailureTest + ( + "Normal rm user should not have the permissions to remove the custom aspect.", + ModelAccessDeniedException.class + ) + { + @Override + public void run() throws Exception + { + nodeService.removeAspect(rmFolder, CUSTOM_PROTECTED_ASPECT); + } + }, powerUserName); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + nodeService.removeAspect(rmFolder, CUSTOM_PROTECTED_ASPECT); + assertFalse(nodeService.hasAspect(rmFolder, CUSTOM_PROTECTED_ASPECT)); + } + }, ADMIN_USER); + } + + /** + * test - getProtectedProperties(), isProtectedProperty(), getProtectedProperty() + */ + public void testProtectedProperties() throws Exception + { + doTestInTransaction(new VoidTest() + { + public void runImpl() + { + Set protectedProperties = modelSecurityService.getProtectedProperties(); + + assertNotNull(protectedProperties); + assertFalse(protectedProperties.isEmpty()); + assertTrue(protectedProperties.contains(CUSTOM_PROTECTED_PROPERTY)); + assertFalse(protectedProperties.contains(CUSTOM_PROPERTY)); + + assertTrue(modelSecurityService.isProtectedProperty(CUSTOM_PROTECTED_PROPERTY)); + assertFalse(modelSecurityService.isProtectedProperty(CUSTOM_PROPERTY)); + + ProtectedProperty protectedProperty = modelSecurityService.getProtectedProperty(CUSTOM_PROPERTY); + assertNull(protectedProperty); + protectedProperty = modelSecurityService.getProtectedProperty(CUSTOM_PROTECTED_PROPERTY); + assertNotNull(protectedProperty); + assertNotNull(protectedProperty.getQName()); + assertNotNull(protectedProperty.getCapabilities()); + } + }); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertTrue(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); + } + }, ADMIN_USER); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertFalse(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); + } + }, powerUserName); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertTrue(modelSecurityService.isProtectedProperty(CUSTOM_PROTECTED_PROPERTY)); + assertFalse(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); + } + }, powerUserName); + + doTestInTransaction(new FailureTest + ( + "Should not have the permissions to edit protected property.", + ModelAccessDeniedException.class + ) + { + @Override + public void run() throws Exception + { + nodeService.setProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY, "hello"); + } + }, powerUserName); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertTrue(modelSecurityService.canEditProtectedProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); + + nodeService.setProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY, "hello"); + assertEquals("hello", nodeService.getProperty(rmFolder, CUSTOM_PROTECTED_PROPERTY)); + } + }, ADMIN_USER); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RMCaveatConfigServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RMCaveatConfigServiceImplTest.java index c7555ebe11..b4b86019bf 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RMCaveatConfigServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RMCaveatConfigServiceImplTest.java @@ -1,621 +1,621 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.ArrayList; -import java.util.List; - -import javax.transaction.UserTransaction; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigServiceImpl; -import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.BaseSpringTest; -import org.alfresco.util.PropertyMap; - -/** - * Test of RM Caveat (Admin facing scripts) - * - * @author Mark Rogers - */ -public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD5015Model -{ - protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private NodeRef filePlan; - - private NodeService nodeService; - private TransactionService transactionService; - private RMCaveatConfigService caveatConfigService; - - private MutableAuthenticationService authenticationService; - private PersonService personService; - private AuthorityService authorityService; - - - // example base test data for supplemental markings list - protected final static String NOFORN = "NOFORN"; // Not Releasable to Foreign Nationals/Governments/Non-US Citizens - protected final static String NOCONTRACT = "NOCONTRACT"; // Not Releasable to Contractors or Contractor/Consultants - protected final static String FOUO = "FOUO"; // For Official Use Only - protected final static String FGI = "FGI"; // Foreign Government Information - - protected final static String RM_LIST = "rmc:smList"; // existing pre-defined list - protected final static String RM_LIST_ALT = "rmc:anoList"; - - @Override - protected void onSetUpInTransaction() throws Exception - { - super.onSetUpInTransaction(); - - // Get the service required in the tests - this.nodeService = (NodeService)this.applicationContext.getBean("NodeService"); // use upper 'N'odeService (to test access config interceptor) - this.authenticationService = (MutableAuthenticationService)this.applicationContext.getBean("AuthenticationService"); - this.personService = (PersonService)this.applicationContext.getBean("PersonService"); - this.authorityService = (AuthorityService)this.applicationContext.getBean("AuthorityService"); - this.caveatConfigService = (RMCaveatConfigServiceImpl)this.applicationContext.getBean("caveatConfigService"); - this.transactionService = (TransactionService)this.applicationContext.getBean("TransactionService"); - - - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - // Get the test data - setUpTestData(); - } - - private void setUpTestData() - { - } - - @Override - protected void onTearDownInTransaction() throws Exception - { - try - { - UserTransaction txn = transactionService.getUserTransaction(false); - txn.begin(); - this.nodeService.deleteNode(filePlan); - txn.commit(); - } - catch (Exception e) - { - // Nothing - //System.out.println("DID NOT DELETE FILE PLAN!"); - } - } - - @Override - protected void onTearDownAfterTransaction() throws Exception - { - // TODO Auto-generated method stub - super.onTearDownAfterTransaction(); - } - - public void testSetup() - { - // NOOP - } - - - /** - * Test of Caveat Config - * - * @throws Exception - */ - public void testAddRMConstraintList() throws Exception - { - setComplete(); - endTransaction(); - - cleanCaveatConfigData(); - - startNewTransaction(); - - /** - * Now remove the entire list (rma:smList); - */ - logger.debug("test remove entire list rmc:smList"); - caveatConfigService.deleteRMConstraint(RM_LIST); - - /** - * Now add the list again - */ - logger.debug("test add back rmc:smList"); - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Negative test - add a list that already exists - */ - logger.debug("try to create duplicate list rmc:smList"); - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Negative test - remove a list that does not exist - */ - logger.debug("test remove entire list rmc:smList"); - caveatConfigService.deleteRMConstraint(RM_LIST); - try - { - caveatConfigService.deleteRMConstraint(RM_LIST); - fail("unknown constraint should have thrown an exception"); - } - catch (Exception e) - { - // expect to go here - } - - - /** - * Negative test - add a constraint to property that does not exist - */ - logger.debug("test property does not exist"); - try - { - caveatConfigService.addRMConstraint("rma:mer", "", new String[0]); - fail("unknown property should have thrown an exception"); - } - catch (Exception e) - { - // expect to go here - } - endTransaction(); - cleanCaveatConfigData(); - - } - - /** - * Test of addRMConstraintListValue - * - * @throws Exception - */ - public void testAddRMConstraintListValue() throws Exception - { - setComplete(); - endTransaction(); - - cleanCaveatConfigData(); - setupCaveatConfigData(); - - startNewTransaction(); - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Add a user to the list - */ - List values = new ArrayList(); - values.add(NOFORN); - values.add(NOCONTRACT); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - - /** - * Add another value to that list - */ - caveatConfigService.addRMConstraintListValue(RM_LIST, "jrogers", FGI); - - /** - * Negative test - attempt to add a duplicate value - */ - caveatConfigService.addRMConstraintListValue(RM_LIST, "jrogers", FGI); - - /** - * Negative test - attempt to add to a list that does not exist - */ - try - { - caveatConfigService.addRMConstraintListValue(RM_LIST_ALT, "mhouse", FGI); - fail("exception not thrown"); - } - catch (Exception re) - { - // should go here - - } - - /** - * Negative test - attempt to add to a list that does exist and user that does not exist - */ - try - { - caveatConfigService.addRMConstraintListValue(RM_LIST, "mhouse", FGI); - fail("exception not thrown"); - } - catch (Exception e) - { - // should go here - } - - } - - - /** - * Test of UpdateRMConstraintListAuthority - * - * @throws Exception - */ - public void testUpdateRMConstraintListAuthority() throws Exception - { - setComplete(); - endTransaction(); - - cleanCaveatConfigData(); - setupCaveatConfigData(); - - startNewTransaction(); - - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Add a user to the list - */ - List values = new ArrayList(); - values.add(NOFORN); - values.add(NOCONTRACT); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - - /** - * Add to a authority that already exists - * Should replace existing authority - */ - List updatedValues = new ArrayList(); - values.add(FGI); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", updatedValues); - - /** - * Add a group to the list - */ - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "Engineering", values); - - /** - * Add to a list that does not exist - * Should create a new list - */ - caveatConfigService.deleteRMConstraint(RM_LIST); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - - - /** - * Add to a authority that already exists - * Should replace existing authority - */ - - endTransaction(); - cleanCaveatConfigData(); - - } - - /** - * Test of RemoveRMConstraintListAuthority - * - * @throws Exception - */ - public void testRemoveRMConstraintListAuthority() throws Exception - { - setComplete(); - endTransaction(); - - cleanCaveatConfigData(); - setupCaveatConfigData(); - - startNewTransaction(); - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - List values = new ArrayList(); - values.add(FGI); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - - /** - * Remove a user from a list - */ - caveatConfigService.removeRMConstraintListAuthority(RM_LIST, "jrogers"); - - /** - * Negative test - remove a user that does not exist - */ - caveatConfigService.removeRMConstraintListAuthority(RM_LIST, "jrogers"); - - /** - * Negative test - remove a user from a list that does not exist. - * Should create a new list - */ - - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - - endTransaction(); - cleanCaveatConfigData(); - - } - - - - - /** - * Test of Caveat Config - * - * @throws Exception - */ - public void testRMCaveatConfig() throws Exception - { - setComplete(); - endTransaction(); - - cleanCaveatConfigData(); - - startNewTransaction(); - - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - List values = new ArrayList(); - values.add(NOFORN); - values.add(FOUO); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "dfranco", values); - - values.add(FGI); - values.add(NOCONTRACT); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "dmartinz", values); - - // Test list of allowed values for caveats - - List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - // get allowed values for given caveat (for current user) - return caveatConfigService.getRMAllowedValues(RM_LIST); - } - }, "dfranco"); - - assertEquals(2, allowedValues.size()); - assertTrue(allowedValues.contains(NOFORN)); - assertTrue(allowedValues.contains(FOUO)); - - - allowedValues = AuthenticationUtil.runAs(new RunAsWork>() - { - public List doWork() - { - // get allowed values for given caveat (for current user) - return caveatConfigService.getRMAllowedValues(RM_LIST); - } - }, "dmartinz"); - - assertEquals(4, allowedValues.size()); - assertTrue(allowedValues.contains(NOFORN)); - assertTrue(allowedValues.contains(NOCONTRACT)); - assertTrue(allowedValues.contains(FOUO)); - assertTrue(allowedValues.contains(FGI)); - - /** - // - * Now remove the entire list (rma:smList); - */ - logger.debug("test remove entire list rmc:smList"); - caveatConfigService.deleteRMConstraint(RM_LIST); - - - /** - * Now add the list again - */ - logger.debug("test add back rmc:smList"); - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Negative test - add a list that already exists - */ - logger.debug("try to create duplicate list rmc:smList"); - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Negative test - remove a list that does not exist - */ - logger.debug("test remove entire list rmc:smList"); - caveatConfigService.deleteRMConstraint(RM_LIST); - try - { - caveatConfigService.deleteRMConstraint(RM_LIST); - fail("unknown constraint should have thrown an exception"); - } - catch (Exception e) - { - // expect to go here - } - - - /** - * Negative test - add a constraint to property that does not exist - */ - logger.debug("test property does not exist"); - try - { - caveatConfigService.addRMConstraint("rma:mer", "", new String[0]); - fail("unknown property should have thrown an exception"); - } - catch (Exception e) - { - // expect to go here - } - endTransaction(); - cleanCaveatConfigData(); - } - - private void cleanCaveatConfigData() - { - startNewTransaction(); - - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - deleteUser("jrangel"); - deleteUser("dmartinz"); - deleteUser("jrogers"); - deleteUser("hmcneil"); - deleteUser("dfranco"); - deleteUser("gsmith"); - deleteUser("eharris"); - deleteUser("bbayless"); - deleteUser("mhouse"); - deleteUser("aly"); - deleteUser("dsandy"); - deleteUser("driggs"); - deleteUser("test1"); - - deleteGroup("Engineering"); - deleteGroup("Finance"); - deleteGroup("test1"); - - caveatConfigService.updateOrCreateCaveatConfig("{}"); // empty config ! - - setComplete(); - endTransaction(); - } - - private void setupCaveatConfigData() - { - startNewTransaction(); - - // Switch to admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - // Create test users/groups (if they do not already exist) - - createUser("jrangel"); - createUser("dmartinz"); - createUser("jrogers"); - createUser("hmcneil"); - createUser("dfranco"); - createUser("gsmith"); - createUser("eharris"); - createUser("bbayless"); - createUser("mhouse"); - createUser("aly"); - createUser("dsandy"); - createUser("driggs"); - createUser("test1"); - - createGroup("Engineering"); - createGroup("Finance"); - createGroup("test1"); - - addToGroup("jrogers", "Engineering"); - addToGroup("dfranco", "Finance"); - - // not in grouo to start with - added later - //addToGroup("gsmith", "Engineering"); - - - //URL url = AbstractContentTransformerTest.class.getClassLoader().getResource("testCaveatConfig2.json"); // from test-resources - //assertNotNull(url); - //File file = new File(url.getFile()); - //assertTrue(file.exists()); - - //caveatConfigService.updateOrCreateCaveatConfig(file); - - setComplete(); - endTransaction(); - } - - protected void createUser(String userName) - { - if (! authenticationService.authenticationExists(userName)) - { - authenticationService.createAuthentication(userName, "PWD".toCharArray()); - } - - if (! personService.personExists(userName)) - { - PropertyMap ppOne = new PropertyMap(4); - ppOne.put(ContentModel.PROP_USERNAME, userName); - ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName"); - ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); - ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); - ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); - - personService.createPerson(ppOne); - } - } - - protected void deleteUser(String userName) - { - if (personService.personExists(userName)) - { - personService.deletePerson(userName); - } - } - - protected void createGroup(String groupShortName) - { - createGroup(null, groupShortName); - } - - protected void createGroup(String parentGroupShortName, String groupShortName) - { - if (parentGroupShortName != null) - { - String parentGroupFullName = authorityService.getName(AuthorityType.GROUP, parentGroupShortName); - if (!authorityService.authorityExists(parentGroupFullName)) - { - authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, null); - authorityService.addAuthority(parentGroupFullName, groupShortName); - } - } - else - { - authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, null); - } - } - - protected void deleteGroup(String groupShortName) - { - String groupFullName = authorityService.getName(AuthorityType.GROUP, groupShortName); - if (authorityService.authorityExists(groupFullName)) - { - authorityService.deleteAuthority(groupFullName); - } - } - - protected void addToGroup(String authorityName, String groupShortName) - { - authorityService.addAuthority(authorityService.getName(AuthorityType.GROUP, groupShortName), authorityName); - } - - protected void removeFromGroup(String authorityName, String groupShortName) - { - authorityService.removeAuthority(authorityService.getName(AuthorityType.GROUP, groupShortName), authorityName); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.ArrayList; +import java.util.List; + +import javax.transaction.UserTransaction; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigServiceImpl; +import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.MutableAuthenticationService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.BaseSpringTest; +import org.alfresco.util.PropertyMap; + +/** + * Test of RM Caveat (Admin facing scripts) + * + * @author Mark Rogers + */ +public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD5015Model +{ + protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); + + private NodeRef filePlan; + + private NodeService nodeService; + private TransactionService transactionService; + private RMCaveatConfigService caveatConfigService; + + private MutableAuthenticationService authenticationService; + private PersonService personService; + private AuthorityService authorityService; + + + // example base test data for supplemental markings list + protected final static String NOFORN = "NOFORN"; // Not Releasable to Foreign Nationals/Governments/Non-US Citizens + protected final static String NOCONTRACT = "NOCONTRACT"; // Not Releasable to Contractors or Contractor/Consultants + protected final static String FOUO = "FOUO"; // For Official Use Only + protected final static String FGI = "FGI"; // Foreign Government Information + + protected final static String RM_LIST = "rmc:smList"; // existing pre-defined list + protected final static String RM_LIST_ALT = "rmc:anoList"; + + @Override + protected void onSetUpInTransaction() throws Exception + { + super.onSetUpInTransaction(); + + // Get the service required in the tests + this.nodeService = (NodeService)this.applicationContext.getBean("NodeService"); // use upper 'N'odeService (to test access config interceptor) + this.authenticationService = (MutableAuthenticationService)this.applicationContext.getBean("AuthenticationService"); + this.personService = (PersonService)this.applicationContext.getBean("PersonService"); + this.authorityService = (AuthorityService)this.applicationContext.getBean("AuthorityService"); + this.caveatConfigService = (RMCaveatConfigServiceImpl)this.applicationContext.getBean("caveatConfigService"); + this.transactionService = (TransactionService)this.applicationContext.getBean("TransactionService"); + + + // Set the current security context as admin + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + + // Get the test data + setUpTestData(); + } + + private void setUpTestData() + { + } + + @Override + protected void onTearDownInTransaction() throws Exception + { + try + { + UserTransaction txn = transactionService.getUserTransaction(false); + txn.begin(); + this.nodeService.deleteNode(filePlan); + txn.commit(); + } + catch (Exception e) + { + // Nothing + //System.out.println("DID NOT DELETE FILE PLAN!"); + } + } + + @Override + protected void onTearDownAfterTransaction() throws Exception + { + // TODO Auto-generated method stub + super.onTearDownAfterTransaction(); + } + + public void testSetup() + { + // NOOP + } + + + /** + * Test of Caveat Config + * + * @throws Exception + */ + public void testAddRMConstraintList() throws Exception + { + setComplete(); + endTransaction(); + + cleanCaveatConfigData(); + + startNewTransaction(); + + /** + * Now remove the entire list (rma:smList); + */ + logger.debug("test remove entire list rmc:smList"); + caveatConfigService.deleteRMConstraint(RM_LIST); + + /** + * Now add the list again + */ + logger.debug("test add back rmc:smList"); + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + /** + * Negative test - add a list that already exists + */ + logger.debug("try to create duplicate list rmc:smList"); + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + /** + * Negative test - remove a list that does not exist + */ + logger.debug("test remove entire list rmc:smList"); + caveatConfigService.deleteRMConstraint(RM_LIST); + try + { + caveatConfigService.deleteRMConstraint(RM_LIST); + fail("unknown constraint should have thrown an exception"); + } + catch (Exception e) + { + // expect to go here + } + + + /** + * Negative test - add a constraint to property that does not exist + */ + logger.debug("test property does not exist"); + try + { + caveatConfigService.addRMConstraint("rma:mer", "", new String[0]); + fail("unknown property should have thrown an exception"); + } + catch (Exception e) + { + // expect to go here + } + endTransaction(); + cleanCaveatConfigData(); + + } + + /** + * Test of addRMConstraintListValue + * + * @throws Exception + */ + public void testAddRMConstraintListValue() throws Exception + { + setComplete(); + endTransaction(); + + cleanCaveatConfigData(); + setupCaveatConfigData(); + + startNewTransaction(); + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + /** + * Add a user to the list + */ + List values = new ArrayList(); + values.add(NOFORN); + values.add(NOCONTRACT); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); + + /** + * Add another value to that list + */ + caveatConfigService.addRMConstraintListValue(RM_LIST, "jrogers", FGI); + + /** + * Negative test - attempt to add a duplicate value + */ + caveatConfigService.addRMConstraintListValue(RM_LIST, "jrogers", FGI); + + /** + * Negative test - attempt to add to a list that does not exist + */ + try + { + caveatConfigService.addRMConstraintListValue(RM_LIST_ALT, "mhouse", FGI); + fail("exception not thrown"); + } + catch (Exception re) + { + // should go here + + } + + /** + * Negative test - attempt to add to a list that does exist and user that does not exist + */ + try + { + caveatConfigService.addRMConstraintListValue(RM_LIST, "mhouse", FGI); + fail("exception not thrown"); + } + catch (Exception e) + { + // should go here + } + + } + + + /** + * Test of UpdateRMConstraintListAuthority + * + * @throws Exception + */ + public void testUpdateRMConstraintListAuthority() throws Exception + { + setComplete(); + endTransaction(); + + cleanCaveatConfigData(); + setupCaveatConfigData(); + + startNewTransaction(); + + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + /** + * Add a user to the list + */ + List values = new ArrayList(); + values.add(NOFORN); + values.add(NOCONTRACT); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); + + /** + * Add to a authority that already exists + * Should replace existing authority + */ + List updatedValues = new ArrayList(); + values.add(FGI); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", updatedValues); + + /** + * Add a group to the list + */ + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "Engineering", values); + + /** + * Add to a list that does not exist + * Should create a new list + */ + caveatConfigService.deleteRMConstraint(RM_LIST); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); + + + /** + * Add to a authority that already exists + * Should replace existing authority + */ + + endTransaction(); + cleanCaveatConfigData(); + + } + + /** + * Test of RemoveRMConstraintListAuthority + * + * @throws Exception + */ + public void testRemoveRMConstraintListAuthority() throws Exception + { + setComplete(); + endTransaction(); + + cleanCaveatConfigData(); + setupCaveatConfigData(); + + startNewTransaction(); + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + List values = new ArrayList(); + values.add(FGI); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); + + /** + * Remove a user from a list + */ + caveatConfigService.removeRMConstraintListAuthority(RM_LIST, "jrogers"); + + /** + * Negative test - remove a user that does not exist + */ + caveatConfigService.removeRMConstraintListAuthority(RM_LIST, "jrogers"); + + /** + * Negative test - remove a user from a list that does not exist. + * Should create a new list + */ + + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); + + endTransaction(); + cleanCaveatConfigData(); + + } + + + + + /** + * Test of Caveat Config + * + * @throws Exception + */ + public void testRMCaveatConfig() throws Exception + { + setComplete(); + endTransaction(); + + cleanCaveatConfigData(); + + startNewTransaction(); + + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + List values = new ArrayList(); + values.add(NOFORN); + values.add(FOUO); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "dfranco", values); + + values.add(FGI); + values.add(NOCONTRACT); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "dmartinz", values); + + // Test list of allowed values for caveats + + List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() + { + public List doWork() + { + // get allowed values for given caveat (for current user) + return caveatConfigService.getRMAllowedValues(RM_LIST); + } + }, "dfranco"); + + assertEquals(2, allowedValues.size()); + assertTrue(allowedValues.contains(NOFORN)); + assertTrue(allowedValues.contains(FOUO)); + + + allowedValues = AuthenticationUtil.runAs(new RunAsWork>() + { + public List doWork() + { + // get allowed values for given caveat (for current user) + return caveatConfigService.getRMAllowedValues(RM_LIST); + } + }, "dmartinz"); + + assertEquals(4, allowedValues.size()); + assertTrue(allowedValues.contains(NOFORN)); + assertTrue(allowedValues.contains(NOCONTRACT)); + assertTrue(allowedValues.contains(FOUO)); + assertTrue(allowedValues.contains(FGI)); + + /** + // + * Now remove the entire list (rma:smList); + */ + logger.debug("test remove entire list rmc:smList"); + caveatConfigService.deleteRMConstraint(RM_LIST); + + + /** + * Now add the list again + */ + logger.debug("test add back rmc:smList"); + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + /** + * Negative test - add a list that already exists + */ + logger.debug("try to create duplicate list rmc:smList"); + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + /** + * Negative test - remove a list that does not exist + */ + logger.debug("test remove entire list rmc:smList"); + caveatConfigService.deleteRMConstraint(RM_LIST); + try + { + caveatConfigService.deleteRMConstraint(RM_LIST); + fail("unknown constraint should have thrown an exception"); + } + catch (Exception e) + { + // expect to go here + } + + + /** + * Negative test - add a constraint to property that does not exist + */ + logger.debug("test property does not exist"); + try + { + caveatConfigService.addRMConstraint("rma:mer", "", new String[0]); + fail("unknown property should have thrown an exception"); + } + catch (Exception e) + { + // expect to go here + } + endTransaction(); + cleanCaveatConfigData(); + } + + private void cleanCaveatConfigData() + { + startNewTransaction(); + + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + + deleteUser("jrangel"); + deleteUser("dmartinz"); + deleteUser("jrogers"); + deleteUser("hmcneil"); + deleteUser("dfranco"); + deleteUser("gsmith"); + deleteUser("eharris"); + deleteUser("bbayless"); + deleteUser("mhouse"); + deleteUser("aly"); + deleteUser("dsandy"); + deleteUser("driggs"); + deleteUser("test1"); + + deleteGroup("Engineering"); + deleteGroup("Finance"); + deleteGroup("test1"); + + caveatConfigService.updateOrCreateCaveatConfig("{}"); // empty config ! + + setComplete(); + endTransaction(); + } + + private void setupCaveatConfigData() + { + startNewTransaction(); + + // Switch to admin + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + + // Create test users/groups (if they do not already exist) + + createUser("jrangel"); + createUser("dmartinz"); + createUser("jrogers"); + createUser("hmcneil"); + createUser("dfranco"); + createUser("gsmith"); + createUser("eharris"); + createUser("bbayless"); + createUser("mhouse"); + createUser("aly"); + createUser("dsandy"); + createUser("driggs"); + createUser("test1"); + + createGroup("Engineering"); + createGroup("Finance"); + createGroup("test1"); + + addToGroup("jrogers", "Engineering"); + addToGroup("dfranco", "Finance"); + + // not in grouo to start with - added later + //addToGroup("gsmith", "Engineering"); + + + //URL url = AbstractContentTransformerTest.class.getClassLoader().getResource("testCaveatConfig2.json"); // from test-resources + //assertNotNull(url); + //File file = new File(url.getFile()); + //assertTrue(file.exists()); + + //caveatConfigService.updateOrCreateCaveatConfig(file); + + setComplete(); + endTransaction(); + } + + protected void createUser(String userName) + { + if (! authenticationService.authenticationExists(userName)) + { + authenticationService.createAuthentication(userName, "PWD".toCharArray()); + } + + if (! personService.personExists(userName)) + { + PropertyMap ppOne = new PropertyMap(4); + ppOne.put(ContentModel.PROP_USERNAME, userName); + ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName"); + ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); + ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); + ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); + + personService.createPerson(ppOne); + } + } + + protected void deleteUser(String userName) + { + if (personService.personExists(userName)) + { + personService.deletePerson(userName); + } + } + + protected void createGroup(String groupShortName) + { + createGroup(null, groupShortName); + } + + protected void createGroup(String parentGroupShortName, String groupShortName) + { + if (parentGroupShortName != null) + { + String parentGroupFullName = authorityService.getName(AuthorityType.GROUP, parentGroupShortName); + if (!authorityService.authorityExists(parentGroupFullName)) + { + authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, null); + authorityService.addAuthority(parentGroupFullName, groupShortName); + } + } + else + { + authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, null); + } + } + + protected void deleteGroup(String groupShortName) + { + String groupFullName = authorityService.getName(AuthorityType.GROUP, groupShortName); + if (authorityService.authorityExists(groupFullName)) + { + authorityService.deleteAuthority(groupFullName); + } + } + + protected void addToGroup(String authorityName, String groupShortName) + { + authorityService.addAuthority(authorityService.getName(AuthorityType.GROUP, groupShortName), authorityName); + } + + protected void removeFromGroup(String authorityName, String groupShortName) + { + authorityService.removeAuthority(authorityService.getName(AuthorityType.GROUP, groupShortName), authorityName); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java index 7f80b18167..90dee1bbfe 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java @@ -1,773 +1,773 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Records Service Implementation Test - * - * @author Roy Wetherall - * @author Tuna Aksoy - * @since 2.1 - */ -public class RecordServiceImplTest extends BaseRMTestCase -{ - /** - * This is a user test - * - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * This is a record test - * - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest() - */ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * This is a collaboration site test - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see RecordService#getRecordMetaDataAspects() - */ - public void testGetRecordMetaDataAspects() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Set aspects = recordService.getRecordMetadataAspects(filePlan); - assertNotNull(aspects); - assertEquals(2, aspects.size()); - assertTrue(aspects.containsAll(getAspectList())); - - return null; - } - - /** - * Helper method for getting a list of record meta data aspects - * - * @return Record meta data aspects as list - */ - private List getAspectList() - { - QName[] aspects = new QName[] - { - ASPECT_RECORD_META_DATA - }; - - return Arrays.asList(aspects); - } - }); - } - - /** - * @see RecordService#isRecord(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testIsRecord() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() - { - assertFalse(recordService.isRecord(filePlan)); - assertFalse(recordService.isRecord(rmContainer)); - assertFalse(recordService.isRecord(rmFolder)); - assertTrue(recordService.isRecord(recordOne)); - assertTrue(recordService.isRecord(recordDeclaredOne)); - } - }); - } - - /** - * @see RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef) - */ - public void testIsDeclared() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() - { - assertFalse(recordService.isRecord(filePlan)); - assertFalse(recordService.isRecord(rmContainer)); - assertFalse(recordService.isRecord(rmFolder)); - assertTrue(recordService.isRecord(recordOne)); - assertTrue(recordService.isRecord(recordDeclaredOne)); - } - }); - } - - public void testUnfiled() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() - { - assertFalse(recordService.isFiled(filePlan)); - assertFalse(recordService.isFiled(rmContainer)); - assertFalse(recordService.isFiled(rmFolder)); - assertTrue(recordService.isFiled(recordOne)); - assertTrue(recordService.isFiled(recordDeclaredOne)); - } - }); - } - - public void testExtendedWriters() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertTrue(extendedSecurityService.getReaders(recordOne).isEmpty()); - assertTrue(extendedSecurityService.getWriters(recordOne).isEmpty()); - - return null; - } - }, dmCollaborator); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA)); - - return null; - } - }, dmCollaborator); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Set writers = new HashSet(1); - writers.add(dmCollaborator); - extendedSecurityService.set(recordOne, null, writers); - - assertTrue(extendedSecurityService.getReaders(recordOne).isEmpty()); - assertFalse(extendedSecurityService.getWriters(recordOne).isEmpty()); - - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); - - // ALLOWED, becuase users have been added to the in-place roles - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA)); - - return null; - } - }, dmCollaborator); - - } - - /** - * @see RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, - * org.alfresco.service.cmr.repository.NodeRef) - */ - public void testCreateRecord() throws Exception - { - // show that users without WRITE can not create a record from a document - doTestInTransaction(new FailureTest( - "Can not create a record from a document if you do not have WRITE permissions.", - AccessDeniedException.class) - { - public void run() throws Exception - { - recordService.createRecord(filePlan, dmDocument); - } - }, dmConsumer); - - // create record from document - doTestInTransaction(new Test() - { - private NodeRef originalLocation; - - @Override - public Void run() - { - originalLocation = nodeService.getPrimaryParent(dmDocument).getParentRef(); - - assertFalse(recordService.isRecord(dmDocument)); - assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); - - checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - - checkPermissions(FILING, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - recordService.createRecord(filePlan, dmDocument); - - return null; - } - - public void test(Void result) - { - checkPermissions(READ_RECORDS, - AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.ALLOWED); // doc/record - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - - checkPermissions(FILING, - AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.ALLOWED); // doc/record - - assertTrue(recordService.isRecord(dmDocument)); - assertTrue(extendedSecurityService.hasExtendedSecurity(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - // show that the record has meta-data about it's original - // location - assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RECORD_ORIGINATING_DETAILS)); - assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); - assertFalse(originalLocation == nodeService.getPrimaryParent(dmDocument).getParentRef()); - - // show that the record is linked to it's original location - assertEquals(2, nodeService.getParentAssocs(dmDocument).size()); - - // **** - // Capability Tests - // **** - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, - RMPermissionModel.EDIT_NON_RECORD_METADATA)); - - Capability filling = capabilityService.getCapability("FileRecords"); - assertEquals(AccessStatus.DENIED, filling.hasPermission(dmDocument)); - - Capability editRecordMetadata = capabilityService.getCapability("EditNonRecordMetadata"); - assertEquals(AccessStatus.ALLOWED, editRecordMetadata.hasPermission(dmDocument)); - - Capability updateProperties = capabilityService.getCapability("UpdateProperties"); - assertEquals(AccessStatus.ALLOWED, updateProperties.hasPermission(dmDocument)); - } - }, dmCollaborator); - - // check the consumer's permissions are correct for the newly created - // document - doTestInTransaction(new Test() - { - @Override - public Void run() - { - checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.ALLOWED); // doc/record - - checkPermissions(FILING, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, - RMPermissionModel.EDIT_NON_RECORD_METADATA)); - - Capability filling = capabilityService.getCapability("FileRecords"); - assertEquals(AccessStatus.DENIED, filling.hasPermission(dmDocument)); - - Capability editRecordMetadata = capabilityService.getCapability("EditNonRecordMetadata"); - assertEquals(AccessStatus.DENIED, editRecordMetadata.hasPermission(dmDocument)); - - Capability updateProperties = capabilityService.getCapability("UpdateProperties"); - assertEquals(AccessStatus.DENIED, updateProperties.hasPermission(dmDocument)); - - return null; - } - }, dmConsumer); - } - - public void testCreateRecordNoLink() throws Exception - { - // show that users without WRITE can not create a record from a document - doTestInTransaction(new FailureTest( - "Can not create a record from a document if you do not have WRITE permissions.", - AccessDeniedException.class) - { - public void run() throws Exception - { - recordService.createRecord(filePlan, dmDocument, false); - } - }, dmConsumer); - - // create record from document - final NodeRef originalLocation = doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - NodeRef originalLocation = nodeService.getPrimaryParent(dmDocument).getParentRef(); - - //assertFalse(recordService.isRecord(dmDocument)); - //assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); - - checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - - checkPermissions(FILING, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - recordService.createRecord(filePlan, dmDocument, false); - - checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, - RMPermissionModel.VIEW_RECORDS)); - - checkPermissions(FILING, AccessStatus.DENIED, // file plan - AccessStatus.DENIED, // unfiled container - AccessStatus.DENIED, // record category - AccessStatus.DENIED, // record folder - AccessStatus.DENIED); // doc/record - - return originalLocation; - } - }, dmCollaborator); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertTrue(recordService.isRecord(dmDocument)); - assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - // show that the record has meta-data about it's original - // location - assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RECORD_ORIGINATING_DETAILS)); - assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); - assertFalse(originalLocation == nodeService.getPrimaryParent(dmDocument).getParentRef()); - - // show that the record is linked to it's original location - assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); - - return null; - } - }, ADMIN_USER); - } - - public void testFileNewContent() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - NodeRef record = fileFolderService.create(rmFolder, "test101.txt", TYPE_CONTENT).getNodeRef(); - - ContentWriter writer = contentService.getWriter(record, PROP_CONTENT, true); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent("hello world this is some test content"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertTrue(recordService.isRecord(record)); - assertTrue(recordService.isFiled(record)); - - assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); - } - }); - } - - public void xtestFileUnfiledrecord() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - recordService.createRecord(filePlan, dmDocument); - - assertTrue(recordService.isRecord(dmDocument)); - assertFalse(recordService.isFiled(dmDocument)); - - assertNull(nodeService.getProperty(dmDocument, PROP_DATE_FILED)); - - fileFolderService.move(dmDocument, rmFolder, "record.txt"); - - return dmDocument; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertTrue(recordService.isRecord(record)); - assertTrue(recordService.isFiled(record)); - - assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); - } - }); - } - - public void testFileDirectlyFromCollab() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - assertNull(nodeService.getProperty(dmDocument, PROP_DATE_FILED)); - - fileFolderService.move(dmDocument, rmFolder, "record.txt"); - - return dmDocument; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertTrue(recordService.isRecord(record)); - assertTrue(recordService.isFiled(record)); - - assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); - } - }, AuthenticationUtil.getSystemUserName()); - } - - private void checkPermissions(String permission, AccessStatus filePlanExpected, AccessStatus unfiledExpected, - AccessStatus recordCatExpected, AccessStatus recordFolderExpected, AccessStatus recordExpected) - { - assertEquals(filePlanExpected, permissionService.hasPermission(filePlan, permission)); - assertEquals(unfiledExpected, permissionService.hasPermission(unfiledContainer, permission)); - assertEquals(recordCatExpected, permissionService.hasPermission(rmContainer, permission)); - assertEquals(recordFolderExpected, permissionService.hasPermission(rmFolder, permission)); - assertEquals(recordExpected, permissionService.hasPermission(dmDocument, permission)); - } - - private String createUserWithCapabilties(final String... capabiltyNames) - { - return doTestInTransaction(new Test() - { - @Override - public String run() throws Exception - { - Role role = utils.createRole(filePlan, GUID.generate(), capabiltyNames); - - String userName = GUID.generate(); - createPerson(userName); - filePlanRoleService.assignRoleToAuthority(filePlan, role.getName(), userName); - - return userName; - } - }, AuthenticationUtil.getSystemUserName()); - - } - - /** - * Test {@link RecordService#isPropertyEditable(NodeRef, QName)} - */ - public void testIsPropertyEditable() throws Exception - { - final String nonRecordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_NON_RECORD_METADATA); - final String recordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_RECORD_METADATA); - final String declaredRecordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - filePlanPermissionService.setPermission(rmFolder, rmUserName, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, nonRecordMetadata, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, recordMetadata, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, declaredRecordMetadata, RMPermissionModel.FILING); - } - }); - - // test rmadmin - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertTrue(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertTrue(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }); - - // test normal user - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); - - assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }, rmUserName); - - // test undeclared record with edit non-record metadata capability - // test declared record with edit non-record metadata capability - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertTrue(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }, nonRecordMetadata); - - // test undeclared record with edit record metadata capability - // test declared record with edit record metadata capability - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertTrue(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }, recordMetadata); - - // test undeclared record with edit declared record metadata capability - // test declared record with edit declared record metadata capability - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); - assertTrue(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); - assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); - } - }, declaredRecordMetadata); - } - - public void testRecordPropertiesUpdate() throws Exception - { - final String nonRecordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_NON_RECORD_METADATA); - final String recordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_RECORD_METADATA); - final String declaredRecordMetadata = createUserWithCapabilties( - RMPermissionModel.VIEW_RECORDS, - RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - filePlanPermissionService.setPermission(rmFolder, rmUserName, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, nonRecordMetadata, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, recordMetadata, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(rmFolder, declaredRecordMetadata, RMPermissionModel.FILING); - } - }); - - // test rmadmin - canEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, ADMIN_USER); - canEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, ADMIN_USER); - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, ADMIN_USER); - canEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, ADMIN_USER); - - // test normal user - cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, rmUserName); - cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, rmUserName); - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, rmUserName); - cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, rmUserName); - - // test undeclared record with edit non-record metadata capability - canEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, nonRecordMetadata); - cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, nonRecordMetadata); - // test declared record with edit non-record metadata capability - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, nonRecordMetadata); - cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, nonRecordMetadata); - - // test undeclared record with edit record metadata capability - cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, recordMetadata); - canEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, recordMetadata); - // test declared record with edit record metadata capability - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, recordMetadata); - cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, recordMetadata); - - // test undeclared record with edit declared record metadata capability - cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, declaredRecordMetadata); - cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, declaredRecordMetadata); - // test declared record with edit declared record metadata capability - cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, declaredRecordMetadata); - canEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, declaredRecordMetadata); - - } - - private void cantEditProperty(final NodeRef nodeRef, final QName property, String user) throws Exception - { - boolean failure = false; - try - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - nodeService.setProperty(nodeRef, property, GUID.generate()); - } - - }, user); - } - catch (Throwable exception) - { - // expected - failure = true; - } - - // assert fail not failure - if (!failure) - { - fail("Property should not have been editable."); - } - } - - private void canEditProperty(final NodeRef nodeRef, final QName property, String user) throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - nodeService.setProperty(nodeRef, property, GUID.generate()); - } - }, user); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * Records Service Implementation Test + * + * @author Roy Wetherall + * @author Tuna Aksoy + * @since 2.1 + */ +public class RecordServiceImplTest extends BaseRMTestCase +{ + /** + * This is a user test + * + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * This is a record test + * + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest() + */ + @Override + protected boolean isRecordTest() + { + return true; + } + + /** + * This is a collaboration site test + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** + * @see RecordService#getRecordMetaDataAspects() + */ + public void testGetRecordMetaDataAspects() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Set aspects = recordService.getRecordMetadataAspects(filePlan); + assertNotNull(aspects); + assertEquals(2, aspects.size()); + assertTrue(aspects.containsAll(getAspectList())); + + return null; + } + + /** + * Helper method for getting a list of record meta data aspects + * + * @return Record meta data aspects as list + */ + private List getAspectList() + { + QName[] aspects = new QName[] + { + ASPECT_RECORD_META_DATA + }; + + return Arrays.asList(aspects); + } + }); + } + + /** + * @see RecordService#isRecord(org.alfresco.service.cmr.repository.NodeRef) + */ + public void testIsRecord() throws Exception + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() + { + assertFalse(recordService.isRecord(filePlan)); + assertFalse(recordService.isRecord(rmContainer)); + assertFalse(recordService.isRecord(rmFolder)); + assertTrue(recordService.isRecord(recordOne)); + assertTrue(recordService.isRecord(recordDeclaredOne)); + } + }); + } + + /** + * @see RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef) + */ + public void testIsDeclared() throws Exception + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() + { + assertFalse(recordService.isRecord(filePlan)); + assertFalse(recordService.isRecord(rmContainer)); + assertFalse(recordService.isRecord(rmFolder)); + assertTrue(recordService.isRecord(recordOne)); + assertTrue(recordService.isRecord(recordDeclaredOne)); + } + }); + } + + public void testUnfiled() throws Exception + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() + { + assertFalse(recordService.isFiled(filePlan)); + assertFalse(recordService.isFiled(rmContainer)); + assertFalse(recordService.isFiled(rmFolder)); + assertTrue(recordService.isFiled(recordOne)); + assertTrue(recordService.isFiled(recordDeclaredOne)); + } + }); + } + + public void testExtendedWriters() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertTrue(extendedSecurityService.getReaders(recordOne).isEmpty()); + assertTrue(extendedSecurityService.getWriters(recordOne).isEmpty()); + + return null; + } + }, dmCollaborator); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA)); + + return null; + } + }, dmCollaborator); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + Set writers = new HashSet(1); + writers.add(dmCollaborator); + extendedSecurityService.set(recordOne, null, writers); + + assertTrue(extendedSecurityService.getReaders(recordOne).isEmpty()); + assertFalse(extendedSecurityService.getWriters(recordOne).isEmpty()); + + return null; + } + }); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.FILING)); + + // ALLOWED, becuase users have been added to the in-place roles + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA)); + + return null; + } + }, dmCollaborator); + + } + + /** + * @see RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, + * org.alfresco.service.cmr.repository.NodeRef) + */ + public void testCreateRecord() throws Exception + { + // show that users without WRITE can not create a record from a document + doTestInTransaction(new FailureTest( + "Can not create a record from a document if you do not have WRITE permissions.", + AccessDeniedException.class) + { + public void run() throws Exception + { + recordService.createRecord(filePlan, dmDocument); + } + }, dmConsumer); + + // create record from document + doTestInTransaction(new Test() + { + private NodeRef originalLocation; + + @Override + public Void run() + { + originalLocation = nodeService.getPrimaryParent(dmDocument).getParentRef(); + + assertFalse(recordService.isRecord(dmDocument)); + assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); + + checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.DENIED); // doc/record + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, + RMPermissionModel.VIEW_RECORDS)); + + checkPermissions(FILING, AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.DENIED); // doc/record + + recordService.createRecord(filePlan, dmDocument); + + return null; + } + + public void test(Void result) + { + checkPermissions(READ_RECORDS, + AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.ALLOWED); // doc/record + + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, + RMPermissionModel.VIEW_RECORDS)); + + checkPermissions(FILING, + AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.ALLOWED); // doc/record + + assertTrue(recordService.isRecord(dmDocument)); + assertTrue(extendedSecurityService.hasExtendedSecurity(dmDocument)); + assertFalse(recordService.isFiled(dmDocument)); + + // show that the record has meta-data about it's original + // location + assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RECORD_ORIGINATING_DETAILS)); + assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); + assertFalse(originalLocation == nodeService.getPrimaryParent(dmDocument).getParentRef()); + + // show that the record is linked to it's original location + assertEquals(2, nodeService.getParentAssocs(dmDocument).size()); + + // **** + // Capability Tests + // **** + + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, + RMPermissionModel.VIEW_RECORDS)); + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, + RMPermissionModel.EDIT_NON_RECORD_METADATA)); + + Capability filling = capabilityService.getCapability("FileRecords"); + assertEquals(AccessStatus.DENIED, filling.hasPermission(dmDocument)); + + Capability editRecordMetadata = capabilityService.getCapability("EditNonRecordMetadata"); + assertEquals(AccessStatus.ALLOWED, editRecordMetadata.hasPermission(dmDocument)); + + Capability updateProperties = capabilityService.getCapability("UpdateProperties"); + assertEquals(AccessStatus.ALLOWED, updateProperties.hasPermission(dmDocument)); + } + }, dmCollaborator); + + // check the consumer's permissions are correct for the newly created + // document + doTestInTransaction(new Test() + { + @Override + public Void run() + { + checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.ALLOWED); // doc/record + + checkPermissions(FILING, AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.DENIED); // doc/record + + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, + RMPermissionModel.VIEW_RECORDS)); + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, + RMPermissionModel.EDIT_NON_RECORD_METADATA)); + + Capability filling = capabilityService.getCapability("FileRecords"); + assertEquals(AccessStatus.DENIED, filling.hasPermission(dmDocument)); + + Capability editRecordMetadata = capabilityService.getCapability("EditNonRecordMetadata"); + assertEquals(AccessStatus.DENIED, editRecordMetadata.hasPermission(dmDocument)); + + Capability updateProperties = capabilityService.getCapability("UpdateProperties"); + assertEquals(AccessStatus.DENIED, updateProperties.hasPermission(dmDocument)); + + return null; + } + }, dmConsumer); + } + + public void testCreateRecordNoLink() throws Exception + { + // show that users without WRITE can not create a record from a document + doTestInTransaction(new FailureTest( + "Can not create a record from a document if you do not have WRITE permissions.", + AccessDeniedException.class) + { + public void run() throws Exception + { + recordService.createRecord(filePlan, dmDocument, false); + } + }, dmConsumer); + + // create record from document + final NodeRef originalLocation = doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + NodeRef originalLocation = nodeService.getPrimaryParent(dmDocument).getParentRef(); + + //assertFalse(recordService.isRecord(dmDocument)); + //assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); + + checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.DENIED); // doc/record + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, + RMPermissionModel.VIEW_RECORDS)); + + checkPermissions(FILING, AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.DENIED); // doc/record + + recordService.createRecord(filePlan, dmDocument, false); + + checkPermissions(READ_RECORDS, AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.DENIED); // doc/record + + assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, + RMPermissionModel.VIEW_RECORDS)); + + checkPermissions(FILING, AccessStatus.DENIED, // file plan + AccessStatus.DENIED, // unfiled container + AccessStatus.DENIED, // record category + AccessStatus.DENIED, // record folder + AccessStatus.DENIED); // doc/record + + return originalLocation; + } + }, dmCollaborator); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertTrue(recordService.isRecord(dmDocument)); + assertFalse(extendedSecurityService.hasExtendedSecurity(dmDocument)); + assertFalse(recordService.isFiled(dmDocument)); + + // show that the record has meta-data about it's original + // location + assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RECORD_ORIGINATING_DETAILS)); + assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINATING_LOCATION)); + assertFalse(originalLocation == nodeService.getPrimaryParent(dmDocument).getParentRef()); + + // show that the record is linked to it's original location + assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); + + return null; + } + }, ADMIN_USER); + } + + public void testFileNewContent() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + NodeRef record = fileFolderService.create(rmFolder, "test101.txt", TYPE_CONTENT).getNodeRef(); + + ContentWriter writer = contentService.getWriter(record, PROP_CONTENT, true); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.putContent("hello world this is some test content"); + + return record; + } + + @Override + public void test(NodeRef record) throws Exception + { + assertTrue(recordService.isRecord(record)); + assertTrue(recordService.isFiled(record)); + + assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); + } + }); + } + + public void xtestFileUnfiledrecord() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + recordService.createRecord(filePlan, dmDocument); + + assertTrue(recordService.isRecord(dmDocument)); + assertFalse(recordService.isFiled(dmDocument)); + + assertNull(nodeService.getProperty(dmDocument, PROP_DATE_FILED)); + + fileFolderService.move(dmDocument, rmFolder, "record.txt"); + + return dmDocument; + } + + @Override + public void test(NodeRef record) throws Exception + { + assertTrue(recordService.isRecord(record)); + assertTrue(recordService.isFiled(record)); + + assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); + } + }); + } + + public void testFileDirectlyFromCollab() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + assertNull(nodeService.getProperty(dmDocument, PROP_DATE_FILED)); + + fileFolderService.move(dmDocument, rmFolder, "record.txt"); + + return dmDocument; + } + + @Override + public void test(NodeRef record) throws Exception + { + assertTrue(recordService.isRecord(record)); + assertTrue(recordService.isFiled(record)); + + assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED)); + } + }, AuthenticationUtil.getSystemUserName()); + } + + private void checkPermissions(String permission, AccessStatus filePlanExpected, AccessStatus unfiledExpected, + AccessStatus recordCatExpected, AccessStatus recordFolderExpected, AccessStatus recordExpected) + { + assertEquals(filePlanExpected, permissionService.hasPermission(filePlan, permission)); + assertEquals(unfiledExpected, permissionService.hasPermission(unfiledContainer, permission)); + assertEquals(recordCatExpected, permissionService.hasPermission(rmContainer, permission)); + assertEquals(recordFolderExpected, permissionService.hasPermission(rmFolder, permission)); + assertEquals(recordExpected, permissionService.hasPermission(dmDocument, permission)); + } + + private String createUserWithCapabilties(final String... capabiltyNames) + { + return doTestInTransaction(new Test() + { + @Override + public String run() throws Exception + { + Role role = utils.createRole(filePlan, GUID.generate(), capabiltyNames); + + String userName = GUID.generate(); + createPerson(userName); + filePlanRoleService.assignRoleToAuthority(filePlan, role.getName(), userName); + + return userName; + } + }, AuthenticationUtil.getSystemUserName()); + + } + + /** + * Test {@link RecordService#isPropertyEditable(NodeRef, QName)} + */ + public void testIsPropertyEditable() throws Exception + { + final String nonRecordMetadata = createUserWithCapabilties( + RMPermissionModel.VIEW_RECORDS, + RMPermissionModel.EDIT_NON_RECORD_METADATA); + final String recordMetadata = createUserWithCapabilties( + RMPermissionModel.VIEW_RECORDS, + RMPermissionModel.EDIT_RECORD_METADATA); + final String declaredRecordMetadata = createUserWithCapabilties( + RMPermissionModel.VIEW_RECORDS, + RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + filePlanPermissionService.setPermission(rmFolder, rmUserName, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(rmFolder, nonRecordMetadata, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(rmFolder, recordMetadata, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(rmFolder, declaredRecordMetadata, RMPermissionModel.FILING); + } + }); + + // test rmadmin + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertTrue(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); + assertTrue(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); + assertTrue(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); + assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); + } + }); + + // test normal user + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS)); + + assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); + assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); + assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); + assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); + } + }, rmUserName); + + // test undeclared record with edit non-record metadata capability + // test declared record with edit non-record metadata capability + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); + assertTrue(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); + assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); + assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); + } + }, nonRecordMetadata); + + // test undeclared record with edit record metadata capability + // test declared record with edit record metadata capability + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertTrue(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); + assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); + assertFalse(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); + assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); + } + }, recordMetadata); + + // test undeclared record with edit declared record metadata capability + // test declared record with edit declared record metadata capability + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + assertFalse(recordService.isPropertyEditable(recordOne, RecordsManagementModel.PROP_LOCATION)); + assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION)); + assertTrue(recordService.isPropertyEditable(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION)); + assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION)); + } + }, declaredRecordMetadata); + } + + public void testRecordPropertiesUpdate() throws Exception + { + final String nonRecordMetadata = createUserWithCapabilties( + RMPermissionModel.VIEW_RECORDS, + RMPermissionModel.EDIT_NON_RECORD_METADATA); + final String recordMetadata = createUserWithCapabilties( + RMPermissionModel.VIEW_RECORDS, + RMPermissionModel.EDIT_RECORD_METADATA); + final String declaredRecordMetadata = createUserWithCapabilties( + RMPermissionModel.VIEW_RECORDS, + RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + filePlanPermissionService.setPermission(rmFolder, rmUserName, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(rmFolder, nonRecordMetadata, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(rmFolder, recordMetadata, RMPermissionModel.FILING); + filePlanPermissionService.setPermission(rmFolder, declaredRecordMetadata, RMPermissionModel.FILING); + } + }); + + // test rmadmin + canEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, ADMIN_USER); + canEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, ADMIN_USER); + cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, ADMIN_USER); + canEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, ADMIN_USER); + + // test normal user + cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, rmUserName); + cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, rmUserName); + cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, rmUserName); + cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, rmUserName); + + // test undeclared record with edit non-record metadata capability + canEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, nonRecordMetadata); + cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, nonRecordMetadata); + // test declared record with edit non-record metadata capability + cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, nonRecordMetadata); + cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, nonRecordMetadata); + + // test undeclared record with edit record metadata capability + cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, recordMetadata); + canEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, recordMetadata); + // test declared record with edit record metadata capability + cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, recordMetadata); + cantEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, recordMetadata); + + // test undeclared record with edit declared record metadata capability + cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, declaredRecordMetadata); + cantEditProperty(recordOne, RecordsManagementModel.PROP_LOCATION, declaredRecordMetadata); + // test declared record with edit declared record metadata capability + cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, declaredRecordMetadata); + canEditProperty(recordDeclaredOne, RecordsManagementModel.PROP_LOCATION, declaredRecordMetadata); + + } + + private void cantEditProperty(final NodeRef nodeRef, final QName property, String user) throws Exception + { + boolean failure = false; + try + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + nodeService.setProperty(nodeRef, property, GUID.generate()); + } + + }, user); + } + catch (Throwable exception) + { + // expected + failure = true; + } + + // assert fail not failure + if (!failure) + { + fail("Property should not have been editable."); + } + } + + private void canEditProperty(final NodeRef nodeRef, final QName property, String user) throws Exception + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + nodeService.setProperty(nodeRef, property, GUID.generate()); + } + }, user); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementActionServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementActionServiceImplTest.java index f42cf652bf..dd798b38a2 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementActionServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementActionServiceImplTest.java @@ -1,271 +1,271 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction2; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Records management action service implementation test - * - * @author Roy Wetherall - */ -public class RecordsManagementActionServiceImplTest extends BaseRMTestCase - implements BeforeRMActionExecution, - OnRMActionExecution -{ - private RetryingTransactionHelper txnHelper; - - private NodeRef nodeRef; - private List nodeRefs; - - private boolean beforeMarker; - private boolean onMarker; - private boolean inTest; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - this.txnHelper = transactionService.getRetryingTransactionHelper(); - - // Set the current security context as system - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - RetryingTransactionCallback setUpCallback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Create a node we can use for the tests - NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - nodeRef = nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), - ContentModel.TYPE_CONTENT).getChildRef(); - - // Create nodeRef list - nodeRefs = new ArrayList(5); - for (int i = 0; i < 5; i++) - { - nodeRefs.add( - nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), - ContentModel.TYPE_CONTENT).getChildRef()); - } - return null; - } - }; - txnHelper.doInTransaction(setUpCallback); - - beforeMarker = false; - onMarker = false; - inTest = false; - } - - @Override - protected void tearDown() - { - AuthenticationUtil.clearCurrentSecurityContext(); - } - - public void testGetActions() - { - RetryingTransactionCallback testCallback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - getActionsImpl(); - return null; - } - }; - txnHelper.doInTransaction(testCallback); - } - - private void getActionsImpl() - { - List result = this.rmActionService.getRecordsManagementActions(); - assertNotNull(result); - Map resultMap = new HashMap(8); - for (RecordsManagementAction action : result) - { - resultMap.put(action.getName(), action); - } - - assertTrue(resultMap.containsKey(TestAction.NAME)); - assertTrue(resultMap.containsKey(TestAction2.NAME)); - - result = this.rmActionService.getDispositionActions(); - resultMap = new HashMap(8); - for (RecordsManagementAction action : result) - { - resultMap.put(action.getName(), action); - } - assertTrue(resultMap.containsKey(TestAction.NAME)); - assertFalse(resultMap.containsKey(TestAction2.NAME)); - - // get some specific actions and check the label - RecordsManagementAction cutoff = this.rmActionService.getDispositionAction("cutoff"); - assertNotNull(cutoff); - assertEquals("Cut Off", cutoff.getLabel()); - - RecordsManagementAction freeze = this.rmActionService.getRecordsManagementAction("freeze"); - assertNotNull(freeze); - assertEquals("Freeze", freeze.getLabel()); - assertEquals("Freeze", freeze.getLabel()); - - // test non-existent actions - assertNull(this.rmActionService.getDispositionAction("notThere")); - assertNull(this.rmActionService.getRecordsManagementAction("notThere")); - } - - public void testExecution() - { - RetryingTransactionCallback testCallback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - executionImpl(); - return null; - } - }; - txnHelper.doInTransaction(testCallback); - } - - public void beforeRMActionExecution(NodeRef nodeRef, String name, Map parameters) - { - if (inTest) - { - assertEquals(this.nodeRef, nodeRef); - assertEquals(TestAction.NAME, name); - assertEquals(1, parameters.size()); - assertTrue(parameters.containsKey(TestAction.PARAM)); - assertEquals(TestAction.PARAM_VALUE, parameters.get(TestAction.PARAM)); - beforeMarker = true; - } - } - - public void onRMActionExecution(NodeRef nodeRef, String name, Map parameters) - { - if (inTest) - { - assertEquals(this.nodeRef, nodeRef); - assertEquals(TestAction.NAME, name); - assertEquals(1, parameters.size()); - assertTrue(parameters.containsKey(TestAction.PARAM)); - assertEquals(TestAction.PARAM_VALUE, parameters.get(TestAction.PARAM)); - onMarker = true; - } - } - - private void executionImpl() - { - inTest = true; - try - { - policyComponent.bindClassBehaviour( - RecordsManagementPolicies.BEFORE_RM_ACTION_EXECUTION, - this, - new JavaBehaviour(this, "beforeRMActionExecution", NotificationFrequency.EVERY_EVENT)); - policyComponent.bindClassBehaviour( - RecordsManagementPolicies.ON_RM_ACTION_EXECUTION, - this, - new JavaBehaviour(this, "onRMActionExecution", NotificationFrequency.EVERY_EVENT)); - - assertFalse(beforeMarker); - assertFalse(onMarker); - assertFalse(this.nodeService.hasAspect(this.nodeRef, ASPECT_RECORD)); - - Map params = new HashMap(1); - params.put(TestAction.PARAM, TestAction.PARAM_VALUE); - this.rmActionService.executeRecordsManagementAction(this.nodeRef, TestAction.NAME, params); - - assertTrue(beforeMarker); - assertTrue(onMarker); - assertTrue(this.nodeService.hasAspect(this.nodeRef, ASPECT_RECORD)); - } - finally - { - inTest = false; - } - } - - public void testBulkExecution() - { - RetryingTransactionCallback testCallback = new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - bulkExecutionImpl(); - return null; - } - }; - txnHelper.doInTransaction(testCallback); - } - - private void bulkExecutionImpl() - { - for (NodeRef nodeRef : this.nodeRefs) - { - assertFalse(this.nodeService.hasAspect(nodeRef, ASPECT_RECORD)); - } - - Map params = new HashMap(1); - params.put(TestAction.PARAM, TestAction.PARAM_VALUE); - this.rmActionService.executeRecordsManagementAction(this.nodeRefs, TestAction.NAME, params); - - for (NodeRef nodeRef : this.nodeRefs) - { - assertTrue(this.nodeService.hasAspect(nodeRef, ASPECT_RECORD)); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction2; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Records management action service implementation test + * + * @author Roy Wetherall + */ +public class RecordsManagementActionServiceImplTest extends BaseRMTestCase + implements BeforeRMActionExecution, + OnRMActionExecution +{ + private RetryingTransactionHelper txnHelper; + + private NodeRef nodeRef; + private List nodeRefs; + + private boolean beforeMarker; + private boolean onMarker; + private boolean inTest; + + @Override + protected void setUp() throws Exception + { + super.setUp(); + + this.txnHelper = transactionService.getRetryingTransactionHelper(); + + // Set the current security context as system + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + RetryingTransactionCallback setUpCallback = new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + // Create a node we can use for the tests + NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); + nodeRef = nodeService.createNode( + rootNodeRef, + ContentModel.ASSOC_CHILDREN, + QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), + ContentModel.TYPE_CONTENT).getChildRef(); + + // Create nodeRef list + nodeRefs = new ArrayList(5); + for (int i = 0; i < 5; i++) + { + nodeRefs.add( + nodeService.createNode( + rootNodeRef, + ContentModel.ASSOC_CHILDREN, + QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), + ContentModel.TYPE_CONTENT).getChildRef()); + } + return null; + } + }; + txnHelper.doInTransaction(setUpCallback); + + beforeMarker = false; + onMarker = false; + inTest = false; + } + + @Override + protected void tearDown() + { + AuthenticationUtil.clearCurrentSecurityContext(); + } + + public void testGetActions() + { + RetryingTransactionCallback testCallback = new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + getActionsImpl(); + return null; + } + }; + txnHelper.doInTransaction(testCallback); + } + + private void getActionsImpl() + { + List result = this.rmActionService.getRecordsManagementActions(); + assertNotNull(result); + Map resultMap = new HashMap(8); + for (RecordsManagementAction action : result) + { + resultMap.put(action.getName(), action); + } + + assertTrue(resultMap.containsKey(TestAction.NAME)); + assertTrue(resultMap.containsKey(TestAction2.NAME)); + + result = this.rmActionService.getDispositionActions(); + resultMap = new HashMap(8); + for (RecordsManagementAction action : result) + { + resultMap.put(action.getName(), action); + } + assertTrue(resultMap.containsKey(TestAction.NAME)); + assertFalse(resultMap.containsKey(TestAction2.NAME)); + + // get some specific actions and check the label + RecordsManagementAction cutoff = this.rmActionService.getDispositionAction("cutoff"); + assertNotNull(cutoff); + assertEquals("Cut Off", cutoff.getLabel()); + + RecordsManagementAction freeze = this.rmActionService.getRecordsManagementAction("freeze"); + assertNotNull(freeze); + assertEquals("Freeze", freeze.getLabel()); + assertEquals("Freeze", freeze.getLabel()); + + // test non-existent actions + assertNull(this.rmActionService.getDispositionAction("notThere")); + assertNull(this.rmActionService.getRecordsManagementAction("notThere")); + } + + public void testExecution() + { + RetryingTransactionCallback testCallback = new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + executionImpl(); + return null; + } + }; + txnHelper.doInTransaction(testCallback); + } + + public void beforeRMActionExecution(NodeRef nodeRef, String name, Map parameters) + { + if (inTest) + { + assertEquals(this.nodeRef, nodeRef); + assertEquals(TestAction.NAME, name); + assertEquals(1, parameters.size()); + assertTrue(parameters.containsKey(TestAction.PARAM)); + assertEquals(TestAction.PARAM_VALUE, parameters.get(TestAction.PARAM)); + beforeMarker = true; + } + } + + public void onRMActionExecution(NodeRef nodeRef, String name, Map parameters) + { + if (inTest) + { + assertEquals(this.nodeRef, nodeRef); + assertEquals(TestAction.NAME, name); + assertEquals(1, parameters.size()); + assertTrue(parameters.containsKey(TestAction.PARAM)); + assertEquals(TestAction.PARAM_VALUE, parameters.get(TestAction.PARAM)); + onMarker = true; + } + } + + private void executionImpl() + { + inTest = true; + try + { + policyComponent.bindClassBehaviour( + RecordsManagementPolicies.BEFORE_RM_ACTION_EXECUTION, + this, + new JavaBehaviour(this, "beforeRMActionExecution", NotificationFrequency.EVERY_EVENT)); + policyComponent.bindClassBehaviour( + RecordsManagementPolicies.ON_RM_ACTION_EXECUTION, + this, + new JavaBehaviour(this, "onRMActionExecution", NotificationFrequency.EVERY_EVENT)); + + assertFalse(beforeMarker); + assertFalse(onMarker); + assertFalse(this.nodeService.hasAspect(this.nodeRef, ASPECT_RECORD)); + + Map params = new HashMap(1); + params.put(TestAction.PARAM, TestAction.PARAM_VALUE); + this.rmActionService.executeRecordsManagementAction(this.nodeRef, TestAction.NAME, params); + + assertTrue(beforeMarker); + assertTrue(onMarker); + assertTrue(this.nodeService.hasAspect(this.nodeRef, ASPECT_RECORD)); + } + finally + { + inTest = false; + } + } + + public void testBulkExecution() + { + RetryingTransactionCallback testCallback = new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + bulkExecutionImpl(); + return null; + } + }; + txnHelper.doInTransaction(testCallback); + } + + private void bulkExecutionImpl() + { + for (NodeRef nodeRef : this.nodeRefs) + { + assertFalse(this.nodeService.hasAspect(nodeRef, ASPECT_RECORD)); + } + + Map params = new HashMap(1); + params.put(TestAction.PARAM, TestAction.PARAM_VALUE); + this.rmActionService.executeRecordsManagementAction(this.nodeRefs, TestAction.NAME, params); + + for (NodeRef nodeRef : this.nodeRefs) + { + assertTrue(this.nodeService.hasAspect(nodeRef, ASPECT_RECORD)); + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java index 99701d26b0..a9cbc3ed52 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java @@ -1,952 +1,952 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeCreateReference; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; -import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.Constraint; -import org.alfresco.service.cmr.dictionary.ConstraintDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.Pair; -import org.springframework.util.CollectionUtils; - -/** - * This test class tests the definition and use of a custom RM elements at the Java services layer. - * - * @author Neil McErlean, janv, Roy Wetherall - */ -public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase - implements RecordsManagementModel, - BeforeCreateReference, - OnCreateReference -{ - - private final static long testRunID = System.currentTimeMillis(); - - private List createdCustomProperties; - private List madeCustomisable; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setUp() - */ - @Override - protected void setUp() throws Exception - { - createdCustomProperties = new ArrayList(); - madeCustomisable = new ArrayList(); - super.setUp(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestData() - */ - @Override - protected void setupTestData() - { - super.setupTestData(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // As system user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - for (QName createdCustomProperty : createdCustomProperties) - { - rmAdminService.removeCustomPropertyDefinition(createdCustomProperty); - } - - for (QName customisable : madeCustomisable) - { - rmAdminService.unmakeCustomisable(customisable); - } - - return null; - } - }); - - super.tearDown(); - } - - /** - * @see RecordsManagementAdminService#getCustomisable() - */ - public void testGetCustomisable() throws Exception - { - // Get the customisable types - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Set list = rmAdminService.getCustomisable(); - assertNotNull(list); - assertTrue(list.containsAll( - CollectionUtils.arrayToList(new QName[] - { - ASPECT_RECORD, - TYPE_RECORD_FOLDER, - TYPE_NON_ELECTRONIC_DOCUMENT, - TYPE_RECORD_CATEGORY - }))); - - return null; - } - }); - } - - /** - * @see RecordsManagementAdminService#isCustomisable(QName) - */ - public void testIsCustomisable() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertFalse(rmAdminService.isCustomisable(TYPE_CONTENT)); - assertFalse(rmAdminService.isCustomisable(ASPECT_DUBLINCORE)); - assertTrue(rmAdminService.isCustomisable(TYPE_RECORD_FOLDER)); - assertTrue(rmAdminService.isCustomisable(ASPECT_RECORD)); - - return null; - } - }); - } - - /** - * @see RecordsManagementAdminService#existsCustomProperty(QName) - * @see RecordsManagementAdminService#addCustomPropertyDefinition(QName, QName, String, QName, String, String, String, boolean, boolean, boolean, QName) - * @see RecordsManagementAdminService#addCustomPropertyDefinition(QName, QName, String, QName, String, String) - */ - public void testAddCustomPropertyDefinition() throws Exception - { - // Add property to Record (id specified, short version) - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - // Check the property does not exist - assertFalse(rmAdminService.existsCustomProperty(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"))); - - return rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), - ASPECT_RECORD, - "Label1", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - - @Override - public void test(QName result) throws Exception - { - try - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), result); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); - assertNotNull(propDefs); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label1", propDef.getTitle(dictionaryService)); - } - finally - { - // Store the created property for cleanup later - createdCustomProperties.add(result); - } - } - }); - - // Add property to record (no id, short version) - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - return rmAdminService.addCustomPropertyDefinition( - null, - ASPECT_RECORD, - "Label2", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - - @Override - public void test(QName result) throws Exception - { - try - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI()); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); - assertNotNull(propDefs); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label2", propDef.getTitle(dictionaryService)); - } - finally - { - // Store the created property for cleanup later - createdCustomProperties.add(result); - } - } - }); - - // Add property to record (long version) - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - return rmAdminService.addCustomPropertyDefinition( - null, - ASPECT_RECORD, - "Label3", - DataTypeDefinition.TEXT, - "Title", - "Description", - "default", - false, - false, - false, - null); - } - - @Override - public void test(QName result) throws Exception - { - try - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI()); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); - assertNotNull(propDefs); - //assertEquals(3, propDefs.size()); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label3", propDef.getTitle(dictionaryService)); - assertEquals("default", propDef.getDefaultValue()); - assertFalse(propDef.isMandatory()); - assertFalse(propDef.isMultiValued()); - assertFalse(propDef.isProtected()); - - } - finally - { - // Store the created property for cleanup later - createdCustomProperties.add(result); - } - } - }); - - // Failure: Add a property with the same name twice - doTestInTransaction(new FailureTest - ( - "Can not create a property with the same id twice", - CustomMetadataException.class - ) - { - @Override - public void run() throws Exception - { - rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), - ASPECT_RECORD, - "Label1", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - }); - - // Failure: Try and add a property to a type that isn't customisable - doTestInTransaction(new FailureTest - ( - "Can not add a custom property to a type that isn't registered as customisable", - CustomMetadataException.class - ) - { - @Override - public void run() throws Exception - { - rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myContentProp"), - TYPE_CONTENT, - "Label1", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - }); - } - - /** - * @see RecordsManagementAdminService#makeCustomisable(QName) - */ - public void testMakeCustomisable() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - // Make a type customisable - assertFalse(rmAdminService.isCustomisable(TYPE_CUSTOM_TYPE)); - rmAdminService.makeCustomisable(TYPE_CUSTOM_TYPE); - madeCustomisable.add(TYPE_CUSTOM_TYPE); - assertTrue(rmAdminService.isCustomisable(TYPE_CUSTOM_TYPE)); - - // Add a custom property - return rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), - TYPE_CUSTOM_TYPE, - "Label", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - - @Override - public void test(QName result) throws Exception - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), result); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(TYPE_CUSTOM_TYPE); - assertNotNull(propDefs); - assertEquals(1, propDefs.size()); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label", propDef.getTitle(dictionaryService)); - - } - }); - - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - // Make an aspect customisable - assertFalse(rmAdminService.isCustomisable(ASPECT_CUSTOM_ASPECT)); - rmAdminService.makeCustomisable(ASPECT_CUSTOM_ASPECT); - madeCustomisable.add(ASPECT_CUSTOM_ASPECT); - assertTrue(rmAdminService.isCustomisable(ASPECT_CUSTOM_ASPECT)); - - // Add a custom property - return rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), - ASPECT_CUSTOM_ASPECT, - "Label", - DataTypeDefinition.TEXT, - "Title", - "Description"); - } - - @Override - public void test(QName result) throws Exception - { - // Check the property QName is correct - assertNotNull(result); - assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), result); - assertTrue(rmAdminService.existsCustomProperty(result)); - - // Check that property is available as a custom property - Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_CUSTOM_ASPECT); - assertNotNull(propDefs); - assertEquals(1, propDefs.size()); - assertTrue(propDefs.containsKey(result)); - - // Check the property definition - PropertyDefinition propDef = propDefs.get(result); - assertNotNull(propDef); - assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); - assertEquals("Description", propDef.getDescription(dictionaryService)); - assertEquals("Label", propDef.getTitle(dictionaryService)); - } - }); - } - - public void testUseCustomProperty() throws Exception - { - // Create custom property on type and aspect - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - rmAdminService.makeCustomisable(TYPE_CUSTOM_TYPE); - madeCustomisable.add(TYPE_CUSTOM_TYPE); - rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), - TYPE_CUSTOM_TYPE, - "Label", - DataTypeDefinition.TEXT, - "Title", - "Description"); - rmAdminService.makeCustomisable(ASPECT_CUSTOM_ASPECT); - madeCustomisable.add(ASPECT_CUSTOM_ASPECT); - rmAdminService.addCustomPropertyDefinition( - QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), - ASPECT_CUSTOM_ASPECT, - "Label", - DataTypeDefinition.TEXT, - "Title", - "Description"); - - return null; - } - }); - - // Create nodes using custom type and aspect - doTestInTransaction(new Test() - { - @Override - public QName run() throws Exception - { - NodeRef customInstance1 = nodeService.createNode( - folder, - ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myCustomInstance1"), - TYPE_CUSTOM_TYPE).getChildRef(); - NodeRef customInstance2 = nodeService.createNode( - folder, - ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myCustomInstance2"), - TYPE_CONTENT).getChildRef(); - nodeService.addAspect(customInstance2, ASPECT_CUSTOM_ASPECT, null); - - // Assert that both instances have the custom aspects applied - assertTrue(nodeService.hasAspect(customInstance1, QName.createQName(RM_CUSTOM_URI, "rmtcustomTypeCustomProperties"))); - assertTrue(nodeService.hasAspect(customInstance2, QName.createQName(RM_CUSTOM_URI, "rmtcustomAspectCustomProperties"))); - - // Remove the custom aspect - nodeService.removeAspect(customInstance2, ASPECT_CUSTOM_ASPECT); - - // Assert the custom property aspect is no longer applied applied - assertTrue(nodeService.hasAspect(customInstance1, QName.createQName(RM_CUSTOM_URI, "rmtcustomTypeCustomProperties"))); - assertFalse(nodeService.hasAspect(customInstance2, QName.createQName(RM_CUSTOM_URI, "rmtcustomAspectCustomProperties"))); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - - public void testCreateAndUseCustomChildReference() throws Exception - { - long now = System.currentTimeMillis(); - createAndUseCustomReference(RelationshipType.PARENTCHILD, null, "superseded" + now, "superseding" + now); - } - - public void testCreateAndUseCustomNonChildReference() throws Exception - { - long now = System.currentTimeMillis(); - createAndUseCustomReference(RelationshipType.BIDIRECTIONAL, "supporting" + now, null, null); - } - - private void createAndUseCustomReference(final RelationshipType refType, final String label, final String source, final String target) throws Exception - { - final NodeRef testRecord1 = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public NodeRef execute() throws Throwable - { - NodeRef result = utils.createRecord(rmFolder, "testRecordA" + System.currentTimeMillis()); - return result; - } - }); - final NodeRef testRecord2 = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public NodeRef execute() throws Throwable - { - NodeRef result = utils.createRecord(rmFolder, "testRecordB" + System.currentTimeMillis()); - return result; - } - }); - - final QName generatedQName = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public QName execute() throws Throwable - { - utils.completeRecord(testRecord1); - utils.completeRecord(testRecord2); - - Map params = new HashMap(); - params.put("referenceType", refType.toString()); - if (label != null) params.put("label", label); - if (source != null) params.put("source", source); - if (target != null) params.put("target", target); - - // Create the relationship display name - RelationshipDisplayName displayName; - if (label != null) - { - // A bidirectional reference - displayName = new RelationshipDisplayName(label, label); - } - else - { - // A parent/child reference - displayName = new RelationshipDisplayName(source, target); - } - - // Create the relationship definition - RelationshipDefinition relationshipDefinition = relationshipService.createRelationshipDefinition(displayName); - - // Get the qualified name - QName qNameResult = QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), namespaceService);; - - System.out.println("Creating new " + refType + " reference definition: " + qNameResult); - System.out.println(" params- label: '" + label + "' source: '" + source + "' target: '" + target + "'"); - - return qNameResult; - } - }); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - RelationshipDefinition relationshipDefinition = relationshipService.getRelationshipDefinition(generatedQName.getLocalName()); - assertNotNull("Relationship definition from relationshipService was null.", relationshipDefinition); - assertEquals(generatedQName.getLocalName(), relationshipDefinition.getUniqueName()); - assertTrue(refType.equals(relationshipDefinition.getType())); - - // Now we need to use the custom reference. - // So we apply the aspect containing it to our test records. - nodeService.addAspect(testRecord1, ASPECT_CUSTOM_ASSOCIATIONS, null); - - if (RelationshipType.PARENTCHILD.equals(refType)) - { - nodeService.addChild(testRecord1, testRecord2, generatedQName, generatedQName); - } - else - { - nodeService.createAssociation(testRecord1, testRecord2, generatedQName); - } - return null; - } - }); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Read back the reference value to make sure it was correctly applied. - List childAssocs = nodeService.getChildAssocs(testRecord1); - List retrievedAssocs = nodeService.getTargetAssocs(testRecord1, RegexQNamePattern.MATCH_ALL); - - Object newlyAddedRef = null; - if (RelationshipType.PARENTCHILD.equals(refType)) - { - for (ChildAssociationRef caRef : childAssocs) - { - QName refInstanceQName = caRef.getQName(); - if (generatedQName.equals(refInstanceQName)) newlyAddedRef = caRef; - } - } - else - { - for (AssociationRef aRef : retrievedAssocs) - { - QName refQName = aRef.getTypeQName(); - if (generatedQName.equals(refQName)) newlyAddedRef = aRef; - } - } - assertNotNull("newlyAddedRef was null.", newlyAddedRef); - - // Check that the reference has appeared in the data dictionary - AspectDefinition customAssocsAspect = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); - assertNotNull(customAssocsAspect); - if (RelationshipType.PARENTCHILD.equals(refType)) - { - assertNotNull("The customReference is not returned from the dictionaryService.", - customAssocsAspect.getChildAssociations().get(generatedQName)); - } - else - { - assertNotNull("The customReference is not returned from the dictionaryService.", - customAssocsAspect.getAssociations().get(generatedQName)); - } - return null; - } - }); - } - - public void testGetAllProperties() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Just dump them out for visual inspection - System.out.println("Available custom properties:"); - Map props = rmAdminService.getCustomPropertyDefinitions(); - for (QName prop : props.keySet()) - { - System.out.println(" - " + prop.toString()); - - String propId = props.get(prop).getTitle(dictionaryService); - assertNotNull("null client-id for " + prop, propId); - - System.out.println(" " + propId); - } - return null; - } - }); - } - - public void testGetAllReferences() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Just dump them out for visual inspection - System.out.println("Available relationship definitions:"); - Set relationshipDefinitions = relationshipService.getRelationshipDefinitions(); - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) - { - String uniqueName = relationshipDefinition.getUniqueName(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - - System.out.println(" - " + uniqueName); - System.out.println(" " + displayName.toString()); - } - - return null; - } - }); - } - - public void testGetAllConstraints() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - // Just dump them out for visual inspection - System.out.println("Available custom constraints:"); - List constraints = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); - for (ConstraintDefinition constraint : constraints) - { - System.out.println(" - " + constraint.getName()); - System.out.println(" " + constraint.getTitle(dictionaryService)); - } - return null; - } - }); - } - - private boolean beforeMarker = false; - private boolean onMarker = false; - @SuppressWarnings("unused") - private boolean inTest = false; - - public void testCreateReference() throws Exception - { - inTest = true; - try - { - // Create the necessary test objects in the db: two records. - final Pair testRecords = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback>() - { - public Pair execute() throws Throwable - { - NodeRef rec1 = utils.createRecord(rmFolder, "testRecordA" + System.currentTimeMillis()); - NodeRef rec2 = utils.createRecord(rmFolder, "testRecordB" + System.currentTimeMillis()); - Pair result = new Pair(rec1, rec2); - return result; - } - }); - final NodeRef testRecord1 = testRecords.getFirst(); - final NodeRef testRecord2 = testRecords.getSecond(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - utils.completeRecord(testRecord1); - utils.completeRecord(testRecord2); - - policyComponent.bindClassBehaviour( - RecordsManagementPolicies.BEFORE_CREATE_REFERENCE, - this, - new JavaBehaviour(RecordsManagementAdminServiceImplTest.this, "beforeCreateReference", NotificationFrequency.EVERY_EVENT)); - policyComponent.bindClassBehaviour( - RecordsManagementPolicies.ON_CREATE_REFERENCE, - this, - new JavaBehaviour(RecordsManagementAdminServiceImplTest.this, "onCreateReference", NotificationFrequency.EVERY_EVENT)); - - assertFalse(beforeMarker); - assertFalse(onMarker); - - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), testRecord1, testRecord2); - - assertTrue(beforeMarker); - assertTrue(onMarker); - return null; - } - }); - } - finally - { - inTest = false; - } - } - - public void beforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) - { - beforeMarker = true; - } - - public void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) - { - onMarker = true; - } - - public void testCreateCustomConstraints() throws Exception - { - final int beforeCnt = - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Integer execute() throws Throwable - { - List result = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); - assertNotNull(result); - return result.size(); - } - }); - - final String conTitle = "test title - "+testRunID; - final List allowedValues = new ArrayList(3); - allowedValues.add("RED"); - allowedValues.add("AMBER"); - allowedValues.add("GREEN"); - - final QName testCon = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public QName execute() throws Throwable - { - String conLocalName = "test-"+testRunID; - - final QName result = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, conLocalName); - - rmAdminService.addCustomConstraintDefinition(result, conTitle, true, allowedValues, MatchLogic.AND); - return result; - } - }); - - - // Set the current security context as System - to see allowed values (unless caveat config is also updated for admin) - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List customConstraintDefs = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); - assertEquals(beforeCnt+1, customConstraintDefs.size()); - - boolean found = false; - for (ConstraintDefinition conDef : customConstraintDefs) - { - if (conDef.getName().equals(testCon)) - { - assertEquals(conTitle, conDef.getTitle(dictionaryService)); - - Constraint con = conDef.getConstraint(); - assertTrue(con instanceof RMListOfValuesConstraint); - - assertEquals("LIST", ((RMListOfValuesConstraint)con).getType()); - assertEquals(3, ((RMListOfValuesConstraint)con).getAllowedValues().size()); - - found = true; - break; - } - } - assertTrue(found); - return null; - } - }); - - - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - allowedValues.clear(); - allowedValues.add("RED"); - allowedValues.add("YELLOW"); - - rmAdminService.changeCustomConstraintValues(testCon, allowedValues); - return null; - } - }); - - // Set the current security context as System - to see allowed values (unless caveat config is also updated for admin) - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List customConstraintDefs = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); - assertEquals(beforeCnt+1, customConstraintDefs.size()); - - boolean found = false; - for (ConstraintDefinition conDef : customConstraintDefs) - { - if (conDef.getName().equals(testCon)) - { - assertEquals(conTitle, conDef.getTitle(dictionaryService)); - - Constraint con = conDef.getConstraint(); - assertTrue(con instanceof RMListOfValuesConstraint); - - assertEquals("LIST", ((RMListOfValuesConstraint)con).getType()); - assertEquals(2, ((RMListOfValuesConstraint)con).getAllowedValues().size()); - - found = true; - break; - } - } - assertTrue(found); - return null; - } - }); - - - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - // Add custom property to record with test constraint - retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - String propLocalName = "myProp-"+testRunID; - - QName dataType = DataTypeDefinition.TEXT; - String propTitle = "My property title"; - String description = "My property description"; - String defaultValue = null; - boolean multiValued = false; - boolean mandatory = false; - boolean isProtected = false; - - QName propName = rmAdminService.addCustomPropertyDefinition(null, ASPECT_RECORD, propLocalName, dataType, propTitle, description, defaultValue, multiValued, mandatory, isProtected, testCon); - createdCustomProperties.add(propName); - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeCreateReference; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; +import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.Constraint; +import org.alfresco.service.cmr.dictionary.ConstraintDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.Pair; +import org.springframework.util.CollectionUtils; + +/** + * This test class tests the definition and use of a custom RM elements at the Java services layer. + * + * @author Neil McErlean, janv, Roy Wetherall + */ +public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase + implements RecordsManagementModel, + BeforeCreateReference, + OnCreateReference +{ + + private final static long testRunID = System.currentTimeMillis(); + + private List createdCustomProperties; + private List madeCustomisable; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setUp() + */ + @Override + protected void setUp() throws Exception + { + createdCustomProperties = new ArrayList(); + madeCustomisable = new ArrayList(); + super.setUp(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestData() + */ + @Override + protected void setupTestData() + { + super.setupTestData(); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDown() + */ + @Override + protected void tearDown() throws Exception + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + // As system user + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + for (QName createdCustomProperty : createdCustomProperties) + { + rmAdminService.removeCustomPropertyDefinition(createdCustomProperty); + } + + for (QName customisable : madeCustomisable) + { + rmAdminService.unmakeCustomisable(customisable); + } + + return null; + } + }); + + super.tearDown(); + } + + /** + * @see RecordsManagementAdminService#getCustomisable() + */ + public void testGetCustomisable() throws Exception + { + // Get the customisable types + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + Set list = rmAdminService.getCustomisable(); + assertNotNull(list); + assertTrue(list.containsAll( + CollectionUtils.arrayToList(new QName[] + { + ASPECT_RECORD, + TYPE_RECORD_FOLDER, + TYPE_NON_ELECTRONIC_DOCUMENT, + TYPE_RECORD_CATEGORY + }))); + + return null; + } + }); + } + + /** + * @see RecordsManagementAdminService#isCustomisable(QName) + */ + public void testIsCustomisable() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + assertFalse(rmAdminService.isCustomisable(TYPE_CONTENT)); + assertFalse(rmAdminService.isCustomisable(ASPECT_DUBLINCORE)); + assertTrue(rmAdminService.isCustomisable(TYPE_RECORD_FOLDER)); + assertTrue(rmAdminService.isCustomisable(ASPECT_RECORD)); + + return null; + } + }); + } + + /** + * @see RecordsManagementAdminService#existsCustomProperty(QName) + * @see RecordsManagementAdminService#addCustomPropertyDefinition(QName, QName, String, QName, String, String, String, boolean, boolean, boolean, QName) + * @see RecordsManagementAdminService#addCustomPropertyDefinition(QName, QName, String, QName, String, String) + */ + public void testAddCustomPropertyDefinition() throws Exception + { + // Add property to Record (id specified, short version) + doTestInTransaction(new Test() + { + @Override + public QName run() throws Exception + { + // Check the property does not exist + assertFalse(rmAdminService.existsCustomProperty(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"))); + + return rmAdminService.addCustomPropertyDefinition( + QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), + ASPECT_RECORD, + "Label1", + DataTypeDefinition.TEXT, + "Title", + "Description"); + } + + @Override + public void test(QName result) throws Exception + { + try + { + // Check the property QName is correct + assertNotNull(result); + assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), result); + assertTrue(rmAdminService.existsCustomProperty(result)); + + // Check that property is available as a custom property + Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); + assertNotNull(propDefs); + assertTrue(propDefs.containsKey(result)); + + // Check the property definition + PropertyDefinition propDef = propDefs.get(result); + assertNotNull(propDef); + assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); + assertEquals("Description", propDef.getDescription(dictionaryService)); + assertEquals("Label1", propDef.getTitle(dictionaryService)); + } + finally + { + // Store the created property for cleanup later + createdCustomProperties.add(result); + } + } + }); + + // Add property to record (no id, short version) + doTestInTransaction(new Test() + { + @Override + public QName run() throws Exception + { + return rmAdminService.addCustomPropertyDefinition( + null, + ASPECT_RECORD, + "Label2", + DataTypeDefinition.TEXT, + "Title", + "Description"); + } + + @Override + public void test(QName result) throws Exception + { + try + { + // Check the property QName is correct + assertNotNull(result); + assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI()); + assertTrue(rmAdminService.existsCustomProperty(result)); + + // Check that property is available as a custom property + Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); + assertNotNull(propDefs); + assertTrue(propDefs.containsKey(result)); + + // Check the property definition + PropertyDefinition propDef = propDefs.get(result); + assertNotNull(propDef); + assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); + assertEquals("Description", propDef.getDescription(dictionaryService)); + assertEquals("Label2", propDef.getTitle(dictionaryService)); + } + finally + { + // Store the created property for cleanup later + createdCustomProperties.add(result); + } + } + }); + + // Add property to record (long version) + doTestInTransaction(new Test() + { + @Override + public QName run() throws Exception + { + return rmAdminService.addCustomPropertyDefinition( + null, + ASPECT_RECORD, + "Label3", + DataTypeDefinition.TEXT, + "Title", + "Description", + "default", + false, + false, + false, + null); + } + + @Override + public void test(QName result) throws Exception + { + try + { + // Check the property QName is correct + assertNotNull(result); + assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI()); + assertTrue(rmAdminService.existsCustomProperty(result)); + + // Check that property is available as a custom property + Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD); + assertNotNull(propDefs); + //assertEquals(3, propDefs.size()); + assertTrue(propDefs.containsKey(result)); + + // Check the property definition + PropertyDefinition propDef = propDefs.get(result); + assertNotNull(propDef); + assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); + assertEquals("Description", propDef.getDescription(dictionaryService)); + assertEquals("Label3", propDef.getTitle(dictionaryService)); + assertEquals("default", propDef.getDefaultValue()); + assertFalse(propDef.isMandatory()); + assertFalse(propDef.isMultiValued()); + assertFalse(propDef.isProtected()); + + } + finally + { + // Store the created property for cleanup later + createdCustomProperties.add(result); + } + } + }); + + // Failure: Add a property with the same name twice + doTestInTransaction(new FailureTest + ( + "Can not create a property with the same id twice", + CustomMetadataException.class + ) + { + @Override + public void run() throws Exception + { + rmAdminService.addCustomPropertyDefinition( + QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), + ASPECT_RECORD, + "Label1", + DataTypeDefinition.TEXT, + "Title", + "Description"); + } + }); + + // Failure: Try and add a property to a type that isn't customisable + doTestInTransaction(new FailureTest + ( + "Can not add a custom property to a type that isn't registered as customisable", + CustomMetadataException.class + ) + { + @Override + public void run() throws Exception + { + rmAdminService.addCustomPropertyDefinition( + QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myContentProp"), + TYPE_CONTENT, + "Label1", + DataTypeDefinition.TEXT, + "Title", + "Description"); + } + }); + } + + /** + * @see RecordsManagementAdminService#makeCustomisable(QName) + */ + public void testMakeCustomisable() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public QName run() throws Exception + { + // Make a type customisable + assertFalse(rmAdminService.isCustomisable(TYPE_CUSTOM_TYPE)); + rmAdminService.makeCustomisable(TYPE_CUSTOM_TYPE); + madeCustomisable.add(TYPE_CUSTOM_TYPE); + assertTrue(rmAdminService.isCustomisable(TYPE_CUSTOM_TYPE)); + + // Add a custom property + return rmAdminService.addCustomPropertyDefinition( + QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), + TYPE_CUSTOM_TYPE, + "Label", + DataTypeDefinition.TEXT, + "Title", + "Description"); + } + + @Override + public void test(QName result) throws Exception + { + // Check the property QName is correct + assertNotNull(result); + assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), result); + assertTrue(rmAdminService.existsCustomProperty(result)); + + // Check that property is available as a custom property + Map propDefs = rmAdminService.getCustomPropertyDefinitions(TYPE_CUSTOM_TYPE); + assertNotNull(propDefs); + assertEquals(1, propDefs.size()); + assertTrue(propDefs.containsKey(result)); + + // Check the property definition + PropertyDefinition propDef = propDefs.get(result); + assertNotNull(propDef); + assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); + assertEquals("Description", propDef.getDescription(dictionaryService)); + assertEquals("Label", propDef.getTitle(dictionaryService)); + + } + }); + + doTestInTransaction(new Test() + { + @Override + public QName run() throws Exception + { + // Make an aspect customisable + assertFalse(rmAdminService.isCustomisable(ASPECT_CUSTOM_ASPECT)); + rmAdminService.makeCustomisable(ASPECT_CUSTOM_ASPECT); + madeCustomisable.add(ASPECT_CUSTOM_ASPECT); + assertTrue(rmAdminService.isCustomisable(ASPECT_CUSTOM_ASPECT)); + + // Add a custom property + return rmAdminService.addCustomPropertyDefinition( + QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), + ASPECT_CUSTOM_ASPECT, + "Label", + DataTypeDefinition.TEXT, + "Title", + "Description"); + } + + @Override + public void test(QName result) throws Exception + { + // Check the property QName is correct + assertNotNull(result); + assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), result); + assertTrue(rmAdminService.existsCustomProperty(result)); + + // Check that property is available as a custom property + Map propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_CUSTOM_ASPECT); + assertNotNull(propDefs); + assertEquals(1, propDefs.size()); + assertTrue(propDefs.containsKey(result)); + + // Check the property definition + PropertyDefinition propDef = propDefs.get(result); + assertNotNull(propDef); + assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName()); + assertEquals("Description", propDef.getDescription(dictionaryService)); + assertEquals("Label", propDef.getTitle(dictionaryService)); + } + }); + } + + public void testUseCustomProperty() throws Exception + { + // Create custom property on type and aspect + doTestInTransaction(new Test() + { + @Override + public QName run() throws Exception + { + rmAdminService.makeCustomisable(TYPE_CUSTOM_TYPE); + madeCustomisable.add(TYPE_CUSTOM_TYPE); + rmAdminService.addCustomPropertyDefinition( + QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), + TYPE_CUSTOM_TYPE, + "Label", + DataTypeDefinition.TEXT, + "Title", + "Description"); + rmAdminService.makeCustomisable(ASPECT_CUSTOM_ASPECT); + madeCustomisable.add(ASPECT_CUSTOM_ASPECT); + rmAdminService.addCustomPropertyDefinition( + QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), + ASPECT_CUSTOM_ASPECT, + "Label", + DataTypeDefinition.TEXT, + "Title", + "Description"); + + return null; + } + }); + + // Create nodes using custom type and aspect + doTestInTransaction(new Test() + { + @Override + public QName run() throws Exception + { + NodeRef customInstance1 = nodeService.createNode( + folder, + ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myCustomInstance1"), + TYPE_CUSTOM_TYPE).getChildRef(); + NodeRef customInstance2 = nodeService.createNode( + folder, + ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "myCustomInstance2"), + TYPE_CONTENT).getChildRef(); + nodeService.addAspect(customInstance2, ASPECT_CUSTOM_ASPECT, null); + + // Assert that both instances have the custom aspects applied + assertTrue(nodeService.hasAspect(customInstance1, QName.createQName(RM_CUSTOM_URI, "rmtcustomTypeCustomProperties"))); + assertTrue(nodeService.hasAspect(customInstance2, QName.createQName(RM_CUSTOM_URI, "rmtcustomAspectCustomProperties"))); + + // Remove the custom aspect + nodeService.removeAspect(customInstance2, ASPECT_CUSTOM_ASPECT); + + // Assert the custom property aspect is no longer applied applied + assertTrue(nodeService.hasAspect(customInstance1, QName.createQName(RM_CUSTOM_URI, "rmtcustomTypeCustomProperties"))); + assertFalse(nodeService.hasAspect(customInstance2, QName.createQName(RM_CUSTOM_URI, "rmtcustomAspectCustomProperties"))); + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + + public void testCreateAndUseCustomChildReference() throws Exception + { + long now = System.currentTimeMillis(); + createAndUseCustomReference(RelationshipType.PARENTCHILD, null, "superseded" + now, "superseding" + now); + } + + public void testCreateAndUseCustomNonChildReference() throws Exception + { + long now = System.currentTimeMillis(); + createAndUseCustomReference(RelationshipType.BIDIRECTIONAL, "supporting" + now, null, null); + } + + private void createAndUseCustomReference(final RelationshipType refType, final String label, final String source, final String target) throws Exception + { + final NodeRef testRecord1 = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public NodeRef execute() throws Throwable + { + NodeRef result = utils.createRecord(rmFolder, "testRecordA" + System.currentTimeMillis()); + return result; + } + }); + final NodeRef testRecord2 = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public NodeRef execute() throws Throwable + { + NodeRef result = utils.createRecord(rmFolder, "testRecordB" + System.currentTimeMillis()); + return result; + } + }); + + final QName generatedQName = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public QName execute() throws Throwable + { + utils.completeRecord(testRecord1); + utils.completeRecord(testRecord2); + + Map params = new HashMap(); + params.put("referenceType", refType.toString()); + if (label != null) params.put("label", label); + if (source != null) params.put("source", source); + if (target != null) params.put("target", target); + + // Create the relationship display name + RelationshipDisplayName displayName; + if (label != null) + { + // A bidirectional reference + displayName = new RelationshipDisplayName(label, label); + } + else + { + // A parent/child reference + displayName = new RelationshipDisplayName(source, target); + } + + // Create the relationship definition + RelationshipDefinition relationshipDefinition = relationshipService.createRelationshipDefinition(displayName); + + // Get the qualified name + QName qNameResult = QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), namespaceService);; + + System.out.println("Creating new " + refType + " reference definition: " + qNameResult); + System.out.println(" params- label: '" + label + "' source: '" + source + "' target: '" + target + "'"); + + return qNameResult; + } + }); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + RelationshipDefinition relationshipDefinition = relationshipService.getRelationshipDefinition(generatedQName.getLocalName()); + assertNotNull("Relationship definition from relationshipService was null.", relationshipDefinition); + assertEquals(generatedQName.getLocalName(), relationshipDefinition.getUniqueName()); + assertTrue(refType.equals(relationshipDefinition.getType())); + + // Now we need to use the custom reference. + // So we apply the aspect containing it to our test records. + nodeService.addAspect(testRecord1, ASPECT_CUSTOM_ASSOCIATIONS, null); + + if (RelationshipType.PARENTCHILD.equals(refType)) + { + nodeService.addChild(testRecord1, testRecord2, generatedQName, generatedQName); + } + else + { + nodeService.createAssociation(testRecord1, testRecord2, generatedQName); + } + return null; + } + }); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + // Read back the reference value to make sure it was correctly applied. + List childAssocs = nodeService.getChildAssocs(testRecord1); + List retrievedAssocs = nodeService.getTargetAssocs(testRecord1, RegexQNamePattern.MATCH_ALL); + + Object newlyAddedRef = null; + if (RelationshipType.PARENTCHILD.equals(refType)) + { + for (ChildAssociationRef caRef : childAssocs) + { + QName refInstanceQName = caRef.getQName(); + if (generatedQName.equals(refInstanceQName)) newlyAddedRef = caRef; + } + } + else + { + for (AssociationRef aRef : retrievedAssocs) + { + QName refQName = aRef.getTypeQName(); + if (generatedQName.equals(refQName)) newlyAddedRef = aRef; + } + } + assertNotNull("newlyAddedRef was null.", newlyAddedRef); + + // Check that the reference has appeared in the data dictionary + AspectDefinition customAssocsAspect = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); + assertNotNull(customAssocsAspect); + if (RelationshipType.PARENTCHILD.equals(refType)) + { + assertNotNull("The customReference is not returned from the dictionaryService.", + customAssocsAspect.getChildAssociations().get(generatedQName)); + } + else + { + assertNotNull("The customReference is not returned from the dictionaryService.", + customAssocsAspect.getAssociations().get(generatedQName)); + } + return null; + } + }); + } + + public void testGetAllProperties() + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + // Just dump them out for visual inspection + System.out.println("Available custom properties:"); + Map props = rmAdminService.getCustomPropertyDefinitions(); + for (QName prop : props.keySet()) + { + System.out.println(" - " + prop.toString()); + + String propId = props.get(prop).getTitle(dictionaryService); + assertNotNull("null client-id for " + prop, propId); + + System.out.println(" " + propId); + } + return null; + } + }); + } + + public void testGetAllReferences() + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + // Just dump them out for visual inspection + System.out.println("Available relationship definitions:"); + Set relationshipDefinitions = relationshipService.getRelationshipDefinitions(); + for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) + { + String uniqueName = relationshipDefinition.getUniqueName(); + RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); + + System.out.println(" - " + uniqueName); + System.out.println(" " + displayName.toString()); + } + + return null; + } + }); + } + + public void testGetAllConstraints() + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + // Just dump them out for visual inspection + System.out.println("Available custom constraints:"); + List constraints = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); + for (ConstraintDefinition constraint : constraints) + { + System.out.println(" - " + constraint.getName()); + System.out.println(" " + constraint.getTitle(dictionaryService)); + } + return null; + } + }); + } + + private boolean beforeMarker = false; + private boolean onMarker = false; + @SuppressWarnings("unused") + private boolean inTest = false; + + public void testCreateReference() throws Exception + { + inTest = true; + try + { + // Create the necessary test objects in the db: two records. + final Pair testRecords = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback>() + { + public Pair execute() throws Throwable + { + NodeRef rec1 = utils.createRecord(rmFolder, "testRecordA" + System.currentTimeMillis()); + NodeRef rec2 = utils.createRecord(rmFolder, "testRecordB" + System.currentTimeMillis()); + Pair result = new Pair(rec1, rec2); + return result; + } + }); + final NodeRef testRecord1 = testRecords.getFirst(); + final NodeRef testRecord2 = testRecords.getSecond(); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + utils.completeRecord(testRecord1); + utils.completeRecord(testRecord2); + + policyComponent.bindClassBehaviour( + RecordsManagementPolicies.BEFORE_CREATE_REFERENCE, + this, + new JavaBehaviour(RecordsManagementAdminServiceImplTest.this, "beforeCreateReference", NotificationFrequency.EVERY_EVENT)); + policyComponent.bindClassBehaviour( + RecordsManagementPolicies.ON_CREATE_REFERENCE, + this, + new JavaBehaviour(RecordsManagementAdminServiceImplTest.this, "onCreateReference", NotificationFrequency.EVERY_EVENT)); + + assertFalse(beforeMarker); + assertFalse(onMarker); + + relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), testRecord1, testRecord2); + + assertTrue(beforeMarker); + assertTrue(onMarker); + return null; + } + }); + } + finally + { + inTest = false; + } + } + + public void beforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + { + beforeMarker = true; + } + + public void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + { + onMarker = true; + } + + public void testCreateCustomConstraints() throws Exception + { + final int beforeCnt = + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Integer execute() throws Throwable + { + List result = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); + assertNotNull(result); + return result.size(); + } + }); + + final String conTitle = "test title - "+testRunID; + final List allowedValues = new ArrayList(3); + allowedValues.add("RED"); + allowedValues.add("AMBER"); + allowedValues.add("GREEN"); + + final QName testCon = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public QName execute() throws Throwable + { + String conLocalName = "test-"+testRunID; + + final QName result = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, conLocalName); + + rmAdminService.addCustomConstraintDefinition(result, conTitle, true, allowedValues, MatchLogic.AND); + return result; + } + }); + + + // Set the current security context as System - to see allowed values (unless caveat config is also updated for admin) + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + List customConstraintDefs = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); + assertEquals(beforeCnt+1, customConstraintDefs.size()); + + boolean found = false; + for (ConstraintDefinition conDef : customConstraintDefs) + { + if (conDef.getName().equals(testCon)) + { + assertEquals(conTitle, conDef.getTitle(dictionaryService)); + + Constraint con = conDef.getConstraint(); + assertTrue(con instanceof RMListOfValuesConstraint); + + assertEquals("LIST", ((RMListOfValuesConstraint)con).getType()); + assertEquals(3, ((RMListOfValuesConstraint)con).getAllowedValues().size()); + + found = true; + break; + } + } + assertTrue(found); + return null; + } + }); + + + // Set the current security context as admin + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + allowedValues.clear(); + allowedValues.add("RED"); + allowedValues.add("YELLOW"); + + rmAdminService.changeCustomConstraintValues(testCon, allowedValues); + return null; + } + }); + + // Set the current security context as System - to see allowed values (unless caveat config is also updated for admin) + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + List customConstraintDefs = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL); + assertEquals(beforeCnt+1, customConstraintDefs.size()); + + boolean found = false; + for (ConstraintDefinition conDef : customConstraintDefs) + { + if (conDef.getName().equals(testCon)) + { + assertEquals(conTitle, conDef.getTitle(dictionaryService)); + + Constraint con = conDef.getConstraint(); + assertTrue(con instanceof RMListOfValuesConstraint); + + assertEquals("LIST", ((RMListOfValuesConstraint)con).getType()); + assertEquals(2, ((RMListOfValuesConstraint)con).getAllowedValues().size()); + + found = true; + break; + } + } + assertTrue(found); + return null; + } + }); + + + // Set the current security context as admin + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + + // Add custom property to record with test constraint + retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + String propLocalName = "myProp-"+testRunID; + + QName dataType = DataTypeDefinition.TEXT; + String propTitle = "My property title"; + String description = "My property description"; + String defaultValue = null; + boolean multiValued = false; + boolean mandatory = false; + boolean isProtected = false; + + QName propName = rmAdminService.addCustomPropertyDefinition(null, ASPECT_RECORD, propLocalName, dataType, propTitle, description, defaultValue, multiValued, mandatory, isProtected, testCon); + createdCustomProperties.add(propName); + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAuditServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAuditServiceImplTest.java index 311d6e2aeb..50511302a7 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAuditServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAuditServiceImplTest.java @@ -1,509 +1,509 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditEntry; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationException; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.EqualsHelper; -import org.alfresco.util.Pair; - -/** - * @see RecordsManagementAuditService - * - * @author Derek Hulley - * @author Roy Wetherall - * - * @since 3.2 - */ -public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase - implements RMPermissionModel -{ - /** Test record */ - private NodeRef record; - - /** Test start time */ - private Date testStartTime; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setUp() - */ - @Override - protected void setUp() throws Exception - { - super.setUp(); - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // test start time recorded - testStartTime = new Date(); - - // Stop and clear the log - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - rmAuditService.startAuditLog(filePlan); - - // check that audit service is started - assertTrue(rmAuditService.isAuditLogEnabled(filePlan)); - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestDataImpl() - */ - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - record = utils.createRecord(rmFolder, "AuditTest.txt"); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Give all the users file permission objects - for (String user : testUsers) - { - filePlanPermissionService.setPermission(filePlan, user, FILING); - filePlanPermissionService.setPermission(rmContainer, user, FILING); - } - } - - public void testGetAuditEvents() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - List events = rmAuditService.getAuditEvents(); - - System.out.println("Found audit events:"); - for (AuditEvent event : events) - { - System.out.println(" - " + event.getName() + " (" + event.getLabel() + ")"); - } - - return null; - } - }, ADMIN_USER); - } - - /** - * Test getAuditTrail method to check that deleted items always show in the audit. - * - * @see RM-2391 (last addressed isue) - */ - public void testGetAuditTrailForDeletedItem() - { - // We have only one entry for the event "audit.start": - List entries = getAuditTrail(1, ADMIN_USER); - - assertEquals(entries.get(0).getEvent(), "audit.start"); - - // Event "audit.view" was generated but will be visible on the next call to getAuditTrail(). - - // Make a change: - updateTitle(filePlan, ADMIN_USER); // event=Update RM Object - - // Show the audit has been updated; at this point we have three entries for the three events up to now: - // "audit.start", "audit.view" and "Update RM Object"; - entries = getAuditTrail(3, ADMIN_USER); - - assertEquals(entries.get(0).getEvent(), "audit.start"); - assertEquals(entries.get(1).getEvent(), "audit.view"); - assertEquals(entries.get(2).getEvent(), "Update RM Object"); - - // New "audit.view" event was generated - will be visible on next getAuditTrail(). - - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - nodeService.deleteNode(record); - List entries = getAuditTrail(5, ADMIN_USER); - - assertEquals(entries.get(0).getEvent(), "audit.start"); - assertEquals(entries.get(1).getEvent(), "audit.view"); - assertEquals(entries.get(2).getEvent(), "Update RM Object"); - assertEquals(entries.get(3).getEvent(), "audit.view"); - - // Show the audit contains a reference to the deleted item: - assertEquals(entries.get(4).getEvent(), "Delete RM Object"); - assertEquals(entries.get(4).getNodeRef(), record); - - return null; - } - }); - } - - /** - * Test getAuditTrail method and parameter filters. - */ - public void testGetAuditTrail() - { - // show the audit is empty - getAuditTrail(1, ADMIN_USER); - - // make a change - final String updatedProperty = updateTitle(filePlan, ADMIN_USER); - - // show the audit has been updated - List entries = getAuditTrail(3, ADMIN_USER); - final RecordsManagementAuditEntry entry = entries.get(2); - assertNotNull(entry); - - // investigate the contents of the audit entry - doTestInTransaction(new Test() - { - @SuppressWarnings("unchecked") - @Override - public Void run() throws Exception - { - assertEquals(filePlan, entry.getNodeRef()); - - String id = (String)nodeService.getProperty(filePlan, PROP_IDENTIFIER); - assertEquals(id, entry.getIdentifier()); - - Map after = entry.getAfterProperties(); - Map> changed = entry.getChangedProperties(); - - assertTrue(after.containsKey(PROP_TITLE)); - assertTrue(changed.containsKey(PROP_TITLE)); - - Serializable value = ((Map)after.get(PROP_TITLE)).get(Locale.ENGLISH); - assertEquals(updatedProperty, value); - value = ((Map)changed.get(PROP_TITLE).getSecond()).get(Locale.ENGLISH); - assertEquals(updatedProperty, value); - - return null; - } - }, ADMIN_USER); - - // add some more title updates - updateTitle(rmContainer, ADMIN_USER); - updateTitle(rmFolder, ADMIN_USER); - updateTitle(record, ADMIN_USER); - - // show the audit has been updated - getAuditTrail(7, ADMIN_USER); - - // snap shot date - Date snapShot = new Date(); - - // show the audit results can be limited - RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); - params.setMaxEntries(2); - getAuditTrail(params, 2, ADMIN_USER); - - // test filter by user - updateTitle(rmContainer, recordsManagerName); - updateTitle(rmFolder, recordsManagerName); - updateTitle(record, recordsManagerName); - - params = new RecordsManagementAuditQueryParameters(); - params.setUser(recordsManagerName); - getAuditTrail(params, 3, ADMIN_USER); - - // test filter by date - params = new RecordsManagementAuditQueryParameters(); - params.setDateFrom(snapShot); - getAuditTrail(params, 13, ADMIN_USER); - params = new RecordsManagementAuditQueryParameters(); - params.setDateTo(snapShot); - getAuditTrail(params, 14, ADMIN_USER); - params.setDateFrom(testStartTime); - getAuditTrail(params, 15, ADMIN_USER); - - // test filter by object - updateTitle(record, ADMIN_USER); - updateTitle(record, ADMIN_USER); - updateTitle(record, ADMIN_USER); - params = new RecordsManagementAuditQueryParameters(); - params.setNodeRef(record); - getAuditTrail(params, 5, ADMIN_USER); - - // test filter by event - params = new RecordsManagementAuditQueryParameters(); - // params.setEvent("cutoff"); - // getAuditTrail(params, 0, ADMIN_USER); - params.setEvent("Update RM Object"); - getAuditTrail(params, 10, ADMIN_USER); - - // test filter by property - // params = new RecordsManagementAuditQueryParameters(); - //params.setProperty(PROP_ADDRESSEES); - //getAuditTrail(params, 0, ADMIN_USER); - // params.setProperty(PROP_TITLE); - // getAuditTrail(params, 10, ADMIN_USER); - } - - /** - * Tests the following methods: - * - start() - * - stop() - * - clear() - * - isEnabled() - * - getDateLastStopped() - * - getDateLastStarted() - * - * @throws InterruptedException - */ - public void testAdminMethods() throws InterruptedException - { - // Stop the audit - rmAuditService.stopAuditLog(filePlan); - - Thread.sleep(5000); - - List result1 = getAuditTrail(ADMIN_USER); - assertNotNull(result1); - - // Update the fileplan - updateTitle(filePlan, ADMIN_USER); - - Thread.sleep(5000); - - // There should be no new audit entries - List result2 = getAuditTrail(ADMIN_USER); - assertNotNull(result2); - assertEquals( - "Audit results should not have changed after auditing was disabled", - result1.size(), result2.size()); - - // repeat with a start - rmAuditService.startAuditLog(filePlan); - updateTitle(filePlan, ADMIN_USER); - - Thread.sleep(5000); - - List result3 = getAuditTrail(ADMIN_USER); - assertNotNull(result3); - assertTrue( - "Expected more results after enabling audit", - result3.size() > result1.size()); - - Thread.sleep(5000); - - // Stop and delete all entries - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - - // There should be no entries - List result4 = getAuditTrail(ADMIN_USER); - assertNotNull(result4); - assertEquals( - "Audit entries should have been cleared", - 0, result4.size()); - } - - // TODO testAuditRMAction - - // TODO testGetAuditTrailFile - - // TODO testFileAuditTrailAsRecord - - public void xtestAuditAuthentication() - { - rmAuditService.stopAuditLog(filePlan); - rmAuditService.clearAuditLog(filePlan); - rmAuditService.startAuditLog(filePlan); - - //MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService(); - //PersonService personService = serviceRegistry.getPersonService(); - - try - { - personService.deletePerson("baboon"); - authenticationService.deleteAuthentication("baboon"); - } - catch (Throwable e) - { - // Not serious - } - - // Failed login attempt ... - try - { - AuthenticationUtil.pushAuthentication(); - authenticationService.authenticate("baboon", "lskdfj".toCharArray()); - fail("Expected authentication failure"); - } - catch (AuthenticationException e) - { - // Good - } - finally - { - AuthenticationUtil.popAuthentication(); - } - rmAuditService.stopAuditLog(filePlan); - List result1 = getAuditTrail(ADMIN_USER); - // Check that the username is reflected correctly in the results - assertFalse("No audit results were generated for the failed login.", result1.isEmpty()); - boolean found = false; - for (RecordsManagementAuditEntry entry : result1) - { - String userName = entry.getUserName(); - if (userName.equals("baboon")) - { - found = true; - break; - } - } - assertTrue("Expected to hit failed login attempt for user", found); - - // Test successful authentication - try - { - personService.deletePerson("cdickons"); - authenticationService.deleteAuthentication("cdickons"); - } - catch (Throwable e) - { - // Not serious - } - authenticationService.createAuthentication("cdickons", getName().toCharArray()); - Map personProperties = new HashMap(); - personProperties.put(ContentModel.PROP_USERNAME, "cdickons"); - personProperties.put(ContentModel.PROP_FIRSTNAME, "Charles"); - personProperties.put(ContentModel.PROP_LASTNAME, "Dickons"); - personService.createPerson(personProperties); - - rmAuditService.clearAuditLog(filePlan); - rmAuditService.startAuditLog(filePlan); - try - { - AuthenticationUtil.pushAuthentication(); - authenticationService.authenticate("cdickons", getName().toCharArray()); - } - finally - { - AuthenticationUtil.popAuthentication(); - } - rmAuditService.stopAuditLog(filePlan); - List result2 = getAuditTrail(ADMIN_USER); - found = false; - for (RecordsManagementAuditEntry entry : result2) - { - String userName = entry.getUserName(); - String fullName = entry.getFullName(); - if (userName.equals("cdickons") && EqualsHelper.nullSafeEquals(fullName, "Charles Dickons")) - { - found = true; - break; - } - } - assertTrue("Expected to hit successful login attempt for Charles Dickons (cdickons)", found); - } - - /** === Helper methods === */ - - private List getAuditTrail(String asUser) - { - return getAuditTrail(-1, asUser); - } - - private List getAuditTrail(final int expectedCount, String asUser) - { - return getAuditTrail(new RecordsManagementAuditQueryParameters(), expectedCount, asUser); - } - - private List getAuditTrail(final RecordsManagementAuditQueryParameters params, final int expectedCount, final String asUser) - { - return doTestInTransaction(new Test>() - { - @Override - public List run() throws Exception - { - return rmAuditService.getAuditTrail(params); - } - - @Override - public void test(List result) throws Exception - { - assertNotNull(result); - if (expectedCount != -1) - { - assertEquals(expectedCount, result.size()); - } - } - }, asUser); - } - - private String updateTitle(final NodeRef nodeRef, final String asUser) - { - return doTestInTransaction(new Test() - { - @Override - public String run() throws Exception - { - String updatedProperty = "Updated - " + System.currentTimeMillis(); - nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, updatedProperty); - return updatedProperty; - } - }, asUser); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditEntry; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditQueryParameters; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationException; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.EqualsHelper; +import org.alfresco.util.Pair; + +/** + * @see RecordsManagementAuditService + * + * @author Derek Hulley + * @author Roy Wetherall + * + * @since 3.2 + */ +public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase + implements RMPermissionModel +{ + /** Test record */ + private NodeRef record; + + /** Test start time */ + private Date testStartTime; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setUp() + */ + @Override + protected void setUp() throws Exception + { + super.setUp(); + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // test start time recorded + testStartTime = new Date(); + + // Stop and clear the log + rmAuditService.stopAuditLog(filePlan); + rmAuditService.clearAuditLog(filePlan); + rmAuditService.startAuditLog(filePlan); + + // check that audit service is started + assertTrue(rmAuditService.isAuditLogEnabled(filePlan)); + + return null; + } + }); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() + */ + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestDataImpl() + */ + @Override + protected void setupTestDataImpl() + { + super.setupTestDataImpl(); + + record = utils.createRecord(rmFolder, "AuditTest.txt"); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected void setupTestUsersImpl(NodeRef filePlan) + { + super.setupTestUsersImpl(filePlan); + + // Give all the users file permission objects + for (String user : testUsers) + { + filePlanPermissionService.setPermission(filePlan, user, FILING); + filePlanPermissionService.setPermission(rmContainer, user, FILING); + } + } + + public void testGetAuditEvents() + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + List events = rmAuditService.getAuditEvents(); + + System.out.println("Found audit events:"); + for (AuditEvent event : events) + { + System.out.println(" - " + event.getName() + " (" + event.getLabel() + ")"); + } + + return null; + } + }, ADMIN_USER); + } + + /** + * Test getAuditTrail method to check that deleted items always show in the audit. + * + * @see RM-2391 (last addressed isue) + */ + public void testGetAuditTrailForDeletedItem() + { + // We have only one entry for the event "audit.start": + List entries = getAuditTrail(1, ADMIN_USER); + + assertEquals(entries.get(0).getEvent(), "audit.start"); + + // Event "audit.view" was generated but will be visible on the next call to getAuditTrail(). + + // Make a change: + updateTitle(filePlan, ADMIN_USER); // event=Update RM Object + + // Show the audit has been updated; at this point we have three entries for the three events up to now: + // "audit.start", "audit.view" and "Update RM Object"; + entries = getAuditTrail(3, ADMIN_USER); + + assertEquals(entries.get(0).getEvent(), "audit.start"); + assertEquals(entries.get(1).getEvent(), "audit.view"); + assertEquals(entries.get(2).getEvent(), "Update RM Object"); + + // New "audit.view" event was generated - will be visible on next getAuditTrail(). + + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + nodeService.deleteNode(record); + List entries = getAuditTrail(5, ADMIN_USER); + + assertEquals(entries.get(0).getEvent(), "audit.start"); + assertEquals(entries.get(1).getEvent(), "audit.view"); + assertEquals(entries.get(2).getEvent(), "Update RM Object"); + assertEquals(entries.get(3).getEvent(), "audit.view"); + + // Show the audit contains a reference to the deleted item: + assertEquals(entries.get(4).getEvent(), "Delete RM Object"); + assertEquals(entries.get(4).getNodeRef(), record); + + return null; + } + }); + } + + /** + * Test getAuditTrail method and parameter filters. + */ + public void testGetAuditTrail() + { + // show the audit is empty + getAuditTrail(1, ADMIN_USER); + + // make a change + final String updatedProperty = updateTitle(filePlan, ADMIN_USER); + + // show the audit has been updated + List entries = getAuditTrail(3, ADMIN_USER); + final RecordsManagementAuditEntry entry = entries.get(2); + assertNotNull(entry); + + // investigate the contents of the audit entry + doTestInTransaction(new Test() + { + @SuppressWarnings("unchecked") + @Override + public Void run() throws Exception + { + assertEquals(filePlan, entry.getNodeRef()); + + String id = (String)nodeService.getProperty(filePlan, PROP_IDENTIFIER); + assertEquals(id, entry.getIdentifier()); + + Map after = entry.getAfterProperties(); + Map> changed = entry.getChangedProperties(); + + assertTrue(after.containsKey(PROP_TITLE)); + assertTrue(changed.containsKey(PROP_TITLE)); + + Serializable value = ((Map)after.get(PROP_TITLE)).get(Locale.ENGLISH); + assertEquals(updatedProperty, value); + value = ((Map)changed.get(PROP_TITLE).getSecond()).get(Locale.ENGLISH); + assertEquals(updatedProperty, value); + + return null; + } + }, ADMIN_USER); + + // add some more title updates + updateTitle(rmContainer, ADMIN_USER); + updateTitle(rmFolder, ADMIN_USER); + updateTitle(record, ADMIN_USER); + + // show the audit has been updated + getAuditTrail(7, ADMIN_USER); + + // snap shot date + Date snapShot = new Date(); + + // show the audit results can be limited + RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); + params.setMaxEntries(2); + getAuditTrail(params, 2, ADMIN_USER); + + // test filter by user + updateTitle(rmContainer, recordsManagerName); + updateTitle(rmFolder, recordsManagerName); + updateTitle(record, recordsManagerName); + + params = new RecordsManagementAuditQueryParameters(); + params.setUser(recordsManagerName); + getAuditTrail(params, 3, ADMIN_USER); + + // test filter by date + params = new RecordsManagementAuditQueryParameters(); + params.setDateFrom(snapShot); + getAuditTrail(params, 13, ADMIN_USER); + params = new RecordsManagementAuditQueryParameters(); + params.setDateTo(snapShot); + getAuditTrail(params, 14, ADMIN_USER); + params.setDateFrom(testStartTime); + getAuditTrail(params, 15, ADMIN_USER); + + // test filter by object + updateTitle(record, ADMIN_USER); + updateTitle(record, ADMIN_USER); + updateTitle(record, ADMIN_USER); + params = new RecordsManagementAuditQueryParameters(); + params.setNodeRef(record); + getAuditTrail(params, 5, ADMIN_USER); + + // test filter by event + params = new RecordsManagementAuditQueryParameters(); + // params.setEvent("cutoff"); + // getAuditTrail(params, 0, ADMIN_USER); + params.setEvent("Update RM Object"); + getAuditTrail(params, 10, ADMIN_USER); + + // test filter by property + // params = new RecordsManagementAuditQueryParameters(); + //params.setProperty(PROP_ADDRESSEES); + //getAuditTrail(params, 0, ADMIN_USER); + // params.setProperty(PROP_TITLE); + // getAuditTrail(params, 10, ADMIN_USER); + } + + /** + * Tests the following methods: + * - start() + * - stop() + * - clear() + * - isEnabled() + * - getDateLastStopped() + * - getDateLastStarted() + * + * @throws InterruptedException + */ + public void testAdminMethods() throws InterruptedException + { + // Stop the audit + rmAuditService.stopAuditLog(filePlan); + + Thread.sleep(5000); + + List result1 = getAuditTrail(ADMIN_USER); + assertNotNull(result1); + + // Update the fileplan + updateTitle(filePlan, ADMIN_USER); + + Thread.sleep(5000); + + // There should be no new audit entries + List result2 = getAuditTrail(ADMIN_USER); + assertNotNull(result2); + assertEquals( + "Audit results should not have changed after auditing was disabled", + result1.size(), result2.size()); + + // repeat with a start + rmAuditService.startAuditLog(filePlan); + updateTitle(filePlan, ADMIN_USER); + + Thread.sleep(5000); + + List result3 = getAuditTrail(ADMIN_USER); + assertNotNull(result3); + assertTrue( + "Expected more results after enabling audit", + result3.size() > result1.size()); + + Thread.sleep(5000); + + // Stop and delete all entries + rmAuditService.stopAuditLog(filePlan); + rmAuditService.clearAuditLog(filePlan); + + // There should be no entries + List result4 = getAuditTrail(ADMIN_USER); + assertNotNull(result4); + assertEquals( + "Audit entries should have been cleared", + 0, result4.size()); + } + + // TODO testAuditRMAction + + // TODO testGetAuditTrailFile + + // TODO testFileAuditTrailAsRecord + + public void xtestAuditAuthentication() + { + rmAuditService.stopAuditLog(filePlan); + rmAuditService.clearAuditLog(filePlan); + rmAuditService.startAuditLog(filePlan); + + //MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService(); + //PersonService personService = serviceRegistry.getPersonService(); + + try + { + personService.deletePerson("baboon"); + authenticationService.deleteAuthentication("baboon"); + } + catch (Throwable e) + { + // Not serious + } + + // Failed login attempt ... + try + { + AuthenticationUtil.pushAuthentication(); + authenticationService.authenticate("baboon", "lskdfj".toCharArray()); + fail("Expected authentication failure"); + } + catch (AuthenticationException e) + { + // Good + } + finally + { + AuthenticationUtil.popAuthentication(); + } + rmAuditService.stopAuditLog(filePlan); + List result1 = getAuditTrail(ADMIN_USER); + // Check that the username is reflected correctly in the results + assertFalse("No audit results were generated for the failed login.", result1.isEmpty()); + boolean found = false; + for (RecordsManagementAuditEntry entry : result1) + { + String userName = entry.getUserName(); + if (userName.equals("baboon")) + { + found = true; + break; + } + } + assertTrue("Expected to hit failed login attempt for user", found); + + // Test successful authentication + try + { + personService.deletePerson("cdickons"); + authenticationService.deleteAuthentication("cdickons"); + } + catch (Throwable e) + { + // Not serious + } + authenticationService.createAuthentication("cdickons", getName().toCharArray()); + Map personProperties = new HashMap(); + personProperties.put(ContentModel.PROP_USERNAME, "cdickons"); + personProperties.put(ContentModel.PROP_FIRSTNAME, "Charles"); + personProperties.put(ContentModel.PROP_LASTNAME, "Dickons"); + personService.createPerson(personProperties); + + rmAuditService.clearAuditLog(filePlan); + rmAuditService.startAuditLog(filePlan); + try + { + AuthenticationUtil.pushAuthentication(); + authenticationService.authenticate("cdickons", getName().toCharArray()); + } + finally + { + AuthenticationUtil.popAuthentication(); + } + rmAuditService.stopAuditLog(filePlan); + List result2 = getAuditTrail(ADMIN_USER); + found = false; + for (RecordsManagementAuditEntry entry : result2) + { + String userName = entry.getUserName(); + String fullName = entry.getFullName(); + if (userName.equals("cdickons") && EqualsHelper.nullSafeEquals(fullName, "Charles Dickons")) + { + found = true; + break; + } + } + assertTrue("Expected to hit successful login attempt for Charles Dickons (cdickons)", found); + } + + /** === Helper methods === */ + + private List getAuditTrail(String asUser) + { + return getAuditTrail(-1, asUser); + } + + private List getAuditTrail(final int expectedCount, String asUser) + { + return getAuditTrail(new RecordsManagementAuditQueryParameters(), expectedCount, asUser); + } + + private List getAuditTrail(final RecordsManagementAuditQueryParameters params, final int expectedCount, final String asUser) + { + return doTestInTransaction(new Test>() + { + @Override + public List run() throws Exception + { + return rmAuditService.getAuditTrail(params); + } + + @Override + public void test(List result) throws Exception + { + assertNotNull(result); + if (expectedCount != -1) + { + assertEquals(expectedCount, result.size()); + } + } + }, asUser); + } + + private String updateTitle(final NodeRef nodeRef, final String asUser) + { + return doTestInTransaction(new Test() + { + @Override + public String run() throws Exception + { + String updatedProperty = "Updated - " + System.currentTimeMillis(); + nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, updatedProperty); + return updatedProperty; + } + }, asUser); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementEventServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementEventServiceImplTest.java index 0510b84726..0c9621fcaa 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementEventServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementEventServiceImplTest.java @@ -1,136 +1,136 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.cmr.repository.StoreRef; - -/** - * Event service implementation unit test - * - * @author Roy Wetherall - */ -public class RecordsManagementEventServiceImplTest extends BaseRMTestCase implements RecordsManagementModel -{ - protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - - private RetryingTransactionHelper transactionHelper; - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - // Get the service required in the tests - this.transactionHelper = (RetryingTransactionHelper)this.applicationContext.getBean("retryingTransactionHelper"); - - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - } - - public void testGetEventTypes() - { - transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List eventTypes = rmEventService.getEventTypes(); - assertNotNull(eventTypes); - for (RecordsManagementEventType eventType : eventTypes) - { - System.out.println(eventType.getName() + " - " + eventType.getDisplayLabel()); - } - return null; - } - }); - } - - public void testGetEvents() - { - transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List events = rmEventService.getEvents(); - assertNotNull(events); - for (RecordsManagementEvent event : events) - { - System.out.println(event.getName()); - } - return null; - } - }); - } - - public void testAddRemoveEvents() - { - transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - List events = rmEventService.getEvents(); - assertNotNull(events); - assertFalse(containsEvent(events, "myEvent")); - - rmEventService.addEvent("rmEventType.simple", "myEvent", "My Event"); - - events = rmEventService.getEvents(); - assertNotNull(events); - assertTrue(containsEvent(events, "myEvent")); - - rmEventService.removeEvent("myEvent"); - - events = rmEventService.getEvents(); - assertNotNull(events); - assertFalse(containsEvent(events, "myEvent")); - return null; - } - }); - } - - private boolean containsEvent(List events, String eventName) - { - boolean result = false; - for (RecordsManagementEvent event : events) - { - if (eventName.equals(event.getName())) - { - result = true; - break; - } - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.cmr.repository.StoreRef; + +/** + * Event service implementation unit test + * + * @author Roy Wetherall + */ +public class RecordsManagementEventServiceImplTest extends BaseRMTestCase implements RecordsManagementModel +{ + protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); + + private RetryingTransactionHelper transactionHelper; + + @Override + protected void setUp() throws Exception + { + super.setUp(); + + // Get the service required in the tests + this.transactionHelper = (RetryingTransactionHelper)this.applicationContext.getBean("retryingTransactionHelper"); + + // Set the current security context as admin + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + } + + public void testGetEventTypes() + { + transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + List eventTypes = rmEventService.getEventTypes(); + assertNotNull(eventTypes); + for (RecordsManagementEventType eventType : eventTypes) + { + System.out.println(eventType.getName() + " - " + eventType.getDisplayLabel()); + } + return null; + } + }); + } + + public void testGetEvents() + { + transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + List events = rmEventService.getEvents(); + assertNotNull(events); + for (RecordsManagementEvent event : events) + { + System.out.println(event.getName()); + } + return null; + } + }); + } + + public void testAddRemoveEvents() + { + transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + List events = rmEventService.getEvents(); + assertNotNull(events); + assertFalse(containsEvent(events, "myEvent")); + + rmEventService.addEvent("rmEventType.simple", "myEvent", "My Event"); + + events = rmEventService.getEvents(); + assertNotNull(events); + assertTrue(containsEvent(events, "myEvent")); + + rmEventService.removeEvent("myEvent"); + + events = rmEventService.getEvents(); + assertNotNull(events); + assertFalse(containsEvent(events, "myEvent")); + return null; + } + }); + } + + private boolean containsEvent(List events, String eventName) + { + boolean result = false; + for (RecordsManagementEvent event : events) + { + if (eventName.equals(event.getName())) + { + result = true; + break; + } + } + return result; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementQueryDAOImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementQueryDAOImplTest.java index 5c58ab24fd..ad8090aef9 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementQueryDAOImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementQueryDAOImplTest.java @@ -1,90 +1,90 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; - -/** - * Records Management Query DAO - * - * @author Roy Wetherall - * @since 2.1 - */ -public class RecordsManagementQueryDAOImplTest extends BaseRMTestCase implements RecordsManagementModel -{ - protected RecordsManagementQueryDAO queryDAO; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - - queryDAO = (RecordsManagementQueryDAO)applicationContext.getBean("recordsManagementQueryDAO"); - } - - /** - * This is a record test - * - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest() - */ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * @see RecordService#getRecordMetaDataAspects() - */ - public void testGetRecordMetaDataAspects() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - int count = queryDAO.getCountRmaIdentifier("abc-123"); - assertEquals(0, count); - - String existingID = (String)nodeService.getProperty(recordOne, PROP_IDENTIFIER); - count = queryDAO.getCountRmaIdentifier(existingID); - assertEquals(1, count); - - return null; - } - }); - } - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.query.RecordsManagementQueryDAO; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; + +/** + * Records Management Query DAO + * + * @author Roy Wetherall + * @since 2.1 + */ +public class RecordsManagementQueryDAOImplTest extends BaseRMTestCase implements RecordsManagementModel +{ + protected RecordsManagementQueryDAO queryDAO; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() + */ + @Override + protected void initServices() + { + super.initServices(); + + queryDAO = (RecordsManagementQueryDAO)applicationContext.getBean("recordsManagementQueryDAO"); + } + + /** + * This is a record test + * + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest() + */ + @Override + protected boolean isRecordTest() + { + return true; + } + + /** + * @see RecordService#getRecordMetaDataAspects() + */ + public void testGetRecordMetaDataAspects() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + int count = queryDAO.getCountRmaIdentifier("abc-123"); + assertEquals(0, count); + + String existingID = (String)nodeService.getProperty(recordOne, PROP_IDENTIFIER); + count = queryDAO.getCountRmaIdentifier(existingID); + assertEquals(1, count); + + return null; + } + }); + } + + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementSearchServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementSearchServiceImplTest.java index 7ed1d9be3c..4ea489ad72 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementSearchServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementSearchServiceImplTest.java @@ -1,290 +1,290 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import static org.alfresco.util.GUID.generate; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters; -import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.Pair; - -/** - * Search service implementation unit test. - * - * @author Roy Wetherall - */ -public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase -{ - @Override - protected boolean isMultiHierarchyTest() - { - return true; - } - - private static final String SEARCH1 = "search1"; - private static final String SEARCH2 = "search2"; - private static final String SEARCH3 = "search3"; - private static final String SEARCH4 = "search4"; - - private String user; - - private NodeRef folderLevelRecordFolder; - private NodeRef recordLevelRecordFolder; - - private int numberOfReports; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestData() - */ - @Override - protected void setupTestData() - { - super.setupTestData(); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Count the number of pre-defined reports - List searches = rmSearchService.getSavedSearches(siteId); - assertNotNull(searches); - numberOfReports = searches.size(); - - user = generate(); - createPerson(user); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupMultiHierarchyTestData() - */ - @Override - protected void setupMultiHierarchyTestData() - { - super.setupMultiHierarchyTestData(); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - folderLevelRecordFolder = mhRecordFolder42; - recordLevelRecordFolder = mhRecordFolder43; - - utils.createRecord(folderLevelRecordFolder, "recordOne.txt", null, "record one - folder level - elephant"); - utils.createRecord(folderLevelRecordFolder, "recordTwo.txt", null, "record two - folder level - snake"); - utils.createRecord(folderLevelRecordFolder, "recordThree.txt", null, "record three - folder level - monkey"); - utils.createRecord(recordLevelRecordFolder, "recordFour.txt", null, "record four - record level - elephant"); - utils.createRecord(recordLevelRecordFolder, "recordFive.txt", null, "record five - record level - snake"); - utils.createRecord(recordLevelRecordFolder, "recordSix.txt", null, "record six - record level - monkey"); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - } - - public void testSearch() - { - // Full text search - doTestInTransaction(new Test() - { - @Override - public Void run() - { - String query = "keywords:\"elephant\""; - RecordsManagementSearchParameters params = new RecordsManagementSearchParameters(); - params.setIncludeUndeclaredRecords(true); - List> results = rmSearchService.search(siteId, query, params); - assertNotNull(results); - assertEquals(2, results.size()); - - return null; - } - }, AuthenticationUtil.getSystemUserName()); - - // Property search - - // - } - - public void testSaveSearch() - { - // Add some saved searches (as admin user) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true); - checkSearchDetails(details1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); - SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH2, "description2", "query2", new RecordsManagementSearchParameters(), false); - checkSearchDetails(details2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false); - - return null; - } - - }); - - // Add some saved searches (as user1) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); - checkSearchDetails(details1, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); - SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false); - checkSearchDetails(details2, siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false); - - return null; - } - - }, user); - - // Get searches (as admin user) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List searches = rmSearchService.getSavedSearches(siteId); - assertNotNull(searches); - assertEquals(numberOfReports + 2, searches.size()); - - SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); - assertNotNull(search1); - checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); - - SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2); - assertNotNull(search2); - checkSearchDetails(search2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false); - - SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3); - assertNull(search3); - - SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4); - assertNull(search4); - - return null; - } - - }); - - // Get searches (as user1) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - List searches = rmSearchService.getSavedSearches(siteId); - assertNotNull(searches); - assertEquals(numberOfReports + 3, searches.size()); - - SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); - assertNotNull(search1); - checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); - - SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2); - assertNull(search2); - - SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3); - assertNotNull(search3); - checkSearchDetails(search3, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); - - SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4); - assertNotNull(search4); - checkSearchDetails(search4, siteId, "search4", "description4", "query4", new RecordsManagementSearchParameters(), false); - - return null; - } - - }, user); - - // Update search (as admin user) - doTestInTransaction(new Test() - { - @Override - public Void run() - { - SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); - assertNotNull(search1); - checkSearchDetails(search1, siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true); - - rmSearchService.saveSearch(siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true); - - search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); - assertNotNull(search1); - checkSearchDetails(search1, siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true); - - return null; - } - }); - - // Delete searches (as admin user) - // TODO - } - - /** - * Check the details of the saved search. - */ - private void checkSearchDetails( - SavedSearchDetails details, - String siteid, - String name, - String description, - String query, - RecordsManagementSearchParameters searchParameters, - boolean isPublic) - { - assertNotNull(details); - assertEquals(siteid, details.getSiteId()); - assertEquals(name, details.getName()); - assertEquals(description, details.getDescription()); - assertEquals(query, details.getSearch()); - assertEquals(isPublic, details.isPublic()); - - assertEquals(searchParameters.getMaxItems(), details.getSearchParameters().getMaxItems()); - assertEquals(searchParameters.isIncludeRecords(), details.getSearchParameters().isIncludeRecords()); - assertEquals(searchParameters.isIncludeUndeclaredRecords(), details.getSearchParameters().isIncludeUndeclaredRecords()); - assertEquals(searchParameters.isIncludeVitalRecords(), details.getSearchParameters().isIncludeVitalRecords()); - assertEquals(searchParameters.isIncludeRecordFolders(), details.getSearchParameters().isIncludeRecordFolders()); - assertEquals(searchParameters.isIncludeFrozen(), details.getSearchParameters().isIncludeFrozen()); - assertEquals(searchParameters.isIncludeCutoff(), details.getSearchParameters().isIncludeCutoff()); - - // Check the other stuff .... - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import static org.alfresco.util.GUID.generate; + +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters; +import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.Pair; + +/** + * Search service implementation unit test. + * + * @author Roy Wetherall + */ +public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase +{ + @Override + protected boolean isMultiHierarchyTest() + { + return true; + } + + private static final String SEARCH1 = "search1"; + private static final String SEARCH2 = "search2"; + private static final String SEARCH3 = "search3"; + private static final String SEARCH4 = "search4"; + + private String user; + + private NodeRef folderLevelRecordFolder; + private NodeRef recordLevelRecordFolder; + + private int numberOfReports; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestData() + */ + @Override + protected void setupTestData() + { + super.setupTestData(); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Count the number of pre-defined reports + List searches = rmSearchService.getSavedSearches(siteId); + assertNotNull(searches); + numberOfReports = searches.size(); + + user = generate(); + createPerson(user); + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupMultiHierarchyTestData() + */ + @Override + protected void setupMultiHierarchyTestData() + { + super.setupMultiHierarchyTestData(); + + doTestInTransaction(new Test() + { + @Override + public Void run() + { + folderLevelRecordFolder = mhRecordFolder42; + recordLevelRecordFolder = mhRecordFolder43; + + utils.createRecord(folderLevelRecordFolder, "recordOne.txt", null, "record one - folder level - elephant"); + utils.createRecord(folderLevelRecordFolder, "recordTwo.txt", null, "record two - folder level - snake"); + utils.createRecord(folderLevelRecordFolder, "recordThree.txt", null, "record three - folder level - monkey"); + utils.createRecord(recordLevelRecordFolder, "recordFour.txt", null, "record four - record level - elephant"); + utils.createRecord(recordLevelRecordFolder, "recordFive.txt", null, "record five - record level - snake"); + utils.createRecord(recordLevelRecordFolder, "recordSix.txt", null, "record six - record level - monkey"); + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + } + + public void testSearch() + { + // Full text search + doTestInTransaction(new Test() + { + @Override + public Void run() + { + String query = "keywords:\"elephant\""; + RecordsManagementSearchParameters params = new RecordsManagementSearchParameters(); + params.setIncludeUndeclaredRecords(true); + List> results = rmSearchService.search(siteId, query, params); + assertNotNull(results); + assertEquals(2, results.size()); + + return null; + } + }, AuthenticationUtil.getSystemUserName()); + + // Property search + + // + } + + public void testSaveSearch() + { + // Add some saved searches (as admin user) + doTestInTransaction(new Test() + { + @Override + public Void run() + { + SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true); + checkSearchDetails(details1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); + SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH2, "description2", "query2", new RecordsManagementSearchParameters(), false); + checkSearchDetails(details2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false); + + return null; + } + + }); + + // Add some saved searches (as user1) + doTestInTransaction(new Test() + { + @Override + public Void run() + { + SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); + checkSearchDetails(details1, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); + SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false); + checkSearchDetails(details2, siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false); + + return null; + } + + }, user); + + // Get searches (as admin user) + doTestInTransaction(new Test() + { + @Override + public Void run() + { + List searches = rmSearchService.getSavedSearches(siteId); + assertNotNull(searches); + assertEquals(numberOfReports + 2, searches.size()); + + SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); + assertNotNull(search1); + checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); + + SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2); + assertNotNull(search2); + checkSearchDetails(search2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false); + + SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3); + assertNull(search3); + + SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4); + assertNull(search4); + + return null; + } + + }); + + // Get searches (as user1) + doTestInTransaction(new Test() + { + @Override + public Void run() + { + List searches = rmSearchService.getSavedSearches(siteId); + assertNotNull(searches); + assertEquals(numberOfReports + 3, searches.size()); + + SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); + assertNotNull(search1); + checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true); + + SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2); + assertNull(search2); + + SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3); + assertNotNull(search3); + checkSearchDetails(search3, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false); + + SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4); + assertNotNull(search4); + checkSearchDetails(search4, siteId, "search4", "description4", "query4", new RecordsManagementSearchParameters(), false); + + return null; + } + + }, user); + + // Update search (as admin user) + doTestInTransaction(new Test() + { + @Override + public Void run() + { + SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); + assertNotNull(search1); + checkSearchDetails(search1, siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true); + + rmSearchService.saveSearch(siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true); + + search1 = rmSearchService.getSavedSearch(siteId, SEARCH1); + assertNotNull(search1); + checkSearchDetails(search1, siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true); + + return null; + } + }); + + // Delete searches (as admin user) + // TODO + } + + /** + * Check the details of the saved search. + */ + private void checkSearchDetails( + SavedSearchDetails details, + String siteid, + String name, + String description, + String query, + RecordsManagementSearchParameters searchParameters, + boolean isPublic) + { + assertNotNull(details); + assertEquals(siteid, details.getSiteId()); + assertEquals(name, details.getName()); + assertEquals(description, details.getDescription()); + assertEquals(query, details.getSearch()); + assertEquals(isPublic, details.isPublic()); + + assertEquals(searchParameters.getMaxItems(), details.getSearchParameters().getMaxItems()); + assertEquals(searchParameters.isIncludeRecords(), details.getSearchParameters().isIncludeRecords()); + assertEquals(searchParameters.isIncludeUndeclaredRecords(), details.getSearchParameters().isIncludeUndeclaredRecords()); + assertEquals(searchParameters.isIncludeVitalRecords(), details.getSearchParameters().isIncludeVitalRecords()); + assertEquals(searchParameters.isIncludeRecordFolders(), details.getSearchParameters().isIncludeRecordFolders()); + assertEquals(searchParameters.isIncludeFrozen(), details.getSearchParameters().isIncludeFrozen()); + assertEquals(searchParameters.isIncludeCutoff(), details.getSearchParameters().isIncludeCutoff()); + + // Check the other stuff .... + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementServiceImplTest.java index 4da5ab54af..3e3cb1a707 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementServiceImplTest.java @@ -1,623 +1,623 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Records management service test. - * - * @author Roy Wetherall - */ -public class RecordsManagementServiceImplTest extends BaseRMTestCase -{ - /********** RM Component methods **********/ - - /** - * @see FilePlanService#isFilePlanComponent(NodeRef) - */ - public void testIsFilePlanComponent() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertTrue("The rm root container should be a rm component", filePlanService.isFilePlanComponent(filePlan)); - assertTrue("The rm container should be a rm component", filePlanService.isFilePlanComponent(rmContainer)); - assertTrue("The rm folder should be a rm component", filePlanService.isFilePlanComponent(rmFolder)); - - return null; - } - }); - } - - /** - * @see FilePlanService#getFilePlanComponentKind(NodeRef) - */ - public void testGetFilePlanComponentKind() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() throws Exception - { - return utils.createRecord(rmFolder, "testRecord.txt"); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); - assertEquals(FilePlanComponentKind.RECORD_CATEGORY, filePlanService.getFilePlanComponentKind(rmContainer)); - assertEquals(FilePlanComponentKind.RECORD_FOLDER, filePlanService.getFilePlanComponentKind(rmFolder)); - assertEquals(FilePlanComponentKind.RECORD, filePlanService.getFilePlanComponentKind(result)); - // TODO HOLD and TRANSFER - assertNull(filePlanService.getFilePlanComponentKind(folder)); - } - }); - } - - /** - * @see FilePlanService#isFilePlan(NodeRef) - */ - public void testIsFilePlan() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertTrue("This is a records management root", filePlanService.isFilePlan(filePlan)); - assertFalse("This should not be a records management root", filePlanService.isFilePlan(rmContainer)); - assertFalse("This should not be a records management root", filePlanService.isFilePlan(rmFolder)); - - return null; - } - }); - } - - /** - * @see FilePlanService#isRecordCategory(NodeRef) - */ - public void testIsRecordCategory() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertFalse("This should not be a record category.", filePlanService.isRecordCategory(filePlan)); - assertTrue("This is a record category.", filePlanService.isRecordCategory(rmContainer)); - assertFalse("This should not be a record category.", filePlanService.isRecordCategory(rmFolder)); - - return null; - } - }); - } - - /** - * @see RecordFolderService#isRecordFolder(NodeRef) - */ - public void testIsRecordFolder() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertFalse("This should not be a record folder", recordFolderService.isRecordFolder(filePlan)); - assertFalse("This should not be a record folder", recordFolderService.isRecordFolder(rmContainer)); - assertTrue("This should be a record folder", recordFolderService.isRecordFolder(rmFolder)); - - return null; - } - }); - } - - public void testGetRecordsManagementRoot() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - assertEquals(filePlan, filePlanService.getFilePlan(filePlan)); - assertEquals(filePlan, filePlanService.getFilePlan(rmContainer)); - assertEquals(filePlan, filePlanService.getFilePlan(rmFolder)); - - return null; - } - }); - } - - /********** Record Management Root methods **********/ - - /** - * @see FilePlanService#getFilePlans() - */ - public void testGetRecordsManagementRoots() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - List roots = new ArrayList(filePlanService.getFilePlans()); - assertNotNull(roots); - assertTrue(roots.size() != 0); - assertTrue(roots.contains(filePlan)); - - return null; - } - }); - } - - /** - * @see FilePlanService#createFilePlan(NodeRef, String) - * @see FilePlanService#createFilePlan(NodeRef, String, QName) - */ - public void testCreateFilePlan() throws Exception - { - // Create default type of root - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createFilePlan(folder, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management root", result); - basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); - } - }); - - // Create specific type of root - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createFilePlan(folder, id, TYPE_FILE_PLAN); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management root", result); - basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); - } - }); - - // Failure: creating root in existing hierarchy - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createFilePlan(rmContainer, GUID.generate()); - } - }); - - // Failure: type no extended from root container - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createFilePlan(folder, GUID.generate(), TYPE_FOLDER); - } - }); - } - - /********** Records Management Container methods **********/ - - /** - * @see FilePlanService#createRecordCategory(NodeRef, String) - * @see FilePlanService#createFilePlan(NodeRef, String, QName) - */ - public void testCreateRecordCategory() throws Exception - { - // Create container (in root) - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createRecordCategory(filePlan, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management container", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); - } - }); - - // Create container (in container) - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return filePlanService.createRecordCategory(rmContainer, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create records management container", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); - } - }); - - // TODO need a custom type of container! - // Create container of a given type -// doTestInTransaction(new Test() -// { -// @Override -// public NodeRef run() -// { -// String id = setString("id", GUID.generate()); -// return filePlanService.createRecordCategory(filePlan, id, TYPE_RECORD_SERIES); -// } -// -// @Override -// public void test(NodeRef result) -// { -// assertNotNull("Unable to create records management container", result); -// basicRMContainerCheck(result, getString("id"), TYPE_RECORD_SERIES); -// } -// }); - - // Fail Test: parent is not a container - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createRecordCategory(folder, GUID.generate()); - } - }); - - // Fail Test: type is not a sub-type of rm:recordsManagementContainer - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.createRecordCategory(filePlan, GUID.generate(), TYPE_FOLDER); - } - }); - } - - /** - * @see FilePlanService#getAllContained(NodeRef) - * @see FilePlanService#getAllContained(NodeRef, boolean) - */ - public void testGetAllContained() throws Exception - { - // Get all contained test - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getAllContained(rmContainer); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getAllContained(rmContainer, false); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getAllContained(rmContainer, true); - assertNotNull(nodes); - assertEquals(4, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(rmFolder)); - assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); - assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); - - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getAllContained(rmFolder); - } - }); - } - - /** - * @see FilePlanService#getContainedRecordCategories(NodeRef) - * @see FilePlanService#getContainedRecordCategories(NodeRef, boolean) - */ - public void testGetContainedRecordCategories() throws Exception - { - // Test getting all contained containers - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getContainedRecordCategories(rmContainer); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - - nodes = filePlanService.getContainedRecordCategories(rmContainer, false); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - - nodes = filePlanService.getContainedRecordCategories(rmContainer, true); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(getNodeRef("series"))); - assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getContainedRecordCategories(rmFolder); - } - }); - } - - /** - * @see FilePlanService#getContainedRecordFolders(NodeRef) - * @see FilePlanService#getContainedRecordFolders(NodeRef, boolean) - */ - public void testGetContainedRecordFolders() throws Exception - { - // Test getting all contained record folders - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Add to the test data - NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); - NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); - NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); - - // Put in model - setNodeRef("series", series); - setNodeRef("seriesChildFolder", seriesChildFolder); - setNodeRef("seriesChildContainer", seriesChildContainer); - - return null; - } - - @Override - public void test(Void result) throws Exception - { - List nodes = filePlanService.getContainedRecordFolders(rmContainer); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getContainedRecordFolders(rmContainer, false); - assertNotNull(nodes); - assertEquals(1, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - - nodes = filePlanService.getContainedRecordFolders(rmContainer, true); - assertNotNull(nodes); - assertEquals(2, nodes.size()); - assertTrue(nodes.contains(rmFolder)); - assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); - } - }); - - // Failure: call on record folder - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - filePlanService.getContainedRecordFolders(rmFolder); - } - }); - } - - /********** Record Folder methods **********/ - - // TODO void testIsRecordFolderDeclared() - - // TODO void testIsRecordFolderClosed() - - // TODO void testGetRecords() - - /** - * @see RecordFolderService#createRecordFolder(NodeRef, String) - * @see RecordFolderService#createRecordFolder(NodeRef, String, QName) - */ - public void testCreateRecordFolder() throws Exception - { - // Create record - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - String id = setString("id", GUID.generate()); - return recordFolderService.createRecordFolder(rmContainer, id); - } - - @Override - public void test(NodeRef result) - { - assertNotNull("Unable to create record folder", result); - basicRMContainerCheck(result, getString("id"), TYPE_RECORD_FOLDER); - } - }); - - // TODO Create record of type - - // Failure: Create record with invalid type - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - recordFolderService.createRecordFolder(rmContainer, GUID.generate(), TYPE_FOLDER); - } - }); - - // Failure: Create record folder in root - doTestInTransaction(new FailureTest() - { - @Override - public void run() - { - recordFolderService.createRecordFolder(filePlan, GUID.generate()); - } - }); - } - - - /********** RM2 - Multi-hierarchy record taxonomy's **********/ - - /** - * Test to create a simple multi-hierarchy record taxonomy - */ - public void testCreateSimpleHierarchy() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - // Create 3 level hierarchy - NodeRef levelOne = setNodeRef("container1", filePlanService.createRecordCategory(filePlan, "container1")); - assertNotNull("Unable to create container", levelOne); - NodeRef levelTwo = setNodeRef("container2", filePlanService.createRecordCategory(levelOne, "container2")); - assertNotNull("Unable to create container", levelTwo); - NodeRef levelThree = setNodeRef("container3", filePlanService.createRecordCategory(levelTwo, "container3")); - assertNotNull("Unable to create container", levelThree); - NodeRef levelThreeRecordFolder = setNodeRef("recordFolder3", recordFolderService.createRecordFolder(levelThree, "recordFolder3")); - assertNotNull("Unable to create record folder", levelThreeRecordFolder); - - return null; - } - - @Override - public void test(Void result) - { - // Test that the hierarchy has been created correctly - basicRMContainerCheck(getNodeRef("container1"), "container1", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("container2"), "container2", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("container3"), "container3", TYPE_RECORD_CATEGORY); - basicRMContainerCheck(getNodeRef("recordFolder3"), "recordFolder3", TYPE_RECORD_FOLDER); - - // TODO need to check that the parents and children can be retrieved correctly - } - }); - } - - /** - * A basic test of a records management container - * - * @param nodeRef node reference - * @param name name of the container - * @param type the type of container - */ - private void basicRMContainerCheck(NodeRef nodeRef, String name, QName type) - { - // Check the basic details - assertEquals(name, nodeService.getProperty(nodeRef, PROP_NAME)); - assertNotNull("RM id has not been set", nodeService.getProperty(nodeRef, PROP_IDENTIFIER)); - assertEquals(type, nodeService.getType(nodeRef)); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * Records management service test. + * + * @author Roy Wetherall + */ +public class RecordsManagementServiceImplTest extends BaseRMTestCase +{ + /********** RM Component methods **********/ + + /** + * @see FilePlanService#isFilePlanComponent(NodeRef) + */ + public void testIsFilePlanComponent() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + assertTrue("The rm root container should be a rm component", filePlanService.isFilePlanComponent(filePlan)); + assertTrue("The rm container should be a rm component", filePlanService.isFilePlanComponent(rmContainer)); + assertTrue("The rm folder should be a rm component", filePlanService.isFilePlanComponent(rmFolder)); + + return null; + } + }); + } + + /** + * @see FilePlanService#getFilePlanComponentKind(NodeRef) + */ + public void testGetFilePlanComponentKind() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() throws Exception + { + return utils.createRecord(rmFolder, "testRecord.txt"); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan)); + assertEquals(FilePlanComponentKind.RECORD_CATEGORY, filePlanService.getFilePlanComponentKind(rmContainer)); + assertEquals(FilePlanComponentKind.RECORD_FOLDER, filePlanService.getFilePlanComponentKind(rmFolder)); + assertEquals(FilePlanComponentKind.RECORD, filePlanService.getFilePlanComponentKind(result)); + // TODO HOLD and TRANSFER + assertNull(filePlanService.getFilePlanComponentKind(folder)); + } + }); + } + + /** + * @see FilePlanService#isFilePlan(NodeRef) + */ + public void testIsFilePlan() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + assertTrue("This is a records management root", filePlanService.isFilePlan(filePlan)); + assertFalse("This should not be a records management root", filePlanService.isFilePlan(rmContainer)); + assertFalse("This should not be a records management root", filePlanService.isFilePlan(rmFolder)); + + return null; + } + }); + } + + /** + * @see FilePlanService#isRecordCategory(NodeRef) + */ + public void testIsRecordCategory() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + assertFalse("This should not be a record category.", filePlanService.isRecordCategory(filePlan)); + assertTrue("This is a record category.", filePlanService.isRecordCategory(rmContainer)); + assertFalse("This should not be a record category.", filePlanService.isRecordCategory(rmFolder)); + + return null; + } + }); + } + + /** + * @see RecordFolderService#isRecordFolder(NodeRef) + */ + public void testIsRecordFolder() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + assertFalse("This should not be a record folder", recordFolderService.isRecordFolder(filePlan)); + assertFalse("This should not be a record folder", recordFolderService.isRecordFolder(rmContainer)); + assertTrue("This should be a record folder", recordFolderService.isRecordFolder(rmFolder)); + + return null; + } + }); + } + + public void testGetRecordsManagementRoot() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + assertEquals(filePlan, filePlanService.getFilePlan(filePlan)); + assertEquals(filePlan, filePlanService.getFilePlan(rmContainer)); + assertEquals(filePlan, filePlanService.getFilePlan(rmFolder)); + + return null; + } + }); + } + + /********** Record Management Root methods **********/ + + /** + * @see FilePlanService#getFilePlans() + */ + public void testGetRecordsManagementRoots() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + List roots = new ArrayList(filePlanService.getFilePlans()); + assertNotNull(roots); + assertTrue(roots.size() != 0); + assertTrue(roots.contains(filePlan)); + + return null; + } + }); + } + + /** + * @see FilePlanService#createFilePlan(NodeRef, String) + * @see FilePlanService#createFilePlan(NodeRef, String, QName) + */ + public void testCreateFilePlan() throws Exception + { + // Create default type of root + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return filePlanService.createFilePlan(folder, id); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create records management root", result); + basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); + } + }); + + // Create specific type of root + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return filePlanService.createFilePlan(folder, id, TYPE_FILE_PLAN); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create records management root", result); + basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN); + } + }); + + // Failure: creating root in existing hierarchy + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.createFilePlan(rmContainer, GUID.generate()); + } + }); + + // Failure: type no extended from root container + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.createFilePlan(folder, GUID.generate(), TYPE_FOLDER); + } + }); + } + + /********** Records Management Container methods **********/ + + /** + * @see FilePlanService#createRecordCategory(NodeRef, String) + * @see FilePlanService#createFilePlan(NodeRef, String, QName) + */ + public void testCreateRecordCategory() throws Exception + { + // Create container (in root) + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return filePlanService.createRecordCategory(filePlan, id); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create records management container", result); + basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); + } + }); + + // Create container (in container) + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return filePlanService.createRecordCategory(rmContainer, id); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create records management container", result); + basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY); + } + }); + + // TODO need a custom type of container! + // Create container of a given type +// doTestInTransaction(new Test() +// { +// @Override +// public NodeRef run() +// { +// String id = setString("id", GUID.generate()); +// return filePlanService.createRecordCategory(filePlan, id, TYPE_RECORD_SERIES); +// } +// +// @Override +// public void test(NodeRef result) +// { +// assertNotNull("Unable to create records management container", result); +// basicRMContainerCheck(result, getString("id"), TYPE_RECORD_SERIES); +// } +// }); + + // Fail Test: parent is not a container + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.createRecordCategory(folder, GUID.generate()); + } + }); + + // Fail Test: type is not a sub-type of rm:recordsManagementContainer + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.createRecordCategory(filePlan, GUID.generate(), TYPE_FOLDER); + } + }); + } + + /** + * @see FilePlanService#getAllContained(NodeRef) + * @see FilePlanService#getAllContained(NodeRef, boolean) + */ + public void testGetAllContained() throws Exception + { + // Get all contained test + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Add to the test data + NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); + NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); + NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); + + // Put in model + setNodeRef("series", series); + setNodeRef("seriesChildFolder", seriesChildFolder); + setNodeRef("seriesChildContainer", seriesChildContainer); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + List nodes = filePlanService.getAllContained(rmContainer); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + assertTrue(nodes.contains(rmFolder)); + + nodes = filePlanService.getAllContained(rmContainer, false); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + assertTrue(nodes.contains(rmFolder)); + + nodes = filePlanService.getAllContained(rmContainer, true); + assertNotNull(nodes); + assertEquals(4, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + assertTrue(nodes.contains(rmFolder)); + assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); + assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); + + } + }); + + // Failure: call on record folder + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.getAllContained(rmFolder); + } + }); + } + + /** + * @see FilePlanService#getContainedRecordCategories(NodeRef) + * @see FilePlanService#getContainedRecordCategories(NodeRef, boolean) + */ + public void testGetContainedRecordCategories() throws Exception + { + // Test getting all contained containers + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Add to the test data + NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); + NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); + NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); + + // Put in model + setNodeRef("series", series); + setNodeRef("seriesChildFolder", seriesChildFolder); + setNodeRef("seriesChildContainer", seriesChildContainer); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + List nodes = filePlanService.getContainedRecordCategories(rmContainer); + assertNotNull(nodes); + assertEquals(1, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + + nodes = filePlanService.getContainedRecordCategories(rmContainer, false); + assertNotNull(nodes); + assertEquals(1, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + + nodes = filePlanService.getContainedRecordCategories(rmContainer, true); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertTrue(nodes.contains(getNodeRef("series"))); + assertTrue(nodes.contains(getNodeRef("seriesChildContainer"))); + } + }); + + // Failure: call on record folder + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.getContainedRecordCategories(rmFolder); + } + }); + } + + /** + * @see FilePlanService#getContainedRecordFolders(NodeRef) + * @see FilePlanService#getContainedRecordFolders(NodeRef, boolean) + */ + public void testGetContainedRecordFolders() throws Exception + { + // Test getting all contained record folders + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Add to the test data + NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries"); + NodeRef seriesChildFolder = recordFolderService.createRecordFolder(series, "seriesRecordFolder"); + NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer"); + + // Put in model + setNodeRef("series", series); + setNodeRef("seriesChildFolder", seriesChildFolder); + setNodeRef("seriesChildContainer", seriesChildContainer); + + return null; + } + + @Override + public void test(Void result) throws Exception + { + List nodes = filePlanService.getContainedRecordFolders(rmContainer); + assertNotNull(nodes); + assertEquals(1, nodes.size()); + assertTrue(nodes.contains(rmFolder)); + + nodes = filePlanService.getContainedRecordFolders(rmContainer, false); + assertNotNull(nodes); + assertEquals(1, nodes.size()); + assertTrue(nodes.contains(rmFolder)); + + nodes = filePlanService.getContainedRecordFolders(rmContainer, true); + assertNotNull(nodes); + assertEquals(2, nodes.size()); + assertTrue(nodes.contains(rmFolder)); + assertTrue(nodes.contains(getNodeRef("seriesChildFolder"))); + } + }); + + // Failure: call on record folder + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + filePlanService.getContainedRecordFolders(rmFolder); + } + }); + } + + /********** Record Folder methods **********/ + + // TODO void testIsRecordFolderDeclared() + + // TODO void testIsRecordFolderClosed() + + // TODO void testGetRecords() + + /** + * @see RecordFolderService#createRecordFolder(NodeRef, String) + * @see RecordFolderService#createRecordFolder(NodeRef, String, QName) + */ + public void testCreateRecordFolder() throws Exception + { + // Create record + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + String id = setString("id", GUID.generate()); + return recordFolderService.createRecordFolder(rmContainer, id); + } + + @Override + public void test(NodeRef result) + { + assertNotNull("Unable to create record folder", result); + basicRMContainerCheck(result, getString("id"), TYPE_RECORD_FOLDER); + } + }); + + // TODO Create record of type + + // Failure: Create record with invalid type + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + recordFolderService.createRecordFolder(rmContainer, GUID.generate(), TYPE_FOLDER); + } + }); + + // Failure: Create record folder in root + doTestInTransaction(new FailureTest() + { + @Override + public void run() + { + recordFolderService.createRecordFolder(filePlan, GUID.generate()); + } + }); + } + + + /********** RM2 - Multi-hierarchy record taxonomy's **********/ + + /** + * Test to create a simple multi-hierarchy record taxonomy + */ + public void testCreateSimpleHierarchy() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + // Create 3 level hierarchy + NodeRef levelOne = setNodeRef("container1", filePlanService.createRecordCategory(filePlan, "container1")); + assertNotNull("Unable to create container", levelOne); + NodeRef levelTwo = setNodeRef("container2", filePlanService.createRecordCategory(levelOne, "container2")); + assertNotNull("Unable to create container", levelTwo); + NodeRef levelThree = setNodeRef("container3", filePlanService.createRecordCategory(levelTwo, "container3")); + assertNotNull("Unable to create container", levelThree); + NodeRef levelThreeRecordFolder = setNodeRef("recordFolder3", recordFolderService.createRecordFolder(levelThree, "recordFolder3")); + assertNotNull("Unable to create record folder", levelThreeRecordFolder); + + return null; + } + + @Override + public void test(Void result) + { + // Test that the hierarchy has been created correctly + basicRMContainerCheck(getNodeRef("container1"), "container1", TYPE_RECORD_CATEGORY); + basicRMContainerCheck(getNodeRef("container2"), "container2", TYPE_RECORD_CATEGORY); + basicRMContainerCheck(getNodeRef("container3"), "container3", TYPE_RECORD_CATEGORY); + basicRMContainerCheck(getNodeRef("recordFolder3"), "recordFolder3", TYPE_RECORD_FOLDER); + + // TODO need to check that the parents and children can be retrieved correctly + } + }); + } + + /** + * A basic test of a records management container + * + * @param nodeRef node reference + * @param name name of the container + * @param type the type of container + */ + private void basicRMContainerCheck(NodeRef nodeRef, String name, QName type) + { + // Check the basic details + assertEquals(name, nodeService.getProperty(nodeRef, PROP_NAME)); + assertNotNull("RM id has not been set", nodeService.getProperty(nodeRef, PROP_IDENTIFIER)); + assertEquals(type, nodeService.getType(nodeRef)); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ReportServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ReportServiceImplTest.java index a54f7976e9..dbaaec0812 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ReportServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ReportServiceImplTest.java @@ -1,240 +1,240 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.report.Report; -import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; -import org.apache.commons.lang.StringUtils; - -/** - * Report service implementation unit test. - * - * @author Roy Wetherall - */ -public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel -{ - public void testGetReportTypes() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Set reportTypes = reportService.getReportTypes(); - - assertNotNull(reportTypes); - assertFalse(reportTypes.isEmpty()); - - for (QName reportType : reportTypes) - { - System.out.println(reportType.toString()); - } - - return null; - } - }); - } - - public void testGenerateReport() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Destruction Report - Report destructionReport = generateDestructionReport(); - System.out.println(destructionReport.getReportName()); - System.out.println(destructionReport.getReportContent().getContentString()); - - // Transfer Report - Report transferReport = reportService.generateReport(TYPE_TRANSFER_REPORT, getTransferObject(), MimetypeMap.MIMETYPE_HTML); - System.out.println(transferReport.getReportName()); - System.out.println(transferReport.getReportContent().getContentString()); - - return null; - } - }); - } - - public void testFileReport() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Destruction Report - NodeRef destructionReportNodeRef = fileDestructionReport(); - assertNotNull(destructionReportNodeRef); - assertTrue(recordService.isRecord(destructionReportNodeRef)); - assertFalse(recordService.isFiled(destructionReportNodeRef)); - assertEquals(TYPE_DESTRUCTION_REPORT, nodeService.getType(destructionReportNodeRef)); - - // Transfer Report - NodeRef transferReportNodeRef = fileTransferReport(); - assertNotNull(transferReportNodeRef); - assertTrue(recordService.isRecord(transferReportNodeRef)); - assertFalse(recordService.isFiled(transferReportNodeRef)); - assertEquals(TYPE_TRANSFER_REPORT, nodeService.getType(transferReportNodeRef)); - - return null; - } - }); - } - - /** - * Helper method to generate a destruction report - * - * @return Destruction report - */ - private Report generateDestructionReport() - { - return reportService.generateReport(TYPE_DESTRUCTION_REPORT, rmFolder); - } - - /** - * Helper method to file a destruction report - * - * @return Node reference of the destruction report - */ - private NodeRef fileDestructionReport() - { - Report destructionReport = generateDestructionReport(); - return reportService.fileReport(filePlan, destructionReport); - } - - /** - * Helper method to file a transfer report - * - * @return Node reference of the transfer report - */ - private NodeRef fileTransferReport() - { - Report transferReport = reportService.generateReport(TYPE_TRANSFER_REPORT, getTransferObject(), MimetypeMap.MIMETYPE_HTML); - return reportService.fileReport(filePlan, transferReport); - } - - public void testFileDestructionReportAction() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(rmFolder, CompleteEventAction.NAME, params); - - rmActionService.executeRecordsManagementAction(rmFolder, CutOffAction.NAME); - rmActionService.executeRecordsManagementAction(rmFolder, DestroyAction.NAME); - - Map fileReportParams = new HashMap(2); - fileReportParams.put(FileReportAction.REPORT_TYPE, "rmr:destructionReport"); - fileReportParams.put(FileReportAction.DESTINATION, filePlan.toString()); - rmActionService.executeRecordsManagementAction(rmFolder, FileReportAction.NAME, fileReportParams); - return null; - } - }); - } - - public void testFileTransferReportAction() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - // Create transfer report for the transfer object - Map params = new HashMap(2); - params.put(FileReportAction.REPORT_TYPE, "rmr:transferReport"); - params.put(FileReportAction.DESTINATION, filePlan.toString()); - RecordsManagementActionResult transferReportAction = rmActionService.executeRecordsManagementAction(getTransferObject(), FileReportAction.NAME, params); - // Check transfer report result - String transferReportName = (String) transferReportAction.getValue(); - assertFalse(StringUtils.isBlank(transferReportName)); - return null; - } - }); - } - - /** - * Helper method for creating a transfer object - * - * @return Node reference of the transfer object - */ - private NodeRef getTransferObject() - { - NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - utils.createDispositionSchedule( - recordCategory, - CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, - CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, - false, // record level - true, // set the default actions - true); // extended disposition schedule - - NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); - - // Set the record folder identifier - String identifier = identifierService.generateIdentifier(TYPE_RECORD_FOLDER, recordCategory); - nodeService.setProperty(recordFolder, PROP_IDENTIFIER, identifier); - - // Complete event - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME); - - // Transfer folder - RecordsManagementActionResult transferAction = rmActionService.executeRecordsManagementAction(recordFolder, TransferAction.NAME); - NodeRef transferObject = (NodeRef) transferAction.getValue(); - assertTrue(transferObject != null); - - return transferObject; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; +import org.alfresco.module.org_alfresco_module_rm.report.Report; +import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; +import org.apache.commons.lang.StringUtils; + +/** + * Report service implementation unit test. + * + * @author Roy Wetherall + */ +public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel +{ + public void testGetReportTypes() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + Set reportTypes = reportService.getReportTypes(); + + assertNotNull(reportTypes); + assertFalse(reportTypes.isEmpty()); + + for (QName reportType : reportTypes) + { + System.out.println(reportType.toString()); + } + + return null; + } + }); + } + + public void testGenerateReport() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // Destruction Report + Report destructionReport = generateDestructionReport(); + System.out.println(destructionReport.getReportName()); + System.out.println(destructionReport.getReportContent().getContentString()); + + // Transfer Report + Report transferReport = reportService.generateReport(TYPE_TRANSFER_REPORT, getTransferObject(), MimetypeMap.MIMETYPE_HTML); + System.out.println(transferReport.getReportName()); + System.out.println(transferReport.getReportContent().getContentString()); + + return null; + } + }); + } + + public void testFileReport() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // Destruction Report + NodeRef destructionReportNodeRef = fileDestructionReport(); + assertNotNull(destructionReportNodeRef); + assertTrue(recordService.isRecord(destructionReportNodeRef)); + assertFalse(recordService.isFiled(destructionReportNodeRef)); + assertEquals(TYPE_DESTRUCTION_REPORT, nodeService.getType(destructionReportNodeRef)); + + // Transfer Report + NodeRef transferReportNodeRef = fileTransferReport(); + assertNotNull(transferReportNodeRef); + assertTrue(recordService.isRecord(transferReportNodeRef)); + assertFalse(recordService.isFiled(transferReportNodeRef)); + assertEquals(TYPE_TRANSFER_REPORT, nodeService.getType(transferReportNodeRef)); + + return null; + } + }); + } + + /** + * Helper method to generate a destruction report + * + * @return Destruction report + */ + private Report generateDestructionReport() + { + return reportService.generateReport(TYPE_DESTRUCTION_REPORT, rmFolder); + } + + /** + * Helper method to file a destruction report + * + * @return Node reference of the destruction report + */ + private NodeRef fileDestructionReport() + { + Report destructionReport = generateDestructionReport(); + return reportService.fileReport(filePlan, destructionReport); + } + + /** + * Helper method to file a transfer report + * + * @return Node reference of the transfer report + */ + private NodeRef fileTransferReport() + { + Report transferReport = reportService.generateReport(TYPE_TRANSFER_REPORT, getTransferObject(), MimetypeMap.MIMETYPE_HTML); + return reportService.fileReport(filePlan, transferReport); + } + + public void testFileDestructionReportAction() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(rmFolder, CompleteEventAction.NAME, params); + + rmActionService.executeRecordsManagementAction(rmFolder, CutOffAction.NAME); + rmActionService.executeRecordsManagementAction(rmFolder, DestroyAction.NAME); + + Map fileReportParams = new HashMap(2); + fileReportParams.put(FileReportAction.REPORT_TYPE, "rmr:destructionReport"); + fileReportParams.put(FileReportAction.DESTINATION, filePlan.toString()); + rmActionService.executeRecordsManagementAction(rmFolder, FileReportAction.NAME, fileReportParams); + return null; + } + }); + } + + public void testFileTransferReportAction() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // Create transfer report for the transfer object + Map params = new HashMap(2); + params.put(FileReportAction.REPORT_TYPE, "rmr:transferReport"); + params.put(FileReportAction.DESTINATION, filePlan.toString()); + RecordsManagementActionResult transferReportAction = rmActionService.executeRecordsManagementAction(getTransferObject(), FileReportAction.NAME, params); + // Check transfer report result + String transferReportName = (String) transferReportAction.getValue(); + assertFalse(StringUtils.isBlank(transferReportName)); + return null; + } + }); + } + + /** + * Helper method for creating a transfer object + * + * @return Node reference of the transfer object + */ + private NodeRef getTransferObject() + { + NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + utils.createDispositionSchedule( + recordCategory, + CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, + CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, + false, // record level + true, // set the default actions + true); // extended disposition schedule + + NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate()); + + // Set the record folder identifier + String identifier = identifierService.generateIdentifier(TYPE_RECORD_FOLDER, recordCategory); + nodeService.setProperty(recordFolder, PROP_IDENTIFIER, identifier); + + // Complete event + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME); + rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params); + + // Cut off folder + rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME); + + // Transfer folder + RecordsManagementActionResult transferAction = rmActionService.executeRecordsManagementAction(recordFolder, TransferAction.NAME); + NodeRef transferObject = (NodeRef) transferAction.getValue(); + assertTrue(transferObject != null); + + return transferObject; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ServiceBaseImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ServiceBaseImplTest.java index d6b92fba09..36104807e8 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ServiceBaseImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/ServiceBaseImplTest.java @@ -1,118 +1,118 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestServiceImpl; -import org.alfresco.service.namespace.QName; - -/** - * Unit test for service base implementation. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class ServiceBaseImplTest extends BaseRMTestCase -{ - /** test service */ - private TestServiceImpl testService; - - /** - * Init services - */ - @Override - protected void initServices() - { - super.initServices(); - - testService = (TestServiceImpl)applicationContext.getBean("testService"); - } - - /** - * test instanceOf() - */ - public void testInstanceOf() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertTrue(testService.doInstanceOf(rmFolder, ContentModel.TYPE_FOLDER)); - assertTrue(testService.doInstanceOf(rmFolder, TYPE_RECORD_FOLDER)); - assertFalse(testService.doInstanceOf(rmFolder, TYPE_RECORD_CATEGORY)); - - return null; - } - }); - - } - - /** - * test getNextCounter() - */ - public void testGetNextCounter() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - assertNull(nodeService.getProperty(rmFolder, PROP_COUNT)); - assertEquals(1, testService.doGetNextCount(rmFolder)); - assertEquals(2, testService.doGetNextCount(rmFolder)); - assertEquals(3, testService.doGetNextCount(rmFolder)); - - return null; - } - }); - - } - - /** - * test getTypeAndAspects() - */ - public void testGetTypeAndAspects() - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - Set result = testService.doGetTypeAndApsects(rmFolder); - assertTrue(result.contains(TYPE_RECORD_FOLDER)); - - return null; - } - }); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.TestServiceImpl; +import org.alfresco.service.namespace.QName; + +/** + * Unit test for service base implementation. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class ServiceBaseImplTest extends BaseRMTestCase +{ + /** test service */ + private TestServiceImpl testService; + + /** + * Init services + */ + @Override + protected void initServices() + { + super.initServices(); + + testService = (TestServiceImpl)applicationContext.getBean("testService"); + } + + /** + * test instanceOf() + */ + public void testInstanceOf() + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + assertTrue(testService.doInstanceOf(rmFolder, ContentModel.TYPE_FOLDER)); + assertTrue(testService.doInstanceOf(rmFolder, TYPE_RECORD_FOLDER)); + assertFalse(testService.doInstanceOf(rmFolder, TYPE_RECORD_CATEGORY)); + + return null; + } + }); + + } + + /** + * test getNextCounter() + */ + public void testGetNextCounter() + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + assertNull(nodeService.getProperty(rmFolder, PROP_COUNT)); + assertEquals(1, testService.doGetNextCount(rmFolder)); + assertEquals(2, testService.doGetNextCount(rmFolder)); + assertEquals(3, testService.doGetNextCount(rmFolder)); + + return null; + } + }); + + } + + /** + * test getTypeAndAspects() + */ + public void testGetTypeAndAspects() + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + Set result = testService.doGetTypeAndApsects(rmFolder); + assertTrue(result.contains(TYPE_RECORD_FOLDER)); + + return null; + } + }); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/VitalRecordServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/VitalRecordServiceImplTest.java index 202f6e69ad..1882cf51cf 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/VitalRecordServiceImplTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/VitalRecordServiceImplTest.java @@ -1,470 +1,470 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.service; - -import java.util.Date; - -import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.util.GUID; - -/** - * Vital record service implementation unit test. - * - * @author Roy Wetherall - */ -public class VitalRecordServiceImplTest extends BaseRMTestCase -{ - /** Test periods */ - protected static final Period PERIOD_NONE = new Period("none|0"); - protected static final Period PERIOD_WEEK = new Period("week|1"); - protected static final Period PERIOD_MONTH = new Period("month|1"); - - /** Test records */ - private NodeRef mhRecord51; - private NodeRef mhRecord52; - private NodeRef mhRecord53; - private NodeRef mhRecord54; - private NodeRef mhRecord55; - - /** - * Indicate this test uses the collaboration site test data - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** Indicate this is a multi hierarchy test */ - @Override - protected boolean isMultiHierarchyTest() - { - return true; - } - - /** vital record multi-hierarchy test data - * - * |--rmRootContainer (no vr def) - * | - * |--mhContainer (no vr def) - * | - * |--mhContainer-1-1 (has schedule - folder level) (no vr def) - * | | - * | |--mhContainer-2-1 (vr def) - * | | - * | |--mhContainer-3-1 (no vr def) - * | - * |--mhContainer-1-2 (has schedule - folder level) (no vr def) - * | - * |--mhContainer-2-2 (no vr def) - * | | - * | |--mhContainer-3-2 (vr def disabled) - * | | - * | |--mhContainer-3-3 (has schedule - record level) (vr def) - * | - * |--mhContainer-2-3 (has schedule - folder level) (vr def) - * | - * |--mhContainer-3-4 (no vr def) - * | - * |--mhContainer-3-5 (has schedule- record level) (vr def) - */ - @Override - protected void setupMultiHierarchyTestData() - { - // Load core test data - super.setupMultiHierarchyTestData(); - - // Setup vital record definitions - setupVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - setupVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); - setupVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); - setupVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); - setupVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - // Create records - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - mhRecord51 = utils.createRecord(mhRecordFolder41, "record51.txt"); - mhRecord52 = utils.createRecord(mhRecordFolder42, "record52.txt"); - mhRecord53 = utils.createRecord(mhRecordFolder43, "record53.txt"); - mhRecord54 = utils.createRecord(mhRecordFolder44, "record54.txt"); - mhRecord55 = utils.createRecord(mhRecordFolder45, "record55.txt"); - - return null; - } - }); - } - - /** - * Helper to set up the vital record definition data in a transactional manner. - * - * @param nodeRef - * @param enabled - * @param period - */ - private void setupVitalRecordDefinition(final NodeRef nodeRef, final boolean enabled, final Period period) - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - vitalRecordService.setVitalRecordDefintion(nodeRef, enabled, period); - return null; - } - }); - } - - /** - * Based on the initial data: - * - check category, folder and record raw values. - * - check search aspect values. - */ - public void testInit() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - assertHasVitalRecordDefinition(mhContainer, false, null); - assertHasVitalRecordDefinition(mhContainer11, false, null); - assertHasVitalRecordDefinition(mhContainer12, false, null); - assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer22, false, null); - assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer31, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - assertHasVitalRecordDefinition(mhRecordFolder41, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder42, false, null); - assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); - - assertVitalRecord(mhRecord51, true, PERIOD_WEEK); - assertVitalRecord(mhRecord52, false, null); - assertVitalRecord(mhRecord53, true, PERIOD_WEEK); - assertVitalRecord(mhRecord54, true, PERIOD_WEEK); - assertVitalRecord(mhRecord55, true, PERIOD_MONTH); - - return null; - } - }); - } - - /** - * Test that when new record categories and record folders are created in an existing file plan - * structure that they correctly inherit the correct vital record property values - */ - public void testValueInheritance() throws Exception - { - // Test record category value inheritance - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return filePlanService.createRecordCategory(mhContainer35, GUID.generate()); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertHasVitalRecordDefinition(result, true, PERIOD_MONTH); - } - }); - - // Test record folder value inheritance - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - return recordFolderService.createRecordFolder(mhContainer32, GUID.generate()); - } - - @Override - public void test(NodeRef result) throws Exception - { - assertHasVitalRecordDefinition(result, false, PERIOD_WEEK); - } - }); - } - - /** Filling tests */ - - public void testFileNewContent() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public NodeRef run() - { - NodeRef record = fileFolderService.create(mhRecordFolder41, "test101.txt" , TYPE_CONTENT).getNodeRef(); - - ContentWriter writer = contentService.getWriter(record, PROP_CONTENT, true); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent("hello world this is some test content"); - - return record; - } - - @Override - public void test(NodeRef record) throws Exception - { - assertVitalRecord(record, true, PERIOD_WEEK); - } - }); - } - -// public void testFileUnfiledrecord() throws Exception -// { -// doTestInTransaction(new Test() -// { -// @Override -// public NodeRef run() throws Exception -// { -// recordService.createRecord(filePlan, dmDocument); -// fileFolderService.move(dmDocument, mhRecordFolder41, "record.txt"); -// -// return dmDocument; -// } -// -// @Override -// public void test(NodeRef record) throws Exception -// { -// assertVitalRecord(record, true, PERIOD_WEEK); -// } -// }); -// } -// -// public void testFileDirectlyFromCollab() throws Exception -// { -// doTestInTransaction(new Test() -// { -// @Override -// public NodeRef run() throws Exception -// { -// fileFolderService.move(dmDocument, mhRecordFolder41, "record.txt"); -// return dmDocument; -// } -// -// @Override -// public void test(NodeRef record) throws Exception -// { -// assertVitalRecord(record, true, PERIOD_WEEK); -// } -// }); -// } - - /** Helper Methods */ - - /** - * Test to ensure that changes made to vital record definitions are reflected down the hierarchy. - */ - public void testChangesToVitalRecordDefinitions() throws Exception - { - // Override vital record definition - doTestInTransaction(new Test() - { - @Override - public Void run() - { - setupVitalRecordDefinition(mhContainer31, true, PERIOD_MONTH); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertHasVitalRecordDefinition(mhContainer, false, null); - assertHasVitalRecordDefinition(mhContainer11, false, null); - assertHasVitalRecordDefinition(mhContainer12, false, null); - assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer22, false, null); - assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer31, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - assertHasVitalRecordDefinition(mhRecordFolder41, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhRecordFolder42, false, null); - assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); - - assertVitalRecord(mhRecord51, true, PERIOD_MONTH); - assertVitalRecord(mhRecord52, false, null); - assertVitalRecord(mhRecord53, true, PERIOD_WEEK); - assertVitalRecord(mhRecord54, true, PERIOD_WEEK); - assertVitalRecord(mhRecord55, true, PERIOD_MONTH); - } - }); - - // 'turn off' vital record def - doTestInTransaction(new Test() - { - @Override - public Void run() - { - setupVitalRecordDefinition(mhContainer31, false, PERIOD_NONE); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertHasVitalRecordDefinition(mhContainer, false, null); - assertHasVitalRecordDefinition(mhContainer11, false, null); - assertHasVitalRecordDefinition(mhContainer12, false, null); - assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer22, false, null); - assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer31, false, null); - assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - assertHasVitalRecordDefinition(mhRecordFolder41, false, null); - assertHasVitalRecordDefinition(mhRecordFolder42, false, null); - assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); - - assertVitalRecord(mhRecord51, false, null); - assertVitalRecord(mhRecord52, false, null); - assertVitalRecord(mhRecord53, true, PERIOD_WEEK); - assertVitalRecord(mhRecord54, true, PERIOD_WEEK); - assertVitalRecord(mhRecord55, true, PERIOD_MONTH); - } - }); - - // Test parent change overrites existing - doTestInTransaction(new Test() - { - @Override - public Void run() - { - setupVitalRecordDefinition(mhContainer12, true, PERIOD_MONTH); - return null; - } - - @Override - public void test(Void result) throws Exception - { - assertHasVitalRecordDefinition(mhContainer, false, null); - assertHasVitalRecordDefinition(mhContainer11, false, null); - assertHasVitalRecordDefinition(mhContainer12, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); - assertHasVitalRecordDefinition(mhContainer22, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer31, false, null); - assertHasVitalRecordDefinition(mhContainer32, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); - - assertHasVitalRecordDefinition(mhRecordFolder41, false, null); - assertHasVitalRecordDefinition(mhRecordFolder42, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_MONTH); - assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); - - assertVitalRecord(mhRecord51, false, null); - assertVitalRecord(mhRecord52, true, PERIOD_MONTH); - assertVitalRecord(mhRecord53, true, PERIOD_MONTH); - assertVitalRecord(mhRecord54, true, PERIOD_MONTH); - assertVitalRecord(mhRecord55, true, PERIOD_MONTH); - } - }); - - } - - @SuppressWarnings("deprecation") - private void assertHasVitalRecordDefinition(NodeRef nodeRef, boolean enabled, Period period) - { - assertTrue(nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION)); - - VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef); - assertNotNull(def); - - Boolean vitalRecordIndicator = (Boolean)nodeService.getProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR); - assertNotNull(vitalRecordIndicator); - assertEquals(enabled, vitalRecordIndicator.booleanValue()); - assertEquals(enabled, def.isEnabled()); - - if (enabled) - { - Period reviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); - assertNotNull(reviewPeriod); - assertEquals(period, reviewPeriod); - assertEquals(period, def.getReviewPeriod()); - assertEquals(period.getNextDate(new Date()).getDate(), def.getNextReviewDate().getDate()); - } - } - - @SuppressWarnings("deprecation") - private void assertVitalRecord(NodeRef nodeRef, boolean enabled, Period period) - { - assertEquals(enabled, nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)); - if (enabled) - { - Date reviewAsOf = (Date)nodeService.getProperty(nodeRef, PROP_REVIEW_AS_OF); - assertNotNull(reviewAsOf); - assertEquals(period.getNextDate(new Date()).getDate(), reviewAsOf.getDate()); - - assertEquals(period.getPeriodType(), nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD)); - assertEquals(period.getExpression(), nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)); - } - else - { - assertNull(nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD)); - assertNull(nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.service; + +import java.util.Date; + +import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordDefinition; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.util.GUID; + +/** + * Vital record service implementation unit test. + * + * @author Roy Wetherall + */ +public class VitalRecordServiceImplTest extends BaseRMTestCase +{ + /** Test periods */ + protected static final Period PERIOD_NONE = new Period("none|0"); + protected static final Period PERIOD_WEEK = new Period("week|1"); + protected static final Period PERIOD_MONTH = new Period("month|1"); + + /** Test records */ + private NodeRef mhRecord51; + private NodeRef mhRecord52; + private NodeRef mhRecord53; + private NodeRef mhRecord54; + private NodeRef mhRecord55; + + /** + * Indicate this test uses the collaboration site test data + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** Indicate this is a multi hierarchy test */ + @Override + protected boolean isMultiHierarchyTest() + { + return true; + } + + /** vital record multi-hierarchy test data + * + * |--rmRootContainer (no vr def) + * | + * |--mhContainer (no vr def) + * | + * |--mhContainer-1-1 (has schedule - folder level) (no vr def) + * | | + * | |--mhContainer-2-1 (vr def) + * | | + * | |--mhContainer-3-1 (no vr def) + * | + * |--mhContainer-1-2 (has schedule - folder level) (no vr def) + * | + * |--mhContainer-2-2 (no vr def) + * | | + * | |--mhContainer-3-2 (vr def disabled) + * | | + * | |--mhContainer-3-3 (has schedule - record level) (vr def) + * | + * |--mhContainer-2-3 (has schedule - folder level) (vr def) + * | + * |--mhContainer-3-4 (no vr def) + * | + * |--mhContainer-3-5 (has schedule- record level) (vr def) + */ + @Override + protected void setupMultiHierarchyTestData() + { + // Load core test data + super.setupMultiHierarchyTestData(); + + // Setup vital record definitions + setupVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); + setupVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); + setupVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); + setupVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); + setupVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); + + // Create records + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + mhRecord51 = utils.createRecord(mhRecordFolder41, "record51.txt"); + mhRecord52 = utils.createRecord(mhRecordFolder42, "record52.txt"); + mhRecord53 = utils.createRecord(mhRecordFolder43, "record53.txt"); + mhRecord54 = utils.createRecord(mhRecordFolder44, "record54.txt"); + mhRecord55 = utils.createRecord(mhRecordFolder45, "record55.txt"); + + return null; + } + }); + } + + /** + * Helper to set up the vital record definition data in a transactional manner. + * + * @param nodeRef + * @param enabled + * @param period + */ + private void setupVitalRecordDefinition(final NodeRef nodeRef, final boolean enabled, final Period period) + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + vitalRecordService.setVitalRecordDefintion(nodeRef, enabled, period); + return null; + } + }); + } + + /** + * Based on the initial data: + * - check category, folder and record raw values. + * - check search aspect values. + */ + public void testInit() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + assertHasVitalRecordDefinition(mhContainer, false, null); + assertHasVitalRecordDefinition(mhContainer11, false, null); + assertHasVitalRecordDefinition(mhContainer12, false, null); + assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer22, false, null); + assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer31, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); + + assertHasVitalRecordDefinition(mhRecordFolder41, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhRecordFolder42, false, null); + assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); + + assertVitalRecord(mhRecord51, true, PERIOD_WEEK); + assertVitalRecord(mhRecord52, false, null); + assertVitalRecord(mhRecord53, true, PERIOD_WEEK); + assertVitalRecord(mhRecord54, true, PERIOD_WEEK); + assertVitalRecord(mhRecord55, true, PERIOD_MONTH); + + return null; + } + }); + } + + /** + * Test that when new record categories and record folders are created in an existing file plan + * structure that they correctly inherit the correct vital record property values + */ + public void testValueInheritance() throws Exception + { + // Test record category value inheritance + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + return filePlanService.createRecordCategory(mhContainer35, GUID.generate()); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertHasVitalRecordDefinition(result, true, PERIOD_MONTH); + } + }); + + // Test record folder value inheritance + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + return recordFolderService.createRecordFolder(mhContainer32, GUID.generate()); + } + + @Override + public void test(NodeRef result) throws Exception + { + assertHasVitalRecordDefinition(result, false, PERIOD_WEEK); + } + }); + } + + /** Filling tests */ + + public void testFileNewContent() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public NodeRef run() + { + NodeRef record = fileFolderService.create(mhRecordFolder41, "test101.txt" , TYPE_CONTENT).getNodeRef(); + + ContentWriter writer = contentService.getWriter(record, PROP_CONTENT, true); + writer.setEncoding("UTF-8"); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.putContent("hello world this is some test content"); + + return record; + } + + @Override + public void test(NodeRef record) throws Exception + { + assertVitalRecord(record, true, PERIOD_WEEK); + } + }); + } + +// public void testFileUnfiledrecord() throws Exception +// { +// doTestInTransaction(new Test() +// { +// @Override +// public NodeRef run() throws Exception +// { +// recordService.createRecord(filePlan, dmDocument); +// fileFolderService.move(dmDocument, mhRecordFolder41, "record.txt"); +// +// return dmDocument; +// } +// +// @Override +// public void test(NodeRef record) throws Exception +// { +// assertVitalRecord(record, true, PERIOD_WEEK); +// } +// }); +// } +// +// public void testFileDirectlyFromCollab() throws Exception +// { +// doTestInTransaction(new Test() +// { +// @Override +// public NodeRef run() throws Exception +// { +// fileFolderService.move(dmDocument, mhRecordFolder41, "record.txt"); +// return dmDocument; +// } +// +// @Override +// public void test(NodeRef record) throws Exception +// { +// assertVitalRecord(record, true, PERIOD_WEEK); +// } +// }); +// } + + /** Helper Methods */ + + /** + * Test to ensure that changes made to vital record definitions are reflected down the hierarchy. + */ + public void testChangesToVitalRecordDefinitions() throws Exception + { + // Override vital record definition + doTestInTransaction(new Test() + { + @Override + public Void run() + { + setupVitalRecordDefinition(mhContainer31, true, PERIOD_MONTH); + return null; + } + + @Override + public void test(Void result) throws Exception + { + assertHasVitalRecordDefinition(mhContainer, false, null); + assertHasVitalRecordDefinition(mhContainer11, false, null); + assertHasVitalRecordDefinition(mhContainer12, false, null); + assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer22, false, null); + assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer31, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); + + assertHasVitalRecordDefinition(mhRecordFolder41, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhRecordFolder42, false, null); + assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); + + assertVitalRecord(mhRecord51, true, PERIOD_MONTH); + assertVitalRecord(mhRecord52, false, null); + assertVitalRecord(mhRecord53, true, PERIOD_WEEK); + assertVitalRecord(mhRecord54, true, PERIOD_WEEK); + assertVitalRecord(mhRecord55, true, PERIOD_MONTH); + } + }); + + // 'turn off' vital record def + doTestInTransaction(new Test() + { + @Override + public Void run() + { + setupVitalRecordDefinition(mhContainer31, false, PERIOD_NONE); + return null; + } + + @Override + public void test(Void result) throws Exception + { + assertHasVitalRecordDefinition(mhContainer, false, null); + assertHasVitalRecordDefinition(mhContainer11, false, null); + assertHasVitalRecordDefinition(mhContainer12, false, null); + assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer22, false, null); + assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer31, false, null); + assertHasVitalRecordDefinition(mhContainer32, false, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); + + assertHasVitalRecordDefinition(mhRecordFolder41, false, null); + assertHasVitalRecordDefinition(mhRecordFolder42, false, null); + assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); + + assertVitalRecord(mhRecord51, false, null); + assertVitalRecord(mhRecord52, false, null); + assertVitalRecord(mhRecord53, true, PERIOD_WEEK); + assertVitalRecord(mhRecord54, true, PERIOD_WEEK); + assertVitalRecord(mhRecord55, true, PERIOD_MONTH); + } + }); + + // Test parent change overrites existing + doTestInTransaction(new Test() + { + @Override + public Void run() + { + setupVitalRecordDefinition(mhContainer12, true, PERIOD_MONTH); + return null; + } + + @Override + public void test(Void result) throws Exception + { + assertHasVitalRecordDefinition(mhContainer, false, null); + assertHasVitalRecordDefinition(mhContainer11, false, null); + assertHasVitalRecordDefinition(mhContainer12, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhContainer21, true, PERIOD_WEEK); + assertHasVitalRecordDefinition(mhContainer22, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhContainer23, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhContainer31, false, null); + assertHasVitalRecordDefinition(mhContainer32, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhContainer33, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhContainer34, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhContainer35, true, PERIOD_MONTH); + + assertHasVitalRecordDefinition(mhRecordFolder41, false, null); + assertHasVitalRecordDefinition(mhRecordFolder42, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhRecordFolder43, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhRecordFolder44, true, PERIOD_MONTH); + assertHasVitalRecordDefinition(mhRecordFolder45, true, PERIOD_MONTH); + + assertVitalRecord(mhRecord51, false, null); + assertVitalRecord(mhRecord52, true, PERIOD_MONTH); + assertVitalRecord(mhRecord53, true, PERIOD_MONTH); + assertVitalRecord(mhRecord54, true, PERIOD_MONTH); + assertVitalRecord(mhRecord55, true, PERIOD_MONTH); + } + }); + + } + + @SuppressWarnings("deprecation") + private void assertHasVitalRecordDefinition(NodeRef nodeRef, boolean enabled, Period period) + { + assertTrue(nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION)); + + VitalRecordDefinition def = vitalRecordService.getVitalRecordDefinition(nodeRef); + assertNotNull(def); + + Boolean vitalRecordIndicator = (Boolean)nodeService.getProperty(nodeRef, PROP_VITAL_RECORD_INDICATOR); + assertNotNull(vitalRecordIndicator); + assertEquals(enabled, vitalRecordIndicator.booleanValue()); + assertEquals(enabled, def.isEnabled()); + + if (enabled) + { + Period reviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); + assertNotNull(reviewPeriod); + assertEquals(period, reviewPeriod); + assertEquals(period, def.getReviewPeriod()); + assertEquals(period.getNextDate(new Date()).getDate(), def.getNextReviewDate().getDate()); + } + } + + @SuppressWarnings("deprecation") + private void assertVitalRecord(NodeRef nodeRef, boolean enabled, Period period) + { + assertEquals(enabled, nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)); + if (enabled) + { + Date reviewAsOf = (Date)nodeService.getProperty(nodeRef, PROP_REVIEW_AS_OF); + assertNotNull(reviewAsOf); + assertEquals(period.getNextDate(new Date()).getDate(), reviewAsOf.getDate()); + + assertEquals(period.getPeriodType(), nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD)); + assertEquals(period.getExpression(), nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)); + } + else + { + assertNull(nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD)); + assertNull(nodeService.getProperty(nodeRef, RecordsManagementSearchBehaviour.PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)); + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ActionDefinitionsRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ActionDefinitionsRestApiTest.java index fa678d6d8e..4daa0fc4c2 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ActionDefinitionsRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ActionDefinitionsRestApiTest.java @@ -1,120 +1,120 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for Action Definitions - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class ActionDefinitionsRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - private static final String RM_ACTIONDEFINITIONS_URL = "/api/rm/rm-actiondefinitions"; - - /** - * Test the REST API to retrieve the list of rm action definitions - * - * @throws IOException - * @throws JSONException - */ - public void testRmGetActionDefinitions() throws IOException, JSONException - { - // Send request - Response response = sendRequest(new GetRequest(RM_ACTIONDEFINITIONS_URL), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json and check the data - JSONObject contentAsJson = new JSONObject(contentAsString); - JSONArray data = contentAsJson.getJSONArray("data"); - assertNotNull(data); - - // Get a (sub)list of available dm action definitions - List dmActionDefinitions = getDmActionDefinitions(); - - // Get the list of rm action definitions from the response and check it - List rmActionDefinitions = new ArrayList(); - for (int i = 0; i < data.length(); i++) - { - String name = data.getJSONObject(i).getString("name"); - assertNotNull(name); - rmActionDefinitions.add(name); - assertFalse(dmActionDefinitions.contains(name)); - } - assertTrue(rmActionDefinitions.containsAll(getRmActionDefinitions())); - } - - /** - * Returns a (sub)list of rm action definitions - * - * @return A (sub)list of rm action definitions - */ - private List getRmActionDefinitions() - { - return Arrays.asList(new String[] - { - "reject", - "fileTo", - "declareRecord" - }); - } - - /** - * Returns a (sub)list of dm action definitions - * - * @return A (sub)list of dm action definitions - */ - private List getDmActionDefinitions() - { - return Arrays.asList(new String[] - { - "check-in", - "check-out", - "mail", - "move", - "transform" - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * REST API Tests for Action Definitions + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class ActionDefinitionsRestApiTest extends BaseRMWebScriptTestCase +{ + /** URL for the REST APIs */ + private static final String RM_ACTIONDEFINITIONS_URL = "/api/rm/rm-actiondefinitions"; + + /** + * Test the REST API to retrieve the list of rm action definitions + * + * @throws IOException + * @throws JSONException + */ + public void testRmGetActionDefinitions() throws IOException, JSONException + { + // Send request + Response response = sendRequest(new GetRequest(RM_ACTIONDEFINITIONS_URL), Status.STATUS_OK); + + // Check the content from the response + String contentAsString = response.getContentAsString(); + assertNotNull(contentAsString); + + // Convert the response to json and check the data + JSONObject contentAsJson = new JSONObject(contentAsString); + JSONArray data = contentAsJson.getJSONArray("data"); + assertNotNull(data); + + // Get a (sub)list of available dm action definitions + List dmActionDefinitions = getDmActionDefinitions(); + + // Get the list of rm action definitions from the response and check it + List rmActionDefinitions = new ArrayList(); + for (int i = 0; i < data.length(); i++) + { + String name = data.getJSONObject(i).getString("name"); + assertNotNull(name); + rmActionDefinitions.add(name); + assertFalse(dmActionDefinitions.contains(name)); + } + assertTrue(rmActionDefinitions.containsAll(getRmActionDefinitions())); + } + + /** + * Returns a (sub)list of rm action definitions + * + * @return A (sub)list of rm action definitions + */ + private List getRmActionDefinitions() + { + return Arrays.asList(new String[] + { + "reject", + "fileTo", + "declareRecord" + }); + } + + /** + * Returns a (sub)list of dm action definitions + * + * @return A (sub)list of dm action definitions + */ + private List getDmActionDefinitions() + { + return Arrays.asList(new String[] + { + "check-in", + "check-out", + "mail", + "move", + "transform" + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/AuditRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/AuditRestApiTest.java index 449c580906..e1f49730b4 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/AuditRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/AuditRestApiTest.java @@ -1,100 +1,100 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import static org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.DEFAULT_RM_SITE_ID; - -import java.io.IOException; -import java.text.MessageFormat; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; - -public class AuditRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - protected static final String GET_NODE_AUDITLOG_URL_FORMAT = "/api/node/{0}/rmauditlog"; - - private static final String USER_WITHOUT_AUDIT_CAPABILITY = GUID.generate(); - - private NodeRef record; - - public void testAuditAccessCapability() throws IOException - { - - String recordAuditUrl = MessageFormat.format(GET_NODE_AUDITLOG_URL_FORMAT,record.toString().replace("://", "/")); - - sendRequest(new GetRequest(recordAuditUrl), Status.STATUS_OK, AuthenticationUtil.getAdminUserName() ); - - sendRequest(new GetRequest(recordAuditUrl), Status.STATUS_FORBIDDEN, USER_WITHOUT_AUDIT_CAPABILITY ); - } - - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil - .getSystemUserName()); - - createUser(USER_WITHOUT_AUDIT_CAPABILITY); - - record = utils.createRecord(recordFolder, GUID.generate()); - - - return null; - } - }); - } - - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - deleteUser(USER_WITHOUT_AUDIT_CAPABILITY); - } - - protected String getRMSiteId() - { - return DEFAULT_RM_SITE_ID; - } - - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import static org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.DEFAULT_RM_SITE_ID; + +import java.io.IOException; +import java.text.MessageFormat; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.GUID; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; + +public class AuditRestApiTest extends BaseRMWebScriptTestCase +{ + /** URL for the REST APIs */ + protected static final String GET_NODE_AUDITLOG_URL_FORMAT = "/api/node/{0}/rmauditlog"; + + private static final String USER_WITHOUT_AUDIT_CAPABILITY = GUID.generate(); + + private NodeRef record; + + public void testAuditAccessCapability() throws IOException + { + + String recordAuditUrl = MessageFormat.format(GET_NODE_AUDITLOG_URL_FORMAT,record.toString().replace("://", "/")); + + sendRequest(new GetRequest(recordAuditUrl), Status.STATUS_OK, AuthenticationUtil.getAdminUserName() ); + + sendRequest(new GetRequest(recordAuditUrl), Status.STATUS_FORBIDDEN, USER_WITHOUT_AUDIT_CAPABILITY ); + } + + @Override + protected void setupTestData() + { + super.setupTestData(); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil + .getSystemUserName()); + + createUser(USER_WITHOUT_AUDIT_CAPABILITY); + + record = utils.createRecord(recordFolder, GUID.generate()); + + + return null; + } + }); + } + + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + + deleteUser(USER_WITHOUT_AUDIT_CAPABILITY); + } + + protected String getRMSiteId() + { + return DEFAULT_RM_SITE_ID; + } + + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/CapabilitiesRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/CapabilitiesRestApiTest.java index 0696cd0697..5297f55385 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/CapabilitiesRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/CapabilitiesRestApiTest.java @@ -1,120 +1,120 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; -import java.text.MessageFormat; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Test for Capabilities - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase -{ - /** URLs for the REST API */ - private static final String GET_CAPABILITIES_URL = "/api/node/{0}/{1}/{2}/capabilities?"; - - /** - * Tests the REST API to get the list of capabilities - * - * @throws IOException - * @throws JSONException - */ - public void testGetCapabilitiesAction() throws IOException, JSONException - { - String baseURL = MessageFormat.format(GET_CAPABILITIES_URL, - filePlan.getStoreRef().getProtocol(), - filePlan.getStoreRef().getIdentifier(), - filePlan.getId()); - - // Format url and send request - String getUrl = String.format(baseURL + "includeAll=%s", true); - Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); - - // Check the content from the response - String getContentAsString = getResponse.getContentAsString(); - assertNotNull(getContentAsString); - - System.out.println(getContentAsString); - - // Convert the response to json and check the data - JSONObject getContentAsJson = new JSONObject(getContentAsString); - JSONObject getData = getContentAsJson.getJSONObject("data"); - assertNotNull(getData); - - // Get the capabilities and check them - JSONArray getDataSets = getData.getJSONArray("capabilities"); - assertNotNull(getDataSets); - - // Format url and send another request with different parameter - getUrl = String.format(baseURL + "grouped=%s", true); - getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); - - // Check the content from the response - getContentAsString = getResponse.getContentAsString(); - assertNotNull(getContentAsString); - - // If both parameters are specified the result should be the same with only specifying the "grouped" parameter - getUrl = String.format(baseURL + "includeAll=%s&grouped=%s", true, true); - getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); - getContentAsString.equalsIgnoreCase(getResponse.getContentAsString()); - - // Convert the response to json and check the data - getContentAsJson = new JSONObject(getContentAsString); - getData = getContentAsJson.getJSONObject("data"); - assertNotNull(getData); - - // Get the grouped capabilities and check them - getDataSets = getData.getJSONArray("groupedCapabilities"); - assertNotNull(getDataSets); - - // Check the JSON structure - int length = getDataSets.length(); - if (length > 0) - { - for (int i = 0; i < length; i++) - { - JSONObject jsonObject = getDataSets.getJSONObject(i); - String key = (String) jsonObject.keys().next(); - JSONObject value = jsonObject.getJSONObject(key); - assertNotNull(value.getString("groupTitle")); - assertNotNull(value.getJSONObject("capabilities")); - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; +import java.text.MessageFormat; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * REST API Test for Capabilities + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase +{ + /** URLs for the REST API */ + private static final String GET_CAPABILITIES_URL = "/api/node/{0}/{1}/{2}/capabilities?"; + + /** + * Tests the REST API to get the list of capabilities + * + * @throws IOException + * @throws JSONException + */ + public void testGetCapabilitiesAction() throws IOException, JSONException + { + String baseURL = MessageFormat.format(GET_CAPABILITIES_URL, + filePlan.getStoreRef().getProtocol(), + filePlan.getStoreRef().getIdentifier(), + filePlan.getId()); + + // Format url and send request + String getUrl = String.format(baseURL + "includeAll=%s", true); + Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); + + // Check the content from the response + String getContentAsString = getResponse.getContentAsString(); + assertNotNull(getContentAsString); + + System.out.println(getContentAsString); + + // Convert the response to json and check the data + JSONObject getContentAsJson = new JSONObject(getContentAsString); + JSONObject getData = getContentAsJson.getJSONObject("data"); + assertNotNull(getData); + + // Get the capabilities and check them + JSONArray getDataSets = getData.getJSONArray("capabilities"); + assertNotNull(getDataSets); + + // Format url and send another request with different parameter + getUrl = String.format(baseURL + "grouped=%s", true); + getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); + + // Check the content from the response + getContentAsString = getResponse.getContentAsString(); + assertNotNull(getContentAsString); + + // If both parameters are specified the result should be the same with only specifying the "grouped" parameter + getUrl = String.format(baseURL + "includeAll=%s&grouped=%s", true, true); + getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); + getContentAsString.equalsIgnoreCase(getResponse.getContentAsString()); + + // Convert the response to json and check the data + getContentAsJson = new JSONObject(getContentAsString); + getData = getContentAsJson.getJSONObject("data"); + assertNotNull(getData); + + // Get the grouped capabilities and check them + getDataSets = getData.getJSONArray("groupedCapabilities"); + assertNotNull(getDataSets); + + // Check the JSON structure + int length = getDataSets.length(); + if (length > 0) + { + for (int i = 0; i < length; i++) + { + JSONObject jsonObject = getDataSets.getJSONObject(i); + String key = (String) jsonObject.keys().next(); + JSONObject value = jsonObject.getJSONObject(key); + assertNotNull(value.getString("groupTitle")); + assertNotNull(value.getJSONObject("capabilities")); + } + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DataSetRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DataSetRestApiTest.java index c4518c1ed9..743775c420 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DataSetRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DataSetRestApiTest.java @@ -1,120 +1,120 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -public class DataSetRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - private static final String GET_DATASETS_URL = "/api/rma/datasets?site=%s"; - //private static final String POST_DATASET_URL = "/api/rma/datasets/%s?site=%s"; - - /** Constant for the content type */ - //private static final String APPLICATION_JSON = "application/json"; - - /** - * Test the REST API to retrieve details of available RM data sets - * and to import an RM data set into a file plan - * - * @throws IOException - * @throws JSONException - */ - public void testGetPostDataSetAction() throws IOException, JSONException - { - /** Test GET */ - - // Format url and send request - String getUrl = String.format(GET_DATASETS_URL, siteId); - Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); - - // Check the content from the response - String getContentAsString = getResponse.getContentAsString(); - assertNotNull(getContentAsString); - - // Convert the response to json and check the data - JSONObject getContentAsJson = new JSONObject(getContentAsString); - JSONObject getData = getContentAsJson.getJSONObject("data"); - assertNotNull(getData); - - // Get the data sets and check them - JSONArray getDataSets = getData.getJSONArray("datasets"); - assertNotNull(getDataSets); - - // Check the label and the id of the data sets - for (int i = 0; i < getDataSets.length(); i++) - { - JSONObject dataSet = (JSONObject) getDataSets.get(i); - assertTrue(dataSet.length() == 3); - assertNotNull(dataSet.get("label")); - assertNotNull(dataSet.get("id")); - assertNotNull(dataSet.get("isLoaded")); - } - - /** Test POST */ -// String dataSetId = getDataSets.getJSONObject(0).getString("id"); -// if (StringUtils.isNotBlank(dataSetId)) -// { -// // Format url and send request -// String url = String.format(POST_DATASET_URL, dataSetId, SITE_ID); -// Response response = sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); -// -// // Check the content from the response -// String contentAsString = response.getContentAsString(); -// assertNotNull(contentAsString); -// -// // Convert the response to json and check the result -// JSONObject contentAsJson = new JSONObject(contentAsString); -// String success = contentAsJson.getString("success"); -// assertNotNull(success); -// assertTrue(success.equals("true")); -// -// // It is not possible to import the same data set into the same file plan -// response = sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); -// -// // Check the content from the response -// contentAsString = response.getContentAsString(); -// assertNotNull(contentAsString); -// -// // Convert the response to json and check the result -// contentAsJson = new JSONObject(contentAsString); -// success = contentAsJson.getString("success"); -// assertNotNull(success); -// assertTrue(success.equals("false")); -// assertNotNull(contentAsJson.getString("message")); -// } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +public class DataSetRestApiTest extends BaseRMWebScriptTestCase +{ + /** URL for the REST APIs */ + private static final String GET_DATASETS_URL = "/api/rma/datasets?site=%s"; + //private static final String POST_DATASET_URL = "/api/rma/datasets/%s?site=%s"; + + /** Constant for the content type */ + //private static final String APPLICATION_JSON = "application/json"; + + /** + * Test the REST API to retrieve details of available RM data sets + * and to import an RM data set into a file plan + * + * @throws IOException + * @throws JSONException + */ + public void testGetPostDataSetAction() throws IOException, JSONException + { + /** Test GET */ + + // Format url and send request + String getUrl = String.format(GET_DATASETS_URL, siteId); + Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK); + + // Check the content from the response + String getContentAsString = getResponse.getContentAsString(); + assertNotNull(getContentAsString); + + // Convert the response to json and check the data + JSONObject getContentAsJson = new JSONObject(getContentAsString); + JSONObject getData = getContentAsJson.getJSONObject("data"); + assertNotNull(getData); + + // Get the data sets and check them + JSONArray getDataSets = getData.getJSONArray("datasets"); + assertNotNull(getDataSets); + + // Check the label and the id of the data sets + for (int i = 0; i < getDataSets.length(); i++) + { + JSONObject dataSet = (JSONObject) getDataSets.get(i); + assertTrue(dataSet.length() == 3); + assertNotNull(dataSet.get("label")); + assertNotNull(dataSet.get("id")); + assertNotNull(dataSet.get("isLoaded")); + } + + /** Test POST */ +// String dataSetId = getDataSets.getJSONObject(0).getString("id"); +// if (StringUtils.isNotBlank(dataSetId)) +// { +// // Format url and send request +// String url = String.format(POST_DATASET_URL, dataSetId, SITE_ID); +// Response response = sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); +// +// // Check the content from the response +// String contentAsString = response.getContentAsString(); +// assertNotNull(contentAsString); +// +// // Convert the response to json and check the result +// JSONObject contentAsJson = new JSONObject(contentAsString); +// String success = contentAsJson.getString("success"); +// assertNotNull(success); +// assertTrue(success.equals("true")); +// +// // It is not possible to import the same data set into the same file plan +// response = sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); +// +// // Check the content from the response +// contentAsString = response.getContentAsString(); +// assertNotNull(contentAsString); +// +// // Convert the response to json and check the result +// contentAsJson = new JSONObject(contentAsString); +// success = contentAsJson.getString("success"); +// assertNotNull(success); +// assertTrue(success.equals("false")); +// assertNotNull(contentAsJson.getString("message")); +// } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DispositionRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DispositionRestApiTest.java index f7bed488e0..30e7b1828d 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DispositionRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/DispositionRestApiTest.java @@ -1,447 +1,447 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.text.MessageFormat; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.util.GUID; -import org.json.JSONArray; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * This class tests the Rest API for disposition related operations - * - * @author Gavin Cornwell - */ -public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel -{ - protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - protected static final String GET_SCHEDULE_URL_FORMAT = "/api/node/{0}/dispositionschedule"; - protected static final String GET_LIFECYCLE_URL_FORMAT = "/api/node/{0}/nextdispositionaction"; - protected static final String POST_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions"; - protected static final String DELETE_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions/{1}"; - protected static final String PUT_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions/{1}"; - protected static final String GET_LIST_URL = "/api/rma/admin/listofvalues"; - protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; - protected static final String APPLICATION_JSON = "application/json"; - - - public void testGetDispositionSchedule() throws Exception - { - // Test 404 status for non existent node - int expectedStatus = 404; - String nonExistentNode = "workspace/SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"; - String nonExistentUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, nonExistentNode); - Response rsp = sendRequest(new GetRequest(nonExistentUrl), expectedStatus); - - // Test 404 status for node that doesn't have dispostion schedule i.e. a record series - String seriesNodeUrl = recordSeries.toString().replace("://", "/"); - String wrongNodeUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, seriesNodeUrl); - rsp = sendRequest(new GetRequest(wrongNodeUrl), expectedStatus); - - // Test data structure returned from "AIS Audit Records" - expectedStatus = 200; - - String categoryNodeUrl = recordCategory.toString().replace("://", "/"); - String requestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - rsp = sendRequest(new GetRequest(requestUrl), expectedStatus); - assertEquals("application/json;charset=UTF-8", rsp.getContentType()); - - // get response as JSON - JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertNotNull(jsonParsedObject); - - // check JSON data - JSONObject dataObj = jsonParsedObject.getJSONObject("data"); - assertNotNull(dataObj); - JSONObject rootDataObject = (JSONObject)dataObj; - assertEquals(10, rootDataObject.length()); - - // check individual data items - String serviceUrl = SERVICE_URL_PREFIX + requestUrl; - String url = rootDataObject.getString("url"); - assertEquals(serviceUrl, url); - - String authority = rootDataObject.getString("authority"); - - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, authority); - - String instructions = rootDataObject.getString("instructions"); - assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, instructions); - - String actionsUrl = rootDataObject.getString("actionsUrl"); - assertEquals(serviceUrl + "/dispositionactiondefinitions", actionsUrl); - - boolean recordLevel = rootDataObject.getBoolean("recordLevelDisposition"); - assertFalse(recordLevel); - - assertFalse(rootDataObject.getBoolean("canStepsBeRemoved")); - - JSONArray actions = rootDataObject.getJSONArray("actions"); - assertNotNull(actions); - assertEquals(2, actions.length()); - JSONObject action1 = (JSONObject)actions.get(0); - assertEquals(9, action1.length()); - assertNotNull(action1.get("id")); - assertNotNull(action1.get("url")); - assertEquals(0, action1.getInt("index")); - assertEquals("cutoff", action1.getString("name")); - assertTrue(action1.getBoolean("eligibleOnFirstCompleteEvent")); - - JSONObject action2 = (JSONObject)actions.get(1); - assertEquals(8, action2.length()); - - // make sure the disposition schedule node ref is present and valid - String scheduleNodeRefJSON = rootDataObject.getString("nodeRef"); - NodeRef scheduleNodeRef = new NodeRef(scheduleNodeRefJSON); - assertTrue(this.nodeService.exists(scheduleNodeRef)); - - // create a new recordCategory node in the recordSeries and then get - // the disposition schedule - NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); - dispositionService.createDispositionSchedule(newRecordCategory, null); - - categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); - requestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - //System.out.println("GET response: " + rsp.getContentAsString()); - rsp = sendRequest(new GetRequest(requestUrl), expectedStatus); - - // get response as JSON - jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - System.out.println(rsp.getContentAsString()); - assertNotNull(jsonParsedObject); - - // check JSON data - dataObj = jsonParsedObject.getJSONObject("data"); - assertNotNull(dataObj); - rootDataObject = (JSONObject)dataObj; - assertEquals(8, rootDataObject.length()); - actions = rootDataObject.getJSONArray("actions"); - assertNotNull(actions); - assertEquals(0, actions.length()); - } - - public void testPostDispositionAction() throws Exception - { - // create a new recordCategory node in the recordSeries and then get - // the disposition schedule - NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); - dispositionService.createDispositionSchedule(newRecordCategory, null); - - String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); - String requestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); - - // Construct the JSON request. - String name = "destroy"; - String desc = "Destroy this record after 5 years"; - String period = "year|5"; - String periodProperty = "rma:cutOffDate"; - boolean eligibleOnFirstCompleteEvent = true; - - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("name", name); - jsonPostData.put("description", desc); - jsonPostData.put("period", period); - jsonPostData.put("location", "my location"); - jsonPostData.put("periodProperty", periodProperty); - jsonPostData.put("eligibleOnFirstCompleteEvent", eligibleOnFirstCompleteEvent); - JSONArray events = new JSONArray(); - events.put("superseded"); - events.put("no_longer_needed"); - jsonPostData.put("events", events); - - // Submit the JSON request. - String jsonPostString = jsonPostData.toString(); - Response rsp = sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 200); - - // check the returned data is what was expected - JSONObject jsonResponse = new JSONObject(new JSONTokener(rsp.getContentAsString())); - JSONObject dataObj = jsonResponse.getJSONObject("data"); - JSONObject rootDataObject = (JSONObject)dataObj; - assertNotNull(rootDataObject.getString("id")); - assertNotNull(rootDataObject.getString("url")); - assertEquals(0, rootDataObject.getInt("index")); - assertEquals(name, rootDataObject.getString("name")); - assertEquals("Destroy", rootDataObject.getString("label")); - assertEquals(desc, rootDataObject.getString("description")); - assertEquals(period, rootDataObject.getString("period")); - assertEquals("my location", rootDataObject.getString("location")); - assertEquals(periodProperty, rootDataObject.getString("periodProperty")); - assertTrue(rootDataObject.getBoolean("eligibleOnFirstCompleteEvent")); - events = rootDataObject.getJSONArray("events"); - assertNotNull(events); - assertEquals(2, events.length()); - assertEquals("superseded", events.get(0)); - assertEquals("no_longer_needed", events.get(1)); - - // test the minimum amount of data required to create an action definition - jsonPostData = new JSONObject(); - jsonPostData.put("name", name); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 200); - - // check the returned data is what was expected - jsonResponse = new JSONObject(new JSONTokener(rsp.getContentAsString())); - dataObj = jsonResponse.getJSONObject("data"); - assertNotNull(rootDataObject.getString("id")); - assertNotNull(rootDataObject.getString("url")); - assertEquals(0, rootDataObject.getInt("index")); - assertEquals(name, dataObj.getString("name")); - assertEquals("none|0", dataObj.getString("period")); - assertFalse(dataObj.has("description")); - assertFalse(dataObj.has("periodProperty")); - assertFalse(dataObj.has("events")); - assertTrue(dataObj.getBoolean("eligibleOnFirstCompleteEvent")); - - // negative test to ensure not supplying mandatory data results in an error - jsonPostData = new JSONObject(); - jsonPostData.put("description", desc); - jsonPostData.put("period", period); - jsonPostString = jsonPostData.toString(); - sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 400); - } - - public void testPutDispositionAction() throws Exception - { - NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); - dispositionService.createDispositionSchedule(newRecordCategory, null); - - // create an action definition to then update - String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); - String postRequestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("name", "cutoff"); - String jsonPostString = jsonPostData.toString(); - sendRequest(new PostRequest(postRequestUrl, jsonPostString, APPLICATION_JSON), 200); - - // verify the action definition is present and retrieve it's id - String getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - Response rsp = sendRequest(new GetRequest(getRequestUrl), 200); - JSONObject json = new JSONObject(new JSONTokener(rsp.getContentAsString())); - JSONObject actionDef = json.getJSONObject("data").getJSONArray("actions").getJSONObject(0); - String actionDefId = actionDef.getString("id"); - assertEquals("cutoff", actionDef.getString("name")); - assertEquals("none|0", actionDef.getString("period")); - assertFalse(actionDef.has("description")); - assertFalse(actionDef.has("events")); - - // define body for PUT request - String name = "destroy"; - String desc = "Destroy this record after 5 years"; - String period = "year|5"; - String location = "my location"; - String periodProperty = "rma:cutOffDate"; - boolean eligibleOnFirstCompleteEvent = false; - - jsonPostData = new JSONObject(); - jsonPostData.put("name", name); - jsonPostData.put("description", desc); - jsonPostData.put("period", period); - jsonPostData.put("location", location); - jsonPostData.put("periodProperty", periodProperty); - jsonPostData.put("eligibleOnFirstCompleteEvent", eligibleOnFirstCompleteEvent); - JSONArray events = new JSONArray(); - events.put("superseded"); - events.put("no_longer_needed"); - jsonPostData.put("events", events); - jsonPostString = jsonPostData.toString(); - - // try and update a non existent action definition to check for 404 - String putRequestUrl = MessageFormat.format(PUT_ACTIONDEF_URL_FORMAT, categoryNodeUrl, "xyz"); - rsp = sendRequest(new PutRequest(putRequestUrl, jsonPostString, APPLICATION_JSON), 404); - - // update the action definition - putRequestUrl = MessageFormat.format(PUT_ACTIONDEF_URL_FORMAT, categoryNodeUrl, actionDefId); - rsp = sendRequest(new PutRequest(putRequestUrl, jsonPostString, APPLICATION_JSON), 200); - - // check the update happened correctly - json = new JSONObject(new JSONTokener(rsp.getContentAsString())); - actionDef = json.getJSONObject("data"); - assertEquals(name, actionDef.getString("name")); - assertEquals("Destroy", actionDef.getString("label")); - assertEquals(desc, actionDef.getString("description")); - assertEquals(period, actionDef.getString("period")); - assertEquals(location, actionDef.getString("location")); - assertEquals(periodProperty, actionDef.getString("periodProperty")); - assertFalse(actionDef.getBoolean("eligibleOnFirstCompleteEvent")); - assertEquals(2, actionDef.getJSONArray("events").length()); - assertEquals("superseded", actionDef.getJSONArray("events").getString(0)); - assertEquals("no_longer_needed", actionDef.getJSONArray("events").getString(1)); - } - - public void testDeleteDispositionAction() throws Exception - { - NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); - dispositionService.createDispositionSchedule(newRecordCategory, null); - - // create an action definition to then delete - String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); - String postRequestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("name", "cutoff"); - String jsonPostString = jsonPostData.toString(); - sendRequest(new PostRequest(postRequestUrl, jsonPostString, APPLICATION_JSON), 200); - - // verify the action definition is present and retrieve it's id - String getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - Response rsp = sendRequest(new GetRequest(getRequestUrl), 200); - JSONObject json = new JSONObject(new JSONTokener(rsp.getContentAsString())); - String actionDefId = json.getJSONObject("data").getJSONArray("actions").getJSONObject(0).getString("id"); - - // try and delete a non existent action definition to check for 404 - String deleteRequestUrl = MessageFormat.format(DELETE_ACTIONDEF_URL_FORMAT, categoryNodeUrl, "xyz"); - rsp = sendRequest(new DeleteRequest(deleteRequestUrl), 404); - - // now delete the action defintion created above - deleteRequestUrl = MessageFormat.format(DELETE_ACTIONDEF_URL_FORMAT, categoryNodeUrl, actionDefId); - rsp = sendRequest(new DeleteRequest(deleteRequestUrl), 200); - - // verify it got deleted - getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); - rsp = sendRequest(new GetRequest(getRequestUrl), 200); - json = new JSONObject(new JSONTokener(rsp.getContentAsString())); - JSONArray actions = json.getJSONObject("data").getJSONArray("actions"); - assertEquals(0, actions.length()); - } - - public void testGetDispositionLifecycle() throws Exception - { - // Test 404 for disposition lifecycle request on incorrect node - String categoryUrl = recordCategory.toString().replace("://", "/"); - String requestUrl = MessageFormat.format(GET_LIFECYCLE_URL_FORMAT, categoryUrl); - Response rsp = sendRequest(new GetRequest(requestUrl), 200); - - JSONObject notFound = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertEquals(true, notFound.getJSONObject("data").getBoolean("notFound")); - - NodeRef newRecordFolder = recordFolderService.createRecordFolder(recordCategory, "recordFolder"); - - - // there should now be a disposition lifecycle for the record - requestUrl = MessageFormat.format(GET_LIFECYCLE_URL_FORMAT, newRecordFolder.toString().replace("://", "/")); - rsp = sendRequest(new GetRequest(requestUrl), 200); - System.out.println("GET : " + rsp.getContentAsString()); - assertEquals("application/json;charset=UTF-8", rsp.getContentType()); - - // get response as JSON - JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertNotNull(jsonParsedObject); - - // check mandatory stuff is present - JSONObject dataObj = jsonParsedObject.getJSONObject("data"); - assertEquals(SERVICE_URL_PREFIX + requestUrl, dataObj.getString("url")); - assertEquals("cutoff", dataObj.getString("name")); - assertFalse(dataObj.getBoolean("eventsEligible")); - assertTrue(dataObj.has("events")); - JSONArray events = dataObj.getJSONArray("events"); - assertEquals(1, events.length()); - JSONObject event1 = events.getJSONObject(0); - assertEquals("case_closed", event1.get("name")); - assertEquals("Case Closed", event1.get("label")); - assertFalse(event1.getBoolean("complete")); - assertFalse(event1.getBoolean("automatic")); - - // check stuff expected to be missing is missing - assertFalse(dataObj.has("asOf")); - assertFalse(dataObj.has("startedAt")); - assertFalse(dataObj.has("startedBy")); - assertFalse(dataObj.has("completedAt")); - assertFalse(dataObj.has("completedBy")); - assertFalse(event1.has("completedAt")); - assertFalse(event1.has("completedBy")); - } - - public void testGetListOfValues() throws Exception - { - // call the list service - Response rsp = sendRequest(new GetRequest(GET_LIST_URL), 200); - assertEquals("application/json;charset=UTF-8", rsp.getContentType()); - - // get response as JSON - JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertNotNull(jsonParsedObject); - JSONObject data = jsonParsedObject.getJSONObject("data"); - - // check dispostion actions - JSONObject actions = data.getJSONObject("dispositionActions"); - assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/dispositionactions", actions.getString("url")); - JSONArray items = actions.getJSONArray("items"); - assertEquals(actionService.getDispositionActions().size(), items.length()); - assertTrue(items.length() > 0); - JSONObject item = items.getJSONObject(0); - assertTrue(item.length() == 2); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - - // check events - JSONObject events = data.getJSONObject("events"); - assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/events", events.getString("url")); - items = events.getJSONArray("items"); - assertEquals(eventService.getEvents().size(), items.length()); - assertTrue(items.length() > 0); - item = items.getJSONObject(0); - assertTrue(item.length() == 3); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - assertTrue(item.has("automatic")); - - // check period types - JSONObject periodTypes = data.getJSONObject("periodTypes"); - assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/periodtypes", periodTypes.getString("url")); - items = periodTypes.getJSONArray("items"); - assertEquals(Period.getProviderNames().size()-1, items.length()); - assertTrue(items.length() > 0); - item = items.getJSONObject(0); - assertTrue(item.length() == 2); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - - // check period properties - JSONObject periodProperties = data.getJSONObject("periodProperties"); - assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/periodproperties", periodProperties.getString("url")); - items = periodProperties.getJSONArray("items"); - assertEquals(5, items.length()); - assertTrue(items.length() > 0); - item = items.getJSONObject(0); - assertTrue(item.length() == 2); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.text.MessageFormat; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.util.GUID; +import org.json.JSONArray; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * This class tests the Rest API for disposition related operations + * + * @author Gavin Cornwell + */ +public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel +{ + protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); + protected static final String GET_SCHEDULE_URL_FORMAT = "/api/node/{0}/dispositionschedule"; + protected static final String GET_LIFECYCLE_URL_FORMAT = "/api/node/{0}/nextdispositionaction"; + protected static final String POST_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions"; + protected static final String DELETE_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions/{1}"; + protected static final String PUT_ACTIONDEF_URL_FORMAT = "/api/node/{0}/dispositionschedule/dispositionactiondefinitions/{1}"; + protected static final String GET_LIST_URL = "/api/rma/admin/listofvalues"; + protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; + protected static final String APPLICATION_JSON = "application/json"; + + + public void testGetDispositionSchedule() throws Exception + { + // Test 404 status for non existent node + int expectedStatus = 404; + String nonExistentNode = "workspace/SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"; + String nonExistentUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, nonExistentNode); + Response rsp = sendRequest(new GetRequest(nonExistentUrl), expectedStatus); + + // Test 404 status for node that doesn't have dispostion schedule i.e. a record series + String seriesNodeUrl = recordSeries.toString().replace("://", "/"); + String wrongNodeUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, seriesNodeUrl); + rsp = sendRequest(new GetRequest(wrongNodeUrl), expectedStatus); + + // Test data structure returned from "AIS Audit Records" + expectedStatus = 200; + + String categoryNodeUrl = recordCategory.toString().replace("://", "/"); + String requestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); + rsp = sendRequest(new GetRequest(requestUrl), expectedStatus); + assertEquals("application/json;charset=UTF-8", rsp.getContentType()); + + // get response as JSON + JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); + assertNotNull(jsonParsedObject); + + // check JSON data + JSONObject dataObj = jsonParsedObject.getJSONObject("data"); + assertNotNull(dataObj); + JSONObject rootDataObject = (JSONObject)dataObj; + assertEquals(10, rootDataObject.length()); + + // check individual data items + String serviceUrl = SERVICE_URL_PREFIX + requestUrl; + String url = rootDataObject.getString("url"); + assertEquals(serviceUrl, url); + + String authority = rootDataObject.getString("authority"); + + assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, authority); + + String instructions = rootDataObject.getString("instructions"); + assertEquals(CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, instructions); + + String actionsUrl = rootDataObject.getString("actionsUrl"); + assertEquals(serviceUrl + "/dispositionactiondefinitions", actionsUrl); + + boolean recordLevel = rootDataObject.getBoolean("recordLevelDisposition"); + assertFalse(recordLevel); + + assertFalse(rootDataObject.getBoolean("canStepsBeRemoved")); + + JSONArray actions = rootDataObject.getJSONArray("actions"); + assertNotNull(actions); + assertEquals(2, actions.length()); + JSONObject action1 = (JSONObject)actions.get(0); + assertEquals(9, action1.length()); + assertNotNull(action1.get("id")); + assertNotNull(action1.get("url")); + assertEquals(0, action1.getInt("index")); + assertEquals("cutoff", action1.getString("name")); + assertTrue(action1.getBoolean("eligibleOnFirstCompleteEvent")); + + JSONObject action2 = (JSONObject)actions.get(1); + assertEquals(8, action2.length()); + + // make sure the disposition schedule node ref is present and valid + String scheduleNodeRefJSON = rootDataObject.getString("nodeRef"); + NodeRef scheduleNodeRef = new NodeRef(scheduleNodeRefJSON); + assertTrue(this.nodeService.exists(scheduleNodeRef)); + + // create a new recordCategory node in the recordSeries and then get + // the disposition schedule + NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); + dispositionService.createDispositionSchedule(newRecordCategory, null); + + categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); + requestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); + //System.out.println("GET response: " + rsp.getContentAsString()); + rsp = sendRequest(new GetRequest(requestUrl), expectedStatus); + + // get response as JSON + jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); + System.out.println(rsp.getContentAsString()); + assertNotNull(jsonParsedObject); + + // check JSON data + dataObj = jsonParsedObject.getJSONObject("data"); + assertNotNull(dataObj); + rootDataObject = (JSONObject)dataObj; + assertEquals(8, rootDataObject.length()); + actions = rootDataObject.getJSONArray("actions"); + assertNotNull(actions); + assertEquals(0, actions.length()); + } + + public void testPostDispositionAction() throws Exception + { + // create a new recordCategory node in the recordSeries and then get + // the disposition schedule + NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); + dispositionService.createDispositionSchedule(newRecordCategory, null); + + String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); + String requestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); + + // Construct the JSON request. + String name = "destroy"; + String desc = "Destroy this record after 5 years"; + String period = "year|5"; + String periodProperty = "rma:cutOffDate"; + boolean eligibleOnFirstCompleteEvent = true; + + JSONObject jsonPostData = new JSONObject(); + jsonPostData.put("name", name); + jsonPostData.put("description", desc); + jsonPostData.put("period", period); + jsonPostData.put("location", "my location"); + jsonPostData.put("periodProperty", periodProperty); + jsonPostData.put("eligibleOnFirstCompleteEvent", eligibleOnFirstCompleteEvent); + JSONArray events = new JSONArray(); + events.put("superseded"); + events.put("no_longer_needed"); + jsonPostData.put("events", events); + + // Submit the JSON request. + String jsonPostString = jsonPostData.toString(); + Response rsp = sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 200); + + // check the returned data is what was expected + JSONObject jsonResponse = new JSONObject(new JSONTokener(rsp.getContentAsString())); + JSONObject dataObj = jsonResponse.getJSONObject("data"); + JSONObject rootDataObject = (JSONObject)dataObj; + assertNotNull(rootDataObject.getString("id")); + assertNotNull(rootDataObject.getString("url")); + assertEquals(0, rootDataObject.getInt("index")); + assertEquals(name, rootDataObject.getString("name")); + assertEquals("Destroy", rootDataObject.getString("label")); + assertEquals(desc, rootDataObject.getString("description")); + assertEquals(period, rootDataObject.getString("period")); + assertEquals("my location", rootDataObject.getString("location")); + assertEquals(periodProperty, rootDataObject.getString("periodProperty")); + assertTrue(rootDataObject.getBoolean("eligibleOnFirstCompleteEvent")); + events = rootDataObject.getJSONArray("events"); + assertNotNull(events); + assertEquals(2, events.length()); + assertEquals("superseded", events.get(0)); + assertEquals("no_longer_needed", events.get(1)); + + // test the minimum amount of data required to create an action definition + jsonPostData = new JSONObject(); + jsonPostData.put("name", name); + jsonPostString = jsonPostData.toString(); + rsp = sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 200); + + // check the returned data is what was expected + jsonResponse = new JSONObject(new JSONTokener(rsp.getContentAsString())); + dataObj = jsonResponse.getJSONObject("data"); + assertNotNull(rootDataObject.getString("id")); + assertNotNull(rootDataObject.getString("url")); + assertEquals(0, rootDataObject.getInt("index")); + assertEquals(name, dataObj.getString("name")); + assertEquals("none|0", dataObj.getString("period")); + assertFalse(dataObj.has("description")); + assertFalse(dataObj.has("periodProperty")); + assertFalse(dataObj.has("events")); + assertTrue(dataObj.getBoolean("eligibleOnFirstCompleteEvent")); + + // negative test to ensure not supplying mandatory data results in an error + jsonPostData = new JSONObject(); + jsonPostData.put("description", desc); + jsonPostData.put("period", period); + jsonPostString = jsonPostData.toString(); + sendRequest(new PostRequest(requestUrl, jsonPostString, APPLICATION_JSON), 400); + } + + public void testPutDispositionAction() throws Exception + { + NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); + dispositionService.createDispositionSchedule(newRecordCategory, null); + + // create an action definition to then update + String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); + String postRequestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); + JSONObject jsonPostData = new JSONObject(); + jsonPostData.put("name", "cutoff"); + String jsonPostString = jsonPostData.toString(); + sendRequest(new PostRequest(postRequestUrl, jsonPostString, APPLICATION_JSON), 200); + + // verify the action definition is present and retrieve it's id + String getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); + Response rsp = sendRequest(new GetRequest(getRequestUrl), 200); + JSONObject json = new JSONObject(new JSONTokener(rsp.getContentAsString())); + JSONObject actionDef = json.getJSONObject("data").getJSONArray("actions").getJSONObject(0); + String actionDefId = actionDef.getString("id"); + assertEquals("cutoff", actionDef.getString("name")); + assertEquals("none|0", actionDef.getString("period")); + assertFalse(actionDef.has("description")); + assertFalse(actionDef.has("events")); + + // define body for PUT request + String name = "destroy"; + String desc = "Destroy this record after 5 years"; + String period = "year|5"; + String location = "my location"; + String periodProperty = "rma:cutOffDate"; + boolean eligibleOnFirstCompleteEvent = false; + + jsonPostData = new JSONObject(); + jsonPostData.put("name", name); + jsonPostData.put("description", desc); + jsonPostData.put("period", period); + jsonPostData.put("location", location); + jsonPostData.put("periodProperty", periodProperty); + jsonPostData.put("eligibleOnFirstCompleteEvent", eligibleOnFirstCompleteEvent); + JSONArray events = new JSONArray(); + events.put("superseded"); + events.put("no_longer_needed"); + jsonPostData.put("events", events); + jsonPostString = jsonPostData.toString(); + + // try and update a non existent action definition to check for 404 + String putRequestUrl = MessageFormat.format(PUT_ACTIONDEF_URL_FORMAT, categoryNodeUrl, "xyz"); + rsp = sendRequest(new PutRequest(putRequestUrl, jsonPostString, APPLICATION_JSON), 404); + + // update the action definition + putRequestUrl = MessageFormat.format(PUT_ACTIONDEF_URL_FORMAT, categoryNodeUrl, actionDefId); + rsp = sendRequest(new PutRequest(putRequestUrl, jsonPostString, APPLICATION_JSON), 200); + + // check the update happened correctly + json = new JSONObject(new JSONTokener(rsp.getContentAsString())); + actionDef = json.getJSONObject("data"); + assertEquals(name, actionDef.getString("name")); + assertEquals("Destroy", actionDef.getString("label")); + assertEquals(desc, actionDef.getString("description")); + assertEquals(period, actionDef.getString("period")); + assertEquals(location, actionDef.getString("location")); + assertEquals(periodProperty, actionDef.getString("periodProperty")); + assertFalse(actionDef.getBoolean("eligibleOnFirstCompleteEvent")); + assertEquals(2, actionDef.getJSONArray("events").length()); + assertEquals("superseded", actionDef.getJSONArray("events").getString(0)); + assertEquals("no_longer_needed", actionDef.getJSONArray("events").getString(1)); + } + + public void testDeleteDispositionAction() throws Exception + { + NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate()); + dispositionService.createDispositionSchedule(newRecordCategory, null); + + // create an action definition to then delete + String categoryNodeUrl = newRecordCategory.toString().replace("://", "/"); + String postRequestUrl = MessageFormat.format(POST_ACTIONDEF_URL_FORMAT, categoryNodeUrl); + JSONObject jsonPostData = new JSONObject(); + jsonPostData.put("name", "cutoff"); + String jsonPostString = jsonPostData.toString(); + sendRequest(new PostRequest(postRequestUrl, jsonPostString, APPLICATION_JSON), 200); + + // verify the action definition is present and retrieve it's id + String getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); + Response rsp = sendRequest(new GetRequest(getRequestUrl), 200); + JSONObject json = new JSONObject(new JSONTokener(rsp.getContentAsString())); + String actionDefId = json.getJSONObject("data").getJSONArray("actions").getJSONObject(0).getString("id"); + + // try and delete a non existent action definition to check for 404 + String deleteRequestUrl = MessageFormat.format(DELETE_ACTIONDEF_URL_FORMAT, categoryNodeUrl, "xyz"); + rsp = sendRequest(new DeleteRequest(deleteRequestUrl), 404); + + // now delete the action defintion created above + deleteRequestUrl = MessageFormat.format(DELETE_ACTIONDEF_URL_FORMAT, categoryNodeUrl, actionDefId); + rsp = sendRequest(new DeleteRequest(deleteRequestUrl), 200); + + // verify it got deleted + getRequestUrl = MessageFormat.format(GET_SCHEDULE_URL_FORMAT, categoryNodeUrl); + rsp = sendRequest(new GetRequest(getRequestUrl), 200); + json = new JSONObject(new JSONTokener(rsp.getContentAsString())); + JSONArray actions = json.getJSONObject("data").getJSONArray("actions"); + assertEquals(0, actions.length()); + } + + public void testGetDispositionLifecycle() throws Exception + { + // Test 404 for disposition lifecycle request on incorrect node + String categoryUrl = recordCategory.toString().replace("://", "/"); + String requestUrl = MessageFormat.format(GET_LIFECYCLE_URL_FORMAT, categoryUrl); + Response rsp = sendRequest(new GetRequest(requestUrl), 200); + + JSONObject notFound = new JSONObject(new JSONTokener(rsp.getContentAsString())); + assertEquals(true, notFound.getJSONObject("data").getBoolean("notFound")); + + NodeRef newRecordFolder = recordFolderService.createRecordFolder(recordCategory, "recordFolder"); + + + // there should now be a disposition lifecycle for the record + requestUrl = MessageFormat.format(GET_LIFECYCLE_URL_FORMAT, newRecordFolder.toString().replace("://", "/")); + rsp = sendRequest(new GetRequest(requestUrl), 200); + System.out.println("GET : " + rsp.getContentAsString()); + assertEquals("application/json;charset=UTF-8", rsp.getContentType()); + + // get response as JSON + JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); + assertNotNull(jsonParsedObject); + + // check mandatory stuff is present + JSONObject dataObj = jsonParsedObject.getJSONObject("data"); + assertEquals(SERVICE_URL_PREFIX + requestUrl, dataObj.getString("url")); + assertEquals("cutoff", dataObj.getString("name")); + assertFalse(dataObj.getBoolean("eventsEligible")); + assertTrue(dataObj.has("events")); + JSONArray events = dataObj.getJSONArray("events"); + assertEquals(1, events.length()); + JSONObject event1 = events.getJSONObject(0); + assertEquals("case_closed", event1.get("name")); + assertEquals("Case Closed", event1.get("label")); + assertFalse(event1.getBoolean("complete")); + assertFalse(event1.getBoolean("automatic")); + + // check stuff expected to be missing is missing + assertFalse(dataObj.has("asOf")); + assertFalse(dataObj.has("startedAt")); + assertFalse(dataObj.has("startedBy")); + assertFalse(dataObj.has("completedAt")); + assertFalse(dataObj.has("completedBy")); + assertFalse(event1.has("completedAt")); + assertFalse(event1.has("completedBy")); + } + + public void testGetListOfValues() throws Exception + { + // call the list service + Response rsp = sendRequest(new GetRequest(GET_LIST_URL), 200); + assertEquals("application/json;charset=UTF-8", rsp.getContentType()); + + // get response as JSON + JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); + assertNotNull(jsonParsedObject); + JSONObject data = jsonParsedObject.getJSONObject("data"); + + // check dispostion actions + JSONObject actions = data.getJSONObject("dispositionActions"); + assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/dispositionactions", actions.getString("url")); + JSONArray items = actions.getJSONArray("items"); + assertEquals(actionService.getDispositionActions().size(), items.length()); + assertTrue(items.length() > 0); + JSONObject item = items.getJSONObject(0); + assertTrue(item.length() == 2); + assertTrue(item.has("label")); + assertTrue(item.has("value")); + + // check events + JSONObject events = data.getJSONObject("events"); + assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/events", events.getString("url")); + items = events.getJSONArray("items"); + assertEquals(eventService.getEvents().size(), items.length()); + assertTrue(items.length() > 0); + item = items.getJSONObject(0); + assertTrue(item.length() == 3); + assertTrue(item.has("label")); + assertTrue(item.has("value")); + assertTrue(item.has("automatic")); + + // check period types + JSONObject periodTypes = data.getJSONObject("periodTypes"); + assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/periodtypes", periodTypes.getString("url")); + items = periodTypes.getJSONArray("items"); + assertEquals(Period.getProviderNames().size()-1, items.length()); + assertTrue(items.length() > 0); + item = items.getJSONObject(0); + assertTrue(item.length() == 2); + assertTrue(item.has("label")); + assertTrue(item.has("value")); + + // check period properties + JSONObject periodProperties = data.getJSONObject("periodProperties"); + assertEquals(SERVICE_URL_PREFIX + GET_LIST_URL + "/periodproperties", periodProperties.getString("url")); + items = periodProperties.getJSONArray("items"); + assertEquals(5, items.length()); + assertTrue(items.length() > 0); + item = items.getJSONObject(0); + assertTrue(item.length() == 2); + assertTrue(item.has("label")); + assertTrue(item.has("value")); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapKeysRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapKeysRestApiTest.java index 7310820cba..8b4f62484c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapKeysRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapKeysRestApiTest.java @@ -1,78 +1,78 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Test for Email mapping keys - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class EmailMapKeysRestApiTest extends BaseRMWebScriptTestCase -{ - /** URLs for the REST API */ - private static final String GET_EMAIL_MAP_KEYS_URL = "/api/rma/admin/emailmapkeys"; - - /** - * Tests the REST API to get the list of email mapping keys - * - * @throws IOException - * @throws JSONException - */ - public void testGetCapabilitiesAction() throws IOException, JSONException - { - // Send request - Response response = sendRequest(new GetRequest(GET_EMAIL_MAP_KEYS_URL), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json and check the data - JSONObject contentAsJson = new JSONObject(contentAsString); - JSONObject data = contentAsJson.getJSONObject("data"); - assertNotNull(data); - - // Get the email mapping keys and check them - JSONArray dataSets = data.getJSONArray("emailmapkeys"); - assertNotNull(dataSets); - - // Check the number of email mapping keys - assertTrue(dataSets.length() == 6); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * REST API Test for Email mapping keys + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class EmailMapKeysRestApiTest extends BaseRMWebScriptTestCase +{ + /** URLs for the REST API */ + private static final String GET_EMAIL_MAP_KEYS_URL = "/api/rma/admin/emailmapkeys"; + + /** + * Tests the REST API to get the list of email mapping keys + * + * @throws IOException + * @throws JSONException + */ + public void testGetCapabilitiesAction() throws IOException, JSONException + { + // Send request + Response response = sendRequest(new GetRequest(GET_EMAIL_MAP_KEYS_URL), Status.STATUS_OK); + + // Check the content from the response + String contentAsString = response.getContentAsString(); + assertNotNull(contentAsString); + + // Convert the response to json and check the data + JSONObject contentAsJson = new JSONObject(contentAsString); + JSONObject data = contentAsJson.getJSONObject("data"); + assertNotNull(data); + + // Get the email mapping keys and check them + JSONArray dataSets = data.getJSONArray("emailmapkeys"); + assertNotNull(dataSets); + + // Check the number of email mapping keys + assertTrue(dataSets.length() == 6); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapScriptTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapScriptTest.java index 7b34de11ac..436f9155cc 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapScriptTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EmailMapScriptTest.java @@ -1,112 +1,112 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -public class EmailMapScriptTest extends BaseRMWebScriptTestCase -{ - /** URLs for the REST APIs */ - public final static String URL_RM_EMAILMAP = "/api/rma/admin/emailmap"; - public final static String URL_RM_EMAILMAP_DELETE = "/api/rma/admin/emailmap/%s/%s"; - - /** Constant for the content type */ - private static final String APPLICATION_JSON = "application/json"; - - /** - * Tests the REST APIs for a custom mapping - * - * @throws IOException - * @throws JSONException - */ - public void testEmailMap() throws IOException, JSONException - { - /** Test GET */ - Response getResponse = sendRequest(new GetRequest(URL_RM_EMAILMAP), Status.STATUS_OK); - - JSONObject getResponseContent = new JSONObject(getResponse.getContentAsString()); - JSONObject getData = getResponseContent.getJSONObject("data"); - JSONArray getMappings = getData.getJSONArray("mappings"); - assertTrue(getMappings.length() == 20); - - /** Test POST */ - JSONObject newMapping = new JSONObject(); - newMapping.put("from", "messageTo"); - newMapping.put("to", "rmc:Wibble"); - - Response postResponse = sendRequest(new PostRequest(URL_RM_EMAILMAP, newMapping.toString(), APPLICATION_JSON), Status.STATUS_OK); - JSONObject postResponseContent = new JSONObject(postResponse.getContentAsString()); - JSONObject postData = postResponseContent.getJSONObject("data"); - JSONArray postMappings = postData.getJSONArray("mappings"); - - assertTrue(postMappings.length() == 21); - assertTrue(existsMapping(postMappings)); - - /** Test DELETE */ - Response deleteResponse = sendRequest(new DeleteRequest(String.format(URL_RM_EMAILMAP_DELETE, "messageTo", "rmc:Wibble")), Status.STATUS_OK); - JSONObject deleteResponseContent = new JSONObject(deleteResponse.getContentAsString()); - JSONObject deleteData = deleteResponseContent.getJSONObject("data"); - JSONArray deleteMappings = deleteData.getJSONArray("mappings"); - - assertTrue(deleteMappings.length() == 20); - assertFalse(existsMapping(deleteMappings)); - } - - /** - * Helper method for checking if a custom mapping exists - * - * @param mappings The list of available mappings - * @return true if the custom mapping exists in the list of available mappings, false otherwise - * @throws JSONException - */ - private boolean existsMapping(JSONArray mappings) throws JSONException - { - boolean result = false; - for (int i = 0; i < mappings.length(); i++) - { - String from = mappings.getJSONObject(i).getString("from"); - String to = mappings.getJSONObject(i).getString("to"); - if (from.equalsIgnoreCase("messageTo") && to.equalsIgnoreCase("rmc:Wibble")) - { - result = true; - break; - } - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +public class EmailMapScriptTest extends BaseRMWebScriptTestCase +{ + /** URLs for the REST APIs */ + public final static String URL_RM_EMAILMAP = "/api/rma/admin/emailmap"; + public final static String URL_RM_EMAILMAP_DELETE = "/api/rma/admin/emailmap/%s/%s"; + + /** Constant for the content type */ + private static final String APPLICATION_JSON = "application/json"; + + /** + * Tests the REST APIs for a custom mapping + * + * @throws IOException + * @throws JSONException + */ + public void testEmailMap() throws IOException, JSONException + { + /** Test GET */ + Response getResponse = sendRequest(new GetRequest(URL_RM_EMAILMAP), Status.STATUS_OK); + + JSONObject getResponseContent = new JSONObject(getResponse.getContentAsString()); + JSONObject getData = getResponseContent.getJSONObject("data"); + JSONArray getMappings = getData.getJSONArray("mappings"); + assertTrue(getMappings.length() == 20); + + /** Test POST */ + JSONObject newMapping = new JSONObject(); + newMapping.put("from", "messageTo"); + newMapping.put("to", "rmc:Wibble"); + + Response postResponse = sendRequest(new PostRequest(URL_RM_EMAILMAP, newMapping.toString(), APPLICATION_JSON), Status.STATUS_OK); + JSONObject postResponseContent = new JSONObject(postResponse.getContentAsString()); + JSONObject postData = postResponseContent.getJSONObject("data"); + JSONArray postMappings = postData.getJSONArray("mappings"); + + assertTrue(postMappings.length() == 21); + assertTrue(existsMapping(postMappings)); + + /** Test DELETE */ + Response deleteResponse = sendRequest(new DeleteRequest(String.format(URL_RM_EMAILMAP_DELETE, "messageTo", "rmc:Wibble")), Status.STATUS_OK); + JSONObject deleteResponseContent = new JSONObject(deleteResponse.getContentAsString()); + JSONObject deleteData = deleteResponseContent.getJSONObject("data"); + JSONArray deleteMappings = deleteData.getJSONArray("mappings"); + + assertTrue(deleteMappings.length() == 20); + assertFalse(existsMapping(deleteMappings)); + } + + /** + * Helper method for checking if a custom mapping exists + * + * @param mappings The list of available mappings + * @return true if the custom mapping exists in the list of available mappings, false otherwise + * @throws JSONException + */ + private boolean existsMapping(JSONArray mappings) throws JSONException + { + boolean result = false; + for (int i = 0; i < mappings.length(); i++) + { + String from = mappings.getJSONObject(i).getString("from"); + String to = mappings.getJSONObject(i).getString("to"); + if (from.equalsIgnoreCase("messageTo") && to.equalsIgnoreCase("rmc:Wibble")) + { + result = true; + break; + } + } + return result; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EventRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EventRestApiTest.java index ead14b3505..72307aa60c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EventRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/EventRestApiTest.java @@ -1,251 +1,251 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.util.GUID; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * RM event REST API test - * - * @author Roy Wetherall - */ -public class EventRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel -{ - protected static final String GET_EVENTS_URL = "/api/rma/admin/rmevents"; - protected static final String GET_EVENTTYPES_URL = "/api/rma/admin/rmeventtypes"; - protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; - protected static final String APPLICATION_JSON = "application/json"; - - protected static final String DISPLAY_LABEL = "display label"; - protected static final String EVENT_TYPE = "rmEventType.simple"; - protected static final String KEY_EVENT_NAME = "eventName"; - protected static final String KEY_EVENT_TYPE = "eventType"; - protected static final String KEY_EVENT_DISPLAY_LABEL = "eventDisplayLabel"; - - public void testGetEventTypes() throws Exception - { - Response rsp = sendRequest(new GetRequest(GET_EVENTTYPES_URL),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject types = obj.getJSONObject("data"); - assertNotNull(types); - - JSONObject type = types.getJSONObject("rmEventType.simple"); - assertNotNull(type); - assertEquals("rmEventType.simple", type.getString("eventTypeName")); - assertNotNull(type.getString("eventTypeDisplayLabel")); - - System.out.println(rspContent); - } - - public void testGetEvents() throws Exception - { - String event1 = GUID.generate(); - String event2 = GUID.generate(); - - // Create a couple or events by hand - eventService.addEvent(EVENT_TYPE, event1, DISPLAY_LABEL); - eventService.addEvent(EVENT_TYPE, event2, DISPLAY_LABEL); - - try - { - // Get the events - Response rsp = sendRequest(new GetRequest(GET_EVENTS_URL),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject roles = obj.getJSONObject("data"); - assertNotNull(roles); - - JSONObject eventObj = roles.getJSONObject(event1); - assertNotNull(eventObj); - assertEquals(event1, eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - eventObj = roles.getJSONObject(event2); - assertNotNull(eventObj); - assertEquals(event2, eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - } - finally - { - // Clean up - eventService.removeEvent(event1); - eventService.removeEvent(event2); - } - - } - - public void testPostEvents() throws Exception - { - String eventName= GUID.generate(); - - JSONObject obj = new JSONObject(); - obj.put(KEY_EVENT_NAME, eventName); - obj.put(KEY_EVENT_DISPLAY_LABEL, DISPLAY_LABEL); - obj.put(KEY_EVENT_TYPE, EVENT_TYPE); - - Response rsp = sendRequest(new PostRequest(GET_EVENTS_URL, obj.toString(), APPLICATION_JSON),200); - try - { - String rspContent = rsp.getContentAsString(); - - JSONObject resultObj = new JSONObject(rspContent); - JSONObject eventObj = resultObj.getJSONObject("data"); - assertNotNull(eventObj); - - assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - } - finally - { - eventService.removeEvent(eventName); - } - - // Test with no event name set - obj = new JSONObject(); - obj.put(KEY_EVENT_DISPLAY_LABEL, DISPLAY_LABEL); - obj.put(KEY_EVENT_TYPE, EVENT_TYPE); - rsp = sendRequest(new PostRequest(GET_EVENTS_URL, obj.toString(), APPLICATION_JSON),200); - try - { - String rspContent = rsp.getContentAsString(); - - JSONObject resultObj = new JSONObject(rspContent); - JSONObject eventObj = resultObj.getJSONObject("data"); - assertNotNull(eventObj); - - assertNotNull(eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - eventName = eventObj.getString(KEY_EVENT_NAME); - } - finally - { - eventService.removeEvent(eventName); - } - } - - public void testPutRole() throws Exception - { - String eventName = GUID.generate(); - eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); - - try - { - JSONObject obj = new JSONObject(); - obj.put(KEY_EVENT_NAME, eventName); - obj.put(KEY_EVENT_DISPLAY_LABEL, "changed"); - obj.put(KEY_EVENT_TYPE, EVENT_TYPE); - - // Get the roles - Response rsp = sendRequest(new PutRequest(GET_EVENTS_URL + "/" + eventName, obj.toString(), APPLICATION_JSON),200); - String rspContent = rsp.getContentAsString(); - - JSONObject result = new JSONObject(rspContent); - JSONObject eventObj = result.getJSONObject("data"); - assertNotNull(eventObj); - - assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); - assertEquals("changed", eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - // Bad requests - obj = new JSONObject(); - obj.put(KEY_EVENT_NAME, "cheese"); - obj.put(KEY_EVENT_DISPLAY_LABEL, "whatever"); - obj.put(KEY_EVENT_TYPE, EVENT_TYPE); - - sendRequest(new PutRequest(GET_EVENTS_URL + "/cheese", obj.toString(), APPLICATION_JSON), 404); - } - finally - { - // Clean up - eventService.removeEvent(eventName); - } - - } - - public void testGetRole() throws Exception - { - String eventName = GUID.generate(); - eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); - - try - { - // Get the roles - Response rsp = sendRequest(new GetRequest(GET_EVENTS_URL + "/" + eventName),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject eventObj = obj.getJSONObject("data"); - assertNotNull(eventObj); - - assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); - assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); - assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); - - // Bad requests - sendRequest(new GetRequest(GET_EVENTS_URL + "/cheese"), 404); - } - finally - { - // Clean up - eventService.removeEvent(eventName); - } - - } - - public void testDeleteRole() throws Exception - { - String eventName = GUID.generate(); - assertFalse(eventService.existsEvent(eventName)); - eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); - assertTrue(eventService.existsEvent(eventName)); - sendRequest(new DeleteRequest(GET_EVENTS_URL + "/" + eventName),200); - assertFalse(eventService.existsEvent(eventName)); - - // Bad request - sendRequest(new DeleteRequest(GET_EVENTS_URL + "/cheese"), 404); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.alfresco.util.GUID; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * RM event REST API test + * + * @author Roy Wetherall + */ +public class EventRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel +{ + protected static final String GET_EVENTS_URL = "/api/rma/admin/rmevents"; + protected static final String GET_EVENTTYPES_URL = "/api/rma/admin/rmeventtypes"; + protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; + protected static final String APPLICATION_JSON = "application/json"; + + protected static final String DISPLAY_LABEL = "display label"; + protected static final String EVENT_TYPE = "rmEventType.simple"; + protected static final String KEY_EVENT_NAME = "eventName"; + protected static final String KEY_EVENT_TYPE = "eventType"; + protected static final String KEY_EVENT_DISPLAY_LABEL = "eventDisplayLabel"; + + public void testGetEventTypes() throws Exception + { + Response rsp = sendRequest(new GetRequest(GET_EVENTTYPES_URL),200); + String rspContent = rsp.getContentAsString(); + + JSONObject obj = new JSONObject(rspContent); + JSONObject types = obj.getJSONObject("data"); + assertNotNull(types); + + JSONObject type = types.getJSONObject("rmEventType.simple"); + assertNotNull(type); + assertEquals("rmEventType.simple", type.getString("eventTypeName")); + assertNotNull(type.getString("eventTypeDisplayLabel")); + + System.out.println(rspContent); + } + + public void testGetEvents() throws Exception + { + String event1 = GUID.generate(); + String event2 = GUID.generate(); + + // Create a couple or events by hand + eventService.addEvent(EVENT_TYPE, event1, DISPLAY_LABEL); + eventService.addEvent(EVENT_TYPE, event2, DISPLAY_LABEL); + + try + { + // Get the events + Response rsp = sendRequest(new GetRequest(GET_EVENTS_URL),200); + String rspContent = rsp.getContentAsString(); + + JSONObject obj = new JSONObject(rspContent); + JSONObject roles = obj.getJSONObject("data"); + assertNotNull(roles); + + JSONObject eventObj = roles.getJSONObject(event1); + assertNotNull(eventObj); + assertEquals(event1, eventObj.get(KEY_EVENT_NAME)); + assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); + assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); + + eventObj = roles.getJSONObject(event2); + assertNotNull(eventObj); + assertEquals(event2, eventObj.get(KEY_EVENT_NAME)); + assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); + assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); + } + finally + { + // Clean up + eventService.removeEvent(event1); + eventService.removeEvent(event2); + } + + } + + public void testPostEvents() throws Exception + { + String eventName= GUID.generate(); + + JSONObject obj = new JSONObject(); + obj.put(KEY_EVENT_NAME, eventName); + obj.put(KEY_EVENT_DISPLAY_LABEL, DISPLAY_LABEL); + obj.put(KEY_EVENT_TYPE, EVENT_TYPE); + + Response rsp = sendRequest(new PostRequest(GET_EVENTS_URL, obj.toString(), APPLICATION_JSON),200); + try + { + String rspContent = rsp.getContentAsString(); + + JSONObject resultObj = new JSONObject(rspContent); + JSONObject eventObj = resultObj.getJSONObject("data"); + assertNotNull(eventObj); + + assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); + assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); + assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); + + } + finally + { + eventService.removeEvent(eventName); + } + + // Test with no event name set + obj = new JSONObject(); + obj.put(KEY_EVENT_DISPLAY_LABEL, DISPLAY_LABEL); + obj.put(KEY_EVENT_TYPE, EVENT_TYPE); + rsp = sendRequest(new PostRequest(GET_EVENTS_URL, obj.toString(), APPLICATION_JSON),200); + try + { + String rspContent = rsp.getContentAsString(); + + JSONObject resultObj = new JSONObject(rspContent); + JSONObject eventObj = resultObj.getJSONObject("data"); + assertNotNull(eventObj); + + assertNotNull(eventObj.get(KEY_EVENT_NAME)); + assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); + assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); + + eventName = eventObj.getString(KEY_EVENT_NAME); + } + finally + { + eventService.removeEvent(eventName); + } + } + + public void testPutRole() throws Exception + { + String eventName = GUID.generate(); + eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); + + try + { + JSONObject obj = new JSONObject(); + obj.put(KEY_EVENT_NAME, eventName); + obj.put(KEY_EVENT_DISPLAY_LABEL, "changed"); + obj.put(KEY_EVENT_TYPE, EVENT_TYPE); + + // Get the roles + Response rsp = sendRequest(new PutRequest(GET_EVENTS_URL + "/" + eventName, obj.toString(), APPLICATION_JSON),200); + String rspContent = rsp.getContentAsString(); + + JSONObject result = new JSONObject(rspContent); + JSONObject eventObj = result.getJSONObject("data"); + assertNotNull(eventObj); + + assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); + assertEquals("changed", eventObj.get(KEY_EVENT_DISPLAY_LABEL)); + assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); + + // Bad requests + obj = new JSONObject(); + obj.put(KEY_EVENT_NAME, "cheese"); + obj.put(KEY_EVENT_DISPLAY_LABEL, "whatever"); + obj.put(KEY_EVENT_TYPE, EVENT_TYPE); + + sendRequest(new PutRequest(GET_EVENTS_URL + "/cheese", obj.toString(), APPLICATION_JSON), 404); + } + finally + { + // Clean up + eventService.removeEvent(eventName); + } + + } + + public void testGetRole() throws Exception + { + String eventName = GUID.generate(); + eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); + + try + { + // Get the roles + Response rsp = sendRequest(new GetRequest(GET_EVENTS_URL + "/" + eventName),200); + String rspContent = rsp.getContentAsString(); + + JSONObject obj = new JSONObject(rspContent); + JSONObject eventObj = obj.getJSONObject("data"); + assertNotNull(eventObj); + + assertEquals(eventName, eventObj.get(KEY_EVENT_NAME)); + assertEquals(DISPLAY_LABEL, eventObj.get(KEY_EVENT_DISPLAY_LABEL)); + assertEquals(EVENT_TYPE, eventObj.get(KEY_EVENT_TYPE)); + + // Bad requests + sendRequest(new GetRequest(GET_EVENTS_URL + "/cheese"), 404); + } + finally + { + // Clean up + eventService.removeEvent(eventName); + } + + } + + public void testDeleteRole() throws Exception + { + String eventName = GUID.generate(); + assertFalse(eventService.existsEvent(eventName)); + eventService.addEvent(EVENT_TYPE, eventName, DISPLAY_LABEL); + assertTrue(eventService.existsEvent(eventName)); + sendRequest(new DeleteRequest(GET_EVENTS_URL + "/" + eventName),200); + assertFalse(eventService.existsEvent(eventName)); + + // Bad request + sendRequest(new DeleteRequest(GET_EVENTS_URL + "/cheese"), 404); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMCaveatConfigScriptTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMCaveatConfigScriptTest.java index b1f6ba0b5f..be984c4237 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMCaveatConfigScriptTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMCaveatConfigScriptTest.java @@ -1,929 +1,929 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.util.GUID; -import org.json.JSONArray; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * - * - * @author Mark Rogers - */ -@SuppressWarnings("unused") -public class RMCaveatConfigScriptTest extends BaseRMWebScriptTestCase -{ - protected final static String RM_LIST = "rmc:smListTest"; - protected final static String RM_LIST_URI_ELEM = "rmc_smListTest"; - - private static final String URL_RM_CONSTRAINTS = "/api/rma/admin/rmconstraints"; - - public void testGetRMConstraints() throws Exception - { - { - Response response = sendRequest(new GetRequest(URL_RM_CONSTRAINTS), Status.STATUS_OK); - - JSONObject top = new JSONObject(response.getContentAsString()); - System.out.println(response.getContentAsString()); - assertNotNull(top.getJSONArray("data")); - } - - /** - * Add a list, then get it back via the list rest script - */ - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - { - Response response = sendRequest(new GetRequest(URL_RM_CONSTRAINTS), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - System.out.println(response.getContentAsString()); - JSONArray data = top.getJSONArray("data"); - - boolean found = false; - assertTrue("no data returned", data.length() > 0); - for(int i = 0; i < data.length(); i++) - { - JSONObject obj = data.getJSONObject(i); - String name = (String)obj.getString("constraintName"); - assertNotNull("constraintName is null", name); - String url = (String)obj.getString("url"); - assertNotNull("detail url is null", name); - if(name.equalsIgnoreCase(RM_LIST)) - { - found = true; - } - - /** - * vallidate the detail URL returned - */ - sendRequest(new GetRequest(url), Status.STATUS_OK); - } - } - } - - /** - * - * @throws Exception - */ - public void testGetRMConstraint() throws Exception - { - /** - * Delete the list to remove any junk then recreate it. - */ - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - - createUser("fbloggs"); - createUser("jrogers"); - createUser("jdoe"); - - - List values = new ArrayList(); - values.add("NOFORN"); - values.add("FGI"); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); - - /** - * Positive test Get the constraint - */ - { - String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - String constraintName = data.getString("constraintName"); - assertNotNull("constraintName is null", constraintName); -// JSONArray allowedValues = data.getJSONArray("allowedValues"); - -// assertTrue("values not correct", compare(array, allowedValues)); - -// JSONArray constraintDetails = data.getJSONArray("constraintDetails"); -// -// assertTrue("details array does not contain 3 elements", constraintDetails.length() == 3); -// for(int i =0; i < constraintDetails.length(); i++) -// { -// JSONObject detail = constraintDetails.getJSONObject(i); -// } - } - - /** - * - * @throws Exception - */ - - /** - * Negative test - Attempt to get a constraint that does exist - */ - { - String url = URL_RM_CONSTRAINTS + "/" + "rmc_wibble"; - sendRequest(new GetRequest(url), Status.STATUS_NOT_FOUND); - } - - deleteUser("fbloggs"); - deleteUser("jrogers"); - deleteUser("jdoe"); - - - - - } - - /** - * Create an RM Constraint - * @throws Exception - */ - public void testUpdateRMConstraint() throws Exception - { - - String constraintName = null; - /* - * Create a new list - */ - { - String title = "test Update RM Constraint title"; - JSONArray array = new JSONArray(); - array.put("LEMON"); - array.put("BANANA"); - array.put("PEACH"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintTitle", title); - /** - * Now do a post to create a new list - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - constraintName = data.getString("constraintName"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - assertTrue("values not correct", compare(array, allowedValues)); - - } - - /** - * Now update both values and title - remove BANANA, PEACH, Add APPLE. - */ - - { - String newTitle = "this is the new title"; - JSONArray array = new JSONArray(); - array.put("LEMON"); - array.put("APPLE"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintName", constraintName); - obj.put("constraintTitle", newTitle); - - System.out.println(obj.toString()); - - /** - * Now do a post to update list - */ - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - JSONObject data = top.getJSONObject("data"); - - System.out.println(response.getContentAsString()); - - String url = data.getString("url"); - String constraintName2 = data.getString("constraintName"); - String constraintTitle = data.getString("constraintTitle"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - - assertTrue(allowedValues.length() == 2); - assertTrue("values not correct", compare(array, allowedValues)); - assertNotNull(url); - assertEquals(constraintName2, constraintName); - assertNotNull(constraintTitle); - assertEquals("title not as expected", constraintTitle, newTitle); - - // Check that data has been persisted. - Response resp2 = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top2 = new JSONObject(resp2.getContentAsString()); - System.out.println("Problem here"); - System.out.println(resp2.getContentAsString()); - JSONObject data2 = top2.getJSONObject("data"); - String constraintTitle2 = data2.getString("constraintTitle"); - JSONArray allowedValues2 = data2.getJSONArray("allowedValues"); - assertTrue("values not correct", compare(array, allowedValues2)); - assertTrue("allowedValues is not 2", allowedValues2.length() == 2); - assertEquals(constraintName2, constraintName); - assertNotNull(constraintTitle2); - assertEquals("title not as expected", constraintTitle2, newTitle); - - } - - /** - * Now put without allowed values - */ - { - String newTitle = "update with no values"; - - JSONObject obj = new JSONObject(); - - obj.put("constraintName", RM_LIST); - obj.put("constraintTitle", newTitle); - - /** - * Now do a put to update a new list - */ - - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - String url = data.getString("url"); - String constraintName2 = data.getString("constraintName"); - String constraintTitle = data.getString("constraintTitle"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - - assertTrue(allowedValues.length() == 2); - - assertNotNull(url); - assertEquals(constraintName2, constraintName); - assertNotNull(constraintTitle); - assertEquals("title not as expected", constraintTitle, newTitle); - } - - /** - * Now post without constraint Title - */ - { - JSONArray array = new JSONArray(); - array.put("LEMON"); - array.put("APPLE"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - - System.out.println(obj.toString()); - - /** - * Now do a Put to update the list - title should remain - */ - - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - } - - /** - * Add a new value (PEAR) to the list - */ - { - JSONArray array = new JSONArray(); - array.put("PEAR"); - array.put("LEMON"); - array.put("APPLE"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - - System.out.println(obj.toString()); - - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - } - - /** - * Remove a value (PEAR) from the list - */ - { - JSONArray array = new JSONArray(); - array.put("APPLE"); - array.put("LEMON"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - - System.out.println(obj.toString()); - - Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - } - - } - - - /** - * Create an RM Constraint - * @throws Exception - */ - public void testCreateRMConstraint() throws Exception - { - /** - * Delete the list to remove any junk then recreate it. - */ - //caveatConfigService.deleteRMConstraint(RM_LIST); - - /** - * create a new list - */ - { - JSONArray array = new JSONArray(); - array.put("NOFORN"); - array.put("FGI"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintName", RM_LIST); - obj.put("constraintTitle", GUID.generate()); - - System.out.println(obj.toString()); - - /** - * Now do a post to create a new list - */ - - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - // Check the response - } - - /** - * Now go and get the constraint - */ - { - String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - String constraintName = data.getString("constraintName"); - assertNotNull("constraintName is null", constraintName); - -// JSONArray constraintDetails = data.getJSONArray("constraintDetails"); -// -// assertTrue("details array does not contain 3 elements", constraintDetails.length() == 3); -// for(int i =0; i < constraintDetails.length(); i++) -// { -// JSONObject detail = constraintDetails.getJSONObject(i); -// } - } - - /** - * Now a constraint with a generated name - */ - { - String title = GUID.generate(); - JSONArray array = new JSONArray(); - array.put("Red"); - array.put("Blue"); - array.put("Green"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintTitle", title); - - System.out.println(obj.toString()); - - /** - * Now do a post to create a new list - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - // Check the response - - String url = data.getString("url"); - String constraintName = data.getString("constraintName"); - String constraintTitle = data.getString("constraintTitle"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - - assertTrue(allowedValues.length() == 3); - assertNotNull(url); - assertNotNull(constraintName); - assertNotNull(constraintTitle); - assertEquals("title not as expected", constraintTitle, title); - sendRequest(new GetRequest(url), Status.STATUS_OK); - - - } - - - /** - * Now a constraint with an empty list of values. - */ - { - JSONArray array = new JSONArray(); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintName", "rmc_whazoo"); - obj.put("constraintTitle", GUID.generate()); - - System.out.println(obj.toString()); - - /** - * Now do a post to create a new list - */ - - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - // Check the response - } - - -// /** -// * Negative tests - duplicate list -// */ -// { -// JSONArray array = new JSONArray(); -// array.put("NOFORN"); -// array.put("FGI"); -// -// JSONObject obj = new JSONObject(); -// obj.put("allowedValues", array); -// obj.put("constraintName", RM_LIST); -// obj.put("constraintTitle", "this is the title"); -// -// System.out.println(obj.toString()); -// -// /** -// * Now do a post to create a new list -// */ -// Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_CREATED); -// JSONObject top = new JSONObject(response.getContentAsString()); -// -// JSONObject data = top.getJSONObject("data"); -// System.out.println(response.getContentAsString()); -// -// // Check the response -// } - - - } - - - public void testGetRMConstraintValues() throws Exception - { - createUser("fbloggs"); - createUser("jrogers"); - createUser("jdoe"); - - /** - * Delete the list to remove any junk then recreate it. - */ - { - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - List values = new ArrayList(); - values.add("NOFORN"); - values.add("FGI"); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); - } - - /** - * Positive test Get the constraint - */ - { - String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM + "/values"; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - String constraintName = data.getString("constraintName"); - assertNotNull("constraintName is null", constraintName); - String constraintTitle = data.getString("constraintTitle"); - assertNotNull("constraintTitle is null", constraintTitle); - - JSONArray values = data.getJSONArray("values"); - - assertTrue("details array does not contain 2 elements", values.length() == 2); - boolean fgiFound = false; - boolean nofornFound = false; - - for(int i =0; i < values.length(); i++) - { - JSONObject value = values.getJSONObject(i); - - if(value.getString("valueName").equalsIgnoreCase("FGI")) - { - fgiFound = true; - - } - - if(value.getString("valueName").equalsIgnoreCase("NOFORN")) - { - nofornFound = true; - } - - - } - assertTrue("fgi not found", fgiFound); - assertTrue("noforn not found", nofornFound); - } - - deleteUser("fbloggs"); - deleteUser("jrogers"); - deleteUser("jdoe"); - } - - - - /** - * Update a value in a constraint - * @throws Exception - */ - public void testUpdateRMConstraintValue() throws Exception - { - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Add some data to an empty list - */ - { - JSONArray values = new JSONArray(); - - JSONArray authorities = new JSONArray(); - authorities.put("fbloggs"); - authorities.put("jdoe"); - - JSONObject valueA = new JSONObject(); - valueA.put("value", "NOFORN"); - valueA.put("authorities", authorities); - - values.put(valueA); - - JSONObject valueB = new JSONObject(); - valueB.put("value", "FGI"); - valueB.put("authorities", authorities); - - values.put(valueB); - - JSONObject obj = new JSONObject(); - obj.put("values", values); - - - /** - * Do the first update - should get back - * NOFORN - fbloggs, jdoe - * FGI - fbloggs, jdoe - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - assertNotNull("data is null", data); - - JSONArray myValues = data.getJSONArray("values"); - assertTrue("two values not found", myValues.length() == 2); - for(int i = 0; i < myValues.length(); i++) - { - JSONObject myObj = myValues.getJSONObject(i); - } - } - - /** - * Add to a new value, NOCON, fbloggs, jrogers - */ - { - JSONArray values = new JSONArray(); - - JSONArray authorities = new JSONArray(); - authorities.put("fbloggs"); - authorities.put("jrogers"); - - JSONObject valueA = new JSONObject(); - valueA.put("value", "NOCON"); - valueA.put("authorities", authorities); - - values.put(valueA); - - - JSONObject obj = new JSONObject(); - obj.put("values", values); - - - /** - * Add a new value - should get back - * NOFORN - fbloggs, jdoe - * FGI - fbloggs, jdoe - * NOCON - fbloggs, jrogers - */ - System.out.println(obj.toString()); - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - assertNotNull("data is null", data); - - JSONArray myValues = data.getJSONArray("values"); - assertTrue("three values not found", myValues.length() == 3); - for(int i = 0; i < myValues.length(); i++) - { - JSONObject myObj = myValues.getJSONObject(i); - } - } - - /** - * Add to an existing value (NOFORN, jrogers) - * should get back - * NOFORN - fbloggs, jdoe, jrogers - * FGI - fbloggs, jdoe - * NOCON - fbloggs, jrogers - */ - { - JSONArray values = new JSONArray(); - - JSONArray authorities = new JSONArray(); - authorities.put("fbloggs"); - authorities.put("jrogers"); - authorities.put("jdoe"); - - JSONObject valueA = new JSONObject(); - valueA.put("value", "NOFORN"); - valueA.put("authorities", authorities); - - values.put(valueA); - - - JSONObject obj = new JSONObject(); - obj.put("values", values); - - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - assertNotNull("data is null", data); - - JSONArray myValues = data.getJSONArray("values"); - assertTrue("three values not found", myValues.length() == 3); - for(int i = 0; i < myValues.length(); i++) - { - JSONObject myObj = myValues.getJSONObject(i); - } - } - - - /** - * Remove from existing value (NOCON, fbloggs) - */ - { - JSONArray values = new JSONArray(); - - JSONArray authorities = new JSONArray(); - authorities.put("jrogers"); - - JSONObject valueA = new JSONObject(); - valueA.put("value", "NOCON"); - valueA.put("authorities", authorities); - - values.put(valueA); - - - JSONObject obj = new JSONObject(); - obj.put("values", values); - - - /** - * should get back - * NOFORN - fbloggs, jdoe - * FGI - fbloggs, jdoe - * NOCON - jrogers - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - assertNotNull("data is null", data); - - JSONArray myValues = data.getJSONArray("values"); - assertTrue("three values not found", myValues.length() == 3); - boolean foundNOCON = false; - boolean foundNOFORN = false; - boolean foundFGI = false; - - for(int i = 0; i < myValues.length(); i++) - { - JSONObject myObj = myValues.getJSONObject(i); - - if(myObj.getString("valueName").equalsIgnoreCase("NOCON")) - { - foundNOCON = true; - } - if(myObj.getString("valueName").equalsIgnoreCase("NOFORN")) - { - foundNOFORN = true; - } - if(myObj.getString("valueName").equalsIgnoreCase("FGI")) - { - foundFGI = true; - } - } - - assertTrue("not found NOCON", foundNOCON); - assertTrue("not found NOFORN", foundNOFORN); - assertTrue("not found FGI", foundFGI); - } - } - - - /** - * Delete the entire constraint - * - * @throws Exception - */ - public void testDeleteRMConstraint() throws Exception - { - /** - * Delete the list to remove any junk then recreate it. - */ - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - /** - * Now do a delete - */ - Response response = sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST), Status.STATUS_OK); - - /** - * Now delete the list that should have been deleted - */ - // TODO NEED TO THINK ABOUT THIS BEHAVIOUR - //{ - // sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST), Status.STATUS_NOT_FOUND); - //} - - /** - * Negative test - delete list that does not exist - */ - { - sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + "rmc_wibble"), Status.STATUS_NOT_FOUND); - } - } - - private boolean compare(JSONArray from, JSONArray to) throws Exception - { - List ret = new ArrayList(); - - if(from.length() != to.length()) - { - fail("arrays are different lengths" + from.length() +", " + to.length()); - return false; - } - - for(int i = 0 ; i < to.length(); i++) - { - ret.add(to.getString(i)); - } - - for(int i = 0 ; i < from.length(); i++) - { - String val = from.getString(i); - - if(ret.contains(val)) - { - - } - else - { - fail("Value not contained in list:" + val); - return false; - } - } - - return true; - } - - - /** - * Create an RM Constraint value - * @throws Exception - */ - public void testGetRMConstraintValue() throws Exception - { - - String constraintName = null; - - /* - * Create a new list - */ - { - String title = "Get Constraint Value"; - JSONArray array = new JSONArray(); - array.put("POTATO"); - array.put("CARROT"); - array.put("TURNIP"); - - JSONObject obj = new JSONObject(); - obj.put("allowedValues", array); - obj.put("constraintTitle", title); - /** - * Now do a post to create a new list - */ - Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - constraintName = data.getString("constraintName"); - JSONArray allowedValues = data.getJSONArray("allowedValues"); - assertTrue("values not correct", compare(array, allowedValues)); - } - - /** - * Get the CARROT value - */ - { - String url = URL_RM_CONSTRAINTS + "/" + constraintName + "/values/" + "CARROT"; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - } - - { - String url = URL_RM_CONSTRAINTS + "/" + constraintName + "/values/" + "ONION"; - sendRequest(new GetRequest(url), Status.STATUS_NOT_FOUND); - } - } -} - +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.alfresco.util.GUID; +import org.json.JSONArray; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * + * + * @author Mark Rogers + */ +@SuppressWarnings("unused") +public class RMCaveatConfigScriptTest extends BaseRMWebScriptTestCase +{ + protected final static String RM_LIST = "rmc:smListTest"; + protected final static String RM_LIST_URI_ELEM = "rmc_smListTest"; + + private static final String URL_RM_CONSTRAINTS = "/api/rma/admin/rmconstraints"; + + public void testGetRMConstraints() throws Exception + { + { + Response response = sendRequest(new GetRequest(URL_RM_CONSTRAINTS), Status.STATUS_OK); + + JSONObject top = new JSONObject(response.getContentAsString()); + System.out.println(response.getContentAsString()); + assertNotNull(top.getJSONArray("data")); + } + + /** + * Add a list, then get it back via the list rest script + */ + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + { + Response response = sendRequest(new GetRequest(URL_RM_CONSTRAINTS), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + System.out.println(response.getContentAsString()); + JSONArray data = top.getJSONArray("data"); + + boolean found = false; + assertTrue("no data returned", data.length() > 0); + for(int i = 0; i < data.length(); i++) + { + JSONObject obj = data.getJSONObject(i); + String name = (String)obj.getString("constraintName"); + assertNotNull("constraintName is null", name); + String url = (String)obj.getString("url"); + assertNotNull("detail url is null", name); + if(name.equalsIgnoreCase(RM_LIST)) + { + found = true; + } + + /** + * vallidate the detail URL returned + */ + sendRequest(new GetRequest(url), Status.STATUS_OK); + } + } + } + + /** + * + * @throws Exception + */ + public void testGetRMConstraint() throws Exception + { + /** + * Delete the list to remove any junk then recreate it. + */ + if (caveatConfigService.getRMConstraint(RM_LIST) != null) + { + caveatConfigService.deleteRMConstraint(RM_LIST); + } + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + + createUser("fbloggs"); + createUser("jrogers"); + createUser("jdoe"); + + + List values = new ArrayList(); + values.add("NOFORN"); + values.add("FGI"); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); + + /** + * Positive test Get the constraint + */ + { + String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; + Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + + String constraintName = data.getString("constraintName"); + assertNotNull("constraintName is null", constraintName); +// JSONArray allowedValues = data.getJSONArray("allowedValues"); + +// assertTrue("values not correct", compare(array, allowedValues)); + +// JSONArray constraintDetails = data.getJSONArray("constraintDetails"); +// +// assertTrue("details array does not contain 3 elements", constraintDetails.length() == 3); +// for(int i =0; i < constraintDetails.length(); i++) +// { +// JSONObject detail = constraintDetails.getJSONObject(i); +// } + } + + /** + * + * @throws Exception + */ + + /** + * Negative test - Attempt to get a constraint that does exist + */ + { + String url = URL_RM_CONSTRAINTS + "/" + "rmc_wibble"; + sendRequest(new GetRequest(url), Status.STATUS_NOT_FOUND); + } + + deleteUser("fbloggs"); + deleteUser("jrogers"); + deleteUser("jdoe"); + + + + + } + + /** + * Create an RM Constraint + * @throws Exception + */ + public void testUpdateRMConstraint() throws Exception + { + + String constraintName = null; + /* + * Create a new list + */ + { + String title = "test Update RM Constraint title"; + JSONArray array = new JSONArray(); + array.put("LEMON"); + array.put("BANANA"); + array.put("PEACH"); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + obj.put("constraintTitle", title); + /** + * Now do a post to create a new list + */ + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + constraintName = data.getString("constraintName"); + JSONArray allowedValues = data.getJSONArray("allowedValues"); + assertTrue("values not correct", compare(array, allowedValues)); + + } + + /** + * Now update both values and title - remove BANANA, PEACH, Add APPLE. + */ + + { + String newTitle = "this is the new title"; + JSONArray array = new JSONArray(); + array.put("LEMON"); + array.put("APPLE"); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + obj.put("constraintName", constraintName); + obj.put("constraintTitle", newTitle); + + System.out.println(obj.toString()); + + /** + * Now do a post to update list + */ + Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); + // Check the response + JSONObject top = new JSONObject(response.getContentAsString()); + JSONObject data = top.getJSONObject("data"); + + System.out.println(response.getContentAsString()); + + String url = data.getString("url"); + String constraintName2 = data.getString("constraintName"); + String constraintTitle = data.getString("constraintTitle"); + JSONArray allowedValues = data.getJSONArray("allowedValues"); + + assertTrue(allowedValues.length() == 2); + assertTrue("values not correct", compare(array, allowedValues)); + assertNotNull(url); + assertEquals(constraintName2, constraintName); + assertNotNull(constraintTitle); + assertEquals("title not as expected", constraintTitle, newTitle); + + // Check that data has been persisted. + Response resp2 = sendRequest(new GetRequest(url), Status.STATUS_OK); + JSONObject top2 = new JSONObject(resp2.getContentAsString()); + System.out.println("Problem here"); + System.out.println(resp2.getContentAsString()); + JSONObject data2 = top2.getJSONObject("data"); + String constraintTitle2 = data2.getString("constraintTitle"); + JSONArray allowedValues2 = data2.getJSONArray("allowedValues"); + assertTrue("values not correct", compare(array, allowedValues2)); + assertTrue("allowedValues is not 2", allowedValues2.length() == 2); + assertEquals(constraintName2, constraintName); + assertNotNull(constraintTitle2); + assertEquals("title not as expected", constraintTitle2, newTitle); + + } + + /** + * Now put without allowed values + */ + { + String newTitle = "update with no values"; + + JSONObject obj = new JSONObject(); + + obj.put("constraintName", RM_LIST); + obj.put("constraintTitle", newTitle); + + /** + * Now do a put to update a new list + */ + + Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); + // Check the response + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + + String url = data.getString("url"); + String constraintName2 = data.getString("constraintName"); + String constraintTitle = data.getString("constraintTitle"); + JSONArray allowedValues = data.getJSONArray("allowedValues"); + + assertTrue(allowedValues.length() == 2); + + assertNotNull(url); + assertEquals(constraintName2, constraintName); + assertNotNull(constraintTitle); + assertEquals("title not as expected", constraintTitle, newTitle); + } + + /** + * Now post without constraint Title + */ + { + JSONArray array = new JSONArray(); + array.put("LEMON"); + array.put("APPLE"); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + + System.out.println(obj.toString()); + + /** + * Now do a Put to update the list - title should remain + */ + + Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); + // Check the response + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + } + + /** + * Add a new value (PEAR) to the list + */ + { + JSONArray array = new JSONArray(); + array.put("PEAR"); + array.put("LEMON"); + array.put("APPLE"); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + + System.out.println(obj.toString()); + + Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); + // Check the response + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + } + + /** + * Remove a value (PEAR) from the list + */ + { + JSONArray array = new JSONArray(); + array.put("APPLE"); + array.put("LEMON"); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + + System.out.println(obj.toString()); + + Response response = sendRequest(new PutRequest(URL_RM_CONSTRAINTS + "/" + constraintName, obj.toString(), "application/json"), Status.STATUS_OK); + // Check the response + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + } + + } + + + /** + * Create an RM Constraint + * @throws Exception + */ + public void testCreateRMConstraint() throws Exception + { + /** + * Delete the list to remove any junk then recreate it. + */ + //caveatConfigService.deleteRMConstraint(RM_LIST); + + /** + * create a new list + */ + { + JSONArray array = new JSONArray(); + array.put("NOFORN"); + array.put("FGI"); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + obj.put("constraintName", RM_LIST); + obj.put("constraintTitle", GUID.generate()); + + System.out.println(obj.toString()); + + /** + * Now do a post to create a new list + */ + + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); + // Check the response + } + + /** + * Now go and get the constraint + */ + { + String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; + Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + + String constraintName = data.getString("constraintName"); + assertNotNull("constraintName is null", constraintName); + +// JSONArray constraintDetails = data.getJSONArray("constraintDetails"); +// +// assertTrue("details array does not contain 3 elements", constraintDetails.length() == 3); +// for(int i =0; i < constraintDetails.length(); i++) +// { +// JSONObject detail = constraintDetails.getJSONObject(i); +// } + } + + /** + * Now a constraint with a generated name + */ + { + String title = GUID.generate(); + JSONArray array = new JSONArray(); + array.put("Red"); + array.put("Blue"); + array.put("Green"); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + obj.put("constraintTitle", title); + + System.out.println(obj.toString()); + + /** + * Now do a post to create a new list + */ + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + + // Check the response + + String url = data.getString("url"); + String constraintName = data.getString("constraintName"); + String constraintTitle = data.getString("constraintTitle"); + JSONArray allowedValues = data.getJSONArray("allowedValues"); + + assertTrue(allowedValues.length() == 3); + assertNotNull(url); + assertNotNull(constraintName); + assertNotNull(constraintTitle); + assertEquals("title not as expected", constraintTitle, title); + sendRequest(new GetRequest(url), Status.STATUS_OK); + + + } + + + /** + * Now a constraint with an empty list of values. + */ + { + JSONArray array = new JSONArray(); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + obj.put("constraintName", "rmc_whazoo"); + obj.put("constraintTitle", GUID.generate()); + + System.out.println(obj.toString()); + + /** + * Now do a post to create a new list + */ + + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + + // Check the response + } + + +// /** +// * Negative tests - duplicate list +// */ +// { +// JSONArray array = new JSONArray(); +// array.put("NOFORN"); +// array.put("FGI"); +// +// JSONObject obj = new JSONObject(); +// obj.put("allowedValues", array); +// obj.put("constraintName", RM_LIST); +// obj.put("constraintTitle", "this is the title"); +// +// System.out.println(obj.toString()); +// +// /** +// * Now do a post to create a new list +// */ +// Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_CREATED); +// JSONObject top = new JSONObject(response.getContentAsString()); +// +// JSONObject data = top.getJSONObject("data"); +// System.out.println(response.getContentAsString()); +// +// // Check the response +// } + + + } + + + public void testGetRMConstraintValues() throws Exception + { + createUser("fbloggs"); + createUser("jrogers"); + createUser("jdoe"); + + /** + * Delete the list to remove any junk then recreate it. + */ + { + if (caveatConfigService.getRMConstraint(RM_LIST) != null) + { + caveatConfigService.deleteRMConstraint(RM_LIST); + } + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + List values = new ArrayList(); + values.add("NOFORN"); + values.add("FGI"); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); + } + + /** + * Positive test Get the constraint + */ + { + String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM + "/values"; + Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + + String constraintName = data.getString("constraintName"); + assertNotNull("constraintName is null", constraintName); + String constraintTitle = data.getString("constraintTitle"); + assertNotNull("constraintTitle is null", constraintTitle); + + JSONArray values = data.getJSONArray("values"); + + assertTrue("details array does not contain 2 elements", values.length() == 2); + boolean fgiFound = false; + boolean nofornFound = false; + + for(int i =0; i < values.length(); i++) + { + JSONObject value = values.getJSONObject(i); + + if(value.getString("valueName").equalsIgnoreCase("FGI")) + { + fgiFound = true; + + } + + if(value.getString("valueName").equalsIgnoreCase("NOFORN")) + { + nofornFound = true; + } + + + } + assertTrue("fgi not found", fgiFound); + assertTrue("noforn not found", nofornFound); + } + + deleteUser("fbloggs"); + deleteUser("jrogers"); + deleteUser("jdoe"); + } + + + + /** + * Update a value in a constraint + * @throws Exception + */ + public void testUpdateRMConstraintValue() throws Exception + { + if (caveatConfigService.getRMConstraint(RM_LIST) != null) + { + caveatConfigService.deleteRMConstraint(RM_LIST); + } + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + /** + * Add some data to an empty list + */ + { + JSONArray values = new JSONArray(); + + JSONArray authorities = new JSONArray(); + authorities.put("fbloggs"); + authorities.put("jdoe"); + + JSONObject valueA = new JSONObject(); + valueA.put("value", "NOFORN"); + valueA.put("authorities", authorities); + + values.put(valueA); + + JSONObject valueB = new JSONObject(); + valueB.put("value", "FGI"); + valueB.put("authorities", authorities); + + values.put(valueB); + + JSONObject obj = new JSONObject(); + obj.put("values", values); + + + /** + * Do the first update - should get back + * NOFORN - fbloggs, jdoe + * FGI - fbloggs, jdoe + */ + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + assertNotNull("data is null", data); + + JSONArray myValues = data.getJSONArray("values"); + assertTrue("two values not found", myValues.length() == 2); + for(int i = 0; i < myValues.length(); i++) + { + JSONObject myObj = myValues.getJSONObject(i); + } + } + + /** + * Add to a new value, NOCON, fbloggs, jrogers + */ + { + JSONArray values = new JSONArray(); + + JSONArray authorities = new JSONArray(); + authorities.put("fbloggs"); + authorities.put("jrogers"); + + JSONObject valueA = new JSONObject(); + valueA.put("value", "NOCON"); + valueA.put("authorities", authorities); + + values.put(valueA); + + + JSONObject obj = new JSONObject(); + obj.put("values", values); + + + /** + * Add a new value - should get back + * NOFORN - fbloggs, jdoe + * FGI - fbloggs, jdoe + * NOCON - fbloggs, jrogers + */ + System.out.println(obj.toString()); + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + assertNotNull("data is null", data); + + JSONArray myValues = data.getJSONArray("values"); + assertTrue("three values not found", myValues.length() == 3); + for(int i = 0; i < myValues.length(); i++) + { + JSONObject myObj = myValues.getJSONObject(i); + } + } + + /** + * Add to an existing value (NOFORN, jrogers) + * should get back + * NOFORN - fbloggs, jdoe, jrogers + * FGI - fbloggs, jdoe + * NOCON - fbloggs, jrogers + */ + { + JSONArray values = new JSONArray(); + + JSONArray authorities = new JSONArray(); + authorities.put("fbloggs"); + authorities.put("jrogers"); + authorities.put("jdoe"); + + JSONObject valueA = new JSONObject(); + valueA.put("value", "NOFORN"); + valueA.put("authorities", authorities); + + values.put(valueA); + + + JSONObject obj = new JSONObject(); + obj.put("values", values); + + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + assertNotNull("data is null", data); + + JSONArray myValues = data.getJSONArray("values"); + assertTrue("three values not found", myValues.length() == 3); + for(int i = 0; i < myValues.length(); i++) + { + JSONObject myObj = myValues.getJSONObject(i); + } + } + + + /** + * Remove from existing value (NOCON, fbloggs) + */ + { + JSONArray values = new JSONArray(); + + JSONArray authorities = new JSONArray(); + authorities.put("jrogers"); + + JSONObject valueA = new JSONObject(); + valueA.put("value", "NOCON"); + valueA.put("authorities", authorities); + + values.put(valueA); + + + JSONObject obj = new JSONObject(); + obj.put("values", values); + + + /** + * should get back + * NOFORN - fbloggs, jdoe + * FGI - fbloggs, jdoe + * NOCON - jrogers + */ + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST + "/values" , obj.toString(), "application/json"), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + assertNotNull("data is null", data); + + JSONArray myValues = data.getJSONArray("values"); + assertTrue("three values not found", myValues.length() == 3); + boolean foundNOCON = false; + boolean foundNOFORN = false; + boolean foundFGI = false; + + for(int i = 0; i < myValues.length(); i++) + { + JSONObject myObj = myValues.getJSONObject(i); + + if(myObj.getString("valueName").equalsIgnoreCase("NOCON")) + { + foundNOCON = true; + } + if(myObj.getString("valueName").equalsIgnoreCase("NOFORN")) + { + foundNOFORN = true; + } + if(myObj.getString("valueName").equalsIgnoreCase("FGI")) + { + foundFGI = true; + } + } + + assertTrue("not found NOCON", foundNOCON); + assertTrue("not found NOFORN", foundNOFORN); + assertTrue("not found FGI", foundFGI); + } + } + + + /** + * Delete the entire constraint + * + * @throws Exception + */ + public void testDeleteRMConstraint() throws Exception + { + /** + * Delete the list to remove any junk then recreate it. + */ + if (caveatConfigService.getRMConstraint(RM_LIST) != null) + { + caveatConfigService.deleteRMConstraint(RM_LIST); + } + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + /** + * Now do a delete + */ + Response response = sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST), Status.STATUS_OK); + + /** + * Now delete the list that should have been deleted + */ + // TODO NEED TO THINK ABOUT THIS BEHAVIOUR + //{ + // sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + RM_LIST), Status.STATUS_NOT_FOUND); + //} + + /** + * Negative test - delete list that does not exist + */ + { + sendRequest(new DeleteRequest(URL_RM_CONSTRAINTS + "/" + "rmc_wibble"), Status.STATUS_NOT_FOUND); + } + } + + private boolean compare(JSONArray from, JSONArray to) throws Exception + { + List ret = new ArrayList(); + + if(from.length() != to.length()) + { + fail("arrays are different lengths" + from.length() +", " + to.length()); + return false; + } + + for(int i = 0 ; i < to.length(); i++) + { + ret.add(to.getString(i)); + } + + for(int i = 0 ; i < from.length(); i++) + { + String val = from.getString(i); + + if(ret.contains(val)) + { + + } + else + { + fail("Value not contained in list:" + val); + return false; + } + } + + return true; + } + + + /** + * Create an RM Constraint value + * @throws Exception + */ + public void testGetRMConstraintValue() throws Exception + { + + String constraintName = null; + + /* + * Create a new list + */ + { + String title = "Get Constraint Value"; + JSONArray array = new JSONArray(); + array.put("POTATO"); + array.put("CARROT"); + array.put("TURNIP"); + + JSONObject obj = new JSONObject(); + obj.put("allowedValues", array); + obj.put("constraintTitle", title); + /** + * Now do a post to create a new list + */ + Response response = sendRequest(new PostRequest(URL_RM_CONSTRAINTS, obj.toString(), "application/json"), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + constraintName = data.getString("constraintName"); + JSONArray allowedValues = data.getJSONArray("allowedValues"); + assertTrue("values not correct", compare(array, allowedValues)); + } + + /** + * Get the CARROT value + */ + { + String url = URL_RM_CONSTRAINTS + "/" + constraintName + "/values/" + "CARROT"; + Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + } + + { + String url = URL_RM_CONSTRAINTS + "/" + constraintName + "/values/" + "ONION"; + sendRequest(new GetRequest(url), Status.STATUS_NOT_FOUND); + } + } +} + diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMConstraintScriptTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMConstraintScriptTest.java index c033c324b9..83c57814ee 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMConstraintScriptTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RMConstraintScriptTest.java @@ -1,109 +1,109 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * Test of GET RM Constraint (User facing scripts) - * - * @author Mark Rogers - */ -public class RMConstraintScriptTest extends BaseRMWebScriptTestCase -{ - protected final static String RM_LIST = "rmc:smListTest"; - protected final static String RM_LIST_URI_ELEM = "rmc_smListTest"; - - private static final String URL_RM_CONSTRAINTS = "/api/rma/rmconstraints"; - - /** - * - * @throws Exception - */ - public void testGetRMConstraint() throws Exception - { - // Set the current security context as admin - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - /** - * Delete the list to remove any junk then recreate it. - */ - if (caveatConfigService.getRMConstraint(RM_LIST) != null) - { - caveatConfigService.deleteRMConstraint(RM_LIST); - } - caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - - - createUser("fbloggs"); - createUser("jrogers"); - createUser("jdoe"); - - - List values = new ArrayList(); - values.add("NOFORN"); - values.add("FGI"); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); - - AuthenticationUtil.setFullyAuthenticatedUser("jdoe"); - /** - * Positive test Get the constraint - */ - { - String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - - JSONObject data = top.getJSONObject("data"); - System.out.println(response.getContentAsString()); - - data.getJSONArray("allowedValuesForCurrentUser"); - - } - - - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - deleteUser("fbloggs"); - deleteUser("jrogers"); - deleteUser("jdoe"); - - } - -} - - +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * Test of GET RM Constraint (User facing scripts) + * + * @author Mark Rogers + */ +public class RMConstraintScriptTest extends BaseRMWebScriptTestCase +{ + protected final static String RM_LIST = "rmc:smListTest"; + protected final static String RM_LIST_URI_ELEM = "rmc_smListTest"; + + private static final String URL_RM_CONSTRAINTS = "/api/rma/rmconstraints"; + + /** + * + * @throws Exception + */ + public void testGetRMConstraint() throws Exception + { + // Set the current security context as admin + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + + /** + * Delete the list to remove any junk then recreate it. + */ + if (caveatConfigService.getRMConstraint(RM_LIST) != null) + { + caveatConfigService.deleteRMConstraint(RM_LIST); + } + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); + + + createUser("fbloggs"); + createUser("jrogers"); + createUser("jdoe"); + + + List values = new ArrayList(); + values.add("NOFORN"); + values.add("FGI"); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "fbloggs", values); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); + caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jdoe", values); + + AuthenticationUtil.setFullyAuthenticatedUser("jdoe"); + /** + * Positive test Get the constraint + */ + { + String url = URL_RM_CONSTRAINTS + "/" + RM_LIST_URI_ELEM; + Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); + JSONObject top = new JSONObject(response.getContentAsString()); + + JSONObject data = top.getJSONObject("data"); + System.out.println(response.getContentAsString()); + + data.getJSONArray("allowedValuesForCurrentUser"); + + } + + + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + deleteUser("fbloggs"); + deleteUser("jrogers"); + deleteUser("jdoe"); + + } + +} + + diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmAuthoritiesRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmAuthoritiesRestApiTest.java index ad72995250..2d3ee0e125 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmAuthoritiesRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmAuthoritiesRestApiTest.java @@ -1,350 +1,350 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.util.GUID; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for adding/removing users/groups to/from a role - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmAuthoritiesRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - private static final String RM_CHILDREN_URL = "/api/rm/%s/roles/%s/authorities/%s"; - - /** Constant for the content type */ - private static final String APPLICATION_JSON = "application/json"; - - /** Constant for users and groups */ - private static final String USER_WITH_CAPABILITY = GUID.generate(); - private static final String USER_WITHOUT_CAPABILITY = GUID.generate(); - private static final String ROLE_INCLUDING_CAPABILITY = GUID.generate(); - private static final String ROLE_NOT_INCLUDING_CAPABILITY = GUID.generate(); - private static final String USER_TO_ADD_TO_ROLE = GUID.generate(); - private static final String GROUP_TO_ADD_TO_ROLE = GUID.generate(); - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#setupTestData() - */ - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - // Create test user WITH required capability - createUser(USER_WITH_CAPABILITY); - // Create test role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS)); - capabilities.add(capabilityService.getCapability(RMPermissionModel.MANAGE_ACCESS_CONTROLS)); - filePlanRoleService.createRole(filePlan, ROLE_INCLUDING_CAPABILITY, ROLE_INCLUDING_CAPABILITY, capabilities); - // Add user to the role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_INCLUDING_CAPABILITY, USER_WITH_CAPABILITY); - - // Create test user WITHOUT required capability - createUser(USER_WITHOUT_CAPABILITY); - // Create test role - filePlanRoleService.createRole(filePlan, ROLE_NOT_INCLUDING_CAPABILITY, ROLE_NOT_INCLUDING_CAPABILITY, new HashSet(1)); - // Add user to the role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_NOT_INCLUDING_CAPABILITY, USER_WITHOUT_CAPABILITY); - - // Create a test user to add to role - createUser(USER_TO_ADD_TO_ROLE); - - // Create a group to add to role - createGroup(GROUP_TO_ADD_TO_ROLE); - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#tearDownImpl() - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // Delete test user WITH required capability - deleteUser(USER_WITH_CAPABILITY); - // Delete test role - filePlanRoleService.deleteRole(filePlan, ROLE_INCLUDING_CAPABILITY); - - // Delete test user WITHOUT required capability - deleteUser(USER_WITHOUT_CAPABILITY); - // Add user to the role - filePlanRoleService.deleteRole(filePlan, ROLE_NOT_INCLUDING_CAPABILITY); - - // Delete the user which was added to the role - deleteUser(getTestUserName()); - - // Delete the group which was added to the role - deleteGroup(getTestGroupName()); - } - - /** - * Test the REST API to add/remove a user to/from a role - * - * @throws IOException - * @throws JSONException - */ - public void testRmAddRemoveUser() throws IOException, JSONException - { - // Do the positive test with a user with the needed capabilities - AuthenticationUtil.setFullyAuthenticatedUser(USER_WITH_CAPABILITY); - - // Get the user name - String userName = getTestUserName(); - - // Check if the user is already assigned to the role - assertFalse(getUsersAssignedToRole().contains(userName)); - - // Format url, send the request and check the content - String url = getFormattedUrlString(userName); - checkContent(postRequestSuccess(url)); - - // The user should be added to the role - assertTrue(getUsersAssignedToRole().contains(userName)); - - // Remove the user from the role and check the content - checkContent(deleteRequestSuccess(url)); - - // The user should be removed from the role - assertFalse(getUsersAssignedToRole().contains(userName)); - - // Do the negative test with a user without any capabilities - AuthenticationUtil.setFullyAuthenticatedUser(USER_WITHOUT_CAPABILITY); - - // Send a request. The expectation is an internal server error - postRequestFailure(url); - } - - /** - * Test the REST API to add/remove a group to/from a role - * - * @throws IOException - * @throws JSONException - */ - public void testRmAddRemoveGroup() throws IOException, JSONException - { - // Do the positive test with a user with the needed capabilities - AuthenticationUtil.setFullyAuthenticatedUser(USER_WITH_CAPABILITY); - - // Get the group name - String groupName = getTestGroupName(); - - // Check if the group is already assigned to the role - assertFalse(getGroupsAssignedToRole().contains(groupName)); - - // Format url, send the request and check the content - String url = getFormattedUrlString(groupName); - checkContent(postRequestSuccess(url)); - - // The group should be added to the role - assertTrue(getGroupsAssignedToRole().contains(groupName)); - - // Remove the group from the role and check the content - checkContent(deleteRequestSuccess(url)); - - // The user should be removed from the role - assertFalse(getGroupsAssignedToRole().contains(groupName)); - - // Do the negative test with a user without any capabilities - AuthenticationUtil.setFullyAuthenticatedUser(USER_WITHOUT_CAPABILITY); - - // Send a request. The expectation is an internal server error - deleteRequestFailure(url); - } - - /** - * Util method to get the user name which will be added/removed to/from the role - * - * @return Returns the user name which will be added/removed to/from the role - */ - private String getTestUserName() - { - return authorityService.getName(AuthorityType.USER, USER_TO_ADD_TO_ROLE); - } - - /** - * Util method to get the group name which will be added/removed to/from the role - * - * @return Returns the user group which will be added/removed to/from the role - */ - private String getTestGroupName() - { - return authorityService.getName(AuthorityType.GROUP, GROUP_TO_ADD_TO_ROLE); - } - - /** - * Util method to get a set of groups assigned to a role - * - * @return Returns a set of groups assigned to a role - */ - private Set getGroupsAssignedToRole() - { - return filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER); - } - - /** - * Util method to get a set of users assigned to a role - * - * @return Returns a set of users assigned to a role - */ - private Set getUsersAssignedToRole() - { - return filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER); - } - - /** - * Util method to get a formatted nodeRef string - * - * @return Returns a formatted nodeRef string - */ - private String getFormattedFilePlanString() - { - StoreRef storeRef = filePlan.getStoreRef(); - String storeType = storeRef.getProtocol(); - String storeId = storeRef.getIdentifier(); - String id = filePlan.getId(); - - StringBuffer sb = new StringBuffer(32); - sb.append(storeType); - sb.append("/"); - sb.append(storeId); - sb.append("/"); - sb.append(id); - - return sb.toString(); - } - - /** - * Util method to get a formatted url string - * - * @param authorityName The name of the authority which should be added/removed to/from a role - * @return Returns a formatted url string - */ - private String getFormattedUrlString(String authorityName) - { - return String.format(RM_CHILDREN_URL, getFormattedFilePlanString(), FilePlanRoleService.ROLE_SECURITY_OFFICER, authorityName); - } - - /** - * Util method to send a post request. The expected status is success. - * - * @param url The url which should be used to make the post request - * @return Returns the response from the server - * @throws UnsupportedEncodingException - * @throws IOException - */ - private Response postRequestSuccess(String url) throws UnsupportedEncodingException, IOException - { - return sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); - } - - /** - * Util method to send a post request. The expected status is an internal server error. - * - * @param url The url which should be used to make the post request - * @return Returns the response from the server - * @throws UnsupportedEncodingException - * @throws IOException - */ - private Response postRequestFailure(String url) throws UnsupportedEncodingException, IOException - { - return sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_INTERNAL_SERVER_ERROR); - } - - /** - * Util method to send a delete request. The expected status is success. - * - * @param url The url which should be used to make the delete request - * @return Returns the response from the server - * @throws IOException - */ - private Response deleteRequestSuccess(String url) throws IOException - { - return sendRequest(new DeleteRequest(url), Status.STATUS_OK); - } - - /** - * Util method to send a delete request. The expected status is an internal server error. - * - * @param url The url which should be used to make the delete request - * @return Returns the response from the server - * @throws IOException - */ - private Response deleteRequestFailure(String url) throws IOException - { - return sendRequest(new DeleteRequest(url), Status.STATUS_INTERNAL_SERVER_ERROR); - } - - /** - * Util method to check the server response - * - * @param response The server response - * @throws UnsupportedEncodingException - */ - private void checkContent(Response response) throws UnsupportedEncodingException - { - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - assertTrue(contentAsString.contains("{}")); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.util.GUID; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * REST API Tests for adding/removing users/groups to/from a role + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmAuthoritiesRestApiTest extends BaseRMWebScriptTestCase +{ + /** URL for the REST APIs */ + private static final String RM_CHILDREN_URL = "/api/rm/%s/roles/%s/authorities/%s"; + + /** Constant for the content type */ + private static final String APPLICATION_JSON = "application/json"; + + /** Constant for users and groups */ + private static final String USER_WITH_CAPABILITY = GUID.generate(); + private static final String USER_WITHOUT_CAPABILITY = GUID.generate(); + private static final String ROLE_INCLUDING_CAPABILITY = GUID.generate(); + private static final String ROLE_NOT_INCLUDING_CAPABILITY = GUID.generate(); + private static final String USER_TO_ADD_TO_ROLE = GUID.generate(); + private static final String GROUP_TO_ADD_TO_ROLE = GUID.generate(); + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#setupTestData() + */ + @Override + protected void setupTestData() + { + super.setupTestData(); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + // Create test user WITH required capability + createUser(USER_WITH_CAPABILITY); + // Create test role + Set capabilities = new HashSet(2); + capabilities.add(capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS)); + capabilities.add(capabilityService.getCapability(RMPermissionModel.MANAGE_ACCESS_CONTROLS)); + filePlanRoleService.createRole(filePlan, ROLE_INCLUDING_CAPABILITY, ROLE_INCLUDING_CAPABILITY, capabilities); + // Add user to the role + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_INCLUDING_CAPABILITY, USER_WITH_CAPABILITY); + + // Create test user WITHOUT required capability + createUser(USER_WITHOUT_CAPABILITY); + // Create test role + filePlanRoleService.createRole(filePlan, ROLE_NOT_INCLUDING_CAPABILITY, ROLE_NOT_INCLUDING_CAPABILITY, new HashSet(1)); + // Add user to the role + filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_NOT_INCLUDING_CAPABILITY, USER_WITHOUT_CAPABILITY); + + // Create a test user to add to role + createUser(USER_TO_ADD_TO_ROLE); + + // Create a group to add to role + createGroup(GROUP_TO_ADD_TO_ROLE); + + return null; + } + }); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#tearDownImpl() + */ + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + + // Delete test user WITH required capability + deleteUser(USER_WITH_CAPABILITY); + // Delete test role + filePlanRoleService.deleteRole(filePlan, ROLE_INCLUDING_CAPABILITY); + + // Delete test user WITHOUT required capability + deleteUser(USER_WITHOUT_CAPABILITY); + // Add user to the role + filePlanRoleService.deleteRole(filePlan, ROLE_NOT_INCLUDING_CAPABILITY); + + // Delete the user which was added to the role + deleteUser(getTestUserName()); + + // Delete the group which was added to the role + deleteGroup(getTestGroupName()); + } + + /** + * Test the REST API to add/remove a user to/from a role + * + * @throws IOException + * @throws JSONException + */ + public void testRmAddRemoveUser() throws IOException, JSONException + { + // Do the positive test with a user with the needed capabilities + AuthenticationUtil.setFullyAuthenticatedUser(USER_WITH_CAPABILITY); + + // Get the user name + String userName = getTestUserName(); + + // Check if the user is already assigned to the role + assertFalse(getUsersAssignedToRole().contains(userName)); + + // Format url, send the request and check the content + String url = getFormattedUrlString(userName); + checkContent(postRequestSuccess(url)); + + // The user should be added to the role + assertTrue(getUsersAssignedToRole().contains(userName)); + + // Remove the user from the role and check the content + checkContent(deleteRequestSuccess(url)); + + // The user should be removed from the role + assertFalse(getUsersAssignedToRole().contains(userName)); + + // Do the negative test with a user without any capabilities + AuthenticationUtil.setFullyAuthenticatedUser(USER_WITHOUT_CAPABILITY); + + // Send a request. The expectation is an internal server error + postRequestFailure(url); + } + + /** + * Test the REST API to add/remove a group to/from a role + * + * @throws IOException + * @throws JSONException + */ + public void testRmAddRemoveGroup() throws IOException, JSONException + { + // Do the positive test with a user with the needed capabilities + AuthenticationUtil.setFullyAuthenticatedUser(USER_WITH_CAPABILITY); + + // Get the group name + String groupName = getTestGroupName(); + + // Check if the group is already assigned to the role + assertFalse(getGroupsAssignedToRole().contains(groupName)); + + // Format url, send the request and check the content + String url = getFormattedUrlString(groupName); + checkContent(postRequestSuccess(url)); + + // The group should be added to the role + assertTrue(getGroupsAssignedToRole().contains(groupName)); + + // Remove the group from the role and check the content + checkContent(deleteRequestSuccess(url)); + + // The user should be removed from the role + assertFalse(getGroupsAssignedToRole().contains(groupName)); + + // Do the negative test with a user without any capabilities + AuthenticationUtil.setFullyAuthenticatedUser(USER_WITHOUT_CAPABILITY); + + // Send a request. The expectation is an internal server error + deleteRequestFailure(url); + } + + /** + * Util method to get the user name which will be added/removed to/from the role + * + * @return Returns the user name which will be added/removed to/from the role + */ + private String getTestUserName() + { + return authorityService.getName(AuthorityType.USER, USER_TO_ADD_TO_ROLE); + } + + /** + * Util method to get the group name which will be added/removed to/from the role + * + * @return Returns the user group which will be added/removed to/from the role + */ + private String getTestGroupName() + { + return authorityService.getName(AuthorityType.GROUP, GROUP_TO_ADD_TO_ROLE); + } + + /** + * Util method to get a set of groups assigned to a role + * + * @return Returns a set of groups assigned to a role + */ + private Set getGroupsAssignedToRole() + { + return filePlanRoleService.getGroupsAssignedToRole(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER); + } + + /** + * Util method to get a set of users assigned to a role + * + * @return Returns a set of users assigned to a role + */ + private Set getUsersAssignedToRole() + { + return filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER); + } + + /** + * Util method to get a formatted nodeRef string + * + * @return Returns a formatted nodeRef string + */ + private String getFormattedFilePlanString() + { + StoreRef storeRef = filePlan.getStoreRef(); + String storeType = storeRef.getProtocol(); + String storeId = storeRef.getIdentifier(); + String id = filePlan.getId(); + + StringBuffer sb = new StringBuffer(32); + sb.append(storeType); + sb.append("/"); + sb.append(storeId); + sb.append("/"); + sb.append(id); + + return sb.toString(); + } + + /** + * Util method to get a formatted url string + * + * @param authorityName The name of the authority which should be added/removed to/from a role + * @return Returns a formatted url string + */ + private String getFormattedUrlString(String authorityName) + { + return String.format(RM_CHILDREN_URL, getFormattedFilePlanString(), FilePlanRoleService.ROLE_SECURITY_OFFICER, authorityName); + } + + /** + * Util method to send a post request. The expected status is success. + * + * @param url The url which should be used to make the post request + * @return Returns the response from the server + * @throws UnsupportedEncodingException + * @throws IOException + */ + private Response postRequestSuccess(String url) throws UnsupportedEncodingException, IOException + { + return sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_OK); + } + + /** + * Util method to send a post request. The expected status is an internal server error. + * + * @param url The url which should be used to make the post request + * @return Returns the response from the server + * @throws UnsupportedEncodingException + * @throws IOException + */ + private Response postRequestFailure(String url) throws UnsupportedEncodingException, IOException + { + return sendRequest(new PostRequest(url, new JSONObject().toString(), APPLICATION_JSON), Status.STATUS_INTERNAL_SERVER_ERROR); + } + + /** + * Util method to send a delete request. The expected status is success. + * + * @param url The url which should be used to make the delete request + * @return Returns the response from the server + * @throws IOException + */ + private Response deleteRequestSuccess(String url) throws IOException + { + return sendRequest(new DeleteRequest(url), Status.STATUS_OK); + } + + /** + * Util method to send a delete request. The expected status is an internal server error. + * + * @param url The url which should be used to make the delete request + * @return Returns the response from the server + * @throws IOException + */ + private Response deleteRequestFailure(String url) throws IOException + { + return sendRequest(new DeleteRequest(url), Status.STATUS_INTERNAL_SERVER_ERROR); + } + + /** + * Util method to check the server response + * + * @param response The server response + * @throws UnsupportedEncodingException + */ + private void checkContent(Response response) throws UnsupportedEncodingException + { + String contentAsString = response.getContentAsString(); + assertNotNull(contentAsString); + assertTrue(contentAsString.contains("{}")); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java index afc94d66f0..889553c38c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java @@ -1,155 +1,155 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for Class Definitions - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmClassesRestApiTest extends BaseRMWebScriptTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** URL for the REST APIs */ - private static final String RM_ASPECTS_URL = "/api/rm/classes?cf=%s&siteId=%s"; - - /** - * Test the REST API to retrieve the list of rm aspects - * - * @throws IOException - * @throws JSONException - */ - public void testRmGetAspectDefinitions() throws IOException, JSONException - { - // Format url and send request - String url = String.format(RM_ASPECTS_URL, "aspect", siteId); - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json array - JSONArray contentAsJson = new JSONArray(contentAsString); - assertNotNull(contentAsJson); - - // Get a (sub)list of available dm/rm aspects - List dmAspects = getDmAspects(); - List rmAspects = getRmAspects(); - - // Get the list of rm aspects from the response and check it - List rmAspectList = new ArrayList(); - for (int i = 0; i < contentAsJson.length(); i++) - { - String name = contentAsJson.getJSONObject(i).getString("name"); - assertNotNull(name); - rmAspectList.add(name); - assertFalse(dmAspects.contains(name)); - } - assertTrue(rmAspectList.containsAll(rmAspects)); - - // Get the list of dm aspects and check them. It also contains rm related aspects. - - // Format url and send request - url = String.format(RM_ASPECTS_URL, "aspect", collabSiteId); - response = sendRequest(new GetRequest(url), Status.STATUS_OK); - - // Check the content from the response - contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json array - contentAsJson = new JSONArray(contentAsString); - assertNotNull(contentAsJson); - - // Get the list of dm aspects from the response and check it - List dmAspectList = new ArrayList(); - for (int i = 0; i < contentAsJson.length(); i++) - { - String name = contentAsJson.getJSONObject(i).getString("name"); - assertNotNull(name); - dmAspectList.add(name); - } - assertTrue(dmAspectList.containsAll(dmAspects)); - // the list of dm aspescts contains also rm aspects - assertTrue(dmAspectList.containsAll(rmAspects)); - } - - /** - * Returns a (sub)list of rm aspects - * - * @return A (sub)list of rm aspects - */ - private List getRmAspects() - { - return Arrays.asList(new String[] - { - "rma:ascended", - "rma:recordMetaData", - "rma:vitalRecordDefinition" - }); - } - - /** - * Returns a (sub)list of dm aspects - * - * @return A (sub)list of dm aspects - */ - private List getDmAspects() - { - return Arrays.asList(new String[] - { - "emailserver:attached", - "bpm:assignees", - "cm:likesRatingSchemeRollups", - "wf:parallelReviewStats", - "sys:localized" - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * REST API Tests for Class Definitions + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmClassesRestApiTest extends BaseRMWebScriptTestCase +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#isCollaborationSiteTest() + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** URL for the REST APIs */ + private static final String RM_ASPECTS_URL = "/api/rm/classes?cf=%s&siteId=%s"; + + /** + * Test the REST API to retrieve the list of rm aspects + * + * @throws IOException + * @throws JSONException + */ + public void testRmGetAspectDefinitions() throws IOException, JSONException + { + // Format url and send request + String url = String.format(RM_ASPECTS_URL, "aspect", siteId); + Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); + + // Check the content from the response + String contentAsString = response.getContentAsString(); + assertNotNull(contentAsString); + + // Convert the response to json array + JSONArray contentAsJson = new JSONArray(contentAsString); + assertNotNull(contentAsJson); + + // Get a (sub)list of available dm/rm aspects + List dmAspects = getDmAspects(); + List rmAspects = getRmAspects(); + + // Get the list of rm aspects from the response and check it + List rmAspectList = new ArrayList(); + for (int i = 0; i < contentAsJson.length(); i++) + { + String name = contentAsJson.getJSONObject(i).getString("name"); + assertNotNull(name); + rmAspectList.add(name); + assertFalse(dmAspects.contains(name)); + } + assertTrue(rmAspectList.containsAll(rmAspects)); + + // Get the list of dm aspects and check them. It also contains rm related aspects. + + // Format url and send request + url = String.format(RM_ASPECTS_URL, "aspect", collabSiteId); + response = sendRequest(new GetRequest(url), Status.STATUS_OK); + + // Check the content from the response + contentAsString = response.getContentAsString(); + assertNotNull(contentAsString); + + // Convert the response to json array + contentAsJson = new JSONArray(contentAsString); + assertNotNull(contentAsJson); + + // Get the list of dm aspects from the response and check it + List dmAspectList = new ArrayList(); + for (int i = 0; i < contentAsJson.length(); i++) + { + String name = contentAsJson.getJSONObject(i).getString("name"); + assertNotNull(name); + dmAspectList.add(name); + } + assertTrue(dmAspectList.containsAll(dmAspects)); + // the list of dm aspescts contains also rm aspects + assertTrue(dmAspectList.containsAll(rmAspects)); + } + + /** + * Returns a (sub)list of rm aspects + * + * @return A (sub)list of rm aspects + */ + private List getRmAspects() + { + return Arrays.asList(new String[] + { + "rma:ascended", + "rma:recordMetaData", + "rma:vitalRecordDefinition" + }); + } + + /** + * Returns a (sub)list of dm aspects + * + * @return A (sub)list of dm aspects + */ + private List getDmAspects() + { + return Arrays.asList(new String[] + { + "emailserver:attached", + "bpm:assignees", + "cm:likesRatingSchemeRollups", + "wf:parallelReviewStats", + "sys:localized" + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java index 5506e308ab..edc2fed386 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java @@ -1,155 +1,155 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for Properties Definitions - * - * @author Tuna Aksoy - * @since 2.1 - */ -public class RmPropertiesRestApiTest extends BaseRMWebScriptTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** URL for the REST APIs */ - private static final String RM_TYPES_URL = "/api/rm/classes?cf=%s&siteId=%s"; - - /** - * Test the REST API to retrieve the list of rm types - * - * @throws IOException - * @throws JSONException - */ - public void testRmGetTypeDefinitions() throws IOException, JSONException - { - // Format url and send request - String url = String.format(RM_TYPES_URL, "type", siteId); - Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json array - JSONArray contentAsJson = new JSONArray(contentAsString); - assertNotNull(contentAsJson); - - // Get a (sub)list of available dm/rm types - List dmTypes = getDmTypes(); - List rmTypes = getRmTypes(); - - // Get the list of rm types from the response and check it - List rmTypeList = new ArrayList(); - for (int i = 0; i < contentAsJson.length(); i++) - { - String name = contentAsJson.getJSONObject(i).getString("name"); - assertNotNull(name); - rmTypeList.add(name); - assertFalse(dmTypes.contains(name)); - } - assertTrue(rmTypeList.containsAll(rmTypes)); - - // Get the list of dm types and check them. It also contains rm related types. - - // Format url and send request - url = String.format(RM_TYPES_URL, "type", collabSiteId); - response = sendRequest(new GetRequest(url), Status.STATUS_OK); - - // Check the content from the response - contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json array - contentAsJson = new JSONArray(contentAsString); - assertNotNull(contentAsJson); - - // Get the list of dm types from the response and check it - List dmTypeList = new ArrayList(); - for (int i = 0; i < contentAsJson.length(); i++) - { - String name = contentAsJson.getJSONObject(i).getString("name"); - assertNotNull(name); - dmTypeList.add(name); - } - assertTrue(dmTypeList.containsAll(dmTypes)); - // the list of dm type contains also rm types - assertTrue(dmTypeList.containsAll(rmTypes)); - } - - /** - * Returns a (sub)list of rm types - * - * @return A (sub)list of rm types - */ - private List getRmTypes() - { - return Arrays.asList(new String[] - { - "rma:eventExecution", - "rma:nonElectronicDocument", - "rma:transfer" - }); - } - - /** - * Returns a (sub)list of dm types - * - * @return A (sub)list of dm types - */ - private List getDmTypes() - { - return Arrays.asList(new String[] - { - "cm:authority", - "sys:descriptor", - "app:folderlink", - "wf:submitGroupReviewTask", - "cmis:policy" - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * REST API Tests for Properties Definitions + * + * @author Tuna Aksoy + * @since 2.1 + */ +public class RmPropertiesRestApiTest extends BaseRMWebScriptTestCase +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase#isCollaborationSiteTest() + */ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + /** URL for the REST APIs */ + private static final String RM_TYPES_URL = "/api/rm/classes?cf=%s&siteId=%s"; + + /** + * Test the REST API to retrieve the list of rm types + * + * @throws IOException + * @throws JSONException + */ + public void testRmGetTypeDefinitions() throws IOException, JSONException + { + // Format url and send request + String url = String.format(RM_TYPES_URL, "type", siteId); + Response response = sendRequest(new GetRequest(url), Status.STATUS_OK); + + // Check the content from the response + String contentAsString = response.getContentAsString(); + assertNotNull(contentAsString); + + // Convert the response to json array + JSONArray contentAsJson = new JSONArray(contentAsString); + assertNotNull(contentAsJson); + + // Get a (sub)list of available dm/rm types + List dmTypes = getDmTypes(); + List rmTypes = getRmTypes(); + + // Get the list of rm types from the response and check it + List rmTypeList = new ArrayList(); + for (int i = 0; i < contentAsJson.length(); i++) + { + String name = contentAsJson.getJSONObject(i).getString("name"); + assertNotNull(name); + rmTypeList.add(name); + assertFalse(dmTypes.contains(name)); + } + assertTrue(rmTypeList.containsAll(rmTypes)); + + // Get the list of dm types and check them. It also contains rm related types. + + // Format url and send request + url = String.format(RM_TYPES_URL, "type", collabSiteId); + response = sendRequest(new GetRequest(url), Status.STATUS_OK); + + // Check the content from the response + contentAsString = response.getContentAsString(); + assertNotNull(contentAsString); + + // Convert the response to json array + contentAsJson = new JSONArray(contentAsString); + assertNotNull(contentAsJson); + + // Get the list of dm types from the response and check it + List dmTypeList = new ArrayList(); + for (int i = 0; i < contentAsJson.length(); i++) + { + String name = contentAsJson.getJSONObject(i).getString("name"); + assertNotNull(name); + dmTypeList.add(name); + } + assertTrue(dmTypeList.containsAll(dmTypes)); + // the list of dm type contains also rm types + assertTrue(dmTypeList.containsAll(rmTypes)); + } + + /** + * Returns a (sub)list of rm types + * + * @return A (sub)list of rm types + */ + private List getRmTypes() + { + return Arrays.asList(new String[] + { + "rma:eventExecution", + "rma:nonElectronicDocument", + "rma:transfer" + }); + } + + /** + * Returns a (sub)list of dm types + * + * @return A (sub)list of dm types + */ + private List getDmTypes() + { + return Arrays.asList(new String[] + { + "cm:authority", + "sys:descriptor", + "app:folderlink", + "wf:submitGroupReviewTask", + "cmis:policy" + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java index 48b12af1b0..1766566de2 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java @@ -1,1172 +1,1172 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; -import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.text.MessageFormat; -import java.util.Date; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionParams; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONStringer; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.ISO8601DateFormat; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * This class tests the Rest API for RM. - * - * @author Neil McErlean - */ -public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel -{ - protected static final String GET_NODE_AUDITLOG_URL_FORMAT = "/api/node/{0}/rmauditlog"; - protected static final String GET_TRANSFER_URL_FORMAT = "/api/node/{0}/transfers/{1}"; - protected static final String TRANSFER_REPORT_URL_FORMAT = "/api/node/{0}/transfers/{1}/report"; - protected static final String REF_INSTANCES_URL_FORMAT = "/api/node/{0}/customreferences"; - protected static final String RMA_AUDITLOG_URL = "/api/rma/admin/rmauditlog"; - protected static final String RMA_AUDITLOG_STATUS_URL = "/api/rma/admin/rmauditlog/status"; - protected static final String GET_LIST_URL = "/api/rma/admin/listofvalues"; - protected static final String RMA_ACTIONS_URL = "/api/rma/actions/ExecutionQueue"; - protected static final String APPLICATION_JSON = "application/json"; - protected static final String RMA_CUSTOM_PROPS_DEFINITIONS_URL = "/api/rma/admin/custompropertydefinitions"; - protected static final String RMA_CUSTOM_REFS_DEFINITIONS_URL = "/api/rma/admin/customreferencedefinitions"; - - private static final String BI_DI = "BiDi"; - private static final String CHILD_SRC = "childSrc"; - private static final String CHILD_TGT = "childTgt"; - - /** - * This test method ensures that a POST of an RM action to a non-existent node - * will result in a 404 status. - * - * @throws Exception - */ - public void testPostActionToNonExistentNode() throws Exception - { - NodeRef nonExistentNode = new NodeRef("workspace://SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"); - - // Construct the JSON request. - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("nodeRef", nonExistentNode.toString()); - // Although the request specifies a 'reviewed' action, it does not matter what - // action is specified here, as the non-existent Node should trigger a 404 - // before the action is executed. - jsonPostData.put("name", "reviewed"); - - // Submit the JSON request. - String jsonPostString = jsonPostData.toString(); - - final int expectedStatus = 404; - sendRequest(new PostRequest(RMA_ACTIONS_URL, jsonPostString, APPLICATION_JSON), expectedStatus); - } - - public void testPostReviewedAction() throws IOException, JSONException - { - NodeRef testRecord = utils.createRecord(recordFolder, "test.txt"); - - // In this test, this property has a date-value equal to the model import time. - Serializable pristineReviewAsOf = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); - - // Construct the JSON request for 'reviewed'. - String jsonString = new JSONStringer().object() - .key("name").value("reviewed") - .key("nodeRef").value(testRecord.toString()) - // These JSON params are just to test the submission of params. They'll be ignored. - .key("params").object() - .key("param1").value("one") - .key("param2").value("two") - .endObject() - .endObject() - .toString(); - - // Submit the JSON request. - final int expectedStatus = 200; - Response rsp = sendRequest(new PostRequest(RMA_ACTIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - - String rspContent = rsp.getContentAsString(); - assertTrue(rspContent.contains("Successfully queued action [reviewed]")); - - Serializable newReviewAsOfDate = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); - assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf, - pristineReviewAsOf.equals(newReviewAsOfDate)); - } - - public void testPostMultiReviewedAction() throws IOException, JSONException - { - NodeRef testRecord = utils.createRecord(recordFolder, "test1.txt"); - NodeRef testRecord2 = utils.createRecord(recordFolder, "test2.txt"); - NodeRef testRecord3 = utils.createRecord(recordFolder, "test3.txt"); - - // In this test, this property has a date-value equal to the model import time. - Serializable pristineReviewAsOf = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); - Serializable pristineReviewAsOf2 = this.nodeService.getProperty(testRecord2, PROP_REVIEW_AS_OF); - Serializable pristineReviewAsOf3 = this.nodeService.getProperty(testRecord3, PROP_REVIEW_AS_OF); - - // Construct the JSON request for 'reviewed'. - String jsonString = new JSONStringer().object() - .key("name").value("reviewed") - .key("nodeRefs").array() - .value(testRecord.toString()) - .value(testRecord2.toString()) - .value(testRecord3.toString()) - .endArray() - // These JSON params are just to test the submission of params. They'll be ignored. - .key("params").object() - .key("param1").value("one") - .key("param2").value("two") - .endObject() - .endObject() - .toString(); - - // Submit the JSON request. - final int expectedStatus = 200; - Response rsp = sendRequest(new PostRequest(RMA_ACTIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - - String rspContent = rsp.getContentAsString(); - assertTrue(rspContent.contains("Successfully queued action [reviewed]")); - - Serializable newReviewAsOfDate = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); - assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf, - pristineReviewAsOf.equals(newReviewAsOfDate)); - Serializable newReviewAsOfDate2 = this.nodeService.getProperty(testRecord2, PROP_REVIEW_AS_OF); - assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf2, - pristineReviewAsOf2.equals(newReviewAsOfDate2)); - Serializable newReviewAsOfDate3 = this.nodeService.getProperty(testRecord3, PROP_REVIEW_AS_OF); - assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf3, - pristineReviewAsOf3.equals(newReviewAsOfDate3)); - } - - public void testActionParams() throws Exception - { - // Construct the JSON request for 'reviewed'. - String jsonString = new JSONStringer().object() - .key("name").value("testActionParams") - .key("nodeRef").array() - .value("nothing://nothing/nothing") - .endArray() - // These JSON params are just to test the submission of params. They'll be ignored. - .key("params").object() - .key(TestActionParams.PARAM_DATE).object() - .key("iso8601") - .value(ISO8601DateFormat.format(new Date())) - .endObject() - .endObject() - .endObject() - .toString(); - - // Submit the JSON request. - final int expectedStatus = 200; - //TODO Currently failing unit test. - sendRequest(new PostRequest(RMA_ACTIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - } - - public void testPostCustomReferenceDefinitions() throws IOException, JSONException - { - postCustomReferenceDefinitions(); - } - - /** - * This method creates a child and a non-child reference and returns their generated ids. - * - * - * @return String[] with element 0 = refId of p/c ref, 1 = refId pf bidi. - */ - private String[] postCustomReferenceDefinitions() throws JSONException, IOException, - UnsupportedEncodingException { - String[] result = new String[2]; - - // 1. Child association. - String jsonString = new JSONStringer().object() - .key("referenceType").value(RelationshipType.PARENTCHILD) - .key("source").value(CHILD_SRC) - .key("target").value(CHILD_TGT) - .endObject() - .toString(); - -// System.out.println(jsonString); - - // Submit the JSON request. - final int expectedStatus = 200; - Response rsp = sendRequest(new PostRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - - String rspContent = rsp.getContentAsString(); - assertTrue(rspContent.contains("success")); - -// System.out.println(rspContent); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String generatedChildRefId = jsonRsp.getJSONObject("data").getString("refId"); - result[0] = generatedChildRefId; - - // 2. Non-child or standard association. - jsonString = new JSONStringer().object() - .key("referenceType").value(RelationshipType.BIDIRECTIONAL) - .key("label").value(BI_DI) - .endObject() - .toString(); - -// System.out.println(jsonString); - - // Submit the JSON request. - rsp = sendRequest(new PostRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL, - jsonString, APPLICATION_JSON), expectedStatus); - - rspContent = rsp.getContentAsString(); - assertTrue(rspContent.contains("success")); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String generatedBidiRefId = jsonRsp.getJSONObject("data").getString("refId"); - result[1] = generatedBidiRefId; - - // Now assert that both have appeared in the data dictionary. - AspectDefinition customAssocsAspect = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); - assertNotNull("Missing customAssocs aspect", customAssocsAspect); - - QName newRefQname = adminService.getQNameForClientId(generatedChildRefId); - Map associations = customAssocsAspect.getAssociations(); - assertTrue("Custom child assoc not returned by dataDictionary.", associations.containsKey(newRefQname)); - - newRefQname = adminService.getQNameForClientId(generatedBidiRefId); - assertTrue("Custom std assoc not returned by dataDictionary.", customAssocsAspect.getAssociations().containsKey(newRefQname)); - - return result; - } - - public void testPutCustomPropertyDefinition() throws Exception - { - // POST to create a property definition with a known propId - final String propertyLabel = "Original label åçîéøü"; - String propId = postCustomPropertyDefinition(propertyLabel, null); - - // PUT an updated label. - final String updatedLabel = "Updated label πø^¨¥†®"; - String jsonString = new JSONStringer().object() - .key("label").value(updatedLabel) - .endObject() - .toString(); - - String propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; - Response rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - // GET from the URL again to ensure it's valid - rsp = sendRequest(new GetRequest(propDefnUrl), 200); - String rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - // PUT an updated constraint ref. - final String updatedConstraint = "rmc:tlList"; - jsonString = new JSONStringer().object() - .key("constraintRef").value(updatedConstraint) - .endObject() - .toString(); - - propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; - rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String urlOfNewPropDef = jsonRsp.getString("url"); - assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); - - // GET from the URL again to ensure it's valid - rsp = sendRequest(new GetRequest(propDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - JSONObject customPropsObject = dataObject.getJSONObject("customProperties"); - assertNotNull("JSON customProperties object was null", customPropsObject); - assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); - - Object keyToSoleProp = customPropsObject.keys().next(); - - JSONObject newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); - assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); - JSONArray constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); - assertEquals("ConstraintRefsArray wrong length.", 1, constraintRefsArray.length()); - String retrievedUpdatedTitle = constraintRefsArray.getJSONObject(0).getString("name"); - assertEquals("Constraints had wrong name.", "rmc:tlList", retrievedUpdatedTitle); - - // PUT again to remove all constraints - jsonString = new JSONStringer().object() - .key("constraintRef").value(null) - .endObject() - .toString(); - - rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - - // GET from the URL again to ensure it's valid - rsp = sendRequest(new GetRequest(propDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - customPropsObject = dataObject.getJSONObject("customProperties"); - assertNotNull("JSON customProperties object was null", customPropsObject); - assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); - - keyToSoleProp = customPropsObject.keys().next(); - - newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); - assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); - constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); - assertEquals("ConstraintRefsArray wrong length.", 0, constraintRefsArray.length()); - - // Finally PUT a constraint on a PropertyDefn that has been cleared of constraints. - // This was raised as an issue - final String readdedConstraint = "rmc:tlList"; - jsonString = new JSONStringer().object() - .key("constraintRef").value(readdedConstraint) - .endObject() - .toString(); - - propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; - rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); -// System.out.println("PUTting a constraint back again."); -// System.out.println(rspContent); - - // And GET from the URL again - rsp = sendRequest(new GetRequest(propDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - customPropsObject = dataObject.getJSONObject("customProperties"); - assertNotNull("JSON customProperties object was null", customPropsObject); - assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); - - keyToSoleProp = customPropsObject.keys().next(); - - newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); - assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); - constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); - assertEquals("ConstraintRefsArray wrong length.", 1, constraintRefsArray.length()); - String readdedUpdatedTitle = constraintRefsArray.getJSONObject(0).getString("name"); - assertEquals("Constraints had wrong name.", "rmc:tlList", readdedUpdatedTitle); - } - - public void testGetCustomReferences() throws IOException, JSONException - { - // Ensure that there is at least one custom reference. - postCustomReferenceDefinitions(); - - // GET all custom reference definitions - final int expectedStatus = 200; - Response rsp = sendRequest(new GetRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL), expectedStatus); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONArray customRefsObj = (JSONArray)dataObj.get("customReferences"); - assertNotNull("JSON 'customReferences' object was null", customRefsObj); - - assertTrue("There should be at least two custom references. Found " + customRefsObj, customRefsObj.length() >= 2); - - // GET a specific custom reference definition. - // Here, we're using one of the built-in references - // qname = rmc:versions - rsp = sendRequest(new GetRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL + "/" + CUSTOM_REF_VERSIONS.getLocalName()), expectedStatus); - - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - customRefsObj = (JSONArray)dataObj.get("customReferences"); - assertNotNull("JSON 'customProperties' object was null", customRefsObj); - - assertTrue("There should be exactly 1 custom references. Found " + customRefsObj.length(), customRefsObj.length() == 1); - } - - public void testGetDodCustomTypes() throws IOException, JSONException - { - final int expectedStatus = 200; - Response rsp = sendRequest(new GetRequest("/api/rma/admin/dodcustomtypes"), expectedStatus); - - String rspContent = rsp.getContentAsString(); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - - // System.out.println(rspContent); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONArray customTypesObj = (JSONArray)dataObj.get("dodCustomTypes"); - assertNotNull("JSON 'dodCustomTypes' object was null", customTypesObj); - - assertEquals("Wrong DOD custom types count.", 4, customTypesObj.length()); - } - - public void testGetPostAndRemoveCustomReferenceInstances() throws Exception - { - NodeRef testRecord1 = utils.createRecord(recordFolder, "testRecord1" + System.currentTimeMillis(), "The from recørd"); - NodeRef testRecord2 = utils.createRecord(recordFolder, "testRecord2" + System.currentTimeMillis(), "The to récord"); - - String node1Url = testRecord1.toString().replace("://", "/"); - String refInstancesRecord1Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node1Url); - - // Create reference types. - String[] generatedRefIds = postCustomReferenceDefinitions(); - - // Add a standard ref - String jsonString = new JSONStringer().object() - .key("toNode").value(testRecord2.toString()) - .key("refId").value(generatedRefIds[1]) - .endObject() - .toString(); - - Response rsp = sendRequest(new PostRequest(refInstancesRecord1Url, - jsonString, APPLICATION_JSON), 200); - - // Add a child ref - jsonString = new JSONStringer().object() - .key("toNode").value(testRecord2.toString()) - .key("refId").value(generatedRefIds[0]) - .endObject() - .toString(); - -// System.out.println(jsonString); - - rsp = sendRequest(new PostRequest(refInstancesRecord1Url, - jsonString, APPLICATION_JSON), 200); - -// System.out.println(rsp.getContentAsString()); - - // Now retrieve the applied references from the REST API - // 1. references on the 'from' record. - rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - String contentAsString = rsp.getContentAsString(); -// System.out.println(contentAsString); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONArray customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); - assertNotNull("JSON 'customReferencesFrom' object was null", customRefsFromArray); - - int customRefsCount = customRefsFromArray.length(); - assertTrue("There should be at least one custom reference. Found " + customRefsFromArray, customRefsCount > 0); - - JSONArray customRefsToArray = (JSONArray)dataObj.get("customReferencesTo"); - assertNotNull("JSON 'customReferencesTo' object was null", customRefsToArray); - assertEquals("customReferencesTo wrong length.", 0, customRefsToArray.length()); - - // 2. Back-references on the 'to' record - String node2Url = testRecord2.toString().replace("://", "/"); - String refInstancesRecord2Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node2Url); - - rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); - - contentAsString = rsp.getContentAsString(); - - jsonRsp = new JSONObject(new JSONTokener(contentAsString)); - - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - customRefsToArray = (JSONArray)dataObj.get("customReferencesTo"); - assertNotNull("JSON 'customReferencesTo' object was null", customRefsToArray); - - customRefsCount = customRefsToArray.length(); - assertTrue("There should be at least one custom reference. Found " + customRefsToArray, customRefsCount > 0); - - customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); - assertNotNull("JSON 'customReferencesFrom' object was null", customRefsFromArray); - assertEquals("customReferencesFrom wrong length.", 0, customRefsFromArray.length()); - - - - // Now to delete a reference instance of each type - String protocol = testRecord2.getStoreRef().getProtocol(); - String identifier = testRecord2.getStoreRef().getIdentifier(); - String recId = testRecord2.getId(); - final String queryFormat = "?st={0}&si={1}&id={2}"; - String urlQueryString = MessageFormat.format(queryFormat, protocol, identifier, recId); - - rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" + generatedRefIds[1] + urlQueryString), 200); - assertTrue(rsp.getContentAsString().contains("success")); - - rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" - + generatedRefIds[0] - + urlQueryString), 200); - assertTrue(rsp.getContentAsString().contains("success")); - - // Get the reference instances back and confirm they've been removed. - rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); - assertNotNull("JSON 'customReferences' object was null", customRefsFromArray); - assertTrue("customRefsArray was unexpectedly not empty.", customRefsFromArray.length() == 0); - } - - public void testMob1630ShouldNotBeAbleToCreateTwoSupersedesReferencesOnOneRecordPair() throws Exception - { - // Create 2 test records. - NodeRef testRecord1 = utils.createRecord(recordFolder, "testRecord1" + System.currentTimeMillis(), "The from recørd"); - NodeRef testRecord2 = utils.createRecord(recordFolder, "testRecord2" + System.currentTimeMillis(), "The to récord"); - - String node1Url = testRecord1.toString().replace("://", "/"); - String node2Url = testRecord2.toString().replace("://", "/"); - String refInstancesRecord1Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node1Url); - String refInstancesRecord2Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node2Url); - - {// Sanity check. There should be no references defined on these new records. - Response rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - String rspContent = rsp.getContentAsString(); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObj = jsonRsp.getJSONObject("data"); - JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); - JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 0, refsTo.length()); - } - - // Add a supersedes ref instance between them - final String supersedesRefLocalName = CUSTOM_REF_SUPERSEDES.getLocalName(); - String jsonString = new JSONStringer().object() - .key("toNode").value(testRecord2.toString()) - .key("refId").value(supersedesRefLocalName) - .endObject() - .toString(); - - Response rsp = sendRequest(new PostRequest(refInstancesRecord1Url, - jsonString, APPLICATION_JSON), 200); - - // The bug is that we can apply two such references which should not be allowed - rsp = sendRequest(new PostRequest(refInstancesRecord1Url, - jsonString, APPLICATION_JSON), 500); - - {// Retrieve reference instances on this pair of records. - // The first record - rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - String rspContent = rsp.getContentAsString(); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObj = jsonRsp.getJSONObject("data"); - JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); - JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 1, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 0, refsTo.length()); - - // The second record - the back-reference - rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); - - rspContent = rsp.getContentAsString(); - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObj = jsonRsp.getJSONObject("data"); - refsFrom = dataObj.getJSONArray("customReferencesFrom"); - refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 1, refsTo.length()); - } - - // Delete the reference instance - String protocol = testRecord2.getStoreRef().getProtocol(); - String identifier = testRecord2.getStoreRef().getIdentifier(); - String recId = testRecord2.getId(); - final String queryFormat = "?st={0}&si={1}&id={2}"; - String urlQueryString = MessageFormat.format(queryFormat, protocol, identifier, recId); - - rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" + supersedesRefLocalName + urlQueryString), 200); - assertTrue(rsp.getContentAsString().contains("success")); - - {// Retrieve reference instances on this pair of records. - // The first record - rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); - - String rspContent = rsp.getContentAsString(); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObj = jsonRsp.getJSONObject("data"); - JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); - JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 0, refsTo.length()); - - // The second record - the back-reference - rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); - - rspContent = rsp.getContentAsString(); - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObj = jsonRsp.getJSONObject("data"); - refsFrom = dataObj.getJSONArray("customReferencesFrom"); - refsTo = dataObj.getJSONArray("customReferencesTo"); - assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); - assertEquals("Incorrect to-refs count.", 0, refsTo.length()); - } - } - - public void testPostCustomPropertyDefinition() throws Exception - { - long currentTimeMillis = System.currentTimeMillis(); - - // Create one with no propId - it'll get generated. - postCustomPropertyDefinition("customProperty" + currentTimeMillis, null); - - // Create another with an explicit propId. - postCustomPropertyDefinition("customProperty" + currentTimeMillis, "prop" + currentTimeMillis); - } - - /** - * Creates a new property definition using a POST call. - * GETs the resultant property definition. - * - * @param propertyLabel the label to use - * @param propId the propId to use - null to have one generated. - * @return the propId of the new property definition - */ - private String postCustomPropertyDefinition(String propertyLabel, String propId) throws JSONException, - IOException, UnsupportedEncodingException - { - String jsonString; - if (propId == null) - { - jsonString = new JSONStringer().object() - .key("label").value(propertyLabel) - .key("description").value("Dynamically defined test property") - .key("mandatory").value(false) - .key("dataType").value("d:text") - .key("element").value("record") - .key("constraintRef").value("rmc:smList") - // Note no propId - .endObject() - .toString(); - } - else - { - jsonString = new JSONStringer().object() - .key("label").value(propertyLabel) - .key("description").value("Dynamically defined test property") - .key("mandatory").value(false) - .key("dataType").value("d:text") - .key("element").value("record") - .key("constraintRef").value("rmc:smList") - .key("propId").value(propId) - .endObject() - .toString(); - } - - // Submit the JSON request. - final int expectedStatus = 200; - Response rsp = sendRequest(new PostRequest("/api/rma/admin/custompropertydefinitions?element=record", - jsonString, APPLICATION_JSON), expectedStatus); - - String rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String urlOfNewPropDef = jsonRsp.getString("url"); - String newPropId = jsonRsp.getString("propId"); - - assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); - - // GET from the URL we're given to ensure it's valid - rsp = sendRequest(new GetRequest(urlOfNewPropDef), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - JSONObject customPropsObject = dataObject.getJSONObject("customProperties"); - assertNotNull("JSON customProperties object was null", customPropsObject); - assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); - - Object keyToSoleProp = customPropsObject.keys().next(); - -// System.out.println("New property defn: " + keyToSoleProp); - - JSONObject newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); - assertEquals("Wrong property label.", propertyLabel, newPropObject.getString("label")); - - return newPropId; - } - - public void testPutCustomReferenceDefinition() throws Exception - { - String[] generatedRefIds = postCustomReferenceDefinitions(); - final String pcRefId = generatedRefIds[0]; - final String bidiRefId = generatedRefIds[1]; - - // GET the custom refs in order to retrieve the label/source/target - String refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + bidiRefId; - Response rsp = sendRequest(new GetRequest(refDefnUrl), 200); - - String rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - - refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; - rsp = sendRequest(new GetRequest(refDefnUrl), 200); - - rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - - // Update the bidirectional reference. - final String updatedBiDiLabel = "Updated label üøéîçå"; - String jsonString = new JSONStringer().object() - .key("label").value(updatedBiDiLabel) - .endObject() - .toString(); - - refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + bidiRefId; - rsp = sendRequest(new PutRequest(refDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String urlOfNewRefDef = jsonRsp.getString("url"); - assertNotNull("urlOfNewRefDef was null.", urlOfNewRefDef); - - // GET the bidi reference to ensure it's valid - rsp = sendRequest(new GetRequest(refDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - JSONArray customRefsObject = dataObject.getJSONArray("customReferences"); - assertNotNull("JSON customReferences object was null", customRefsObject); - assertEquals("Wrong customReferences length.", 1, customRefsObject.length()); - - JSONObject newRefObject = customRefsObject.getJSONObject(0); - assertEquals("Wrong property label.", updatedBiDiLabel, newRefObject.getString("label")); - - // Update the parent/child reference. - final String updatedPcSource = "Updated source ∆Ωç√∫"; - final String updatedPcTarget = "Updated target ∆Ωç√∫"; - jsonString = new JSONStringer().object() - .key("source").value(updatedPcSource) - .key("target").value(updatedPcTarget) - .endObject() - .toString(); - - refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; - rsp = sendRequest(new PutRequest(refDefnUrl, - jsonString, APPLICATION_JSON), 200); - - rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - urlOfNewRefDef = jsonRsp.getString("url"); - assertNotNull("urlOfNewRefDef was null.", urlOfNewRefDef); - - // GET the parent/child reference to ensure it's valid - refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; - - rsp = sendRequest(new GetRequest(refDefnUrl), 200); - rspContent = rsp.getContentAsString(); - -// System.out.println(rspContent); - - jsonRsp = new JSONObject(new JSONTokener(rspContent)); - dataObject = jsonRsp.getJSONObject("data"); - assertNotNull("JSON data object was null", dataObject); - customRefsObject = dataObject.getJSONArray("customReferences"); - assertNotNull("JSON customReferences object was null", customRefsObject); - assertEquals("Wrong customReferences length.", 1, customRefsObject.length()); - - newRefObject = customRefsObject.getJSONObject(0); - assertEquals("Wrong reference source.", updatedPcSource, newRefObject.getString("source")); - assertEquals("Wrong reference target.", updatedPcTarget, newRefObject.getString("target")); - } - - public void testGetCustomProperties() throws Exception - { - getCustomProperties(); - } - - private String getCustomProperties() throws Exception, IOException, - UnsupportedEncodingException, JSONException - { - // Ensure that there is at least one custom property. - this.testPostCustomPropertyDefinition(); - - final int expectedStatus = 200; - Response rsp = sendRequest(new GetRequest("/api/rma/admin/custompropertydefinitions?element=record"), expectedStatus); - - String contentAsString = rsp.getContentAsString(); -// System.out.println(contentAsString); - JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONObject customPropsObj = (JSONObject)dataObj.get("customProperties"); - assertNotNull("JSON 'customProperties' object was null", customPropsObj); - - final int customPropsCount = customPropsObj.length(); - assertTrue("There should be at least one custom property. Found " + customPropsObj, customPropsCount > 0); - - return contentAsString; - } - - public void testGetRecordMetaDataAspects() throws Exception - { - Response rsp = sendRequest(new GetRequest("/api/rma/recordmetadataaspects"), 200); - String contentAsString = rsp.getContentAsString(); - System.out.println(contentAsString); - JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); - - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - - JSONArray aspects = dataObj.getJSONArray("recordMetaDataAspects"); - assertNotNull(aspects); - assertEquals(4, aspects.length()); - - // TODO test the items themselves - } - - public void testExport() throws Exception - { - String exportUrl = "/api/rma/admin/export"; - - // define JSON POST body - JSONObject jsonPostData = new JSONObject(); - JSONArray nodeRefs = new JSONArray(); - nodeRefs.put(recordFolder.toString()); - nodeRefs.put(recordFolder2.toString()); - jsonPostData.put("nodeRefs", nodeRefs); - String jsonPostString = jsonPostData.toString(); - - // make the export request - Response rsp = sendRequest(new PostRequest(exportUrl, jsonPostString, APPLICATION_JSON), 200); - assertEquals("application/acp", rsp.getContentType()); - } - - public void testExportInTransferFormat() throws Exception - { - String exportUrl = "/api/rma/admin/export"; - - // define JSON POST body - JSONObject jsonPostData = new JSONObject(); - JSONArray nodeRefs = new JSONArray(); - nodeRefs.put(recordFolder.toString()); - nodeRefs.put(recordFolder2.toString()); - jsonPostData.put("nodeRefs", nodeRefs); - jsonPostData.put("transferFormat", true); - String jsonPostString = jsonPostData.toString(); - - // make the export request - Response rsp = sendRequest(new PostRequest(exportUrl, jsonPostString, APPLICATION_JSON), 200); - assertEquals("application/zip", rsp.getContentType()); - } - - public void testAudit() throws Exception - { - // call the list service to get audit events - Response rsp = sendRequest(new GetRequest(GET_LIST_URL), 200); - //System.out.println("GET : " + rsp.getContentAsString()); - assertEquals("application/json;charset=UTF-8", rsp.getContentType()); - - // get response as JSON and check - JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertNotNull(jsonParsedObject); - JSONObject data = jsonParsedObject.getJSONObject("data"); - JSONObject events = data.getJSONObject("auditEvents"); - JSONArray items = events.getJSONArray("items"); - assertEquals(auditService.getAuditEvents().size(), items.length()); - assertTrue(items.length() > 0); - JSONObject item = items.getJSONObject(0); - assertTrue(item.length() == 2); - assertTrue(item.has("label")); - assertTrue(item.has("value")); - - // get the full RM audit log and check response - rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL), 200); - assertEquals("application/json", rsp.getContentType()); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - // get the full RM audit log as an HTML report and check response - rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL + "?format=html"), 200); - assertEquals("text/html", rsp.getContentType()); - - // export the full RM audit log and check response - rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL + "?export=true"), 200); - assertEquals("application/json", rsp.getContentType()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - // construct the URL - String nodeUrl = recordCategory.toString().replace("://", "/"); - String auditUrl = MessageFormat.format(GET_NODE_AUDITLOG_URL_FORMAT, nodeUrl); - - // send request - rsp = sendRequest(new GetRequest(auditUrl), 200); - // check response - assertEquals("application/json", rsp.getContentType()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - // get the audit log with all restrictions in place - String filteredAuditUrl = auditUrl + "?user=gavinc&size=5&from=2009-01-01&to=2009-12-31&event=Login"; - rsp = sendRequest(new GetRequest(filteredAuditUrl), 200); - // check response - assertEquals("application/json", rsp.getContentType()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - // attempt to get the audit log with invalid restrictions in place - filteredAuditUrl = auditUrl + "?user=fred&size=abc&from=2009&to=2010&property=wrong"; - rsp = sendRequest(new GetRequest(filteredAuditUrl), 200); - assertEquals("application/json", rsp.getContentType()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - - checkAuditStatus(true); - - // start the RM audit log - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("enabled", true); - String jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PutRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); - - checkAuditStatus(true); - - // check the response - //System.out.println(rsp.getContentAsString()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - JSONObject dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - assertTrue(dataObj.getBoolean("enabled")); - assertTrue(dataObj.has("started")); - assertTrue(dataObj.has("stopped")); - - // stop the RM audit log - jsonPostData = new JSONObject(); - jsonPostData.put("enabled", false); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PutRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); - - checkAuditStatus(false); - - // check the response - //System.out.println(rsp.getContentAsString()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - assertFalse(dataObj.getBoolean("enabled")); - - // clear the RM audit log - rsp = sendRequest(new DeleteRequest(RMA_AUDITLOG_URL), 200); - //System.out.println(rsp.getContentAsString()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - dataObj = (JSONObject)jsonRsp.get("data"); - assertNotNull("JSON 'data' object was null", dataObj); - assertFalse(dataObj.getBoolean("enabled")); - } - - private void checkAuditStatus(boolean expected) throws Exception - { - Response rsp = sendRequest(new GetRequest(RMA_AUDITLOG_STATUS_URL), 200); - JSONObject rspObj = new JSONObject(rsp.getContentAsString()); - JSONObject data = rspObj.getJSONObject("data"); - boolean enabled = data.getBoolean("enabled"); - assertEquals("Audit log status does not match expected status.", expected, enabled); - - } - - public void testFileAuditLogAsRecord() throws Exception - { - // Attempt to store audit log at non existent destination, make sure we get 404 - JSONObject jsonPostData = new JSONObject(); - jsonPostData.put("destination", "workspace://SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"); - String jsonPostString = jsonPostData.toString(); - Response rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 404); - - // Attempt to store audit log at wrong type of destination, make sure we get 400 - jsonPostData = new JSONObject(); - jsonPostData.put("destination", recordCategory.toString()); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 400); - - - // Store the full audit log as a record - jsonPostData = new JSONObject(); - jsonPostData.put("destination", recordFolder2); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); - - // check the response - System.out.println(rsp.getContentAsString()); - JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertTrue(jsonRsp.has("success")); - assertTrue(jsonRsp.getBoolean("success")); - assertTrue(jsonRsp.has("record")); - assertNotNull(jsonRsp.get("record")); - assertTrue(nodeService.exists(new NodeRef(jsonRsp.getString("record")))); - assertTrue(jsonRsp.has("recordName")); - assertNotNull(jsonRsp.get("recordName")); - assertTrue(jsonRsp.getString("recordName").startsWith("audit_")); - - // Store a filtered audit log as a record - jsonPostData = new JSONObject(); - jsonPostData.put("destination", recordFolder2); - jsonPostData.put("size", "50"); - jsonPostData.put("user", "gavinc"); - jsonPostData.put("event", "Update Metadata"); - jsonPostData.put("property", "{http://www.alfresco.org/model/content/1.0}modified"); - jsonPostString = jsonPostData.toString(); - rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); - - // check the response - System.out.println(rsp.getContentAsString()); - jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); - assertTrue(jsonRsp.has("success")); - assertTrue(jsonRsp.getBoolean("success")); - assertTrue(jsonRsp.has("record")); - assertNotNull(jsonRsp.get("record")); - assertTrue(nodeService.exists(new NodeRef(jsonRsp.getString("record")))); - assertTrue(jsonRsp.has("recordName")); - assertNotNull(jsonRsp.get("recordName")); - assertTrue(jsonRsp.getString("recordName").startsWith("audit_")); - } - - public void testPropertyLabelWithAccentedChars() throws Exception - { - final long number = System.currentTimeMillis(); - - // Create a property with a simple name - final String simplePropId = "simpleId" + number; - postCustomPropertyDefinition("simple", simplePropId); - - // Create a property whose name has accented chars - final String originalAccentedLabel = "øoê≈çœ"; - final String accentedPropId = "accentedId" + number; - postCustomPropertyDefinition(originalAccentedLabel, accentedPropId); - - // We'll update the label on the simple-name property a few times. - // This will cause the repeated read and write of the entire RM custom model xml file - // This should also leave the accented-char property unchanged. - putCustomPropDefinition("one", simplePropId); - putCustomPropDefinition("two", simplePropId); - putCustomPropDefinition("three", simplePropId); - putCustomPropDefinition("four", simplePropId); - putCustomPropDefinition("five", simplePropId); - - // Now get all the custom properties back. - String rspContent = getCustomProperties(); - - JSONObject rspObject = new JSONObject(new JSONTokener(rspContent)); - JSONObject dataObj = rspObject.getJSONObject("data"); - assertNotNull("jsonObject was null", dataObj); - - JSONObject customPropertiesObj = dataObj.getJSONObject("customProperties"); - assertNotNull("customPropertiesObj was null", customPropertiesObj); - - JSONObject accentedPropertyObj = customPropertiesObj.getJSONObject(RecordsManagementCustomModel.RM_CUSTOM_PREFIX - + ":" + accentedPropId); - assertNotNull("accentedPropertyObj was null", accentedPropertyObj); - - String labelObj = accentedPropertyObj.getString("label"); - assertEquals("labelObj was changed.", originalAccentedLabel, labelObj); - } - - private void putCustomPropDefinition(String label, String id) throws JSONException, IOException, - UnsupportedEncodingException - { - String jsonString = new JSONStringer().object() - .key("label").value(label) - .endObject() - .toString(); - - String propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + id; - Response rsp = sendRequest(new PutRequest(propDefnUrl, - jsonString, APPLICATION_JSON), 200); - - String rspContent = rsp.getContentAsString(); -// System.out.println(rspContent); - - JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); - String urlOfNewPropDef = jsonRsp.getString("url"); - assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.Date; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionParams; +import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONStringer; +import org.json.JSONTokener; +import org.springframework.extensions.surf.util.ISO8601DateFormat; +import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * This class tests the Rest API for RM. + * + * @author Neil McErlean + */ +public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel +{ + protected static final String GET_NODE_AUDITLOG_URL_FORMAT = "/api/node/{0}/rmauditlog"; + protected static final String GET_TRANSFER_URL_FORMAT = "/api/node/{0}/transfers/{1}"; + protected static final String TRANSFER_REPORT_URL_FORMAT = "/api/node/{0}/transfers/{1}/report"; + protected static final String REF_INSTANCES_URL_FORMAT = "/api/node/{0}/customreferences"; + protected static final String RMA_AUDITLOG_URL = "/api/rma/admin/rmauditlog"; + protected static final String RMA_AUDITLOG_STATUS_URL = "/api/rma/admin/rmauditlog/status"; + protected static final String GET_LIST_URL = "/api/rma/admin/listofvalues"; + protected static final String RMA_ACTIONS_URL = "/api/rma/actions/ExecutionQueue"; + protected static final String APPLICATION_JSON = "application/json"; + protected static final String RMA_CUSTOM_PROPS_DEFINITIONS_URL = "/api/rma/admin/custompropertydefinitions"; + protected static final String RMA_CUSTOM_REFS_DEFINITIONS_URL = "/api/rma/admin/customreferencedefinitions"; + + private static final String BI_DI = "BiDi"; + private static final String CHILD_SRC = "childSrc"; + private static final String CHILD_TGT = "childTgt"; + + /** + * This test method ensures that a POST of an RM action to a non-existent node + * will result in a 404 status. + * + * @throws Exception + */ + public void testPostActionToNonExistentNode() throws Exception + { + NodeRef nonExistentNode = new NodeRef("workspace://SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"); + + // Construct the JSON request. + JSONObject jsonPostData = new JSONObject(); + jsonPostData.put("nodeRef", nonExistentNode.toString()); + // Although the request specifies a 'reviewed' action, it does not matter what + // action is specified here, as the non-existent Node should trigger a 404 + // before the action is executed. + jsonPostData.put("name", "reviewed"); + + // Submit the JSON request. + String jsonPostString = jsonPostData.toString(); + + final int expectedStatus = 404; + sendRequest(new PostRequest(RMA_ACTIONS_URL, jsonPostString, APPLICATION_JSON), expectedStatus); + } + + public void testPostReviewedAction() throws IOException, JSONException + { + NodeRef testRecord = utils.createRecord(recordFolder, "test.txt"); + + // In this test, this property has a date-value equal to the model import time. + Serializable pristineReviewAsOf = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); + + // Construct the JSON request for 'reviewed'. + String jsonString = new JSONStringer().object() + .key("name").value("reviewed") + .key("nodeRef").value(testRecord.toString()) + // These JSON params are just to test the submission of params. They'll be ignored. + .key("params").object() + .key("param1").value("one") + .key("param2").value("two") + .endObject() + .endObject() + .toString(); + + // Submit the JSON request. + final int expectedStatus = 200; + Response rsp = sendRequest(new PostRequest(RMA_ACTIONS_URL, + jsonString, APPLICATION_JSON), expectedStatus); + + String rspContent = rsp.getContentAsString(); + assertTrue(rspContent.contains("Successfully queued action [reviewed]")); + + Serializable newReviewAsOfDate = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); + assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf, + pristineReviewAsOf.equals(newReviewAsOfDate)); + } + + public void testPostMultiReviewedAction() throws IOException, JSONException + { + NodeRef testRecord = utils.createRecord(recordFolder, "test1.txt"); + NodeRef testRecord2 = utils.createRecord(recordFolder, "test2.txt"); + NodeRef testRecord3 = utils.createRecord(recordFolder, "test3.txt"); + + // In this test, this property has a date-value equal to the model import time. + Serializable pristineReviewAsOf = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); + Serializable pristineReviewAsOf2 = this.nodeService.getProperty(testRecord2, PROP_REVIEW_AS_OF); + Serializable pristineReviewAsOf3 = this.nodeService.getProperty(testRecord3, PROP_REVIEW_AS_OF); + + // Construct the JSON request for 'reviewed'. + String jsonString = new JSONStringer().object() + .key("name").value("reviewed") + .key("nodeRefs").array() + .value(testRecord.toString()) + .value(testRecord2.toString()) + .value(testRecord3.toString()) + .endArray() + // These JSON params are just to test the submission of params. They'll be ignored. + .key("params").object() + .key("param1").value("one") + .key("param2").value("two") + .endObject() + .endObject() + .toString(); + + // Submit the JSON request. + final int expectedStatus = 200; + Response rsp = sendRequest(new PostRequest(RMA_ACTIONS_URL, + jsonString, APPLICATION_JSON), expectedStatus); + + String rspContent = rsp.getContentAsString(); + assertTrue(rspContent.contains("Successfully queued action [reviewed]")); + + Serializable newReviewAsOfDate = this.nodeService.getProperty(testRecord, PROP_REVIEW_AS_OF); + assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf, + pristineReviewAsOf.equals(newReviewAsOfDate)); + Serializable newReviewAsOfDate2 = this.nodeService.getProperty(testRecord2, PROP_REVIEW_AS_OF); + assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf2, + pristineReviewAsOf2.equals(newReviewAsOfDate2)); + Serializable newReviewAsOfDate3 = this.nodeService.getProperty(testRecord3, PROP_REVIEW_AS_OF); + assertFalse("The reviewAsOf property should have changed. Was " + pristineReviewAsOf3, + pristineReviewAsOf3.equals(newReviewAsOfDate3)); + } + + public void testActionParams() throws Exception + { + // Construct the JSON request for 'reviewed'. + String jsonString = new JSONStringer().object() + .key("name").value("testActionParams") + .key("nodeRef").array() + .value("nothing://nothing/nothing") + .endArray() + // These JSON params are just to test the submission of params. They'll be ignored. + .key("params").object() + .key(TestActionParams.PARAM_DATE).object() + .key("iso8601") + .value(ISO8601DateFormat.format(new Date())) + .endObject() + .endObject() + .endObject() + .toString(); + + // Submit the JSON request. + final int expectedStatus = 200; + //TODO Currently failing unit test. + sendRequest(new PostRequest(RMA_ACTIONS_URL, + jsonString, APPLICATION_JSON), expectedStatus); + } + + public void testPostCustomReferenceDefinitions() throws IOException, JSONException + { + postCustomReferenceDefinitions(); + } + + /** + * This method creates a child and a non-child reference and returns their generated ids. + * + * + * @return String[] with element 0 = refId of p/c ref, 1 = refId pf bidi. + */ + private String[] postCustomReferenceDefinitions() throws JSONException, IOException, + UnsupportedEncodingException { + String[] result = new String[2]; + + // 1. Child association. + String jsonString = new JSONStringer().object() + .key("referenceType").value(RelationshipType.PARENTCHILD) + .key("source").value(CHILD_SRC) + .key("target").value(CHILD_TGT) + .endObject() + .toString(); + +// System.out.println(jsonString); + + // Submit the JSON request. + final int expectedStatus = 200; + Response rsp = sendRequest(new PostRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL, + jsonString, APPLICATION_JSON), expectedStatus); + + String rspContent = rsp.getContentAsString(); + assertTrue(rspContent.contains("success")); + +// System.out.println(rspContent); + + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + String generatedChildRefId = jsonRsp.getJSONObject("data").getString("refId"); + result[0] = generatedChildRefId; + + // 2. Non-child or standard association. + jsonString = new JSONStringer().object() + .key("referenceType").value(RelationshipType.BIDIRECTIONAL) + .key("label").value(BI_DI) + .endObject() + .toString(); + +// System.out.println(jsonString); + + // Submit the JSON request. + rsp = sendRequest(new PostRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL, + jsonString, APPLICATION_JSON), expectedStatus); + + rspContent = rsp.getContentAsString(); + assertTrue(rspContent.contains("success")); + +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + String generatedBidiRefId = jsonRsp.getJSONObject("data").getString("refId"); + result[1] = generatedBidiRefId; + + // Now assert that both have appeared in the data dictionary. + AspectDefinition customAssocsAspect = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); + assertNotNull("Missing customAssocs aspect", customAssocsAspect); + + QName newRefQname = adminService.getQNameForClientId(generatedChildRefId); + Map associations = customAssocsAspect.getAssociations(); + assertTrue("Custom child assoc not returned by dataDictionary.", associations.containsKey(newRefQname)); + + newRefQname = adminService.getQNameForClientId(generatedBidiRefId); + assertTrue("Custom std assoc not returned by dataDictionary.", customAssocsAspect.getAssociations().containsKey(newRefQname)); + + return result; + } + + public void testPutCustomPropertyDefinition() throws Exception + { + // POST to create a property definition with a known propId + final String propertyLabel = "Original label åçîéøü"; + String propId = postCustomPropertyDefinition(propertyLabel, null); + + // PUT an updated label. + final String updatedLabel = "Updated label πø^¨¥†®"; + String jsonString = new JSONStringer().object() + .key("label").value(updatedLabel) + .endObject() + .toString(); + + String propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; + Response rsp = sendRequest(new PutRequest(propDefnUrl, + jsonString, APPLICATION_JSON), 200); + + // GET from the URL again to ensure it's valid + rsp = sendRequest(new GetRequest(propDefnUrl), 200); + String rspContent = rsp.getContentAsString(); + +// System.out.println(rspContent); + + // PUT an updated constraint ref. + final String updatedConstraint = "rmc:tlList"; + jsonString = new JSONStringer().object() + .key("constraintRef").value(updatedConstraint) + .endObject() + .toString(); + + propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; + rsp = sendRequest(new PutRequest(propDefnUrl, + jsonString, APPLICATION_JSON), 200); + + rspContent = rsp.getContentAsString(); + + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + String urlOfNewPropDef = jsonRsp.getString("url"); + assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); + + // GET from the URL again to ensure it's valid + rsp = sendRequest(new GetRequest(propDefnUrl), 200); + rspContent = rsp.getContentAsString(); + +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + JSONObject dataObject = jsonRsp.getJSONObject("data"); + assertNotNull("JSON data object was null", dataObject); + JSONObject customPropsObject = dataObject.getJSONObject("customProperties"); + assertNotNull("JSON customProperties object was null", customPropsObject); + assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); + + Object keyToSoleProp = customPropsObject.keys().next(); + + JSONObject newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); + assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); + JSONArray constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); + assertEquals("ConstraintRefsArray wrong length.", 1, constraintRefsArray.length()); + String retrievedUpdatedTitle = constraintRefsArray.getJSONObject(0).getString("name"); + assertEquals("Constraints had wrong name.", "rmc:tlList", retrievedUpdatedTitle); + + // PUT again to remove all constraints + jsonString = new JSONStringer().object() + .key("constraintRef").value(null) + .endObject() + .toString(); + + rsp = sendRequest(new PutRequest(propDefnUrl, + jsonString, APPLICATION_JSON), 200); + + rspContent = rsp.getContentAsString(); +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + + // GET from the URL again to ensure it's valid + rsp = sendRequest(new GetRequest(propDefnUrl), 200); + rspContent = rsp.getContentAsString(); + +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + dataObject = jsonRsp.getJSONObject("data"); + assertNotNull("JSON data object was null", dataObject); + customPropsObject = dataObject.getJSONObject("customProperties"); + assertNotNull("JSON customProperties object was null", customPropsObject); + assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); + + keyToSoleProp = customPropsObject.keys().next(); + + newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); + assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); + constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); + assertEquals("ConstraintRefsArray wrong length.", 0, constraintRefsArray.length()); + + // Finally PUT a constraint on a PropertyDefn that has been cleared of constraints. + // This was raised as an issue + final String readdedConstraint = "rmc:tlList"; + jsonString = new JSONStringer().object() + .key("constraintRef").value(readdedConstraint) + .endObject() + .toString(); + + propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + propId; + rsp = sendRequest(new PutRequest(propDefnUrl, + jsonString, APPLICATION_JSON), 200); + + rspContent = rsp.getContentAsString(); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); +// System.out.println("PUTting a constraint back again."); +// System.out.println(rspContent); + + // And GET from the URL again + rsp = sendRequest(new GetRequest(propDefnUrl), 200); + rspContent = rsp.getContentAsString(); + +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + dataObject = jsonRsp.getJSONObject("data"); + assertNotNull("JSON data object was null", dataObject); + customPropsObject = dataObject.getJSONObject("customProperties"); + assertNotNull("JSON customProperties object was null", customPropsObject); + assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); + + keyToSoleProp = customPropsObject.keys().next(); + + newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); + assertEquals("Wrong property label.", updatedLabel, newPropObject.getString("label")); + constraintRefsArray = newPropObject.getJSONArray("constraintRefs"); + assertEquals("ConstraintRefsArray wrong length.", 1, constraintRefsArray.length()); + String readdedUpdatedTitle = constraintRefsArray.getJSONObject(0).getString("name"); + assertEquals("Constraints had wrong name.", "rmc:tlList", readdedUpdatedTitle); + } + + public void testGetCustomReferences() throws IOException, JSONException + { + // Ensure that there is at least one custom reference. + postCustomReferenceDefinitions(); + + // GET all custom reference definitions + final int expectedStatus = 200; + Response rsp = sendRequest(new GetRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL), expectedStatus); + + JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + + JSONObject dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + + JSONArray customRefsObj = (JSONArray)dataObj.get("customReferences"); + assertNotNull("JSON 'customReferences' object was null", customRefsObj); + + assertTrue("There should be at least two custom references. Found " + customRefsObj, customRefsObj.length() >= 2); + + // GET a specific custom reference definition. + // Here, we're using one of the built-in references + // qname = rmc:versions + rsp = sendRequest(new GetRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL + "/" + CUSTOM_REF_VERSIONS.getLocalName()), expectedStatus); + + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + + dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + + customRefsObj = (JSONArray)dataObj.get("customReferences"); + assertNotNull("JSON 'customProperties' object was null", customRefsObj); + + assertTrue("There should be exactly 1 custom references. Found " + customRefsObj.length(), customRefsObj.length() == 1); + } + + public void testGetDodCustomTypes() throws IOException, JSONException + { + final int expectedStatus = 200; + Response rsp = sendRequest(new GetRequest("/api/rma/admin/dodcustomtypes"), expectedStatus); + + String rspContent = rsp.getContentAsString(); + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + + // System.out.println(rspContent); + + JSONObject dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + + JSONArray customTypesObj = (JSONArray)dataObj.get("dodCustomTypes"); + assertNotNull("JSON 'dodCustomTypes' object was null", customTypesObj); + + assertEquals("Wrong DOD custom types count.", 4, customTypesObj.length()); + } + + public void testGetPostAndRemoveCustomReferenceInstances() throws Exception + { + NodeRef testRecord1 = utils.createRecord(recordFolder, "testRecord1" + System.currentTimeMillis(), "The from recørd"); + NodeRef testRecord2 = utils.createRecord(recordFolder, "testRecord2" + System.currentTimeMillis(), "The to récord"); + + String node1Url = testRecord1.toString().replace("://", "/"); + String refInstancesRecord1Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node1Url); + + // Create reference types. + String[] generatedRefIds = postCustomReferenceDefinitions(); + + // Add a standard ref + String jsonString = new JSONStringer().object() + .key("toNode").value(testRecord2.toString()) + .key("refId").value(generatedRefIds[1]) + .endObject() + .toString(); + + Response rsp = sendRequest(new PostRequest(refInstancesRecord1Url, + jsonString, APPLICATION_JSON), 200); + + // Add a child ref + jsonString = new JSONStringer().object() + .key("toNode").value(testRecord2.toString()) + .key("refId").value(generatedRefIds[0]) + .endObject() + .toString(); + +// System.out.println(jsonString); + + rsp = sendRequest(new PostRequest(refInstancesRecord1Url, + jsonString, APPLICATION_JSON), 200); + +// System.out.println(rsp.getContentAsString()); + + // Now retrieve the applied references from the REST API + // 1. references on the 'from' record. + rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); + + String contentAsString = rsp.getContentAsString(); +// System.out.println(contentAsString); + + JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); + + JSONObject dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + + JSONArray customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); + assertNotNull("JSON 'customReferencesFrom' object was null", customRefsFromArray); + + int customRefsCount = customRefsFromArray.length(); + assertTrue("There should be at least one custom reference. Found " + customRefsFromArray, customRefsCount > 0); + + JSONArray customRefsToArray = (JSONArray)dataObj.get("customReferencesTo"); + assertNotNull("JSON 'customReferencesTo' object was null", customRefsToArray); + assertEquals("customReferencesTo wrong length.", 0, customRefsToArray.length()); + + // 2. Back-references on the 'to' record + String node2Url = testRecord2.toString().replace("://", "/"); + String refInstancesRecord2Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node2Url); + + rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); + + contentAsString = rsp.getContentAsString(); + + jsonRsp = new JSONObject(new JSONTokener(contentAsString)); + + dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + + customRefsToArray = (JSONArray)dataObj.get("customReferencesTo"); + assertNotNull("JSON 'customReferencesTo' object was null", customRefsToArray); + + customRefsCount = customRefsToArray.length(); + assertTrue("There should be at least one custom reference. Found " + customRefsToArray, customRefsCount > 0); + + customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); + assertNotNull("JSON 'customReferencesFrom' object was null", customRefsFromArray); + assertEquals("customReferencesFrom wrong length.", 0, customRefsFromArray.length()); + + + + // Now to delete a reference instance of each type + String protocol = testRecord2.getStoreRef().getProtocol(); + String identifier = testRecord2.getStoreRef().getIdentifier(); + String recId = testRecord2.getId(); + final String queryFormat = "?st={0}&si={1}&id={2}"; + String urlQueryString = MessageFormat.format(queryFormat, protocol, identifier, recId); + + rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" + generatedRefIds[1] + urlQueryString), 200); + assertTrue(rsp.getContentAsString().contains("success")); + + rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" + + generatedRefIds[0] + + urlQueryString), 200); + assertTrue(rsp.getContentAsString().contains("success")); + + // Get the reference instances back and confirm they've been removed. + rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); + + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + + dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + + customRefsFromArray = (JSONArray)dataObj.get("customReferencesFrom"); + assertNotNull("JSON 'customReferences' object was null", customRefsFromArray); + assertTrue("customRefsArray was unexpectedly not empty.", customRefsFromArray.length() == 0); + } + + public void testMob1630ShouldNotBeAbleToCreateTwoSupersedesReferencesOnOneRecordPair() throws Exception + { + // Create 2 test records. + NodeRef testRecord1 = utils.createRecord(recordFolder, "testRecord1" + System.currentTimeMillis(), "The from recørd"); + NodeRef testRecord2 = utils.createRecord(recordFolder, "testRecord2" + System.currentTimeMillis(), "The to récord"); + + String node1Url = testRecord1.toString().replace("://", "/"); + String node2Url = testRecord2.toString().replace("://", "/"); + String refInstancesRecord1Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node1Url); + String refInstancesRecord2Url = MessageFormat.format(REF_INSTANCES_URL_FORMAT, node2Url); + + {// Sanity check. There should be no references defined on these new records. + Response rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); + + String rspContent = rsp.getContentAsString(); + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + JSONObject dataObj = jsonRsp.getJSONObject("data"); + JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); + JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); + assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); + assertEquals("Incorrect to-refs count.", 0, refsTo.length()); + } + + // Add a supersedes ref instance between them + final String supersedesRefLocalName = CUSTOM_REF_SUPERSEDES.getLocalName(); + String jsonString = new JSONStringer().object() + .key("toNode").value(testRecord2.toString()) + .key("refId").value(supersedesRefLocalName) + .endObject() + .toString(); + + Response rsp = sendRequest(new PostRequest(refInstancesRecord1Url, + jsonString, APPLICATION_JSON), 200); + + // The bug is that we can apply two such references which should not be allowed + rsp = sendRequest(new PostRequest(refInstancesRecord1Url, + jsonString, APPLICATION_JSON), 500); + + {// Retrieve reference instances on this pair of records. + // The first record + rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); + + String rspContent = rsp.getContentAsString(); + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + JSONObject dataObj = jsonRsp.getJSONObject("data"); + JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); + JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); + assertEquals("Incorrect from-refs count.", 1, refsFrom.length()); + assertEquals("Incorrect to-refs count.", 0, refsTo.length()); + + // The second record - the back-reference + rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); + + rspContent = rsp.getContentAsString(); + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + dataObj = jsonRsp.getJSONObject("data"); + refsFrom = dataObj.getJSONArray("customReferencesFrom"); + refsTo = dataObj.getJSONArray("customReferencesTo"); + assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); + assertEquals("Incorrect to-refs count.", 1, refsTo.length()); + } + + // Delete the reference instance + String protocol = testRecord2.getStoreRef().getProtocol(); + String identifier = testRecord2.getStoreRef().getIdentifier(); + String recId = testRecord2.getId(); + final String queryFormat = "?st={0}&si={1}&id={2}"; + String urlQueryString = MessageFormat.format(queryFormat, protocol, identifier, recId); + + rsp = sendRequest(new DeleteRequest(refInstancesRecord1Url + "/" + supersedesRefLocalName + urlQueryString), 200); + assertTrue(rsp.getContentAsString().contains("success")); + + {// Retrieve reference instances on this pair of records. + // The first record + rsp = sendRequest(new GetRequest(refInstancesRecord1Url), 200); + + String rspContent = rsp.getContentAsString(); + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + JSONObject dataObj = jsonRsp.getJSONObject("data"); + JSONArray refsFrom = dataObj.getJSONArray("customReferencesFrom"); + JSONArray refsTo = dataObj.getJSONArray("customReferencesTo"); + assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); + assertEquals("Incorrect to-refs count.", 0, refsTo.length()); + + // The second record - the back-reference + rsp = sendRequest(new GetRequest(refInstancesRecord2Url), 200); + + rspContent = rsp.getContentAsString(); + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + dataObj = jsonRsp.getJSONObject("data"); + refsFrom = dataObj.getJSONArray("customReferencesFrom"); + refsTo = dataObj.getJSONArray("customReferencesTo"); + assertEquals("Incorrect from-refs count.", 0, refsFrom.length()); + assertEquals("Incorrect to-refs count.", 0, refsTo.length()); + } + } + + public void testPostCustomPropertyDefinition() throws Exception + { + long currentTimeMillis = System.currentTimeMillis(); + + // Create one with no propId - it'll get generated. + postCustomPropertyDefinition("customProperty" + currentTimeMillis, null); + + // Create another with an explicit propId. + postCustomPropertyDefinition("customProperty" + currentTimeMillis, "prop" + currentTimeMillis); + } + + /** + * Creates a new property definition using a POST call. + * GETs the resultant property definition. + * + * @param propertyLabel the label to use + * @param propId the propId to use - null to have one generated. + * @return the propId of the new property definition + */ + private String postCustomPropertyDefinition(String propertyLabel, String propId) throws JSONException, + IOException, UnsupportedEncodingException + { + String jsonString; + if (propId == null) + { + jsonString = new JSONStringer().object() + .key("label").value(propertyLabel) + .key("description").value("Dynamically defined test property") + .key("mandatory").value(false) + .key("dataType").value("d:text") + .key("element").value("record") + .key("constraintRef").value("rmc:smList") + // Note no propId + .endObject() + .toString(); + } + else + { + jsonString = new JSONStringer().object() + .key("label").value(propertyLabel) + .key("description").value("Dynamically defined test property") + .key("mandatory").value(false) + .key("dataType").value("d:text") + .key("element").value("record") + .key("constraintRef").value("rmc:smList") + .key("propId").value(propId) + .endObject() + .toString(); + } + + // Submit the JSON request. + final int expectedStatus = 200; + Response rsp = sendRequest(new PostRequest("/api/rma/admin/custompropertydefinitions?element=record", + jsonString, APPLICATION_JSON), expectedStatus); + + String rspContent = rsp.getContentAsString(); + +// System.out.println(rspContent); + + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + String urlOfNewPropDef = jsonRsp.getString("url"); + String newPropId = jsonRsp.getString("propId"); + + assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); + + // GET from the URL we're given to ensure it's valid + rsp = sendRequest(new GetRequest(urlOfNewPropDef), 200); + rspContent = rsp.getContentAsString(); + +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + JSONObject dataObject = jsonRsp.getJSONObject("data"); + assertNotNull("JSON data object was null", dataObject); + JSONObject customPropsObject = dataObject.getJSONObject("customProperties"); + assertNotNull("JSON customProperties object was null", customPropsObject); + assertEquals("Wrong customProperties length.", 1, customPropsObject.length()); + + Object keyToSoleProp = customPropsObject.keys().next(); + +// System.out.println("New property defn: " + keyToSoleProp); + + JSONObject newPropObject = customPropsObject.getJSONObject((String)keyToSoleProp); + assertEquals("Wrong property label.", propertyLabel, newPropObject.getString("label")); + + return newPropId; + } + + public void testPutCustomReferenceDefinition() throws Exception + { + String[] generatedRefIds = postCustomReferenceDefinitions(); + final String pcRefId = generatedRefIds[0]; + final String bidiRefId = generatedRefIds[1]; + + // GET the custom refs in order to retrieve the label/source/target + String refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + bidiRefId; + Response rsp = sendRequest(new GetRequest(refDefnUrl), 200); + + String rspContent = rsp.getContentAsString(); +// System.out.println(rspContent); + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + + refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; + rsp = sendRequest(new GetRequest(refDefnUrl), 200); + + rspContent = rsp.getContentAsString(); +// System.out.println(rspContent); + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + + // Update the bidirectional reference. + final String updatedBiDiLabel = "Updated label üøéîçå"; + String jsonString = new JSONStringer().object() + .key("label").value(updatedBiDiLabel) + .endObject() + .toString(); + + refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + bidiRefId; + rsp = sendRequest(new PutRequest(refDefnUrl, + jsonString, APPLICATION_JSON), 200); + + rspContent = rsp.getContentAsString(); +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + String urlOfNewRefDef = jsonRsp.getString("url"); + assertNotNull("urlOfNewRefDef was null.", urlOfNewRefDef); + + // GET the bidi reference to ensure it's valid + rsp = sendRequest(new GetRequest(refDefnUrl), 200); + rspContent = rsp.getContentAsString(); + +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + JSONObject dataObject = jsonRsp.getJSONObject("data"); + assertNotNull("JSON data object was null", dataObject); + JSONArray customRefsObject = dataObject.getJSONArray("customReferences"); + assertNotNull("JSON customReferences object was null", customRefsObject); + assertEquals("Wrong customReferences length.", 1, customRefsObject.length()); + + JSONObject newRefObject = customRefsObject.getJSONObject(0); + assertEquals("Wrong property label.", updatedBiDiLabel, newRefObject.getString("label")); + + // Update the parent/child reference. + final String updatedPcSource = "Updated source ∆Ωç√∫"; + final String updatedPcTarget = "Updated target ∆Ωç√∫"; + jsonString = new JSONStringer().object() + .key("source").value(updatedPcSource) + .key("target").value(updatedPcTarget) + .endObject() + .toString(); + + refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; + rsp = sendRequest(new PutRequest(refDefnUrl, + jsonString, APPLICATION_JSON), 200); + + rspContent = rsp.getContentAsString(); +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + urlOfNewRefDef = jsonRsp.getString("url"); + assertNotNull("urlOfNewRefDef was null.", urlOfNewRefDef); + + // GET the parent/child reference to ensure it's valid + refDefnUrl = "/api/rma/admin/customreferencedefinitions/" + pcRefId; + + rsp = sendRequest(new GetRequest(refDefnUrl), 200); + rspContent = rsp.getContentAsString(); + +// System.out.println(rspContent); + + jsonRsp = new JSONObject(new JSONTokener(rspContent)); + dataObject = jsonRsp.getJSONObject("data"); + assertNotNull("JSON data object was null", dataObject); + customRefsObject = dataObject.getJSONArray("customReferences"); + assertNotNull("JSON customReferences object was null", customRefsObject); + assertEquals("Wrong customReferences length.", 1, customRefsObject.length()); + + newRefObject = customRefsObject.getJSONObject(0); + assertEquals("Wrong reference source.", updatedPcSource, newRefObject.getString("source")); + assertEquals("Wrong reference target.", updatedPcTarget, newRefObject.getString("target")); + } + + public void testGetCustomProperties() throws Exception + { + getCustomProperties(); + } + + private String getCustomProperties() throws Exception, IOException, + UnsupportedEncodingException, JSONException + { + // Ensure that there is at least one custom property. + this.testPostCustomPropertyDefinition(); + + final int expectedStatus = 200; + Response rsp = sendRequest(new GetRequest("/api/rma/admin/custompropertydefinitions?element=record"), expectedStatus); + + String contentAsString = rsp.getContentAsString(); +// System.out.println(contentAsString); + JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); + + JSONObject dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + + JSONObject customPropsObj = (JSONObject)dataObj.get("customProperties"); + assertNotNull("JSON 'customProperties' object was null", customPropsObj); + + final int customPropsCount = customPropsObj.length(); + assertTrue("There should be at least one custom property. Found " + customPropsObj, customPropsCount > 0); + + return contentAsString; + } + + public void testGetRecordMetaDataAspects() throws Exception + { + Response rsp = sendRequest(new GetRequest("/api/rma/recordmetadataaspects"), 200); + String contentAsString = rsp.getContentAsString(); + System.out.println(contentAsString); + JSONObject jsonRsp = new JSONObject(new JSONTokener(contentAsString)); + + JSONObject dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + + JSONArray aspects = dataObj.getJSONArray("recordMetaDataAspects"); + assertNotNull(aspects); + assertEquals(4, aspects.length()); + + // TODO test the items themselves + } + + public void testExport() throws Exception + { + String exportUrl = "/api/rma/admin/export"; + + // define JSON POST body + JSONObject jsonPostData = new JSONObject(); + JSONArray nodeRefs = new JSONArray(); + nodeRefs.put(recordFolder.toString()); + nodeRefs.put(recordFolder2.toString()); + jsonPostData.put("nodeRefs", nodeRefs); + String jsonPostString = jsonPostData.toString(); + + // make the export request + Response rsp = sendRequest(new PostRequest(exportUrl, jsonPostString, APPLICATION_JSON), 200); + assertEquals("application/acp", rsp.getContentType()); + } + + public void testExportInTransferFormat() throws Exception + { + String exportUrl = "/api/rma/admin/export"; + + // define JSON POST body + JSONObject jsonPostData = new JSONObject(); + JSONArray nodeRefs = new JSONArray(); + nodeRefs.put(recordFolder.toString()); + nodeRefs.put(recordFolder2.toString()); + jsonPostData.put("nodeRefs", nodeRefs); + jsonPostData.put("transferFormat", true); + String jsonPostString = jsonPostData.toString(); + + // make the export request + Response rsp = sendRequest(new PostRequest(exportUrl, jsonPostString, APPLICATION_JSON), 200); + assertEquals("application/zip", rsp.getContentType()); + } + + public void testAudit() throws Exception + { + // call the list service to get audit events + Response rsp = sendRequest(new GetRequest(GET_LIST_URL), 200); + //System.out.println("GET : " + rsp.getContentAsString()); + assertEquals("application/json;charset=UTF-8", rsp.getContentType()); + + // get response as JSON and check + JSONObject jsonParsedObject = new JSONObject(new JSONTokener(rsp.getContentAsString())); + assertNotNull(jsonParsedObject); + JSONObject data = jsonParsedObject.getJSONObject("data"); + JSONObject events = data.getJSONObject("auditEvents"); + JSONArray items = events.getJSONArray("items"); + assertEquals(auditService.getAuditEvents().size(), items.length()); + assertTrue(items.length() > 0); + JSONObject item = items.getJSONObject(0); + assertTrue(item.length() == 2); + assertTrue(item.has("label")); + assertTrue(item.has("value")); + + // get the full RM audit log and check response + rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL), 200); + assertEquals("application/json", rsp.getContentType()); + JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + + // get the full RM audit log as an HTML report and check response + rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL + "?format=html"), 200); + assertEquals("text/html", rsp.getContentType()); + + // export the full RM audit log and check response + rsp = sendRequest(new GetRequest(RMA_AUDITLOG_URL + "?export=true"), 200); + assertEquals("application/json", rsp.getContentType()); + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + + // construct the URL + String nodeUrl = recordCategory.toString().replace("://", "/"); + String auditUrl = MessageFormat.format(GET_NODE_AUDITLOG_URL_FORMAT, nodeUrl); + + // send request + rsp = sendRequest(new GetRequest(auditUrl), 200); + // check response + assertEquals("application/json", rsp.getContentType()); + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + + // get the audit log with all restrictions in place + String filteredAuditUrl = auditUrl + "?user=gavinc&size=5&from=2009-01-01&to=2009-12-31&event=Login"; + rsp = sendRequest(new GetRequest(filteredAuditUrl), 200); + // check response + assertEquals("application/json", rsp.getContentType()); + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + + // attempt to get the audit log with invalid restrictions in place + filteredAuditUrl = auditUrl + "?user=fred&size=abc&from=2009&to=2010&property=wrong"; + rsp = sendRequest(new GetRequest(filteredAuditUrl), 200); + assertEquals("application/json", rsp.getContentType()); + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + + checkAuditStatus(true); + + // start the RM audit log + JSONObject jsonPostData = new JSONObject(); + jsonPostData.put("enabled", true); + String jsonPostString = jsonPostData.toString(); + rsp = sendRequest(new PutRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); + + checkAuditStatus(true); + + // check the response + //System.out.println(rsp.getContentAsString()); + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + JSONObject dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + assertTrue(dataObj.getBoolean("enabled")); + assertTrue(dataObj.has("started")); + assertTrue(dataObj.has("stopped")); + + // stop the RM audit log + jsonPostData = new JSONObject(); + jsonPostData.put("enabled", false); + jsonPostString = jsonPostData.toString(); + rsp = sendRequest(new PutRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); + + checkAuditStatus(false); + + // check the response + //System.out.println(rsp.getContentAsString()); + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + assertFalse(dataObj.getBoolean("enabled")); + + // clear the RM audit log + rsp = sendRequest(new DeleteRequest(RMA_AUDITLOG_URL), 200); + //System.out.println(rsp.getContentAsString()); + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + dataObj = (JSONObject)jsonRsp.get("data"); + assertNotNull("JSON 'data' object was null", dataObj); + assertFalse(dataObj.getBoolean("enabled")); + } + + private void checkAuditStatus(boolean expected) throws Exception + { + Response rsp = sendRequest(new GetRequest(RMA_AUDITLOG_STATUS_URL), 200); + JSONObject rspObj = new JSONObject(rsp.getContentAsString()); + JSONObject data = rspObj.getJSONObject("data"); + boolean enabled = data.getBoolean("enabled"); + assertEquals("Audit log status does not match expected status.", expected, enabled); + + } + + public void testFileAuditLogAsRecord() throws Exception + { + // Attempt to store audit log at non existent destination, make sure we get 404 + JSONObject jsonPostData = new JSONObject(); + jsonPostData.put("destination", "workspace://SpacesStore/09ca1e02-1c87-4a53-97e7-xxxxxxxxxxxx"); + String jsonPostString = jsonPostData.toString(); + Response rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 404); + + // Attempt to store audit log at wrong type of destination, make sure we get 400 + jsonPostData = new JSONObject(); + jsonPostData.put("destination", recordCategory.toString()); + jsonPostString = jsonPostData.toString(); + rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 400); + + + // Store the full audit log as a record + jsonPostData = new JSONObject(); + jsonPostData.put("destination", recordFolder2); + jsonPostString = jsonPostData.toString(); + rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); + + // check the response + System.out.println(rsp.getContentAsString()); + JSONObject jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + assertTrue(jsonRsp.has("success")); + assertTrue(jsonRsp.getBoolean("success")); + assertTrue(jsonRsp.has("record")); + assertNotNull(jsonRsp.get("record")); + assertTrue(nodeService.exists(new NodeRef(jsonRsp.getString("record")))); + assertTrue(jsonRsp.has("recordName")); + assertNotNull(jsonRsp.get("recordName")); + assertTrue(jsonRsp.getString("recordName").startsWith("audit_")); + + // Store a filtered audit log as a record + jsonPostData = new JSONObject(); + jsonPostData.put("destination", recordFolder2); + jsonPostData.put("size", "50"); + jsonPostData.put("user", "gavinc"); + jsonPostData.put("event", "Update Metadata"); + jsonPostData.put("property", "{http://www.alfresco.org/model/content/1.0}modified"); + jsonPostString = jsonPostData.toString(); + rsp = sendRequest(new PostRequest(RMA_AUDITLOG_URL, jsonPostString, APPLICATION_JSON), 200); + + // check the response + System.out.println(rsp.getContentAsString()); + jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); + assertTrue(jsonRsp.has("success")); + assertTrue(jsonRsp.getBoolean("success")); + assertTrue(jsonRsp.has("record")); + assertNotNull(jsonRsp.get("record")); + assertTrue(nodeService.exists(new NodeRef(jsonRsp.getString("record")))); + assertTrue(jsonRsp.has("recordName")); + assertNotNull(jsonRsp.get("recordName")); + assertTrue(jsonRsp.getString("recordName").startsWith("audit_")); + } + + public void testPropertyLabelWithAccentedChars() throws Exception + { + final long number = System.currentTimeMillis(); + + // Create a property with a simple name + final String simplePropId = "simpleId" + number; + postCustomPropertyDefinition("simple", simplePropId); + + // Create a property whose name has accented chars + final String originalAccentedLabel = "øoê≈çœ"; + final String accentedPropId = "accentedId" + number; + postCustomPropertyDefinition(originalAccentedLabel, accentedPropId); + + // We'll update the label on the simple-name property a few times. + // This will cause the repeated read and write of the entire RM custom model xml file + // This should also leave the accented-char property unchanged. + putCustomPropDefinition("one", simplePropId); + putCustomPropDefinition("two", simplePropId); + putCustomPropDefinition("three", simplePropId); + putCustomPropDefinition("four", simplePropId); + putCustomPropDefinition("five", simplePropId); + + // Now get all the custom properties back. + String rspContent = getCustomProperties(); + + JSONObject rspObject = new JSONObject(new JSONTokener(rspContent)); + JSONObject dataObj = rspObject.getJSONObject("data"); + assertNotNull("jsonObject was null", dataObj); + + JSONObject customPropertiesObj = dataObj.getJSONObject("customProperties"); + assertNotNull("customPropertiesObj was null", customPropertiesObj); + + JSONObject accentedPropertyObj = customPropertiesObj.getJSONObject(RecordsManagementCustomModel.RM_CUSTOM_PREFIX + + ":" + accentedPropId); + assertNotNull("accentedPropertyObj was null", accentedPropertyObj); + + String labelObj = accentedPropertyObj.getString("label"); + assertEquals("labelObj was changed.", originalAccentedLabel, labelObj); + } + + private void putCustomPropDefinition(String label, String id) throws JSONException, IOException, + UnsupportedEncodingException + { + String jsonString = new JSONStringer().object() + .key("label").value(label) + .endObject() + .toString(); + + String propDefnUrl = "/api/rma/admin/custompropertydefinitions/" + id; + Response rsp = sendRequest(new PutRequest(propDefnUrl, + jsonString, APPLICATION_JSON), 200); + + String rspContent = rsp.getContentAsString(); +// System.out.println(rspContent); + + JSONObject jsonRsp = new JSONObject(new JSONTokener(rspContent)); + String urlOfNewPropDef = jsonRsp.getString("url"); + assertNotNull("urlOfNewPropDef was null.", urlOfNewPropDef); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RoleRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RoleRestApiTest.java index 4d5478a065..3bd9cf1baf 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RoleRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RoleRestApiTest.java @@ -1,376 +1,376 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.text.MessageFormat; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.util.GUID; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * This class tests the Rest API for disposition related operations - * - * @author Roy Wetherall - */ -public class RoleRestApiTest extends BaseRMWebScriptTestCase - implements RecordsManagementModel -{ - protected static final String GET_ROLES_URL_BY_SITE = "/api/rma/admin/{0}/rmroles"; - protected static final String GET_ROLES_URL_BY_FILEPLAN = "/api/rma/admin/{0}/{1}/{2}/rmroles"; - protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; - protected static final String APPLICATION_JSON = "application/json"; - - private String getRolesUrlBySite() - { - return MessageFormat.format(GET_ROLES_URL_BY_SITE, siteId); - } - - private String getRoleUrlByFilePlan() - { - return MessageFormat.format(GET_ROLES_URL_BY_FILEPLAN, filePlan.getStoreRef().getProtocol(), filePlan.getStoreRef().getIdentifier(), filePlan.getId()); - } - - public void testGetRoles() throws Exception - { - String role1 = GUID.generate(); - String role2 = GUID.generate(); - String role3 = GUID.generate(); - - // Create a couple or roles by hand - filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); - filePlanRoleService.createRole(filePlan, role2, "My Test Role Too", getListOfCapabilities(5)); - - //The user can either enter a plain text label or a key to look up in a property file. - filePlanRoleService.createRole(filePlan, role3, "System Administrator", getListOfCapabilities(5)); - - // create test group - String groupName = GUID.generate(); - String group = authorityService.createAuthority(AuthorityType.GROUP, groupName, "monkey", null); - - // Add the admin user to one of the roles - filePlanRoleService.assignRoleToAuthority(filePlan, role1, "admin"); - filePlanRoleService.assignRoleToAuthority(filePlan, role1, group); - - try - { - // Get the roles (for the default file plan) - Response rsp = sendRequest(new GetRequest(getRolesUrlBySite()),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject roles = obj.getJSONObject("data"); - assertNotNull(roles); - - JSONObject roleObj = roles.getJSONObject(role1); - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - roleObj = roles.getJSONObject(role2); - assertNotNull(roleObj); - assertEquals(role2, roleObj.get("name")); - assertEquals("My Test Role Too", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - //Custom role with a user entered message key - roleObj = roles.getJSONObject(role3); - assertNotNull(roleObj); - assertEquals(role3, roleObj.get("name")); - assertEquals("System Administrator", roleObj.get("displayLabel")); - - // Get the roles, specifying the file plan - rsp = sendRequest(new GetRequest(getRoleUrlByFilePlan()),200); - rspContent = rsp.getContentAsString(); - - obj = new JSONObject(rspContent); - roles = obj.getJSONObject("data"); - assertNotNull(roles); - - roleObj = roles.getJSONObject(role1); - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - roleObj = roles.getJSONObject(role2); - assertNotNull(roleObj); - assertEquals(role2, roleObj.get("name")); - assertEquals("My Test Role Too", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - // Get the roles for "admin" - rsp = sendRequest(new GetRequest(getRolesUrlBySite() + "?user=admin"),200); - rspContent = rsp.getContentAsString(); - - obj = new JSONObject(rspContent); - roles = obj.getJSONObject("data"); - assertNotNull(roles); - - roleObj = roles.getJSONObject(role1); - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - assertFalse(roles.has(role2)); - - // Get the roles including assigned authorities - rsp = sendRequest(new GetRequest(getRoleUrlByFilePlan() + "?auths=true"),200); - rspContent = rsp.getContentAsString(); - - System.out.println(rspContent); - - obj = new JSONObject(rspContent); - roles = obj.getJSONObject("data"); - assertNotNull(roles); - - roleObj = roles.getJSONObject(role1); - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - JSONArray users = roleObj.getJSONArray("assignedUsers"); - assertNotNull(users); - assertEquals(1, users.length()); - - JSONArray groups = roleObj.getJSONArray("assignedGroups"); - assertNotNull(groups); - assertEquals(1, groups.length()); - - roleObj = roles.getJSONObject(role2); - assertNotNull(roleObj); - assertEquals(role2, roleObj.get("name")); - assertEquals("My Test Role Too", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - users = roleObj.getJSONArray("assignedUsers"); - assertNotNull(users); - assertEquals(0, users.length()); - - groups = roleObj.getJSONArray("assignedGroups"); - assertNotNull(groups); - assertEquals(0, groups.length()); - } - finally - { - // Clean up - filePlanRoleService.deleteRole(filePlan, role1); - filePlanRoleService.deleteRole(filePlan, role2); - } - - } - - @SuppressWarnings("unchecked") - private void checkCapabilities(JSONObject role, int expectedCount) throws JSONException - { - JSONObject capabilities = role.getJSONObject("capabilities"); - assertNotNull(capabilities); - - int count = 0; - Iterator it = capabilities.keys(); - while (it.hasNext()) - { - String key = it.next(); - assertNotNull(key); - assertNotNull(capabilities.getString(key)); - count ++; - } - - assertEquals(expectedCount, count); - } - - public void testPostRoles() throws Exception - { - Set caps = getListOfCapabilities(5); - JSONArray arrCaps = new JSONArray(); - for (Capability cap : caps) - { - arrCaps.put(cap.getName()); - } - - String roleName = GUID.generate(); - - JSONObject obj = new JSONObject(); - obj.put("name", roleName); - obj.put("displayLabel", "Display Label"); - obj.put("capabilities", arrCaps); - - Response rsp = sendRequest(new PostRequest(getRolesUrlBySite(), obj.toString(), APPLICATION_JSON),200); - try - { - String rspContent = rsp.getContentAsString(); - - JSONObject resultObj = new JSONObject(rspContent); - JSONObject roleObj = resultObj.getJSONObject("data"); - assertNotNull(roleObj); - - assertNotNull(roleObj); - assertEquals(roleName, roleObj.get("name")); - assertEquals("Display Label", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - } - finally - { - filePlanRoleService.deleteRole(filePlan, roleName); - } - - } - - public void testPutRole() throws Exception - { - String role1 = GUID.generate(); - filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); - - try - { - Set caps = getListOfCapabilities(4,8); - JSONArray arrCaps = new JSONArray(); - for (Capability cap : caps) - { - System.out.println(cap.getName()); - arrCaps.put(cap.getName()); - } - - JSONObject obj = new JSONObject(); - obj.put("name", role1); - obj.put("displayLabel", "Changed"); - obj.put("capabilities", arrCaps); - - // Get the roles - Response rsp = sendRequest(new PutRequest(getRolesUrlBySite() + "/" + role1, obj.toString(), APPLICATION_JSON),200); - String rspContent = rsp.getContentAsString(); - - JSONObject result = new JSONObject(rspContent); - JSONObject roleObj = result.getJSONObject("data"); - assertNotNull(roleObj); - - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("Changed", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 4); - - // Bad requests - sendRequest(new PutRequest(getRolesUrlBySite() + "/cheese", obj.toString(), APPLICATION_JSON), 404); - } - finally - { - // Clean up - filePlanRoleService.deleteRole(filePlan, role1); - } - - } - - public void testGetRole() throws Exception - { - String role1 = GUID.generate(); - filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); - - try - { - // Get the roles - Response rsp = sendRequest(new GetRequest(getRolesUrlBySite() + "/" + role1),200); - String rspContent = rsp.getContentAsString(); - - JSONObject obj = new JSONObject(rspContent); - JSONObject roleObj = obj.getJSONObject("data"); - assertNotNull(roleObj); - - assertNotNull(roleObj); - assertEquals(role1, roleObj.get("name")); - assertEquals("My Test Role", roleObj.get("displayLabel")); - checkCapabilities(roleObj, 5); - - // Bad requests - sendRequest(new GetRequest(getRolesUrlBySite() + "/cheese"), 404); - } - finally - { - // Clean up - filePlanRoleService.deleteRole(filePlan, role1); - } - - } - - public void testDeleteRole() throws Exception - { - String role1 = GUID.generate(); - assertFalse(filePlanRoleService.existsRole(filePlan, role1)); - filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); - assertTrue(filePlanRoleService.existsRole(filePlan, role1)); - sendRequest(new DeleteRequest(getRolesUrlBySite() + "/" + role1),200); - assertFalse(filePlanRoleService.existsRole(filePlan, role1)); - - // Bad request - sendRequest(new DeleteRequest(getRolesUrlBySite() + "/cheese"), 404); - } - - private Set getListOfCapabilities(int size) - { - return getListOfCapabilities(size, 0); - } - - private Set getListOfCapabilities(int size, int offset) - { - Set result = new HashSet(size); - Set caps = capabilityService.getCapabilities(false); - int count = 0; - for (Capability cap : caps) - { - if (count < size+offset) - { - if (count >= offset) - { - result.add(cap); - } - } - else - { - break; - } - count ++; - } - return result; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.text.MessageFormat; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.util.GUID; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PostRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.PutRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * This class tests the Rest API for disposition related operations + * + * @author Roy Wetherall + */ +public class RoleRestApiTest extends BaseRMWebScriptTestCase + implements RecordsManagementModel +{ + protected static final String GET_ROLES_URL_BY_SITE = "/api/rma/admin/{0}/rmroles"; + protected static final String GET_ROLES_URL_BY_FILEPLAN = "/api/rma/admin/{0}/{1}/{2}/rmroles"; + protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; + protected static final String APPLICATION_JSON = "application/json"; + + private String getRolesUrlBySite() + { + return MessageFormat.format(GET_ROLES_URL_BY_SITE, siteId); + } + + private String getRoleUrlByFilePlan() + { + return MessageFormat.format(GET_ROLES_URL_BY_FILEPLAN, filePlan.getStoreRef().getProtocol(), filePlan.getStoreRef().getIdentifier(), filePlan.getId()); + } + + public void testGetRoles() throws Exception + { + String role1 = GUID.generate(); + String role2 = GUID.generate(); + String role3 = GUID.generate(); + + // Create a couple or roles by hand + filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); + filePlanRoleService.createRole(filePlan, role2, "My Test Role Too", getListOfCapabilities(5)); + + //The user can either enter a plain text label or a key to look up in a property file. + filePlanRoleService.createRole(filePlan, role3, "System Administrator", getListOfCapabilities(5)); + + // create test group + String groupName = GUID.generate(); + String group = authorityService.createAuthority(AuthorityType.GROUP, groupName, "monkey", null); + + // Add the admin user to one of the roles + filePlanRoleService.assignRoleToAuthority(filePlan, role1, "admin"); + filePlanRoleService.assignRoleToAuthority(filePlan, role1, group); + + try + { + // Get the roles (for the default file plan) + Response rsp = sendRequest(new GetRequest(getRolesUrlBySite()),200); + String rspContent = rsp.getContentAsString(); + + JSONObject obj = new JSONObject(rspContent); + JSONObject roles = obj.getJSONObject("data"); + assertNotNull(roles); + + JSONObject roleObj = roles.getJSONObject(role1); + assertNotNull(roleObj); + assertEquals(role1, roleObj.get("name")); + assertEquals("My Test Role", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + + roleObj = roles.getJSONObject(role2); + assertNotNull(roleObj); + assertEquals(role2, roleObj.get("name")); + assertEquals("My Test Role Too", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + + //Custom role with a user entered message key + roleObj = roles.getJSONObject(role3); + assertNotNull(roleObj); + assertEquals(role3, roleObj.get("name")); + assertEquals("System Administrator", roleObj.get("displayLabel")); + + // Get the roles, specifying the file plan + rsp = sendRequest(new GetRequest(getRoleUrlByFilePlan()),200); + rspContent = rsp.getContentAsString(); + + obj = new JSONObject(rspContent); + roles = obj.getJSONObject("data"); + assertNotNull(roles); + + roleObj = roles.getJSONObject(role1); + assertNotNull(roleObj); + assertEquals(role1, roleObj.get("name")); + assertEquals("My Test Role", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + + roleObj = roles.getJSONObject(role2); + assertNotNull(roleObj); + assertEquals(role2, roleObj.get("name")); + assertEquals("My Test Role Too", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + + // Get the roles for "admin" + rsp = sendRequest(new GetRequest(getRolesUrlBySite() + "?user=admin"),200); + rspContent = rsp.getContentAsString(); + + obj = new JSONObject(rspContent); + roles = obj.getJSONObject("data"); + assertNotNull(roles); + + roleObj = roles.getJSONObject(role1); + assertNotNull(roleObj); + assertEquals(role1, roleObj.get("name")); + assertEquals("My Test Role", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + + assertFalse(roles.has(role2)); + + // Get the roles including assigned authorities + rsp = sendRequest(new GetRequest(getRoleUrlByFilePlan() + "?auths=true"),200); + rspContent = rsp.getContentAsString(); + + System.out.println(rspContent); + + obj = new JSONObject(rspContent); + roles = obj.getJSONObject("data"); + assertNotNull(roles); + + roleObj = roles.getJSONObject(role1); + assertNotNull(roleObj); + assertEquals(role1, roleObj.get("name")); + assertEquals("My Test Role", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + + JSONArray users = roleObj.getJSONArray("assignedUsers"); + assertNotNull(users); + assertEquals(1, users.length()); + + JSONArray groups = roleObj.getJSONArray("assignedGroups"); + assertNotNull(groups); + assertEquals(1, groups.length()); + + roleObj = roles.getJSONObject(role2); + assertNotNull(roleObj); + assertEquals(role2, roleObj.get("name")); + assertEquals("My Test Role Too", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + + users = roleObj.getJSONArray("assignedUsers"); + assertNotNull(users); + assertEquals(0, users.length()); + + groups = roleObj.getJSONArray("assignedGroups"); + assertNotNull(groups); + assertEquals(0, groups.length()); + } + finally + { + // Clean up + filePlanRoleService.deleteRole(filePlan, role1); + filePlanRoleService.deleteRole(filePlan, role2); + } + + } + + @SuppressWarnings("unchecked") + private void checkCapabilities(JSONObject role, int expectedCount) throws JSONException + { + JSONObject capabilities = role.getJSONObject("capabilities"); + assertNotNull(capabilities); + + int count = 0; + Iterator it = capabilities.keys(); + while (it.hasNext()) + { + String key = it.next(); + assertNotNull(key); + assertNotNull(capabilities.getString(key)); + count ++; + } + + assertEquals(expectedCount, count); + } + + public void testPostRoles() throws Exception + { + Set caps = getListOfCapabilities(5); + JSONArray arrCaps = new JSONArray(); + for (Capability cap : caps) + { + arrCaps.put(cap.getName()); + } + + String roleName = GUID.generate(); + + JSONObject obj = new JSONObject(); + obj.put("name", roleName); + obj.put("displayLabel", "Display Label"); + obj.put("capabilities", arrCaps); + + Response rsp = sendRequest(new PostRequest(getRolesUrlBySite(), obj.toString(), APPLICATION_JSON),200); + try + { + String rspContent = rsp.getContentAsString(); + + JSONObject resultObj = new JSONObject(rspContent); + JSONObject roleObj = resultObj.getJSONObject("data"); + assertNotNull(roleObj); + + assertNotNull(roleObj); + assertEquals(roleName, roleObj.get("name")); + assertEquals("Display Label", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + } + finally + { + filePlanRoleService.deleteRole(filePlan, roleName); + } + + } + + public void testPutRole() throws Exception + { + String role1 = GUID.generate(); + filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); + + try + { + Set caps = getListOfCapabilities(4,8); + JSONArray arrCaps = new JSONArray(); + for (Capability cap : caps) + { + System.out.println(cap.getName()); + arrCaps.put(cap.getName()); + } + + JSONObject obj = new JSONObject(); + obj.put("name", role1); + obj.put("displayLabel", "Changed"); + obj.put("capabilities", arrCaps); + + // Get the roles + Response rsp = sendRequest(new PutRequest(getRolesUrlBySite() + "/" + role1, obj.toString(), APPLICATION_JSON),200); + String rspContent = rsp.getContentAsString(); + + JSONObject result = new JSONObject(rspContent); + JSONObject roleObj = result.getJSONObject("data"); + assertNotNull(roleObj); + + assertNotNull(roleObj); + assertEquals(role1, roleObj.get("name")); + assertEquals("Changed", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 4); + + // Bad requests + sendRequest(new PutRequest(getRolesUrlBySite() + "/cheese", obj.toString(), APPLICATION_JSON), 404); + } + finally + { + // Clean up + filePlanRoleService.deleteRole(filePlan, role1); + } + + } + + public void testGetRole() throws Exception + { + String role1 = GUID.generate(); + filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); + + try + { + // Get the roles + Response rsp = sendRequest(new GetRequest(getRolesUrlBySite() + "/" + role1),200); + String rspContent = rsp.getContentAsString(); + + JSONObject obj = new JSONObject(rspContent); + JSONObject roleObj = obj.getJSONObject("data"); + assertNotNull(roleObj); + + assertNotNull(roleObj); + assertEquals(role1, roleObj.get("name")); + assertEquals("My Test Role", roleObj.get("displayLabel")); + checkCapabilities(roleObj, 5); + + // Bad requests + sendRequest(new GetRequest(getRolesUrlBySite() + "/cheese"), 404); + } + finally + { + // Clean up + filePlanRoleService.deleteRole(filePlan, role1); + } + + } + + public void testDeleteRole() throws Exception + { + String role1 = GUID.generate(); + assertFalse(filePlanRoleService.existsRole(filePlan, role1)); + filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); + assertTrue(filePlanRoleService.existsRole(filePlan, role1)); + sendRequest(new DeleteRequest(getRolesUrlBySite() + "/" + role1),200); + assertFalse(filePlanRoleService.existsRole(filePlan, role1)); + + // Bad request + sendRequest(new DeleteRequest(getRolesUrlBySite() + "/cheese"), 404); + } + + private Set getListOfCapabilities(int size) + { + return getListOfCapabilities(size, 0); + } + + private Set getListOfCapabilities(int size, int offset) + { + Set result = new HashSet(size); + Set caps = capabilityService.getCapabilities(false); + int count = 0; + for (Capability cap : caps) + { + if (count < size+offset) + { + if (count >= offset) + { + result.add(cap); + } + } + else + { + break; + } + count ++; + } + return result; + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/SubstitutionSuggestionsRestApiTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/SubstitutionSuggestionsRestApiTest.java index 8ce677f4cf..bcbeb49545 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/SubstitutionSuggestionsRestApiTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/SubstitutionSuggestionsRestApiTest.java @@ -1,103 +1,103 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.legacy.webscript; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; - -/** - * REST API Tests for Action Definitions - * - * @author Mark Hibbins - * @since 2.2 - */ -public class SubstitutionSuggestionsRestApiTest extends BaseRMWebScriptTestCase -{ - /** URL for the REST APIs */ - private static final String RM_SUBSTITUTIONSUGGESTIONS_URL = "/api/rm/rm-substitutionsuggestions?fragment=month"; - - /** - * Test the REST API to retrieve the list of rm substitution suggestions - * - * @throws IOException - * @throws JSONException - */ - public void testRmGetSubstitutionSuggestions() throws IOException, JSONException - { - // Send request - Response response = sendRequest(new GetRequest(RM_SUBSTITUTIONSUGGESTIONS_URL), Status.STATUS_OK); - - // Check the content from the response - String contentAsString = response.getContentAsString(); - assertNotNull(contentAsString); - - // Convert the response to json and check the data - JSONObject contentAsJson = new JSONObject(contentAsString); - JSONArray data = contentAsJson.getJSONArray("substitutions"); - assertNotNull(data); - - // Get the list of rm action definitions from the response and check it - List substitutionDefinitions = getSubstitutionDefinitions(); - List rmSubstitutionDefinitions = new ArrayList(); - for (int i = 0; i < data.length(); i++) - { - String value = data.getString(i); - assertNotNull(value); - rmSubstitutionDefinitions.add(value); - } - assertTrue(rmSubstitutionDefinitions.containsAll(substitutionDefinitions)); - assertTrue(substitutionDefinitions.containsAll(rmSubstitutionDefinitions)); - } - - /** - * Returns a (sub)list of dm action definitions - * - * @return A (sub)list of dm action definitions - */ - private List getSubstitutionDefinitions() - { - return Arrays.asList(new String[] - { - "date.month.number", - "date.month.long", - "date.month.short", - "date.month", - "date.day.month", - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.legacy.webscript; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; +import org.springframework.extensions.webscripts.TestWebScriptServer.Response; + +/** + * REST API Tests for Action Definitions + * + * @author Mark Hibbins + * @since 2.2 + */ +public class SubstitutionSuggestionsRestApiTest extends BaseRMWebScriptTestCase +{ + /** URL for the REST APIs */ + private static final String RM_SUBSTITUTIONSUGGESTIONS_URL = "/api/rm/rm-substitutionsuggestions?fragment=month"; + + /** + * Test the REST API to retrieve the list of rm substitution suggestions + * + * @throws IOException + * @throws JSONException + */ + public void testRmGetSubstitutionSuggestions() throws IOException, JSONException + { + // Send request + Response response = sendRequest(new GetRequest(RM_SUBSTITUTIONSUGGESTIONS_URL), Status.STATUS_OK); + + // Check the content from the response + String contentAsString = response.getContentAsString(); + assertNotNull(contentAsString); + + // Convert the response to json and check the data + JSONObject contentAsJson = new JSONObject(contentAsString); + JSONArray data = contentAsJson.getJSONArray("substitutions"); + assertNotNull(data); + + // Get the list of rm action definitions from the response and check it + List substitutionDefinitions = getSubstitutionDefinitions(); + List rmSubstitutionDefinitions = new ArrayList(); + for (int i = 0; i < data.length(); i++) + { + String value = data.getString(i); + assertNotNull(value); + rmSubstitutionDefinitions.add(value); + } + assertTrue(rmSubstitutionDefinitions.containsAll(substitutionDefinitions)); + assertTrue(substitutionDefinitions.containsAll(rmSubstitutionDefinitions)); + } + + /** + * Returns a (sub)list of dm action definitions + * + * @return A (sub)list of dm action definitions + */ + private List getSubstitutionDefinitions() + { + return Arrays.asList(new String[] + { + "date.month.number", + "date.month.long", + "date.month.short", + "date.month", + "date.day.month", + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/DataLoadSystemTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/DataLoadSystemTest.java index f44581893c..1e1c120288 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/DataLoadSystemTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/DataLoadSystemTest.java @@ -1,338 +1,338 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.system; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteRole; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ApplicationContextHelper; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.extensions.webscripts.GUID; - -public class DataLoadSystemTest -{ - /** services */ - protected FilePlanService filePlanService; - protected RecordFolderService recordFolderService; - protected RecordService recordService; - protected TransactionService transactionService; - protected AuthorityService authorityService; - protected MutableAuthenticationService authenticationService; - protected PersonService personService; - protected FilePlanRoleService filePlanRoleService; - protected SiteService siteService; - protected FileFolderService fileFolderService; - - /** config locations */ - protected String[] getConfigLocations() - { - return new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:test-context.xml" - }; - } - - /** transaction batch size */ - private static final int BATCH_SIZE = 100; - - /** file plan sizing */ - private static final int ROOT_CATEGORY_COUNT = 0; - private static final int RECORD_FOLDER_COUNT = 0; - private static final int RECORD_COUNT = 0; - - /** rm user sizing */ - private static final int RM_GROUP_COUNT = 0; - private static final int RM_USER_COUNT = 0; - - /** inplace sizing */ - private static final int USER_COUNT = 0; - private static final int INPLACE_RECORD_COUNT = 5000; - - /** application context */ - private ApplicationContext applicationContext; - CommonRMTestUtils utils; - - private int totalCount; - private List recordCategories; - private List recordFolders; - private List groups; - - @Before - public void before() - { - applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); - utils = new CommonRMTestUtils(applicationContext); - - filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService"); - recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService"); - recordService = (RecordService)applicationContext.getBean("RecordService"); - transactionService = (TransactionService)applicationContext.getBean("transactionService"); - authorityService = (AuthorityService)applicationContext.getBean("authorityService"); - authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService"); - personService = (PersonService)applicationContext.getBean("personService"); - filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("filePlanRoleService"); - siteService = (SiteService)applicationContext.getBean("siteService"); - fileFolderService = (FileFolderService)applicationContext.getBean("fileFolderService"); - } - - @Test - public void loadAllData() - { - loadFilePlanData(); - loadRMUsersAndGroups(); - loadInPlace(); - } - - private void loadInPlace() - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - final SiteInfo site = siteService.getSite("test"); - if (site == null) - { - throw new AlfrescoRuntimeException("The collab site test is not present."); - } - - final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - Assert.fail("The default RM site is not present."); - } - - // create users and add to site - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - // create user - String userName = GUID.generate(); - System.out.println("Creating user " + userName); - createPerson(userName, true); - - // add to collab site - siteService.setMembership("test", userName, SiteRole.SiteCollaborator.toString()); - - return null; - } - }, USER_COUNT); - - // create content and declare as record - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - // create document - NodeRef docLib = siteService.getContainer(site.getShortName(), SiteService.DOCUMENT_LIBRARY); - NodeRef document = fileFolderService.create(docLib, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - recordService.createRecord(filePlan, document); - - return null; - } - }, INPLACE_RECORD_COUNT); - - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - - private void loadRMUsersAndGroups() - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - Assert.fail("The default RM site is not present."); - } - - groups = new ArrayList(); - - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - String groupName = GUID.generate(); - System.out.println("Creating group " + groupName); - groups.add("GROUP_" + authorityService.createAuthority(AuthorityType.GROUP, groupName)); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, groupName); - return null; - } - }, RM_GROUP_COUNT); - - for (final String group : groups) - { - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - String userName = GUID.generate(); - System.out.println("Creating user " + userName + " and adding to group " + group); - createPerson(userName, true); - authorityService.addAuthority(group, userName); - return null; - } - }, RM_USER_COUNT); - } - - return null; - } - }); - } - - private void loadFilePlanData() - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - Assert.fail("The default RM site is not present."); - } - - // create root categories - recordCategories = new ArrayList(ROOT_CATEGORY_COUNT); - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - recordCategories.add(filePlanService.createRecordCategory(filePlan, GUID.generate())); - return null; - } - }, ROOT_CATEGORY_COUNT); - - // create record folders - recordFolders = new ArrayList(RECORD_FOLDER_COUNT); - for (final NodeRef recordCategory : recordCategories) - { - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - recordFolders.add(recordFolderService.createRecordFolder(recordCategory, GUID.generate())); - return null; - } - }, RECORD_FOLDER_COUNT); - } - - // create records - for (final NodeRef recordFolder : recordFolders) - { - repeatInTransactionBatches(new RunAsWork() - { - public Void doWork() throws Exception - { - recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null); - return null; - } - }, RECORD_COUNT); - } - - - return null; - } - }); - } - - private NodeRef createPerson(String userName, boolean createAuth) - { - if (createAuth) - { - authenticationService.createAuthentication(userName, "password".toCharArray()); - } - Map properties = new HashMap(); - properties.put(ContentModel.PROP_USERNAME, userName); - return personService.createPerson(properties); - } - - private void repeatInTransactionBatches(final RunAsWork work, final int count) throws Exception - { - totalCount = 0; - while (totalCount < count) - { - transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() - { - public Void execute() throws Throwable - { - int batchSize = count - totalCount; - if (batchSize >= BATCH_SIZE) - { - batchSize = BATCH_SIZE; - } - - for (int i = 0; i < batchSize; i++) - { - // do it - work.doWork(); - totalCount++; - } - - System.out.println("Created " + totalCount + " of " + count); - - return null; - } - }, - false, true); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.system; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.MutableAuthenticationService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteRole; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.ApplicationContextHelper; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.extensions.webscripts.GUID; + +public class DataLoadSystemTest +{ + /** services */ + protected FilePlanService filePlanService; + protected RecordFolderService recordFolderService; + protected RecordService recordService; + protected TransactionService transactionService; + protected AuthorityService authorityService; + protected MutableAuthenticationService authenticationService; + protected PersonService personService; + protected FilePlanRoleService filePlanRoleService; + protected SiteService siteService; + protected FileFolderService fileFolderService; + + /** config locations */ + protected String[] getConfigLocations() + { + return new String[] + { + "classpath:alfresco/application-context.xml", + "classpath:test-context.xml" + }; + } + + /** transaction batch size */ + private static final int BATCH_SIZE = 100; + + /** file plan sizing */ + private static final int ROOT_CATEGORY_COUNT = 0; + private static final int RECORD_FOLDER_COUNT = 0; + private static final int RECORD_COUNT = 0; + + /** rm user sizing */ + private static final int RM_GROUP_COUNT = 0; + private static final int RM_USER_COUNT = 0; + + /** inplace sizing */ + private static final int USER_COUNT = 0; + private static final int INPLACE_RECORD_COUNT = 5000; + + /** application context */ + private ApplicationContext applicationContext; + CommonRMTestUtils utils; + + private int totalCount; + private List recordCategories; + private List recordFolders; + private List groups; + + @Before + public void before() + { + applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); + utils = new CommonRMTestUtils(applicationContext); + + filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService"); + recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService"); + recordService = (RecordService)applicationContext.getBean("RecordService"); + transactionService = (TransactionService)applicationContext.getBean("transactionService"); + authorityService = (AuthorityService)applicationContext.getBean("authorityService"); + authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService"); + personService = (PersonService)applicationContext.getBean("personService"); + filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("filePlanRoleService"); + siteService = (SiteService)applicationContext.getBean("siteService"); + fileFolderService = (FileFolderService)applicationContext.getBean("fileFolderService"); + } + + @Test + public void loadAllData() + { + loadFilePlanData(); + loadRMUsersAndGroups(); + loadInPlace(); + } + + private void loadInPlace() + { + AuthenticationUtil.runAs(new RunAsWork() + { + public Void doWork() throws Exception + { + final SiteInfo site = siteService.getSite("test"); + if (site == null) + { + throw new AlfrescoRuntimeException("The collab site test is not present."); + } + + final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (filePlan == null) + { + Assert.fail("The default RM site is not present."); + } + + // create users and add to site + repeatInTransactionBatches(new RunAsWork() + { + public Void doWork() throws Exception + { + // create user + String userName = GUID.generate(); + System.out.println("Creating user " + userName); + createPerson(userName, true); + + // add to collab site + siteService.setMembership("test", userName, SiteRole.SiteCollaborator.toString()); + + return null; + } + }, USER_COUNT); + + // create content and declare as record + repeatInTransactionBatches(new RunAsWork() + { + public Void doWork() throws Exception + { + // create document + NodeRef docLib = siteService.getContainer(site.getShortName(), SiteService.DOCUMENT_LIBRARY); + NodeRef document = fileFolderService.create(docLib, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + + recordService.createRecord(filePlan, document); + + return null; + } + }, INPLACE_RECORD_COUNT); + + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + + + private void loadRMUsersAndGroups() + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Void doWork() throws Exception + { + final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (filePlan == null) + { + Assert.fail("The default RM site is not present."); + } + + groups = new ArrayList(); + + repeatInTransactionBatches(new RunAsWork() + { + public Void doWork() throws Exception + { + String groupName = GUID.generate(); + System.out.println("Creating group " + groupName); + groups.add("GROUP_" + authorityService.createAuthority(AuthorityType.GROUP, groupName)); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, groupName); + return null; + } + }, RM_GROUP_COUNT); + + for (final String group : groups) + { + repeatInTransactionBatches(new RunAsWork() + { + public Void doWork() throws Exception + { + String userName = GUID.generate(); + System.out.println("Creating user " + userName + " and adding to group " + group); + createPerson(userName, true); + authorityService.addAuthority(group, userName); + return null; + } + }, RM_USER_COUNT); + } + + return null; + } + }); + } + + private void loadFilePlanData() + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + public Void doWork() throws Exception + { + final NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if (filePlan == null) + { + Assert.fail("The default RM site is not present."); + } + + // create root categories + recordCategories = new ArrayList(ROOT_CATEGORY_COUNT); + repeatInTransactionBatches(new RunAsWork() + { + public Void doWork() throws Exception + { + recordCategories.add(filePlanService.createRecordCategory(filePlan, GUID.generate())); + return null; + } + }, ROOT_CATEGORY_COUNT); + + // create record folders + recordFolders = new ArrayList(RECORD_FOLDER_COUNT); + for (final NodeRef recordCategory : recordCategories) + { + repeatInTransactionBatches(new RunAsWork() + { + public Void doWork() throws Exception + { + recordFolders.add(recordFolderService.createRecordFolder(recordCategory, GUID.generate())); + return null; + } + }, RECORD_FOLDER_COUNT); + } + + // create records + for (final NodeRef recordFolder : recordFolders) + { + repeatInTransactionBatches(new RunAsWork() + { + public Void doWork() throws Exception + { + recordService.createRecordFromContent(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT, null, null); + return null; + } + }, RECORD_COUNT); + } + + + return null; + } + }); + } + + private NodeRef createPerson(String userName, boolean createAuth) + { + if (createAuth) + { + authenticationService.createAuthentication(userName, "password".toCharArray()); + } + Map properties = new HashMap(); + properties.put(ContentModel.PROP_USERNAME, userName); + return personService.createPerson(properties); + } + + private void repeatInTransactionBatches(final RunAsWork work, final int count) throws Exception + { + totalCount = 0; + while (totalCount < count) + { + transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + int batchSize = count - totalCount; + if (batchSize >= BATCH_SIZE) + { + batchSize = BATCH_SIZE; + } + + for (int i = 0; i < batchSize; i++) + { + // do it + work.doWork(); + totalCount++; + } + + System.out.println("Created " + totalCount + " of " + count); + + return null; + } + }, + false, true); + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/NotificationServiceHelperSystemTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/NotificationServiceHelperSystemTest.java index 308d8dca77..27f5f024c4 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/NotificationServiceHelperSystemTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/NotificationServiceHelperSystemTest.java @@ -1,156 +1,156 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.system; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; -import org.alfresco.util.PropertyMap; - -/** - * Notification helper (system) test - * - * @author Roy Wetherall - */ -public class NotificationServiceHelperSystemTest extends BaseRMTestCase -{ - private static final String NOTIFICATION_ROLE = "RecordsManager"; - private static final String EMAIL_ADDRESS = "roy.wetherall@alfreso.com"; - - /** Services */ - private RecordsManagementNotificationHelper notificationHelper; - - /** Test data */ - private NodeRef record; - private List records; - private String userName; - private NodeRef person; - - @Override - protected void initServices() - { - super.initServices(); - - // Get the notification helper - notificationHelper = (RecordsManagementNotificationHelper)applicationContext.getBean("recordsManagementNotificationHelper"); - } - - @Override - protected void setupTestData() - { - super.setupTestData(); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - // Create a user - userName = GUID.generate(); - authenticationService.createAuthentication(userName, "".toCharArray()); - PropertyMap props = new PropertyMap(); - props.put(PROP_USERNAME, userName); - props.put(PROP_FIRSTNAME, "Test"); - props.put(PROP_LASTNAME, "User"); - props.put(PROP_EMAIL, EMAIL_ADDRESS); - person = personService.createPerson(props); - - // Find the authority for the given role - Role role = filePlanRoleService.getRole(filePlan, NOTIFICATION_ROLE); - assertNotNull("Notification role could not be retrieved", role); - String roleGroup = role.getRoleGroupName(); - assertNotNull("Notification role group can not be null.", roleGroup); - - // Add user to notification role group - authorityService.addAuthority(roleGroup, userName); - - return null; - } - }); - } - - @Override - protected void setupTestDataImpl() - { - super.setupTestDataImpl(); - - // Create a few test records - record = utils.createRecord(rmFolder, "recordOne"); - NodeRef record2 = utils.createRecord(rmFolder, "recordTwo"); - NodeRef record3 = utils.createRecord(rmFolder, "recordThree"); - - records = new ArrayList(3); - records.add(record); - records.add(record2); - records.add(record3); - } - - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // Delete the person and user - personService.deletePerson(person); - } - - public void testSendDueForReviewNotification() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - notificationHelper.recordsDueForReviewEmailNotification(records); - return null; - } - }); - } - - public void testSendSupersededNotification() - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - notificationHelper.recordSupersededEmailNotification(record); - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.system; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.util.GUID; +import org.alfresco.util.PropertyMap; + +/** + * Notification helper (system) test + * + * @author Roy Wetherall + */ +public class NotificationServiceHelperSystemTest extends BaseRMTestCase +{ + private static final String NOTIFICATION_ROLE = "RecordsManager"; + private static final String EMAIL_ADDRESS = "roy.wetherall@alfreso.com"; + + /** Services */ + private RecordsManagementNotificationHelper notificationHelper; + + /** Test data */ + private NodeRef record; + private List records; + private String userName; + private NodeRef person; + + @Override + protected void initServices() + { + super.initServices(); + + // Get the notification helper + notificationHelper = (RecordsManagementNotificationHelper)applicationContext.getBean("recordsManagementNotificationHelper"); + } + + @Override + protected void setupTestData() + { + super.setupTestData(); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + + // Create a user + userName = GUID.generate(); + authenticationService.createAuthentication(userName, "".toCharArray()); + PropertyMap props = new PropertyMap(); + props.put(PROP_USERNAME, userName); + props.put(PROP_FIRSTNAME, "Test"); + props.put(PROP_LASTNAME, "User"); + props.put(PROP_EMAIL, EMAIL_ADDRESS); + person = personService.createPerson(props); + + // Find the authority for the given role + Role role = filePlanRoleService.getRole(filePlan, NOTIFICATION_ROLE); + assertNotNull("Notification role could not be retrieved", role); + String roleGroup = role.getRoleGroupName(); + assertNotNull("Notification role group can not be null.", roleGroup); + + // Add user to notification role group + authorityService.addAuthority(roleGroup, userName); + + return null; + } + }); + } + + @Override + protected void setupTestDataImpl() + { + super.setupTestDataImpl(); + + // Create a few test records + record = utils.createRecord(rmFolder, "recordOne"); + NodeRef record2 = utils.createRecord(rmFolder, "recordTwo"); + NodeRef record3 = utils.createRecord(rmFolder, "recordThree"); + + records = new ArrayList(3); + records.add(record); + records.add(record2); + records.add(record3); + } + + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + + // Delete the person and user + personService.deletePerson(person); + } + + public void testSendDueForReviewNotification() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + notificationHelper.recordsDueForReviewEmailNotification(records); + return null; + } + }); + } + + public void testSendSupersededNotification() + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + notificationHelper.recordSupersededEmailNotification(record); + 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 86d3350610..7c369cc84a 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 @@ -1,993 +1,993 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; -import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -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.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authority.AuthorityDAO; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.repo.site.SiteServiceImpl; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.action.ActionService; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.cmr.tagging.TaggingService; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ApplicationContextHelper; -import org.alfresco.util.GUID; -import org.alfresco.util.RetryingTransactionHelperTestCase; -import org.springframework.context.ApplicationContext; - -/** - * Base test case class to use for RM unit tests. - * - * @author Roy Wetherall - */ -public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase - implements RecordsManagementModel, ContentModel, RMPermissionModel -{ - /** Application context */ - protected String[] getConfigLocations() - { - return new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:test-context.xml" - }; - } - protected ApplicationContext applicationContext; - - /** test model constants */ - protected String URI = "http://www.alfresco.org/model/rmtest/1.0"; - protected String PREFIX = "rmt"; - protected QName TYPE_CUSTOM_TYPE = QName.createQName(URI, "customType"); - protected QName ASPECT_CUSTOM_ASPECT = QName.createQName(URI, "customAspect"); - protected QName ASPECT_RECORD_META_DATA = QName.createQName(URI, "recordMetaData"); - - /** test data */ - protected String NAME_DM_DOCUMENT = "collabDocument.txt"; - - /** admin user */ - protected static final String ADMIN_USER = "admin"; - - /** Common test utils */ - protected CommonRMTestUtils utils; - - /** Services */ - protected NodeService nodeService; - protected ContentService contentService; - protected DictionaryService dictionaryService; - protected RetryingTransactionHelper retryingTransactionHelper; - protected PolicyComponent policyComponent; - protected NamespaceService namespaceService; - protected SearchService searchService; - protected SiteService siteService; - protected MutableAuthenticationService authenticationService; - protected AuthorityService authorityService; - protected PersonService personService; - protected TransactionService transactionService; - protected FileFolderService fileFolderService; - protected PermissionService permissionService; - protected TaggingService taggingService; - protected ActionService actionService; - protected OwnableService ownableService; - protected VersionService versionService; - - /** RM Services */ - protected DispositionService dispositionService; - protected RecordsManagementEventService rmEventService; - protected RecordsManagementAdminService rmAdminService; - protected RecordsManagementActionService rmActionService; - protected RecordsManagementSearchService rmSearchService; - protected FilePlanRoleService filePlanRoleService; - protected FilePlanPermissionService filePlanPermissionService; - protected CapabilityService capabilityService; - protected VitalRecordService vitalRecordService; - protected DataSetService dataSetService; - protected FreezeService freezeService; - protected RecordService recordService; - protected FilePlanService filePlanService; - protected RecordFolderService recordFolderService; - protected ExtendedSecurityService extendedSecurityService; - protected ReportService reportService; - protected RecordsManagementAuditService rmAuditService; - protected IdentifierService identifierService; - protected HoldService holdService; - protected InplaceRecordService inplaceRecordService; - protected RelationshipService relationshipService; - - /** test data */ - protected String siteId; - protected StoreRef storeRef; - protected NodeRef rootNodeRef; - protected SiteInfo siteInfo; - protected NodeRef folder; - protected NodeRef filePlan; - protected NodeRef rmContainer; - protected DispositionSchedule dispositionSchedule; - protected NodeRef rmFolder; - protected NodeRef unfiledContainer; - protected String collabSiteId; - protected NodeRef holdsContainer; - protected NodeRef transfersContainer; - - /** multi-hierarchy test data - * - * |--rmRootContainer - * | - * |--mhContainer - * | - * |--mhContainer-1-1 (has schedule - folder level) - * | | - * | |--mhContainer-2-1 - * | | - * | |--mhContainer-3-1 - * | - * |--mhContainer-1-2 (has schedule - folder level) - * | - * |--mhContainer-2-2 - * | | - * | |--mhContainer-3-2 - * | | - * | |--mhContainer-3-3 (has schedule - record level) - * | - * |--mhContainer-2-3 (has schedule - folder level) - * | - * |--mhContainer-3-4 - * | - * |--mhContainer-3-5 (has schedule- record level) - */ - - protected NodeRef mhContainer; - - protected NodeRef mhContainer11; - protected DispositionSchedule mhDispositionSchedule11; - protected NodeRef mhContainer12; - protected DispositionSchedule mhDispositionSchedule12; - - protected NodeRef mhContainer21; - protected NodeRef mhContainer22; - protected NodeRef mhContainer23; - protected DispositionSchedule mhDispositionSchedule23; - - protected NodeRef mhContainer31; - protected NodeRef mhContainer32; - protected NodeRef mhContainer33; - protected DispositionSchedule mhDispositionSchedule33; - protected NodeRef mhContainer34; - protected NodeRef mhContainer35; - protected DispositionSchedule mhDispositionSchedule35; - - protected NodeRef mhRecordFolder41; - protected NodeRef mhRecordFolder42; - protected NodeRef mhRecordFolder43; - protected NodeRef mhRecordFolder44; - protected NodeRef mhRecordFolder45; - - /** test user names */ - protected String[] testUsers; - protected String userName; - protected String rmUserName; - protected String powerUserName; - protected String securityOfficerName; - protected String recordsManagerName; - - /** test people */ - protected NodeRef userPerson; - protected NodeRef rmUserPerson; - protected NodeRef powerUserPerson; - protected NodeRef securityOfficerPerson; - protected NodeRef recordsManagerPerson; - - /** test records */ - protected NodeRef recordOne; - protected NodeRef recordTwo; - protected NodeRef recordThree; - protected NodeRef recordFour; - protected NodeRef recordFive; - protected NodeRef recordDeclaredOne; - protected NodeRef recordDeclaredTwo; - - /** collaboration site artifacts */ - protected SiteInfo collaborationSite; - protected NodeRef documentLibrary; - protected NodeRef dmFolder; - protected NodeRef dmDocument; - - /** collaboration site users */ - protected String dmConsumer; - protected NodeRef dmConsumerNodeRef; - protected String dmContributor; - protected NodeRef dmContributorNodeRef; - protected String dmCollaborator; - protected NodeRef dmCollaboratorNodeRef; - - /** - * Indicates whether this is a RM site test or not. If true then the test RM site is created along with a basic - * file plan structure, otherwise not. - */ - protected boolean isRMSiteTest() - { - return true; - } - - /** - * Indicates whether this is a multi-hierarchy test or not. If it is then the multi-hierarchy record - * taxonomy test data is loaded. - */ - protected boolean isMultiHierarchyTest() - { - return false; - } - - /** - * Indicates whether the test users should be created or not. - */ - protected boolean isUserTest() - { - return false; - } - - /** - * Indicates whether the test records should be created or not. - */ - protected boolean isRecordTest() - { - return false; - } - - /** - * Indicates whether the test users should have filling on the file plan structure - * by default or not. - */ - protected boolean isFillingForAllUsers() - { - return false; - } - - /** - * Indicates whether the test collaboration site should be created - * or not. - */ - protected boolean isCollaborationSiteTest() - { - return false; - } - - /** - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception - { - // Get the application context - applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); - utils = new CommonRMTestUtils(applicationContext); - - // Initialise the service beans - initServices(); - - // Setup test data - setupTestData(); - - // Create multi hierarchy data - if (isMultiHierarchyTest()) - { - setupMultiHierarchyTestData(); - } - - // Create collaboration data - if (isCollaborationSiteTest()) - { - setupCollaborationSiteTestData(); - } - - // Create the users here - if (isUserTest()) - { - setupTestUsers(filePlan); - } - } - - /** - * Initialise the service beans. - */ - protected void initServices() - { - // Get services - nodeService = (NodeService)applicationContext.getBean("NodeService"); - contentService = (ContentService)applicationContext.getBean("ContentService"); - retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); - namespaceService = (NamespaceService)this.applicationContext.getBean("NamespaceService"); - searchService = (SearchService)this.applicationContext.getBean("SearchService"); - policyComponent = (PolicyComponent)this.applicationContext.getBean("policyComponent"); - dictionaryService = (DictionaryService)this.applicationContext.getBean("DictionaryService"); - siteService = (SiteService)this.applicationContext.getBean("SiteService"); - authorityService = (AuthorityService)this.applicationContext.getBean("AuthorityService"); - authenticationService = (MutableAuthenticationService)this.applicationContext.getBean("AuthenticationService"); - personService = (PersonService)this.applicationContext.getBean("PersonService"); - transactionService = (TransactionService)applicationContext.getBean("TransactionService"); - fileFolderService = (FileFolderService)applicationContext.getBean("FileFolderService"); - permissionService = (PermissionService)applicationContext.getBean("PermissionService"); - taggingService = (TaggingService)applicationContext.getBean("TaggingService"); - actionService = (ActionService)applicationContext.getBean("ActionService"); - ownableService = (OwnableService)applicationContext.getBean("OwnableService"); - versionService = (VersionService)applicationContext.getBean("VersionService"); - - // Get RM services - dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); - rmEventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService"); - rmAdminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService"); - rmActionService = (RecordsManagementActionService)this.applicationContext.getBean("RecordsManagementActionService"); - rmSearchService = (RecordsManagementSearchService)this.applicationContext.getBean("RecordsManagementSearchService"); - filePlanRoleService = (FilePlanRoleService)this.applicationContext.getBean("FilePlanRoleService"); - filePlanPermissionService = (FilePlanPermissionService)this.applicationContext.getBean("FilePlanPermissionService"); - capabilityService = (CapabilityService)this.applicationContext.getBean("CapabilityService"); - vitalRecordService = (VitalRecordService)this.applicationContext.getBean("VitalRecordService"); - dataSetService = (DataSetService) applicationContext.getBean("DataSetService"); - freezeService = (FreezeService) applicationContext.getBean("FreezeService"); - recordService = (RecordService) applicationContext.getBean("RecordService"); - filePlanService = (FilePlanService) applicationContext.getBean("FilePlanService"); - recordFolderService = (RecordFolderService) applicationContext.getBean("RecordFolderService"); - extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("ExtendedSecurityService"); - reportService = (ReportService) applicationContext.getBean("ReportService"); - rmAuditService = (RecordsManagementAuditService) applicationContext.getBean("RecordsManagementAuditService"); - identifierService = (IdentifierService) applicationContext.getBean("recordsManagementIdentifierService"); - holdService = (HoldService) applicationContext.getBean("HoldService"); - inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService"); - relationshipService = (RelationshipService) applicationContext.getBean("RelationshipService"); - } - - /** - * @see junit.framework.TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // Do the tear down - AuthenticationUtil.runAsSystem(() -> - { - tearDownImpl(); - return null; - }); - - return null; - } - }); - } - - /** - * Tear down implementation - */ - protected void tearDownImpl() - { - BehaviourFilter filter = (BehaviourFilter)applicationContext.getBean("policyBehaviourFilter"); - filter.disableBehaviour(); - try - { - if (filePlan != null && nodeService.exists(filePlan)) - { - List holds = holdService.getHolds(filePlan); - for (NodeRef hold : holds) - { - holdService.deleteHold(hold); - } - } - - if (folder != null && nodeService.exists(folder)) - { - // Delete the folder - nodeService.deleteNode(folder); - } - - if (siteId != null && siteService.getSite(siteId) != null) - { - // Delete the site - siteService.deleteSite(siteId); - } - - // delete the collaboration site (if required) - if (isCollaborationSiteTest() && siteService.getSite(collabSiteId) != null) - { - siteService.deleteSite(collabSiteId); - } - } - finally - { - filter.enableBehaviour(); - } - } - - /** - * @see org.alfresco.util.RetryingTransactionHelperTestCase#getRetryingTransactionHelper() - */ - @Override - public RetryingTransactionHelper getRetryingTransactionHelper() - { - return retryingTransactionHelper; - } - - /** - * Setup test data for tests - */ - protected void setupTestData() - { - doTestInTransaction(new Test() - { - public Void run() - { - setupTestDataImpl(); - - if (isRecordTest() && isRMSiteTest()) - { - setupTestRecords(); - } - - return null; - } - - @Override - public void test(Void result) throws Exception - { - if (isRMSiteTest()) - { - if (isRecordTest()) - { - // declare a record - utils.completeRecord(recordDeclaredOne); - utils.completeRecord(recordDeclaredTwo); - } - - // unfiled container - unfiledContainer = filePlanService.getUnfiledContainer(filePlan); - assertNotNull(unfiledContainer); - - // holds container - holdsContainer = filePlanService.getHoldContainer(filePlan); - assertNotNull(holdsContainer); - - // transfers container - transfersContainer = filePlanService.getTransferContainer(filePlan); - assertNotNull(transfersContainer); - } - } - }, AuthenticationUtil.getSystemUserName()); - } - - /** - * Impl of test data setup - */ - protected void setupTestDataImpl() - { - AuthorityDAO authDao = (AuthorityDAO)applicationContext.getBean("authorityDAO"); - if (!authDao.authorityExists(AuthenticationUtil.getSystemUserName())) - { - createPerson(AuthenticationUtil.getSystemUserName(), false); - } - assertTrue("No person object for System available.", authDao.authorityExists(AuthenticationUtil.getSystemUserName())); - - storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; - rootNodeRef = nodeService.getRootNode(storeRef); - - // Create folder - String containerName = "RM2_" + System.currentTimeMillis(); - Map containerProps = new HashMap(1); - containerProps.put(ContentModel.PROP_NAME, containerName); - folder = nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, containerName), - ContentModel.TYPE_FOLDER, - containerProps).getChildRef(); - assertNotNull("Could not create base folder", folder); - - permissionService.setPermission(folder, ADMIN_USER, PermissionService.WRITE, true); - permissionService.setPermission(folder, ADMIN_USER, PermissionService.ADD_CHILDREN, true); - - if (isRMSiteTest()) - { - siteId = GUID.generate(); - siteInfo = siteService.createSite( - "rm-site-dashboard", - siteId, - "title", - "descrition", - SiteVisibility.PUBLIC, - RecordsManagementModel.TYPE_RM_SITE); - - filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - assertNotNull("Site document library container was not created successfully.", filePlan); - - // Create RM container - rmContainer = filePlanService.createRecordCategory(filePlan, "rmContainer"); - assertNotNull("Could not create rm container", rmContainer); - - // Create disposition schedule - dispositionSchedule = utils.createBasicDispositionSchedule(rmContainer); - - // Create RM folder - rmFolder = recordFolderService.createRecordFolder(rmContainer, "rmFolder"); - assertNotNull("Could not create rm folder", rmFolder); - } - } - - protected void setupTestRecords() - { - recordOne = utils.createRecord(rmFolder, "one.txt"); - recordTwo = utils.createRecord(rmFolder, "two.txt"); - recordThree = utils.createRecord(rmFolder, "three.txt"); - recordFour = utils.createRecord(rmFolder, "four.txt"); - recordFive = utils.createRecord(rmFolder, "five.txt"); - recordDeclaredOne = utils.createRecord(rmFolder, "declaredOne.txt"); - recordDeclaredTwo = utils.createRecord(rmFolder, "declaredTwo.txt"); - } - - protected void setupTestUsers(final NodeRef filePlan) - { - AuthenticationUtil.runAs(() -> - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - setupTestUsersImpl(filePlan); - return null; - } - }); - - return null; - }, - AuthenticationUtil.getAdminUserName()); - } - - /** - * - * @param filePlan - */ - protected void setupTestUsersImpl(NodeRef filePlan) - { - userName = GUID.generate(); - userPerson = createPerson(userName); - - rmUserName = GUID.generate(); - rmUserPerson = createPerson(rmUserName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, rmUserName); - - powerUserName = GUID.generate(); - powerUserPerson = createPerson(powerUserName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_POWER_USER, powerUserName); - - securityOfficerName = GUID.generate(); - securityOfficerPerson = createPerson(securityOfficerName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER, securityOfficerName); - - recordsManagerName = GUID.generate(); - recordsManagerPerson = createPerson(recordsManagerName); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, recordsManagerName); - - testUsers = new String[] - { - userName, - rmUserName, - powerUserName, - securityOfficerName, - recordsManagerName - }; - - if (isFillingForAllUsers()) - { - // Give all the users file permission objects - for (String user : testUsers) - { - filePlanPermissionService.setPermission(filePlan, user, FILING); - filePlanPermissionService.setPermission(rmContainer, user, FILING); - filePlanPermissionService.setPermission(rmFolder, user, FILING); - filePlanPermissionService.setPermission(unfiledContainer, user, FILING); - } - } - } - - /** - * Util method to create a person. - * @param userName user name - * @return NodeRef user node reference - */ - protected NodeRef createPerson(String userName, boolean createAuth) - { - if (createAuth) - { - authenticationService.createAuthentication(userName, "password".toCharArray()); - } - Map properties = new HashMap(); - properties.put(ContentModel.PROP_USERNAME, userName); - properties.put(ContentModel.PROP_FIRSTNAME, userName); - return personService.createPerson(properties); - } - - protected NodeRef createPerson(String userName) - { - return createPerson(userName, true); - } - - /** - * Setup multi hierarchy test data - */ - protected void setupMultiHierarchyTestData() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - return AuthenticationUtil.runAsSystem(() -> - { - // Do setup - setupMultiHierarchyTestDataImpl(); - - return null; - }); - } - }); - } - - /** - * Impl of multi hierarchy test data - */ - protected void setupMultiHierarchyTestDataImpl() - { - // Create root mh container - mhContainer = filePlanService.createRecordCategory(filePlan, "mhContainer"); - - // Level 1 - mhContainer11 = filePlanService.createRecordCategory(mhContainer, "mhContainer11"); - mhDispositionSchedule11 = utils.createBasicDispositionSchedule(mhContainer11, "ds11", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); - mhContainer12 = filePlanService.createRecordCategory(mhContainer, "mhContainer12"); - mhDispositionSchedule12 = utils.createBasicDispositionSchedule(mhContainer12, "ds12", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); - - // Level 2 - mhContainer21 = filePlanService.createRecordCategory(mhContainer11, "mhContainer21"); - mhContainer22 = filePlanService.createRecordCategory(mhContainer12, "mhContainer22"); - mhContainer23 = filePlanService.createRecordCategory(mhContainer12, "mhContainer23"); - mhDispositionSchedule23 = utils.createBasicDispositionSchedule(mhContainer23, "ds23", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); - - // Level 3 - mhContainer31 = filePlanService.createRecordCategory(mhContainer21, "mhContainer31"); - mhContainer32 = filePlanService.createRecordCategory(mhContainer22, "mhContainer32"); - mhContainer33 = filePlanService.createRecordCategory(mhContainer22, "mhContainer33"); - mhDispositionSchedule33 = utils.createBasicDispositionSchedule(mhContainer33, "ds33", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true); - mhContainer34 = filePlanService.createRecordCategory(mhContainer23, "mhContainer34"); - mhContainer35 = filePlanService.createRecordCategory(mhContainer23, "mhContainer35"); - mhDispositionSchedule35 = utils.createBasicDispositionSchedule(mhContainer35, "ds35", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true); - - // Record folders - mhRecordFolder41 = recordFolderService.createRecordFolder(mhContainer31, "mhFolder41"); - mhRecordFolder42 = recordFolderService.createRecordFolder(mhContainer32, "mhFolder42"); - mhRecordFolder43 = recordFolderService.createRecordFolder(mhContainer33, "mhFolder43"); - mhRecordFolder44 = recordFolderService.createRecordFolder(mhContainer34, "mhFolder44"); - mhRecordFolder45 = recordFolderService.createRecordFolder(mhContainer35, "mhFolder45"); - } - - protected void setupCollaborationSiteTestData() - { - doTestInTransaction(new Test() - { - public Void run() - { - setupCollaborationSiteTestDataImpl(); - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - protected void setupCollaborationSiteTestDataImpl() - { - // create collaboration site - collabSiteId = GUID.generate(); - collaborationSite = siteService.createSite("site-dashboard", collabSiteId, "title", "description", SiteVisibility.PRIVATE); - documentLibrary = SiteServiceImpl.getSiteContainer( - collabSiteId, - SiteService.DOCUMENT_LIBRARY, - true, - siteService, - transactionService, - taggingService); - - assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary); - - // create a folder and documents - dmFolder = fileFolderService.create(documentLibrary, "collabFolder", ContentModel.TYPE_FOLDER).getNodeRef(); - dmDocument = fileFolderService.create(dmFolder, NAME_DM_DOCUMENT, ContentModel.TYPE_CONTENT).getNodeRef(); - - dmConsumer = GUID.generate(); - dmConsumerNodeRef = createPerson(dmConsumer); - siteService.setMembership(collabSiteId, dmConsumer, SiteModel.SITE_CONSUMER); - - dmContributor = GUID.generate(); - dmContributorNodeRef = createPerson(dmContributor); - siteService.setMembership(collabSiteId, dmContributor, SiteModel.SITE_CONTRIBUTOR); - - dmCollaborator = GUID.generate(); - dmCollaboratorNodeRef = createPerson(dmCollaborator); - siteService.setMembership(collabSiteId, dmCollaborator, SiteModel.SITE_COLLABORATOR); - } - - /** - * Override to ensure the tests are run as the 'admin' user by default. - */ - - @Override - protected A doTestInTransaction(Test test) - { - return super.doTestInTransaction(test, AuthenticationUtil.getAdminUserName()); - } - - @Override - protected void doTestInTransaction(FailureTest test) - { - super.doTestInTransaction(test, AuthenticationUtil.getAdminUserName()); - } - - /** - * Helper class to try and simplify {@link Void} tests. - * - * @author Roy Wetherall - * @since 2.1 - */ - protected abstract class VoidTest extends Test - { - @Override - public Void run() throws Exception - { - runImpl(); - return null; - } - - public abstract void runImpl() throws Exception; - - @Override - public void test(Void result) throws Exception - { - testImpl(); - } - - public void testImpl() throws Exception - { - // empty implementation - } - } - - /** - * Execute behaviour driven test. - * - * @param test - */ - protected void doBehaviourDrivenTest(BehaviourDrivenTest test) - { - try - { - test.run(); - } - catch (Exception exception) - { - throw new RuntimeException(exception); - } - } - - /** - * Behaviour driven test. - * - * @author Roy Wetherall - * @since 2.2 - */ - protected abstract class BehaviourDrivenTest - { - /** run in transaction */ - protected boolean runInTransactionTests = true; - - /** run as user */ - protected String runAsUser = AuthenticationUtil.getAdminUserName(); - - /** expected exception */ - protected Class expectedException; - - /** - * Default constructor - */ - public BehaviourDrivenTest() - { - } - - public BehaviourDrivenTest(Class expectedException) - { - this.expectedException = expectedException; - } - - public BehaviourDrivenTest(Class expectedException, String runAsUser) - { - this.expectedException = expectedException; - this.runAsUser = runAsUser; - } - - public BehaviourDrivenTest(String runAsUser) - { - this.runAsUser = runAsUser; - } - - public BehaviourDrivenTest(String runAsUser, boolean runInTransactionTests) - { - this.runInTransactionTests = runInTransactionTests; - if (runAsUser != null) - { - this.runAsUser = runAsUser; - } - } - - public void given() throws Exception { /** empty implementation */ } - - public void when() throws Exception { /** empty implementation */ } - - public void then() throws Exception { /** empty implementation */ } - - public void after() throws Exception { /** empty implementation */ } - - public void run() throws Exception - { - try - { - if (runInTransactionTests) - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - given(); - } - }, runAsUser); - } - else - { - given(); - } - - if (expectedException == null) - { - if (runInTransactionTests) - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - when(); - } - }, runAsUser); - - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - then(); - } - }, runAsUser); - } - else - { - when(); - then(); - } - } - else - { - doTestInTransaction(new FailureTest(expectedException) - { - @Override - public void run() throws Exception - { - when(); - } - }, runAsUser); - } - } - finally - { - if (runInTransactionTests) - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - after(); - } - }, runAsUser); - } - else - { - after(); - } - } - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; +import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +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.search.RecordsManagementSearchService; +import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; +import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authority.AuthorityDAO; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.repo.site.SiteServiceImpl; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.action.ActionService; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.MutableAuthenticationService; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.service.cmr.tagging.TaggingService; +import org.alfresco.service.cmr.version.VersionService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.ApplicationContextHelper; +import org.alfresco.util.GUID; +import org.alfresco.util.RetryingTransactionHelperTestCase; +import org.springframework.context.ApplicationContext; + +/** + * Base test case class to use for RM unit tests. + * + * @author Roy Wetherall + */ +public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase + implements RecordsManagementModel, ContentModel, RMPermissionModel +{ + /** Application context */ + protected String[] getConfigLocations() + { + return new String[] + { + "classpath:alfresco/application-context.xml", + "classpath:test-context.xml" + }; + } + protected ApplicationContext applicationContext; + + /** test model constants */ + protected String URI = "http://www.alfresco.org/model/rmtest/1.0"; + protected String PREFIX = "rmt"; + protected QName TYPE_CUSTOM_TYPE = QName.createQName(URI, "customType"); + protected QName ASPECT_CUSTOM_ASPECT = QName.createQName(URI, "customAspect"); + protected QName ASPECT_RECORD_META_DATA = QName.createQName(URI, "recordMetaData"); + + /** test data */ + protected String NAME_DM_DOCUMENT = "collabDocument.txt"; + + /** admin user */ + protected static final String ADMIN_USER = "admin"; + + /** Common test utils */ + protected CommonRMTestUtils utils; + + /** Services */ + protected NodeService nodeService; + protected ContentService contentService; + protected DictionaryService dictionaryService; + protected RetryingTransactionHelper retryingTransactionHelper; + protected PolicyComponent policyComponent; + protected NamespaceService namespaceService; + protected SearchService searchService; + protected SiteService siteService; + protected MutableAuthenticationService authenticationService; + protected AuthorityService authorityService; + protected PersonService personService; + protected TransactionService transactionService; + protected FileFolderService fileFolderService; + protected PermissionService permissionService; + protected TaggingService taggingService; + protected ActionService actionService; + protected OwnableService ownableService; + protected VersionService versionService; + + /** RM Services */ + protected DispositionService dispositionService; + protected RecordsManagementEventService rmEventService; + protected RecordsManagementAdminService rmAdminService; + protected RecordsManagementActionService rmActionService; + protected RecordsManagementSearchService rmSearchService; + protected FilePlanRoleService filePlanRoleService; + protected FilePlanPermissionService filePlanPermissionService; + protected CapabilityService capabilityService; + protected VitalRecordService vitalRecordService; + protected DataSetService dataSetService; + protected FreezeService freezeService; + protected RecordService recordService; + protected FilePlanService filePlanService; + protected RecordFolderService recordFolderService; + protected ExtendedSecurityService extendedSecurityService; + protected ReportService reportService; + protected RecordsManagementAuditService rmAuditService; + protected IdentifierService identifierService; + protected HoldService holdService; + protected InplaceRecordService inplaceRecordService; + protected RelationshipService relationshipService; + + /** test data */ + protected String siteId; + protected StoreRef storeRef; + protected NodeRef rootNodeRef; + protected SiteInfo siteInfo; + protected NodeRef folder; + protected NodeRef filePlan; + protected NodeRef rmContainer; + protected DispositionSchedule dispositionSchedule; + protected NodeRef rmFolder; + protected NodeRef unfiledContainer; + protected String collabSiteId; + protected NodeRef holdsContainer; + protected NodeRef transfersContainer; + + /** multi-hierarchy test data + * + * |--rmRootContainer + * | + * |--mhContainer + * | + * |--mhContainer-1-1 (has schedule - folder level) + * | | + * | |--mhContainer-2-1 + * | | + * | |--mhContainer-3-1 + * | + * |--mhContainer-1-2 (has schedule - folder level) + * | + * |--mhContainer-2-2 + * | | + * | |--mhContainer-3-2 + * | | + * | |--mhContainer-3-3 (has schedule - record level) + * | + * |--mhContainer-2-3 (has schedule - folder level) + * | + * |--mhContainer-3-4 + * | + * |--mhContainer-3-5 (has schedule- record level) + */ + + protected NodeRef mhContainer; + + protected NodeRef mhContainer11; + protected DispositionSchedule mhDispositionSchedule11; + protected NodeRef mhContainer12; + protected DispositionSchedule mhDispositionSchedule12; + + protected NodeRef mhContainer21; + protected NodeRef mhContainer22; + protected NodeRef mhContainer23; + protected DispositionSchedule mhDispositionSchedule23; + + protected NodeRef mhContainer31; + protected NodeRef mhContainer32; + protected NodeRef mhContainer33; + protected DispositionSchedule mhDispositionSchedule33; + protected NodeRef mhContainer34; + protected NodeRef mhContainer35; + protected DispositionSchedule mhDispositionSchedule35; + + protected NodeRef mhRecordFolder41; + protected NodeRef mhRecordFolder42; + protected NodeRef mhRecordFolder43; + protected NodeRef mhRecordFolder44; + protected NodeRef mhRecordFolder45; + + /** test user names */ + protected String[] testUsers; + protected String userName; + protected String rmUserName; + protected String powerUserName; + protected String securityOfficerName; + protected String recordsManagerName; + + /** test people */ + protected NodeRef userPerson; + protected NodeRef rmUserPerson; + protected NodeRef powerUserPerson; + protected NodeRef securityOfficerPerson; + protected NodeRef recordsManagerPerson; + + /** test records */ + protected NodeRef recordOne; + protected NodeRef recordTwo; + protected NodeRef recordThree; + protected NodeRef recordFour; + protected NodeRef recordFive; + protected NodeRef recordDeclaredOne; + protected NodeRef recordDeclaredTwo; + + /** collaboration site artifacts */ + protected SiteInfo collaborationSite; + protected NodeRef documentLibrary; + protected NodeRef dmFolder; + protected NodeRef dmDocument; + + /** collaboration site users */ + protected String dmConsumer; + protected NodeRef dmConsumerNodeRef; + protected String dmContributor; + protected NodeRef dmContributorNodeRef; + protected String dmCollaborator; + protected NodeRef dmCollaboratorNodeRef; + + /** + * Indicates whether this is a RM site test or not. If true then the test RM site is created along with a basic + * file plan structure, otherwise not. + */ + protected boolean isRMSiteTest() + { + return true; + } + + /** + * Indicates whether this is a multi-hierarchy test or not. If it is then the multi-hierarchy record + * taxonomy test data is loaded. + */ + protected boolean isMultiHierarchyTest() + { + return false; + } + + /** + * Indicates whether the test users should be created or not. + */ + protected boolean isUserTest() + { + return false; + } + + /** + * Indicates whether the test records should be created or not. + */ + protected boolean isRecordTest() + { + return false; + } + + /** + * Indicates whether the test users should have filling on the file plan structure + * by default or not. + */ + protected boolean isFillingForAllUsers() + { + return false; + } + + /** + * Indicates whether the test collaboration site should be created + * or not. + */ + protected boolean isCollaborationSiteTest() + { + return false; + } + + /** + * @see junit.framework.TestCase#setUp() + */ + @Override + protected void setUp() throws Exception + { + // Get the application context + applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations()); + utils = new CommonRMTestUtils(applicationContext); + + // Initialise the service beans + initServices(); + + // Setup test data + setupTestData(); + + // Create multi hierarchy data + if (isMultiHierarchyTest()) + { + setupMultiHierarchyTestData(); + } + + // Create collaboration data + if (isCollaborationSiteTest()) + { + setupCollaborationSiteTestData(); + } + + // Create the users here + if (isUserTest()) + { + setupTestUsers(filePlan); + } + } + + /** + * Initialise the service beans. + */ + protected void initServices() + { + // Get services + nodeService = (NodeService)applicationContext.getBean("NodeService"); + contentService = (ContentService)applicationContext.getBean("ContentService"); + retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); + namespaceService = (NamespaceService)this.applicationContext.getBean("NamespaceService"); + searchService = (SearchService)this.applicationContext.getBean("SearchService"); + policyComponent = (PolicyComponent)this.applicationContext.getBean("policyComponent"); + dictionaryService = (DictionaryService)this.applicationContext.getBean("DictionaryService"); + siteService = (SiteService)this.applicationContext.getBean("SiteService"); + authorityService = (AuthorityService)this.applicationContext.getBean("AuthorityService"); + authenticationService = (MutableAuthenticationService)this.applicationContext.getBean("AuthenticationService"); + personService = (PersonService)this.applicationContext.getBean("PersonService"); + transactionService = (TransactionService)applicationContext.getBean("TransactionService"); + fileFolderService = (FileFolderService)applicationContext.getBean("FileFolderService"); + permissionService = (PermissionService)applicationContext.getBean("PermissionService"); + taggingService = (TaggingService)applicationContext.getBean("TaggingService"); + actionService = (ActionService)applicationContext.getBean("ActionService"); + ownableService = (OwnableService)applicationContext.getBean("OwnableService"); + versionService = (VersionService)applicationContext.getBean("VersionService"); + + // Get RM services + dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); + rmEventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService"); + rmAdminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService"); + rmActionService = (RecordsManagementActionService)this.applicationContext.getBean("RecordsManagementActionService"); + rmSearchService = (RecordsManagementSearchService)this.applicationContext.getBean("RecordsManagementSearchService"); + filePlanRoleService = (FilePlanRoleService)this.applicationContext.getBean("FilePlanRoleService"); + filePlanPermissionService = (FilePlanPermissionService)this.applicationContext.getBean("FilePlanPermissionService"); + capabilityService = (CapabilityService)this.applicationContext.getBean("CapabilityService"); + vitalRecordService = (VitalRecordService)this.applicationContext.getBean("VitalRecordService"); + dataSetService = (DataSetService) applicationContext.getBean("DataSetService"); + freezeService = (FreezeService) applicationContext.getBean("FreezeService"); + recordService = (RecordService) applicationContext.getBean("RecordService"); + filePlanService = (FilePlanService) applicationContext.getBean("FilePlanService"); + recordFolderService = (RecordFolderService) applicationContext.getBean("RecordFolderService"); + extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("ExtendedSecurityService"); + reportService = (ReportService) applicationContext.getBean("ReportService"); + rmAuditService = (RecordsManagementAuditService) applicationContext.getBean("RecordsManagementAuditService"); + identifierService = (IdentifierService) applicationContext.getBean("recordsManagementIdentifierService"); + holdService = (HoldService) applicationContext.getBean("HoldService"); + inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService"); + relationshipService = (RelationshipService) applicationContext.getBean("RelationshipService"); + } + + /** + * @see junit.framework.TestCase#tearDown() + */ + @Override + protected void tearDown() throws Exception + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + // Do the tear down + AuthenticationUtil.runAsSystem(() -> + { + tearDownImpl(); + return null; + }); + + return null; + } + }); + } + + /** + * Tear down implementation + */ + protected void tearDownImpl() + { + BehaviourFilter filter = (BehaviourFilter)applicationContext.getBean("policyBehaviourFilter"); + filter.disableBehaviour(); + try + { + if (filePlan != null && nodeService.exists(filePlan)) + { + List holds = holdService.getHolds(filePlan); + for (NodeRef hold : holds) + { + holdService.deleteHold(hold); + } + } + + if (folder != null && nodeService.exists(folder)) + { + // Delete the folder + nodeService.deleteNode(folder); + } + + if (siteId != null && siteService.getSite(siteId) != null) + { + // Delete the site + siteService.deleteSite(siteId); + } + + // delete the collaboration site (if required) + if (isCollaborationSiteTest() && siteService.getSite(collabSiteId) != null) + { + siteService.deleteSite(collabSiteId); + } + } + finally + { + filter.enableBehaviour(); + } + } + + /** + * @see org.alfresco.util.RetryingTransactionHelperTestCase#getRetryingTransactionHelper() + */ + @Override + public RetryingTransactionHelper getRetryingTransactionHelper() + { + return retryingTransactionHelper; + } + + /** + * Setup test data for tests + */ + protected void setupTestData() + { + doTestInTransaction(new Test() + { + public Void run() + { + setupTestDataImpl(); + + if (isRecordTest() && isRMSiteTest()) + { + setupTestRecords(); + } + + return null; + } + + @Override + public void test(Void result) throws Exception + { + if (isRMSiteTest()) + { + if (isRecordTest()) + { + // declare a record + utils.completeRecord(recordDeclaredOne); + utils.completeRecord(recordDeclaredTwo); + } + + // unfiled container + unfiledContainer = filePlanService.getUnfiledContainer(filePlan); + assertNotNull(unfiledContainer); + + // holds container + holdsContainer = filePlanService.getHoldContainer(filePlan); + assertNotNull(holdsContainer); + + // transfers container + transfersContainer = filePlanService.getTransferContainer(filePlan); + assertNotNull(transfersContainer); + } + } + }, AuthenticationUtil.getSystemUserName()); + } + + /** + * Impl of test data setup + */ + protected void setupTestDataImpl() + { + AuthorityDAO authDao = (AuthorityDAO)applicationContext.getBean("authorityDAO"); + if (!authDao.authorityExists(AuthenticationUtil.getSystemUserName())) + { + createPerson(AuthenticationUtil.getSystemUserName(), false); + } + assertTrue("No person object for System available.", authDao.authorityExists(AuthenticationUtil.getSystemUserName())); + + storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; + rootNodeRef = nodeService.getRootNode(storeRef); + + // Create folder + String containerName = "RM2_" + System.currentTimeMillis(); + Map containerProps = new HashMap(1); + containerProps.put(ContentModel.PROP_NAME, containerName); + folder = nodeService.createNode( + rootNodeRef, + ContentModel.ASSOC_CHILDREN, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, containerName), + ContentModel.TYPE_FOLDER, + containerProps).getChildRef(); + assertNotNull("Could not create base folder", folder); + + permissionService.setPermission(folder, ADMIN_USER, PermissionService.WRITE, true); + permissionService.setPermission(folder, ADMIN_USER, PermissionService.ADD_CHILDREN, true); + + if (isRMSiteTest()) + { + siteId = GUID.generate(); + siteInfo = siteService.createSite( + "rm-site-dashboard", + siteId, + "title", + "descrition", + SiteVisibility.PUBLIC, + RecordsManagementModel.TYPE_RM_SITE); + + filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); + assertNotNull("Site document library container was not created successfully.", filePlan); + + // Create RM container + rmContainer = filePlanService.createRecordCategory(filePlan, "rmContainer"); + assertNotNull("Could not create rm container", rmContainer); + + // Create disposition schedule + dispositionSchedule = utils.createBasicDispositionSchedule(rmContainer); + + // Create RM folder + rmFolder = recordFolderService.createRecordFolder(rmContainer, "rmFolder"); + assertNotNull("Could not create rm folder", rmFolder); + } + } + + protected void setupTestRecords() + { + recordOne = utils.createRecord(rmFolder, "one.txt"); + recordTwo = utils.createRecord(rmFolder, "two.txt"); + recordThree = utils.createRecord(rmFolder, "three.txt"); + recordFour = utils.createRecord(rmFolder, "four.txt"); + recordFive = utils.createRecord(rmFolder, "five.txt"); + recordDeclaredOne = utils.createRecord(rmFolder, "declaredOne.txt"); + recordDeclaredTwo = utils.createRecord(rmFolder, "declaredTwo.txt"); + } + + protected void setupTestUsers(final NodeRef filePlan) + { + AuthenticationUtil.runAs(() -> + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + setupTestUsersImpl(filePlan); + return null; + } + }); + + return null; + }, + AuthenticationUtil.getAdminUserName()); + } + + /** + * + * @param filePlan + */ + protected void setupTestUsersImpl(NodeRef filePlan) + { + userName = GUID.generate(); + userPerson = createPerson(userName); + + rmUserName = GUID.generate(); + rmUserPerson = createPerson(rmUserName); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_USER, rmUserName); + + powerUserName = GUID.generate(); + powerUserPerson = createPerson(powerUserName); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_POWER_USER, powerUserName); + + securityOfficerName = GUID.generate(); + securityOfficerPerson = createPerson(securityOfficerName); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_SECURITY_OFFICER, securityOfficerName); + + recordsManagerName = GUID.generate(); + recordsManagerPerson = createPerson(recordsManagerName); + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, recordsManagerName); + + testUsers = new String[] + { + userName, + rmUserName, + powerUserName, + securityOfficerName, + recordsManagerName + }; + + if (isFillingForAllUsers()) + { + // Give all the users file permission objects + for (String user : testUsers) + { + filePlanPermissionService.setPermission(filePlan, user, FILING); + filePlanPermissionService.setPermission(rmContainer, user, FILING); + filePlanPermissionService.setPermission(rmFolder, user, FILING); + filePlanPermissionService.setPermission(unfiledContainer, user, FILING); + } + } + } + + /** + * Util method to create a person. + * @param userName user name + * @return NodeRef user node reference + */ + protected NodeRef createPerson(String userName, boolean createAuth) + { + if (createAuth) + { + authenticationService.createAuthentication(userName, "password".toCharArray()); + } + Map properties = new HashMap(); + properties.put(ContentModel.PROP_USERNAME, userName); + properties.put(ContentModel.PROP_FIRSTNAME, userName); + return personService.createPerson(properties); + } + + protected NodeRef createPerson(String userName) + { + return createPerson(userName, true); + } + + /** + * Setup multi hierarchy test data + */ + protected void setupMultiHierarchyTestData() + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + return AuthenticationUtil.runAsSystem(() -> + { + // Do setup + setupMultiHierarchyTestDataImpl(); + + return null; + }); + } + }); + } + + /** + * Impl of multi hierarchy test data + */ + protected void setupMultiHierarchyTestDataImpl() + { + // Create root mh container + mhContainer = filePlanService.createRecordCategory(filePlan, "mhContainer"); + + // Level 1 + mhContainer11 = filePlanService.createRecordCategory(mhContainer, "mhContainer11"); + mhDispositionSchedule11 = utils.createBasicDispositionSchedule(mhContainer11, "ds11", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); + mhContainer12 = filePlanService.createRecordCategory(mhContainer, "mhContainer12"); + mhDispositionSchedule12 = utils.createBasicDispositionSchedule(mhContainer12, "ds12", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); + + // Level 2 + mhContainer21 = filePlanService.createRecordCategory(mhContainer11, "mhContainer21"); + mhContainer22 = filePlanService.createRecordCategory(mhContainer12, "mhContainer22"); + mhContainer23 = filePlanService.createRecordCategory(mhContainer12, "mhContainer23"); + mhDispositionSchedule23 = utils.createBasicDispositionSchedule(mhContainer23, "ds23", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true); + + // Level 3 + mhContainer31 = filePlanService.createRecordCategory(mhContainer21, "mhContainer31"); + mhContainer32 = filePlanService.createRecordCategory(mhContainer22, "mhContainer32"); + mhContainer33 = filePlanService.createRecordCategory(mhContainer22, "mhContainer33"); + mhDispositionSchedule33 = utils.createBasicDispositionSchedule(mhContainer33, "ds33", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true); + mhContainer34 = filePlanService.createRecordCategory(mhContainer23, "mhContainer34"); + mhContainer35 = filePlanService.createRecordCategory(mhContainer23, "mhContainer35"); + mhDispositionSchedule35 = utils.createBasicDispositionSchedule(mhContainer35, "ds35", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true); + + // Record folders + mhRecordFolder41 = recordFolderService.createRecordFolder(mhContainer31, "mhFolder41"); + mhRecordFolder42 = recordFolderService.createRecordFolder(mhContainer32, "mhFolder42"); + mhRecordFolder43 = recordFolderService.createRecordFolder(mhContainer33, "mhFolder43"); + mhRecordFolder44 = recordFolderService.createRecordFolder(mhContainer34, "mhFolder44"); + mhRecordFolder45 = recordFolderService.createRecordFolder(mhContainer35, "mhFolder45"); + } + + protected void setupCollaborationSiteTestData() + { + doTestInTransaction(new Test() + { + public Void run() + { + setupCollaborationSiteTestDataImpl(); + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + + protected void setupCollaborationSiteTestDataImpl() + { + // create collaboration site + collabSiteId = GUID.generate(); + collaborationSite = siteService.createSite("site-dashboard", collabSiteId, "title", "description", SiteVisibility.PRIVATE); + documentLibrary = SiteServiceImpl.getSiteContainer( + collabSiteId, + SiteService.DOCUMENT_LIBRARY, + true, + siteService, + transactionService, + taggingService); + + assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary); + + // create a folder and documents + dmFolder = fileFolderService.create(documentLibrary, "collabFolder", ContentModel.TYPE_FOLDER).getNodeRef(); + dmDocument = fileFolderService.create(dmFolder, NAME_DM_DOCUMENT, ContentModel.TYPE_CONTENT).getNodeRef(); + + dmConsumer = GUID.generate(); + dmConsumerNodeRef = createPerson(dmConsumer); + siteService.setMembership(collabSiteId, dmConsumer, SiteModel.SITE_CONSUMER); + + dmContributor = GUID.generate(); + dmContributorNodeRef = createPerson(dmContributor); + siteService.setMembership(collabSiteId, dmContributor, SiteModel.SITE_CONTRIBUTOR); + + dmCollaborator = GUID.generate(); + dmCollaboratorNodeRef = createPerson(dmCollaborator); + siteService.setMembership(collabSiteId, dmCollaborator, SiteModel.SITE_COLLABORATOR); + } + + /** + * Override to ensure the tests are run as the 'admin' user by default. + */ + + @Override + protected A doTestInTransaction(Test test) + { + return super.doTestInTransaction(test, AuthenticationUtil.getAdminUserName()); + } + + @Override + protected void doTestInTransaction(FailureTest test) + { + super.doTestInTransaction(test, AuthenticationUtil.getAdminUserName()); + } + + /** + * Helper class to try and simplify {@link Void} tests. + * + * @author Roy Wetherall + * @since 2.1 + */ + protected abstract class VoidTest extends Test + { + @Override + public Void run() throws Exception + { + runImpl(); + return null; + } + + public abstract void runImpl() throws Exception; + + @Override + public void test(Void result) throws Exception + { + testImpl(); + } + + public void testImpl() throws Exception + { + // empty implementation + } + } + + /** + * Execute behaviour driven test. + * + * @param test + */ + protected void doBehaviourDrivenTest(BehaviourDrivenTest test) + { + try + { + test.run(); + } + catch (Exception exception) + { + throw new RuntimeException(exception); + } + } + + /** + * Behaviour driven test. + * + * @author Roy Wetherall + * @since 2.2 + */ + protected abstract class BehaviourDrivenTest + { + /** run in transaction */ + protected boolean runInTransactionTests = true; + + /** run as user */ + protected String runAsUser = AuthenticationUtil.getAdminUserName(); + + /** expected exception */ + protected Class expectedException; + + /** + * Default constructor + */ + public BehaviourDrivenTest() + { + } + + public BehaviourDrivenTest(Class expectedException) + { + this.expectedException = expectedException; + } + + public BehaviourDrivenTest(Class expectedException, String runAsUser) + { + this.expectedException = expectedException; + this.runAsUser = runAsUser; + } + + public BehaviourDrivenTest(String runAsUser) + { + this.runAsUser = runAsUser; + } + + public BehaviourDrivenTest(String runAsUser, boolean runInTransactionTests) + { + this.runInTransactionTests = runInTransactionTests; + if (runAsUser != null) + { + this.runAsUser = runAsUser; + } + } + + public void given() throws Exception { /** empty implementation */ } + + public void when() throws Exception { /** empty implementation */ } + + public void then() throws Exception { /** empty implementation */ } + + public void after() throws Exception { /** empty implementation */ } + + public void run() throws Exception + { + try + { + if (runInTransactionTests) + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + given(); + } + }, runAsUser); + } + else + { + given(); + } + + if (expectedException == null) + { + if (runInTransactionTests) + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + when(); + } + }, runAsUser); + + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + then(); + } + }, runAsUser); + } + else + { + when(); + then(); + } + } + else + { + doTestInTransaction(new FailureTest(expectedException) + { + @Override + public void run() throws Exception + { + when(); + } + }, runAsUser); + } + } + finally + { + if (runInTransactionTests) + { + doTestInTransaction(new VoidTest() + { + @Override + public void runImpl() throws Exception + { + after(); + } + }, runAsUser); + } + else + { + after(); + } + } + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java index 0d221db809..f495e50996 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java @@ -1,400 +1,400 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; -import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; -import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.site.SiteServiceImpl; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.repo.web.scripts.BaseWebScriptTest; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Period; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.service.cmr.tagging.TaggingService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.GUID; -import org.alfresco.util.PropertyMap; -import org.springframework.context.ApplicationContext; - -/** - * @author Roy Wetherall - */ -public class BaseRMWebScriptTestCase extends BaseWebScriptTest -{ - /** Common test utils */ - protected CommonRMTestUtils utils; - - /** Application context */ - protected ApplicationContext applicationContext; - - /** Services */ - protected NodeService nodeService; - protected ContentService contentService; - protected DictionaryService dictionaryService; - protected RetryingTransactionHelper retryingTransactionHelper; - protected PolicyComponent policyComponent; - protected NamespaceService namespaceService; - protected SearchService searchService; - protected SiteService siteService; - protected MutableAuthenticationService authenticationService; - protected AuthorityService authorityService; - protected PersonService personService; - protected TransactionService transactionService; - protected TaggingService taggingService; - - /** RM Services */ - protected DispositionService dispositionService; - protected RecordsManagementEventService eventService; - protected RecordsManagementAdminService adminService; - protected RecordsManagementActionService actionService; - protected RecordsManagementSearchService rmSearchService; - protected FilePlanRoleService filePlanRoleService; - protected FilePlanPermissionService filePlanPermissionService; - protected RecordsManagementAuditService auditService; - protected CapabilityService capabilityService; - protected VitalRecordService vitalRecordService; - protected FilePlanService filePlanService; - protected RecordFolderService recordFolderService; - protected RMCaveatConfigService caveatConfigService; - - /** test data */ - protected String siteId; - protected StoreRef storeRef; - protected NodeRef rootNodeRef; - protected SiteInfo siteInfo; - protected NodeRef folder; - protected NodeRef filePlan; - protected NodeRef recordSeries; // A category with no disposition schedule - protected NodeRef recordCategory; - protected DispositionSchedule dispositionSchedule; - protected NodeRef recordFolder; - protected NodeRef recordFolder2; - protected String collabSiteId; - - /** admin user name */ - protected static final String ADMIN_USER = "admin"; - - /** - * Indicates whether the test collaboration site should be created - * or not. - */ - protected boolean isCollaborationSiteTest() - { - return false; - } - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - // Initialise the service beans - initServices(); - - // Setup test data - setupTestData(); - } - - /** - * Initialise the service beans. - */ - protected void initServices() - { - applicationContext = getServer().getApplicationContext(); - - // Common test utils - utils = new CommonRMTestUtils(applicationContext); - - // Get services - nodeService = (NodeService)applicationContext.getBean("NodeService"); - contentService = (ContentService)applicationContext.getBean("ContentService"); - retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); - namespaceService = (NamespaceService)applicationContext.getBean("NamespaceService"); - searchService = (SearchService)applicationContext.getBean("SearchService"); - policyComponent = (PolicyComponent)applicationContext.getBean("policyComponent"); - dictionaryService = (DictionaryService)applicationContext.getBean("DictionaryService"); - siteService = (SiteService)applicationContext.getBean("SiteService"); - authorityService = (AuthorityService)applicationContext.getBean("AuthorityService"); - authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService"); - personService = (PersonService)applicationContext.getBean("PersonService"); - transactionService = (TransactionService)applicationContext.getBean("TransactionService"); - taggingService = (TaggingService)applicationContext.getBean("TaggingService"); - - // Get RM services - dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); - eventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService"); - adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService"); - actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService"); - rmSearchService = (RecordsManagementSearchService)applicationContext.getBean("RecordsManagementSearchService"); - filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService"); - filePlanPermissionService = (FilePlanPermissionService)applicationContext.getBean("FilePlanPermissionService"); - auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService"); - capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService"); - vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService"); - filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService"); - recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService"); - caveatConfigService = (RMCaveatConfigService)applicationContext.getBean("CaveatConfigService"); - } - - /** - * @see junit.framework.TestCase#tearDown() - */ - @Override - protected void tearDown() throws Exception - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // As system user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - // Do the tear down - tearDownImpl(); - - return null; - } - }); - } - - /** - * Tear down implementation - */ - protected void tearDownImpl() - { - // Delete the folder - nodeService.deleteNode(folder); - - // Delete the site - siteService.deleteSite(siteId); - - // Delete the collaboration site (if required) - if (isCollaborationSiteTest()) - { - siteService.deleteSite(collabSiteId); - } - } - - /** - * Setup test data for tests - */ - protected void setupTestData() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - setupTestDataImpl(); - return null; - } - }); - - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // As system user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); - - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_ADMIN, ADMIN_USER); - - return null; - } - }); - } - - /** - * Impl of test data setup - */ - protected void setupTestDataImpl() - { - storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; - rootNodeRef = nodeService.getRootNode(storeRef); - - // Create folder - String containerName = "RM2_" + System.currentTimeMillis(); - Map containerProps = new HashMap(1); - containerProps.put(ContentModel.PROP_NAME, containerName); - folder = nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, containerName), - ContentModel.TYPE_FOLDER, - containerProps).getChildRef(); - assertNotNull("Could not create base folder", folder); - - // Create the site - siteId = getRMSiteId(); - siteInfo = siteService.createSite("rm-site-dashboard", siteId, "title", "descrition", SiteVisibility.PUBLIC, RecordsManagementModel.TYPE_RM_SITE); - filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); - assertNotNull("Site document library container was not created successfully.", filePlan); - - recordSeries = filePlanService.createRecordCategory(filePlan, "recordSeries"); - assertNotNull("Could not create record category with no disposition schedule", recordSeries); - - recordCategory = filePlanService.createRecordCategory(recordSeries, "rmContainer"); - assertNotNull("Could not create record category", recordCategory); - - // Make vital record - vitalRecordService.setVitalRecordDefintion(recordCategory, true, new Period("week|1")); - - // Create disposition schedule - dispositionSchedule = utils.createBasicDispositionSchedule(recordCategory); - - // Create RM folder - recordFolder = recordFolderService.createRecordFolder(recordCategory, "rmFolder"); - assertNotNull("Could not create rm folder", recordFolder); - recordFolder2 = recordFolderService.createRecordFolder(recordCategory, "rmFolder2"); - assertNotNull("Could not create rm folder 2", recordFolder2); - - // Create collaboration data - if (isCollaborationSiteTest()) - { - setupCollaborationSiteTestData(); - } - } - - protected void setupCollaborationSiteTestData() - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - @Override - public Object execute() throws Throwable - { - // As system user - AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - - setupCollaborationSiteTestDataImpl(); - - return null; - } - }); - } - - protected void setupCollaborationSiteTestDataImpl() - { - // create collaboration site - collabSiteId = GUID.generate(); - siteService.createSite("preset", collabSiteId, "title", "description", SiteVisibility.PRIVATE); - NodeRef documentLibrary = SiteServiceImpl.getSiteContainer( - collabSiteId, - SiteService.DOCUMENT_LIBRARY, - true, - siteService, - transactionService, - taggingService); - - assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary); - } - - protected void createUser(String userName) - { - if (!authenticationService.authenticationExists(userName)) - { - authenticationService.createAuthentication(userName, "PWD".toCharArray()); - - PropertyMap ppOne = new PropertyMap(4); - ppOne.put(ContentModel.PROP_USERNAME, userName); - ppOne.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, "title" + userName); - ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName"); - ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); - ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); - ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); - - personService.createPerson(ppOne); - } - } - - protected void deleteUser(String userName) - { - if (authenticationService.authenticationExists(userName)) - { - personService.deletePerson(userName); - } - } - - protected void createGroup(String groupName) - { - if (!authorityService.authorityExists(groupName)) - { - authorityService.createAuthority(AuthorityType.GROUP, groupName); - } - } - - protected void deleteGroup(String groupName) - { - if (authorityService.authorityExists(groupName)) - { - authorityService.deleteAuthority(groupName, true); - } - } - - protected String getRMSiteId() - { - return GUID.generate(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; +import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; +import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.site.SiteServiceImpl; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.repo.web.scripts.BaseWebScriptTest; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.Period; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.MutableAuthenticationService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.cmr.site.SiteInfo; +import org.alfresco.service.cmr.site.SiteService; +import org.alfresco.service.cmr.site.SiteVisibility; +import org.alfresco.service.cmr.tagging.TaggingService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.GUID; +import org.alfresco.util.PropertyMap; +import org.springframework.context.ApplicationContext; + +/** + * @author Roy Wetherall + */ +public class BaseRMWebScriptTestCase extends BaseWebScriptTest +{ + /** Common test utils */ + protected CommonRMTestUtils utils; + + /** Application context */ + protected ApplicationContext applicationContext; + + /** Services */ + protected NodeService nodeService; + protected ContentService contentService; + protected DictionaryService dictionaryService; + protected RetryingTransactionHelper retryingTransactionHelper; + protected PolicyComponent policyComponent; + protected NamespaceService namespaceService; + protected SearchService searchService; + protected SiteService siteService; + protected MutableAuthenticationService authenticationService; + protected AuthorityService authorityService; + protected PersonService personService; + protected TransactionService transactionService; + protected TaggingService taggingService; + + /** RM Services */ + protected DispositionService dispositionService; + protected RecordsManagementEventService eventService; + protected RecordsManagementAdminService adminService; + protected RecordsManagementActionService actionService; + protected RecordsManagementSearchService rmSearchService; + protected FilePlanRoleService filePlanRoleService; + protected FilePlanPermissionService filePlanPermissionService; + protected RecordsManagementAuditService auditService; + protected CapabilityService capabilityService; + protected VitalRecordService vitalRecordService; + protected FilePlanService filePlanService; + protected RecordFolderService recordFolderService; + protected RMCaveatConfigService caveatConfigService; + + /** test data */ + protected String siteId; + protected StoreRef storeRef; + protected NodeRef rootNodeRef; + protected SiteInfo siteInfo; + protected NodeRef folder; + protected NodeRef filePlan; + protected NodeRef recordSeries; // A category with no disposition schedule + protected NodeRef recordCategory; + protected DispositionSchedule dispositionSchedule; + protected NodeRef recordFolder; + protected NodeRef recordFolder2; + protected String collabSiteId; + + /** admin user name */ + protected static final String ADMIN_USER = "admin"; + + /** + * Indicates whether the test collaboration site should be created + * or not. + */ + protected boolean isCollaborationSiteTest() + { + return false; + } + + @Override + protected void setUp() throws Exception + { + super.setUp(); + + // Initialise the service beans + initServices(); + + // Setup test data + setupTestData(); + } + + /** + * Initialise the service beans. + */ + protected void initServices() + { + applicationContext = getServer().getApplicationContext(); + + // Common test utils + utils = new CommonRMTestUtils(applicationContext); + + // Get services + nodeService = (NodeService)applicationContext.getBean("NodeService"); + contentService = (ContentService)applicationContext.getBean("ContentService"); + retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); + namespaceService = (NamespaceService)applicationContext.getBean("NamespaceService"); + searchService = (SearchService)applicationContext.getBean("SearchService"); + policyComponent = (PolicyComponent)applicationContext.getBean("policyComponent"); + dictionaryService = (DictionaryService)applicationContext.getBean("DictionaryService"); + siteService = (SiteService)applicationContext.getBean("SiteService"); + authorityService = (AuthorityService)applicationContext.getBean("AuthorityService"); + authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService"); + personService = (PersonService)applicationContext.getBean("PersonService"); + transactionService = (TransactionService)applicationContext.getBean("TransactionService"); + taggingService = (TaggingService)applicationContext.getBean("TaggingService"); + + // Get RM services + dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); + eventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService"); + adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService"); + actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService"); + rmSearchService = (RecordsManagementSearchService)applicationContext.getBean("RecordsManagementSearchService"); + filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService"); + filePlanPermissionService = (FilePlanPermissionService)applicationContext.getBean("FilePlanPermissionService"); + auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService"); + capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService"); + vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService"); + filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService"); + recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService"); + caveatConfigService = (RMCaveatConfigService)applicationContext.getBean("CaveatConfigService"); + } + + /** + * @see junit.framework.TestCase#tearDown() + */ + @Override + protected void tearDown() throws Exception + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + // As system user + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + // Do the tear down + tearDownImpl(); + + return null; + } + }); + } + + /** + * Tear down implementation + */ + protected void tearDownImpl() + { + // Delete the folder + nodeService.deleteNode(folder); + + // Delete the site + siteService.deleteSite(siteId); + + // Delete the collaboration site (if required) + if (isCollaborationSiteTest()) + { + siteService.deleteSite(collabSiteId); + } + } + + /** + * Setup test data for tests + */ + protected void setupTestData() + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + setupTestDataImpl(); + return null; + } + }); + + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + // As system user + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); + + filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_ADMIN, ADMIN_USER); + + return null; + } + }); + } + + /** + * Impl of test data setup + */ + protected void setupTestDataImpl() + { + storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE; + rootNodeRef = nodeService.getRootNode(storeRef); + + // Create folder + String containerName = "RM2_" + System.currentTimeMillis(); + Map containerProps = new HashMap(1); + containerProps.put(ContentModel.PROP_NAME, containerName); + folder = nodeService.createNode( + rootNodeRef, + ContentModel.ASSOC_CHILDREN, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, containerName), + ContentModel.TYPE_FOLDER, + containerProps).getChildRef(); + assertNotNull("Could not create base folder", folder); + + // Create the site + siteId = getRMSiteId(); + siteInfo = siteService.createSite("rm-site-dashboard", siteId, "title", "descrition", SiteVisibility.PUBLIC, RecordsManagementModel.TYPE_RM_SITE); + filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); + assertNotNull("Site document library container was not created successfully.", filePlan); + + recordSeries = filePlanService.createRecordCategory(filePlan, "recordSeries"); + assertNotNull("Could not create record category with no disposition schedule", recordSeries); + + recordCategory = filePlanService.createRecordCategory(recordSeries, "rmContainer"); + assertNotNull("Could not create record category", recordCategory); + + // Make vital record + vitalRecordService.setVitalRecordDefintion(recordCategory, true, new Period("week|1")); + + // Create disposition schedule + dispositionSchedule = utils.createBasicDispositionSchedule(recordCategory); + + // Create RM folder + recordFolder = recordFolderService.createRecordFolder(recordCategory, "rmFolder"); + assertNotNull("Could not create rm folder", recordFolder); + recordFolder2 = recordFolderService.createRecordFolder(recordCategory, "rmFolder2"); + assertNotNull("Could not create rm folder 2", recordFolder2); + + // Create collaboration data + if (isCollaborationSiteTest()) + { + setupCollaborationSiteTestData(); + } + } + + protected void setupCollaborationSiteTestData() + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + @Override + public Object execute() throws Throwable + { + // As system user + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); + + setupCollaborationSiteTestDataImpl(); + + return null; + } + }); + } + + protected void setupCollaborationSiteTestDataImpl() + { + // create collaboration site + collabSiteId = GUID.generate(); + siteService.createSite("preset", collabSiteId, "title", "description", SiteVisibility.PRIVATE); + NodeRef documentLibrary = SiteServiceImpl.getSiteContainer( + collabSiteId, + SiteService.DOCUMENT_LIBRARY, + true, + siteService, + transactionService, + taggingService); + + assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary); + } + + protected void createUser(String userName) + { + if (!authenticationService.authenticationExists(userName)) + { + authenticationService.createAuthentication(userName, "PWD".toCharArray()); + + PropertyMap ppOne = new PropertyMap(4); + ppOne.put(ContentModel.PROP_USERNAME, userName); + ppOne.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, "title" + userName); + ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName"); + ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); + ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); + ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); + + personService.createPerson(ppOne); + } + } + + protected void deleteUser(String userName) + { + if (authenticationService.authenticationExists(userName)) + { + personService.deletePerson(userName); + } + } + + protected void createGroup(String groupName) + { + if (!authorityService.authorityExists(groupName)) + { + authorityService.createAuthority(AuthorityType.GROUP, groupName); + } + } + + protected void deleteGroup(String groupName) + { + if (authorityService.authorityExists(groupName)) + { + authorityService.deleteAuthority(groupName, true); + } + } + + protected String getRMSiteId() + { + return GUID.generate(); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java index 1938535988..53e4bb898d 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java @@ -1,380 +1,380 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.io.InputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -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.NodeService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.lang.StringUtils; -import org.springframework.context.ApplicationContext; - -/** - * Common RM test utility methods. - * - * @author Roy Wetherall - */ -public class CommonRMTestUtils implements RecordsManagementModel -{ - private DispositionService dispositionService; - private NodeService nodeService; - private ContentService contentService; - private RecordsManagementActionService actionService; - private ModelSecurityService modelSecurityService; - private FilePlanRoleService filePlanRoleService; - private CapabilityService capabilityService; - - /** test values */ - public static final String DEFAULT_DISPOSITION_AUTHORITY = "disposition authority"; - public static final String DEFAULT_DISPOSITION_INSTRUCTIONS = "disposition instructions"; - public static final String DEFAULT_DISPOSITION_DESCRIPTION = "disposition action description"; - public static final String DEFAULT_EVENT_NAME = "case_closed"; - public static final String PERIOD_NONE = "none|0"; - public static final String PERIOD_IMMEDIATELY = "immediately|0"; - public static final String PERIOD_ONE_WEEK = "week|1"; - - /** - * Constructor - * - * @param applicationContext application context - */ - public CommonRMTestUtils(ApplicationContext applicationContext) - { - dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); - nodeService = (NodeService)applicationContext.getBean("NodeService"); - contentService = (ContentService)applicationContext.getBean("ContentService"); - actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService"); - modelSecurityService = (ModelSecurityService)applicationContext.getBean("ModelSecurityService"); - filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService"); - capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService"); - } - - /** - * Create a disposition schedule - * - * @param container record category - * @return {@link DispositionSchedule} created disposition schedule node reference - */ - public DispositionSchedule createBasicDispositionSchedule(NodeRef container) - { - return createBasicDispositionSchedule(container, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true); - } - - /** - * Create test disposition schedule - */ - public DispositionSchedule createBasicDispositionSchedule( - NodeRef container, - String dispositionInstructions, - String dispositionAuthority, - boolean isRecordLevel, - boolean defaultDispositionActions) - { - return createDispositionSchedule(container, dispositionInstructions, dispositionAuthority, isRecordLevel, defaultDispositionActions, false); - } - - /** - * Create test disposition schedule - */ - public DispositionSchedule createDispositionSchedule( - NodeRef container, - String dispositionInstructions, - String dispositionAuthority, - boolean isRecordLevel, - boolean defaultDispositionActions, - boolean extendedDispositionSchedule) - { - return createDispositionSchedule( - container, - dispositionInstructions, - dispositionAuthority, - isRecordLevel, - defaultDispositionActions, - extendedDispositionSchedule, - DEFAULT_EVENT_NAME); - } - - /** - * Create test disposition schedule - */ - public DispositionSchedule createDispositionSchedule( - NodeRef container, - String dispositionInstructions, - String dispositionAuthority, - boolean isRecordLevel, - boolean defaultDispositionActions, - boolean extendedDispositionSchedule, - String defaultEvent) - { - Map dsProps = new HashMap(3); - dsProps.put(PROP_DISPOSITION_AUTHORITY, dispositionAuthority); - dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, dispositionInstructions); - dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, isRecordLevel); - DispositionSchedule dispositionSchedule = dispositionService.createDispositionSchedule(container, dsProps); - - if (defaultDispositionActions) - { - Map adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); - - List events = new ArrayList(1); - events.add(defaultEvent); - adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - - if (extendedDispositionSchedule) - { - adParams = new HashMap(4); - adParams.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); - adParams.put(PROP_DISPOSITION_PERIOD, PERIOD_IMMEDIATELY); - adParams.put(PROP_DISPOSITION_LOCATION, StringUtils.EMPTY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - } - - adParams = new HashMap(3); - adParams.put(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME); - adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); - adParams.put(PROP_DISPOSITION_PERIOD, PERIOD_IMMEDIATELY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - } - - return dispositionSchedule; - } - - /** - * Helper method to create a record in a record folder. - * - * @param recordFolder record folder - * @param name name of record - * @return {@link NodeRef} record node reference - */ - public NodeRef createRecord(NodeRef recordFolder, String name) - { - return createRecord(recordFolder, name, null, "Some test content"); - } - - /** - * Helper method to create a record in a record folder. - * - * @param recordFolder record folder - * @param name name of the record - * @param title title of the record - * @return {@link NodeRef} record node reference - */ - public NodeRef createRecord(NodeRef recordFolder, String name, String title) - { - Map props = new HashMap(1); - props.put(ContentModel.PROP_TITLE, title); - return createRecord(recordFolder, name, props, "Some test content"); - } - - /** - * Helper method to create a record in a record folder. - * - * @param recordFolder record folder - * @param name name of record - * @param properties properties of the record - * @param content content of the record - * @return {@link NodeRef} record node reference - */ - public NodeRef createRecord(NodeRef recordFolder, String name, Map properties, String content) - { - // Create the record - NodeRef record = createRecordImpl(recordFolder, name, properties); - - // Set the content - ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.setEncoding("UTF-8"); - writer.putContent(content); - - return record; - } - - /** - * Helper method to create a record in a record folder. - * - * @param recordFolder record folder - * @param name name of record - * @param properties properties of the record - * @param content content of the record - * @return {@link NodeRef} record node reference - */ - public NodeRef createRecord(NodeRef recordFolder, String name, Map properties, String mimetype, InputStream content) - { - // Create the record - NodeRef record = createRecordImpl(recordFolder, name, properties); - - // Set the content - ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); - writer.setMimetype(mimetype); - writer.setEncoding("UTF-8"); - writer.putContent(content); - - return record; - } - - /** - * Helper to consolidate creation of contentless record - */ - private NodeRef createRecordImpl(NodeRef recordFolder, String name, Map properties) - { - // Create the document - if (properties == null) - { - properties = new HashMap(1); - } - if (!properties.containsKey(ContentModel.PROP_NAME)) - { - properties.put(ContentModel.PROP_NAME, name); - } - NodeRef record = nodeService.createNode(recordFolder, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), - ContentModel.TYPE_CONTENT, - properties).getChildRef(); - return record; - } - - /** - * Helper method to complete record. - */ - public void completeRecord(final NodeRef record) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - modelSecurityService.setEnabled(false); - try - { - nodeService.setProperty(record, RecordsManagementModel.PROP_DATE_FILED, new Date()); - nodeService.setProperty(record, ContentModel.PROP_TITLE, "titleValue"); - actionService.executeRecordsManagementAction(record, "declareRecord"); - } - finally - { - modelSecurityService.setEnabled(true); - } - - return null; - } - - }, AuthenticationUtil.getAdminUserName()); - - } - - public void closeFolder(final NodeRef recordFolder) - { - AuthenticationUtil.runAs(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - modelSecurityService.setEnabled(false); - try - { - actionService.executeRecordsManagementAction(recordFolder, "closeRecordFolder"); - } - finally - { - modelSecurityService.setEnabled(true); - } - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - public Role createRole(NodeRef filePlan, String roleName, String ... capabilityNames) - { - Set capabilities = new HashSet(capabilityNames.length); - for (String name : capabilityNames) - { - Capability capability = capabilityService.getCapability(name); - if (capability == null) - { - throw new AlfrescoRuntimeException("capability " + name + " not found."); - } - capabilities.add(capability); - } - - return filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - } - - /** - * Helper method to complete event on disposable item - * - * @param disposableItem disposable item (record or record folder) - * @param eventName event name - */ - public void completeEvent(NodeRef disposableItem, String eventName) - { - // build action properties - Map params = new HashMap(1); - params.put(CompleteEventAction.PARAM_EVENT_NAME, eventName); - - // complete event - actionService.executeRecordsManagementAction(disposableItem, CompleteEventAction.NAME, params); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.io.InputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.role.Role; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +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.NodeService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.lang.StringUtils; +import org.springframework.context.ApplicationContext; + +/** + * Common RM test utility methods. + * + * @author Roy Wetherall + */ +public class CommonRMTestUtils implements RecordsManagementModel +{ + private DispositionService dispositionService; + private NodeService nodeService; + private ContentService contentService; + private RecordsManagementActionService actionService; + private ModelSecurityService modelSecurityService; + private FilePlanRoleService filePlanRoleService; + private CapabilityService capabilityService; + + /** test values */ + public static final String DEFAULT_DISPOSITION_AUTHORITY = "disposition authority"; + public static final String DEFAULT_DISPOSITION_INSTRUCTIONS = "disposition instructions"; + public static final String DEFAULT_DISPOSITION_DESCRIPTION = "disposition action description"; + public static final String DEFAULT_EVENT_NAME = "case_closed"; + public static final String PERIOD_NONE = "none|0"; + public static final String PERIOD_IMMEDIATELY = "immediately|0"; + public static final String PERIOD_ONE_WEEK = "week|1"; + + /** + * Constructor + * + * @param applicationContext application context + */ + public CommonRMTestUtils(ApplicationContext applicationContext) + { + dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); + nodeService = (NodeService)applicationContext.getBean("NodeService"); + contentService = (ContentService)applicationContext.getBean("ContentService"); + actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService"); + modelSecurityService = (ModelSecurityService)applicationContext.getBean("ModelSecurityService"); + filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService"); + capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService"); + } + + /** + * Create a disposition schedule + * + * @param container record category + * @return {@link DispositionSchedule} created disposition schedule node reference + */ + public DispositionSchedule createBasicDispositionSchedule(NodeRef container) + { + return createBasicDispositionSchedule(container, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true); + } + + /** + * Create test disposition schedule + */ + public DispositionSchedule createBasicDispositionSchedule( + NodeRef container, + String dispositionInstructions, + String dispositionAuthority, + boolean isRecordLevel, + boolean defaultDispositionActions) + { + return createDispositionSchedule(container, dispositionInstructions, dispositionAuthority, isRecordLevel, defaultDispositionActions, false); + } + + /** + * Create test disposition schedule + */ + public DispositionSchedule createDispositionSchedule( + NodeRef container, + String dispositionInstructions, + String dispositionAuthority, + boolean isRecordLevel, + boolean defaultDispositionActions, + boolean extendedDispositionSchedule) + { + return createDispositionSchedule( + container, + dispositionInstructions, + dispositionAuthority, + isRecordLevel, + defaultDispositionActions, + extendedDispositionSchedule, + DEFAULT_EVENT_NAME); + } + + /** + * Create test disposition schedule + */ + public DispositionSchedule createDispositionSchedule( + NodeRef container, + String dispositionInstructions, + String dispositionAuthority, + boolean isRecordLevel, + boolean defaultDispositionActions, + boolean extendedDispositionSchedule, + String defaultEvent) + { + Map dsProps = new HashMap(3); + dsProps.put(PROP_DISPOSITION_AUTHORITY, dispositionAuthority); + dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, dispositionInstructions); + dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, isRecordLevel); + DispositionSchedule dispositionSchedule = dispositionService.createDispositionSchedule(container, dsProps); + + if (defaultDispositionActions) + { + Map adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); + + List events = new ArrayList(1); + events.add(defaultEvent); + adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); + + dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); + + if (extendedDispositionSchedule) + { + adParams = new HashMap(4); + adParams.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); + adParams.put(PROP_DISPOSITION_PERIOD, PERIOD_IMMEDIATELY); + adParams.put(PROP_DISPOSITION_LOCATION, StringUtils.EMPTY); + + dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); + } + + adParams = new HashMap(3); + adParams.put(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME); + adParams.put(PROP_DISPOSITION_DESCRIPTION, DEFAULT_DISPOSITION_DESCRIPTION); + adParams.put(PROP_DISPOSITION_PERIOD, PERIOD_IMMEDIATELY); + + dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); + } + + return dispositionSchedule; + } + + /** + * Helper method to create a record in a record folder. + * + * @param recordFolder record folder + * @param name name of record + * @return {@link NodeRef} record node reference + */ + public NodeRef createRecord(NodeRef recordFolder, String name) + { + return createRecord(recordFolder, name, null, "Some test content"); + } + + /** + * Helper method to create a record in a record folder. + * + * @param recordFolder record folder + * @param name name of the record + * @param title title of the record + * @return {@link NodeRef} record node reference + */ + public NodeRef createRecord(NodeRef recordFolder, String name, String title) + { + Map props = new HashMap(1); + props.put(ContentModel.PROP_TITLE, title); + return createRecord(recordFolder, name, props, "Some test content"); + } + + /** + * Helper method to create a record in a record folder. + * + * @param recordFolder record folder + * @param name name of record + * @param properties properties of the record + * @param content content of the record + * @return {@link NodeRef} record node reference + */ + public NodeRef createRecord(NodeRef recordFolder, String name, Map properties, String content) + { + // Create the record + NodeRef record = createRecordImpl(recordFolder, name, properties); + + // Set the content + ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + writer.setEncoding("UTF-8"); + writer.putContent(content); + + return record; + } + + /** + * Helper method to create a record in a record folder. + * + * @param recordFolder record folder + * @param name name of record + * @param properties properties of the record + * @param content content of the record + * @return {@link NodeRef} record node reference + */ + public NodeRef createRecord(NodeRef recordFolder, String name, Map properties, String mimetype, InputStream content) + { + // Create the record + NodeRef record = createRecordImpl(recordFolder, name, properties); + + // Set the content + ContentWriter writer = contentService.getWriter(record, ContentModel.PROP_CONTENT, true); + writer.setMimetype(mimetype); + writer.setEncoding("UTF-8"); + writer.putContent(content); + + return record; + } + + /** + * Helper to consolidate creation of contentless record + */ + private NodeRef createRecordImpl(NodeRef recordFolder, String name, Map properties) + { + // Create the document + if (properties == null) + { + properties = new HashMap(1); + } + if (!properties.containsKey(ContentModel.PROP_NAME)) + { + properties.put(ContentModel.PROP_NAME, name); + } + NodeRef record = nodeService.createNode(recordFolder, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), + ContentModel.TYPE_CONTENT, + properties).getChildRef(); + return record; + } + + /** + * Helper method to complete record. + */ + public void completeRecord(final NodeRef record) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + modelSecurityService.setEnabled(false); + try + { + nodeService.setProperty(record, RecordsManagementModel.PROP_DATE_FILED, new Date()); + nodeService.setProperty(record, ContentModel.PROP_TITLE, "titleValue"); + actionService.executeRecordsManagementAction(record, "declareRecord"); + } + finally + { + modelSecurityService.setEnabled(true); + } + + return null; + } + + }, AuthenticationUtil.getAdminUserName()); + + } + + public void closeFolder(final NodeRef recordFolder) + { + AuthenticationUtil.runAs(new RunAsWork() + { + @Override + public Void doWork() throws Exception + { + modelSecurityService.setEnabled(false); + try + { + actionService.executeRecordsManagementAction(recordFolder, "closeRecordFolder"); + } + finally + { + modelSecurityService.setEnabled(true); + } + return null; + } + }, AuthenticationUtil.getAdminUserName()); + } + + public Role createRole(NodeRef filePlan, String roleName, String ... capabilityNames) + { + Set capabilities = new HashSet(capabilityNames.length); + for (String name : capabilityNames) + { + Capability capability = capabilityService.getCapability(name); + if (capability == null) + { + throw new AlfrescoRuntimeException("capability " + name + " not found."); + } + capabilities.add(capability); + } + + return filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); + } + + /** + * Helper method to complete event on disposable item + * + * @param disposableItem disposable item (record or record folder) + * @param eventName event name + */ + public void completeEvent(NodeRef disposableItem, String eventName) + { + // build action properties + Map params = new HashMap(1); + params.put(CompleteEventAction.PARAM_EVENT_NAME, eventName); + + // complete event + actionService.executeRecordsManagementAction(disposableItem, CompleteEventAction.NAME, params); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/GenerateCapabilityReport.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/GenerateCapabilityReport.java index 860c8e87ac..88f5b4622d 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/GenerateCapabilityReport.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/GenerateCapabilityReport.java @@ -1,83 +1,83 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.io.BufferedWriter; -import java.io.FileWriter; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.Group; - -/** - * Utility test case to generate a report of the capabilities in the system. - * - * @author Roy Wetherall - * @since 2.1 - */ -public class GenerateCapabilityReport extends BaseRMTestCase -{ - public void testGetCapability() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() throws Exception - { - FileWriter writer = new FileWriter("c:\\mywork\\capabilityReport.csv"); - BufferedWriter out = new BufferedWriter(writer); - try - { - Set capabilities = capabilityService.getCapabilities(true); - for (Capability capability : capabilities) - { - Group group = capability.getGroup(); - String groupId = "none"; - if (group != null) - { - groupId = group.getId(); - } - - out.write(groupId); - out.write(","); - out.write(capability.getName()); - out.write(","); - out.write(Boolean.toString(capability.isPrivate())); - out.write("\n"); - } - } - finally - { - out.close(); - } - - return null; - } - }); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.io.BufferedWriter; +import java.io.FileWriter; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.Capability; +import org.alfresco.module.org_alfresco_module_rm.capability.Group; + +/** + * Utility test case to generate a report of the capabilities in the system. + * + * @author Roy Wetherall + * @since 2.1 + */ +public class GenerateCapabilityReport extends BaseRMTestCase +{ + public void testGetCapability() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + FileWriter writer = new FileWriter("c:\\mywork\\capabilityReport.csv"); + BufferedWriter out = new BufferedWriter(writer); + try + { + Set capabilities = capabilityService.getCapabilities(true); + for (Capability capability : capabilities) + { + Group group = capability.getGroup(); + String groupId = "none"; + if (group != null) + { + groupId = group.getId(); + } + + out.write(groupId); + out.write(","); + out.write(capability.getName()); + out.write(","); + out.write(Boolean.toString(capability.isPrivate())); + out.write("\n"); + } + } + finally + { + out.close(); + } + + return null; + } + }); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/RetryingTransactionHelperBaseTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/RetryingTransactionHelperBaseTest.java index b2de47f94c..d558478985 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/RetryingTransactionHelperBaseTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/RetryingTransactionHelperBaseTest.java @@ -1,76 +1,76 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.util.ApplicationContextHelper; -import org.alfresco.util.RetryingTransactionHelperTestCase; -import org.springframework.context.ApplicationContext; - -/** - * Base unit test for a simple retrying transaction helper test case. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RetryingTransactionHelperBaseTest extends RetryingTransactionHelperTestCase -{ - /** Application context */ - protected static final String[] CONFIG_LOCATIONS = new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:test-context.xml" - }; - protected ApplicationContext applicationContext; - - /** retrying transaction helper */ - protected RetryingTransactionHelper retryingTransactionHelper; - - /** - * @see org.alfresco.util.RetryingTransactionHelperTestCase#getRetryingTransactionHelper() - */ - @Override - public RetryingTransactionHelper getRetryingTransactionHelper() - { - return retryingTransactionHelper; - } - - /** - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception - { - // Get the application context - applicationContext = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS); - - // get the retrying transaction helper - retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.util.ApplicationContextHelper; +import org.alfresco.util.RetryingTransactionHelperTestCase; +import org.springframework.context.ApplicationContext; + +/** + * Base unit test for a simple retrying transaction helper test case. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RetryingTransactionHelperBaseTest extends RetryingTransactionHelperTestCase +{ + /** Application context */ + protected static final String[] CONFIG_LOCATIONS = new String[] + { + "classpath:alfresco/application-context.xml", + "classpath:test-context.xml" + }; + protected ApplicationContext applicationContext; + + /** retrying transaction helper */ + protected RetryingTransactionHelper retryingTransactionHelper; + + /** + * @see org.alfresco.util.RetryingTransactionHelperTestCase#getRetryingTransactionHelper() + */ + @Override + public RetryingTransactionHelper getRetryingTransactionHelper() + { + return retryingTransactionHelper; + } + + /** + * @see junit.framework.TestCase#setUp() + */ + @Override + protected void setUp() throws Exception + { + // Get the application context + applicationContext = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS); + + // get the retrying transaction helper + retryingTransactionHelper = (RetryingTransactionHelper)applicationContext.getBean("retryingTransactionHelper"); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java index 2e28720eba..928c7e5fc7 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java @@ -1,55 +1,55 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -public class TestAction extends RMActionExecuterAbstractBase -{ - public static final String NAME = "testAction"; - public static final String PARAM = "testActionParam"; - public static final String PARAM_VALUE = "value"; - - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - if (!action.getParameterValue(PARAM).equals(PARAM_VALUE)) - { - throw new RuntimeException("Unexpected parameter value. Expected " + PARAM_VALUE + " actual " + action.getParameterValue(PARAM)); - } - this.getNodeService().addAspect(actionedUponNodeRef, ASPECT_RECORD, null); - } - - @Override - public boolean isDispositionAction() - { - return true; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +public class TestAction extends RMActionExecuterAbstractBase +{ + public static final String NAME = "testAction"; + public static final String PARAM = "testActionParam"; + public static final String PARAM_VALUE = "value"; + + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + if (!action.getParameterValue(PARAM).equals(PARAM_VALUE)) + { + throw new RuntimeException("Unexpected parameter value. Expected " + PARAM_VALUE + " actual " + action.getParameterValue(PARAM)); + } + this.getNodeService().addAspect(actionedUponNodeRef, ASPECT_RECORD, null); + } + + @Override + public boolean isDispositionAction() + { + return true; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction2.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction2.java index 83162a19ef..07b681ace0 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction2.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction2.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -public class TestAction2 extends RMActionExecuterAbstractBase -{ - public static final String NAME = "testAction2"; - - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - // Do nothing - } - - @Override - public boolean isDispositionAction() - { - return false; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +public class TestAction2 extends RMActionExecuterAbstractBase +{ + public static final String NAME = "testAction2"; + + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + // Do nothing + } + + @Override + public boolean isDispositionAction() + { + return false; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionParams.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionParams.java index 77ff2947a8..452c32dea4 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionParams.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionParams.java @@ -1,49 +1,49 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -public class TestActionParams extends RMActionExecuterAbstractBase -{ - public static final String NAME = "testActionParams"; - public static final String PARAM_DATE = "paramDate"; - - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - Object dateValue = action.getParameterValue(PARAM_DATE); - if (!(dateValue instanceof java.util.Date)) - { - throw new AlfrescoRuntimeException("Param was not a Date as expected."); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; + +public class TestActionParams extends RMActionExecuterAbstractBase +{ + public static final String NAME = "testActionParams"; + public static final String PARAM_DATE = "paramDate"; + + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + Object dateValue = action.getParameterValue(PARAM_DATE); + if (!(dateValue instanceof java.util.Date)) + { + throw new AlfrescoRuntimeException("Param was not a Date as expected."); + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java index 9ca365aa83..e3854b32fc 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java @@ -1,111 +1,111 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.surf.util.I18NUtil; - -public class TestActionPropertySubs extends RMActionExecuterAbstractBase -{ - public static final String NAME = "testActionPropertySubs"; - - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl("dayShort", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("dayShort2", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("dayLong", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("dayNumber", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("dayYear", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("monthShort", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("monthShort2", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("monthLong", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("monthNumber", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("yearShort", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("yearShort2", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("yearLong", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("yearWeek", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("name", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("company", DataTypeDefinition.TEXT, false, "")); - paramList.add(new ParameterDefinitionImpl("combo", DataTypeDefinition.TEXT, false, "")); - } - - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - Date date = new Date(); - String dayShort = new SimpleDateFormat("EE").format(date); - String dayLong = new SimpleDateFormat("EEEE").format(date); - String dayNumber = new SimpleDateFormat("uu").format(date); - String dayYear = new SimpleDateFormat("DDD").format(date); - String monthShort = new SimpleDateFormat("MMM").format(date); - String monthLong = new SimpleDateFormat("MMMM").format(date); - String monthNumber = new SimpleDateFormat("MM").format(date); - String yearShort = new SimpleDateFormat("yy").format(date); - String yearLong = new SimpleDateFormat("yyyy").format(date); - String yearWeek = new SimpleDateFormat("ww").format(date); - String name = (String) getNodeService().getProperty(actionedUponNodeRef, ContentModel.PROP_NAME); - String company = I18NUtil.getMessage("test.company"); - - assertEquals(dayShort, (String) action.getParameterValue("dayShort")); - assertEquals(dayShort, (String) action.getParameterValue("dayShort2")); - assertEquals(dayLong, (String) action.getParameterValue("dayLong")); - assertEquals(dayNumber, (String) action.getParameterValue("dayNumber")); - assertEquals(dayYear, (String) action.getParameterValue("dayYear")); - assertEquals(monthShort, (String) action.getParameterValue("monthShort")); - assertEquals(monthShort, (String) action.getParameterValue("monthShort2")); - assertEquals(monthLong, (String) action.getParameterValue("monthLong")); - assertEquals(monthNumber, (String) action.getParameterValue("monthNumber")); - assertEquals(yearShort, (String) action.getParameterValue("yearShort")); - assertEquals(yearShort, (String) action.getParameterValue("yearShort2")); - assertEquals(yearLong, (String) action.getParameterValue("yearLong")); - assertEquals(yearWeek, (String) action.getParameterValue("yearWeek")); - assertEquals(name, (String)action.getParameterValue("name")); - assertEquals(company, (String)action.getParameterValue("company")); - assertEquals(yearLong + "/" + monthShort + "/" + name + "-" + company +".txt", (String) action.getParameterValue("combo")); - } - - private void assertEquals(String expected, String actual) - { - if (!expected.equals(actual)) - { - throw new AlfrescoRuntimeException("Expected value " + expected + " does not match actual value " + actual); - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +public class TestActionPropertySubs extends RMActionExecuterAbstractBase +{ + public static final String NAME = "testActionPropertySubs"; + + @Override + protected void addParameterDefinitions(List paramList) + { + paramList.add(new ParameterDefinitionImpl("dayShort", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("dayShort2", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("dayLong", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("dayNumber", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("dayYear", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("monthShort", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("monthShort2", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("monthLong", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("monthNumber", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("yearShort", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("yearShort2", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("yearLong", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("yearWeek", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("name", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("company", DataTypeDefinition.TEXT, false, "")); + paramList.add(new ParameterDefinitionImpl("combo", DataTypeDefinition.TEXT, false, "")); + } + + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + Date date = new Date(); + String dayShort = new SimpleDateFormat("EE").format(date); + String dayLong = new SimpleDateFormat("EEEE").format(date); + String dayNumber = new SimpleDateFormat("uu").format(date); + String dayYear = new SimpleDateFormat("DDD").format(date); + String monthShort = new SimpleDateFormat("MMM").format(date); + String monthLong = new SimpleDateFormat("MMMM").format(date); + String monthNumber = new SimpleDateFormat("MM").format(date); + String yearShort = new SimpleDateFormat("yy").format(date); + String yearLong = new SimpleDateFormat("yyyy").format(date); + String yearWeek = new SimpleDateFormat("ww").format(date); + String name = (String) getNodeService().getProperty(actionedUponNodeRef, ContentModel.PROP_NAME); + String company = I18NUtil.getMessage("test.company"); + + assertEquals(dayShort, (String) action.getParameterValue("dayShort")); + assertEquals(dayShort, (String) action.getParameterValue("dayShort2")); + assertEquals(dayLong, (String) action.getParameterValue("dayLong")); + assertEquals(dayNumber, (String) action.getParameterValue("dayNumber")); + assertEquals(dayYear, (String) action.getParameterValue("dayYear")); + assertEquals(monthShort, (String) action.getParameterValue("monthShort")); + assertEquals(monthShort, (String) action.getParameterValue("monthShort2")); + assertEquals(monthLong, (String) action.getParameterValue("monthLong")); + assertEquals(monthNumber, (String) action.getParameterValue("monthNumber")); + assertEquals(yearShort, (String) action.getParameterValue("yearShort")); + assertEquals(yearShort, (String) action.getParameterValue("yearShort2")); + assertEquals(yearLong, (String) action.getParameterValue("yearLong")); + assertEquals(yearWeek, (String) action.getParameterValue("yearWeek")); + assertEquals(name, (String)action.getParameterValue("name")); + assertEquals(company, (String)action.getParameterValue("company")); + assertEquals(yearLong + "/" + monthShort + "/" + name + "-" + company +".txt", (String) action.getParameterValue("combo")); + } + + private void assertEquals(String expected, String actual) + { + if (!expected.equals(actual)) + { + throw new AlfrescoRuntimeException("Expected value " + expected + " does not match actual value " + actual); + } + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestContentCleanser.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestContentCleanser.java index 5d5fb7caff..43894c8d97 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestContentCleanser.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestContentCleanser.java @@ -1,65 +1,65 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.io.File; - -import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser522022M; - -/** - * Test Content Cleanser - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class TestContentCleanser extends ContentCleanser522022M -{ - private boolean hasCleansed = false; - - public void reset() - { - hasCleansed = false; - } - - public boolean hasCleansed() - { - return hasCleansed; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) - */ - @Override - public void cleanse(File file) - { - hasCleansed = false; - super.cleanse(file); - hasCleansed = true; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.io.File; + +import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser522022M; + +/** + * Test Content Cleanser + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class TestContentCleanser extends ContentCleanser522022M +{ + private boolean hasCleansed = false; + + public void reset() + { + hasCleansed = false; + } + + public boolean hasCleansed() + { + return hasCleansed; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) + */ + @Override + public void cleanse(File file) + { + hasCleansed = false; + super.cleanse(file); + hasCleansed = true; + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestDmAction.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestDmAction.java index 8797525fed..ac8407aa8f 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestDmAction.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestDmAction.java @@ -1,52 +1,52 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.util.List; - -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * @author Roy Wetherall - * @since 2.1 - */ -public class TestDmAction extends ActionExecuterAbstractBase -{ - @Override - protected void executeImpl(Action action, NodeRef actionedUponNodeRef) - { - } - - @Override - protected void addParameterDefinitions(List paramDefs) - { - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.util.List; + +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * @author Roy Wetherall + * @since 2.1 + */ +public class TestDmAction extends ActionExecuterAbstractBase +{ + @Override + protected void executeImpl(Action action, NodeRef actionedUponNodeRef) + { + } + + @Override + protected void addParameterDefinitions(List paramDefs) + { + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java index 15e7c45939..b117bd07cb 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java @@ -1,44 +1,44 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - * @since 2.3 - */ -public interface TestModel -{ - public static final String TEST_URI = "http://www.alfresco.org/model/rmtest/1.0"; - public static final String TEST_PREFIX = "rmt"; - - public static final QName ASPECT_RECORD_METADATA = QName.createQName(TEST_URI, "recordMetaData"); - public static final QName PROPERTY_RECORD_METADATA = QName.createQName(TEST_URI, "recordMetaDataProperty"); - public static final QName NOT_RM_FOLDER_TYPE = QName.createQName(TEST_URI, "notRmFolderType"); -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 org.alfresco.service.namespace.QName; + +/** + * @author Roy Wetherall + * @since 2.3 + */ +public interface TestModel +{ + public static final String TEST_URI = "http://www.alfresco.org/model/rmtest/1.0"; + public static final String TEST_PREFIX = "rmt"; + + public static final QName ASPECT_RECORD_METADATA = QName.createQName(TEST_URI, "recordMetaData"); + public static final QName PROPERTY_RECORD_METADATA = QName.createQName(TEST_URI, "recordMetaDataProperty"); + public static final QName NOT_RM_FOLDER_TYPE = QName.createQName(TEST_URI, "notRmFolderType"); +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestService.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestService.java index 3c3d0ce5d3..aa689a492f 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestService.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestService.java @@ -1,38 +1,38 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 org.alfresco.service.cmr.repository.NodeRef; - -public interface TestService -{ - void testMethodOne(NodeRef nodeRef); - - void testMethodTwo(NodeRef nodeRef); - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 org.alfresco.service.cmr.repository.NodeRef; + +public interface TestService +{ + void testMethodOne(NodeRef nodeRef); + + void testMethodTwo(NodeRef nodeRef); + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestServiceImpl.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestServiceImpl.java index aeec7bce1e..85d6485a93 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestServiceImpl.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestServiceImpl.java @@ -1,66 +1,66 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - * @since 2.1 - */ -public class TestServiceImpl extends ServiceBaseImpl implements TestService -{ - @Override - public void testMethodOne(NodeRef nodeRef) - { - } - - @Override - public void testMethodTwo(NodeRef nodeRef) - { - } - - public boolean doInstanceOf(NodeRef nodeRef, QName ofClassName) - { - return instanceOf(nodeRef, ofClassName); - } - - public int doGetNextCount(NodeRef nodeRef) - { - return getNextCount(nodeRef); - } - - public Set doGetTypeAndApsects(NodeRef nodeRef) - { - return getTypeAndApsects(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * @author Roy Wetherall + * @since 2.1 + */ +public class TestServiceImpl extends ServiceBaseImpl implements TestService +{ + @Override + public void testMethodOne(NodeRef nodeRef) + { + } + + @Override + public void testMethodTwo(NodeRef nodeRef) + { + } + + public boolean doInstanceOf(NodeRef nodeRef, QName ofClassName) + { + return instanceOf(nodeRef, ofClassName); + } + + public int doGetNextCount(NodeRef nodeRef) + { + return getNextCount(nodeRef); + } + + public Set doGetTypeAndApsects(NodeRef nodeRef) + { + return getTypeAndApsects(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestWebScriptRepoServer.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestWebScriptRepoServer.java index 9dfe1bf418..408f1cb981 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestWebScriptRepoServer.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestWebScriptRepoServer.java @@ -1,229 +1,229 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.alfresco.repo.security.authentication.AuthenticationException; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.security.AuthenticationService; -import org.alfresco.util.EqualsHelper; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.extensions.webscripts.TestWebScriptServer; - -/** - * Stand-alone Web Script Test Server - * - * @author davidc - */ -public class TestWebScriptRepoServer extends TestWebScriptServer -{ - /** - * Main entry point. - */ - public static void main(String[] args) - { - try - { - TestWebScriptServer testServer = getTestServer(); - AuthenticationUtil.setRunAsUserSystem(); - testServer.rep(); - } - catch(Throwable e) - { - StringWriter strWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter(strWriter); - e.printStackTrace(printWriter); - System.out.println(strWriter.toString()); - } - finally - { - System.exit(0); - } - } - - private final static String[] CONFIG_LOCATIONS = new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:alfresco/web-scripts-application-context.xml", - "classpath:alfresco/web-scripts-application-context-test.xml" - }; - - /** A static reference to the application context being used */ - private static ClassPathXmlApplicationContext ctx; - private static String appendedTestConfiguration; - - private RetryingTransactionHelper retryingTransactionHelper; - private AuthenticationService authenticationService; - - - /** - * Sets helper that provides transaction callbacks - */ - public void setTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) - { - this.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * @param authenticationService - */ - public void setAuthenticationService(AuthenticationService authenticationService) - { - this.authenticationService = authenticationService; - } - - /** - * Get default user name - */ - protected String getDefaultUserName() - { - return AuthenticationUtil.getAdminUserName(); - } - - /** - * {@inheritDoc #getTestServer(String)} - */ - public static TestWebScriptServer getTestServer() - { - return getTestServer(null); - } - - /** - * Start up a context and get the server bean. - *

- * This method will close and restart the application context only if the configuration has - * changed. - * - * @param appendTestConfigLocation additional context file to include in the application context - * @return Test Server - */ - public static synchronized TestWebScriptServer getTestServer(String appendTestConfigLocation) - { - if (TestWebScriptRepoServer.ctx != null) - { - boolean configChanged = !EqualsHelper.nullSafeEquals( - appendTestConfigLocation, - TestWebScriptRepoServer.appendedTestConfiguration); - if (configChanged) - { - // The config changed, so close the context (it'll be restarted later) - try - { - ctx.close(); - ctx = null; - } - catch (Throwable e) - { - throw new RuntimeException("Failed to shut down existing application context", e); - } - } - else - { - // There is already a context with the required configuration - } - } - - // Check if we need to start/restart the context - if (TestWebScriptRepoServer.ctx == null) - { - // Restart it - final String[] configLocations; - if (appendTestConfigLocation == null) - { - configLocations = CONFIG_LOCATIONS; - } - else - { - configLocations = new String[CONFIG_LOCATIONS.length+1]; - System.arraycopy(CONFIG_LOCATIONS, 0, configLocations, 0, CONFIG_LOCATIONS.length); - configLocations[CONFIG_LOCATIONS.length] = appendTestConfigLocation; - } - TestWebScriptRepoServer.ctx = new ClassPathXmlApplicationContext(configLocations); - TestWebScriptRepoServer.appendedTestConfiguration = appendTestConfigLocation; - } - - // Get the bean - TestWebScriptServer testServer = (org.alfresco.repo.web.scripts.TestWebScriptRepoServer)TestWebScriptRepoServer.ctx.getBean("webscripts.test"); - return testServer; - } - - /** - * Interpret a single command using the BufferedReader passed in for any data needed. - * - * @param line The unparsed command - * @return The textual output of the command. - */ - @Override - protected String interpretCommand(final String line) - throws IOException - { - try - { - if (username.startsWith("TICKET_")) - { - try - { - retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() - { - public Object execute() throws Exception - { - authenticationService.validate(username); - return null; - } - }); - return executeCommand(line); - } - finally - { - authenticationService.clearCurrentSecurityContext(); - } - } - } - catch(AuthenticationException e) - { - executeCommand("user " + getDefaultUserName()); - } - - // execute command in context of currently selected user - return AuthenticationUtil.runAs(new RunAsWork() - { - @SuppressWarnings("synthetic-access") - public String doWork() throws Exception - { - return executeCommand(line); - } - }, username); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.alfresco.repo.security.authentication.AuthenticationException; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.security.AuthenticationService; +import org.alfresco.util.EqualsHelper; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.extensions.webscripts.TestWebScriptServer; + +/** + * Stand-alone Web Script Test Server + * + * @author davidc + */ +public class TestWebScriptRepoServer extends TestWebScriptServer +{ + /** + * Main entry point. + */ + public static void main(String[] args) + { + try + { + TestWebScriptServer testServer = getTestServer(); + AuthenticationUtil.setRunAsUserSystem(); + testServer.rep(); + } + catch(Throwable e) + { + StringWriter strWriter = new StringWriter(); + PrintWriter printWriter = new PrintWriter(strWriter); + e.printStackTrace(printWriter); + System.out.println(strWriter.toString()); + } + finally + { + System.exit(0); + } + } + + private final static String[] CONFIG_LOCATIONS = new String[] + { + "classpath:alfresco/application-context.xml", + "classpath:alfresco/web-scripts-application-context.xml", + "classpath:alfresco/web-scripts-application-context-test.xml" + }; + + /** A static reference to the application context being used */ + private static ClassPathXmlApplicationContext ctx; + private static String appendedTestConfiguration; + + private RetryingTransactionHelper retryingTransactionHelper; + private AuthenticationService authenticationService; + + + /** + * Sets helper that provides transaction callbacks + */ + public void setTransactionHelper(RetryingTransactionHelper retryingTransactionHelper) + { + this.retryingTransactionHelper = retryingTransactionHelper; + } + + /** + * @param authenticationService + */ + public void setAuthenticationService(AuthenticationService authenticationService) + { + this.authenticationService = authenticationService; + } + + /** + * Get default user name + */ + protected String getDefaultUserName() + { + return AuthenticationUtil.getAdminUserName(); + } + + /** + * {@inheritDoc #getTestServer(String)} + */ + public static TestWebScriptServer getTestServer() + { + return getTestServer(null); + } + + /** + * Start up a context and get the server bean. + *

+ * This method will close and restart the application context only if the configuration has + * changed. + * + * @param appendTestConfigLocation additional context file to include in the application context + * @return Test Server + */ + public static synchronized TestWebScriptServer getTestServer(String appendTestConfigLocation) + { + if (TestWebScriptRepoServer.ctx != null) + { + boolean configChanged = !EqualsHelper.nullSafeEquals( + appendTestConfigLocation, + TestWebScriptRepoServer.appendedTestConfiguration); + if (configChanged) + { + // The config changed, so close the context (it'll be restarted later) + try + { + ctx.close(); + ctx = null; + } + catch (Throwable e) + { + throw new RuntimeException("Failed to shut down existing application context", e); + } + } + else + { + // There is already a context with the required configuration + } + } + + // Check if we need to start/restart the context + if (TestWebScriptRepoServer.ctx == null) + { + // Restart it + final String[] configLocations; + if (appendTestConfigLocation == null) + { + configLocations = CONFIG_LOCATIONS; + } + else + { + configLocations = new String[CONFIG_LOCATIONS.length+1]; + System.arraycopy(CONFIG_LOCATIONS, 0, configLocations, 0, CONFIG_LOCATIONS.length); + configLocations[CONFIG_LOCATIONS.length] = appendTestConfigLocation; + } + TestWebScriptRepoServer.ctx = new ClassPathXmlApplicationContext(configLocations); + TestWebScriptRepoServer.appendedTestConfiguration = appendTestConfigLocation; + } + + // Get the bean + TestWebScriptServer testServer = (org.alfresco.repo.web.scripts.TestWebScriptRepoServer)TestWebScriptRepoServer.ctx.getBean("webscripts.test"); + return testServer; + } + + /** + * Interpret a single command using the BufferedReader passed in for any data needed. + * + * @param line The unparsed command + * @return The textual output of the command. + */ + @Override + protected String interpretCommand(final String line) + throws IOException + { + try + { + if (username.startsWith("TICKET_")) + { + try + { + retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback() + { + public Object execute() throws Exception + { + authenticationService.validate(username); + return null; + } + }); + return executeCommand(line); + } + finally + { + authenticationService.clearCurrentSecurityContext(); + } + } + } + catch(AuthenticationException e) + { + executeCommand("user " + getDefaultUserName()); + } + + // execute command in context of currently selected user + return AuthenticationUtil.runAs(new RunAsWork() + { + @SuppressWarnings("synthetic-access") + public String doWork() throws Exception + { + return executeCommand(line); + } + }, username); + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/BehaviourTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/BehaviourTest.java index 7ba8091d4a..e77dc8a92f 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/BehaviourTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/BehaviourTest.java @@ -1,276 +1,276 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bdt; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; - -/** - * Helper class that provides an simple way to write behaviour integration tests. - *

- * Note that initBehaviourTest() must be called before given() is called. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class BehaviourTest -{ - /** retrying transaction helper */ - private static RetryingTransactionHelper retryingTransactionHelper; - - /** current execution user */ - private String asUser = AuthenticationUtil.getAdminUserName(); - - /** - * Initialise behaviour tests for execution with retrying transaction helper - * - * @param retryingTransactionHelper retrying transaction helper - */ - public static void initBehaviourTests(RetryingTransactionHelper retryingTransactionHelper) - { - BehaviourTest.retryingTransactionHelper = retryingTransactionHelper; - } - - /** - * Start a test - * - * @return BehaviourTest new test instance - */ - public static BehaviourTest test() - { - return new BehaviourTest(); - } - - /** - * Helper method to get the retrying transaction helper - * - * @return RetryingTransactionHelper retrying transaction helper - */ - /*package*/ RetryingTransactionHelper getRetryingTransactionHelper() - { - return retryingTransactionHelper; - } - - /** - * Helper method to get the execution user - * - * @return String execution user - */ - /* package*/ String getAsUser() - { - return asUser; - } - - /** - * Helper method to switch the current execution user to admin. - * - * @return BehaviourTest test instance - */ - public BehaviourTest asAdmin() - { - return as(AuthenticationUtil.getAdminUserName()); - } - - /** - * Set execution user - * - * @param asUser execution user - * @return BehaviourTest test instance - */ - public BehaviourTest as(String asUser) - { - this.asUser = asUser; - return this; - } - - /** - * Given. - *

- * Used to group together given conditions. - * - * @return BehaviourTest test instance - */ - public BehaviourTest given() - { - return this; - } - - /** - * Given. - *

- * Performs work. - * - * @param given work to do - * @return BehaviourTest test instance - */ - public BehaviourTest given(Work given) - { - return perform(given); - } - - /** - * When. - *

- * Used to group together when actions. - * - * @return BehaviourTest test instance - */ - public BehaviourTest when() - { - return this; - } - - /** - * When. - *

- * Performs work. - * - * @param when work to do - * @return BehaviourTest test instance - */ - public BehaviourTest when(Work when) - { - return perform(when); - } - - /** - * Then. - *

- * Used to group together then actions. - * - * @return BehaviourTest test instance - */ - public BehaviourTest then() - { - return this; - } - - /** - * Then. - *

- * Performs work. - * - * @param then work to do - * @return BehaviourTest test instance - */ - public BehaviourTest then(Work then) - { - return perform(then); - } - - /** - * Expect a value. - * - * @param value value - * @return ExpectedValue expected value evaluator - */ - public ExpectedValue expect(boolean value) - { - return new ExpectedValue(this, value); - } - - /** - * Expect a value. - * - * @param value value - * @return ExpectedValue expected value evaluator - */ - public ExpectedValue expect(String value) - { - return new ExpectedValue(this, value); - } - - /** - * Expect a value. - * - * @param value value - * @return ExpectedValue expected value evaluator - */ - public ExpectedValue expect(Object value) - { - return new ExpectedValue(this, value); - } - - - /** - * Expect a failure. - * - * @param exceptionClass expected exception - * @return ExpectedFailure expected failure evaluator - */ - public ExpectedFailure expectException(Class exceptionClass) - { - return new ExpectedFailure(this, exceptionClass); - } - - /** - * Perform work a number of times - * - * @param count number of times to perform the work - * @param work work to perform - * @return BehaviourTest test instance - */ - public BehaviourTest perform(int count, Work work) - { - for (int i = 0; i < count; i++) - { - perform(work); - } - - return this; - } - - /** - * Perform work - * - * @param work work to perform - * @return BehaviourTest test instance - */ - public BehaviourTest perform(Work work) - { - return AuthenticationUtil.runAs(() -> - { - return retryingTransactionHelper.doInTransaction(() -> - { - work.doIt(); - return this; - }); - }, - this.asUser); - } - - /** - * Work Interface - */ - public interface Work - { - /** - * Do the work. - */ - void doIt() throws Exception; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bdt; + +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper; + +/** + * Helper class that provides an simple way to write behaviour integration tests. + *

+ * Note that initBehaviourTest() must be called before given() is called. + * + * @author Roy Wetherall + * @since 2.5 + */ +public class BehaviourTest +{ + /** retrying transaction helper */ + private static RetryingTransactionHelper retryingTransactionHelper; + + /** current execution user */ + private String asUser = AuthenticationUtil.getAdminUserName(); + + /** + * Initialise behaviour tests for execution with retrying transaction helper + * + * @param retryingTransactionHelper retrying transaction helper + */ + public static void initBehaviourTests(RetryingTransactionHelper retryingTransactionHelper) + { + BehaviourTest.retryingTransactionHelper = retryingTransactionHelper; + } + + /** + * Start a test + * + * @return BehaviourTest new test instance + */ + public static BehaviourTest test() + { + return new BehaviourTest(); + } + + /** + * Helper method to get the retrying transaction helper + * + * @return RetryingTransactionHelper retrying transaction helper + */ + /*package*/ RetryingTransactionHelper getRetryingTransactionHelper() + { + return retryingTransactionHelper; + } + + /** + * Helper method to get the execution user + * + * @return String execution user + */ + /* package*/ String getAsUser() + { + return asUser; + } + + /** + * Helper method to switch the current execution user to admin. + * + * @return BehaviourTest test instance + */ + public BehaviourTest asAdmin() + { + return as(AuthenticationUtil.getAdminUserName()); + } + + /** + * Set execution user + * + * @param asUser execution user + * @return BehaviourTest test instance + */ + public BehaviourTest as(String asUser) + { + this.asUser = asUser; + return this; + } + + /** + * Given. + *

+ * Used to group together given conditions. + * + * @return BehaviourTest test instance + */ + public BehaviourTest given() + { + return this; + } + + /** + * Given. + *

+ * Performs work. + * + * @param given work to do + * @return BehaviourTest test instance + */ + public BehaviourTest given(Work given) + { + return perform(given); + } + + /** + * When. + *

+ * Used to group together when actions. + * + * @return BehaviourTest test instance + */ + public BehaviourTest when() + { + return this; + } + + /** + * When. + *

+ * Performs work. + * + * @param when work to do + * @return BehaviourTest test instance + */ + public BehaviourTest when(Work when) + { + return perform(when); + } + + /** + * Then. + *

+ * Used to group together then actions. + * + * @return BehaviourTest test instance + */ + public BehaviourTest then() + { + return this; + } + + /** + * Then. + *

+ * Performs work. + * + * @param then work to do + * @return BehaviourTest test instance + */ + public BehaviourTest then(Work then) + { + return perform(then); + } + + /** + * Expect a value. + * + * @param value value + * @return ExpectedValue expected value evaluator + */ + public ExpectedValue expect(boolean value) + { + return new ExpectedValue(this, value); + } + + /** + * Expect a value. + * + * @param value value + * @return ExpectedValue expected value evaluator + */ + public ExpectedValue expect(String value) + { + return new ExpectedValue(this, value); + } + + /** + * Expect a value. + * + * @param value value + * @return ExpectedValue expected value evaluator + */ + public ExpectedValue expect(Object value) + { + return new ExpectedValue(this, value); + } + + + /** + * Expect a failure. + * + * @param exceptionClass expected exception + * @return ExpectedFailure expected failure evaluator + */ + public ExpectedFailure expectException(Class exceptionClass) + { + return new ExpectedFailure(this, exceptionClass); + } + + /** + * Perform work a number of times + * + * @param count number of times to perform the work + * @param work work to perform + * @return BehaviourTest test instance + */ + public BehaviourTest perform(int count, Work work) + { + for (int i = 0; i < count; i++) + { + perform(work); + } + + return this; + } + + /** + * Perform work + * + * @param work work to perform + * @return BehaviourTest test instance + */ + public BehaviourTest perform(Work work) + { + return AuthenticationUtil.runAs(() -> + { + return retryingTransactionHelper.doInTransaction(() -> + { + work.doIt(); + return this; + }); + }, + this.asUser); + } + + /** + * Work Interface + */ + public interface Work + { + /** + * Do the work. + */ + void doIt() throws Exception; + } +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedFailure.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedFailure.java index 33c5662d98..9377402aaf 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedFailure.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedFailure.java @@ -1,92 +1,92 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bdt; - -import static org.junit.Assert.fail; - -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; - -import org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.Work; - -/** - * Expected failure. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class ExpectedFailure -{ - private static final String MESSAGE = "Expected failure \"{0}\" was not observed."; - - private BehaviourTest test; - private Set> exceptionClasses; - private Work work; - - @SafeVarargs - public ExpectedFailure(BehaviourTest test, Class ...exceptionClasses) - { - this.test = test; - this.exceptionClasses = Arrays.stream(exceptionClasses).collect(Collectors.toSet()); - } - - public ExpectedFailure from(Work work) - { - this.work = work; - return this; - } - - public BehaviourTest because(String message) - { - try - { - test.perform(work); - } - catch(Exception actualException) - { - boolean found = false; - - for (Class exceptionClass : exceptionClasses) - { - if (exceptionClass.isAssignableFrom(actualException.getClass())) - { - found = true; - } - } - - if (!found) - { - fail(MessageFormat.format(MESSAGE, message)); - } - } - - return test; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bdt; + +import static org.junit.Assert.fail; + +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.Set; +import java.util.stream.Collectors; + +import org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.Work; + +/** + * Expected failure. + * + * @author Roy Wetherall + * @since 2.5 + */ +public class ExpectedFailure +{ + private static final String MESSAGE = "Expected failure \"{0}\" was not observed."; + + private BehaviourTest test; + private Set> exceptionClasses; + private Work work; + + @SafeVarargs + public ExpectedFailure(BehaviourTest test, Class ...exceptionClasses) + { + this.test = test; + this.exceptionClasses = Arrays.stream(exceptionClasses).collect(Collectors.toSet()); + } + + public ExpectedFailure from(Work work) + { + this.work = work; + return this; + } + + public BehaviourTest because(String message) + { + try + { + test.perform(work); + } + catch(Exception actualException) + { + boolean found = false; + + for (Class exceptionClass : exceptionClasses) + { + if (exceptionClass.isAssignableFrom(actualException.getClass())) + { + found = true; + } + } + + if (!found) + { + fail(MessageFormat.format(MESSAGE, message)); + } + } + + return test; + } + +} diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedValue.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedValue.java index 8935696c23..dd72955d2c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedValue.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/bdt/ExpectedValue.java @@ -1,86 +1,86 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bdt; - -import static org.junit.Assert.assertEquals; - -import java.text.MessageFormat; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; - -/** - * Expected value. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class ExpectedValue -{ - private static final String MESSAGE = "Expected value outcome \"{0}\" was not observed."; - - private T expectedValue; - private Evaluation evaluation; - private BehaviourTest test; - - public ExpectedValue(BehaviourTest test, T value) - { - this.expectedValue = value; - this.test = test; - } - - public ExpectedValue from(Evaluation evaluation) - { - this.evaluation = evaluation; - return this; - } - - public BehaviourTest because(String message) - { - T actualValue = (T)AuthenticationUtil.runAs(() -> - { - return test.getRetryingTransactionHelper().doInTransaction(() -> - { - return evaluation.eval(); - }); - }, - test.getAsUser()); - - if (message != null) - { - message = MessageFormat.format(MESSAGE, message); - } - - assertEquals(message, expectedValue, actualValue); - - return test; - } - - public interface Evaluation - { - T eval() throws Exception; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bdt; + +import static org.junit.Assert.assertEquals; + +import java.text.MessageFormat; + +import org.alfresco.repo.security.authentication.AuthenticationUtil; + +/** + * Expected value. + * + * @author Roy Wetherall + * @since 2.5 + */ +public class ExpectedValue +{ + private static final String MESSAGE = "Expected value outcome \"{0}\" was not observed."; + + private T expectedValue; + private Evaluation evaluation; + private BehaviourTest test; + + public ExpectedValue(BehaviourTest test, T value) + { + this.expectedValue = value; + this.test = test; + } + + public ExpectedValue from(Evaluation evaluation) + { + this.evaluation = evaluation; + return this; + } + + public BehaviourTest because(String message) + { + T actualValue = (T)AuthenticationUtil.runAs(() -> + { + return test.getRetryingTransactionHelper().doInTransaction(() -> + { + return evaluation.eval(); + }); + }, + test.getAsUser()); + + if (message != null) + { + message = MessageFormat.format(MESSAGE, message); + } + + assertEquals(message, expectedValue, actualValue); + + return test; + } + + public interface Evaluation + { + T eval() throws Exception; + } +} diff --git a/rm-community/rm-community-repo/test/resources/alfresco/extension/rm-method-security.properties b/rm-community/rm-community-repo/test/resources/alfresco/extension/rm-method-security.properties index f1427d4545..0e1e0079dc 100644 --- a/rm-community/rm-community-repo/test/resources/alfresco/extension/rm-method-security.properties +++ b/rm-community/rm-community-repo/test/resources/alfresco/extension/rm-method-security.properties @@ -1,2 +1,2 @@ -rm.methodsecurity.org.alfresco.module.org_alfresco_module_rm.test.util.TestService.testMethodOne=RM_ALLOW +rm.methodsecurity.org.alfresco.module.org_alfresco_module_rm.test.util.TestService.testMethodOne=RM_ALLOW rm.methodsecurity.org.alfresco.module.org_alfresco_module_rm.test.util.TestService.*=RM_DENY \ No newline at end of file diff --git a/rm-community/rm-community-repo/test/resources/org/alfresco/repository/generic-paged-results.lib.ftl b/rm-community/rm-community-repo/test/resources/org/alfresco/repository/generic-paged-results.lib.ftl index b526c80a19..010ce82bba 100644 --- a/rm-community/rm-community-repo/test/resources/org/alfresco/repository/generic-paged-results.lib.ftl +++ b/rm-community/rm-community-repo/test/resources/org/alfresco/repository/generic-paged-results.lib.ftl @@ -1,39 +1,39 @@ -<#-- - #%L - Alfresco Records Management Module - %% - Copyright (C) 2005 - 2016 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% ---> -<#macro pagedResults data> - "total": ${data.total?c}, - "pageSize": ${data.pageSize?c}, - "startIndex": ${data.startIndex?c}, - "itemCount": ${data.itemCount?c}, - "items": - [ - <#list data.items as item> - <#nested item> - <#if item_has_next>, - - ] - +<#-- + #%L + Alfresco Records Management Module + %% + Copyright (C) 2005 - 2016 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% +--> +<#macro pagedResults data> + "total": ${data.total?c}, + "pageSize": ${data.pageSize?c}, + "startIndex": ${data.startIndex?c}, + "itemCount": ${data.itemCount?c}, + "items": + [ + <#list data.items as item> + <#nested item> + <#if item_has_next>, + + ] + diff --git a/rm-community/rm-community-repo/test/resources/test-context.xml b/rm-community/rm-community-repo/test/resources/test-context.xml index 1035796f12..58b4aa0fee 100644 --- a/rm-community/rm-community-repo/test/resources/test-context.xml +++ b/rm-community/rm-community-repo/test/resources/test-context.xml @@ -1,249 +1,249 @@ - - - - - - - - - - test-model.xml - - - - - - - - - - test - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - RECORD - RECORD_FOLDER - - - - - - - - - - - - - - - - - - - - RECORD - - - - - - - - - - - - - - 0 30 3 * * ? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.test.util.TestService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - Search - - - buildonly - - - - manager - - - - - - - - + + + + + + + + + + test-model.xml + + + + + + + + + + test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + RECORD + RECORD_FOLDER + + + + + + + + + + + + + + + + + + + + RECORD + + + + + + + + + + + + + + 0 30 3 * * ? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.module.org_alfresco_module_rm.test.util.TestService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + Search + + + buildonly + + + + manager + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/test/resources/test-filePlan.xml b/rm-community/rm-community-repo/test/resources/test-filePlan.xml index b12a93f680..89054370b1 100644 --- a/rm-community/rm-community-repo/test/resources/test-filePlan.xml +++ b/rm-community/rm-community-repo/test/resources/test-filePlan.xml @@ -1,285 +1,285 @@ - - - - - - TestRecordCategory1 - 0001 - TestRecordCategory1 - TestRecordCategory1 description - - - - - - - - - TestRecordCategory11 - 0001-01 - TestRecordCategory11 - TestRecordCategory11 description - week|1 - true - - - - - - T0-000-00-1 item 001 - Cut off monthly, hold 1 month, then destroy. - - - - - - cutoff - monthend|1 - - - - - destroy - month|1 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - TestRecordFolder1 - TestRecordFolder1 - 0001-01-01 - week|1 - true - - - - - TestRecordFolder2 - TestRecordFolder2 - 0001-01-02 - week|1 - true - - - - - - - - - - - TestRecordCategory12 - 0001-02 - TestRecordCategory12 - TestRecordCategory12 description - - - - - - T0-000-00-1 item 002 - Cut off every 3 months, hold 3 months, then destroy. - - - - - - cutoff - quarterend|1 - - - - - destroy - month|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - TestRecordFolder3 - 0001-02-01 - TestRecordFolder3 - - - - - - - - - - - TestRecordCategory13 - 0001-03 - TestRecordCategory13 - TestRecordCategory13 description - - - - - - T0-000-00-1 item 003 - Cut off at end of FY, hold 3 years, then destroy. - - - - - - cutoff - fyend|1 - - - - - destroy - year|3 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - TestRecordCategory2 - 0002 - TestRecordCategory2 - TestRecordCategory2 description - - - - - - - - - TestRecordCategory21 - 0002-01 - TestRecordCategory21 - TestRecordCategory21 description - - - - - - T0-000-00-2 item 001 - Cut off when superseded, hold 5 years, then destroy. - true - - - - - - cutoff - superseded - - - - - destroy - year|5 - {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate - - - - - - - - - - - - - - TestRecordCategory22 - 0002-02 - TestRecordCategory22 - TestRecordCategory22 description - - - - - - T0-000-00-2 item 002 - Cut off when no longer needed and destroy immediately. - - - - - - cutoff - no_longer_needed - - - - - destroy - immediately|0 - - - - - - - - - - TestRecordFolder4 - 0002-02-01 - TestRecordFolder4 - - - - - TestRecordFolder5 - 0002-02-02 - TestRecordFolder5 - - - - - - - - + + + + + + TestRecordCategory1 + 0001 + TestRecordCategory1 + TestRecordCategory1 description + + + + + + + + + TestRecordCategory11 + 0001-01 + TestRecordCategory11 + TestRecordCategory11 description + week|1 + true + + + + + + T0-000-00-1 item 001 + Cut off monthly, hold 1 month, then destroy. + + + + + + cutoff + monthend|1 + + + + + destroy + month|1 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + TestRecordFolder1 + TestRecordFolder1 + 0001-01-01 + week|1 + true + + + + + TestRecordFolder2 + TestRecordFolder2 + 0001-01-02 + week|1 + true + + + + + + + + + + + TestRecordCategory12 + 0001-02 + TestRecordCategory12 + TestRecordCategory12 description + + + + + + T0-000-00-1 item 002 + Cut off every 3 months, hold 3 months, then destroy. + + + + + + cutoff + quarterend|1 + + + + + destroy + month|3 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + TestRecordFolder3 + 0001-02-01 + TestRecordFolder3 + + + + + + + + + + + TestRecordCategory13 + 0001-03 + TestRecordCategory13 + TestRecordCategory13 description + + + + + + T0-000-00-1 item 003 + Cut off at end of FY, hold 3 years, then destroy. + + + + + + cutoff + fyend|1 + + + + + destroy + year|3 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + + + TestRecordCategory2 + 0002 + TestRecordCategory2 + TestRecordCategory2 description + + + + + + + + + TestRecordCategory21 + 0002-01 + TestRecordCategory21 + TestRecordCategory21 description + + + + + + T0-000-00-2 item 001 + Cut off when superseded, hold 5 years, then destroy. + true + + + + + + cutoff + superseded + + + + + destroy + year|5 + {http://www.alfresco.org/model/recordsmanagement/1.0}cutOffDate + + + + + + + + + + + + + + TestRecordCategory22 + 0002-02 + TestRecordCategory22 + TestRecordCategory22 description + + + + + + T0-000-00-2 item 002 + Cut off when no longer needed and destroy immediately. + + + + + + cutoff + no_longer_needed + + + + + destroy + immediately|0 + + + + + + + + + + TestRecordFolder4 + 0002-02-01 + TestRecordFolder4 + + + + + TestRecordFolder5 + 0002-02-02 + TestRecordFolder5 + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/test/resources/test-job-context.xml b/rm-community/rm-community-repo/test/resources/test-job-context.xml index 2cfee8877d..ea535d5f17 100644 --- a/rm-community/rm-community-repo/test/resources/test-job-context.xml +++ b/rm-community/rm-community-repo/test/resources/test-job-context.xml @@ -1,18 +1,18 @@ - - - - - - - - - - - - - - 0/30 * * * * ? - - - + + + + + + + + + + + + + + 0/30 * * * * ? + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/test/resources/test-model.xml b/rm-community/rm-community-repo/test/resources/test-model.xml index 9eafa717a3..b1686f5c6e 100644 --- a/rm-community/rm-community-repo/test/resources/test-model.xml +++ b/rm-community/rm-community-repo/test/resources/test-model.xml @@ -1,72 +1,72 @@ - - - - - RM Test Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - cm:content - - - cm:folder - - - - - - - - - - - - - d:text - - - d:text - - - - - - - - d:text - - - - - - - - d:text - true - - - - - - + + + + + RM Test Model + Roy Wetherall + 1.0 + + + + + + + + + + + + + + + + + + + + + + cm:content + + + cm:folder + + + + + + + + + + + + + d:text + + + d:text + + + + + + + + d:text + + + + + + + + d:text + true + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/test/resources/test-rm3314-context.xml b/rm-community/rm-community-repo/test/resources/test-rm3314-context.xml index 5b72399d04..a01ac698f5 100644 --- a/rm-community/rm-community-repo/test/resources/test-rm3314-context.xml +++ b/rm-community/rm-community-repo/test/resources/test-rm3314-context.xml @@ -1,27 +1,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/test/resources/test.properties b/rm-community/rm-community-repo/test/resources/test.properties index 2242a41e9f..c988e45267 100644 --- a/rm-community/rm-community-repo/test/resources/test.properties +++ b/rm-community/rm-community-repo/test/resources/test.properties @@ -1 +1 @@ -test.company=Alfresco +test.company=Alfresco diff --git a/rm-community/rm-community-repo/test/resources/testCaveatConfig1.json b/rm-community/rm-community-repo/test/resources/testCaveatConfig1.json index 1fac03e309..a7c77f4894 100644 --- a/rm-community/rm-community-repo/test/resources/testCaveatConfig1.json +++ b/rm-community/rm-community-repo/test/resources/testCaveatConfig1.json @@ -1,8 +1,8 @@ -{ - "rmc:prjList": { - "admin" : ["Project A", "Project B", "Project C"] - }, - "rmc:smList": { - "admin" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"] - } -} +{ + "rmc:prjList": { + "admin" : ["Project A", "Project B", "Project C"] + }, + "rmc:smList": { + "admin" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"] + } +} diff --git a/rm-community/rm-community-repo/test/resources/testCaveatConfig2.json b/rm-community/rm-community-repo/test/resources/testCaveatConfig2.json index fec003535f..6d0dbfea80 100644 --- a/rm-community/rm-community-repo/test/resources/testCaveatConfig2.json +++ b/rm-community/rm-community-repo/test/resources/testCaveatConfig2.json @@ -1,27 +1,27 @@ -{ - "rmc:prjList": { - "dmartinz" : ["Project A", "Project B", "Project C"], - "jrogers" : ["Project A", "Project B"], - "GROUP_Engineering" : ["Project A"], - "dfranco" : ["Project A", "Project C"], - "admin" : ["Project A", "Project B", "Project C"], - "GROUP_Finance" : ["Project C"] - }, - "rmc:smList": { - "jrangel" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], - "dmartinz" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], - "jrogers" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], - "hmcneil" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], - "dfranco" : ["NOFORN", "FOUO"], - "gsmith" : ["NOFORN", "FOUO"], - "eharris" : ["NOCONTRACT", "FOUO"], - "bbayless" : ["NOCONTRACT", "FOUO"], - "mhouse" : ["NOCONTRACT", "FOUO"], - "aly" : ["FOUO"], - "dsandy" : ["FGI"], - "driggs" : ["NOFORN"], - "admin" : ["FOUO", "NOFORN"], - "test1" : ["NOCONTRACT"], - "GROUP_test1" : ["NOCONTRACT"] - } -} +{ + "rmc:prjList": { + "dmartinz" : ["Project A", "Project B", "Project C"], + "jrogers" : ["Project A", "Project B"], + "GROUP_Engineering" : ["Project A"], + "dfranco" : ["Project A", "Project C"], + "admin" : ["Project A", "Project B", "Project C"], + "GROUP_Finance" : ["Project C"] + }, + "rmc:smList": { + "jrangel" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], + "dmartinz" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], + "jrogers" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], + "hmcneil" : ["NOFORN", "NOCONTRACT", "FOUO", "FGI"], + "dfranco" : ["NOFORN", "FOUO"], + "gsmith" : ["NOFORN", "FOUO"], + "eharris" : ["NOCONTRACT", "FOUO"], + "bbayless" : ["NOCONTRACT", "FOUO"], + "mhouse" : ["NOCONTRACT", "FOUO"], + "aly" : ["FOUO"], + "dsandy" : ["FGI"], + "driggs" : ["NOFORN"], + "admin" : ["FOUO", "NOFORN"], + "test1" : ["NOCONTRACT"], + "GROUP_test1" : ["NOCONTRACT"] + } +} diff --git a/rm-community/rm-community-repo/tomcat/context.xml b/rm-community/rm-community-repo/tomcat/context.xml index 298d524489..3a6aef298e 100644 --- a/rm-community/rm-community-repo/tomcat/context.xml +++ b/rm-community/rm-community-repo/tomcat/context.xml @@ -1,31 +1,31 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java index 1579b93d70..5a582e0f18 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java @@ -1,63 +1,63 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action; - -import static org.mockito.Mockito.doReturn; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.action.Action; -import org.mockito.Mock; - -/** - * Declare as version record action unit test. - * - * @author Roy Wetherall - * @since 2.3 - */ -public abstract class BaseActionUnitTest extends BaseUnitTest -{ - /** mocked action */ - private @Mock Action mockedAction; - - /** - * @return mocked action - */ - protected Action getMockedAction() - { - return mockedAction; - } - - /** - * Helper to mock an action parameter value - */ - protected void mockActionParameterValue(String name, Object value) - { - doReturn(value).when(mockedAction).getParameterValue(name); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action; + +import static org.mockito.Mockito.doReturn; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.action.Action; +import org.mockito.Mock; + +/** + * Declare as version record action unit test. + * + * @author Roy Wetherall + * @since 2.3 + */ +public abstract class BaseActionUnitTest extends BaseUnitTest +{ + /** mocked action */ + private @Mock Action mockedAction; + + /** + * @return mocked action + */ + protected Action getMockedAction() + { + return mockedAction; + } + + /** + * Helper to mock an action parameter value + */ + protected void mockActionParameterValue(String name, Object value) + { + doReturn(value).when(mockedAction).getParameterValue(name); + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java index d75fd7cb36..1622b03eb0 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java @@ -1,302 +1,302 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.dm; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Declare as version record action unit test. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest -{ - /** Sync Model */ - private static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; - private static final QName ASPECT_SYNCED = QName.createQName(SYNC_MODEL_1_0_URI, "synced"); - - /** actioned upon node reference */ - private NodeRef actionedUponNodeRef; - - /** declare as version record action */ - private @InjectMocks DeclareAsVersionRecordAction declareAsVersionRecordAction; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - public void before() throws Exception - { - super.before(); - - // mocked action - declareAsVersionRecordAction.setAuditable(false); - - // mocked actioned upon noderef - actionedUponNodeRef = generateNodeRef(); - } - - /** - * Given that the actioned upon node reference doesn't exist - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefDoesntExist() - { - doReturn(false).when(mockedNodeService).exists(actionedUponNodeRef); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference isn't a subtype of cm:content - * When I execute the action - * Then nothing happens - */ - @Test - public void aciontedUponNodeRefIsntSubTypeOfCmContent() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(false).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference doesn't have the versionable aspect applied - * When I executed the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefDoesntHaveVersionableApplied() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference is already an record - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefAlreadyRecord() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference is a working copy - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefWorkingCopy() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference is a rejected record - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefRejectedRecord() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference is synced to the cloud - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefSynced() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that no file plan is provided - * And no default file plan exists - * When I execute the action - * Then an exception is thrown - */ - @Test - public void noFilePlanParameterNoDefaultFilePlan() - { - // setup - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); - - // no default file plan - doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // expect exception - exception.expect(AlfrescoRuntimeException.class); - - // exceute action - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - } - - /** - * Given that no file plan is provided - * And adefault file plan exists - * When I execute the action - * Then a version record is declared - */ - @Test - public void noFilePlanParameterDefaultFilePlan() - { - // setup - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); - - // no default file plan - doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // exceute action - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that a file plan is provided - * And it isn't a file plan - * When I execute the action - * Then an exception is thrown - */ - @Test - public void invalidFilePlanParameter() - { - // setup - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); - - // not a file plan is provided in the parameters - mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, generateNodeRef()); - - // expect exception - exception.expect(AlfrescoRuntimeException.class); - - // exceute action - declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); - } - - /** - * Given that a file plan is provided - * And it is a file plan - * When I execute the action - * Then a version record is declared - */ - @Test - public void validFilePlanParameter() - { - // setup - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); - - // not a file plan is provided in the parameters - NodeRef myFilePlan = generateNodeRef(TYPE_FILE_PLAN); - doReturn(true).when(mockedFilePlanService).isFilePlan(myFilePlan); - mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, myFilePlan); - - // exceute action - declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); - verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(myFilePlan, actionedUponNodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.dm; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Declare as version record action unit test. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest +{ + /** Sync Model */ + private static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; + private static final QName ASPECT_SYNCED = QName.createQName(SYNC_MODEL_1_0_URI, "synced"); + + /** actioned upon node reference */ + private NodeRef actionedUponNodeRef; + + /** declare as version record action */ + private @InjectMocks DeclareAsVersionRecordAction declareAsVersionRecordAction; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Override + public void before() throws Exception + { + super.before(); + + // mocked action + declareAsVersionRecordAction.setAuditable(false); + + // mocked actioned upon noderef + actionedUponNodeRef = generateNodeRef(); + } + + /** + * Given that the actioned upon node reference doesn't exist + * When I execute the action + * Then nothing happens + */ + @Test + public void actionedUponNodeRefDoesntExist() + { + doReturn(false).when(mockedNodeService).exists(actionedUponNodeRef); + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + + /** + * Given that the actioned upon node reference isn't a subtype of cm:content + * When I execute the action + * Then nothing happens + */ + @Test + public void aciontedUponNodeRefIsntSubTypeOfCmContent() + { + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(false).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + + /** + * Given that the actioned upon node reference doesn't have the versionable aspect applied + * When I executed the action + * Then nothing happens + */ + @Test + public void actionedUponNodeRefDoesntHaveVersionableApplied() + { + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + + /** + * Given that the actioned upon node reference is already an record + * When I execute the action + * Then nothing happens + */ + @Test + public void actionedUponNodeRefAlreadyRecord() + { + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + + /** + * Given that the actioned upon node reference is a working copy + * When I execute the action + * Then nothing happens + */ + @Test + public void actionedUponNodeRefWorkingCopy() + { + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + + /** + * Given that the actioned upon node reference is a rejected record + * When I execute the action + * Then nothing happens + */ + @Test + public void actionedUponNodeRefRejectedRecord() + { + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + + /** + * Given that the actioned upon node reference is synced to the cloud + * When I execute the action + * Then nothing happens + */ + @Test + public void actionedUponNodeRefSynced() + { + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + + /** + * Given that no file plan is provided + * And no default file plan exists + * When I execute the action + * Then an exception is thrown + */ + @Test + public void noFilePlanParameterNoDefaultFilePlan() + { + // setup + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); + + // no default file plan + doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + + // expect exception + exception.expect(AlfrescoRuntimeException.class); + + // exceute action + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + } + + /** + * Given that no file plan is provided + * And adefault file plan exists + * When I execute the action + * Then a version record is declared + */ + @Test + public void noFilePlanParameterDefaultFilePlan() + { + // setup + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); + + // no default file plan + doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + + // exceute action + declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); + verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); + } + + /** + * Given that a file plan is provided + * And it isn't a file plan + * When I execute the action + * Then an exception is thrown + */ + @Test + public void invalidFilePlanParameter() + { + // setup + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); + + // not a file plan is provided in the parameters + mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, generateNodeRef()); + + // expect exception + exception.expect(AlfrescoRuntimeException.class); + + // exceute action + declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); + } + + /** + * Given that a file plan is provided + * And it is a file plan + * When I execute the action + * Then a version record is declared + */ + @Test + public void validFilePlanParameter() + { + // setup + doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); + doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); + doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); + doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); + + // not a file plan is provided in the parameters + NodeRef myFilePlan = generateNodeRef(TYPE_FILE_PLAN); + doReturn(true).when(mockedFilePlanService).isFilePlan(myFilePlan); + mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, myFilePlan); + + // exceute action + declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); + verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(myFilePlan, actionedUponNodeRef); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java index be9d58dce6..8e457412f7 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java @@ -1,115 +1,115 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import static org.mockito.Mockito.verifyZeroInteractions; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for file report action. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class FileReportActionUnitTest extends BaseActionUnitTest -{ - /** actioned upon node reference */ - private NodeRef actionedUponNodeRef; - - /** file report action */ - private @InjectMocks FileReportAction fileReportAction; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - public void before() throws Exception - { - super.before(); - - // actioned upon node reference - actionedUponNodeRef = generateRecord(); - - // mocked action - fileReportAction.setAuditable(false); - } - - /** - * given the destination is not set, ensure that an exception is thrown - */ - @Test - public void destinationNotSet() - { - // == given == - - // set action parameter values - mockActionParameterValue(FileReportAction.MIMETYPE, MimetypeMap.MIMETYPE_HTML); - mockActionParameterValue(FileReportAction.REPORT_TYPE, "rma:destructionReport"); - - // expected exception - exception.expect(AlfrescoRuntimeException.class); - - // == when == - - // execute action - fileReportAction.executeImpl(getMockedAction(), actionedUponNodeRef); - - // == then == - verifyZeroInteractions(mockedReportService, mockedNodeService); - } - - /** - * given no report type set, ensure that an exception is thrown - */ - @Test - public void reportTypeNotSet() - { - // == given == - - // set action parameter values - mockActionParameterValue(FileReportAction.MIMETYPE, MimetypeMap.MIMETYPE_HTML); - mockActionParameterValue(FileReportAction.DESTINATION, generateNodeRef().toString()); - - // expected exception - exception.expect(AlfrescoRuntimeException.class); - - // == when == - - // execute action - fileReportAction.executeImpl(getMockedAction(), actionedUponNodeRef); - - // == then == - verifyZeroInteractions(mockedReportService, mockedNodeService); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import static org.mockito.Mockito.verifyZeroInteractions; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for file report action. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class FileReportActionUnitTest extends BaseActionUnitTest +{ + /** actioned upon node reference */ + private NodeRef actionedUponNodeRef; + + /** file report action */ + private @InjectMocks FileReportAction fileReportAction; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Override + public void before() throws Exception + { + super.before(); + + // actioned upon node reference + actionedUponNodeRef = generateRecord(); + + // mocked action + fileReportAction.setAuditable(false); + } + + /** + * given the destination is not set, ensure that an exception is thrown + */ + @Test + public void destinationNotSet() + { + // == given == + + // set action parameter values + mockActionParameterValue(FileReportAction.MIMETYPE, MimetypeMap.MIMETYPE_HTML); + mockActionParameterValue(FileReportAction.REPORT_TYPE, "rma:destructionReport"); + + // expected exception + exception.expect(AlfrescoRuntimeException.class); + + // == when == + + // execute action + fileReportAction.executeImpl(getMockedAction(), actionedUponNodeRef); + + // == then == + verifyZeroInteractions(mockedReportService, mockedNodeService); + } + + /** + * given no report type set, ensure that an exception is thrown + */ + @Test + public void reportTypeNotSet() + { + // == given == + + // set action parameter values + mockActionParameterValue(FileReportAction.MIMETYPE, MimetypeMap.MIMETYPE_HTML); + mockActionParameterValue(FileReportAction.DESTINATION, generateNodeRef().toString()); + + // expected exception + exception.expect(AlfrescoRuntimeException.class); + + // == when == + + // execute action + fileReportAction.executeImpl(getMockedAction(), actionedUponNodeRef); + + // == then == + verifyZeroInteractions(mockedReportService, mockedNodeService); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java index 0289715bf7..e5e1a3b3b8 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java @@ -1,153 +1,153 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.action.impl; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for unlink from action - * - * @author Roy Wetherall - * @since 2.3 - */ -public class UnlinkFromActionUnitTest extends BaseActionUnitTest -{ - private NodeRef record; - private NodeRef recordFolder; - - @InjectMocks - private UnlinkFromAction action; - - @Before - @Override - public void before() throws Exception - { - super.before(); - - record = generateRecord(); - recordFolder = generateRecordFolder(); - } - - /** - * Given the actioned upon node does not exist - * When the action is executed - * Then nothing happens - */ - @Test - public void nodeDoesNotExist() - { - doReturn(false).when(mockedNodeService).exists(record); - action.executeImpl(mock(Action.class), record); - verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); - } - - /** - * Given the actioned upon node is pending delete - * When the action is executed - * Then nothing happens - */ - @Test - public void nodePendingDelete() - { - doReturn(true).when(mockedNodeService).exists(record); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); - action.executeImpl(mock(Action.class), record); - verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); - } - - /** - * Given that actioned upon node is not a record - * When the action is executed - * Then nothing happens - */ - @Test - public void nodeNotRecord() - { - NodeRef notRecord = generateCmContent(generateText()); - doReturn(true).when(mockedNodeService).exists(notRecord); - doReturn(false).when(mockedNodeService).hasAspect(notRecord, ASPECT_PENDING_DELETE); - action.executeImpl(mock(Action.class), notRecord); - verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); - } - - /** - * Given that the record folder parameter is not provided - * When the action is executed - * Then an exception is thrown - */ - @Test(expected=AlfrescoRuntimeException.class) - public void recordFolderParamMissing() - { - // setup record - doReturn(true).when(mockedNodeService).exists(record); - doReturn(false).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); - - // create action mock - mockActionParameterValue(UnlinkFromAction.PARAM_RECORD_FOLDER, null); - - // execute action - action.executeImpl(getMockedAction(), record); - } - - /** - * Given that a valid record folder is provided - * When the action is executed - * Then the record is unlinked from the record folder - */ - @Test - public void validUnlink() - { - // setup record - doReturn(true).when(mockedNodeService).exists(record); - doReturn(false).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); - - // create action mock - mockActionParameterValue(UnlinkFromAction.PARAM_RECORD_FOLDER, recordFolder.toString()); - - // execute action - action.executeImpl(getMockedAction(), record); - - // verify unlink - verify(mockedRecordService, times(1)).unlink(record, recordFolder); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.action.impl; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for unlink from action + * + * @author Roy Wetherall + * @since 2.3 + */ +public class UnlinkFromActionUnitTest extends BaseActionUnitTest +{ + private NodeRef record; + private NodeRef recordFolder; + + @InjectMocks + private UnlinkFromAction action; + + @Before + @Override + public void before() throws Exception + { + super.before(); + + record = generateRecord(); + recordFolder = generateRecordFolder(); + } + + /** + * Given the actioned upon node does not exist + * When the action is executed + * Then nothing happens + */ + @Test + public void nodeDoesNotExist() + { + doReturn(false).when(mockedNodeService).exists(record); + action.executeImpl(mock(Action.class), record); + verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); + } + + /** + * Given the actioned upon node is pending delete + * When the action is executed + * Then nothing happens + */ + @Test + public void nodePendingDelete() + { + doReturn(true).when(mockedNodeService).exists(record); + doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); + action.executeImpl(mock(Action.class), record); + verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); + } + + /** + * Given that actioned upon node is not a record + * When the action is executed + * Then nothing happens + */ + @Test + public void nodeNotRecord() + { + NodeRef notRecord = generateCmContent(generateText()); + doReturn(true).when(mockedNodeService).exists(notRecord); + doReturn(false).when(mockedNodeService).hasAspect(notRecord, ASPECT_PENDING_DELETE); + action.executeImpl(mock(Action.class), notRecord); + verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); + } + + /** + * Given that the record folder parameter is not provided + * When the action is executed + * Then an exception is thrown + */ + @Test(expected=AlfrescoRuntimeException.class) + public void recordFolderParamMissing() + { + // setup record + doReturn(true).when(mockedNodeService).exists(record); + doReturn(false).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); + + // create action mock + mockActionParameterValue(UnlinkFromAction.PARAM_RECORD_FOLDER, null); + + // execute action + action.executeImpl(getMockedAction(), record); + } + + /** + * Given that a valid record folder is provided + * When the action is executed + * Then the record is unlinked from the record folder + */ + @Test + public void validUnlink() + { + // setup record + doReturn(true).when(mockedNodeService).exists(record); + doReturn(false).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); + + // create action mock + mockActionParameterValue(UnlinkFromAction.PARAM_RECORD_FOLDER, recordFolder.toString()); + + // execute action + action.executeImpl(getMockedAction(), record); + + // verify unlink + verify(mockedRecordService, times(1)).unlink(record, recordFolder); + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/CommunityPublicAPIUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/CommunityPublicAPIUnitTest.java index a9f9c282ce..e233b7338f 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/CommunityPublicAPIUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/api/CommunityPublicAPIUnitTest.java @@ -1,42 +1,42 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.api; - -import com.google.common.collect.HashMultimap; - -import org.junit.Test; - -public class CommunityPublicAPIUnitTest -{ - @Test - public void testPublicAPIConsistency() - { - HashMultimap, Class> knownBadReferences = HashMultimap.create(); - PublicAPITestUtil.testPublicAPIConsistency("org.alfresco.module.org_alfresco_module_rm", knownBadReferences); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.api; + +import com.google.common.collect.HashMultimap; + +import org.junit.Test; + +public class CommunityPublicAPIUnitTest +{ + @Test + public void testPublicAPIConsistency() + { + HashMultimap, Class> knownBadReferences = HashMultimap.create(); + PublicAPITestUtil.testPublicAPIConsistency("org.alfresco.module.org_alfresco_module_rm", knownBadReferences); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java index 85473ace7f..ff020f57a7 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java @@ -1,103 +1,103 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bootstrap; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.importer.ImporterBootstrap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Bootstrap importer module component unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class BootstrapImporterModuleComponentUnitTest extends BaseUnitTest -{ - /** RM config node */ - private static final NodeRef configNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); - - /** mocks */ - @Mock(name="importer") private ImporterBootstrap mockedImporter; - @Mock(name="modulePatchExecuter") private ModulePatchExecuter mockedModulePatchExecuter; - @Mock(name="recordContributorsGroupBootstrapComponent") private RecordContributorsGroupBootstrapComponent mockedRecordContributorsGroupBootstrapComponent; - - /** importer */ - @InjectMocks - private BootstrapImporterModuleComponent importer; - - /** - * Given that the system has already been bootstraped - * When I try and boostrap the system - * Then the system is not bootstraped again - */ - @Test - public void alreadyBootstraped() throws Throwable - { - // config node exists - doReturn(true).when(mockedNodeService).exists(configNodeRef); - - // boostrap - importer.executeInternal(); - - // not bootstraped - verify(mockedImporter, never()).bootstrap(); - verify(mockedModulePatchExecuter, never()).initSchemaVersion(); - verify(mockedRecordContributorsGroupBootstrapComponent, never()).createRecordContributorsGroup(); - } - - /** - * Given that the system has not been bootstraped - * When I try and bootstrap the system - * Then the system is bootstraped - */ - @Test - public void boostrap() throws Throwable - { - // config node does not exist - doReturn(false).when(mockedNodeService).exists(configNodeRef); - - // boostrap - importer.executeInternal(); - - // not bootstraped - verify(mockedImporter, times(1)).bootstrap(); - verify(mockedModulePatchExecuter, times(1)).initSchemaVersion(); - verify(mockedRecordContributorsGroupBootstrapComponent, times(1)).createRecordContributorsGroup(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bootstrap; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.repo.importer.ImporterBootstrap; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; + +/** + * Bootstrap importer module component unit test + * + * @author Roy Wetherall + * @since 2.3 + */ +public class BootstrapImporterModuleComponentUnitTest extends BaseUnitTest +{ + /** RM config node */ + private static final NodeRef configNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); + + /** mocks */ + @Mock(name="importer") private ImporterBootstrap mockedImporter; + @Mock(name="modulePatchExecuter") private ModulePatchExecuter mockedModulePatchExecuter; + @Mock(name="recordContributorsGroupBootstrapComponent") private RecordContributorsGroupBootstrapComponent mockedRecordContributorsGroupBootstrapComponent; + + /** importer */ + @InjectMocks + private BootstrapImporterModuleComponent importer; + + /** + * Given that the system has already been bootstraped + * When I try and boostrap the system + * Then the system is not bootstraped again + */ + @Test + public void alreadyBootstraped() throws Throwable + { + // config node exists + doReturn(true).when(mockedNodeService).exists(configNodeRef); + + // boostrap + importer.executeInternal(); + + // not bootstraped + verify(mockedImporter, never()).bootstrap(); + verify(mockedModulePatchExecuter, never()).initSchemaVersion(); + verify(mockedRecordContributorsGroupBootstrapComponent, never()).createRecordContributorsGroup(); + } + + /** + * Given that the system has not been bootstraped + * When I try and bootstrap the system + * Then the system is bootstraped + */ + @Test + public void boostrap() throws Throwable + { + // config node does not exist + doReturn(false).when(mockedNodeService).exists(configNodeRef); + + // boostrap + importer.executeInternal(); + + // not bootstraped + verify(mockedImporter, times(1)).bootstrap(); + verify(mockedModulePatchExecuter, times(1)).initSchemaVersion(); + verify(mockedRecordContributorsGroupBootstrapComponent, times(1)).createRecordContributorsGroup(); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponentUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponentUnitTest.java index 0adeac8866..90692f301a 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponentUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/ModuleCompatibilityComponentUnitTest.java @@ -1,179 +1,179 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bootstrap; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode; -import org.alfresco.service.cmr.module.ModuleDetails; -import org.alfresco.service.cmr.module.ModuleService; -import org.alfresco.service.descriptor.DescriptorService; -import org.alfresco.service.license.LicenseDescriptor; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * Module compatibility component unit test - * - * @author Roy Wetherall - * @since 2.4 - */ -public class ModuleCompatibilityComponentUnitTest -{ - /** mocks */ - @Mock private DescriptorService mockedDescriptorService; - @Mock private ModuleService mockedModuleService; - @Mock private ContextRefreshedEvent mockedContextRefreshedEvent; - @Mock private ConfigurableApplicationContext mockedApplicationContext; - @Mock private ModuleDetails mockedModuleDetails; - @Mock private LicenseDescriptor mockedDescriptor; - - /** object under test */ - @InjectMocks private ModuleCompatibilityComponent moduleCompatibilityComponent; - - /** - * Before test execution - */ - @Before - public void before() - { - MockitoAnnotations.initMocks(this); - - when(mockedContextRefreshedEvent.getApplicationContext()) - .thenReturn(mockedApplicationContext); - when(mockedDescriptorService.getLicenseDescriptor()) - .thenReturn(mockedDescriptor); - } - - /** - * Given that core community is installed - * And that RM community is installed - * When the application context is loaded - * Then it is successful - */ - @Test - public void communityOnCommunity() - { - // community core installed - when(mockedDescriptor.getLicenseMode()) - .thenReturn(LicenseMode.UNKNOWN); - - // community RM installed - when(mockedModuleService.getModule(anyString())) - .thenReturn(null); - - // on app context refresh - moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); - - // verify close never called - verify(mockedApplicationContext, never()).close(); - - } - - /** - * Given that core community is installed - * And that RM enterprise is installed - * When the application context is loaded - * Then it fails - */ - @Test - public void enterpriseOnCommunity() - { - // community core installed - when(mockedDescriptor.getLicenseMode()) - .thenReturn(LicenseMode.UNKNOWN); - - // enterprise RM installed - when(mockedModuleService.getModule(anyString())) - .thenReturn(mockedModuleDetails); - - // on app context refresh - moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); - - // verify close is called - verify(mockedApplicationContext).close(); - - } - - /** - * Given that core enterprise is installed - * And that RM community is installed - * When the application context is loaded - * Then it fails - */ - @Test - public void communityOnEnterprise() - { - // enterprise core installed - when(mockedDescriptor.getLicenseMode()) - .thenReturn(LicenseMode.ENTERPRISE); - - // community RM installed - when(mockedModuleService.getModule(anyString())) - .thenReturn(null); - - // on app context refresh - moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); - - // verify close is called - verify(mockedApplicationContext).close(); - } - - /** - * Given that core enterprise is installed - * And that RM enterprise is installed - * When the application context is loaded - * Then it is successful - */ - @Test - public void enterpriseOnEnterprise() - { - // enterprise core installed - when(mockedDescriptor.getLicenseMode()) - .thenReturn(LicenseMode.ENTERPRISE); - - // enterprise RM installed - when(mockedModuleService.getModule(anyString())) - .thenReturn(mockedModuleDetails); - - // on app context refresh - moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); - - // verify close never called - verify(mockedApplicationContext, never()).close(); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bootstrap; + +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode; +import org.alfresco.service.cmr.module.ModuleDetails; +import org.alfresco.service.cmr.module.ModuleService; +import org.alfresco.service.descriptor.DescriptorService; +import org.alfresco.service.license.LicenseDescriptor; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.event.ContextRefreshedEvent; + +/** + * Module compatibility component unit test + * + * @author Roy Wetherall + * @since 2.4 + */ +public class ModuleCompatibilityComponentUnitTest +{ + /** mocks */ + @Mock private DescriptorService mockedDescriptorService; + @Mock private ModuleService mockedModuleService; + @Mock private ContextRefreshedEvent mockedContextRefreshedEvent; + @Mock private ConfigurableApplicationContext mockedApplicationContext; + @Mock private ModuleDetails mockedModuleDetails; + @Mock private LicenseDescriptor mockedDescriptor; + + /** object under test */ + @InjectMocks private ModuleCompatibilityComponent moduleCompatibilityComponent; + + /** + * Before test execution + */ + @Before + public void before() + { + MockitoAnnotations.initMocks(this); + + when(mockedContextRefreshedEvent.getApplicationContext()) + .thenReturn(mockedApplicationContext); + when(mockedDescriptorService.getLicenseDescriptor()) + .thenReturn(mockedDescriptor); + } + + /** + * Given that core community is installed + * And that RM community is installed + * When the application context is loaded + * Then it is successful + */ + @Test + public void communityOnCommunity() + { + // community core installed + when(mockedDescriptor.getLicenseMode()) + .thenReturn(LicenseMode.UNKNOWN); + + // community RM installed + when(mockedModuleService.getModule(anyString())) + .thenReturn(null); + + // on app context refresh + moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); + + // verify close never called + verify(mockedApplicationContext, never()).close(); + + } + + /** + * Given that core community is installed + * And that RM enterprise is installed + * When the application context is loaded + * Then it fails + */ + @Test + public void enterpriseOnCommunity() + { + // community core installed + when(mockedDescriptor.getLicenseMode()) + .thenReturn(LicenseMode.UNKNOWN); + + // enterprise RM installed + when(mockedModuleService.getModule(anyString())) + .thenReturn(mockedModuleDetails); + + // on app context refresh + moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); + + // verify close is called + verify(mockedApplicationContext).close(); + + } + + /** + * Given that core enterprise is installed + * And that RM community is installed + * When the application context is loaded + * Then it fails + */ + @Test + public void communityOnEnterprise() + { + // enterprise core installed + when(mockedDescriptor.getLicenseMode()) + .thenReturn(LicenseMode.ENTERPRISE); + + // community RM installed + when(mockedModuleService.getModule(anyString())) + .thenReturn(null); + + // on app context refresh + moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); + + // verify close is called + verify(mockedApplicationContext).close(); + } + + /** + * Given that core enterprise is installed + * And that RM enterprise is installed + * When the application context is loaded + * Then it is successful + */ + @Test + public void enterpriseOnEnterprise() + { + // enterprise core installed + when(mockedDescriptor.getLicenseMode()) + .thenReturn(LicenseMode.ENTERPRISE); + + // enterprise RM installed + when(mockedModuleService.getModule(anyString())) + .thenReturn(mockedModuleDetails); + + // on app context refresh + moduleCompatibilityComponent.onApplicationEvent(mockedContextRefreshedEvent); + + // verify close never called + verify(mockedApplicationContext, never()).close(); + + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java index fcac25a3a5..70f4e27407 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java @@ -1,92 +1,92 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.bootstrap; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.security.AuthorityType; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Record contributors group bootstrap component unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordContributorsGroupBootstrapComponentUnitTest extends BaseUnitTest -{ - @InjectMocks - private RecordContributorsGroupBootstrapComponent component; - - /** - * Given that the record contributors group already exists - * When I try and create the group - * Then nothing happens - */ - @Test - public void groupAlreadyExists() - { - // group already exists - doReturn(true).when(mockedAuthorityService).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); - - // create group - component.createRecordContributorsGroup(); - - // group not created - verify(mockedAuthorityService, times(1)).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); - verifyNoMoreInteractions(mockedAuthorityService); - } - - /** - * Given that the record contributors group does not exist - * When I try and create the group - * Then the group is successfully created - * And 'everyone' is added to the new group - */ - @Test - public void createGroup() - { - // group does not exists - doReturn(false).when(mockedAuthorityService).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); - - // create group - component.createRecordContributorsGroup(); - - // group not created - verify(mockedAuthorityService, times(1)).createAuthority(AuthorityType.GROUP, RecordContributorsGroupBootstrapComponent.RECORD_CONTRIBUTORS); - verify(mockedAuthorityService, times(1)).addAuthority(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS, "admin"); - verify(mockedAuthorityService, times(1)).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); - verifyNoMoreInteractions(mockedAuthorityService); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.bootstrap; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.security.AuthorityType; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Record contributors group bootstrap component unit test + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RecordContributorsGroupBootstrapComponentUnitTest extends BaseUnitTest +{ + @InjectMocks + private RecordContributorsGroupBootstrapComponent component; + + /** + * Given that the record contributors group already exists + * When I try and create the group + * Then nothing happens + */ + @Test + public void groupAlreadyExists() + { + // group already exists + doReturn(true).when(mockedAuthorityService).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); + + // create group + component.createRecordContributorsGroup(); + + // group not created + verify(mockedAuthorityService, times(1)).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); + verifyNoMoreInteractions(mockedAuthorityService); + } + + /** + * Given that the record contributors group does not exist + * When I try and create the group + * Then the group is successfully created + * And 'everyone' is added to the new group + */ + @Test + public void createGroup() + { + // group does not exists + doReturn(false).when(mockedAuthorityService).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); + + // create group + component.createRecordContributorsGroup(); + + // group not created + verify(mockedAuthorityService, times(1)).createAuthority(AuthorityType.GROUP, RecordContributorsGroupBootstrapComponent.RECORD_CONTRIBUTORS); + verify(mockedAuthorityService, times(1)).addAuthority(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS, "admin"); + verify(mockedAuthorityService, times(1)).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); + verifyNoMoreInteractions(mockedAuthorityService); + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java index d0e4948708..825a700056 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java @@ -1,229 +1,229 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.lang.reflect.Method; -import java.util.Iterator; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.policy.ConfigAttributeDefinition; -import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -import net.sf.acegisecurity.Authentication; -import net.sf.acegisecurity.ConfigAttribute; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * RM entry voter unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RMEntryVoterUnitTest extends BaseUnitTest -{ - private static final String POLICY_NAME = "myPolicy"; - - /** RM Entry */ - private @InjectMocks RMEntryVoter entryVoter; - - /** mocked policy */ - private @Mock Policy mockedPolicy; - - /** mocked authentication */ - private @Mock Authentication mockedAuthentication; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Before - @Override - public void before() throws Exception - { - super.before(); - - // don't run as system - when(mockedAuthenticationUtil.isRunAsUserTheSystemUser()) - .thenReturn(false); - - // indicate that "vote" transaction value is not set - when(mockedTransactionalResourceHelper.isResourcePresent("voting")) - .thenReturn(false); - } - - /** - * Given that the system is already voting - * When I vote - * Then access granted - */ - @Test - public void alreadyVoting() throws Exception - { - // indicate already voting - when(mockedTransactionalResourceHelper.isResourcePresent("voting")) - .thenReturn(true); - - // given I am providing an invalid policy for a method - MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); - - // call vote - assertEquals( - AccessDecisionVoter.ACCESS_GRANTED, - entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef)); - } - - /** - * Given that I am running this as the system user - * When I evaluate - * Then access granted - */ - @Test - public void runAsSystem() throws Exception - { - // run as system - when(mockedAuthenticationUtil.isRunAsUserTheSystemUser()) - .thenReturn(true); - - // given I am providing an invalid policy for a method - MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); - - // call vote - assertEquals( - AccessDecisionVoter.ACCESS_GRANTED, - entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef)); - } - - /** - * Given that we have provided an invalid policy - * When I evaluate the voter - * Then an AlfrescoRuntimeException is thrown - */ - @Test - public void invalidPolicy() throws Exception - { - // given I am providing an invalid policy for a method - MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); - - // I expect an Alfresco Runtime Exception - exception.expect(AlfrescoRuntimeException.class); - - // call vote - entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef); - } - - /** - * Given that I have provided a valid policy - * When I evaluate the voter - * Then the corresponding policy will be evaluated - */ - @Test - public void validPolicy() throws Exception - { - // valid policy - when(mockedPolicy.getName()) - .thenReturn(POLICY_NAME); - entryVoter.registerPolicy(mockedPolicy); - - // mock calling details - MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM." + POLICY_NAME); - - // call vote - entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef); - - // verify that the policy was executed - verify(mockedPolicy, times(1)).evaluate(eq(mockedMethodInvocation), any(Class[].class), any(ConfigAttributeDefinition.class)); - } - - /** - * Helper method to create configuration object - */ - @SuppressWarnings("rawtypes") - private net.sf.acegisecurity.ConfigAttributeDefinition createConfigDefinition(String value) - { - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfig = mock(net.sf.acegisecurity.ConfigAttributeDefinition.class); - - ConfigAttribute mockedConfigAttr = mock(ConfigAttribute.class); - when(mockedConfigAttr.getAttribute()) - .thenReturn(value); - - Iterator mockedIter = mock(Iterator.class); - when(mockedIter.hasNext()) - .thenReturn(true) - .thenReturn(false); - when(mockedIter.next()) - .thenReturn(mockedConfigAttr); - - when(mockedConfig.getConfigAttributes()) - .thenReturn(mockedIter); - - return mockedConfig; - } - - /** - * Helper method to create method invocation mock - */ - private MethodInvocation createMethodInvoation(String methodName, Class ... parameterTypes) - throws Exception - { - // mock method invocation - MethodInvocation mockedMethodInvocation = mock(MethodInvocation.class); - - // get method object .. assumed to be a method on this object - Method method = RMEntryVoterUnitTest.class.getMethod(methodName, parameterTypes); - when(mockedMethodInvocation.getMethod()) - .thenReturn(method); - - return mockedMethodInvocation; - } - - /** ========= Test methods ======== */ - - public void myTestMethod(NodeRef nodeRef) - { - // does nothing - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Method; +import java.util.Iterator; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.module.org_alfresco_module_rm.capability.policy.ConfigAttributeDefinition; +import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.NodeRef; +import org.aopalliance.intercept.MethodInvocation; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; + +import net.sf.acegisecurity.Authentication; +import net.sf.acegisecurity.ConfigAttribute; +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * RM entry voter unit test + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RMEntryVoterUnitTest extends BaseUnitTest +{ + private static final String POLICY_NAME = "myPolicy"; + + /** RM Entry */ + private @InjectMocks RMEntryVoter entryVoter; + + /** mocked policy */ + private @Mock Policy mockedPolicy; + + /** mocked authentication */ + private @Mock Authentication mockedAuthentication; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Before + @Override + public void before() throws Exception + { + super.before(); + + // don't run as system + when(mockedAuthenticationUtil.isRunAsUserTheSystemUser()) + .thenReturn(false); + + // indicate that "vote" transaction value is not set + when(mockedTransactionalResourceHelper.isResourcePresent("voting")) + .thenReturn(false); + } + + /** + * Given that the system is already voting + * When I vote + * Then access granted + */ + @Test + public void alreadyVoting() throws Exception + { + // indicate already voting + when(mockedTransactionalResourceHelper.isResourcePresent("voting")) + .thenReturn(true); + + // given I am providing an invalid policy for a method + MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); + net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); + + // call vote + assertEquals( + AccessDecisionVoter.ACCESS_GRANTED, + entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef)); + } + + /** + * Given that I am running this as the system user + * When I evaluate + * Then access granted + */ + @Test + public void runAsSystem() throws Exception + { + // run as system + when(mockedAuthenticationUtil.isRunAsUserTheSystemUser()) + .thenReturn(true); + + // given I am providing an invalid policy for a method + MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); + net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); + + // call vote + assertEquals( + AccessDecisionVoter.ACCESS_GRANTED, + entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef)); + } + + /** + * Given that we have provided an invalid policy + * When I evaluate the voter + * Then an AlfrescoRuntimeException is thrown + */ + @Test + public void invalidPolicy() throws Exception + { + // given I am providing an invalid policy for a method + MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); + net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); + + // I expect an Alfresco Runtime Exception + exception.expect(AlfrescoRuntimeException.class); + + // call vote + entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef); + } + + /** + * Given that I have provided a valid policy + * When I evaluate the voter + * Then the corresponding policy will be evaluated + */ + @Test + public void validPolicy() throws Exception + { + // valid policy + when(mockedPolicy.getName()) + .thenReturn(POLICY_NAME); + entryVoter.registerPolicy(mockedPolicy); + + // mock calling details + MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); + net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM." + POLICY_NAME); + + // call vote + entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef); + + // verify that the policy was executed + verify(mockedPolicy, times(1)).evaluate(eq(mockedMethodInvocation), any(Class[].class), any(ConfigAttributeDefinition.class)); + } + + /** + * Helper method to create configuration object + */ + @SuppressWarnings("rawtypes") + private net.sf.acegisecurity.ConfigAttributeDefinition createConfigDefinition(String value) + { + net.sf.acegisecurity.ConfigAttributeDefinition mockedConfig = mock(net.sf.acegisecurity.ConfigAttributeDefinition.class); + + ConfigAttribute mockedConfigAttr = mock(ConfigAttribute.class); + when(mockedConfigAttr.getAttribute()) + .thenReturn(value); + + Iterator mockedIter = mock(Iterator.class); + when(mockedIter.hasNext()) + .thenReturn(true) + .thenReturn(false); + when(mockedIter.next()) + .thenReturn(mockedConfigAttr); + + when(mockedConfig.getConfigAttributes()) + .thenReturn(mockedIter); + + return mockedConfig; + } + + /** + * Helper method to create method invocation mock + */ + private MethodInvocation createMethodInvoation(String methodName, Class ... parameterTypes) + throws Exception + { + // mock method invocation + MethodInvocation mockedMethodInvocation = mock(MethodInvocation.class); + + // get method object .. assumed to be a method on this object + Method method = RMEntryVoterUnitTest.class.getMethod(methodName, parameterTypes); + when(mockedMethodInvocation.getMethod()) + .thenReturn(method); + + return mockedMethodInvocation; + } + + /** ========= Test methods ======== */ + + public void myTestMethod(NodeRef nodeRef) + { + // does nothing + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java index 0ad66d0524..de3eb1eaf0 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java @@ -1,151 +1,151 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Filling on hold container capability condition unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class FillingOnHoldContainerCapabilityConditionUnitTest extends BaseUnitTest -{ - /** evaluator */ - private @InjectMocks FillingOnHoldContainerCapabilityCondition condition; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Before - @Override - public void before() throws Exception - { - super.before(); - } - - /** - * Given hold container node - * And no filling permission - * When evaluate - * Then false - */ - @Test - public void noFillingOnHoldContainer() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - when(mockedFilePlanService.isFilePlan(holdContainer)) - .thenReturn(false); - when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.DENIED); - - assertFalse(condition.evaluateImpl(holdContainer)); - } - - /** - * Given hold container node - * And filling permission - * When evaluate - * Then true - */ - @Test - public void fillingOnHoldContainer() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - when(mockedFilePlanService.isFilePlan(holdContainer)) - .thenReturn(false); - when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - assertTrue(condition.evaluateImpl(holdContainer)); - } - - /** - * Given file-plan node - * And no filling permission on hold container - * When evaluate - * Then false - */ - @Test - public void filePlanNoFilling() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - when(mockedFilePlanService.getHoldContainer(filePlan)) - .thenReturn(holdContainer); - when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.DENIED); - - assertFalse(condition.evaluateImpl(holdContainer)); - } - - /** - * Given file-plan node - * And filling permission on hold container - * When evaluate - * Then true - */ - @Test - public void filePlanFilling() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - when(mockedFilePlanService.getHoldContainer(filePlan)) - .thenReturn(holdContainer); - when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - assertTrue(condition.evaluateImpl(holdContainer)); - } - - /** - * Given unexpected node type - * When evaluate - * Then false - */ - @Test - public void unexpectedNode() - { - NodeRef unexpectedNode = generateNodeRef(); - when(mockedFilePlanService.isFilePlan(unexpectedNode)) - .thenReturn(false); - when(mockedPermissionService.hasPermission(unexpectedNode, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - assertFalse(condition.evaluateImpl(unexpectedNode)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Filling on hold container capability condition unit test + * + * @author Roy Wetherall + * @since 2.3 + */ +public class FillingOnHoldContainerCapabilityConditionUnitTest extends BaseUnitTest +{ + /** evaluator */ + private @InjectMocks FillingOnHoldContainerCapabilityCondition condition; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Before + @Override + public void before() throws Exception + { + super.before(); + } + + /** + * Given hold container node + * And no filling permission + * When evaluate + * Then false + */ + @Test + public void noFillingOnHoldContainer() + { + NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); + when(mockedFilePlanService.isFilePlan(holdContainer)) + .thenReturn(false); + when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) + .thenReturn(AccessStatus.DENIED); + + assertFalse(condition.evaluateImpl(holdContainer)); + } + + /** + * Given hold container node + * And filling permission + * When evaluate + * Then true + */ + @Test + public void fillingOnHoldContainer() + { + NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); + when(mockedFilePlanService.isFilePlan(holdContainer)) + .thenReturn(false); + when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) + .thenReturn(AccessStatus.ALLOWED); + + assertTrue(condition.evaluateImpl(holdContainer)); + } + + /** + * Given file-plan node + * And no filling permission on hold container + * When evaluate + * Then false + */ + @Test + public void filePlanNoFilling() + { + NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); + when(mockedFilePlanService.getHoldContainer(filePlan)) + .thenReturn(holdContainer); + when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) + .thenReturn(AccessStatus.DENIED); + + assertFalse(condition.evaluateImpl(holdContainer)); + } + + /** + * Given file-plan node + * And filling permission on hold container + * When evaluate + * Then true + */ + @Test + public void filePlanFilling() + { + NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); + when(mockedFilePlanService.getHoldContainer(filePlan)) + .thenReturn(holdContainer); + when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) + .thenReturn(AccessStatus.ALLOWED); + + assertTrue(condition.evaluateImpl(holdContainer)); + } + + /** + * Given unexpected node type + * When evaluate + * Then false + */ + @Test + public void unexpectedNode() + { + NodeRef unexpectedNode = generateNodeRef(); + when(mockedFilePlanService.isFilePlan(unexpectedNode)) + .thenReturn(false); + when(mockedPermissionService.hasPermission(unexpectedNode, RMPermissionModel.FILE_RECORDS)) + .thenReturn(AccessStatus.ALLOWED); + + assertFalse(condition.evaluateImpl(unexpectedNode)); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java index 91fe77c205..2be813cf13 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java @@ -1,245 +1,245 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Frozen capability condition unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class FrozenCapabilityConditionUnitTest extends BaseUnitTest -{ - /** evaluator */ - private @InjectMocks FrozenCapabilityCondition condition; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Before - @Override - public void before() throws Exception - { - super.before(); - } - - /** - * Given hold - * When evaluate - * Then true - */ - @Test - public void evaluateHold() - { - // is a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(true); - - // evaluate - assertTrue(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, never()).isFrozen(nodeRef); - verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); - } - - /** - * Given is frozen - * And no check children - * When evaluate - * Then true - */ - @Test - public void frozenDontCheckChildren() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // dont check children - condition.setCheckChildren(false); - - // is frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(true); - - // evaluate - assertTrue(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); - } - - /** - * Given is not frozen - * And no check children - * When evaluate - * Then false - */ - @Test - public void notFrozenDontCheckChildren() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // dont check children - condition.setCheckChildren(false); - - // is not frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(false); - - // evaluate - assertFalse(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); - } - - /** - * Given is frozen - * And check children - * When evaluate - * Then true - */ - @Test - public void frozenCheckChildren() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // check children - condition.setCheckChildren(true); - - // is frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(true); - - // evaluate - assertTrue(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); - } - - /** - * Given is not frozen - * And check children - * And children no frozen - * When evaluate - * Then false - */ - @Test - public void notFrozenCheckChildrenNotFrozen() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // check children - condition.setCheckChildren(true); - - // is not frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(false); - - // children not frozen - when(mockedFreezeService.hasFrozenChildren(nodeRef)) - .thenReturn(false); - - // evaluate - assertFalse(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, times(1)).hasFrozenChildren(nodeRef); - } - - /** - * Given is not frozen - * And check children - * And children frozen - * When evaluate - * Then true - */ - @Test - public void notFrozenCheckChildrenFrozen() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // check children - condition.setCheckChildren(true); - - // is not frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(false); - - // children frozen - when(mockedFreezeService.hasFrozenChildren(nodeRef)) - .thenReturn(true); - - // evaluate - assertTrue(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, times(1)).hasFrozenChildren(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Frozen capability condition unit test + * + * @author Roy Wetherall + * @since 2.3 + */ +public class FrozenCapabilityConditionUnitTest extends BaseUnitTest +{ + /** evaluator */ + private @InjectMocks FrozenCapabilityCondition condition; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Before + @Override + public void before() throws Exception + { + super.before(); + } + + /** + * Given hold + * When evaluate + * Then true + */ + @Test + public void evaluateHold() + { + // is a hold + NodeRef nodeRef = generateNodeRef(); + when(mockedHoldService.isHold(nodeRef)) + .thenReturn(true); + + // evaluate + assertTrue(condition.evaluate(nodeRef)); + + // verify + verify(mockedHoldService, times(1)).isHold(nodeRef); + verify(mockedFreezeService, never()).isFrozen(nodeRef); + verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); + } + + /** + * Given is frozen + * And no check children + * When evaluate + * Then true + */ + @Test + public void frozenDontCheckChildren() + { + // is not a hold + NodeRef nodeRef = generateNodeRef(); + when(mockedHoldService.isHold(nodeRef)) + .thenReturn(false); + + // dont check children + condition.setCheckChildren(false); + + // is frozen + when(mockedFreezeService.isFrozen(nodeRef)) + .thenReturn(true); + + // evaluate + assertTrue(condition.evaluate(nodeRef)); + + // verify + verify(mockedHoldService, times(1)).isHold(nodeRef); + verify(mockedFreezeService, times(1)).isFrozen(nodeRef); + verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); + } + + /** + * Given is not frozen + * And no check children + * When evaluate + * Then false + */ + @Test + public void notFrozenDontCheckChildren() + { + // is not a hold + NodeRef nodeRef = generateNodeRef(); + when(mockedHoldService.isHold(nodeRef)) + .thenReturn(false); + + // dont check children + condition.setCheckChildren(false); + + // is not frozen + when(mockedFreezeService.isFrozen(nodeRef)) + .thenReturn(false); + + // evaluate + assertFalse(condition.evaluate(nodeRef)); + + // verify + verify(mockedHoldService, times(1)).isHold(nodeRef); + verify(mockedFreezeService, times(1)).isFrozen(nodeRef); + verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); + } + + /** + * Given is frozen + * And check children + * When evaluate + * Then true + */ + @Test + public void frozenCheckChildren() + { + // is not a hold + NodeRef nodeRef = generateNodeRef(); + when(mockedHoldService.isHold(nodeRef)) + .thenReturn(false); + + // check children + condition.setCheckChildren(true); + + // is frozen + when(mockedFreezeService.isFrozen(nodeRef)) + .thenReturn(true); + + // evaluate + assertTrue(condition.evaluate(nodeRef)); + + // verify + verify(mockedHoldService, times(1)).isHold(nodeRef); + verify(mockedFreezeService, times(1)).isFrozen(nodeRef); + verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); + } + + /** + * Given is not frozen + * And check children + * And children no frozen + * When evaluate + * Then false + */ + @Test + public void notFrozenCheckChildrenNotFrozen() + { + // is not a hold + NodeRef nodeRef = generateNodeRef(); + when(mockedHoldService.isHold(nodeRef)) + .thenReturn(false); + + // check children + condition.setCheckChildren(true); + + // is not frozen + when(mockedFreezeService.isFrozen(nodeRef)) + .thenReturn(false); + + // children not frozen + when(mockedFreezeService.hasFrozenChildren(nodeRef)) + .thenReturn(false); + + // evaluate + assertFalse(condition.evaluate(nodeRef)); + + // verify + verify(mockedHoldService, times(1)).isHold(nodeRef); + verify(mockedFreezeService, times(1)).isFrozen(nodeRef); + verify(mockedFreezeService, times(1)).hasFrozenChildren(nodeRef); + } + + /** + * Given is not frozen + * And check children + * And children frozen + * When evaluate + * Then true + */ + @Test + public void notFrozenCheckChildrenFrozen() + { + // is not a hold + NodeRef nodeRef = generateNodeRef(); + when(mockedHoldService.isHold(nodeRef)) + .thenReturn(false); + + // check children + condition.setCheckChildren(true); + + // is not frozen + when(mockedFreezeService.isFrozen(nodeRef)) + .thenReturn(false); + + // children frozen + when(mockedFreezeService.hasFrozenChildren(nodeRef)) + .thenReturn(true); + + // evaluate + assertTrue(condition.evaluate(nodeRef)); + + // verify + verify(mockedHoldService, times(1)).isHold(nodeRef); + verify(mockedFreezeService, times(1)).isFrozen(nodeRef); + verify(mockedFreezeService, times(1)).hasFrozenChildren(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java index 3f812948e8..5836dd8b1e 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java @@ -1,152 +1,152 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.declarative.condition; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Freeze evaluator unit test. - * - * @author Roy Wetherall - */ -public class HoldCapabilityConditionUnitTest extends BaseUnitTest -{ - /** test data */ - private NodeRef hold1; - private NodeRef hold2; - private List holds; - - /** mocked objects */ - private @Mock(name="kinds") Set mockedKinds; - - /** evaluator */ - private @Spy @InjectMocks HoldCapabilityCondition evaluator; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Before - @Override - public void before() throws Exception - { - super.before(); - - // setup test data - hold1 = generateNodeRef(TYPE_HOLD); - hold2 = generateNodeRef(TYPE_HOLD); - holds = new ArrayList(2); - holds.add(hold1); - holds.add(hold2); - - // setup interactions - doReturn(false).when(mockedKinds).contains(FilePlanComponentKind.RECORD_CATEGORY); - doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD_FOLDER); - doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.HOLD); - } - - /** - * Test given there are no holds - */ - @Test - public void noHolds() - { - // given - doReturn(Collections.EMPTY_LIST).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); - - // when - boolean result = evaluator.evaluateImpl(recordFolder); - - // then - assertFalse(result); - verify(mockedPermissionService, never()).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); - - } - - /** - * Test given the user has no filling permissions on any of the available holds - */ - @Test - public void noFillingOnHolds() - { - // given - doReturn(holds).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); - doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold1, RMPermissionModel.FILING); - doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold2, RMPermissionModel.FILING); - - // when - boolean result = evaluator.evaluateImpl(recordFolder); - - // then - assertFalse(result); - verify(mockedPermissionService, times(2)).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); - - } - - /** - * Test given the user has filling on one of the available holds - */ - @Test - public void fillingOnHolds() - { - // given - doReturn(holds).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); - doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold1, RMPermissionModel.FILING); - doReturn(AccessStatus.ALLOWED).when(mockedPermissionService).hasPermission(hold2, RMPermissionModel.FILING); - - // when - boolean result = evaluator.evaluateImpl(recordFolder); - - // then - assertTrue(result); - verify(mockedPermissionService, times(2)).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.declarative.condition; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; + +/** + * Freeze evaluator unit test. + * + * @author Roy Wetherall + */ +public class HoldCapabilityConditionUnitTest extends BaseUnitTest +{ + /** test data */ + private NodeRef hold1; + private NodeRef hold2; + private List holds; + + /** mocked objects */ + private @Mock(name="kinds") Set mockedKinds; + + /** evaluator */ + private @Spy @InjectMocks HoldCapabilityCondition evaluator; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Before + @Override + public void before() throws Exception + { + super.before(); + + // setup test data + hold1 = generateNodeRef(TYPE_HOLD); + hold2 = generateNodeRef(TYPE_HOLD); + holds = new ArrayList(2); + holds.add(hold1); + holds.add(hold2); + + // setup interactions + doReturn(false).when(mockedKinds).contains(FilePlanComponentKind.RECORD_CATEGORY); + doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD_FOLDER); + doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.HOLD); + } + + /** + * Test given there are no holds + */ + @Test + public void noHolds() + { + // given + doReturn(Collections.EMPTY_LIST).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); + + // when + boolean result = evaluator.evaluateImpl(recordFolder); + + // then + assertFalse(result); + verify(mockedPermissionService, never()).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); + + } + + /** + * Test given the user has no filling permissions on any of the available holds + */ + @Test + public void noFillingOnHolds() + { + // given + doReturn(holds).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); + doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold1, RMPermissionModel.FILING); + doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold2, RMPermissionModel.FILING); + + // when + boolean result = evaluator.evaluateImpl(recordFolder); + + // then + assertFalse(result); + verify(mockedPermissionService, times(2)).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); + + } + + /** + * Test given the user has filling on one of the available holds + */ + @Test + public void fillingOnHolds() + { + // given + doReturn(holds).when(mockedHoldService).heldBy(eq(recordFolder), anyBoolean()); + doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold1, RMPermissionModel.FILING); + doReturn(AccessStatus.ALLOWED).when(mockedPermissionService).hasPermission(hold2, RMPermissionModel.FILING); + + // when + boolean result = evaluator.evaluateImpl(recordFolder); + + // then + assertTrue(result); + verify(mockedPermissionService, times(2)).hasPermission(any(NodeRef.class), eq(RMPermissionModel.FILING)); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java index cb9e7edabe..7c7b705f47 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java @@ -1,74 +1,74 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.capability.impl; - -import static org.mockito.Mockito.when; - -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Assert; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -/** - * Edit non records metadata capability unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class EditNonRecordsMetadataCapabilityUnitTest extends BaseUnitTest -{ - /** mocked set */ - @Mock private Set mockedSet; - - /** test capability */ - @InjectMocks private EditNonRecordMetadataCapability capability; - - /** - * Given that the evaluated node is held in the transaction cache as new - * When evaluated - * Then access is granted - */ - @Test - public void newRecord() - { - NodeRef nodeRef = generateNodeRef(); - when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) - .thenReturn(mockedSet); - when(mockedSet.contains(nodeRef)) - .thenReturn(true); - - Assert.assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(nodeRef)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.capability.impl; + +import static org.mockito.Mockito.when; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Assert; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; + +import net.sf.acegisecurity.vote.AccessDecisionVoter; + +/** + * Edit non records metadata capability unit test + * + * @author Roy Wetherall + * @since 2.3 + */ +public class EditNonRecordsMetadataCapabilityUnitTest extends BaseUnitTest +{ + /** mocked set */ + @Mock private Set mockedSet; + + /** test capability */ + @InjectMocks private EditNonRecordMetadataCapability capability; + + /** + * Given that the evaluated node is held in the transaction cache as new + * When evaluated + * Then access is granted + */ + @Test + public void newRecord() + { + NodeRef nodeRef = generateNodeRef(); + when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) + .thenReturn(mockedSet); + when(mockedSet.contains(nodeRef)) + .thenReturn(true); + + Assert.assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(nodeRef)); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleanerUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleanerUnitTest.java index 485278bb99..27d6317431 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleanerUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/EagerContentStoreCleanerUnitTest.java @@ -1,130 +1,130 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.content; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.content.ContentStore; -import org.alfresco.repo.content.filestore.FileContentReader; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Eager content store cleaner unit test. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class EagerContentStoreCleanerUnitTest extends BaseUnitTest -{ - @InjectMocks private EagerContentStoreCleaner eagerContentStoreCleaner = new EagerContentStoreCleaner() - { - /** dummy implementation */ - public boolean registerOrphanedContentUrl(String contentUrl, boolean force) {return true;}; - }; - - @Mock private ContentCleanser mockedContentCleanser; - - /** - * When content is registered for cleansing - * Then the content URL is recorded for use later - */ - @SuppressWarnings("unchecked") - @Test - public void registerContentURL() - { - String contentURL = AlfMock.generateText(); - Set mockedSet = mock(Set.class); - when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) - .thenReturn(mockedSet); - - eagerContentStoreCleaner.registerOrphanedContentUrlForCleansing(contentURL); - - verify(mockedSet).add(contentURL); - } - - /** - * Given that the content requires cleansing - * When the content is deleted from the store - * Then the content is cleansed first - */ - @Test - public void contentRequiresCleaning() - { - String contentURL = AlfMock.generateText(); - Set mockedSet = new HashSet(Arrays.asList(contentURL)); - when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) - .thenReturn(mockedSet); - - FileContentReader mockedReader = mock(FileContentReader.class); - when(mockedReader.exists()) - .thenReturn(true); - - File mockedFile = mock(File.class); - when(mockedReader.getFile()) - .thenReturn(mockedFile); - - ContentStore mockedContentStore = mock(ContentStore.class); - when(mockedContentStore.getReader(contentURL)) - .thenReturn(mockedReader); - - eagerContentStoreCleaner.deleteFromStore(contentURL, mockedContentStore); - - verify(mockedContentCleanser).cleanse(mockedFile); - } - - /** - * Given that the content does not require cleansing - * When the content is deleted from the store - * Then the content is not cleansed - */ - @Test - public void contentDoesntRequireCleaning() - { - String contentURL = AlfMock.generateText(); - Set mockedSet = new HashSet(Arrays.asList(contentURL)); - when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) - .thenReturn(mockedSet); - - eagerContentStoreCleaner.deleteFromStore(AlfMock.generateText(), mock(ContentStore.class)); - - verifyZeroInteractions(mockedContentCleanser); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.content; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser; +import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.repo.content.ContentStore; +import org.alfresco.repo.content.filestore.FileContentReader; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; + +/** + * Eager content store cleaner unit test. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class EagerContentStoreCleanerUnitTest extends BaseUnitTest +{ + @InjectMocks private EagerContentStoreCleaner eagerContentStoreCleaner = new EagerContentStoreCleaner() + { + /** dummy implementation */ + public boolean registerOrphanedContentUrl(String contentUrl, boolean force) {return true;}; + }; + + @Mock private ContentCleanser mockedContentCleanser; + + /** + * When content is registered for cleansing + * Then the content URL is recorded for use later + */ + @SuppressWarnings("unchecked") + @Test + public void registerContentURL() + { + String contentURL = AlfMock.generateText(); + Set mockedSet = mock(Set.class); + when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) + .thenReturn(mockedSet); + + eagerContentStoreCleaner.registerOrphanedContentUrlForCleansing(contentURL); + + verify(mockedSet).add(contentURL); + } + + /** + * Given that the content requires cleansing + * When the content is deleted from the store + * Then the content is cleansed first + */ + @Test + public void contentRequiresCleaning() + { + String contentURL = AlfMock.generateText(); + Set mockedSet = new HashSet(Arrays.asList(contentURL)); + when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) + .thenReturn(mockedSet); + + FileContentReader mockedReader = mock(FileContentReader.class); + when(mockedReader.exists()) + .thenReturn(true); + + File mockedFile = mock(File.class); + when(mockedReader.getFile()) + .thenReturn(mockedFile); + + ContentStore mockedContentStore = mock(ContentStore.class); + when(mockedContentStore.getReader(contentURL)) + .thenReturn(mockedReader); + + eagerContentStoreCleaner.deleteFromStore(contentURL, mockedContentStore); + + verify(mockedContentCleanser).cleanse(mockedFile); + } + + /** + * Given that the content does not require cleansing + * When the content is deleted from the store + * Then the content is not cleansed + */ + @Test + public void contentDoesntRequireCleaning() + { + String contentURL = AlfMock.generateText(); + Set mockedSet = new HashSet(Arrays.asList(contentURL)); + when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)) + .thenReturn(mockedSet); + + eagerContentStoreCleaner.deleteFromStore(AlfMock.generateText(), mock(ContentStore.class)); + + verifyZeroInteractions(mockedContentCleanser); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022MUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022MUnitTest.java index 91315afc40..e4b5f41760 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022MUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanser522022MUnitTest.java @@ -1,121 +1,121 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.content.cleanser; - -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.when; - -import java.io.File; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ContentIOException; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Eager content store cleaner unit test. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class ContentCleanser522022MUnitTest extends BaseUnitTest -{ - @InjectMocks @Spy private ContentCleanser522022M contentCleanser522022M = new ContentCleanser522022M() - { - /** dummy implementations */ - protected void overwrite(File file, OverwriteOperation overwriteOperation) {}; - }; - - @Mock private File mockedFile; - - /** - * Given that a file exists - * When I cleanse it - * Then the content is overwritten - */ - @Test - public void cleanseFile() - { - when(mockedFile.exists()) - .thenReturn(true); - when(mockedFile.canWrite()) - .thenReturn(true); - - contentCleanser522022M.cleanse(mockedFile); - - InOrder inOrder = inOrder(contentCleanser522022M); - - inOrder.verify(contentCleanser522022M) - .overwrite(mockedFile, contentCleanser522022M.overwriteOnes); - inOrder.verify(contentCleanser522022M) - .overwrite(mockedFile, contentCleanser522022M.overwriteZeros); - inOrder.verify(contentCleanser522022M) - .overwrite(mockedFile, contentCleanser522022M.overwriteRandom); - } - - /** - * Given that the file does not exist - * When I cleanse it - * Then an exception is thrown - */ - @Test - ( - expected=ContentIOException.class - ) - public void fileDoesNotExist() - { - when(mockedFile.exists()) - .thenReturn(false); - when(mockedFile.canWrite()) - .thenReturn(true); - - contentCleanser522022M.cleanse(mockedFile); - } - - /** - * Given that I can not write to the file - * When I cleanse it - * Then an exception is thrown - */ - @Test - ( - expected=ContentIOException.class - ) - public void cantWriteToFile() - { - when(mockedFile.exists()) - .thenReturn(true); - when(mockedFile.canWrite()) - .thenReturn(false); - - contentCleanser522022M.cleanse(mockedFile); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.content.cleanser; + +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.when; + +import java.io.File; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ContentIOException; +import org.junit.Test; +import org.mockito.InOrder; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; + +/** + * Eager content store cleaner unit test. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class ContentCleanser522022MUnitTest extends BaseUnitTest +{ + @InjectMocks @Spy private ContentCleanser522022M contentCleanser522022M = new ContentCleanser522022M() + { + /** dummy implementations */ + protected void overwrite(File file, OverwriteOperation overwriteOperation) {}; + }; + + @Mock private File mockedFile; + + /** + * Given that a file exists + * When I cleanse it + * Then the content is overwritten + */ + @Test + public void cleanseFile() + { + when(mockedFile.exists()) + .thenReturn(true); + when(mockedFile.canWrite()) + .thenReturn(true); + + contentCleanser522022M.cleanse(mockedFile); + + InOrder inOrder = inOrder(contentCleanser522022M); + + inOrder.verify(contentCleanser522022M) + .overwrite(mockedFile, contentCleanser522022M.overwriteOnes); + inOrder.verify(contentCleanser522022M) + .overwrite(mockedFile, contentCleanser522022M.overwriteZeros); + inOrder.verify(contentCleanser522022M) + .overwrite(mockedFile, contentCleanser522022M.overwriteRandom); + } + + /** + * Given that the file does not exist + * When I cleanse it + * Then an exception is thrown + */ + @Test + ( + expected=ContentIOException.class + ) + public void fileDoesNotExist() + { + when(mockedFile.exists()) + .thenReturn(false); + when(mockedFile.canWrite()) + .thenReturn(true); + + contentCleanser522022M.cleanse(mockedFile); + } + + /** + * Given that I can not write to the file + * When I cleanse it + * Then an exception is thrown + */ + @Test + ( + expected=ContentIOException.class + ) + public void cantWriteToFile() + { + when(mockedFile.exists()) + .thenReturn(true); + when(mockedFile.canWrite()) + .thenReturn(false); + + contentCleanser522022M.cleanse(mockedFile); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilterUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilterUnitTest.java index c4853e8ca7..74f2b8642c 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilterUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilterUnitTest.java @@ -1,186 +1,186 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.forms; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyListOf; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.forms.Field; -import org.alfresco.repo.forms.FieldDefinition; -import org.alfresco.repo.forms.Form; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.dictionary.TypeDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * RecordsManagementTypeFormFilter Unit Test - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest -{ - private static final QName MY_CUSTOM_TYPE = generateQName(RM_URI); - - @Mock private Form mockForm; - @Mock private TypeDefinition mockTypeDefinition; - @Mock(name="recordsManagementAdminService") private RecordsManagementAdminService mockRecordsManagementAdminService; - - @Spy @InjectMocks RecordsManagementTypeFormFilter typeFormFilter; - - /** - * Test addCustomRMProperties - no custom properties found - */ - @Test - public void testAddCustomRMPropertiesNoneFound() - { - typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm); - verifyZeroInteractions(mockForm); - } - - /** - * Test that non-customisable types are being treated correctly - */ - @Test - public void testAfterGenerateNotCustomisable() - { - when(mockTypeDefinition.getName()).thenReturn(MY_CUSTOM_TYPE); - when(mockRecordsManagementAdminService.isCustomisable(MY_CUSTOM_TYPE)).thenReturn(false); - - typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); - - verify(typeFormFilter, never()).addCustomRMProperties(any(QName.class), any(Form.class)); - } - - /** - * Test that customisable types are being treated correctly - */ - @Test - public void testAfterGenerateCustomisable() - { - when(mockTypeDefinition.getName()).thenReturn(MY_CUSTOM_TYPE); - when(mockRecordsManagementAdminService.isCustomisable(MY_CUSTOM_TYPE)).thenReturn(true); - - typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); - - verify(typeFormFilter, times(1)).addCustomRMProperties(any(QName.class), any(Form.class)); - } - - /** - * Test the default values for certain properties are being set correctly - */ - @Test - public void testDefaultFormValues() - { - List defs = new ArrayList(3); - FieldDefinition idDef = mockFieldDefinition("rma:identifier"); - defs.add(idDef); - FieldDefinition vrDef = mockFieldDefinition("rma:vitalRecordIndicator"); - defs.add(vrDef); - FieldDefinition rpDef = mockFieldDefinition("rma:reviewPeriod"); - defs.add(rpDef); - - when(mockForm.getFieldDefinitions()).thenReturn(defs); - - typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); - - verify(mockedIdentifierService).generateIdentifier(any(QName.class), any(NodeRef.class)); - verify(idDef).setDefaultValue(anyString()); - verify(vrDef).setDefaultValue(Boolean.FALSE.toString()); - verify(rpDef).setDefaultValue("none|0"); - } - - /** - * Helper to mock field definition - */ - private FieldDefinition mockFieldDefinition(String name) - { - FieldDefinition def = mock(FieldDefinition.class); - when(def.getName()).thenReturn(name); - return def; - } - - /** - * Test addCustomRMProperties - two custom properties found - */ - @Test - public void testAddCustomRMProperties() - { - // map of custom properties - Map properties = mockPropertyDefintionMap(2); - - // setup rm admin service to return properties for my custom type - when(mockRecordsManagementAdminService.getCustomPropertyDefinitions(MY_CUSTOM_TYPE)).thenReturn(properties); - - // call method - typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm); - - // ensure that two custom properties have been added to the form - verify(mockForm, times(1)).addFields(anyListOf(Field.class)); - } - - /** - * Helper method to createa a mock property definition map - */ - private Map mockPropertyDefintionMap(int size) - { - Map properties = new HashMap(size); - for (int i = 0; i < size; i++) - { - QName name = generateQName(RM_URI); - PropertyDefinition propDef = mock(PropertyDefinition.class); - when(propDef.getName()).thenReturn(name); - DataTypeDefinition mockDataTypeDefinition = mock(DataTypeDefinition.class); - when(mockDataTypeDefinition.getName()).thenReturn(DataTypeDefinition.TEXT); - when(propDef.getDataType()).thenReturn(mockDataTypeDefinition); - properties.put(name, propDef); - } - return properties; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.forms; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyListOf; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.repo.forms.Field; +import org.alfresco.repo.forms.FieldDefinition; +import org.alfresco.repo.forms.Form; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.dictionary.TypeDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; + +/** + * RecordsManagementTypeFormFilter Unit Test + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RecordsManagementTypeFormFilterUnitTest extends BaseUnitTest +{ + private static final QName MY_CUSTOM_TYPE = generateQName(RM_URI); + + @Mock private Form mockForm; + @Mock private TypeDefinition mockTypeDefinition; + @Mock(name="recordsManagementAdminService") private RecordsManagementAdminService mockRecordsManagementAdminService; + + @Spy @InjectMocks RecordsManagementTypeFormFilter typeFormFilter; + + /** + * Test addCustomRMProperties - no custom properties found + */ + @Test + public void testAddCustomRMPropertiesNoneFound() + { + typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm); + verifyZeroInteractions(mockForm); + } + + /** + * Test that non-customisable types are being treated correctly + */ + @Test + public void testAfterGenerateNotCustomisable() + { + when(mockTypeDefinition.getName()).thenReturn(MY_CUSTOM_TYPE); + when(mockRecordsManagementAdminService.isCustomisable(MY_CUSTOM_TYPE)).thenReturn(false); + + typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); + + verify(typeFormFilter, never()).addCustomRMProperties(any(QName.class), any(Form.class)); + } + + /** + * Test that customisable types are being treated correctly + */ + @Test + public void testAfterGenerateCustomisable() + { + when(mockTypeDefinition.getName()).thenReturn(MY_CUSTOM_TYPE); + when(mockRecordsManagementAdminService.isCustomisable(MY_CUSTOM_TYPE)).thenReturn(true); + + typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); + + verify(typeFormFilter, times(1)).addCustomRMProperties(any(QName.class), any(Form.class)); + } + + /** + * Test the default values for certain properties are being set correctly + */ + @Test + public void testDefaultFormValues() + { + List defs = new ArrayList(3); + FieldDefinition idDef = mockFieldDefinition("rma:identifier"); + defs.add(idDef); + FieldDefinition vrDef = mockFieldDefinition("rma:vitalRecordIndicator"); + defs.add(vrDef); + FieldDefinition rpDef = mockFieldDefinition("rma:reviewPeriod"); + defs.add(rpDef); + + when(mockForm.getFieldDefinitions()).thenReturn(defs); + + typeFormFilter.afterGenerate(mockTypeDefinition, null, null, mockForm, null); + + verify(mockedIdentifierService).generateIdentifier(any(QName.class), any(NodeRef.class)); + verify(idDef).setDefaultValue(anyString()); + verify(vrDef).setDefaultValue(Boolean.FALSE.toString()); + verify(rpDef).setDefaultValue("none|0"); + } + + /** + * Helper to mock field definition + */ + private FieldDefinition mockFieldDefinition(String name) + { + FieldDefinition def = mock(FieldDefinition.class); + when(def.getName()).thenReturn(name); + return def; + } + + /** + * Test addCustomRMProperties - two custom properties found + */ + @Test + public void testAddCustomRMProperties() + { + // map of custom properties + Map properties = mockPropertyDefintionMap(2); + + // setup rm admin service to return properties for my custom type + when(mockRecordsManagementAdminService.getCustomPropertyDefinitions(MY_CUSTOM_TYPE)).thenReturn(properties); + + // call method + typeFormFilter.addCustomRMProperties(MY_CUSTOM_TYPE, mockForm); + + // ensure that two custom properties have been added to the form + verify(mockForm, times(1)).addFields(anyListOf(Field.class)); + } + + /** + * Helper method to createa a mock property definition map + */ + private Map mockPropertyDefintionMap(int size) + { + Map properties = new HashMap(size); + for (int i = 0; i < size; i++) + { + QName name = generateQName(RM_URI); + PropertyDefinition propDef = mock(PropertyDefinition.class); + when(propDef.getName()).thenReturn(name); + DataTypeDefinition mockDataTypeDefinition = mock(DataTypeDefinition.class); + when(mockDataTypeDefinition.getName()).thenReturn(DataTypeDefinition.TEXT); + when(propDef.getDataType()).thenReturn(mockDataTypeDefinition); + properties.put(name, propDef); + } + return properties; + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java index 2b0b81de54..169a6bc694 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java @@ -1,468 +1,468 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.hold; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -/** - * Hold service implementation unit test - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldServiceImplUnitTest extends BaseUnitTest -{ - /** test values */ - private static final String HOLD_NAME = "holdname"; - private static final String HOLD_REASON = "holdreason"; - private static final String HOLD_DESCRIPTION = "holddescription"; - - protected NodeRef holdContainer; - protected NodeRef hold; - protected NodeRef hold2; - - @Spy @InjectMocks HoldServiceImpl holdService; - - @Before - @Override - public void before() throws Exception - { - super.before(); - - // setup objects used in mock interactions - holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - hold = generateNodeRef(TYPE_HOLD); - hold2 = generateNodeRef(TYPE_HOLD); - - // setup interactions - doReturn(holdContainer).when(mockedFilePlanService).getHoldContainer(filePlan); - } - - @Test - public void isHold() - { - assertTrue(holdService.isHold(hold)); - assertFalse(holdService.isHold(recordFolder)); - } - - @Test - public void heldByMultipleResults() - { - // setup record folder in multiple holds - List holds = new ArrayList(2); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold, ASSOC_FROZEN_RECORDS, recordFolder, true, 1)); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold2, ASSOC_FROZEN_RECORDS, recordFolder, true, 2)); - doReturn(holds).when(mockedNodeService).getParentAssocs(recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - - // check that both holds are found for record folder - List heldByHolds = holdService.heldBy(recordFolder, true); - assertNotNull(heldByHolds); - assertEquals(2, heldByHolds.size()); - assertTrue(holdService.heldBy(recordFolder, false).isEmpty()); - - // check that both holds are found for record (even thou they are one level deep) - heldByHolds = holdService.heldBy(record, true); - assertNotNull(heldByHolds); - assertEquals(2, heldByHolds.size()); - assertTrue(holdService.heldBy(record, false).isEmpty()); - } - - @Test (expected=AlfrescoRuntimeException.class) - public void getHold() - { - // setup node service interactions - when(mockedNodeService.getChildByName(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), anyString())).thenReturn(null) - .thenReturn(hold) - .thenReturn(recordFolder); - - // no hold - NodeRef noHold = holdService.getHold(filePlan, "notAHold"); - assertNull(noHold); - - // found hold - NodeRef someHold = holdService.getHold(filePlan, "someHold"); - assertNotNull(someHold); - assertEquals(TYPE_HOLD, mockedNodeService.getType(someHold)); - - // ensure runtime exception is thrown - holdService.getHold(filePlan, "notHold"); - } - - @Test (expected=RuntimeException.class) - public void getHeldNotAHold() - { - holdService.getHeld(recordFolder); - } - - @Test - public void getHeldNoResults() - { - assertTrue(holdService.getHeld(hold).isEmpty()); - } - - @Test - public void getHeldWithResults() - { - // setup record folder in hold - List holds = new ArrayList(1); - holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold, ASSOC_FROZEN_RECORDS, recordFolder, true, 1)); - doReturn(holds).when(mockedNodeService).getChildAssocs(hold, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); - - List list = holdService.getHeld(hold); - assertEquals(1, list.size()); - assertEquals(recordFolder, list.get(0)); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test - public void createHold() - { - // setup node service interactions - when(mockedNodeService.createNode(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), any(QName.class) , eq(TYPE_HOLD), any(Map.class))) - .thenReturn(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, holdContainer, generateQName(), hold)); - - // create hold - NodeRef newHold = holdService.createHold(filePlan, HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION); - assertNotNull(newHold); - assertEquals(TYPE_HOLD, mockedNodeService.getType(newHold)); - assertEquals(hold, newHold); - - // check the node service interactions - ArgumentCaptor propertyMapCaptor = ArgumentCaptor.forClass(Map.class); - ArgumentCaptor assocNameCaptor = ArgumentCaptor.forClass(QName.class); - verify(mockedNodeService).createNode(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), assocNameCaptor.capture() , eq(TYPE_HOLD), propertyMapCaptor.capture()); - - // check property map - Map propertyMap = (Map)propertyMapCaptor.getValue(); - assertNotNull(propertyMap); - assertEquals(3, propertyMap.size()); - assertTrue(propertyMap.containsKey(ContentModel.PROP_NAME)); - assertEquals(HOLD_NAME, propertyMap.get(ContentModel.PROP_NAME)); - assertTrue(propertyMap.containsKey(ContentModel.PROP_DESCRIPTION)); - assertEquals(HOLD_DESCRIPTION, propertyMap.get(ContentModel.PROP_DESCRIPTION)); - assertTrue(propertyMap.containsKey(PROP_HOLD_REASON)); - assertEquals(HOLD_REASON, propertyMap.get(PROP_HOLD_REASON)); - - // check assoc name - assertNotNull(assocNameCaptor.getValue()); - assertEquals(NamespaceService.CONTENT_MODEL_1_0_URI, assocNameCaptor.getValue().getNamespaceURI()); - assertEquals(HOLD_NAME, assocNameCaptor.getValue().getLocalName()); - } - - @Test - public void getHoldReason() - { - // setup node service interactions - when(mockedNodeService.exists(hold)) - .thenReturn(false) - .thenReturn(true) - .thenReturn(true) - .thenReturn(true); - when(mockedNodeService.getProperty(eq(hold), eq(PROP_HOLD_REASON))) - .thenReturn(null) - .thenReturn(HOLD_REASON); - - // node does not exist - assertNull(holdService.getHoldReason(hold)); - - // node isn't a hold - assertNull(holdService.getHoldReason(recordFolder)); - - // hold reason isn't set - assertNull(holdService.getHoldReason(hold)); - - // hold reason set - assertEquals(HOLD_REASON, holdService.getHoldReason(hold)); - } - - @Test - public void setHoldReason() - { - // setup node service interactions - when(mockedNodeService.exists(hold)) - .thenReturn(false) - .thenReturn(true) - .thenReturn(true); - - // node does not exist - holdService.setHoldReason(hold, HOLD_REASON); - verify(mockedNodeService, never()).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); - - // node isn't a hold - holdService.setHoldReason(recordFolder, HOLD_REASON); - verify(mockedNodeService, never()).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); - - // set hold reason - holdService.setHoldReason(hold, HOLD_REASON); - verify(mockedNodeService).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); - } - - @Test (expected=AlfrescoRuntimeException.class) - public void deleteHoldNotAHold() - { - holdService.deleteHold(recordFolder); - verify(mockedNodeService, never()).deleteNode(hold); - } - - @Test - public void deleteHold() - { - // delete hold - holdService.deleteHold(hold); - verify(mockedNodeService).deleteNode(hold); - - // TODO check interactions with policy component!!! - } - - @Test (expected=AlfrescoRuntimeException.class) - public void addToHoldNotAHold() - { - holdService.addToHold(recordFolder, recordFolder); - } - - @Test (expected=AlfrescoRuntimeException.class) - public void addToHoldNotARecordFolderOrRecord() - { - NodeRef anotherThing = generateNodeRef(TYPE_RECORD_CATEGORY); - holdService.addToHold(hold, anotherThing); - } - - @SuppressWarnings("unchecked") - @Test - public void addToHoldNotInHold() - { - holdService.addToHold(hold, recordFolder); - - verify(mockedNodeService).addChild(hold, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - verify(mockedNodeService).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(recordFolder), anyString()); - - holdService.addToHold(hold, record); - verify(mockedNodeService).addChild(hold, record, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - verify(mockedNodeService).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService, times(2)).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(record), anyString()); - } - - @SuppressWarnings("unchecked") - @Test - public void addToHoldAlreadyInHold() - { - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); - - holdService.addToHold(hold, recordFolder); - - verify(mockedNodeService, never()).addChild(hold, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - verify(mockedNodeService, never()).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService, never()).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedRecordsManagementAuditService, never()).auditEvent(eq(recordFolder), anyString()); - } - - @SuppressWarnings("unchecked") - @Test - public void addToHoldAldeadyFrozen() - { - doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); - - holdService.addToHold(hold, recordFolder); - - verify(mockedNodeService, times(1)).addChild(hold, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - verify(mockedNodeService, never()).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService, never()).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(recordFolder), anyString()); - } - - @SuppressWarnings("unchecked") - @Test - public void addToHolds() - { - // ensure the interaction indicates that a node has the frozen aspect applied if it has - doAnswer(new Answer() - { - public Void answer(InvocationOnMock invocation) - { - NodeRef nodeRef = (NodeRef)invocation.getArguments()[0]; - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FROZEN); - return null; - } - - }).when(mockedNodeService).addAspect(any(NodeRef.class), eq(ASPECT_FROZEN), any(Map.class)); - - // build a list of holds - List holds = new ArrayList(2); - holds.add(hold); - holds.add(hold2); - - // add the record folder to both holds - holdService.addToHolds(holds, recordFolder); - - // verify the interactions - verify(mockedNodeService, times(1)).addChild(hold, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - verify(mockedNodeService, times(1)).addChild(hold2, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - verify(mockedNodeService, times(1)).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedNodeService, times(1)).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); - verify(mockedRecordsManagementAuditService, times(2)).auditEvent(eq(recordFolder), anyString()); - } - - @Test (expected=AlfrescoRuntimeException.class) - public void removeFromHoldNotAHold() - { - holdService.removeFromHold(recordFolder, recordFolder); - } - - @Test - public void removeFromHoldNotInHold() - { - holdService.removeFromHold(hold, recordFolder); - - verify(mockedNodeService, never()).removeChild(hold, recordFolder); - verify(mockedNodeService, never()).removeAspect(recordFolder, ASPECT_FROZEN); - verify(mockedNodeService, never()).removeAspect(record, ASPECT_FROZEN); - verify(mockedRecordsManagementAuditService, never()).auditEvent(eq(recordFolder), anyString()); - } - - @Test - public void removeFromHold() - { - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); - doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); - - holdService.removeFromHold(hold, recordFolder); - - verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); - verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); - verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); - verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(recordFolder), anyString()); - } - - @Test - public void removeFromHolds() - { - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold2); - doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); - - // build a list of holds - List holds = new ArrayList(2); - holds.add(hold); - holds.add(hold2); - - holdService.removeFromHolds(holds, recordFolder); - - verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); - verify(mockedNodeService, times(1)).removeChild(hold2, recordFolder); - verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); - verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); - verify(mockedRecordsManagementAuditService, times(2)).auditEvent(any(NodeRef.class), anyString()); - } - - @Test - public void removeFromAllHolds() - { - // build a list of holds - List holds = new ArrayList(2); - holds.add(hold); - holds.add(hold2); - - doAnswer(new Answer() - { - public Void answer(InvocationOnMock invocation) - { - doReturn(Collections.singletonList(hold2)).when(holdService).heldBy(recordFolder, true); - return null; - } - - }).when(mockedNodeService).removeChild(hold, recordFolder); - - doAnswer(new Answer() - { - public Void answer(InvocationOnMock invocation) - { - doReturn(new ArrayList()).when(holdService).heldBy(recordFolder, true); - return null; - } - - }).when(mockedNodeService).removeChild(hold2, recordFolder); - - // define interactions - doReturn(holds).when(holdService).heldBy(recordFolder, true); - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); - doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold2); - doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); - - // remove record folder from all holds - holdService.removeFromAllHolds(recordFolder); - - // verify interactions - verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); - verify(mockedNodeService, times(1)).removeChild(hold2, recordFolder); - verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); - verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.hold; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +/** + * Hold service implementation unit test + * + * @author Roy Wetherall + * @since 2.2 + */ +public class HoldServiceImplUnitTest extends BaseUnitTest +{ + /** test values */ + private static final String HOLD_NAME = "holdname"; + private static final String HOLD_REASON = "holdreason"; + private static final String HOLD_DESCRIPTION = "holddescription"; + + protected NodeRef holdContainer; + protected NodeRef hold; + protected NodeRef hold2; + + @Spy @InjectMocks HoldServiceImpl holdService; + + @Before + @Override + public void before() throws Exception + { + super.before(); + + // setup objects used in mock interactions + holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); + hold = generateNodeRef(TYPE_HOLD); + hold2 = generateNodeRef(TYPE_HOLD); + + // setup interactions + doReturn(holdContainer).when(mockedFilePlanService).getHoldContainer(filePlan); + } + + @Test + public void isHold() + { + assertTrue(holdService.isHold(hold)); + assertFalse(holdService.isHold(recordFolder)); + } + + @Test + public void heldByMultipleResults() + { + // setup record folder in multiple holds + List holds = new ArrayList(2); + holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold, ASSOC_FROZEN_RECORDS, recordFolder, true, 1)); + holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold2, ASSOC_FROZEN_RECORDS, recordFolder, true, 2)); + doReturn(holds).when(mockedNodeService).getParentAssocs(recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + + // check that both holds are found for record folder + List heldByHolds = holdService.heldBy(recordFolder, true); + assertNotNull(heldByHolds); + assertEquals(2, heldByHolds.size()); + assertTrue(holdService.heldBy(recordFolder, false).isEmpty()); + + // check that both holds are found for record (even thou they are one level deep) + heldByHolds = holdService.heldBy(record, true); + assertNotNull(heldByHolds); + assertEquals(2, heldByHolds.size()); + assertTrue(holdService.heldBy(record, false).isEmpty()); + } + + @Test (expected=AlfrescoRuntimeException.class) + public void getHold() + { + // setup node service interactions + when(mockedNodeService.getChildByName(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), anyString())).thenReturn(null) + .thenReturn(hold) + .thenReturn(recordFolder); + + // no hold + NodeRef noHold = holdService.getHold(filePlan, "notAHold"); + assertNull(noHold); + + // found hold + NodeRef someHold = holdService.getHold(filePlan, "someHold"); + assertNotNull(someHold); + assertEquals(TYPE_HOLD, mockedNodeService.getType(someHold)); + + // ensure runtime exception is thrown + holdService.getHold(filePlan, "notHold"); + } + + @Test (expected=RuntimeException.class) + public void getHeldNotAHold() + { + holdService.getHeld(recordFolder); + } + + @Test + public void getHeldNoResults() + { + assertTrue(holdService.getHeld(hold).isEmpty()); + } + + @Test + public void getHeldWithResults() + { + // setup record folder in hold + List holds = new ArrayList(1); + holds.add(new ChildAssociationRef(ASSOC_FROZEN_RECORDS, hold, ASSOC_FROZEN_RECORDS, recordFolder, true, 1)); + doReturn(holds).when(mockedNodeService).getChildAssocs(hold, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); + + List list = holdService.getHeld(hold); + assertEquals(1, list.size()); + assertEquals(recordFolder, list.get(0)); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Test + public void createHold() + { + // setup node service interactions + when(mockedNodeService.createNode(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), any(QName.class) , eq(TYPE_HOLD), any(Map.class))) + .thenReturn(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, holdContainer, generateQName(), hold)); + + // create hold + NodeRef newHold = holdService.createHold(filePlan, HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION); + assertNotNull(newHold); + assertEquals(TYPE_HOLD, mockedNodeService.getType(newHold)); + assertEquals(hold, newHold); + + // check the node service interactions + ArgumentCaptor propertyMapCaptor = ArgumentCaptor.forClass(Map.class); + ArgumentCaptor assocNameCaptor = ArgumentCaptor.forClass(QName.class); + verify(mockedNodeService).createNode(eq(holdContainer), eq(ContentModel.ASSOC_CONTAINS), assocNameCaptor.capture() , eq(TYPE_HOLD), propertyMapCaptor.capture()); + + // check property map + Map propertyMap = (Map)propertyMapCaptor.getValue(); + assertNotNull(propertyMap); + assertEquals(3, propertyMap.size()); + assertTrue(propertyMap.containsKey(ContentModel.PROP_NAME)); + assertEquals(HOLD_NAME, propertyMap.get(ContentModel.PROP_NAME)); + assertTrue(propertyMap.containsKey(ContentModel.PROP_DESCRIPTION)); + assertEquals(HOLD_DESCRIPTION, propertyMap.get(ContentModel.PROP_DESCRIPTION)); + assertTrue(propertyMap.containsKey(PROP_HOLD_REASON)); + assertEquals(HOLD_REASON, propertyMap.get(PROP_HOLD_REASON)); + + // check assoc name + assertNotNull(assocNameCaptor.getValue()); + assertEquals(NamespaceService.CONTENT_MODEL_1_0_URI, assocNameCaptor.getValue().getNamespaceURI()); + assertEquals(HOLD_NAME, assocNameCaptor.getValue().getLocalName()); + } + + @Test + public void getHoldReason() + { + // setup node service interactions + when(mockedNodeService.exists(hold)) + .thenReturn(false) + .thenReturn(true) + .thenReturn(true) + .thenReturn(true); + when(mockedNodeService.getProperty(eq(hold), eq(PROP_HOLD_REASON))) + .thenReturn(null) + .thenReturn(HOLD_REASON); + + // node does not exist + assertNull(holdService.getHoldReason(hold)); + + // node isn't a hold + assertNull(holdService.getHoldReason(recordFolder)); + + // hold reason isn't set + assertNull(holdService.getHoldReason(hold)); + + // hold reason set + assertEquals(HOLD_REASON, holdService.getHoldReason(hold)); + } + + @Test + public void setHoldReason() + { + // setup node service interactions + when(mockedNodeService.exists(hold)) + .thenReturn(false) + .thenReturn(true) + .thenReturn(true); + + // node does not exist + holdService.setHoldReason(hold, HOLD_REASON); + verify(mockedNodeService, never()).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); + + // node isn't a hold + holdService.setHoldReason(recordFolder, HOLD_REASON); + verify(mockedNodeService, never()).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); + + // set hold reason + holdService.setHoldReason(hold, HOLD_REASON); + verify(mockedNodeService).setProperty(hold, PROP_HOLD_REASON, HOLD_REASON); + } + + @Test (expected=AlfrescoRuntimeException.class) + public void deleteHoldNotAHold() + { + holdService.deleteHold(recordFolder); + verify(mockedNodeService, never()).deleteNode(hold); + } + + @Test + public void deleteHold() + { + // delete hold + holdService.deleteHold(hold); + verify(mockedNodeService).deleteNode(hold); + + // TODO check interactions with policy component!!! + } + + @Test (expected=AlfrescoRuntimeException.class) + public void addToHoldNotAHold() + { + holdService.addToHold(recordFolder, recordFolder); + } + + @Test (expected=AlfrescoRuntimeException.class) + public void addToHoldNotARecordFolderOrRecord() + { + NodeRef anotherThing = generateNodeRef(TYPE_RECORD_CATEGORY); + holdService.addToHold(hold, anotherThing); + } + + @SuppressWarnings("unchecked") + @Test + public void addToHoldNotInHold() + { + holdService.addToHold(hold, recordFolder); + + verify(mockedNodeService).addChild(hold, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + verify(mockedNodeService).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedNodeService).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(recordFolder), anyString()); + + holdService.addToHold(hold, record); + verify(mockedNodeService).addChild(hold, record, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + verify(mockedNodeService).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedNodeService, times(2)).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(record), anyString()); + } + + @SuppressWarnings("unchecked") + @Test + public void addToHoldAlreadyInHold() + { + doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); + + holdService.addToHold(hold, recordFolder); + + verify(mockedNodeService, never()).addChild(hold, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + verify(mockedNodeService, never()).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedNodeService, never()).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedRecordsManagementAuditService, never()).auditEvent(eq(recordFolder), anyString()); + } + + @SuppressWarnings("unchecked") + @Test + public void addToHoldAldeadyFrozen() + { + doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); + doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); + + holdService.addToHold(hold, recordFolder); + + verify(mockedNodeService, times(1)).addChild(hold, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + verify(mockedNodeService, never()).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedNodeService, never()).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(recordFolder), anyString()); + } + + @SuppressWarnings("unchecked") + @Test + public void addToHolds() + { + // ensure the interaction indicates that a node has the frozen aspect applied if it has + doAnswer(new Answer() + { + public Void answer(InvocationOnMock invocation) + { + NodeRef nodeRef = (NodeRef)invocation.getArguments()[0]; + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FROZEN); + return null; + } + + }).when(mockedNodeService).addAspect(any(NodeRef.class), eq(ASPECT_FROZEN), any(Map.class)); + + // build a list of holds + List holds = new ArrayList(2); + holds.add(hold); + holds.add(hold2); + + // add the record folder to both holds + holdService.addToHolds(holds, recordFolder); + + // verify the interactions + verify(mockedNodeService, times(1)).addChild(hold, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + verify(mockedNodeService, times(1)).addChild(hold2, recordFolder, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); + verify(mockedNodeService, times(1)).addAspect(eq(recordFolder), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedNodeService, times(1)).addAspect(eq(record), eq(ASPECT_FROZEN), any(Map.class)); + verify(mockedRecordsManagementAuditService, times(2)).auditEvent(eq(recordFolder), anyString()); + } + + @Test (expected=AlfrescoRuntimeException.class) + public void removeFromHoldNotAHold() + { + holdService.removeFromHold(recordFolder, recordFolder); + } + + @Test + public void removeFromHoldNotInHold() + { + holdService.removeFromHold(hold, recordFolder); + + verify(mockedNodeService, never()).removeChild(hold, recordFolder); + verify(mockedNodeService, never()).removeAspect(recordFolder, ASPECT_FROZEN); + verify(mockedNodeService, never()).removeAspect(record, ASPECT_FROZEN); + verify(mockedRecordsManagementAuditService, never()).auditEvent(eq(recordFolder), anyString()); + } + + @Test + public void removeFromHold() + { + doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); + doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); + doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); + + holdService.removeFromHold(hold, recordFolder); + + verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); + verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); + verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); + verify(mockedRecordsManagementAuditService, times(1)).auditEvent(eq(recordFolder), anyString()); + } + + @Test + public void removeFromHolds() + { + doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); + doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold2); + doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); + doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); + + // build a list of holds + List holds = new ArrayList(2); + holds.add(hold); + holds.add(hold2); + + holdService.removeFromHolds(holds, recordFolder); + + verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); + verify(mockedNodeService, times(1)).removeChild(hold2, recordFolder); + verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); + verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); + verify(mockedRecordsManagementAuditService, times(2)).auditEvent(any(NodeRef.class), anyString()); + } + + @Test + public void removeFromAllHolds() + { + // build a list of holds + List holds = new ArrayList(2); + holds.add(hold); + holds.add(hold2); + + doAnswer(new Answer() + { + public Void answer(InvocationOnMock invocation) + { + doReturn(Collections.singletonList(hold2)).when(holdService).heldBy(recordFolder, true); + return null; + } + + }).when(mockedNodeService).removeChild(hold, recordFolder); + + doAnswer(new Answer() + { + public Void answer(InvocationOnMock invocation) + { + doReturn(new ArrayList()).when(holdService).heldBy(recordFolder, true); + return null; + } + + }).when(mockedNodeService).removeChild(hold2, recordFolder); + + // define interactions + doReturn(holds).when(holdService).heldBy(recordFolder, true); + doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold); + doReturn(Collections.singletonList(recordFolder)).when(holdService).getHeld(hold2); + doReturn(true).when(mockedNodeService).hasAspect(recordFolder, ASPECT_FROZEN); + doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_FROZEN); + + // remove record folder from all holds + holdService.removeFromAllHolds(recordFolder); + + // verify interactions + verify(mockedNodeService, times(1)).removeChild(hold, recordFolder); + verify(mockedNodeService, times(1)).removeChild(hold2, recordFolder); + verify(mockedNodeService, times(1)).removeAspect(recordFolder, ASPECT_FROZEN); + verify(mockedNodeService, times(1)).removeAspect(record, ASPECT_FROZEN); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java index 24b580549a..6454fca64f 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java @@ -1,255 +1,255 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.job; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.contains; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; - -import java.util.Collections; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Disposition lifecycle job execution unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest -{ - /** disposition actions */ - private static final String CUTOFF = "cutoff"; - private static final String RETAIN = "retain"; - private static final String DESTROY = "destroy"; - - /** test query snipit */ - private static final String QUERY = "\"" + CUTOFF + "\" OR \"" + RETAIN + "\""; - - /** mocked result set */ - @Mock ResultSet mockedResultSet; - - /** disposition lifecycle job executer */ - @InjectMocks DispositionLifecycleJobExecuter executer; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - @Before - public void before() throws Exception - { - super.before(); - - // setup data - List dispositionActions = buildList(CUTOFF, RETAIN); - executer.setDispositionActions(dispositionActions); - - // setup interactions - doReturn(mockedResultSet).when(mockedSearchService).query(eq(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), eq(SearchService.LANGUAGE_FTS_ALFRESCO), anyString()); - } - - /** - * Helper method to verify that the query has been executed and closed - */ - private void verifyQuery() - { - verify(mockedSearchService, times(1)).query(eq(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), eq(SearchService.LANGUAGE_FTS_ALFRESCO), contains(QUERY)); - verify(mockedResultSet, times(1)).getNodeRefs(); - verify(mockedResultSet, times(1)).close(); - } - - /** - * When the are no results in query. - */ - @Test - public void noResultsInQuery() - { - // given - doReturn(Collections.EMPTY_LIST).when(mockedResultSet).getNodeRefs(); - - // when - executer.executeImpl(); - - // then - - // ensure the query is executed and closed - verifyQuery(); - - // ensure nothing else happens becuase we have no results - verifyZeroInteractions(mockedNodeService, mockedRecordFolderService, mockedRetryingTransactionHelper); - } - - /** - * When the disposition actions do not match those that can be processed automatically. - */ - @SuppressWarnings("unchecked") - @Test - public void dispositionActionDoesNotMatch() - { - // test data - NodeRef node1 = generateNodeRef(); - NodeRef node2 = generateNodeRef(); - List nodeRefs = buildList(node1, node2); - - // given - doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); - doReturn(DESTROY).when(mockedNodeService).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); - doReturn(DESTROY).when(mockedNodeService).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); - - // when - executer.executeImpl(); - - // then - - // ensure the query is executed and closed - verifyQuery(); - - // ensure work is executed in transaction for each node processed - verify(mockedNodeService, times(2)).exists(any(NodeRef.class)); - verify(mockedRetryingTransactionHelper, times(2)).doInTransaction(any(RetryingTransactionCallback.class)); - - // ensure each node is process correctly - verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); - verify(mockedNodeService, times(1)).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); - - // ensure no more interactions - verifyNoMoreInteractions(mockedNodeService); - verifyZeroInteractions(mockedRecordsManagementActionService); - - } - - /** - * When a node does not exist - */ - @Test - public void nodeDoesNotExist() - { - // test data - NodeRef node1 = generateNodeRef(null, false); - List nodeRefs = buildList(node1); - - // given - doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); - - // when - executer.executeImpl(); - - // then - - // ensure the query is executed and closed - verifyQuery(); - - // ensure the node exist check is made for the node - verify(mockedNodeService, times(1)).exists(any(NodeRef.class)); - - // ensure no more interactions - verifyNoMoreInteractions(mockedNodeService); - verifyZeroInteractions(mockedRecordsManagementActionService, mockedRetryingTransactionHelper); - } - - /** - * When there are disposition actions eligible for processing - */ - @SuppressWarnings("unchecked") - @Test - public void dispositionActionProcessed() - { - // test data - NodeRef node1 = generateNodeRef(); - NodeRef node2 = generateNodeRef(); - List nodeRefs = buildList(node1, node2); - NodeRef parent = generateNodeRef(); - ChildAssociationRef parentAssoc = new ChildAssociationRef(ASSOC_NEXT_DISPOSITION_ACTION, parent, generateQName(), generateNodeRef()); - - // given - doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); - doReturn(CUTOFF).when(mockedNodeService).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); - doReturn(RETAIN).when(mockedNodeService).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); - doReturn(parentAssoc).when(mockedNodeService).getPrimaryParent(any(NodeRef.class)); - - // when - executer.executeImpl(); - - // then - - // ensure the query is executed and closed - verifyQuery(); - - // ensure work is executed in transaction for each node processed - verify(mockedNodeService, times(2)).exists(any(NodeRef.class)); - verify(mockedRetryingTransactionHelper, times(2)).doInTransaction(any(RetryingTransactionCallback.class)); - - // ensure each node is process correctly - // node1 - verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); - verify(mockedNodeService, times(1)).getPrimaryParent(node1); - verify(mockedRecordsManagementActionService, times(1)).executeRecordsManagementAction(eq(parent), eq(CUTOFF), anyMap()); - // node2 - verify(mockedNodeService, times(1)).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); - verify(mockedNodeService, times(1)).getPrimaryParent(node2); - verify(mockedRecordsManagementActionService, times(1)).executeRecordsManagementAction(eq(parent), eq(RETAIN), anyMap()); - - // ensure no more interactions - verifyNoMoreInteractions(mockedNodeService, mockedRecordsManagementActionService); - } - - /** - * Brittle unit test that simply checks the generated query is an exact string when the supplied disposition actions - * are "CUTOFF" and "RETAIN" (see {@link #before}). - */ - @Test - public void testGetQuery() - { - String actual = executer.getQuery(); - - String expected = "TYPE:\"rma:dispositionAction\" + (@rma\\:dispositionAction:(\"cutoff\" OR \"retain\")) AND ISUNSET:\"rma:dispositionActionCompletedAt\" AND ( @rma\\:dispositionEventsEligible:true OR @rma\\:dispositionAsOf:[MIN TO NOW] ) "; - assertEquals(expected, actual); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.job; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.contains; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.verifyZeroInteractions; + +import java.util.Collections; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; + +/** + * Disposition lifecycle job execution unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest +{ + /** disposition actions */ + private static final String CUTOFF = "cutoff"; + private static final String RETAIN = "retain"; + private static final String DESTROY = "destroy"; + + /** test query snipit */ + private static final String QUERY = "\"" + CUTOFF + "\" OR \"" + RETAIN + "\""; + + /** mocked result set */ + @Mock ResultSet mockedResultSet; + + /** disposition lifecycle job executer */ + @InjectMocks DispositionLifecycleJobExecuter executer; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Override + @Before + public void before() throws Exception + { + super.before(); + + // setup data + List dispositionActions = buildList(CUTOFF, RETAIN); + executer.setDispositionActions(dispositionActions); + + // setup interactions + doReturn(mockedResultSet).when(mockedSearchService).query(eq(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), eq(SearchService.LANGUAGE_FTS_ALFRESCO), anyString()); + } + + /** + * Helper method to verify that the query has been executed and closed + */ + private void verifyQuery() + { + verify(mockedSearchService, times(1)).query(eq(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), eq(SearchService.LANGUAGE_FTS_ALFRESCO), contains(QUERY)); + verify(mockedResultSet, times(1)).getNodeRefs(); + verify(mockedResultSet, times(1)).close(); + } + + /** + * When the are no results in query. + */ + @Test + public void noResultsInQuery() + { + // given + doReturn(Collections.EMPTY_LIST).when(mockedResultSet).getNodeRefs(); + + // when + executer.executeImpl(); + + // then + + // ensure the query is executed and closed + verifyQuery(); + + // ensure nothing else happens becuase we have no results + verifyZeroInteractions(mockedNodeService, mockedRecordFolderService, mockedRetryingTransactionHelper); + } + + /** + * When the disposition actions do not match those that can be processed automatically. + */ + @SuppressWarnings("unchecked") + @Test + public void dispositionActionDoesNotMatch() + { + // test data + NodeRef node1 = generateNodeRef(); + NodeRef node2 = generateNodeRef(); + List nodeRefs = buildList(node1, node2); + + // given + doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); + doReturn(DESTROY).when(mockedNodeService).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); + doReturn(DESTROY).when(mockedNodeService).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); + + // when + executer.executeImpl(); + + // then + + // ensure the query is executed and closed + verifyQuery(); + + // ensure work is executed in transaction for each node processed + verify(mockedNodeService, times(2)).exists(any(NodeRef.class)); + verify(mockedRetryingTransactionHelper, times(2)).doInTransaction(any(RetryingTransactionCallback.class)); + + // ensure each node is process correctly + verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); + verify(mockedNodeService, times(1)).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); + + // ensure no more interactions + verifyNoMoreInteractions(mockedNodeService); + verifyZeroInteractions(mockedRecordsManagementActionService); + + } + + /** + * When a node does not exist + */ + @Test + public void nodeDoesNotExist() + { + // test data + NodeRef node1 = generateNodeRef(null, false); + List nodeRefs = buildList(node1); + + // given + doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); + + // when + executer.executeImpl(); + + // then + + // ensure the query is executed and closed + verifyQuery(); + + // ensure the node exist check is made for the node + verify(mockedNodeService, times(1)).exists(any(NodeRef.class)); + + // ensure no more interactions + verifyNoMoreInteractions(mockedNodeService); + verifyZeroInteractions(mockedRecordsManagementActionService, mockedRetryingTransactionHelper); + } + + /** + * When there are disposition actions eligible for processing + */ + @SuppressWarnings("unchecked") + @Test + public void dispositionActionProcessed() + { + // test data + NodeRef node1 = generateNodeRef(); + NodeRef node2 = generateNodeRef(); + List nodeRefs = buildList(node1, node2); + NodeRef parent = generateNodeRef(); + ChildAssociationRef parentAssoc = new ChildAssociationRef(ASSOC_NEXT_DISPOSITION_ACTION, parent, generateQName(), generateNodeRef()); + + // given + doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); + doReturn(CUTOFF).when(mockedNodeService).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); + doReturn(RETAIN).when(mockedNodeService).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); + doReturn(parentAssoc).when(mockedNodeService).getPrimaryParent(any(NodeRef.class)); + + // when + executer.executeImpl(); + + // then + + // ensure the query is executed and closed + verifyQuery(); + + // ensure work is executed in transaction for each node processed + verify(mockedNodeService, times(2)).exists(any(NodeRef.class)); + verify(mockedRetryingTransactionHelper, times(2)).doInTransaction(any(RetryingTransactionCallback.class)); + + // ensure each node is process correctly + // node1 + verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); + verify(mockedNodeService, times(1)).getPrimaryParent(node1); + verify(mockedRecordsManagementActionService, times(1)).executeRecordsManagementAction(eq(parent), eq(CUTOFF), anyMap()); + // node2 + verify(mockedNodeService, times(1)).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); + verify(mockedNodeService, times(1)).getPrimaryParent(node2); + verify(mockedRecordsManagementActionService, times(1)).executeRecordsManagementAction(eq(parent), eq(RETAIN), anyMap()); + + // ensure no more interactions + verifyNoMoreInteractions(mockedNodeService, mockedRecordsManagementActionService); + } + + /** + * Brittle unit test that simply checks the generated query is an exact string when the supplied disposition actions + * are "CUTOFF" and "RETAIN" (see {@link #before}). + */ + @Test + public void testGetQuery() + { + String actual = executer.getQuery(); + + String expected = "TYPE:\"rma:dispositionAction\" + (@rma\\:dispositionAction:(\"cutoff\" OR \"retain\")) AND ISUNSET:\"rma:dispositionActionCompletedAt\" AND ( @rma\\:dispositionEventsEligible:true OR @rma\\:dispositionAsOf:[MIN TO NOW] ) "; + assertEquals(expected, actual); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java index d6aada4ef3..7ff5adcc2b 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java @@ -1,116 +1,116 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.util.Collections; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Freeze evaluator unit test. - * - * @author Roy Wetherall - */ -public class FrozenEvaluatorUnitTest extends BaseUnitTest -{ - @Mock(name="kinds") Set mockedKinds; - - @Spy @InjectMocks FrozenEvaluator evaluator; - - @Before - @Override - public void before() throws Exception - { - super.before(); - - // setup interactions - doReturn(false).when(mockedKinds).contains(FilePlanComponentKind.RECORD_CATEGORY); - doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD_FOLDER); - doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD); - } - - @Test - public void isNotRecordOrRecordFolder() - { - // setup interactions - NodeRef nodeRef = generateNodeRef(TYPE_RECORD_CATEGORY); - doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(mockedFilePlanService).getFilePlanComponentKind(nodeRef); - - // evaluate - boolean result = evaluator.evaluate(filePlanComponent); - assertFalse(result); - - // verify interactions - verify(mockedHoldService, never()).heldBy(filePlanComponent, true); - } - - @Test - public void isNotHeld() - { - // setup interactions - doReturn(FilePlanComponentKind.RECORD).when(mockedFilePlanService).getFilePlanComponentKind(record); - doReturn(Collections.EMPTY_LIST).when(mockedHoldService).heldBy(record, true); - - // evaluate - boolean result = evaluator.evaluate(record); - assertFalse(result); - - // verify interactions - verify(mockedHoldService, times(1)).heldBy(record, true); - } - - @Test - public void isHeldByAtLeastOne() - { - // setup interactions - doReturn(FilePlanComponentKind.RECORD).when(mockedFilePlanService).getFilePlanComponentKind(record); - doReturn(Collections.singletonList(generateNodeRef(TYPE_HOLD))).when(mockedHoldService).heldBy(record, true); - - // evaluate - boolean result = evaluator.evaluate(record); - assertTrue(result); - - // verify interactions - verify(mockedHoldService, times(1)).heldBy(record, true); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Collections; +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; + +/** + * Freeze evaluator unit test. + * + * @author Roy Wetherall + */ +public class FrozenEvaluatorUnitTest extends BaseUnitTest +{ + @Mock(name="kinds") Set mockedKinds; + + @Spy @InjectMocks FrozenEvaluator evaluator; + + @Before + @Override + public void before() throws Exception + { + super.before(); + + // setup interactions + doReturn(false).when(mockedKinds).contains(FilePlanComponentKind.RECORD_CATEGORY); + doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD_FOLDER); + doReturn(true).when(mockedKinds).contains(FilePlanComponentKind.RECORD); + } + + @Test + public void isNotRecordOrRecordFolder() + { + // setup interactions + NodeRef nodeRef = generateNodeRef(TYPE_RECORD_CATEGORY); + doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(mockedFilePlanService).getFilePlanComponentKind(nodeRef); + + // evaluate + boolean result = evaluator.evaluate(filePlanComponent); + assertFalse(result); + + // verify interactions + verify(mockedHoldService, never()).heldBy(filePlanComponent, true); + } + + @Test + public void isNotHeld() + { + // setup interactions + doReturn(FilePlanComponentKind.RECORD).when(mockedFilePlanService).getFilePlanComponentKind(record); + doReturn(Collections.EMPTY_LIST).when(mockedHoldService).heldBy(record, true); + + // evaluate + boolean result = evaluator.evaluate(record); + assertFalse(result); + + // verify interactions + verify(mockedHoldService, times(1)).heldBy(record, true); + } + + @Test + public void isHeldByAtLeastOne() + { + // setup interactions + doReturn(FilePlanComponentKind.RECORD).when(mockedFilePlanService).getFilePlanComponentKind(record); + doReturn(Collections.singletonList(generateNodeRef(TYPE_HOLD))).when(mockedHoldService).heldBy(record, true); + + // evaluate + boolean result = evaluator.evaluate(record); + assertTrue(result); + + // verify interactions + verify(mockedHoldService, times(1)).heldBy(record, true); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java index c27f3afd3b..b60243b4a2 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java @@ -1,181 +1,181 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; - -/** - * Transfer evaluator unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class TransferEvaluatorUnitTest extends BaseUnitTest -{ - private NodeRef transfer; - - @Spy @InjectMocks TransferEvaluator transferEvaluator; - - @Override - public void before() throws Exception - { - super.before(); - - // setup node references - transfer = generateNodeRef(TYPE_TRANSFER); - } - - private List getParentAssocs(NodeRef provided) - { - List result = new ArrayList(1); - result.add(new ChildAssociationRef(ASSOC_TRANSFERRED, transfer, generateQName(), provided, false, 1)); - return result; - } - - @Test - public void isNotTransferringRecord() - { - // setup interactions - doReturn(Collections.emptyList()).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - - // evaluate - assertFalse(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, never()).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, times(1)).getRecordFolders(record); - - } - - @Test - public void isTransferringWhenExpectingAccending() - { - // setup interactions - doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - transferEvaluator.setTransferAccessionIndicator(true); - - // evaluate - assertFalse(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, never()).getRecordFolders(record); - } - - @Test - public void transferringRecord() - { - // setup interactions - doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - - // evaluate - assertTrue(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, never()).getRecordFolders(record); - - } - - @Test - public void transferringRecordFolder() - { - // setup interactions - doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(getParentAssocs(recordFolder)).when(mockedNodeService).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - - // evaluate - assertTrue(transferEvaluator.evaluate(recordFolder)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, never()).getRecordFolders(record); - } - - @Test - public void transferringRecordWithinRecordFolder() - { - // setup interactions - doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(Collections.emptyList()).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - doReturn(getParentAssocs(recordFolder)).when(mockedNodeService).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - - // evaluate - assertTrue(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, times(1)).getRecordFolders(record); - - } - - @Test - public void accendingRecord() - { - // setup interactions - doReturn(Boolean.TRUE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - transferEvaluator.setTransferAccessionIndicator(true); - - // evaluate - assertTrue(transferEvaluator.evaluate(record)); - - // verify interactions - verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); - verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); - verify(mockedRecordFolderService, never()).getRecordFolders(record); - - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.jscript.app.evaluator; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Spy; + +/** + * Transfer evaluator unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class TransferEvaluatorUnitTest extends BaseUnitTest +{ + private NodeRef transfer; + + @Spy @InjectMocks TransferEvaluator transferEvaluator; + + @Override + public void before() throws Exception + { + super.before(); + + // setup node references + transfer = generateNodeRef(TYPE_TRANSFER); + } + + private List getParentAssocs(NodeRef provided) + { + List result = new ArrayList(1); + result.add(new ChildAssociationRef(ASSOC_TRANSFERRED, transfer, generateQName(), provided, false, 1)); + return result; + } + + @Test + public void isNotTransferringRecord() + { + // setup interactions + doReturn(Collections.emptyList()).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + + // evaluate + assertFalse(transferEvaluator.evaluate(record)); + + // verify interactions + verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + verify(mockedNodeService, never()).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + verify(mockedRecordFolderService, times(1)).getRecordFolders(record); + + } + + @Test + public void isTransferringWhenExpectingAccending() + { + // setup interactions + doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + transferEvaluator.setTransferAccessionIndicator(true); + + // evaluate + assertFalse(transferEvaluator.evaluate(record)); + + // verify interactions + verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + verify(mockedRecordFolderService, never()).getRecordFolders(record); + } + + @Test + public void transferringRecord() + { + // setup interactions + doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + + // evaluate + assertTrue(transferEvaluator.evaluate(record)); + + // verify interactions + verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + verify(mockedRecordFolderService, never()).getRecordFolders(record); + + } + + @Test + public void transferringRecordFolder() + { + // setup interactions + doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + doReturn(getParentAssocs(recordFolder)).when(mockedNodeService).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + + // evaluate + assertTrue(transferEvaluator.evaluate(recordFolder)); + + // verify interactions + verify(mockedNodeService, times(1)).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + verify(mockedRecordFolderService, never()).getRecordFolders(record); + } + + @Test + public void transferringRecordWithinRecordFolder() + { + // setup interactions + doReturn(Boolean.FALSE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + doReturn(Collections.emptyList()).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + doReturn(getParentAssocs(recordFolder)).when(mockedNodeService).getParentAssocs(recordFolder, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + + // evaluate + assertTrue(transferEvaluator.evaluate(record)); + + // verify interactions + verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + verify(mockedRecordFolderService, times(1)).getRecordFolders(record); + + } + + @Test + public void accendingRecord() + { + // setup interactions + doReturn(Boolean.TRUE).when(mockedNodeService).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + doReturn(getParentAssocs(record)).when(mockedNodeService).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + transferEvaluator.setTransferAccessionIndicator(true); + + // evaluate + assertTrue(transferEvaluator.evaluate(record)); + + // verify interactions + verify(mockedNodeService, times(1)).getParentAssocs(record, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); + verify(mockedNodeService, times(1)).getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR); + verify(mockedRecordFolderService, never()).getRecordFolders(record); + + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessorUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessorUnitTest.java index 25011250cc..5746c0a3f2 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessorUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/compatibility/DictionaryBootstrapPostProcessorUnitTest.java @@ -1,104 +1,104 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.compatibility; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; - -/** - * Dictionary bootstrap post processor unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class DictionaryBootstrapPostProcessorUnitTest extends BaseUnitTest -{ - /** bean id's */ - private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap"; - private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap"; - - @Mock private ConfigurableListableBeanFactory mockedBeanFactory; - @Mock private BeanDefinition mockedBeanDefinition; - - @InjectMocks private DictionaryBootstrapPostProcessor postProcessor; - - /** - * given the bean factory does not contain the site service bootstrap bean then ensure that it is - * not added as a dependency - */ - @Test - public void noSiteServiceBootstrapBeanAvailable() - { - // === given ==== - doReturn(false).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP); - - // === when === - postProcessor.postProcessBeanFactory(mockedBeanFactory); - - // === then === - verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP); - verifyNoMoreInteractions(mockedBeanFactory); - verifyZeroInteractions(mockedBeanDefinition); - } - - /** - * given that the site service bootstrap bean is contained within the bean factory, ensure that - * it is added as a dependency - */ - @Test - public void siteServiceBootstrapBeanAvailable() - { - // === given ==== - doReturn(true).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP); - doReturn(true).when(mockedBeanFactory).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP); - doReturn(mockedBeanDefinition).when(mockedBeanFactory).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); - - // === when === - postProcessor.postProcessBeanFactory(mockedBeanFactory); - - // === then === - verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP); - verify(mockedBeanFactory, times(1)).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP); - - verify(mockedBeanFactory, times(1)).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); - verify(mockedBeanDefinition, times(1)).setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP}); - - verifyNoMoreInteractions(mockedBeanFactory, mockedBeanDefinition); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.compatibility; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.verifyZeroInteractions; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; + +/** + * Dictionary bootstrap post processor unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class DictionaryBootstrapPostProcessorUnitTest extends BaseUnitTest +{ + /** bean id's */ + private static final String BEAN_SITESERVICE_BOOTSTRAP = "siteService_dictionaryBootstrap"; + private static final String BEAN_RM_DICTIONARY_BOOTSTRAP = "org_alfresco_module_rm_dictionaryBootstrap"; + + @Mock private ConfigurableListableBeanFactory mockedBeanFactory; + @Mock private BeanDefinition mockedBeanDefinition; + + @InjectMocks private DictionaryBootstrapPostProcessor postProcessor; + + /** + * given the bean factory does not contain the site service bootstrap bean then ensure that it is + * not added as a dependency + */ + @Test + public void noSiteServiceBootstrapBeanAvailable() + { + // === given ==== + doReturn(false).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP); + + // === when === + postProcessor.postProcessBeanFactory(mockedBeanFactory); + + // === then === + verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP); + verifyNoMoreInteractions(mockedBeanFactory); + verifyZeroInteractions(mockedBeanDefinition); + } + + /** + * given that the site service bootstrap bean is contained within the bean factory, ensure that + * it is added as a dependency + */ + @Test + public void siteServiceBootstrapBeanAvailable() + { + // === given ==== + doReturn(true).when(mockedBeanFactory).containsBean(BEAN_SITESERVICE_BOOTSTRAP); + doReturn(true).when(mockedBeanFactory).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP); + doReturn(mockedBeanDefinition).when(mockedBeanFactory).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); + + // === when === + postProcessor.postProcessBeanFactory(mockedBeanFactory); + + // === then === + verify(mockedBeanFactory, times(1)).containsBean(BEAN_SITESERVICE_BOOTSTRAP); + verify(mockedBeanFactory, times(1)).containsBean(BEAN_RM_DICTIONARY_BOOTSTRAP); + + verify(mockedBeanFactory, times(1)).getBeanDefinition(BEAN_RM_DICTIONARY_BOOTSTRAP); + verify(mockedBeanDefinition, times(1)).setDependsOn(new String[]{BEAN_SITESERVICE_BOOTSTRAP}); + + verifyNoMoreInteractions(mockedBeanFactory, mockedBeanDefinition); + + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspectUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspectUnitTest.java index 969f39a07e..480d28ad11 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspectUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VersionRecordAspectUnitTest.java @@ -1,99 +1,99 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.aspect; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.cmr.version.VersionService; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Version record aspect unit tests - * - * @author Roy Wetherall - * @since 2.3.1 - */ -public class VersionRecordAspectUnitTest extends BaseUnitTest -{ - /** service mocks */ - private @Mock VersionHistory mockedVersionHistory; - private @Mock Version mockedVersion; - private @Mock VersionService mockedVersionService; - private @Mock RelationshipService mockedRelationshipService; - - /** test object */ - private @InjectMocks VersionRecordAspect versionRecordAspect; - - /** - * given that there is no recorded version - * before delete of record - * then nothing happens - */ - @Test - public void beforeDeleteNoVersionNodeRef() - { - NodeRef nodeRef = generateNodeRef(); - - when(mockedRecordableVersionService.getRecordedVersion(nodeRef)) - .thenReturn(null); - - versionRecordAspect.beforeDeleteNode(nodeRef); - - verify(mockedNodeService, never()).getProperty(nodeRef, RecordableVersionModel.PROP_VERSION_LABEL); - verify(mockedRecordableVersionService, never()).destroyRecordedVersion(any(Version.class)); - } - - /** - * given that there is a recorded version - * before delete of record - * then the version is marked as destroyed - */ - @Test - public void beforeDeleteMarkVersionDestroyed() - { - NodeRef nodeRef = generateNodeRef(); - - when(mockedRecordableVersionService.getRecordedVersion(nodeRef)) - .thenReturn(mockedVersion); - - versionRecordAspect.beforeDeleteNode(nodeRef); - - verify(mockedRecordableVersionService).destroyRecordedVersion(mockedVersion); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.aspect; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionHistory; +import org.alfresco.service.cmr.version.VersionService; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; + +/** + * Version record aspect unit tests + * + * @author Roy Wetherall + * @since 2.3.1 + */ +public class VersionRecordAspectUnitTest extends BaseUnitTest +{ + /** service mocks */ + private @Mock VersionHistory mockedVersionHistory; + private @Mock Version mockedVersion; + private @Mock VersionService mockedVersionService; + private @Mock RelationshipService mockedRelationshipService; + + /** test object */ + private @InjectMocks VersionRecordAspect versionRecordAspect; + + /** + * given that there is no recorded version + * before delete of record + * then nothing happens + */ + @Test + public void beforeDeleteNoVersionNodeRef() + { + NodeRef nodeRef = generateNodeRef(); + + when(mockedRecordableVersionService.getRecordedVersion(nodeRef)) + .thenReturn(null); + + versionRecordAspect.beforeDeleteNode(nodeRef); + + verify(mockedNodeService, never()).getProperty(nodeRef, RecordableVersionModel.PROP_VERSION_LABEL); + verify(mockedRecordableVersionService, never()).destroyRecordedVersion(any(Version.class)); + } + + /** + * given that there is a recorded version + * before delete of record + * then the version is marked as destroyed + */ + @Test + public void beforeDeleteMarkVersionDestroyed() + { + NodeRef nodeRef = generateNodeRef(); + + when(mockedRecordableVersionService.getRecordedVersion(nodeRef)) + .thenReturn(mockedVersion); + + versionRecordAspect.beforeDeleteNode(nodeRef); + + verify(mockedRecordableVersionService).destroyRecordedVersion(mockedVersion); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeUnitTest.java index 4048585913..717af0cde9 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeUnitTest.java @@ -1,87 +1,87 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for HoldContainerTypeTest - * - * @author Mihai Cozma - * @since 2.4 - */ -public class HoldContainerTypeUnitTest extends BaseUnitTest -{ - /** test object */ - private @InjectMocks HoldContainerType holdContainerType; - - /** - * Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN When adding a child association - * between the folder and the container Then the folder type shouldn't be renamed - */ - @Test (expected = AlfrescoRuntimeException.class) - public void testAddContentToHoldContainer() - { - - NodeRef holdContainer = createHoldContainer(); - - /* - * When adding a child association between the folder and the container - */ - NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); - ChildAssociationRef childAssoc = new ChildAssociationRef( ContentModel.TYPE_CONTENT, holdContainer, - ContentModel.TYPE_CONTENT, record); - - holdContainerType.onCreateChildAssociation(childAssoc, true); - - } - - /** - * Generates a record management container - * - * @return reference to the generated container - */ - private NodeRef createHoldContainer() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER, true); - - return holdContainer; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for HoldContainerTypeTest + * + * @author Mihai Cozma + * @since 2.4 + */ +public class HoldContainerTypeUnitTest extends BaseUnitTest +{ + /** test object */ + private @InjectMocks HoldContainerType holdContainerType; + + /** + * Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN When adding a child association + * between the folder and the container Then the folder type shouldn't be renamed + */ + @Test (expected = AlfrescoRuntimeException.class) + public void testAddContentToHoldContainer() + { + + NodeRef holdContainer = createHoldContainer(); + + /* + * When adding a child association between the folder and the container + */ + NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); + ChildAssociationRef childAssoc = new ChildAssociationRef( ContentModel.TYPE_CONTENT, holdContainer, + ContentModel.TYPE_CONTENT, record); + + holdContainerType.onCreateChildAssociation(childAssoc, true); + + } + + /** + * Generates a record management container + * + * @return reference to the generated container + */ + private NodeRef createHoldContainer() + { + NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER, true); + + return holdContainer; + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordTypeUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordTypeUnitTest.java index eb4fad6ae7..b75f1588d0 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordTypeUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/NonElectronicRecordTypeUnitTest.java @@ -1,113 +1,113 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.util.GUID; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * @author silviudinuta - */ -public class NonElectronicRecordTypeUnitTest implements RecordsManagementModel, ContentModel -{ - private final static NodeRef CHILD_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, - GUID.generate()); - private final static NodeRef PARENT_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, - GUID.generate()); - - @InjectMocks - NonElectronicRecordType nonElectronicRecordType; - - @Mock - AuthenticationUtil mockAuthenticationUtil; - - @Mock - RecordService mockedRecordService; - - @Mock - NodeService mockedNodeService; - - @Before - public void setUp() - { - MockitoAnnotations.initMocks(this); - MockAuthenticationUtilHelper.setup(mockAuthenticationUtil); - when(mockedNodeService.exists(CHILD_NODE_REF)).thenReturn(true); - when(mockedNodeService.exists(PARENT_NODE_REF)).thenReturn(true); - - ChildAssociationRef generateChildAssociationRef = mock(ChildAssociationRef.class); - when(generateChildAssociationRef.getParentRef()).thenReturn(PARENT_NODE_REF); - when(generateChildAssociationRef.getChildRef()).thenReturn(CHILD_NODE_REF); - - when(mockedNodeService.getPrimaryParent(CHILD_NODE_REF)).thenReturn(generateChildAssociationRef); - when(mockedNodeService.getType(PARENT_NODE_REF)).thenReturn(TYPE_UNFILED_RECORD_FOLDER); - } - - @Test - public void testOnUpdateWithAspectsAlreadyPresent() - { - when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(true); - when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_RECORD)).thenReturn(true); - - nonElectronicRecordType.onUpdateNode(CHILD_NODE_REF); - - verify(mockedNodeService, never()).addAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT, null); - verify(mockedRecordService, never()).makeRecord(CHILD_NODE_REF); - } - - @Test - public void testOnUpdateWithoutTheAspects() - { - when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false); - when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_RECORD)).thenReturn(false); - - nonElectronicRecordType.onUpdateNode(CHILD_NODE_REF); - - verify(mockedNodeService, times(1)).addAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT, null); - verify(mockedRecordService, times(1)).makeRecord(CHILD_NODE_REF); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.util.GUID; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +/** + * @author silviudinuta + */ +public class NonElectronicRecordTypeUnitTest implements RecordsManagementModel, ContentModel +{ + private final static NodeRef CHILD_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, + GUID.generate()); + private final static NodeRef PARENT_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, + GUID.generate()); + + @InjectMocks + NonElectronicRecordType nonElectronicRecordType; + + @Mock + AuthenticationUtil mockAuthenticationUtil; + + @Mock + RecordService mockedRecordService; + + @Mock + NodeService mockedNodeService; + + @Before + public void setUp() + { + MockitoAnnotations.initMocks(this); + MockAuthenticationUtilHelper.setup(mockAuthenticationUtil); + when(mockedNodeService.exists(CHILD_NODE_REF)).thenReturn(true); + when(mockedNodeService.exists(PARENT_NODE_REF)).thenReturn(true); + + ChildAssociationRef generateChildAssociationRef = mock(ChildAssociationRef.class); + when(generateChildAssociationRef.getParentRef()).thenReturn(PARENT_NODE_REF); + when(generateChildAssociationRef.getChildRef()).thenReturn(CHILD_NODE_REF); + + when(mockedNodeService.getPrimaryParent(CHILD_NODE_REF)).thenReturn(generateChildAssociationRef); + when(mockedNodeService.getType(PARENT_NODE_REF)).thenReturn(TYPE_UNFILED_RECORD_FOLDER); + } + + @Test + public void testOnUpdateWithAspectsAlreadyPresent() + { + when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(true); + when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_RECORD)).thenReturn(true); + + nonElectronicRecordType.onUpdateNode(CHILD_NODE_REF); + + verify(mockedNodeService, never()).addAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT, null); + verify(mockedRecordService, never()).makeRecord(CHILD_NODE_REF); + } + + @Test + public void testOnUpdateWithoutTheAspects() + { + when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false); + when(mockedNodeService.hasAspect(CHILD_NODE_REF, ASPECT_RECORD)).thenReturn(false); + + nonElectronicRecordType.onUpdateNode(CHILD_NODE_REF); + + verify(mockedNodeService, times(1)).addAspect(CHILD_NODE_REF, ASPECT_FILE_PLAN_COMPONENT, null); + verify(mockedRecordService, times(1)).makeRecord(CHILD_NODE_REF); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerTypeUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerTypeUnitTest.java index 5589f7a410..e1ba28b442 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerTypeUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerTypeUnitTest.java @@ -4,28 +4,28 @@ * %% * Copyright (C) 2005 - 2016 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 + * 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.model.rma.type; - +package org.alfresco.module.org_alfresco_module_rm.model.rma.type; + import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.never; @@ -40,62 +40,62 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for RecordsManagementContainerType - * @author Ana Bozianu - * @since 2.4 - */ -public class RecordsManagementContainerTypeUnitTest extends BaseUnitTest -{ - /** test object */ +import org.mockito.InjectMocks; + +/** + * Unit test for RecordsManagementContainerType + * @author Ana Bozianu + * @since 2.4 + */ +public class RecordsManagementContainerTypeUnitTest extends BaseUnitTest +{ + /** test object */ private @InjectMocks RecordsManagementContainerType recordManagementContainerType; - - /** - * Having the Unfilled Record container and a folder - * When adding a child association between the folder and the container - * Then the folder type shouldn't be renamed - */ - @Test - public void testAddFolderToRMContainer() - { - /* Having a RM container and a folder */ - NodeRef rmContainer = generateRMContainer(); - NodeRef rmFolder = generateFolderNode(false); - - /* - * When adding a child association between the folder and the container - */ - ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmContainer, ContentModel.ASSOC_CONTAINS, rmFolder); - recordManagementContainerType.onCreateChildAssociation(childAssoc, true); - - /* Then the node type should not be changed to TYPE_RECORD_FOLDER */ - verify(mockedNodeService).setType(rmFolder, TYPE_RECORD_FOLDER); - verify(mockedRecordFolderService).setupRecordFolder(rmFolder); - } - - /** - * Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN - * When adding a child association between the folder and the container - * Then the folder type shouldn't be renamed - */ - @Test - public void testAddHiddenFolderToRMContainer() - { - /* Having a RM container and a folder with ASPECT_HIDDEN applied */ - NodeRef rmContainer = generateRMContainer(); - NodeRef rmFolder = generateFolderNode(true); - - /* - * When adding a child association between the folder and the container - */ - ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmContainer, ContentModel.ASSOC_CONTAINS, rmFolder); - recordManagementContainerType.onCreateChildAssociation(childAssoc, true); - - /* Then the node type should not be changed to TYPE_RECORD_FOLDER */ - verify(mockedNodeService, never()).setType(rmFolder, TYPE_RECORD_FOLDER); - verify(mockedRecordFolderService, never()).setupRecordFolder(rmFolder); + + /** + * Having the Unfilled Record container and a folder + * When adding a child association between the folder and the container + * Then the folder type shouldn't be renamed + */ + @Test + public void testAddFolderToRMContainer() + { + /* Having a RM container and a folder */ + NodeRef rmContainer = generateRMContainer(); + NodeRef rmFolder = generateFolderNode(false); + + /* + * When adding a child association between the folder and the container + */ + ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmContainer, ContentModel.ASSOC_CONTAINS, rmFolder); + recordManagementContainerType.onCreateChildAssociation(childAssoc, true); + + /* Then the node type should not be changed to TYPE_RECORD_FOLDER */ + verify(mockedNodeService).setType(rmFolder, TYPE_RECORD_FOLDER); + verify(mockedRecordFolderService).setupRecordFolder(rmFolder); + } + + /** + * Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN + * When adding a child association between the folder and the container + * Then the folder type shouldn't be renamed + */ + @Test + public void testAddHiddenFolderToRMContainer() + { + /* Having a RM container and a folder with ASPECT_HIDDEN applied */ + NodeRef rmContainer = generateRMContainer(); + NodeRef rmFolder = generateFolderNode(true); + + /* + * When adding a child association between the folder and the container + */ + ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmContainer, ContentModel.ASSOC_CONTAINS, rmFolder); + recordManagementContainerType.onCreateChildAssociation(childAssoc, true); + + /* Then the node type should not be changed to TYPE_RECORD_FOLDER */ + verify(mockedNodeService, never()).setType(rmFolder, TYPE_RECORD_FOLDER); + verify(mockedRecordFolderService, never()).setupRecordFolder(rmFolder); } /** @@ -118,35 +118,35 @@ public class RecordsManagementContainerTypeUnitTest extends BaseUnitTest { assertTrue(e instanceof AlfrescoRuntimeException); } - } - - /** - * Generates a record management container - * @return reference to the generated container - */ - private NodeRef generateRMContainer() - { - NodeRef rmContainer = generateNodeRef(); - when(mockedNodeService.getType(rmContainer)).thenReturn(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); - when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER, TYPE_FILE_PLAN)).thenReturn(false); - return rmContainer; - } - - /** - * Generates a folder node - * @param hasHiddenAspect does the folder node have the aspect ASPECT_HIDDEN - * @return reference to the created folder - */ - private NodeRef generateFolderNode(boolean hasHiddenAspect) - { - NodeRef rmFolder = generateNodeRef(); - when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_FOLDER)).thenReturn(true); - when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false); - when(mockedNodeService.getType(rmFolder)).thenReturn(ContentModel.TYPE_FOLDER); - when(mockedNodeService.exists(rmFolder)).thenReturn(true); - when(mockedNodeService.hasAspect(rmFolder, ContentModel.ASPECT_HIDDEN)).thenReturn(hasHiddenAspect); - when(mockedNodeService.hasAspect(rmFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false); - return rmFolder; + } + + /** + * Generates a record management container + * @return reference to the generated container + */ + private NodeRef generateRMContainer() + { + NodeRef rmContainer = generateNodeRef(); + when(mockedNodeService.getType(rmContainer)).thenReturn(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER); + when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER, TYPE_FILE_PLAN)).thenReturn(false); + return rmContainer; + } + + /** + * Generates a folder node + * @param hasHiddenAspect does the folder node have the aspect ASPECT_HIDDEN + * @return reference to the created folder + */ + private NodeRef generateFolderNode(boolean hasHiddenAspect) + { + NodeRef rmFolder = generateNodeRef(); + when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_FOLDER)).thenReturn(true); + when(mockedDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_SYSTEM_FOLDER)).thenReturn(false); + when(mockedNodeService.getType(rmFolder)).thenReturn(ContentModel.TYPE_FOLDER); + when(mockedNodeService.exists(rmFolder)).thenReturn(true); + when(mockedNodeService.hasAspect(rmFolder, ContentModel.ASPECT_HIDDEN)).thenReturn(hasHiddenAspect); + when(mockedNodeService.hasAspect(rmFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false); + return rmFolder; } /** @@ -162,5 +162,5 @@ public class RecordsManagementContainerTypeUnitTest extends BaseUnitTest when(mockedNodeService.hasAspect(nonRmFolder, ContentModel.ASPECT_HIDDEN)).thenReturn(false); when(mockedNodeService.hasAspect(nonRmFolder, ASPECT_FILE_PLAN_COMPONENT)).thenReturn(false); return nonRmFolder; - } -} + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeUnitTest.java index 69a7e20b2f..a754d52974 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeUnitTest.java @@ -1,81 +1,81 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.model.rma.type; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for TransferContainerTypeTest - * - * @author Mihai Cozma - * @since 2.4 - */ -public class TransferContainerTypeUnitTest extends BaseUnitTest -{ - /** test object */ - private @InjectMocks TransferContainerType transferContainerType; - - /** - * Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN When adding a child association - * between the folder and the container Then the folder type shouldn't be renamed - */ - @Test(expected = AlfrescoRuntimeException.class) - public void testAddContentToTransferContainerTest() - { - - NodeRef transferContainer = createTransferContainer(); - - /* - * When adding a child association between the folder and the container - */ - NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); - ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.TYPE_CONTENT, transferContainer, - ContentModel.TYPE_CONTENT, record); - - transferContainerType.onCreateChildAssociation(childAssoc, true); - - } - - /** - * Generates a record management container - * - * @return reference to the generated container - */ - private NodeRef createTransferContainer() - { - NodeRef holdContainer = generateNodeRef(TYPE_TRANSFER, true); - - return holdContainer; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for TransferContainerTypeTest + * + * @author Mihai Cozma + * @since 2.4 + */ +public class TransferContainerTypeUnitTest extends BaseUnitTest +{ + /** test object */ + private @InjectMocks TransferContainerType transferContainerType; + + /** + * Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN When adding a child association + * between the folder and the container Then the folder type shouldn't be renamed + */ + @Test(expected = AlfrescoRuntimeException.class) + public void testAddContentToTransferContainerTest() + { + + NodeRef transferContainer = createTransferContainer(); + + /* + * When adding a child association between the folder and the container + */ + NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); + ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.TYPE_CONTENT, transferContainer, + ContentModel.TYPE_CONTENT, record); + + transferContainerType.onCreateChildAssociation(childAssoc, true); + + } + + /** + * Generates a record management container + * + * @return reference to the generated container + */ + private NodeRef createTransferContainer() + { + NodeRef holdContainer = generateNodeRef(TYPE_TRANSFER, true); + + return holdContainer; + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java index ae3a485282..c7e2deb796 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java @@ -1,133 +1,133 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Collections; - -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.security.AuthorityType; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for RMv22CapabilityPatch - * - * @author Roy Wetherall - */ -public class RMv22CapabilityPatchUnitTest extends BaseUnitTest -{ - /** patch */ - private @InjectMocks RMv22CapabilityPatch patch; - - /** - * Given that I am upgrading an existing repository to v2.2 - * When I execute the patch - * Then the capabilities are updated - */ - @Test - public void executePatch() - { - when(mockedFilePlanService.getFilePlans()) - .thenReturn(Collections.singleton(filePlan)); - when(mockedAuthorityService.getName(eq(AuthorityType.GROUP), anyString())) - .thenReturn( - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - FilePlanRoleService.ROLE_SECURITY_OFFICER, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - - // execute patch - patch.applyInternal(); - - // verify that the correct capabilities have been added - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_ADMIN, - "FileDestructionReport", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - "FileDestructionReport", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_ADMIN, - "CreateHold", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - "CreateHold", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_ADMIN, - "AddToHold", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - "AddToHold", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_ADMIN, - "RemoveFromHold", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - "RemoveFromHold", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_RECORDS_MANAGER, - "ManageAccessControls", - true); - verify(mockedPermissionService, times(1)).setPermission( - filePlan, - FilePlanRoleService.ROLE_SECURITY_OFFICER, - "ManageAccessControls", - true); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Collections; + +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.security.AuthorityType; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for RMv22CapabilityPatch + * + * @author Roy Wetherall + */ +public class RMv22CapabilityPatchUnitTest extends BaseUnitTest +{ + /** patch */ + private @InjectMocks RMv22CapabilityPatch patch; + + /** + * Given that I am upgrading an existing repository to v2.2 + * When I execute the patch + * Then the capabilities are updated + */ + @Test + public void executePatch() + { + when(mockedFilePlanService.getFilePlans()) + .thenReturn(Collections.singleton(filePlan)); + when(mockedAuthorityService.getName(eq(AuthorityType.GROUP), anyString())) + .thenReturn( + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_SECURITY_OFFICER, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + + // execute patch + patch.applyInternal(); + + // verify that the correct capabilities have been added + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_ADMIN, + "FileDestructionReport", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "FileDestructionReport", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_ADMIN, + "CreateHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "CreateHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_ADMIN, + "AddToHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "AddToHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_ADMIN, + "RemoveFromHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "RemoveFromHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "ManageAccessControls", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_SECURITY_OFFICER, + "ManageAccessControls", + true); + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatchUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatchUnitTest.java index eaaad235ee..bf5ebfa35f 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatchUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22RemoveInPlaceRolesFromAllPatchUnitTest.java @@ -1,136 +1,136 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v22; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -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.test.util.BaseUnitTest; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for remove in-place roles from 'all roles' group patch unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RMv22RemoveInPlaceRolesFromAllPatchUnitTest extends BaseUnitTest -{ - /** test data */ - private static final String ALL_ROLES = "allroles"; - - /** patch */ - @InjectMocks private RMv22RemoveInPlaceRolesFromAllPatch patch; - - /** - * Given there are no file plans to update then the 'all roles' group should not - * be changed. - */ - @Test - public void noFilePlans() - { - // given - doReturn(Collections.EMPTY_SET).when(mockedFilePlanService).getFilePlans(); - - // when - patch.applyInternal(); - - // then - verifyZeroInteractions(mockedAuthorityService); - } - - /** - * Given that there is one file plan whose 'all roles' group does not contain the - * in-place roles the 'all roles' groups should not be changed. - */ - @Test - public void rolesDontNeedRemovingFromGroup() - { - // given - doReturn(Collections.singleton(filePlan)).when(mockedFilePlanService).getFilePlans(); - doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_READERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); - doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_WRITERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); - doReturn(ALL_ROLES).when(mockedFilePlanRoleService).getAllRolesContainerGroup(filePlan); - doReturn(Collections.EMPTY_SET).when(mockedAuthorityService).getContainedAuthorities(null, ALL_ROLES, true); - - // when - patch.applyInternal(); - - // then - verify(mockedAuthorityService, times(1)).getContainedAuthorities(null, ALL_ROLES, true); - verifyNoMoreInteractions(mockedAuthorityService); - } - - /** - * Given that there is one file plan whose 'all roles' group contains the in-place - * roles then they should be revoved. - */ - @Test - public void removeRolesFromGroup() - { - // given - doReturn(Collections.singleton(filePlan)).when(mockedFilePlanService).getFilePlans(); - doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_READERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); - doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_WRITERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); - doReturn(ALL_ROLES).when(mockedFilePlanRoleService).getAllRolesContainerGroup(filePlan); - Set contains = new HashSet(2); - contains.add(FilePlanRoleService.ROLE_EXTENDED_READERS); - contains.add(FilePlanRoleService.ROLE_EXTENDED_WRITERS); - doReturn(contains).when(mockedAuthorityService).getContainedAuthorities(null, ALL_ROLES, true); - - // when - patch.applyInternal(); - - // then - verify(mockedAuthorityService, times(1)).getContainedAuthorities(null, ALL_ROLES, true); - verify(mockedAuthorityService, times(1)).removeAuthority(ALL_ROLES, FilePlanRoleService.ROLE_EXTENDED_READERS); - verify(mockedAuthorityService, times(1)).removeAuthority(ALL_ROLES, FilePlanRoleService.ROLE_EXTENDED_WRITERS); - verifyNoMoreInteractions(mockedAuthorityService); - } - - /** - * Helper method to create a mocked role. - */ - private Role getMockedRole(String name) - { - Role mockedRole = mock(Role.class); - doReturn(name).when(mockedRole).getRoleGroupName(); - return mockedRole; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v22; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.verifyZeroInteractions; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +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.test.util.BaseUnitTest; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for remove in-place roles from 'all roles' group patch unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RMv22RemoveInPlaceRolesFromAllPatchUnitTest extends BaseUnitTest +{ + /** test data */ + private static final String ALL_ROLES = "allroles"; + + /** patch */ + @InjectMocks private RMv22RemoveInPlaceRolesFromAllPatch patch; + + /** + * Given there are no file plans to update then the 'all roles' group should not + * be changed. + */ + @Test + public void noFilePlans() + { + // given + doReturn(Collections.EMPTY_SET).when(mockedFilePlanService).getFilePlans(); + + // when + patch.applyInternal(); + + // then + verifyZeroInteractions(mockedAuthorityService); + } + + /** + * Given that there is one file plan whose 'all roles' group does not contain the + * in-place roles the 'all roles' groups should not be changed. + */ + @Test + public void rolesDontNeedRemovingFromGroup() + { + // given + doReturn(Collections.singleton(filePlan)).when(mockedFilePlanService).getFilePlans(); + doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_READERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); + doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_WRITERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); + doReturn(ALL_ROLES).when(mockedFilePlanRoleService).getAllRolesContainerGroup(filePlan); + doReturn(Collections.EMPTY_SET).when(mockedAuthorityService).getContainedAuthorities(null, ALL_ROLES, true); + + // when + patch.applyInternal(); + + // then + verify(mockedAuthorityService, times(1)).getContainedAuthorities(null, ALL_ROLES, true); + verifyNoMoreInteractions(mockedAuthorityService); + } + + /** + * Given that there is one file plan whose 'all roles' group contains the in-place + * roles then they should be revoved. + */ + @Test + public void removeRolesFromGroup() + { + // given + doReturn(Collections.singleton(filePlan)).when(mockedFilePlanService).getFilePlans(); + doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_READERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS); + doReturn(getMockedRole(FilePlanRoleService.ROLE_EXTENDED_WRITERS)).when(mockedFilePlanRoleService).getRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS); + doReturn(ALL_ROLES).when(mockedFilePlanRoleService).getAllRolesContainerGroup(filePlan); + Set contains = new HashSet(2); + contains.add(FilePlanRoleService.ROLE_EXTENDED_READERS); + contains.add(FilePlanRoleService.ROLE_EXTENDED_WRITERS); + doReturn(contains).when(mockedAuthorityService).getContainedAuthorities(null, ALL_ROLES, true); + + // when + patch.applyInternal(); + + // then + verify(mockedAuthorityService, times(1)).getContainedAuthorities(null, ALL_ROLES, true); + verify(mockedAuthorityService, times(1)).removeAuthority(ALL_ROLES, FilePlanRoleService.ROLE_EXTENDED_READERS); + verify(mockedAuthorityService, times(1)).removeAuthority(ALL_ROLES, FilePlanRoleService.ROLE_EXTENDED_WRITERS); + verifyNoMoreInteractions(mockedAuthorityService); + } + + /** + * Helper method to create a mocked role. + */ + private Role getMockedRole(String name) + { + Role mockedRole = mock(Role.class); + doReturn(name).when(mockedRole).getRoleGroupName(); + return mockedRole; + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java index 8d98cbb90f..09b6a372d3 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java @@ -1,118 +1,118 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.patch.v24; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateNodeRef; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -import java.util.Collections; - -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.rule.RuleModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -/** - * RM V2.4 File Plan container rule inheritance patch unit test. - * - * @author Roy Wetherall - * @since 2.4 - */ -public class RMv24FilePlanContainerRuleInheritancePatchUnitTest -{ - private @Mock NodeService mockedNodeService; - private @Mock FilePlanService mockedFilePlanService; - - private @InjectMocks RMv24FilePlanContainerRuleInheritancePatch patch; - - @Before - public void before() - { - MockitoAnnotations.initMocks(this); - } - - /** - * Given there are not file plans, - * When the patch is executed, - * Then nothing happens - */ - @SuppressWarnings("unchecked") - @Test - public void noFilePlans() - { - // given - when(mockedFilePlanService.getFilePlans()) - .thenReturn(Collections.EMPTY_SET); - - // when - patch.applyInternal(); - - // then - verifyZeroInteractions(mockedNodeService); - } - - /** - * Given there is a file plan, - * When the patch is executed, - * Then the file plan containers are updated - */ - @Test - public void atLeastOneFilePlan() - { - NodeRef filePlan = generateNodeRef(mockedNodeService, RecordsManagementModel.TYPE_FILE_PLAN); - NodeRef holdsContainer = generateNodeRef(mockedNodeService); - NodeRef transferContainer = generateNodeRef(mockedNodeService); - NodeRef unfiledRecordsContainer = generateNodeRef(mockedNodeService); - - // given - when(mockedFilePlanService.getFilePlans()) - .thenReturn(Collections.singleton(filePlan)); - when(mockedFilePlanService.getHoldContainer(filePlan)) - .thenReturn(holdsContainer); - when(mockedFilePlanService.getTransferContainer(filePlan)) - .thenReturn(transferContainer); - when(mockedFilePlanService.getUnfiledContainer(filePlan)) - .thenReturn(unfiledRecordsContainer); - - // when - patch.applyInternal(); - - // then - verify(mockedNodeService).addAspect(holdsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - verify(mockedNodeService).addAspect(transferContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - verify(mockedNodeService).addAspect(unfiledRecordsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.patch.v24; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateNodeRef; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.rule.RuleModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +/** + * RM V2.4 File Plan container rule inheritance patch unit test. + * + * @author Roy Wetherall + * @since 2.4 + */ +public class RMv24FilePlanContainerRuleInheritancePatchUnitTest +{ + private @Mock NodeService mockedNodeService; + private @Mock FilePlanService mockedFilePlanService; + + private @InjectMocks RMv24FilePlanContainerRuleInheritancePatch patch; + + @Before + public void before() + { + MockitoAnnotations.initMocks(this); + } + + /** + * Given there are not file plans, + * When the patch is executed, + * Then nothing happens + */ + @SuppressWarnings("unchecked") + @Test + public void noFilePlans() + { + // given + when(mockedFilePlanService.getFilePlans()) + .thenReturn(Collections.EMPTY_SET); + + // when + patch.applyInternal(); + + // then + verifyZeroInteractions(mockedNodeService); + } + + /** + * Given there is a file plan, + * When the patch is executed, + * Then the file plan containers are updated + */ + @Test + public void atLeastOneFilePlan() + { + NodeRef filePlan = generateNodeRef(mockedNodeService, RecordsManagementModel.TYPE_FILE_PLAN); + NodeRef holdsContainer = generateNodeRef(mockedNodeService); + NodeRef transferContainer = generateNodeRef(mockedNodeService); + NodeRef unfiledRecordsContainer = generateNodeRef(mockedNodeService); + + // given + when(mockedFilePlanService.getFilePlans()) + .thenReturn(Collections.singleton(filePlan)); + when(mockedFilePlanService.getHoldContainer(filePlan)) + .thenReturn(holdsContainer); + when(mockedFilePlanService.getTransferContainer(filePlan)) + .thenReturn(transferContainer); + when(mockedFilePlanService.getUnfiledContainer(filePlan)) + .thenReturn(unfiledRecordsContainer); + + // when + patch.applyInternal(); + + // then + verify(mockedNodeService).addAspect(holdsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + verify(mockedNodeService).addAspect(transferContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + verify(mockedNodeService).addAspect(unfiledRecordsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrapUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrapUnitTest.java index 502bc5b1e3..1161ec3c47 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrapUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordMetadataBootstrapUnitTest.java @@ -1,71 +1,71 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.record; - -import static org.mockito.Mockito.verify; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for RecordMetadataBootstrap - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RecordMetadataBootstrapUnitTest extends BaseUnitTest -{ - @InjectMocks private RecordMetadataBootstrap bootstrap; - - /** - * Test init method to ensure set map will register correctly with record service. - */ - @Test - public void testInit() - { - // create and set map - Map map = new HashMap(2); - map.put("rma:test1", "rma:filePlan"); - map.put("rma:test2", "rma:filePlan"); - bootstrap.setRecordMetadataAspects(map); - - // call init - bootstrap.init(); - - // verify that the metedata aspects where registered - QName test1 = QName.createQName(RM_URI, "test1"); - QName test2 = QName.createQName(RM_URI, "test2"); - verify(mockedRecordService).registerRecordMetadataAspect(test1, TYPE_FILE_PLAN); - verify(mockedRecordService).registerRecordMetadataAspect(test2, TYPE_FILE_PLAN); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.record; + +import static org.mockito.Mockito.verify; + +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.namespace.QName; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for RecordMetadataBootstrap + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RecordMetadataBootstrapUnitTest extends BaseUnitTest +{ + @InjectMocks private RecordMetadataBootstrap bootstrap; + + /** + * Test init method to ensure set map will register correctly with record service. + */ + @Test + public void testInit() + { + // create and set map + Map map = new HashMap(2); + map.put("rma:test1", "rma:filePlan"); + map.put("rma:test2", "rma:filePlan"); + bootstrap.setRecordMetadataAspects(map); + + // call init + bootstrap.init(); + + // verify that the metedata aspects where registered + QName test1 = QName.createQName(RM_URI, "test1"); + QName test2 = QName.createQName(RM_URI, "test2"); + verify(mockedRecordService).registerRecordMetadataAspect(test1, TYPE_FILE_PLAN); + verify(mockedRecordService).registerRecordMetadataAspect(test2, TYPE_FILE_PLAN); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java index 1b2b3543cc..506b8c03da 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java @@ -1,465 +1,465 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.record; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.policy.Behaviour; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.collections.CollectionUtils; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; - -/** - * Unit test for RecordServiceImpl - * - * @author Roy Wetherall - * @since 2.2 - */ -public class RecordServiceImplUnitTest extends BaseUnitTest -{ - private NodeRef nonStandardFilePlanComponent; - private NodeRef nonStandardFilePlan; - - private static QName TYPE_MY_FILE_PLAN = generateQName(); - private static QName ASPECT_FOR_FILE_PLAN = generateQName(); - - @Spy @InjectMocks private RecordServiceImpl recordService; - - @SuppressWarnings("unchecked") - @Before - @Override - public void before() throws Exception - { - super.before(); - - nonStandardFilePlanComponent = generateNodeRef(TYPE_RECORD_CATEGORY); - nonStandardFilePlan = generateNodeRef(TYPE_MY_FILE_PLAN); - - // set-up node service - when(mockedNodeService.getProperty(nonStandardFilePlanComponent, PROP_ROOT_NODEREF)).thenReturn(nonStandardFilePlan); - - // set-up dictionary service - when(mockedDictionaryService.getAllAspects()).thenReturn(CollectionUtils.EMPTY_COLLECTION); - - // mock up getting behaviours - when(recordService.getBehaviour(any(String.class))).thenReturn(mock(Behaviour.class)); - } - - @Test - public void testRegisterRecordMetadataAspect() - { - Map> map = recordService.getRecordMetadataAspectsMap(); - assertTrue(map.isEmpty()); - recordService.registerRecordMetadataAspect(ASPECT_FOR_FILE_PLAN, TYPE_FILE_PLAN); - map = recordService.getRecordMetadataAspectsMap(); - assertEquals(1, map.size()); - assertTrue(map.containsKey(ASPECT_FOR_FILE_PLAN)); - Set types = map.get(ASPECT_FOR_FILE_PLAN); - assertNotNull(types); - assertEquals(1, types.size()); - assertTrue(types.contains(TYPE_FILE_PLAN)); - } - - /** - * Given invalid types - * When linking - * Then exception thrown - */ - @Test - public void linkNonRecord() - { - NodeRef nonRecord = generateNodeRef(TYPE_CONTENT); - NodeRef recordFolder = generateRecordFolder(); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.link(nonRecord, recordFolder); - } - @Test - public void linkNonRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef nonRecordFolder = generateNodeRef(TYPE_FOLDER); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.link(record, nonRecordFolder); - } - - /** - * Given that the record is already a child of the record folder - * When I try to link the record to the same record folder - * Then an exception is thrown - */ - @Test - public void linkRecordToRecordFolderFailsIfAlreadyAChild() - { - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - - // given that the record is already a child of the record folder - makeChildrenOf(recordFolder, record); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.link(record, recordFolder); - } - - /** - * Given a record that is not a child of a record folder - * When I link the record to the record folder - * Then the record is now linked to the record folder - */ - @Test - public void linkRecordToRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - - // given that the record is already a child of the record folder - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // link - recordService.link(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - - /** - * Given that the source record has no disposition schedule - * When I link - * Then it is successful - */ - @Test public void linkNoSourceDisposition() - { - // create record and record folder - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // set dispositions - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(null); - - // link - recordService.link(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - - /** - * Given that the target record folder has no disposition schedule - * When I link - * Then it is successful - */ - @Test public void linkNoTargetDisposition() - { - // create record and record folder - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // set dispositions - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(mock(DispositionSchedule.class)); - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(null); - - // link - recordService.link(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - - /** - * Given that the source record and target record folder have incompatible disposition schedules - * When I link - * Then I expect a failure - */ - @Test public void linkIncompatibleDispositions() - { - // create record and record folder - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // set dispositions - DispositionSchedule recordDispositionSchedule = mock(DispositionSchedule.class); - when(recordDispositionSchedule.isRecordLevelDisposition()) - .thenReturn(true); - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(recordDispositionSchedule); - - DispositionSchedule recordFolderDispositionSchedule = mock(DispositionSchedule.class); - when(recordFolderDispositionSchedule.isRecordLevelDisposition()) - .thenReturn(false); - when(mockedDispositionService.getDispositionSchedule(recordFolder)) - .thenReturn(recordFolderDispositionSchedule); - - // expect exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.link(record, recordFolder); - } - - /** - * Given that the source record and target record folder have compatible disposition schedules - * When I link - * Then it is successful - */ - @Test public void linkCompatibleDispositions() - { - // create record and record folder - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // set dispositions - DispositionSchedule recordDispositionSchedule = mock(DispositionSchedule.class); - when(recordDispositionSchedule.isRecordLevelDisposition()) - .thenReturn(true); - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(recordDispositionSchedule); - - DispositionSchedule recordFolderDispositionSchedule = mock(DispositionSchedule.class); - when(recordFolderDispositionSchedule.isRecordLevelDisposition()) - .thenReturn(true); - when(mockedDispositionService.getDispositionSchedule(recordFolder)) - .thenReturn(recordFolderDispositionSchedule); - - // link - recordService.link(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - - /** - * Given invalid types - * When unlinking - * Then exception thrown - */ - @Test - public void unlinkNonRecord() - { - NodeRef nonRecord = generateNodeRef(TYPE_CONTENT); - NodeRef recordFolder = generateRecordFolder(); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // unlink - recordService.unlink(nonRecord, recordFolder); - } - @Test - public void unlinkNonRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef nonRecordFolder = generateNodeRef(TYPE_FOLDER); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // unlink - recordService.unlink(record, nonRecordFolder); - } - - /** - * Given a record folder is a records primary parent - * When I try and unlink the record from that record folder - * Then an exception is thrown - */ - @Test - public void unlinkRecordFromPrimaryRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - - // given that the record is already a child of the record folder - makePrimaryParentOf(record, recordFolder); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.unlink(record, recordFolder); - } - - /** - * Given a record that is linked to a record - * And that the record is not the primary parent of the record - * When I unlink the record to the record folder - * Then the record is no longer linked to the record folder - */ - @Test - public void unlinkRecordFromRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - - // the records primary parent is another record folder - makePrimaryParentOf(record, generateRecordFolder()); - - // unlink - recordService.unlink(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).removeChild(recordFolder, record); - } - - /** - * Given that a new record is being created - * When the behaviour is triggered - * Then the record is stored for later reference in the transaction - */ - @SuppressWarnings("unchecked") - @Test - public void onCreateChildAssociationNewRecord() - { - // standard content node - NodeRef nodeRef = generateCmContent("test.txt"); - ChildAssociationRef assoc = generateChildAssociationRef(generateNodeRef(), nodeRef); - - doNothing().when(recordService).file(nodeRef); - - // doesn't have no content aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) - .thenReturn(false); - - Set values = mock(HashSet.class); - when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) - .thenReturn(values); - - // trigger behaviour - recordService.onCreateChildAssociation(assoc, true); - - // verify - verify(values, times(1)).add(nodeRef); - } - - /** - * Given that an existing record is linked - * When the behaviour is triggered - * Then the record is not stored for later reference in the transaction - */ - @SuppressWarnings("unchecked") - @Test - public void onCreateChildAssociationExistingRecord() - { - // standard content node - NodeRef nodeRef = generateCmContent("test.txt"); - ChildAssociationRef assoc = generateChildAssociationRef(generateNodeRef(), nodeRef); - - doNothing().when(recordService).file(nodeRef); - - // doesn't have no content aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) - .thenReturn(false); - - Set values = mock(HashSet.class); - when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) - .thenReturn(values); - - // trigger behaviour - recordService.onCreateChildAssociation(assoc, false); - - // verify - verify(values, never()).add(nodeRef); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.record; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.repo.policy.Behaviour; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.collections.CollectionUtils; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Spy; + +/** + * Unit test for RecordServiceImpl + * + * @author Roy Wetherall + * @since 2.2 + */ +public class RecordServiceImplUnitTest extends BaseUnitTest +{ + private NodeRef nonStandardFilePlanComponent; + private NodeRef nonStandardFilePlan; + + private static QName TYPE_MY_FILE_PLAN = generateQName(); + private static QName ASPECT_FOR_FILE_PLAN = generateQName(); + + @Spy @InjectMocks private RecordServiceImpl recordService; + + @SuppressWarnings("unchecked") + @Before + @Override + public void before() throws Exception + { + super.before(); + + nonStandardFilePlanComponent = generateNodeRef(TYPE_RECORD_CATEGORY); + nonStandardFilePlan = generateNodeRef(TYPE_MY_FILE_PLAN); + + // set-up node service + when(mockedNodeService.getProperty(nonStandardFilePlanComponent, PROP_ROOT_NODEREF)).thenReturn(nonStandardFilePlan); + + // set-up dictionary service + when(mockedDictionaryService.getAllAspects()).thenReturn(CollectionUtils.EMPTY_COLLECTION); + + // mock up getting behaviours + when(recordService.getBehaviour(any(String.class))).thenReturn(mock(Behaviour.class)); + } + + @Test + public void testRegisterRecordMetadataAspect() + { + Map> map = recordService.getRecordMetadataAspectsMap(); + assertTrue(map.isEmpty()); + recordService.registerRecordMetadataAspect(ASPECT_FOR_FILE_PLAN, TYPE_FILE_PLAN); + map = recordService.getRecordMetadataAspectsMap(); + assertEquals(1, map.size()); + assertTrue(map.containsKey(ASPECT_FOR_FILE_PLAN)); + Set types = map.get(ASPECT_FOR_FILE_PLAN); + assertNotNull(types); + assertEquals(1, types.size()); + assertTrue(types.contains(TYPE_FILE_PLAN)); + } + + /** + * Given invalid types + * When linking + * Then exception thrown + */ + @Test + public void linkNonRecord() + { + NodeRef nonRecord = generateNodeRef(TYPE_CONTENT); + NodeRef recordFolder = generateRecordFolder(); + + // set expected exception + exception.expect(RecordLinkRuntimeException.class); + + // link + recordService.link(nonRecord, recordFolder); + } + @Test + public void linkNonRecordFolder() + { + NodeRef record = generateRecord(); + NodeRef nonRecordFolder = generateNodeRef(TYPE_FOLDER); + + // set expected exception + exception.expect(RecordLinkRuntimeException.class); + + // link + recordService.link(record, nonRecordFolder); + } + + /** + * Given that the record is already a child of the record folder + * When I try to link the record to the same record folder + * Then an exception is thrown + */ + @Test + public void linkRecordToRecordFolderFailsIfAlreadyAChild() + { + NodeRef record = generateRecord(); + NodeRef recordFolder = generateRecordFolder(); + + // given that the record is already a child of the record folder + makeChildrenOf(recordFolder, record); + + // set expected exception + exception.expect(RecordLinkRuntimeException.class); + + // link + recordService.link(record, recordFolder); + } + + /** + * Given a record that is not a child of a record folder + * When I link the record to the record folder + * Then the record is now linked to the record folder + */ + @Test + public void linkRecordToRecordFolder() + { + NodeRef record = generateRecord(); + NodeRef recordFolder = generateRecordFolder(); + + // given that the record is already a child of the record folder + makeChildrenOf(generateRecordFolder(), record); + + // set the name of the record + String name = generateText(); + doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); + + // link + recordService.link(record, recordFolder); + + // verify link was created + verify(mockedNodeService, times(1)).addChild( + recordFolder, + record, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); + } + + /** + * Given that the source record has no disposition schedule + * When I link + * Then it is successful + */ + @Test public void linkNoSourceDisposition() + { + // create record and record folder + NodeRef record = generateRecord(); + NodeRef recordFolder = generateRecordFolder(); + makeChildrenOf(generateRecordFolder(), record); + + // set the name of the record + String name = generateText(); + doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); + + // set dispositions + when(mockedDispositionService.getDispositionSchedule(record)) + .thenReturn(null); + + // link + recordService.link(record, recordFolder); + + // verify link was created + verify(mockedNodeService, times(1)).addChild( + recordFolder, + record, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); + } + + /** + * Given that the target record folder has no disposition schedule + * When I link + * Then it is successful + */ + @Test public void linkNoTargetDisposition() + { + // create record and record folder + NodeRef record = generateRecord(); + NodeRef recordFolder = generateRecordFolder(); + makeChildrenOf(generateRecordFolder(), record); + + // set the name of the record + String name = generateText(); + doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); + + // set dispositions + when(mockedDispositionService.getDispositionSchedule(record)) + .thenReturn(mock(DispositionSchedule.class)); + when(mockedDispositionService.getDispositionSchedule(record)) + .thenReturn(null); + + // link + recordService.link(record, recordFolder); + + // verify link was created + verify(mockedNodeService, times(1)).addChild( + recordFolder, + record, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); + } + + /** + * Given that the source record and target record folder have incompatible disposition schedules + * When I link + * Then I expect a failure + */ + @Test public void linkIncompatibleDispositions() + { + // create record and record folder + NodeRef record = generateRecord(); + NodeRef recordFolder = generateRecordFolder(); + makeChildrenOf(generateRecordFolder(), record); + + // set the name of the record + String name = generateText(); + doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); + + // set dispositions + DispositionSchedule recordDispositionSchedule = mock(DispositionSchedule.class); + when(recordDispositionSchedule.isRecordLevelDisposition()) + .thenReturn(true); + when(mockedDispositionService.getDispositionSchedule(record)) + .thenReturn(recordDispositionSchedule); + + DispositionSchedule recordFolderDispositionSchedule = mock(DispositionSchedule.class); + when(recordFolderDispositionSchedule.isRecordLevelDisposition()) + .thenReturn(false); + when(mockedDispositionService.getDispositionSchedule(recordFolder)) + .thenReturn(recordFolderDispositionSchedule); + + // expect exception + exception.expect(RecordLinkRuntimeException.class); + + // link + recordService.link(record, recordFolder); + } + + /** + * Given that the source record and target record folder have compatible disposition schedules + * When I link + * Then it is successful + */ + @Test public void linkCompatibleDispositions() + { + // create record and record folder + NodeRef record = generateRecord(); + NodeRef recordFolder = generateRecordFolder(); + makeChildrenOf(generateRecordFolder(), record); + + // set the name of the record + String name = generateText(); + doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); + + // set dispositions + DispositionSchedule recordDispositionSchedule = mock(DispositionSchedule.class); + when(recordDispositionSchedule.isRecordLevelDisposition()) + .thenReturn(true); + when(mockedDispositionService.getDispositionSchedule(record)) + .thenReturn(recordDispositionSchedule); + + DispositionSchedule recordFolderDispositionSchedule = mock(DispositionSchedule.class); + when(recordFolderDispositionSchedule.isRecordLevelDisposition()) + .thenReturn(true); + when(mockedDispositionService.getDispositionSchedule(recordFolder)) + .thenReturn(recordFolderDispositionSchedule); + + // link + recordService.link(record, recordFolder); + + // verify link was created + verify(mockedNodeService, times(1)).addChild( + recordFolder, + record, + ContentModel.ASSOC_CONTAINS, + QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); + } + + /** + * Given invalid types + * When unlinking + * Then exception thrown + */ + @Test + public void unlinkNonRecord() + { + NodeRef nonRecord = generateNodeRef(TYPE_CONTENT); + NodeRef recordFolder = generateRecordFolder(); + + // set expected exception + exception.expect(RecordLinkRuntimeException.class); + + // unlink + recordService.unlink(nonRecord, recordFolder); + } + @Test + public void unlinkNonRecordFolder() + { + NodeRef record = generateRecord(); + NodeRef nonRecordFolder = generateNodeRef(TYPE_FOLDER); + + // set expected exception + exception.expect(RecordLinkRuntimeException.class); + + // unlink + recordService.unlink(record, nonRecordFolder); + } + + /** + * Given a record folder is a records primary parent + * When I try and unlink the record from that record folder + * Then an exception is thrown + */ + @Test + public void unlinkRecordFromPrimaryRecordFolder() + { + NodeRef record = generateRecord(); + NodeRef recordFolder = generateRecordFolder(); + + // given that the record is already a child of the record folder + makePrimaryParentOf(record, recordFolder); + + // set expected exception + exception.expect(RecordLinkRuntimeException.class); + + // link + recordService.unlink(record, recordFolder); + } + + /** + * Given a record that is linked to a record + * And that the record is not the primary parent of the record + * When I unlink the record to the record folder + * Then the record is no longer linked to the record folder + */ + @Test + public void unlinkRecordFromRecordFolder() + { + NodeRef record = generateRecord(); + NodeRef recordFolder = generateRecordFolder(); + + // the records primary parent is another record folder + makePrimaryParentOf(record, generateRecordFolder()); + + // unlink + recordService.unlink(record, recordFolder); + + // verify link was created + verify(mockedNodeService, times(1)).removeChild(recordFolder, record); + } + + /** + * Given that a new record is being created + * When the behaviour is triggered + * Then the record is stored for later reference in the transaction + */ + @SuppressWarnings("unchecked") + @Test + public void onCreateChildAssociationNewRecord() + { + // standard content node + NodeRef nodeRef = generateCmContent("test.txt"); + ChildAssociationRef assoc = generateChildAssociationRef(generateNodeRef(), nodeRef); + + doNothing().when(recordService).file(nodeRef); + + // doesn't have no content aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) + .thenReturn(false); + + Set values = mock(HashSet.class); + when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) + .thenReturn(values); + + // trigger behaviour + recordService.onCreateChildAssociation(assoc, true); + + // verify + verify(values, times(1)).add(nodeRef); + } + + /** + * Given that an existing record is linked + * When the behaviour is triggered + * Then the record is not stored for later reference in the transaction + */ + @SuppressWarnings("unchecked") + @Test + public void onCreateChildAssociationExistingRecord() + { + // standard content node + NodeRef nodeRef = generateCmContent("test.txt"); + ChildAssociationRef assoc = generateChildAssociationRef(generateNodeRef(), nodeRef); + + doNothing().when(recordService).file(nodeRef); + + // doesn't have no content aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) + .thenReturn(false); + + Set values = mock(HashSet.class); + when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) + .thenReturn(values); + + // trigger behaviour + recordService.onCreateChildAssociation(assoc, false); + + // verify + verify(values, never()).add(nodeRef); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java index 0999f49b34..acdea71558 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java @@ -1,62 +1,62 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.recorded.version.config; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Base test class for the recorded version config tests - * - * @author Tuna Aksoy - * @since 2.3 - */ -public abstract class BaseRecordedVersionConfigTest extends BaseWebScriptUnitTest implements RecordableVersionModel -{ - /** Recorded version config web script root folder */ - protected static final String RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT = "alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/"; - - /** Node ref for test document */ - protected NodeRef testdoc; - - /** Setup web script parameters */ - protected Map buildParameters() - { - testdoc = generateCmContent("testdoc.txt"); - - return buildParameters - ( - "store_type", testdoc.getStoreRef().getProtocol(), - "store_id", testdoc.getStoreRef().getIdentifier(), - "id", testdoc.getId() - ); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.recorded.version.config; + +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Base test class for the recorded version config tests + * + * @author Tuna Aksoy + * @since 2.3 + */ +public abstract class BaseRecordedVersionConfigTest extends BaseWebScriptUnitTest implements RecordableVersionModel +{ + /** Recorded version config web script root folder */ + protected static final String RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT = "alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/"; + + /** Node ref for test document */ + protected NodeRef testdoc; + + /** Setup web script parameters */ + protected Map buildParameters() + { + testdoc = generateCmContent("testdoc.txt"); + + return buildParameters + ( + "store_type", testdoc.getStoreRef().getProtocol(), + "store_id", testdoc.getStoreRef().getIdentifier(), + "id", testdoc.getId() + ); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetUnitTest.java index d7a628b399..7febb0bfae 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetUnitTest.java @@ -1,136 +1,136 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.recorded.version.config; - -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.MAJOR_ONLY; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigGet; -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Recorded Version Config REST API GET implementation unit test. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordedVersionConfigGetUnitTest extends BaseRecordedVersionConfigTest -{ - /** RecordedVersionConfigGet webscript instance */ - protected @InjectMocks RecordedVersionConfigGet webScript; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recorded.version.config.BaseRecordedVersionConfigTest#getWebScript() - */ - @Override - protected DeclarativeWebScript getWebScript() - { - return webScript; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recorded.version.config.BaseRecordedVersionConfigTest#getWebScriptTemplate() - */ - @Override - protected String getWebScriptTemplate() - { - return RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT + "recorded-version-config.get.json.ftl"; - } - - @Test - public void getRecordedVersionConfig() throws Exception - { - // Build parameters - Map parameters = buildParameters(); - - // Test document should not have any recordable version policy set - doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); - - // Setup versions - List versions = Arrays.asList( - new Version(NONE.toString(), true), - new Version(MAJOR_ONLY.toString(), false), - new Version(ALL.toString(), false)); - - // Stub getVersions - doReturn(versions).when(mockedRecordableVersionConfigService).getVersions(testdoc); - - // Execute web script - JSONObject json = executeJSONWebScript(parameters); - - // Do checks - assertNotNull(json); - - assertTrue(json.has("data")); - JSONObject data = json.getJSONObject("data"); - assertNotNull(data); - - assertTrue(data.has("recordableVersions")); - JSONArray recordableVersions = data.getJSONArray("recordableVersions"); - assertNotNull(recordableVersions); - assertEquals(recordableVersions.length(), 3); - - List policies = new ArrayList(); - boolean isSelected = false; - int selectedOnce = 0; - for (int i = 0; i < recordableVersions.length(); i++) - { - JSONObject jsonObject = recordableVersions.getJSONObject(i); - String policy = jsonObject.getString("policy"); - policies.add(RecordableVersionPolicy.valueOf(policy)); - boolean selected = Boolean.valueOf(jsonObject.getString("selected")).booleanValue(); - if (selected) - { - isSelected = true; - selectedOnce++; - } - } - assertEquals(policies, Arrays.asList(RecordableVersionPolicy.values())); - assertTrue(isSelected); - assertEquals(selectedOnce, 1); - - // Test document should still not have any recordable version policy set - doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.recorded.version.config; + +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.MAJOR_ONLY; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigGet; +import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.springframework.extensions.webscripts.DeclarativeWebScript; + +/** + * Recorded Version Config REST API GET implementation unit test. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RecordedVersionConfigGetUnitTest extends BaseRecordedVersionConfigTest +{ + /** RecordedVersionConfigGet webscript instance */ + protected @InjectMocks RecordedVersionConfigGet webScript; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recorded.version.config.BaseRecordedVersionConfigTest#getWebScript() + */ + @Override + protected DeclarativeWebScript getWebScript() + { + return webScript; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.recorded.version.config.BaseRecordedVersionConfigTest#getWebScriptTemplate() + */ + @Override + protected String getWebScriptTemplate() + { + return RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT + "recorded-version-config.get.json.ftl"; + } + + @Test + public void getRecordedVersionConfig() throws Exception + { + // Build parameters + Map parameters = buildParameters(); + + // Test document should not have any recordable version policy set + doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); + + // Setup versions + List versions = Arrays.asList( + new Version(NONE.toString(), true), + new Version(MAJOR_ONLY.toString(), false), + new Version(ALL.toString(), false)); + + // Stub getVersions + doReturn(versions).when(mockedRecordableVersionConfigService).getVersions(testdoc); + + // Execute web script + JSONObject json = executeJSONWebScript(parameters); + + // Do checks + assertNotNull(json); + + assertTrue(json.has("data")); + JSONObject data = json.getJSONObject("data"); + assertNotNull(data); + + assertTrue(data.has("recordableVersions")); + JSONArray recordableVersions = data.getJSONArray("recordableVersions"); + assertNotNull(recordableVersions); + assertEquals(recordableVersions.length(), 3); + + List policies = new ArrayList(); + boolean isSelected = false; + int selectedOnce = 0; + for (int i = 0; i < recordableVersions.length(); i++) + { + JSONObject jsonObject = recordableVersions.getJSONObject(i); + String policy = jsonObject.getString("policy"); + policies.add(RecordableVersionPolicy.valueOf(policy)); + boolean selected = Boolean.valueOf(jsonObject.getString("selected")).booleanValue(); + if (selected) + { + isSelected = true; + selectedOnce++; + } + } + assertEquals(policies, Arrays.asList(RecordableVersionPolicy.values())); + assertTrue(isSelected); + assertEquals(selectedOnce, 1); + + // Test document should still not have any recordable version policy set + doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostUnitTest.java index cab5a8bd8d..0e2bfaf49f 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostUnitTest.java @@ -1,113 +1,113 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.recorded.version.config; - -import static org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigPost.RECORDED_VERSION; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.doReturn; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigPost; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Recorded Version Config REST API POST implementation unit test. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordedVersionConfigPostUnitTest extends BaseRecordedVersionConfigTest -{ - /** RecordedVersionConfigPost webscript instance */ - protected @InjectMocks RecordedVersionConfigPost webScript; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() - */ - @Override - protected DeclarativeWebScript getWebScript() - { - return webScript; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() - */ - @Override - protected String getWebScriptTemplate() - { - return RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT + "recorded-version-config.post.json.ftl"; - } - - @Test - public void setRecordedVersionConfig() throws Exception - { - // Build the content - String content = buildContent(ALL); - - // Build parameters - Map parameters = buildParameters(); - - // Test document should not have any recordable version policy set - doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); - - // execute web script - JSONObject json = executeJSONWebScript(parameters, content); - - // Do checks - assertNotNull(json); - assertEquals(json.length(), 0); - - // Test document must have recordable version policy "ALL" set - doReturn(ALL).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); - } - - /** - * Helper method to build the content for the POST request - * @param policy The recordable version policy - * - * @return Content for the build request - */ - private String buildContent(RecordableVersionPolicy policy) - { - StringBuilder sb = new StringBuilder(); - sb.append("{\""); - sb.append(RECORDED_VERSION); - sb.append("\":\""); - sb.append(policy.toString()); - sb.append("\"}"); - return sb.toString(); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.recorded.version.config; + +import static org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigPost.RECORDED_VERSION; +import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.doReturn; + +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigPost; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; +import org.json.JSONObject; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.springframework.extensions.webscripts.DeclarativeWebScript; + +/** + * Recorded Version Config REST API POST implementation unit test. + * + * @author Tuna Aksoy + * @since 2.3 + */ +public class RecordedVersionConfigPostUnitTest extends BaseRecordedVersionConfigTest +{ + /** RecordedVersionConfigPost webscript instance */ + protected @InjectMocks RecordedVersionConfigPost webScript; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() + */ + @Override + protected DeclarativeWebScript getWebScript() + { + return webScript; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() + */ + @Override + protected String getWebScriptTemplate() + { + return RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT + "recorded-version-config.post.json.ftl"; + } + + @Test + public void setRecordedVersionConfig() throws Exception + { + // Build the content + String content = buildContent(ALL); + + // Build parameters + Map parameters = buildParameters(); + + // Test document should not have any recordable version policy set + doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); + + // execute web script + JSONObject json = executeJSONWebScript(parameters, content); + + // Do checks + assertNotNull(json); + assertEquals(json.length(), 0); + + // Test document must have recordable version policy "ALL" set + doReturn(ALL).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); + } + + /** + * Helper method to build the content for the POST request + * @param policy The recordable version policy + * + * @return Content for the build request + */ + private String buildContent(RecordableVersionPolicy policy) + { + StringBuilder sb = new StringBuilder(); + sb.append("{\""); + sb.append(RECORDED_VERSION); + sb.append("\":\""); + sb.append(policy.toString()); + sb.append("\"}"); + return sb.toString(); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java index 79bfa67047..44a4e13ace 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java @@ -1,78 +1,78 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Base hold web script unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest -{ - /** test holds */ - protected NodeRef hold1NodeRef; - protected NodeRef hold2NodeRef; - protected List holds; - protected List records; - protected List recordFolders; - protected List filePlanComponents; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - public void before() throws Exception - { - super.before(); - - // generate test holds - hold1NodeRef = generateHoldNodeRef("hold1"); - hold2NodeRef = generateHoldNodeRef("hold2"); - - // list of holds - holds = new ArrayList(2); - Collections.addAll(holds, hold1NodeRef, hold2NodeRef); - - // list of records - records = Collections.singletonList(record); - - // list of record folders - recordFolders = Collections.singletonList(recordFolder); - - // list of file plan components - filePlanComponents = Collections.singletonList(filePlanComponent); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Base hold web script unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest +{ + /** test holds */ + protected NodeRef hold1NodeRef; + protected NodeRef hold2NodeRef; + protected List holds; + protected List records; + protected List recordFolders; + protected List filePlanComponents; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Override + public void before() throws Exception + { + super.before(); + + // generate test holds + hold1NodeRef = generateHoldNodeRef("hold1"); + hold2NodeRef = generateHoldNodeRef("hold2"); + + // list of holds + holds = new ArrayList(2); + Collections.addAll(holds, hold1NodeRef, hold2NodeRef); + + // list of records + records = Collections.singletonList(record); + + // list of record folders + recordFolders = Collections.singletonList(recordFolder); + + // list of file plan components + filePlanComponents = Collections.singletonList(filePlanComponent); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java index 145ae69f36..768a83c15f 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java @@ -1,249 +1,249 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.WebScriptExceptionMatcher.badRequest; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.List; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Test; -import org.springframework.extensions.webscripts.WebScriptException; - -/** - * Base hold web script with content unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebScriptUnitTest -{ - /** - * Helper method to build JSON content to send to hold webscripts. - */ - protected String buildContent(List nodeRefs, List holds) - { - StringBuilder builder = new StringBuilder(255); - builder.append("{"); - - if (nodeRefs != null) - { - builder.append("'nodeRefs':["); - - boolean bFirst = true; - for (NodeRef nodeRef : nodeRefs) - { - if (!bFirst) - { - builder.append(","); - } - else - { - bFirst = false; - } - - builder.append("'" + nodeRef.toString() + "'"); - } - - builder.append("]"); - } - - if (nodeRefs != null && holds != null) - { - builder.append(","); - } - - if (holds != null) - { - builder.append("'holds':["); - - boolean bFirst = true; - for (NodeRef hold : holds) - { - if (!bFirst) - { - builder.append(","); - } - else - { - bFirst = false; - } - - builder.append("'" + hold.toString() + "'"); - } - - builder.append("]"); - } - - builder.append("}"); - - return builder.toString(); - } - - /** - * Test for expected exception when invalid JSON sent - */ - @SuppressWarnings("unchecked") - @Test - public void sendInvalidJSON() throws Exception - { - // invalid JSON - String content = "invalid JSON"; - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when one of the holds doesn't exist. - */ - @SuppressWarnings("unchecked") - @Test - public void holdDoesNotExist() throws Exception - { - // setup interactions - when(mockedNodeService.exists(eq(hold1NodeRef))).thenReturn(false); - - // build content - String content = buildContent(records, holds); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected excpetion when the item being added to the hold - * does not exist. - */ - @SuppressWarnings("unchecked") - @Test - public void nodeRefDoesNotExist() throws Exception - { - // setup interactions - when(mockedNodeService.exists(eq(record))).thenReturn(false); - - // build content - String content = buildContent(records, holds); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when hold information is missing from - * sent JSON. - */ - @SuppressWarnings("unchecked") - @Test - public void holdMissingFromContent() throws Exception - { - // build content - String content = buildContent(records, null); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when noderef information is missing - * from send JSON. - */ - @SuppressWarnings("unchecked") - @Test - public void nodeRefMissingFromContent() throws Exception - { - // build content - String content = buildContent(null, holds); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when adding an item to something - * that isn't a hold. - */ - @SuppressWarnings("unchecked") - @Test - public void holdIsNotAHold() throws Exception - { - // build json content to send to server - List notAHold = Collections.singletonList(recordFolder); - String content = buildContent(records, notAHold); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } - - /** - * Test for expected exception when adding an item to a hold - * that isn't a record or record folder. - */ - @SuppressWarnings("unchecked") - @Test - public void nodeRefIsNotARecordOrRecordFolder() throws Exception - { - // build json content to send to server - List notAHold = Collections.singletonList(recordFolder); - String content = buildContent(filePlanComponents, notAHold); - - // expected exception - exception.expect(WebScriptException.class); - exception.expect(badRequest()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP, content); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.WebScriptExceptionMatcher.badRequest; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Test; +import org.springframework.extensions.webscripts.WebScriptException; + +/** + * Base hold web script with content unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebScriptUnitTest +{ + /** + * Helper method to build JSON content to send to hold webscripts. + */ + protected String buildContent(List nodeRefs, List holds) + { + StringBuilder builder = new StringBuilder(255); + builder.append("{"); + + if (nodeRefs != null) + { + builder.append("'nodeRefs':["); + + boolean bFirst = true; + for (NodeRef nodeRef : nodeRefs) + { + if (!bFirst) + { + builder.append(","); + } + else + { + bFirst = false; + } + + builder.append("'" + nodeRef.toString() + "'"); + } + + builder.append("]"); + } + + if (nodeRefs != null && holds != null) + { + builder.append(","); + } + + if (holds != null) + { + builder.append("'holds':["); + + boolean bFirst = true; + for (NodeRef hold : holds) + { + if (!bFirst) + { + builder.append(","); + } + else + { + bFirst = false; + } + + builder.append("'" + hold.toString() + "'"); + } + + builder.append("]"); + } + + builder.append("}"); + + return builder.toString(); + } + + /** + * Test for expected exception when invalid JSON sent + */ + @SuppressWarnings("unchecked") + @Test + public void sendInvalidJSON() throws Exception + { + // invalid JSON + String content = "invalid JSON"; + + // expected exception + exception.expect(WebScriptException.class); + exception.expect(badRequest()); + + // execute web script + executeWebScript(Collections.EMPTY_MAP, content); + } + + /** + * Test for expected exception when one of the holds doesn't exist. + */ + @SuppressWarnings("unchecked") + @Test + public void holdDoesNotExist() throws Exception + { + // setup interactions + when(mockedNodeService.exists(eq(hold1NodeRef))).thenReturn(false); + + // build content + String content = buildContent(records, holds); + + // expected exception + exception.expect(WebScriptException.class); + exception.expect(badRequest()); + + // execute web script + executeWebScript(Collections.EMPTY_MAP, content); + } + + /** + * Test for expected excpetion when the item being added to the hold + * does not exist. + */ + @SuppressWarnings("unchecked") + @Test + public void nodeRefDoesNotExist() throws Exception + { + // setup interactions + when(mockedNodeService.exists(eq(record))).thenReturn(false); + + // build content + String content = buildContent(records, holds); + + // expected exception + exception.expect(WebScriptException.class); + exception.expect(badRequest()); + + // execute web script + executeWebScript(Collections.EMPTY_MAP, content); + } + + /** + * Test for expected exception when hold information is missing from + * sent JSON. + */ + @SuppressWarnings("unchecked") + @Test + public void holdMissingFromContent() throws Exception + { + // build content + String content = buildContent(records, null); + + // expected exception + exception.expect(WebScriptException.class); + exception.expect(badRequest()); + + // execute web script + executeWebScript(Collections.EMPTY_MAP, content); + } + + /** + * Test for expected exception when noderef information is missing + * from send JSON. + */ + @SuppressWarnings("unchecked") + @Test + public void nodeRefMissingFromContent() throws Exception + { + // build content + String content = buildContent(null, holds); + + // expected exception + exception.expect(WebScriptException.class); + exception.expect(badRequest()); + + // execute web script + executeWebScript(Collections.EMPTY_MAP, content); + } + + /** + * Test for expected exception when adding an item to something + * that isn't a hold. + */ + @SuppressWarnings("unchecked") + @Test + public void holdIsNotAHold() throws Exception + { + // build json content to send to server + List notAHold = Collections.singletonList(recordFolder); + String content = buildContent(records, notAHold); + + // expected exception + exception.expect(WebScriptException.class); + exception.expect(badRequest()); + + // execute web script + executeWebScript(Collections.EMPTY_MAP, content); + } + + /** + * Test for expected exception when adding an item to a hold + * that isn't a record or record folder. + */ + @SuppressWarnings("unchecked") + @Test + public void nodeRefIsNotARecordOrRecordFolder() throws Exception + { + // build json content to send to server + List notAHold = Collections.singletonList(recordFolder); + String content = buildContent(filePlanComponents, notAHold); + + // expected exception + exception.expect(WebScriptException.class); + exception.expect(badRequest()); + + // execute web script + executeWebScript(Collections.EMPTY_MAP, content); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java index 39943f535a..244fa49d55 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPostUnitTest.java @@ -1,109 +1,109 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.util.Collections; - -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Hold ReST API POST implementation unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest -{ - /** classpath location of ftl template for web script */ - private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.post.json.ftl"; - - /** HoldPost webscript instance */ - protected @Spy @InjectMocks HoldPost webScript; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() - */ - @Override - protected DeclarativeWebScript getWebScript() - { - return webScript; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() - */ - @Override - protected String getWebScriptTemplate() - { - return WEBSCRIPT_TEMPLATE; - } - - /** - * Test that a record can be added to holds. - */ - @SuppressWarnings("unchecked") - @Test - public void addRecordToHolds() throws Exception - { - // build json to send to server - String content = buildContent(records, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the record was added to the holds - verify(mockedHoldService, times(1)).addToHolds(holds, records); - } - - /** - * Test that a record folder can be added to holds. - */ - @SuppressWarnings("unchecked") - @Test - public void addRecordFolderToHolds() throws Exception - { - // build json to send to server - String content = buildContent(recordFolders, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the record was added to the holds - verify(mockedHoldService, times(1)).addToHolds(holds, recordFolders); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Collections; + +import org.json.JSONObject; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.springframework.extensions.webscripts.DeclarativeWebScript; + +/** + * Hold ReST API POST implementation unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class HoldPostUnitTest extends BaseHoldWebScriptWithContentUnitTest +{ + /** classpath location of ftl template for web script */ + private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.post.json.ftl"; + + /** HoldPost webscript instance */ + protected @Spy @InjectMocks HoldPost webScript; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() + */ + @Override + protected DeclarativeWebScript getWebScript() + { + return webScript; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() + */ + @Override + protected String getWebScriptTemplate() + { + return WEBSCRIPT_TEMPLATE; + } + + /** + * Test that a record can be added to holds. + */ + @SuppressWarnings("unchecked") + @Test + public void addRecordToHolds() throws Exception + { + // build json to send to server + String content = buildContent(records, holds); + + // execute web script + JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); + assertNotNull(json); + + // verify that the record was added to the holds + verify(mockedHoldService, times(1)).addToHolds(holds, records); + } + + /** + * Test that a record folder can be added to holds. + */ + @SuppressWarnings("unchecked") + @Test + public void addRecordFolderToHolds() throws Exception + { + // build json to send to server + String content = buildContent(recordFolders, holds); + + // execute web script + JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); + assertNotNull(json); + + // verify that the record was added to the holds + verify(mockedHoldService, times(1)).addToHolds(holds, recordFolders); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java index d1492a36ed..8dc8adf225 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldPutUnitTest.java @@ -1,109 +1,109 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.util.Collections; - -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Hold ReST API PUT implementation unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest -{ - /** classpath location of ftl template for web script */ - private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.put.json.ftl"; - - /** HoldPut webscript instance */ - protected @Spy @InjectMocks HoldPut webScript; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() - */ - @Override - protected DeclarativeWebScript getWebScript() - { - return webScript; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() - */ - @Override - protected String getWebScriptTemplate() - { - return WEBSCRIPT_TEMPLATE; - } - - /** - * Test that a record can be removed from holds. - */ - @SuppressWarnings("unchecked") - @Test - public void removeRecordFromHolds() throws Exception - { - // build json to send to server - String content = buildContent(records, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the record was removed from holds - verify(mockedHoldService, times(1)).removeFromHolds(holds, records); - } - - /** - * Test that a record folder can be removed from holds. - */ - @SuppressWarnings("unchecked") - @Test - public void removeRecordFolderFromHolds() throws Exception - { - // build json to send to server - String content = buildContent(recordFolders, holds); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); - assertNotNull(json); - - // verify that the record was removed from holds - verify(mockedHoldService, times(1)).removeFromHolds(holds, recordFolders); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Collections; + +import org.json.JSONObject; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.springframework.extensions.webscripts.DeclarativeWebScript; + +/** + * Hold ReST API PUT implementation unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class HoldPutUnitTest extends BaseHoldWebScriptWithContentUnitTest +{ + /** classpath location of ftl template for web script */ + private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "hold.put.json.ftl"; + + /** HoldPut webscript instance */ + protected @Spy @InjectMocks HoldPut webScript; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() + */ + @Override + protected DeclarativeWebScript getWebScript() + { + return webScript; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() + */ + @Override + protected String getWebScriptTemplate() + { + return WEBSCRIPT_TEMPLATE; + } + + /** + * Test that a record can be removed from holds. + */ + @SuppressWarnings("unchecked") + @Test + public void removeRecordFromHolds() throws Exception + { + // build json to send to server + String content = buildContent(records, holds); + + // execute web script + JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); + assertNotNull(json); + + // verify that the record was removed from holds + verify(mockedHoldService, times(1)).removeFromHolds(holds, records); + } + + /** + * Test that a record folder can be removed from holds. + */ + @SuppressWarnings("unchecked") + @Test + public void removeRecordFolderFromHolds() throws Exception + { + // build json to send to server + String content = buildContent(recordFolders, holds); + + // execute web script + JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP, content); + assertNotNull(json); + + // verify that the record was removed from holds + verify(mockedHoldService, times(1)).removeFromHolds(holds, recordFolders); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java index dae971f104..fb2472d4cb 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/HoldsGetUnitTest.java @@ -1,278 +1,278 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.script.hold; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.WebScriptExceptionMatcher.fileNotFound; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; - -import java.util.Collections; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.security.AccessStatus; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.WebScriptException; - -/** - * Holds ReST API GET implementation unit test. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class HoldsGetUnitTest extends BaseHoldWebScriptUnitTest -{ - /** classpath location of ftl template for web script */ - private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "holds.get.json.ftl"; - - /** HoldsGet webscript instance */ - protected @Spy @InjectMocks HoldsGet webScript; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() - */ - @Override - protected DeclarativeWebScript getWebScript() - { - return webScript; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() - */ - @Override - protected String getWebScriptTemplate() - { - return WEBSCRIPT_TEMPLATE; - } - - /** - * Test the outcome of calling the web script with an invalid file plan - */ - @Test - public void invalidFilePlan() throws Exception - { - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", "imadethisup" - ); - - // setup expected exception - exception.expect(WebScriptException.class); - exception.expect(fileNotFound()); - - // execute web script - executeWebScript(parameters); - } - - /** - * Test the outcome of calling the web script with no file plan specified - * and with no default file plan created. - */ - @SuppressWarnings("unchecked") - @Test - public void defaultFilePlanDoesNotExist() throws Exception - { - // setup expected exception - exception.expect(WebScriptException.class); - exception.expect(fileNotFound()); - - // execute web script - executeWebScript(Collections.EMPTY_MAP); - } - - /** - * Test the successful retrieval of holds defined for a specified file - * plan. - */ - @Test - public void getHoldsForFilePlan() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).getHolds(filePlan); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId() - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - } - - /** - * Test the retrieval of holds for the default file plan. - */ - @SuppressWarnings("unchecked") - @Test - public void getHoldsForDefaultFilePlan() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).getHolds(filePlan); - doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // execute web script - JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - } - - /** - * Test the retrieval of holds that hold a specified node. - */ - @Test - public void getHoldsThatNodeRefIsHeldBy() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).heldBy(record, true); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId(), - "itemNodeRef", record.toString() - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - - } - - /** - * Test the retrieval of holds that a node is not held in. - */ - @Test - public void getHoldsThatNodeRefIsNotHeldBy() throws Exception - { - // setup interactions - doReturn(holds).when(mockedHoldService).heldBy(record, false); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId(), - "itemNodeRef", record.toString(), - "includedInHold", "false" - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - testForBothHolds(json); - } - - public void getFileOnlyHolds() throws Exception - { - doReturn(AccessStatus.ALLOWED).when(mockedPermissionService).hasPermission(hold1NodeRef, RMPermissionModel.FILING); - doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold2NodeRef, RMPermissionModel.FILING); - - // setup web script parameters - Map parameters = buildParameters - ( - "store_type", filePlan.getStoreRef().getProtocol(), - "store_id", filePlan.getStoreRef().getIdentifier(), - "id", filePlan.getId(), - "itemNodeRef", record.toString(), - "includedInHold", "false", - "fileOnly", "true" - ); - - // execute web script - JSONObject json = executeJSONWebScript(parameters); - assertNotNull(json); - - // check the JSON result - assertTrue(json.has("data")); - assertTrue(json.getJSONObject("data").has("holds")); - - JSONArray jsonHolds = json.getJSONObject("data").getJSONArray("holds"); - assertNotNull(jsonHolds); - assertEquals(1, jsonHolds.length()); - - JSONObject hold1 = jsonHolds.getJSONObject(0); - assertNotNull(hold1); - assertEquals("hold1", hold1.getString("name")); - assertEquals(hold1NodeRef.toString(), hold1.getString("nodeRef")); - } - - /** - * Helper method to test JSON object for the presence of both test holds. - * - * @param json json result from web script - */ - private void testForBothHolds(JSONObject json) throws Exception - { - // check the JSON result - assertTrue(json.has("data")); - assertTrue(json.getJSONObject("data").has("holds")); - - JSONArray jsonHolds = json.getJSONObject("data").getJSONArray("holds"); - assertNotNull(jsonHolds); - assertEquals(2, jsonHolds.length()); - - JSONObject hold1 = jsonHolds.getJSONObject(0); - assertNotNull(hold1); - assertEquals("hold1", hold1.getString("name")); - assertEquals(hold1NodeRef.toString(), hold1.getString("nodeRef")); - - JSONObject hold2 = jsonHolds.getJSONObject(1); - assertNotNull(hold2); - assertEquals("hold2", hold2.getString("name")); - assertEquals(hold2NodeRef.toString(), hold2.getString("nodeRef")); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.script.hold; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.WebScriptExceptionMatcher.fileNotFound; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; + +import java.util.Collections; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.service.cmr.security.AccessStatus; +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.WebScriptException; + +/** + * Holds ReST API GET implementation unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class HoldsGetUnitTest extends BaseHoldWebScriptUnitTest +{ + /** classpath location of ftl template for web script */ + private static final String WEBSCRIPT_TEMPLATE = WEBSCRIPT_ROOT_RM + "holds.get.json.ftl"; + + /** HoldsGet webscript instance */ + protected @Spy @InjectMocks HoldsGet webScript; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() + */ + @Override + protected DeclarativeWebScript getWebScript() + { + return webScript; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() + */ + @Override + protected String getWebScriptTemplate() + { + return WEBSCRIPT_TEMPLATE; + } + + /** + * Test the outcome of calling the web script with an invalid file plan + */ + @Test + public void invalidFilePlan() throws Exception + { + // setup web script parameters + Map parameters = buildParameters + ( + "store_type", filePlan.getStoreRef().getProtocol(), + "store_id", filePlan.getStoreRef().getIdentifier(), + "id", "imadethisup" + ); + + // setup expected exception + exception.expect(WebScriptException.class); + exception.expect(fileNotFound()); + + // execute web script + executeWebScript(parameters); + } + + /** + * Test the outcome of calling the web script with no file plan specified + * and with no default file plan created. + */ + @SuppressWarnings("unchecked") + @Test + public void defaultFilePlanDoesNotExist() throws Exception + { + // setup expected exception + exception.expect(WebScriptException.class); + exception.expect(fileNotFound()); + + // execute web script + executeWebScript(Collections.EMPTY_MAP); + } + + /** + * Test the successful retrieval of holds defined for a specified file + * plan. + */ + @Test + public void getHoldsForFilePlan() throws Exception + { + // setup interactions + doReturn(holds).when(mockedHoldService).getHolds(filePlan); + + // setup web script parameters + Map parameters = buildParameters + ( + "store_type", filePlan.getStoreRef().getProtocol(), + "store_id", filePlan.getStoreRef().getIdentifier(), + "id", filePlan.getId() + ); + + // execute web script + JSONObject json = executeJSONWebScript(parameters); + assertNotNull(json); + + // check the JSON result + testForBothHolds(json); + } + + /** + * Test the retrieval of holds for the default file plan. + */ + @SuppressWarnings("unchecked") + @Test + public void getHoldsForDefaultFilePlan() throws Exception + { + // setup interactions + doReturn(holds).when(mockedHoldService).getHolds(filePlan); + doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + + // execute web script + JSONObject json = executeJSONWebScript(Collections.EMPTY_MAP); + assertNotNull(json); + + // check the JSON result + testForBothHolds(json); + } + + /** + * Test the retrieval of holds that hold a specified node. + */ + @Test + public void getHoldsThatNodeRefIsHeldBy() throws Exception + { + // setup interactions + doReturn(holds).when(mockedHoldService).heldBy(record, true); + + // setup web script parameters + Map parameters = buildParameters + ( + "store_type", filePlan.getStoreRef().getProtocol(), + "store_id", filePlan.getStoreRef().getIdentifier(), + "id", filePlan.getId(), + "itemNodeRef", record.toString() + ); + + // execute web script + JSONObject json = executeJSONWebScript(parameters); + assertNotNull(json); + + // check the JSON result + testForBothHolds(json); + + } + + /** + * Test the retrieval of holds that a node is not held in. + */ + @Test + public void getHoldsThatNodeRefIsNotHeldBy() throws Exception + { + // setup interactions + doReturn(holds).when(mockedHoldService).heldBy(record, false); + + // setup web script parameters + Map parameters = buildParameters + ( + "store_type", filePlan.getStoreRef().getProtocol(), + "store_id", filePlan.getStoreRef().getIdentifier(), + "id", filePlan.getId(), + "itemNodeRef", record.toString(), + "includedInHold", "false" + ); + + // execute web script + JSONObject json = executeJSONWebScript(parameters); + assertNotNull(json); + + // check the JSON result + testForBothHolds(json); + } + + public void getFileOnlyHolds() throws Exception + { + doReturn(AccessStatus.ALLOWED).when(mockedPermissionService).hasPermission(hold1NodeRef, RMPermissionModel.FILING); + doReturn(AccessStatus.DENIED).when(mockedPermissionService).hasPermission(hold2NodeRef, RMPermissionModel.FILING); + + // setup web script parameters + Map parameters = buildParameters + ( + "store_type", filePlan.getStoreRef().getProtocol(), + "store_id", filePlan.getStoreRef().getIdentifier(), + "id", filePlan.getId(), + "itemNodeRef", record.toString(), + "includedInHold", "false", + "fileOnly", "true" + ); + + // execute web script + JSONObject json = executeJSONWebScript(parameters); + assertNotNull(json); + + // check the JSON result + assertTrue(json.has("data")); + assertTrue(json.getJSONObject("data").has("holds")); + + JSONArray jsonHolds = json.getJSONObject("data").getJSONArray("holds"); + assertNotNull(jsonHolds); + assertEquals(1, jsonHolds.length()); + + JSONObject hold1 = jsonHolds.getJSONObject(0); + assertNotNull(hold1); + assertEquals("hold1", hold1.getString("name")); + assertEquals(hold1NodeRef.toString(), hold1.getString("nodeRef")); + } + + /** + * Helper method to test JSON object for the presence of both test holds. + * + * @param json json result from web script + */ + private void testForBothHolds(JSONObject json) throws Exception + { + // check the JSON result + assertTrue(json.has("data")); + assertTrue(json.getJSONObject("data").has("holds")); + + JSONArray jsonHolds = json.getJSONObject("data").getJSONArray("holds"); + assertNotNull(jsonHolds); + assertEquals(2, jsonHolds.length()); + + JSONObject hold1 = jsonHolds.getJSONObject(0); + assertNotNull(hold1); + assertEquals("hold1", hold1.getString("name")); + assertEquals(hold1NodeRef.toString(), hold1.getString("nodeRef")); + + JSONObject hold2 = jsonHolds.getJSONObject(1); + assertNotNull(hold2); + assertEquals("hold2", hold2.getString("name")); + assertEquals(hold2NodeRef.toString(), hold2.getString("nodeRef")); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImplUnitTest.java index 9bda06d5db..05d691186b 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImplUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImplUnitTest.java @@ -1,928 +1,928 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.READER_GROUP_PREFIX; -import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.ROOT_IPR_GROUP; -import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.WRITER_GROUP_PREFIX; -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; -import static org.alfresco.service.cmr.security.PermissionService.GROUP_PREFIX; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anySet; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.alfresco.model.RenditionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.query.PagingRequest; -import org.alfresco.query.PagingResults; -import org.alfresco.repo.security.authority.RMAuthority; -import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.service.transaction.TransactionService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.context.ApplicationContext; -import org.springframework.context.event.ContextRefreshedEvent; - -/** - * Extended security service implementation unit test. - * - * @author Roy Wetherall - * @since 2.5 - */ -public class ExtendedSecurityServiceImplUnitTest -{ - /** service mocks*/ - @Mock private FilePlanService mockedFilePlanService; - @Mock private FilePlanRoleService mockedFilePlanRoleService; - @Mock private AuthorityService mockedAuthorityService; - @Mock private PermissionService mockedPermissionService; - @Mock private TransactionService mockedTransactionService; - @Mock private RetryingTransactionHelper mockedRetryingTransactionHelper; - @Mock private NodeService mockedNodeService; - @Mock private PagingResults mockedReadPagingResults; - @Mock private PagingResults mockedWritePagingResults; - @Mock private ApplicationContext mockedApplicationContext; - @Mock private ChildAssociationRef mockedChildAssociationRef; - - /** test component */ - @InjectMocks private ExtendedSecurityServiceImpl extendedSecurityService; - - /** read/write group full names */ - private static final String READER_GROUP_FULL_PREFIX = GROUP_PREFIX + READER_GROUP_PREFIX; - private static final String WRITER_GROUP_FULL_PREFIX = GROUP_PREFIX + WRITER_GROUP_PREFIX; - - /** test authorities */ - private static final String USER = "USER"; - private static final String GROUP = GROUP_PREFIX + "GROUP"; - private static final String USER_W = "USER_W"; - private static final String GROUP_W = GROUP_PREFIX + "GROUP_W"; - private static final Set READERS = Stream.of(USER, GROUP).collect(Collectors.toSet()); - private static final Set WRITERS = Stream.of(USER_W, GROUP_W).collect(Collectors.toSet()); - - /** has extended security permission set */ - private static final Set HAS_EXTENDED_SECURITY = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, READER_GROUP_FULL_PREFIX, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, WRITER_GROUP_FULL_PREFIX, 2)) - .collect(Collectors.toSet()); - - /** has no extended security permission set */ - private static final Set HAS_NO_EXTENDED_SECURITY = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 2)) - .collect(Collectors.toSet()); - - /** test data */ - private NodeRef nodeRef; - private NodeRef filePlan; - private String readGroupPrefix; - private String writeGroupPrefix; - - /** - * Before tests - */ - @SuppressWarnings("unchecked") - @Before public void before() - { - // initialise mocks - MockitoAnnotations.initMocks(this); - - // setup node - nodeRef = AlfMock.generateNodeRef(mockedNodeService); - - // setup file plan - filePlan = AlfMock.generateNodeRef(mockedNodeService); - when(mockedFilePlanService.getFilePlan(any(NodeRef.class))) - .thenReturn(filePlan); - - // set-up application context - when(mockedApplicationContext.getBean("dbNodeService")) - .thenReturn(mockedNodeService); - - // setup retrying transaction helper - Answer doInTransactionAnswer = new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RetryingTransactionCallback callback = (RetryingTransactionCallback)invocation.getArguments()[0]; - return callback.execute(); - } - }; - doAnswer(doInTransactionAnswer) - .when(mockedRetryingTransactionHelper) - .doInTransaction(any(RetryingTransactionCallback.class)); - when(mockedTransactionService.getRetryingTransactionHelper()) - .thenReturn(mockedRetryingTransactionHelper); - - // setup create authority - Answer createAuthorityAnswer = new Answer() - { - public String answer(InvocationOnMock invocation) throws Throwable - { - return PermissionService.GROUP_PREFIX + (String)invocation.getArguments()[1]; - } - - }; - when(mockedAuthorityService.createAuthority(any(AuthorityType.class), anyString(), anyString(), anySet())) - .thenAnswer(createAuthorityAnswer); - - // setup group prefixes - readGroupPrefix = extendedSecurityService.getIPRGroupPrefixShortName(READER_GROUP_PREFIX, READERS); - writeGroupPrefix = extendedSecurityService.getIPRGroupPrefixShortName(WRITER_GROUP_PREFIX, WRITERS); - - // make sure the users and groups exist - Stream - .of(USER, USER_W, GROUP, GROUP_W) - .forEach((a) -> - when(mockedAuthorityService.authorityExists(a)) - .thenReturn(true)); - } - - /** - * Given that the root authority does not exist - * When the application context is refreshed - * Then the root authority is created - */ - @Test public void rootAuthorityDoesNotExist() - { - // group doesn't exist - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + ExtendedSecurityServiceImpl.ROOT_IPR_GROUP)) - .thenReturn(false); - - // refresh context - extendedSecurityService.onApplicationEvent(mock(ContextRefreshedEvent.class)); - - // verify group is created - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, Collections.singleton(RMAuthority.ZONE_APP_RM)); - } - - /** - * Given that the root authority exists - * When the application context is refreshed - * Then nothing happens - */ - @Test public void rootAuthorityDoesExist() - { - // group doesn't exist - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + ROOT_IPR_GROUP)) - .thenReturn(true); - - // refresh context - extendedSecurityService.onApplicationEvent(mock(ContextRefreshedEvent.class)); - - // verify group is created - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, Collections.singleton(RMAuthority.ZONE_APP_RM)); - } - - /** - * Given that an IPR read group has read on a node - * And that an IPR write group has filling on a node - * When checking for the existence of extended permissions on that node - * Then it will be confirmed - */ - @Test public void hasExtendedSecurityWithReadAndWriteGroups() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_EXTENDED_SECURITY); - - // has extended security - assertTrue(extendedSecurityService.hasExtendedSecurity(nodeRef)); - } - - /** - * Given that there is no IPR read group has read on a node - * When checking for the existence of extended permissions on that node - * Then it will be denied - */ - @Test public void hasExtendedSecurityWithNoReadGroup() - { - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, GROUP_PREFIX + WRITER_GROUP_PREFIX, 2)) - .collect(Collectors.toSet()); - - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // has extended security - assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); - } - - /** - * Given that there is no IPR write group has read on a node - * When checking for the existence of extended permissions on that node - * Then it will be denied - */ - @Test public void hasExtendedSecurityWithNoWriteGroup() - { - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, GROUP_PREFIX + READER_GROUP_PREFIX, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 2)) - .collect(Collectors.toSet()); - - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // has extended security - assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); - } - - /** - * Given that an IPR read group has no groups assigned permission - * When checking for the existence of extended permissions on that node - * Then it will be denied - */ - @Test public void hasExtendedSecurityWithNoAssignedGroups() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_NO_EXTENDED_SECURITY); - - // has extended security - assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); - } - - /** - * Given that there are no IPR groups assigned - * When I try and get the extended readers - * The I will get an empty set - */ - @Test public void getExtendedReadersNoIPRGroupsAssigned() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_NO_EXTENDED_SECURITY); - - // get extended readers - assertTrue(extendedSecurityService.getReaders(nodeRef).isEmpty()); - } - - /** - * Given that there are IPR groups assigned - * When I try and get the extended readers - * The I will get the set of readers - */ - @Test public void getExtendedReaders() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_EXTENDED_SECURITY); - - when(mockedAuthorityService.getContainedAuthorities(null, READER_GROUP_FULL_PREFIX, true)) - .thenReturn(Stream - .of(USER, GROUP) - .collect(Collectors.toSet())); - - // get extended readers - Set extendedReaders = extendedSecurityService.getReaders(nodeRef); - assertEquals(Stream - .of(USER, GROUP) - .collect(Collectors.toSet()), - extendedReaders); - } - - /** - * Given that there are no IPR groups assigned - * When I try and get the extended writers - * The I will get an empty set - */ - @Test public void getExtendedWritersNoIPRGroupsAssigned() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_NO_EXTENDED_SECURITY); - - // get extended writers - assertTrue(extendedSecurityService.getWriters(nodeRef).isEmpty()); - } - - /** - * Given that there are IPR groups assigned - * When I try and get the extended writers - * The I will get the set of writers - */ - @Test public void getExtendedWriters() - { - // setup permissions - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_EXTENDED_SECURITY); - - when(mockedAuthorityService.getContainedAuthorities(null, WRITER_GROUP_FULL_PREFIX, true)) - .thenReturn(Stream - .of(USER, GROUP) - .collect(Collectors.toSet())); - - // get extended writers - Set extendedWriters = extendedSecurityService.getWriters(nodeRef); - assertEquals(Stream - .of(USER, GROUP) - .collect(Collectors.toSet()), - extendedWriters); - } - - /** - * Given a node with no previous IPR groups assigned - * And no IPR group matching authorities - * When I add some read and write authorities - * Then new IPR groups are created - * And they are assigned to the node - * And they are added to the RM roles - */ - @Test public void addExtendedSecurityForTheFirstTimeAndCreateGroups() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 0); - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(Collections.emptyList()); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - any(String.class), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // verify read group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService).addAuthority(readGroup, USER); - verify(mockedAuthorityService).addAuthority(readGroup, GROUP); - - // verify write group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); - verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - } - - /** - * Given a node with no previous IPR groups assigned - * And existing IPR groups matching - * When I add some read and write authorities - * Then the existing IPR groups are used - * And they are assigned to the node - * And do not not need to be re-added to the RM roles - */ - @Test public void addExtendedSecurityForTheFirstTimeAndReuseGroups() - { - // group names - String readGroup = readGroupPrefix + "0"; - String writeGroup = writeGroupPrefix + "0"; - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(readGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - when(mockedWritePagingResults.getPage()) - .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(writeGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedWritePagingResults); - - // setup exact match - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) - .thenReturn(true); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) - .thenReturn(Stream - .of(USER, GROUP) - .collect(Collectors.toSet())); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) - .thenReturn(Stream - .of(USER_W, GROUP_W) - .collect(Collectors.toSet())); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // verify read group is not recreated - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService, never()).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService, never()).addAuthority(readGroup, USER); - verify(mockedAuthorityService, never()).addAuthority(readGroup, GROUP); - - // verify write group is not recreated - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService, never()).addAuthority(readGroup, writeGroup); - verify(mockedAuthorityService, never()).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService, never()).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - - } - - /** - * Given a node with no previous IPR groups assigned - * And existing IPR groups matches existing has, but not exact match - * When I add some read and write authorities - * Then new groups are created - * And they are assigned to the node - * And added to the RM roles - */ - @Test public void addExtendedSecurityForTheFirstTimeAndCreateGroupsAfterClash() - { - // group names - String readGroup = readGroupPrefix + "0"; - String writeGroup = writeGroupPrefix + "0"; - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(readGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - when(mockedWritePagingResults.getPage()) - .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(writeGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedWritePagingResults); - - // setup exact match - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) - .thenReturn(true); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) - .thenReturn(Stream - .of(USER, GROUP, AlfMock.generateText()) - .collect(Collectors.toSet())); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) - .thenReturn(Stream - .of(USER_W, AlfMock.generateText()) - .collect(Collectors.toSet())); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // new group names - readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 1); - writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 1); - - // verify read group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService).addAuthority(readGroup, USER); - verify(mockedAuthorityService).addAuthority(readGroup, GROUP); - - // verify write group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); - verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - } - - /** - * Given a node with no previous IPR groups assigned - * And existing IPR groups matching, but found on second page of find results - * When I add some read and write authorities - * Then the existing IPR groups are used - * And they are assigned to the node - * And do not not need to be re-added to the RM roles - */ - @Test public void addExtendedSecurityWithResultPaging() - { - // group names - String readGroup = readGroupPrefix + "0"; - String writeGroup = writeGroupPrefix + "0"; - - // create fity results - List fiftyResults = new ArrayList(50); - for (int i = 0; i < 50; i++) - { - fiftyResults.add(AlfMock.generateText()); - } - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(fiftyResults) - .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(readGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - when(mockedWritePagingResults.getPage()) - .thenReturn(fiftyResults) - .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - eq(writeGroupPrefix), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedWritePagingResults); - - // setup exact match - when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) - .thenReturn(true); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) - .thenReturn(Stream - .of(USER, GROUP) - .collect(Collectors.toSet())); - when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) - .thenReturn(Stream - .of(USER_W, GROUP_W) - .collect(Collectors.toSet())); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // verify read group is not recreated - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService, never()).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService, never()).addAuthority(readGroup, USER); - verify(mockedAuthorityService, never()).addAuthority(readGroup, GROUP); - - // verify write group is not recreated - verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService, never()).addAuthority(readGroup, writeGroup); - verify(mockedAuthorityService, never()).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService, never()).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - - } - - /** - * Given that a node already has extended security - * When I add extended security - * Then the existing extended security is replaced with the new extended security - */ - @Test public void addExtendedSecurityToNodeWithExtendedSecurity() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); - - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) - .collect(Collectors.toSet()); - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // set revised reader and writers - String user = generateText(); - String group = generateText(); - String userW = generateText(); - String groupW = generateText(); - Set newReaders = Stream.of(user, group).collect(Collectors.toSet()); - Set newWriters = Stream.of(userW, groupW).collect(Collectors.toSet()); - - // new group names - String newReadGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, newReaders, 0); - String newWriteGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, newWriters, 0); - - // make sure users and groups exist - Stream - .of(user, group, userW, groupW) - .forEach((a) -> - when(mockedAuthorityService.authorityExists(a)) - .thenReturn(true)); - - // setup query results for no group matches - when(mockedReadPagingResults.getPage()) - .thenReturn(Collections.emptyList()); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - any(String.class), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - // set extended security - extendedSecurityService.set(nodeRef, newReaders, newWriters); - - // verify that the old permissions are cleared - verify(mockedPermissionService).clearPermission(nodeRef, readGroup); - verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); - - // verify read group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, newReadGroup, newReadGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - newReadGroup = GROUP_PREFIX + newReadGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, newReadGroup); - verify(mockedAuthorityService).addAuthority(newReadGroup, user); - verify(mockedAuthorityService).addAuthority(newReadGroup, group); - - // verify write group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, newWriteGroup, newWriteGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - newWriteGroup = GROUP_PREFIX + newWriteGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, newWriteGroup); - verify(mockedAuthorityService).addAuthority(newWriteGroup, userW); - verify(mockedAuthorityService).addAuthority(newWriteGroup, groupW); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, newReadGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, newWriteGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, newReadGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, newWriteGroup, RMPermissionModel.FILING, true); - - } - - /** - * Given that a node has renditions - * When I add extended security - * Then they are applied to the renditions - */ - @Test public void extendedSecurityAddedToRenditions() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 0); - - // setup query results - when(mockedReadPagingResults.getPage()) - .thenReturn(Collections.emptyList()); - when(mockedAuthorityService.getAuthorities( - eq(AuthorityType.GROUP), - eq(RMAuthority.ZONE_APP_RM), - any(String.class), - eq(false), - eq(false), - any(PagingRequest.class))) - .thenReturn(mockedReadPagingResults); - - // setup renditions - NodeRef renditionNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) - .thenReturn(true); - when(mockedChildAssociationRef.getChildRef()) - .thenReturn(renditionNodeRef); - when(mockedNodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL)) - .thenReturn(Collections.singletonList(mockedChildAssociationRef)); - - // add extended security - extendedSecurityService.set(nodeRef, READERS, WRITERS); - - // verify no old permissions needing to be cleared - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - - // verify read group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - readGroup = GROUP_PREFIX + readGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); - verify(mockedAuthorityService).addAuthority(readGroup, USER); - verify(mockedAuthorityService).addAuthority(readGroup, GROUP); - - // verify write group created correctly - verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); - writeGroup = GROUP_PREFIX + writeGroup; - verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); - verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); - verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); - - // verify groups assigned to RM roles - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); - verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); - - // verify permissions are assigned to node - verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); - - // verify permissions are assigned to the rendition - verify(mockedPermissionService).setPermission(renditionNodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); - verify(mockedPermissionService).setPermission(renditionNodeRef, writeGroup, RMPermissionModel.FILING, true); - } - - /** - * Given that a node has extended security - * When I remove the extended security - * Then the inplace groups permissions are removed - */ - @Test public void removeAllExtendedSecurity() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); - - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) - .collect(Collectors.toSet()); - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // remove extended security - extendedSecurityService.remove(nodeRef); - - // verify that the groups permissions have been removed - verify(mockedPermissionService).clearPermission(nodeRef, readGroup); - verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); - } - - /** - * Given that a node has no extended security - * When I remove the extended security - * Then nothing happens - */ - @Test public void noExtendedSecurityToRemove() - { - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(HAS_NO_EXTENDED_SECURITY); - - // remove extended security - extendedSecurityService.remove(nodeRef); - - // verify that the groups permissions have been removed - verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); - } - - /** - * Given that node has renditions - * When I remove the extended security for a node - * Then the extended security is also removed from the renditions - */ - @Test public void removeExtendedSecurityFromRenditions() - { - // group names - String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); - String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); - - // setup renditions - NodeRef renditionNodeRef = AlfMock.generateNodeRef(mockedNodeService); - when(mockedNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) - .thenReturn(true); - when(mockedChildAssociationRef.getChildRef()) - .thenReturn(renditionNodeRef); - when(mockedNodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL)) - .thenReturn(Collections.singletonList(mockedChildAssociationRef)); - - // setup permissions - Set permissions = Stream - .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), - new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) - .collect(Collectors.toSet()); - when(mockedPermissionService.getAllSetPermissions(nodeRef)) - .thenReturn(permissions); - - // remove extended security - extendedSecurityService.remove(nodeRef); - - // verify that the groups permissions have been removed - verify(mockedPermissionService).clearPermission(nodeRef, readGroup); - verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); - - // verify that the groups permissions have been removed from the rendition - verify(mockedPermissionService).clearPermission(renditionNodeRef, readGroup); - verify(mockedPermissionService).clearPermission(renditionNodeRef, writeGroup); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.READER_GROUP_PREFIX; +import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.ROOT_IPR_GROUP; +import static org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityServiceImpl.WRITER_GROUP_PREFIX; +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; +import static org.alfresco.service.cmr.security.PermissionService.GROUP_PREFIX; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anySet; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.alfresco.model.RenditionModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; +import org.alfresco.query.PagingRequest; +import org.alfresco.query.PagingResults; +import org.alfresco.repo.security.authority.RMAuthority; +import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.AccessPermission; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.AuthorityType; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.service.transaction.TransactionService; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.springframework.context.ApplicationContext; +import org.springframework.context.event.ContextRefreshedEvent; + +/** + * Extended security service implementation unit test. + * + * @author Roy Wetherall + * @since 2.5 + */ +public class ExtendedSecurityServiceImplUnitTest +{ + /** service mocks*/ + @Mock private FilePlanService mockedFilePlanService; + @Mock private FilePlanRoleService mockedFilePlanRoleService; + @Mock private AuthorityService mockedAuthorityService; + @Mock private PermissionService mockedPermissionService; + @Mock private TransactionService mockedTransactionService; + @Mock private RetryingTransactionHelper mockedRetryingTransactionHelper; + @Mock private NodeService mockedNodeService; + @Mock private PagingResults mockedReadPagingResults; + @Mock private PagingResults mockedWritePagingResults; + @Mock private ApplicationContext mockedApplicationContext; + @Mock private ChildAssociationRef mockedChildAssociationRef; + + /** test component */ + @InjectMocks private ExtendedSecurityServiceImpl extendedSecurityService; + + /** read/write group full names */ + private static final String READER_GROUP_FULL_PREFIX = GROUP_PREFIX + READER_GROUP_PREFIX; + private static final String WRITER_GROUP_FULL_PREFIX = GROUP_PREFIX + WRITER_GROUP_PREFIX; + + /** test authorities */ + private static final String USER = "USER"; + private static final String GROUP = GROUP_PREFIX + "GROUP"; + private static final String USER_W = "USER_W"; + private static final String GROUP_W = GROUP_PREFIX + "GROUP_W"; + private static final Set READERS = Stream.of(USER, GROUP).collect(Collectors.toSet()); + private static final Set WRITERS = Stream.of(USER_W, GROUP_W).collect(Collectors.toSet()); + + /** has extended security permission set */ + private static final Set HAS_EXTENDED_SECURITY = Stream + .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, READER_GROUP_FULL_PREFIX, 0), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, WRITER_GROUP_FULL_PREFIX, 2)) + .collect(Collectors.toSet()); + + /** has no extended security permission set */ + private static final Set HAS_NO_EXTENDED_SECURITY = Stream + .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 0), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 2)) + .collect(Collectors.toSet()); + + /** test data */ + private NodeRef nodeRef; + private NodeRef filePlan; + private String readGroupPrefix; + private String writeGroupPrefix; + + /** + * Before tests + */ + @SuppressWarnings("unchecked") + @Before public void before() + { + // initialise mocks + MockitoAnnotations.initMocks(this); + + // setup node + nodeRef = AlfMock.generateNodeRef(mockedNodeService); + + // setup file plan + filePlan = AlfMock.generateNodeRef(mockedNodeService); + when(mockedFilePlanService.getFilePlan(any(NodeRef.class))) + .thenReturn(filePlan); + + // set-up application context + when(mockedApplicationContext.getBean("dbNodeService")) + .thenReturn(mockedNodeService); + + // setup retrying transaction helper + Answer doInTransactionAnswer = new Answer() + { + @SuppressWarnings("rawtypes") + @Override + public Object answer(InvocationOnMock invocation) throws Throwable + { + RetryingTransactionCallback callback = (RetryingTransactionCallback)invocation.getArguments()[0]; + return callback.execute(); + } + }; + doAnswer(doInTransactionAnswer) + .when(mockedRetryingTransactionHelper) + .doInTransaction(any(RetryingTransactionCallback.class)); + when(mockedTransactionService.getRetryingTransactionHelper()) + .thenReturn(mockedRetryingTransactionHelper); + + // setup create authority + Answer createAuthorityAnswer = new Answer() + { + public String answer(InvocationOnMock invocation) throws Throwable + { + return PermissionService.GROUP_PREFIX + (String)invocation.getArguments()[1]; + } + + }; + when(mockedAuthorityService.createAuthority(any(AuthorityType.class), anyString(), anyString(), anySet())) + .thenAnswer(createAuthorityAnswer); + + // setup group prefixes + readGroupPrefix = extendedSecurityService.getIPRGroupPrefixShortName(READER_GROUP_PREFIX, READERS); + writeGroupPrefix = extendedSecurityService.getIPRGroupPrefixShortName(WRITER_GROUP_PREFIX, WRITERS); + + // make sure the users and groups exist + Stream + .of(USER, USER_W, GROUP, GROUP_W) + .forEach((a) -> + when(mockedAuthorityService.authorityExists(a)) + .thenReturn(true)); + } + + /** + * Given that the root authority does not exist + * When the application context is refreshed + * Then the root authority is created + */ + @Test public void rootAuthorityDoesNotExist() + { + // group doesn't exist + when(mockedAuthorityService.authorityExists(GROUP_PREFIX + ExtendedSecurityServiceImpl.ROOT_IPR_GROUP)) + .thenReturn(false); + + // refresh context + extendedSecurityService.onApplicationEvent(mock(ContextRefreshedEvent.class)); + + // verify group is created + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, Collections.singleton(RMAuthority.ZONE_APP_RM)); + } + + /** + * Given that the root authority exists + * When the application context is refreshed + * Then nothing happens + */ + @Test public void rootAuthorityDoesExist() + { + // group doesn't exist + when(mockedAuthorityService.authorityExists(GROUP_PREFIX + ROOT_IPR_GROUP)) + .thenReturn(true); + + // refresh context + extendedSecurityService.onApplicationEvent(mock(ContextRefreshedEvent.class)); + + // verify group is created + verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, ROOT_IPR_GROUP, ROOT_IPR_GROUP, Collections.singleton(RMAuthority.ZONE_APP_RM)); + } + + /** + * Given that an IPR read group has read on a node + * And that an IPR write group has filling on a node + * When checking for the existence of extended permissions on that node + * Then it will be confirmed + */ + @Test public void hasExtendedSecurityWithReadAndWriteGroups() + { + // setup permissions + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(HAS_EXTENDED_SECURITY); + + // has extended security + assertTrue(extendedSecurityService.hasExtendedSecurity(nodeRef)); + } + + /** + * Given that there is no IPR read group has read on a node + * When checking for the existence of extended permissions on that node + * Then it will be denied + */ + @Test public void hasExtendedSecurityWithNoReadGroup() + { + // setup permissions + Set permissions = Stream + .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 0), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, GROUP_PREFIX + WRITER_GROUP_PREFIX, 2)) + .collect(Collectors.toSet()); + + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(permissions); + + // has extended security + assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); + } + + /** + * Given that there is no IPR write group has read on a node + * When checking for the existence of extended permissions on that node + * Then it will be denied + */ + @Test public void hasExtendedSecurityWithNoWriteGroup() + { + // setup permissions + Set permissions = Stream + .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, GROUP_PREFIX + READER_GROUP_PREFIX, 0), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 2)) + .collect(Collectors.toSet()); + + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(permissions); + + // has extended security + assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); + } + + /** + * Given that an IPR read group has no groups assigned permission + * When checking for the existence of extended permissions on that node + * Then it will be denied + */ + @Test public void hasExtendedSecurityWithNoAssignedGroups() + { + // setup permissions + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(HAS_NO_EXTENDED_SECURITY); + + // has extended security + assertFalse(extendedSecurityService.hasExtendedSecurity(nodeRef)); + } + + /** + * Given that there are no IPR groups assigned + * When I try and get the extended readers + * The I will get an empty set + */ + @Test public void getExtendedReadersNoIPRGroupsAssigned() + { + // setup permissions + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(HAS_NO_EXTENDED_SECURITY); + + // get extended readers + assertTrue(extendedSecurityService.getReaders(nodeRef).isEmpty()); + } + + /** + * Given that there are IPR groups assigned + * When I try and get the extended readers + * The I will get the set of readers + */ + @Test public void getExtendedReaders() + { + // setup permissions + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(HAS_EXTENDED_SECURITY); + + when(mockedAuthorityService.getContainedAuthorities(null, READER_GROUP_FULL_PREFIX, true)) + .thenReturn(Stream + .of(USER, GROUP) + .collect(Collectors.toSet())); + + // get extended readers + Set extendedReaders = extendedSecurityService.getReaders(nodeRef); + assertEquals(Stream + .of(USER, GROUP) + .collect(Collectors.toSet()), + extendedReaders); + } + + /** + * Given that there are no IPR groups assigned + * When I try and get the extended writers + * The I will get an empty set + */ + @Test public void getExtendedWritersNoIPRGroupsAssigned() + { + // setup permissions + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(HAS_NO_EXTENDED_SECURITY); + + // get extended writers + assertTrue(extendedSecurityService.getWriters(nodeRef).isEmpty()); + } + + /** + * Given that there are IPR groups assigned + * When I try and get the extended writers + * The I will get the set of writers + */ + @Test public void getExtendedWriters() + { + // setup permissions + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(HAS_EXTENDED_SECURITY); + + when(mockedAuthorityService.getContainedAuthorities(null, WRITER_GROUP_FULL_PREFIX, true)) + .thenReturn(Stream + .of(USER, GROUP) + .collect(Collectors.toSet())); + + // get extended writers + Set extendedWriters = extendedSecurityService.getWriters(nodeRef); + assertEquals(Stream + .of(USER, GROUP) + .collect(Collectors.toSet()), + extendedWriters); + } + + /** + * Given a node with no previous IPR groups assigned + * And no IPR group matching authorities + * When I add some read and write authorities + * Then new IPR groups are created + * And they are assigned to the node + * And they are added to the RM roles + */ + @Test public void addExtendedSecurityForTheFirstTimeAndCreateGroups() + { + // group names + String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 0); + String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 0); + + // setup query results + when(mockedReadPagingResults.getPage()) + .thenReturn(Collections.emptyList()); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + any(String.class), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedReadPagingResults); + + // add extended security + extendedSecurityService.set(nodeRef, READERS, WRITERS); + + // verify no old permissions needing to be cleared + verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); + + // verify read group created correctly + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + readGroup = GROUP_PREFIX + readGroup; + verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); + verify(mockedAuthorityService).addAuthority(readGroup, USER); + verify(mockedAuthorityService).addAuthority(readGroup, GROUP); + + // verify write group created correctly + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + writeGroup = GROUP_PREFIX + writeGroup; + verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); + verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); + verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); + + // verify groups assigned to RM roles + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); + + // verify permissions are assigned to node + verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); + verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); + } + + /** + * Given a node with no previous IPR groups assigned + * And existing IPR groups matching + * When I add some read and write authorities + * Then the existing IPR groups are used + * And they are assigned to the node + * And do not not need to be re-added to the RM roles + */ + @Test public void addExtendedSecurityForTheFirstTimeAndReuseGroups() + { + // group names + String readGroup = readGroupPrefix + "0"; + String writeGroup = writeGroupPrefix + "0"; + + // setup query results + when(mockedReadPagingResults.getPage()) + .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + eq(readGroupPrefix), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedReadPagingResults); + + when(mockedWritePagingResults.getPage()) + .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + eq(writeGroupPrefix), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedWritePagingResults); + + // setup exact match + when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) + .thenReturn(true); + when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) + .thenReturn(Stream + .of(USER, GROUP) + .collect(Collectors.toSet())); + when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) + .thenReturn(Stream + .of(USER_W, GROUP_W) + .collect(Collectors.toSet())); + + // add extended security + extendedSecurityService.set(nodeRef, READERS, WRITERS); + + // verify no old permissions needing to be cleared + verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); + + // verify read group is not recreated + verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + readGroup = GROUP_PREFIX + readGroup; + verify(mockedAuthorityService, never()).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); + verify(mockedAuthorityService, never()).addAuthority(readGroup, USER); + verify(mockedAuthorityService, never()).addAuthority(readGroup, GROUP); + + // verify write group is not recreated + verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + writeGroup = GROUP_PREFIX + writeGroup; + verify(mockedAuthorityService, never()).addAuthority(readGroup, writeGroup); + verify(mockedAuthorityService, never()).addAuthority(writeGroup, USER_W); + verify(mockedAuthorityService, never()).addAuthority(writeGroup, GROUP_W); + + // verify groups assigned to RM roles + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); + + // verify permissions are assigned to node + verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); + verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); + + } + + /** + * Given a node with no previous IPR groups assigned + * And existing IPR groups matches existing has, but not exact match + * When I add some read and write authorities + * Then new groups are created + * And they are assigned to the node + * And added to the RM roles + */ + @Test public void addExtendedSecurityForTheFirstTimeAndCreateGroupsAfterClash() + { + // group names + String readGroup = readGroupPrefix + "0"; + String writeGroup = writeGroupPrefix + "0"; + + // setup query results + when(mockedReadPagingResults.getPage()) + .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + eq(readGroupPrefix), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedReadPagingResults); + + when(mockedWritePagingResults.getPage()) + .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + eq(writeGroupPrefix), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedWritePagingResults); + + // setup exact match + when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) + .thenReturn(true); + when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) + .thenReturn(Stream + .of(USER, GROUP, AlfMock.generateText()) + .collect(Collectors.toSet())); + when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) + .thenReturn(Stream + .of(USER_W, AlfMock.generateText()) + .collect(Collectors.toSet())); + + // add extended security + extendedSecurityService.set(nodeRef, READERS, WRITERS); + + // verify no old permissions needing to be cleared + verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); + + // new group names + readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 1); + writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 1); + + // verify read group created correctly + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + readGroup = GROUP_PREFIX + readGroup; + verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); + verify(mockedAuthorityService).addAuthority(readGroup, USER); + verify(mockedAuthorityService).addAuthority(readGroup, GROUP); + + // verify write group created correctly + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + writeGroup = GROUP_PREFIX + writeGroup; + verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); + verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); + verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); + + // verify groups assigned to RM roles + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); + + // verify permissions are assigned to node + verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); + verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); + } + + /** + * Given a node with no previous IPR groups assigned + * And existing IPR groups matching, but found on second page of find results + * When I add some read and write authorities + * Then the existing IPR groups are used + * And they are assigned to the node + * And do not not need to be re-added to the RM roles + */ + @Test public void addExtendedSecurityWithResultPaging() + { + // group names + String readGroup = readGroupPrefix + "0"; + String writeGroup = writeGroupPrefix + "0"; + + // create fity results + List fiftyResults = new ArrayList(50); + for (int i = 0; i < 50; i++) + { + fiftyResults.add(AlfMock.generateText()); + } + + // setup query results + when(mockedReadPagingResults.getPage()) + .thenReturn(fiftyResults) + .thenReturn(Stream.of(GROUP_PREFIX + readGroup).collect(Collectors.toList())); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + eq(readGroupPrefix), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedReadPagingResults); + + when(mockedWritePagingResults.getPage()) + .thenReturn(fiftyResults) + .thenReturn(Stream.of(GROUP_PREFIX + writeGroup).collect(Collectors.toList())); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + eq(writeGroupPrefix), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedWritePagingResults); + + // setup exact match + when(mockedAuthorityService.authorityExists(GROUP_PREFIX + writeGroup)) + .thenReturn(true); + when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + readGroup, true)) + .thenReturn(Stream + .of(USER, GROUP) + .collect(Collectors.toSet())); + when(mockedAuthorityService.getContainedAuthorities(null, GROUP_PREFIX + writeGroup, true)) + .thenReturn(Stream + .of(USER_W, GROUP_W) + .collect(Collectors.toSet())); + + // add extended security + extendedSecurityService.set(nodeRef, READERS, WRITERS); + + // verify no old permissions needing to be cleared + verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); + + // verify read group is not recreated + verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + readGroup = GROUP_PREFIX + readGroup; + verify(mockedAuthorityService, never()).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); + verify(mockedAuthorityService, never()).addAuthority(readGroup, USER); + verify(mockedAuthorityService, never()).addAuthority(readGroup, GROUP); + + // verify write group is not recreated + verify(mockedAuthorityService, never()).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + writeGroup = GROUP_PREFIX + writeGroup; + verify(mockedAuthorityService, never()).addAuthority(readGroup, writeGroup); + verify(mockedAuthorityService, never()).addAuthority(writeGroup, USER_W); + verify(mockedAuthorityService, never()).addAuthority(writeGroup, GROUP_W); + + // verify groups assigned to RM roles + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); + + // verify permissions are assigned to node + verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); + verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); + + } + + /** + * Given that a node already has extended security + * When I add extended security + * Then the existing extended security is replaced with the new extended security + */ + @Test public void addExtendedSecurityToNodeWithExtendedSecurity() + { + // group names + String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); + String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); + + // setup permissions + Set permissions = Stream + .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) + .collect(Collectors.toSet()); + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(permissions); + + // set revised reader and writers + String user = generateText(); + String group = generateText(); + String userW = generateText(); + String groupW = generateText(); + Set newReaders = Stream.of(user, group).collect(Collectors.toSet()); + Set newWriters = Stream.of(userW, groupW).collect(Collectors.toSet()); + + // new group names + String newReadGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, newReaders, 0); + String newWriteGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, newWriters, 0); + + // make sure users and groups exist + Stream + .of(user, group, userW, groupW) + .forEach((a) -> + when(mockedAuthorityService.authorityExists(a)) + .thenReturn(true)); + + // setup query results for no group matches + when(mockedReadPagingResults.getPage()) + .thenReturn(Collections.emptyList()); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + any(String.class), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedReadPagingResults); + + // set extended security + extendedSecurityService.set(nodeRef, newReaders, newWriters); + + // verify that the old permissions are cleared + verify(mockedPermissionService).clearPermission(nodeRef, readGroup); + verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); + + // verify read group created correctly + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, newReadGroup, newReadGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + newReadGroup = GROUP_PREFIX + newReadGroup; + verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, newReadGroup); + verify(mockedAuthorityService).addAuthority(newReadGroup, user); + verify(mockedAuthorityService).addAuthority(newReadGroup, group); + + // verify write group created correctly + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, newWriteGroup, newWriteGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + newWriteGroup = GROUP_PREFIX + newWriteGroup; + verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, newWriteGroup); + verify(mockedAuthorityService).addAuthority(newWriteGroup, userW); + verify(mockedAuthorityService).addAuthority(newWriteGroup, groupW); + + // verify groups assigned to RM roles + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, newReadGroup); + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, newWriteGroup); + + // verify permissions are assigned to node + verify(mockedPermissionService).setPermission(nodeRef, newReadGroup, RMPermissionModel.READ_RECORDS, true); + verify(mockedPermissionService).setPermission(nodeRef, newWriteGroup, RMPermissionModel.FILING, true); + + } + + /** + * Given that a node has renditions + * When I add extended security + * Then they are applied to the renditions + */ + @Test public void extendedSecurityAddedToRenditions() + { + // group names + String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_PREFIX, READERS, 0); + String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_PREFIX, WRITERS, 0); + + // setup query results + when(mockedReadPagingResults.getPage()) + .thenReturn(Collections.emptyList()); + when(mockedAuthorityService.getAuthorities( + eq(AuthorityType.GROUP), + eq(RMAuthority.ZONE_APP_RM), + any(String.class), + eq(false), + eq(false), + any(PagingRequest.class))) + .thenReturn(mockedReadPagingResults); + + // setup renditions + NodeRef renditionNodeRef = AlfMock.generateNodeRef(mockedNodeService); + when(mockedNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) + .thenReturn(true); + when(mockedChildAssociationRef.getChildRef()) + .thenReturn(renditionNodeRef); + when(mockedNodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL)) + .thenReturn(Collections.singletonList(mockedChildAssociationRef)); + + // add extended security + extendedSecurityService.set(nodeRef, READERS, WRITERS); + + // verify no old permissions needing to be cleared + verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); + + // verify read group created correctly + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, readGroup, readGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + readGroup = GROUP_PREFIX + readGroup; + verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, readGroup); + verify(mockedAuthorityService).addAuthority(readGroup, USER); + verify(mockedAuthorityService).addAuthority(readGroup, GROUP); + + // verify write group created correctly + verify(mockedAuthorityService).createAuthority(AuthorityType.GROUP, writeGroup, writeGroup, Collections.singleton(RMAuthority.ZONE_APP_RM)); + writeGroup = GROUP_PREFIX + writeGroup; + verify(mockedAuthorityService).addAuthority(GROUP_PREFIX + ROOT_IPR_GROUP, writeGroup); + verify(mockedAuthorityService).addAuthority(writeGroup, USER_W); + verify(mockedAuthorityService).addAuthority(writeGroup, GROUP_W); + + // verify groups assigned to RM roles + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_READERS, readGroup); + verify(mockedFilePlanRoleService).assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS, writeGroup); + + // verify permissions are assigned to node + verify(mockedPermissionService).setPermission(nodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); + verify(mockedPermissionService).setPermission(nodeRef, writeGroup, RMPermissionModel.FILING, true); + + // verify permissions are assigned to the rendition + verify(mockedPermissionService).setPermission(renditionNodeRef, readGroup, RMPermissionModel.READ_RECORDS, true); + verify(mockedPermissionService).setPermission(renditionNodeRef, writeGroup, RMPermissionModel.FILING, true); + } + + /** + * Given that a node has extended security + * When I remove the extended security + * Then the inplace groups permissions are removed + */ + @Test public void removeAllExtendedSecurity() + { + // group names + String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); + String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); + + // setup permissions + Set permissions = Stream + .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) + .collect(Collectors.toSet()); + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(permissions); + + // remove extended security + extendedSecurityService.remove(nodeRef); + + // verify that the groups permissions have been removed + verify(mockedPermissionService).clearPermission(nodeRef, readGroup); + verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); + } + + /** + * Given that a node has no extended security + * When I remove the extended security + * Then nothing happens + */ + @Test public void noExtendedSecurityToRemove() + { + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(HAS_NO_EXTENDED_SECURITY); + + // remove extended security + extendedSecurityService.remove(nodeRef); + + // verify that the groups permissions have been removed + verify(mockedPermissionService, never()).clearPermission(eq(nodeRef), anyString()); + } + + /** + * Given that node has renditions + * When I remove the extended security for a node + * Then the extended security is also removed from the renditions + */ + @Test public void removeExtendedSecurityFromRenditions() + { + // group names + String readGroup = extendedSecurityService.getIPRGroupShortName(READER_GROUP_FULL_PREFIX, READERS, 0); + String writeGroup = extendedSecurityService.getIPRGroupShortName(WRITER_GROUP_FULL_PREFIX, WRITERS, 0); + + // setup renditions + NodeRef renditionNodeRef = AlfMock.generateNodeRef(mockedNodeService); + when(mockedNodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD)) + .thenReturn(true); + when(mockedChildAssociationRef.getChildRef()) + .thenReturn(renditionNodeRef); + when(mockedNodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL)) + .thenReturn(Collections.singletonList(mockedChildAssociationRef)); + + // setup permissions + Set permissions = Stream + .of(new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, readGroup, 0), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, AlfMock.generateText(), 1), + new AccessPermissionImpl(AlfMock.generateText(), AccessStatus.ALLOWED, writeGroup, 2)) + .collect(Collectors.toSet()); + when(mockedPermissionService.getAllSetPermissions(nodeRef)) + .thenReturn(permissions); + + // remove extended security + extendedSecurityService.remove(nodeRef); + + // verify that the groups permissions have been removed + verify(mockedPermissionService).clearPermission(nodeRef, readGroup); + verify(mockedPermissionService).clearPermission(nodeRef, writeGroup); + + // verify that the groups permissions have been removed from the rendition + verify(mockedPermissionService).clearPermission(renditionNodeRef, readGroup); + verify(mockedPermissionService).clearPermission(renditionNodeRef, writeGroup); + + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java index cdcab4f4a4..5823c9b004 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java @@ -1,449 +1,449 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.security; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessPermission; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Spy; -import org.mockito.verification.VerificationMode; - -/** - * File plan permission service implementation unit test. - *

- * Primarily tests the file plan permission service interaction with the - * permission service. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class FilePlanPermissionServiceImplUnitTest extends BaseUnitTest -{ - /** test authority */ - protected static final String AUTHORITY = "anAuthority"; - protected static final String AUTHORITY2 = "anOtherAuthority"; - - /** fileplan nodes */ - protected NodeRef rootRecordCategory; - protected NodeRef recordCategory; - protected NodeRef newRecordFolder; - protected NodeRef newRecord; - - /** unfiled nodes */ - protected NodeRef unfiledRecordContainer; - protected NodeRef unfiledRecordFolder; - protected NodeRef unfiledRecordFolderChild; - protected NodeRef unfiledRecord; - - /** held nodes */ - protected NodeRef holdContainer; - protected NodeRef hold; - protected NodeRef heldRecord; - - /** file plan permission service implementation */ - @Spy @InjectMocks FilePlanPermissionServiceImpl filePlanPermissionService; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - public void before() throws Exception - { - super.before(); - - // initialize node's - unfiledRecordContainer = generateContainerNodeRef(TYPE_UNFILED_RECORD_CONTAINER); - unfiledRecordFolder = generateContainerNodeRef(TYPE_UNFILED_RECORD_FOLDER); - unfiledRecordFolderChild = generateContainerNodeRef(TYPE_UNFILED_RECORD_FOLDER); - unfiledRecord = generateRecord(); - holdContainer = generateContainerNodeRef(TYPE_HOLD_CONTAINER); - hold = generateHoldNodeRef("my test hold"); - heldRecord = generateRecord(); - rootRecordCategory = generateContainerNodeRef(TYPE_RECORD_CATEGORY); - recordCategory = generateContainerNodeRef(TYPE_RECORD_CATEGORY); - newRecordFolder = generateRecordFolder(); - newRecord = generateRecord(); - - // setup parent hierarchy - makePrimaryParentOf(filePlan, generateNodeRef(ContentModel.TYPE_FOLDER)); - - makePrimaryParentOf(rootRecordCategory, filePlan); - makePrimaryParentOf(recordCategory, rootRecordCategory); - makePrimaryParentOf(newRecordFolder, recordCategory); - makePrimaryParentOf(newRecord, newRecordFolder); - - makePrimaryParentOf(unfiledRecordFolder, unfiledRecordContainer); - makePrimaryParentOf(unfiledRecordContainer, filePlan); - - makePrimaryParentOf(hold, holdContainer); - makePrimaryParentOf(holdContainer, filePlan); - - - // setup child hierarchy - makeChildrenOf(filePlan, rootRecordCategory); - makeChildrenOf(rootRecordCategory, recordCategory); - makeChildrenOf(recordCategory, newRecordFolder); - makeChildrenOf(newRecordFolder, newRecord); - - makeChildrenOf(unfiledRecordFolder, unfiledRecordFolderChild); - makeChildrenOf(unfiledRecordFolderChild, unfiledRecord); - - makeChildrenOf(holdContainer, hold); - makeChildrenOf(hold, heldRecord); - - doReturn(FilePlanComponentKind.FILE_PLAN).when(filePlanPermissionService).getFilePlanComponentKind(filePlan); - doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(filePlanPermissionService).getFilePlanComponentKind(rootRecordCategory); - doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(filePlanPermissionService).getFilePlanComponentKind(recordCategory); - doReturn(FilePlanComponentKind.RECORD_FOLDER).when(filePlanPermissionService).getFilePlanComponentKind(newRecordFolder); - doReturn(FilePlanComponentKind.RECORD).when(filePlanPermissionService).getFilePlanComponentKind(newRecord); - doReturn(FilePlanComponentKind.UNFILED_RECORD_FOLDER).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecordFolder); - doReturn(FilePlanComponentKind.UNFILED_RECORD_CONTAINER).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecordContainer); - doReturn(FilePlanComponentKind.RECORD).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecord); - doReturn(FilePlanComponentKind.HOLD_CONTAINER).when(filePlanPermissionService).getFilePlanComponentKind(holdContainer); - doReturn(FilePlanComponentKind.HOLD).when(filePlanPermissionService).getFilePlanComponentKind(hold); - } - - /** - * Helper method to generate a container node ref of a perticular type. - * - * @param type type of node reference - * @return {@link NodeRef} node reference that behaves like a container of the type given. - */ - private NodeRef generateContainerNodeRef(QName type) - { - NodeRef nodeRef = generateNodeRef(type); - setupAsFilePlanComponent(nodeRef); - doReturn(true).when(filePlanPermissionService).isFilePlanContainer(nodeRef); - return nodeRef; - } - - /** - * Set read permission on unfiled record folder. - */ - @Test - public void setReadPermissionOnUnfiledRecordFolder() - { - // set read permission on unfiled record folder - filePlanPermissionService.setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS, true); - } - - /** - * Set filling permission on unfiled record folder - */ - @Test - public void setReadAndFilePermissionOnUnfileRecordFolder() - { - // set read permission on unfiled record folder - filePlanPermissionService.setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.FILING); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.FILING, true); - } - - /** - * Remove permission from unfiled record folders. - */ - @Test - public void deletePermissionFromUnfiledRecordFolder() - { - // delete read permission from unfiled record folder - filePlanPermissionService.deletePermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); - - // verify permission deleted on target node - verify(mockedPermissionService, times(1)).deletePermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); - } - - /** - * Set read permission on hold container - */ - @Test - public void setReadPermissionOnHoldContainer() - { - // set read permission on hold - filePlanPermissionService.setPermission(holdContainer, AUTHORITY, RMPermissionModel.READ_RECORDS); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(holdContainer, AUTHORITY, RMPermissionModel.READ_RECORDS, true); - } - - /** - * Set filing permission on hold container - */ - @Test - public void setFilingPermissionOnHoldContainer() - { - // set read permission on hold - filePlanPermissionService.setPermission(holdContainer, AUTHORITY, RMPermissionModel.FILING); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(holdContainer, AUTHORITY, RMPermissionModel.FILING, true); - } - - /** - * Set read permission on hold. - */ - @Test - public void setReadPermissionOnHold() - { - // set read permission on hold - filePlanPermissionService.setPermission(hold, AUTHORITY, RMPermissionModel.READ_RECORDS); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(hold, AUTHORITY, RMPermissionModel.READ_RECORDS, true); - } - - /** - * Set filing permission on hold. - */ - @Test - public void setFilingPermissionOnHold() - { - // set filing permission on hold - filePlanPermissionService.setPermission(hold, AUTHORITY, RMPermissionModel.FILING); - - // verify permission set on target node - verify(mockedPermissionService, times(1)).setPermission(hold, AUTHORITY, RMPermissionModel.FILING, true); - } - - /** - * Helper method to setup permissions on mock objects - */ - private void setupPermissions(NodeRef nodeRef) - { - Set perms = new HashSet(4); - - // setup basic file and read for authorities - perms.add(new AccessPermissionImpl(RMPermissionModel.READ_RECORDS, AccessStatus.ALLOWED, AUTHORITY, 0)); - perms.add(new AccessPermissionImpl(RMPermissionModel.FILING, AccessStatus.ALLOWED, AUTHORITY2, 1)); - - doReturn(perms).when(mockedPermissionService).getAllSetPermissions(nodeRef); - } - - /** - * Helper to verify the core permissions have been initialized correctly - */ - private void verifyInitPermissions(NodeRef nodeRef, boolean isInherited) - { - verify(mockedPermissionService).getAllSetPermissions(nodeRef); - verify(mockedPermissionService).setInheritParentPermissions(nodeRef, isInherited); - verify(mockedPermissionService).clearPermission(nodeRef, null); - verify(mockedOwnableService).setOwner(nodeRef, OwnableService.NO_OWNER); - } - - /** - * Helper to verify that permissions have been set correctly on the child - * - * @param parent parent node - * @param child child node - * @param read verification mode relating to setting read on the child - * @param filling verification mode relating to setting filling on the child - */ - private void verifyInitPermissions(NodeRef parent, NodeRef child, VerificationMode read, VerificationMode filling, boolean isParentFilePlan, boolean isInherited) - { - // verify the core permissions are set-up correctly - verifyInitPermissions(child, isInherited); - - if (isParentFilePlan) - { - // verify the permissions came from the correct parent - verify(mockedPermissionService).getAllSetPermissions(parent); - - // verify all the inherited permissions are set correctly (note read are not inherited from fileplan) - verify(mockedPermissionService, filling).setPermission(child, AUTHORITY2, RMPermissionModel.FILING, true); - verify(mockedPermissionService, read).setPermission(child, AUTHORITY, RMPermissionModel.READ_RECORDS, true); - } - } - - /** - * Test the initialisation of permissions for a new root category - */ - @Test - public void initPermissionsForNewRootRecordCategory() - { - // setup permissions for file plan - setupPermissions(filePlan); - - // setup permissions - filePlanPermissionService.setupRecordCategoryPermissions(rootRecordCategory); - - // verify permission init - verifyInitPermissions(filePlan, rootRecordCategory, never(), times(1), true, false); - } - - /** - * Test the initialisation of permissions for a new category - */ - @Test - public void initPermissionsForNewRecordCategory() - { - // setup permissions for parent - setupPermissions(rootRecordCategory); - - // setup permissions - filePlanPermissionService.setupRecordCategoryPermissions(recordCategory); - - // verify permission init - verifyInitPermissions(rootRecordCategory, recordCategory, times(1), times(1), false, true); - } - - /** - * Test initialisation new record folder permissions - */ - @Test - public void initPermissionsForNewRecordFolder() - { - // setup permissions for parent - setupPermissions(recordCategory); - - // setup permissions - filePlanPermissionService.setupPermissions(recordCategory, newRecordFolder); - - // verify permission init - verifyInitPermissions(recordCategory, newRecordFolder, times(1), times(1), false, true); - - } - - /** - * Test setup of new record permissions - */ - @Test - public void initPermissionsForNewRecord() - { - // setup permissions for parent - setupPermissions(newRecordFolder); - - // setup permissions for record - filePlanPermissionService.setupPermissions(newRecordFolder, newRecord); - - // verify permission init - verifyInitPermissions(newRecordFolder, newRecord, times(1), times(1), false, true); - } - - /** - * Test setup of permissions for new hold container - */ - @Test - public void initPermnissionsForNewHoldContainer() - { - // setup permissions for parent - setupPermissions(filePlan); - - // setup permissions for record - filePlanPermissionService.setupPermissions(filePlan, holdContainer); - - // verify permissions are set-up correctly - verifyInitPermissions(filePlan, holdContainer, times(1), times(1), false, true); - } - - /** - * Test setup of permissions for new hold - */ - @Test - public void initPermissionsForNewHold() - { - // setup permissions for parent - setupPermissions(holdContainer); - - // setup permissions for record - filePlanPermissionService.setupPermissions(holdContainer, hold); - - // verify permissions are set-up correctly - verifyInitPermissions(holdContainer, hold, never(), times(1), false, false); - - } - - /** - * Test setup of permissions for new unfiled container - */ - @Test - public void initPermissionsForNewUnfiledContainer() - { - // setup permissions for parent - setupPermissions(filePlan); - - // setup permissions for record - filePlanPermissionService.setupPermissions(filePlan, unfiledRecordContainer); - - // verify permissions are set-up correctly - verifyInitPermissions(filePlan, unfiledRecordContainer, times(1), times(1), false, false); - } - - /** - * Test setup of permissions for new unfiled record folder - */ - @Test - public void initPermissionsForNewUnfiledRecordFolder() - { - // setup permissions for parent - setupPermissions(unfiledRecordContainer); - - // setup permissions for record - filePlanPermissionService.setupPermissions(unfiledRecordContainer, unfiledRecordFolder); - - // verify permissions are set-up correctly - verifyInitPermissions(unfiledRecordContainer, unfiledRecordFolder, never(), times(1), false, true); - - } - - /** - * Test setup of permissions for new unfiled record - */ - @Test - public void initPermissionsForNewUnfiledRecord() - { - // setup permissions for parent - setupPermissions(unfiledRecordFolder); - - // setup permissions for record - filePlanPermissionService.setupPermissions(unfiledRecordFolder, unfiledRecord); - - // verify permission init - verifyInitPermissions(unfiledRecordFolder, unfiledRecord, times(1), times(1), false, true); - - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.security; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessPermission; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.namespace.QName; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Spy; +import org.mockito.verification.VerificationMode; + +/** + * File plan permission service implementation unit test. + *

+ * Primarily tests the file plan permission service interaction with the + * permission service. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class FilePlanPermissionServiceImplUnitTest extends BaseUnitTest +{ + /** test authority */ + protected static final String AUTHORITY = "anAuthority"; + protected static final String AUTHORITY2 = "anOtherAuthority"; + + /** fileplan nodes */ + protected NodeRef rootRecordCategory; + protected NodeRef recordCategory; + protected NodeRef newRecordFolder; + protected NodeRef newRecord; + + /** unfiled nodes */ + protected NodeRef unfiledRecordContainer; + protected NodeRef unfiledRecordFolder; + protected NodeRef unfiledRecordFolderChild; + protected NodeRef unfiledRecord; + + /** held nodes */ + protected NodeRef holdContainer; + protected NodeRef hold; + protected NodeRef heldRecord; + + /** file plan permission service implementation */ + @Spy @InjectMocks FilePlanPermissionServiceImpl filePlanPermissionService; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @Override + public void before() throws Exception + { + super.before(); + + // initialize node's + unfiledRecordContainer = generateContainerNodeRef(TYPE_UNFILED_RECORD_CONTAINER); + unfiledRecordFolder = generateContainerNodeRef(TYPE_UNFILED_RECORD_FOLDER); + unfiledRecordFolderChild = generateContainerNodeRef(TYPE_UNFILED_RECORD_FOLDER); + unfiledRecord = generateRecord(); + holdContainer = generateContainerNodeRef(TYPE_HOLD_CONTAINER); + hold = generateHoldNodeRef("my test hold"); + heldRecord = generateRecord(); + rootRecordCategory = generateContainerNodeRef(TYPE_RECORD_CATEGORY); + recordCategory = generateContainerNodeRef(TYPE_RECORD_CATEGORY); + newRecordFolder = generateRecordFolder(); + newRecord = generateRecord(); + + // setup parent hierarchy + makePrimaryParentOf(filePlan, generateNodeRef(ContentModel.TYPE_FOLDER)); + + makePrimaryParentOf(rootRecordCategory, filePlan); + makePrimaryParentOf(recordCategory, rootRecordCategory); + makePrimaryParentOf(newRecordFolder, recordCategory); + makePrimaryParentOf(newRecord, newRecordFolder); + + makePrimaryParentOf(unfiledRecordFolder, unfiledRecordContainer); + makePrimaryParentOf(unfiledRecordContainer, filePlan); + + makePrimaryParentOf(hold, holdContainer); + makePrimaryParentOf(holdContainer, filePlan); + + + // setup child hierarchy + makeChildrenOf(filePlan, rootRecordCategory); + makeChildrenOf(rootRecordCategory, recordCategory); + makeChildrenOf(recordCategory, newRecordFolder); + makeChildrenOf(newRecordFolder, newRecord); + + makeChildrenOf(unfiledRecordFolder, unfiledRecordFolderChild); + makeChildrenOf(unfiledRecordFolderChild, unfiledRecord); + + makeChildrenOf(holdContainer, hold); + makeChildrenOf(hold, heldRecord); + + doReturn(FilePlanComponentKind.FILE_PLAN).when(filePlanPermissionService).getFilePlanComponentKind(filePlan); + doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(filePlanPermissionService).getFilePlanComponentKind(rootRecordCategory); + doReturn(FilePlanComponentKind.RECORD_CATEGORY).when(filePlanPermissionService).getFilePlanComponentKind(recordCategory); + doReturn(FilePlanComponentKind.RECORD_FOLDER).when(filePlanPermissionService).getFilePlanComponentKind(newRecordFolder); + doReturn(FilePlanComponentKind.RECORD).when(filePlanPermissionService).getFilePlanComponentKind(newRecord); + doReturn(FilePlanComponentKind.UNFILED_RECORD_FOLDER).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecordFolder); + doReturn(FilePlanComponentKind.UNFILED_RECORD_CONTAINER).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecordContainer); + doReturn(FilePlanComponentKind.RECORD).when(filePlanPermissionService).getFilePlanComponentKind(unfiledRecord); + doReturn(FilePlanComponentKind.HOLD_CONTAINER).when(filePlanPermissionService).getFilePlanComponentKind(holdContainer); + doReturn(FilePlanComponentKind.HOLD).when(filePlanPermissionService).getFilePlanComponentKind(hold); + } + + /** + * Helper method to generate a container node ref of a perticular type. + * + * @param type type of node reference + * @return {@link NodeRef} node reference that behaves like a container of the type given. + */ + private NodeRef generateContainerNodeRef(QName type) + { + NodeRef nodeRef = generateNodeRef(type); + setupAsFilePlanComponent(nodeRef); + doReturn(true).when(filePlanPermissionService).isFilePlanContainer(nodeRef); + return nodeRef; + } + + /** + * Set read permission on unfiled record folder. + */ + @Test + public void setReadPermissionOnUnfiledRecordFolder() + { + // set read permission on unfiled record folder + filePlanPermissionService.setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); + + // verify permission set on target node + verify(mockedPermissionService, times(1)).setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS, true); + } + + /** + * Set filling permission on unfiled record folder + */ + @Test + public void setReadAndFilePermissionOnUnfileRecordFolder() + { + // set read permission on unfiled record folder + filePlanPermissionService.setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.FILING); + + // verify permission set on target node + verify(mockedPermissionService, times(1)).setPermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.FILING, true); + } + + /** + * Remove permission from unfiled record folders. + */ + @Test + public void deletePermissionFromUnfiledRecordFolder() + { + // delete read permission from unfiled record folder + filePlanPermissionService.deletePermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); + + // verify permission deleted on target node + verify(mockedPermissionService, times(1)).deletePermission(unfiledRecordFolder, AUTHORITY, RMPermissionModel.READ_RECORDS); + } + + /** + * Set read permission on hold container + */ + @Test + public void setReadPermissionOnHoldContainer() + { + // set read permission on hold + filePlanPermissionService.setPermission(holdContainer, AUTHORITY, RMPermissionModel.READ_RECORDS); + + // verify permission set on target node + verify(mockedPermissionService, times(1)).setPermission(holdContainer, AUTHORITY, RMPermissionModel.READ_RECORDS, true); + } + + /** + * Set filing permission on hold container + */ + @Test + public void setFilingPermissionOnHoldContainer() + { + // set read permission on hold + filePlanPermissionService.setPermission(holdContainer, AUTHORITY, RMPermissionModel.FILING); + + // verify permission set on target node + verify(mockedPermissionService, times(1)).setPermission(holdContainer, AUTHORITY, RMPermissionModel.FILING, true); + } + + /** + * Set read permission on hold. + */ + @Test + public void setReadPermissionOnHold() + { + // set read permission on hold + filePlanPermissionService.setPermission(hold, AUTHORITY, RMPermissionModel.READ_RECORDS); + + // verify permission set on target node + verify(mockedPermissionService, times(1)).setPermission(hold, AUTHORITY, RMPermissionModel.READ_RECORDS, true); + } + + /** + * Set filing permission on hold. + */ + @Test + public void setFilingPermissionOnHold() + { + // set filing permission on hold + filePlanPermissionService.setPermission(hold, AUTHORITY, RMPermissionModel.FILING); + + // verify permission set on target node + verify(mockedPermissionService, times(1)).setPermission(hold, AUTHORITY, RMPermissionModel.FILING, true); + } + + /** + * Helper method to setup permissions on mock objects + */ + private void setupPermissions(NodeRef nodeRef) + { + Set perms = new HashSet(4); + + // setup basic file and read for authorities + perms.add(new AccessPermissionImpl(RMPermissionModel.READ_RECORDS, AccessStatus.ALLOWED, AUTHORITY, 0)); + perms.add(new AccessPermissionImpl(RMPermissionModel.FILING, AccessStatus.ALLOWED, AUTHORITY2, 1)); + + doReturn(perms).when(mockedPermissionService).getAllSetPermissions(nodeRef); + } + + /** + * Helper to verify the core permissions have been initialized correctly + */ + private void verifyInitPermissions(NodeRef nodeRef, boolean isInherited) + { + verify(mockedPermissionService).getAllSetPermissions(nodeRef); + verify(mockedPermissionService).setInheritParentPermissions(nodeRef, isInherited); + verify(mockedPermissionService).clearPermission(nodeRef, null); + verify(mockedOwnableService).setOwner(nodeRef, OwnableService.NO_OWNER); + } + + /** + * Helper to verify that permissions have been set correctly on the child + * + * @param parent parent node + * @param child child node + * @param read verification mode relating to setting read on the child + * @param filling verification mode relating to setting filling on the child + */ + private void verifyInitPermissions(NodeRef parent, NodeRef child, VerificationMode read, VerificationMode filling, boolean isParentFilePlan, boolean isInherited) + { + // verify the core permissions are set-up correctly + verifyInitPermissions(child, isInherited); + + if (isParentFilePlan) + { + // verify the permissions came from the correct parent + verify(mockedPermissionService).getAllSetPermissions(parent); + + // verify all the inherited permissions are set correctly (note read are not inherited from fileplan) + verify(mockedPermissionService, filling).setPermission(child, AUTHORITY2, RMPermissionModel.FILING, true); + verify(mockedPermissionService, read).setPermission(child, AUTHORITY, RMPermissionModel.READ_RECORDS, true); + } + } + + /** + * Test the initialisation of permissions for a new root category + */ + @Test + public void initPermissionsForNewRootRecordCategory() + { + // setup permissions for file plan + setupPermissions(filePlan); + + // setup permissions + filePlanPermissionService.setupRecordCategoryPermissions(rootRecordCategory); + + // verify permission init + verifyInitPermissions(filePlan, rootRecordCategory, never(), times(1), true, false); + } + + /** + * Test the initialisation of permissions for a new category + */ + @Test + public void initPermissionsForNewRecordCategory() + { + // setup permissions for parent + setupPermissions(rootRecordCategory); + + // setup permissions + filePlanPermissionService.setupRecordCategoryPermissions(recordCategory); + + // verify permission init + verifyInitPermissions(rootRecordCategory, recordCategory, times(1), times(1), false, true); + } + + /** + * Test initialisation new record folder permissions + */ + @Test + public void initPermissionsForNewRecordFolder() + { + // setup permissions for parent + setupPermissions(recordCategory); + + // setup permissions + filePlanPermissionService.setupPermissions(recordCategory, newRecordFolder); + + // verify permission init + verifyInitPermissions(recordCategory, newRecordFolder, times(1), times(1), false, true); + + } + + /** + * Test setup of new record permissions + */ + @Test + public void initPermissionsForNewRecord() + { + // setup permissions for parent + setupPermissions(newRecordFolder); + + // setup permissions for record + filePlanPermissionService.setupPermissions(newRecordFolder, newRecord); + + // verify permission init + verifyInitPermissions(newRecordFolder, newRecord, times(1), times(1), false, true); + } + + /** + * Test setup of permissions for new hold container + */ + @Test + public void initPermnissionsForNewHoldContainer() + { + // setup permissions for parent + setupPermissions(filePlan); + + // setup permissions for record + filePlanPermissionService.setupPermissions(filePlan, holdContainer); + + // verify permissions are set-up correctly + verifyInitPermissions(filePlan, holdContainer, times(1), times(1), false, true); + } + + /** + * Test setup of permissions for new hold + */ + @Test + public void initPermissionsForNewHold() + { + // setup permissions for parent + setupPermissions(holdContainer); + + // setup permissions for record + filePlanPermissionService.setupPermissions(holdContainer, hold); + + // verify permissions are set-up correctly + verifyInitPermissions(holdContainer, hold, never(), times(1), false, false); + + } + + /** + * Test setup of permissions for new unfiled container + */ + @Test + public void initPermissionsForNewUnfiledContainer() + { + // setup permissions for parent + setupPermissions(filePlan); + + // setup permissions for record + filePlanPermissionService.setupPermissions(filePlan, unfiledRecordContainer); + + // verify permissions are set-up correctly + verifyInitPermissions(filePlan, unfiledRecordContainer, times(1), times(1), false, false); + } + + /** + * Test setup of permissions for new unfiled record folder + */ + @Test + public void initPermissionsForNewUnfiledRecordFolder() + { + // setup permissions for parent + setupPermissions(unfiledRecordContainer); + + // setup permissions for record + filePlanPermissionService.setupPermissions(unfiledRecordContainer, unfiledRecordFolder); + + // verify permissions are set-up correctly + verifyInitPermissions(unfiledRecordContainer, unfiledRecordFolder, never(), times(1), false, true); + + } + + /** + * Test setup of permissions for new unfiled record + */ + @Test + public void initPermissionsForNewUnfiledRecord() + { + // setup permissions for parent + setupPermissions(unfiledRecordFolder); + + // setup permissions for record + filePlanPermissionService.setupPermissions(unfiledRecordFolder, unfiledRecord); + + // verify permission init + verifyInitPermissions(unfiledRecordFolder, unfiledRecord, times(1), times(1), false, true); + + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java index ea3edee41b..838c0a8869 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java @@ -1,47 +1,47 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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; - -import org.junit.extensions.cpsuite.ClasspathSuite; -import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters; -import org.junit.runner.RunWith; - -/** - * All unit test suite. - * - * @author Roy Wetherall - * @since 2.2 - */ -@RunWith(ClasspathSuite.class) -@ClassnameFilters({ - // Execute all test classes ending with "UnitTest" - ".*UnitTest" -}) -public class AllUnitTestSuite -{ -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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; + +import org.junit.extensions.cpsuite.ClasspathSuite; +import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters; +import org.junit.runner.RunWith; + +/** + * All unit test suite. + * + * @author Roy Wetherall + * @since 2.2 + */ +@RunWith(ClasspathSuite.class) +@ClassnameFilters({ + // Execute all test classes ending with "UnitTest" + ".*UnitTest" +}) +public class AllUnitTestSuite +{ +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/AlfMock.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/AlfMock.java index 5cf8e7b9dc..ef13267e74 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/AlfMock.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/AlfMock.java @@ -1,130 +1,130 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; - -import java.util.UUID; - -import org.alfresco.model.ContentModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; - -/** - * Utilities helpful when mocking Alfresco constructs. - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class AlfMock -{ - /** - * Helper to generate random text value suitable for a property - * value or node name - */ - public static String generateText() - { - return UUID.randomUUID().toString(); - } - - /** - * Helper method to generate a qname. - */ - public static QName generateQName() - { - return generateQName(GUID.generate()); - } - - /** - * Helper method to generate a qname. - */ - public static QName generateQName(String uri) - { - return QName.createQName(uri, GUID.generate()); - } - - /** - * Helper method to generate a node reference. - * - * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store - */ - public static NodeRef generateNodeRef(NodeService mockedNodeService) - { - return generateNodeRef(mockedNodeService, null); - } - - /** - * Helper method to generate a node reference of a particular type. - * - * @param type content type qualified name - * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store with - * the content type provided - */ - public static NodeRef generateNodeRef(NodeService mockedNodeService, QName type) - { - return generateNodeRef(mockedNodeService, type, true); - } - - /** - * Helper method to generate a cm:content node reference with a given name. - * - * @param name content name - * @return NodeRef node reference - */ - public static NodeRef generateCmContent(NodeService mockedNodeService, String name) - { - NodeRef nodeRef = generateNodeRef(mockedNodeService, ContentModel.TYPE_CONTENT, true); - doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME); - return nodeRef; - } - - /** - * Helper method to generate a node reference of a particular type with a given existence characteristic. - * - * @param type content type qualified name - * @param exists indicates whether this node should behave like a node that exists or not - * @return {@link NodeRef} node reference that behaves like a node that exists (or not) in the spaces store with - * the content type provided - */ - public static NodeRef generateNodeRef(NodeService mockedNodeService, QName type, boolean exists) - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists); - if (type != null) - { - when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); - } - return nodeRef; - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.util.UUID; + +import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.GUID; + +/** + * Utilities helpful when mocking Alfresco constructs. + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class AlfMock +{ + /** + * Helper to generate random text value suitable for a property + * value or node name + */ + public static String generateText() + { + return UUID.randomUUID().toString(); + } + + /** + * Helper method to generate a qname. + */ + public static QName generateQName() + { + return generateQName(GUID.generate()); + } + + /** + * Helper method to generate a qname. + */ + public static QName generateQName(String uri) + { + return QName.createQName(uri, GUID.generate()); + } + + /** + * Helper method to generate a node reference. + * + * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store + */ + public static NodeRef generateNodeRef(NodeService mockedNodeService) + { + return generateNodeRef(mockedNodeService, null); + } + + /** + * Helper method to generate a node reference of a particular type. + * + * @param type content type qualified name + * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store with + * the content type provided + */ + public static NodeRef generateNodeRef(NodeService mockedNodeService, QName type) + { + return generateNodeRef(mockedNodeService, type, true); + } + + /** + * Helper method to generate a cm:content node reference with a given name. + * + * @param name content name + * @return NodeRef node reference + */ + public static NodeRef generateCmContent(NodeService mockedNodeService, String name) + { + NodeRef nodeRef = generateNodeRef(mockedNodeService, ContentModel.TYPE_CONTENT, true); + doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME); + return nodeRef; + } + + /** + * Helper method to generate a node reference of a particular type with a given existence characteristic. + * + * @param type content type qualified name + * @param exists indicates whether this node should behave like a node that exists or not + * @return {@link NodeRef} node reference that behaves like a node that exists (or not) in the spaces store with + * the content type provided + */ + public static NodeRef generateNodeRef(NodeService mockedNodeService, QName type, boolean exists) + { + NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); + when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists); + if (type != null) + { + when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); + } + return nodeRef; + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java index 950ab63512..f51d23f6bb 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java @@ -1,394 +1,394 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; -import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; -import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.CmObjectType; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; -import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -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.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.CopyService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.SearchService; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.QNamePattern; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.GUID; -import org.alfresco.util.collections.CollectionUtils; -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.ExpectedException; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.context.ApplicationContext; - -/** - * Base unit test. - *

- * Contains core and records management service mocks ready for injection. Helper methods - * provide an easy way to build RM or Alfresco constructs for use in tests. - * - * @author Roy Wetherall - * @since 2.2 - */ -public class BaseUnitTest implements RecordsManagementModel, ContentModel -{ - protected NodeRef filePlanComponent; - protected NodeRef filePlan; - - protected NodeRef recordFolder; - protected NodeRef record; - - /** core service mocks */ - @Mock(name="nodeService") protected NodeService mockedNodeService; - @Mock(name="dictionaryService") protected DictionaryService mockedDictionaryService; - @Mock(name="namespaceService") protected NamespaceService mockedNamespaceService; - @Mock(name="identifierService") protected IdentifierService mockedIdentifierService; - @Mock(name="permissionService") protected PermissionService mockedPermissionService; - @Mock(name="ownableService") protected OwnableService mockedOwnableService; - @Mock(name="searchService") protected SearchService mockedSearchService; - @Mock(name="retryingTransactionHelper") protected RetryingTransactionHelper mockedRetryingTransactionHelper; - @Mock(name="authorityService") protected AuthorityService mockedAuthorityService; - @Mock(name="policyComponent") protected PolicyComponent mockedPolicyComponent; - @Mock(name="copyService") protected CopyService mockedCopyService; - @Mock(name="fileFolderService") protected FileFolderService mockedFileFolderService; - @Mock(name="modelSecurityService") protected ModelSecurityService mockedModelSecurityService; - - /** rm service mocks */ - @Mock(name="filePlanService") protected FilePlanService mockedFilePlanService; - @Mock(name="recordFolderService") protected RecordFolderService mockedRecordFolderService; - @Mock(name="recordService") protected RecordService mockedRecordService; - @Mock(name="holdService") protected HoldService mockedHoldService; - @Mock(name="recordsManagementActionService") protected RecordsManagementActionService mockedRecordsManagementActionService; - @Mock(name="reportService") protected ReportService mockedReportService; - @Mock(name="filePlanRoleService") protected FilePlanRoleService mockedFilePlanRoleService; - @Mock(name="recordsManagementAuditService") protected RecordsManagementAuditService mockedRecordsManagementAuditService; - @Mock(name="policyBehaviourFilter") protected BehaviourFilter mockedBehaviourFilter; - @Mock(name="authenticationUtil") protected AuthenticationUtil mockedAuthenticationUtil; - @Mock(name="extendedPermissionService") protected ExtendedPermissionService mockedExtendedPermissionService; - @Mock(name="extendedSecurityService") protected ExtendedSecurityService mockedExtendedSecurityService; - @Mock(name="recordableVersionConfigService") protected RecordableVersionConfigService mockedRecordableVersionConfigService; - @Mock(name="cmObjectType") protected CmObjectType mockedCmObjectType; - @Mock(name="recordableVersionService") protected RecordableVersionService mockedRecordableVersionService; - @Mock(name="transactionalResourceHelper") protected TransactionalResourceHelper mockedTransactionalResourceHelper; - @Mock(name="alfrescoTransactionSupport") protected AlfrescoTransactionSupport mockedAlfrescoTransactionSupport; - @Mock(name="freezeService") protected FreezeService mockedFreezeService; - @Mock(name="dispositionService") protected DispositionService mockedDispositionService; - - /** application context mock */ - @Mock(name="applicationContext") protected ApplicationContext mockedApplicationContext; - - /** expected exception rule */ - @Rule - public ExpectedException exception = ExpectedException.none(); - - /** - * Test method setup - */ - @SuppressWarnings("unchecked") - @Before - public void before() throws Exception - { - MockitoAnnotations.initMocks(this); - - // setup application context - doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService"); - - // setup retrying transaction helper - Answer doInTransactionAnswer = new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RetryingTransactionCallback callback = (RetryingTransactionCallback)invocation.getArguments()[0]; - return callback.execute(); - } - }; - doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).doInTransaction(any(RetryingTransactionCallback.class)); - - // setup mocked authentication util - MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil); - - // setup file plan - filePlan = generateNodeRef(TYPE_FILE_PLAN); - setupAsFilePlanComponent(filePlan); - doReturn(true).when(mockedFilePlanService).isFilePlan(filePlan); - - // setup basic file plan component - filePlanComponent = generateNodeRef(); - setupAsFilePlanComponent(filePlanComponent); - - // setup namespace service - doReturn(RM_URI).when(mockedNamespaceService).getNamespaceURI(RM_PREFIX); - doReturn(CollectionUtils.unmodifiableSet(RM_PREFIX)).when(mockedNamespaceService).getPrefixes(RM_URI); - - // setup record folder and record - recordFolder = generateRecordFolder(); - record = generateRecord(); - - // set record as child of record folder - List result = new ArrayList(1); - result.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, recordFolder, generateQName(RM_URI), record, true, 1)); - doReturn(result).when(mockedNodeService).getChildAssocs(eq(recordFolder), eq(ContentModel.ASSOC_CONTAINS), any(QNamePattern.class)); - doReturn(result).when(mockedNodeService).getParentAssocs(record); - doReturn(Collections.singletonList(recordFolder)).when(mockedRecordFolderService).getRecordFolders(record); - doReturn(Collections.singletonList(record)).when(mockedRecordService).getRecords(recordFolder); - } - - /** - * Helper method to generate hold reference - * - * @param name hold name - * @return {@link NodeRef} node reference that will behave like a hold - */ - protected NodeRef generateHoldNodeRef(String name) - { - NodeRef hold = generateNodeRef(TYPE_HOLD); - doReturn(name).when(mockedNodeService).getProperty(hold, ContentModel.PROP_NAME); - doReturn(true).when(mockedHoldService).isHold(hold); - return hold; - } - - /** - * Helper method to generate record folder reference - * - * @return {@link NodeRef} node reference that will behave like a record folder - */ - protected NodeRef generateRecordFolder() - { - NodeRef recordFolder = generateNodeRef(TYPE_RECORD_FOLDER); - setupAsFilePlanComponent(recordFolder); - doReturn(true).when(mockedRecordFolderService).isRecordFolder(recordFolder); - return recordFolder; - } - - /** - * Helper method to generate a record node reference. - * - * @return {@link NodeRef} node reference that will behave like a record or type cm:content - */ - protected NodeRef generateRecord() - { - NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); - setupAsFilePlanComponent(record); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_RECORD); - doReturn(true).when(mockedRecordService).isRecord(record); - return record; - } - - /** - * Helper method to setup a node reference as a file plan component. - * - * @param nodeRef {@link NodeRef} node reference that will now behave like a file plan component - */ - protected void setupAsFilePlanComponent(NodeRef nodeRef) - { - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT); - doReturn(true).when(mockedFilePlanService).isFilePlanComponent(nodeRef); - doReturn(filePlan).when(mockedFilePlanService).getFilePlan(nodeRef); - doReturn(filePlan).when(mockedNodeService).getProperty(nodeRef, PROP_ROOT_NODEREF); - } - - /** - * Helper method to generate a node reference. - * - * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store - */ - protected NodeRef generateNodeRef() - { - return generateNodeRef(null); - } - - /** - * Helper method to generate a node reference of a particular type. - * - * @param type content type qualified name - * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store with - * the content type provided - */ - protected NodeRef generateNodeRef(QName type) - { - return generateNodeRef(type, true); - } - - /** - * Helper method to generate a cm:content node reference with a given name. - * - * @param name content name - * @return NodeRef node reference - */ - protected NodeRef generateCmContent(String name) - { - NodeRef nodeRef = generateNodeRef(ContentModel.TYPE_CONTENT, true); - doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME); - return nodeRef; - } - - /** - * Helper method to generate a node reference of a particular type with a given existence characteristic. - * - * @param type content type qualified name - * @param exists indicates whether this node should behave like a node that exists or not - * @return {@link NodeRef} node reference that behaves like a node that exists (or not) in the spaces store with - * the content type provided - */ - protected NodeRef generateNodeRef(QName type, boolean exists) - { - NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists); - if (type != null) - { - when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); - } - return nodeRef; - } - - /** - * Helper method to generate a mocked child association reference. - * - * @param parent parent node (optional) - * @param child child node (optional) - * @return {@link ChildAssociationRef} mocked to return the parent and child nodes - */ - protected ChildAssociationRef generateChildAssociationRef(NodeRef parent, NodeRef child) - { - ChildAssociationRef mockedChildAssociationRef = mock(ChildAssociationRef.class); - - if (parent != null) - { - doReturn(parent).when(mockedChildAssociationRef).getParentRef(); - } - - if (child != null) - { - doReturn(child).when(mockedChildAssociationRef).getChildRef(); - } - - return mockedChildAssociationRef; - } - - /** - * Helper method to make one node the primary parent of the other. - *

- * Assumes the cm:contains assoc type. - * - * @param child - * @param parent - */ - protected void makePrimaryParentOf(NodeRef child, NodeRef parent) - { - makePrimaryParentOf(child, parent, ContentModel.ASSOC_CONTAINS, generateQName()); - } - - protected void makePrimaryParentOf(NodeRef child, NodeRef parent, QName assocType, QName assocName) - { - makePrimaryParentOf(child, parent, assocType, assocName, mockedNodeService); - } - - protected void makePrimaryParentOf(NodeRef child, NodeRef parent, QName assocType, QName assocName, NodeService mockedNodeService) - { - doReturn(new ChildAssociationRef(assocType, parent, assocName, child)) - .when(mockedNodeService) - .getPrimaryParent(child); - } - - /** - * Helper method to make a number of nodes children of another. - *

- * Assumes the cm:contains assoc type. - * - * @param parent - * @param children - */ - protected void makeChildrenOf(NodeRef parent, NodeRef ... children) - { - List assocs = new ArrayList(children.length); - for (NodeRef child : children) - { - assocs.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parent, generateQName(), child)); - doReturn(assocs).when(mockedNodeService).getParentAssocs(child); - } - doReturn(assocs).when(mockedNodeService).getChildAssocs(parent, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - } - - @SuppressWarnings("unchecked") - protected List buildList(T ... values) - { - List result = new ArrayList(values.length); - for (T value : values) - { - result.add(value); - } - return result; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateQName; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; +import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; +import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.model.rma.type.CmObjectType; +import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; +import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; +import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; +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.security.ExtendedSecurityService; +import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; +import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.CopyService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.cmr.security.AuthorityService; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.QNamePattern; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.util.GUID; +import org.alfresco.util.collections.CollectionUtils; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.ExpectedException; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.springframework.context.ApplicationContext; + +/** + * Base unit test. + *

+ * Contains core and records management service mocks ready for injection. Helper methods + * provide an easy way to build RM or Alfresco constructs for use in tests. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class BaseUnitTest implements RecordsManagementModel, ContentModel +{ + protected NodeRef filePlanComponent; + protected NodeRef filePlan; + + protected NodeRef recordFolder; + protected NodeRef record; + + /** core service mocks */ + @Mock(name="nodeService") protected NodeService mockedNodeService; + @Mock(name="dictionaryService") protected DictionaryService mockedDictionaryService; + @Mock(name="namespaceService") protected NamespaceService mockedNamespaceService; + @Mock(name="identifierService") protected IdentifierService mockedIdentifierService; + @Mock(name="permissionService") protected PermissionService mockedPermissionService; + @Mock(name="ownableService") protected OwnableService mockedOwnableService; + @Mock(name="searchService") protected SearchService mockedSearchService; + @Mock(name="retryingTransactionHelper") protected RetryingTransactionHelper mockedRetryingTransactionHelper; + @Mock(name="authorityService") protected AuthorityService mockedAuthorityService; + @Mock(name="policyComponent") protected PolicyComponent mockedPolicyComponent; + @Mock(name="copyService") protected CopyService mockedCopyService; + @Mock(name="fileFolderService") protected FileFolderService mockedFileFolderService; + @Mock(name="modelSecurityService") protected ModelSecurityService mockedModelSecurityService; + + /** rm service mocks */ + @Mock(name="filePlanService") protected FilePlanService mockedFilePlanService; + @Mock(name="recordFolderService") protected RecordFolderService mockedRecordFolderService; + @Mock(name="recordService") protected RecordService mockedRecordService; + @Mock(name="holdService") protected HoldService mockedHoldService; + @Mock(name="recordsManagementActionService") protected RecordsManagementActionService mockedRecordsManagementActionService; + @Mock(name="reportService") protected ReportService mockedReportService; + @Mock(name="filePlanRoleService") protected FilePlanRoleService mockedFilePlanRoleService; + @Mock(name="recordsManagementAuditService") protected RecordsManagementAuditService mockedRecordsManagementAuditService; + @Mock(name="policyBehaviourFilter") protected BehaviourFilter mockedBehaviourFilter; + @Mock(name="authenticationUtil") protected AuthenticationUtil mockedAuthenticationUtil; + @Mock(name="extendedPermissionService") protected ExtendedPermissionService mockedExtendedPermissionService; + @Mock(name="extendedSecurityService") protected ExtendedSecurityService mockedExtendedSecurityService; + @Mock(name="recordableVersionConfigService") protected RecordableVersionConfigService mockedRecordableVersionConfigService; + @Mock(name="cmObjectType") protected CmObjectType mockedCmObjectType; + @Mock(name="recordableVersionService") protected RecordableVersionService mockedRecordableVersionService; + @Mock(name="transactionalResourceHelper") protected TransactionalResourceHelper mockedTransactionalResourceHelper; + @Mock(name="alfrescoTransactionSupport") protected AlfrescoTransactionSupport mockedAlfrescoTransactionSupport; + @Mock(name="freezeService") protected FreezeService mockedFreezeService; + @Mock(name="dispositionService") protected DispositionService mockedDispositionService; + + /** application context mock */ + @Mock(name="applicationContext") protected ApplicationContext mockedApplicationContext; + + /** expected exception rule */ + @Rule + public ExpectedException exception = ExpectedException.none(); + + /** + * Test method setup + */ + @SuppressWarnings("unchecked") + @Before + public void before() throws Exception + { + MockitoAnnotations.initMocks(this); + + // setup application context + doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService"); + + // setup retrying transaction helper + Answer doInTransactionAnswer = new Answer() + { + @SuppressWarnings("rawtypes") + @Override + public Object answer(InvocationOnMock invocation) throws Throwable + { + RetryingTransactionCallback callback = (RetryingTransactionCallback)invocation.getArguments()[0]; + return callback.execute(); + } + }; + doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).doInTransaction(any(RetryingTransactionCallback.class)); + + // setup mocked authentication util + MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil); + + // setup file plan + filePlan = generateNodeRef(TYPE_FILE_PLAN); + setupAsFilePlanComponent(filePlan); + doReturn(true).when(mockedFilePlanService).isFilePlan(filePlan); + + // setup basic file plan component + filePlanComponent = generateNodeRef(); + setupAsFilePlanComponent(filePlanComponent); + + // setup namespace service + doReturn(RM_URI).when(mockedNamespaceService).getNamespaceURI(RM_PREFIX); + doReturn(CollectionUtils.unmodifiableSet(RM_PREFIX)).when(mockedNamespaceService).getPrefixes(RM_URI); + + // setup record folder and record + recordFolder = generateRecordFolder(); + record = generateRecord(); + + // set record as child of record folder + List result = new ArrayList(1); + result.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, recordFolder, generateQName(RM_URI), record, true, 1)); + doReturn(result).when(mockedNodeService).getChildAssocs(eq(recordFolder), eq(ContentModel.ASSOC_CONTAINS), any(QNamePattern.class)); + doReturn(result).when(mockedNodeService).getParentAssocs(record); + doReturn(Collections.singletonList(recordFolder)).when(mockedRecordFolderService).getRecordFolders(record); + doReturn(Collections.singletonList(record)).when(mockedRecordService).getRecords(recordFolder); + } + + /** + * Helper method to generate hold reference + * + * @param name hold name + * @return {@link NodeRef} node reference that will behave like a hold + */ + protected NodeRef generateHoldNodeRef(String name) + { + NodeRef hold = generateNodeRef(TYPE_HOLD); + doReturn(name).when(mockedNodeService).getProperty(hold, ContentModel.PROP_NAME); + doReturn(true).when(mockedHoldService).isHold(hold); + return hold; + } + + /** + * Helper method to generate record folder reference + * + * @return {@link NodeRef} node reference that will behave like a record folder + */ + protected NodeRef generateRecordFolder() + { + NodeRef recordFolder = generateNodeRef(TYPE_RECORD_FOLDER); + setupAsFilePlanComponent(recordFolder); + doReturn(true).when(mockedRecordFolderService).isRecordFolder(recordFolder); + return recordFolder; + } + + /** + * Helper method to generate a record node reference. + * + * @return {@link NodeRef} node reference that will behave like a record or type cm:content + */ + protected NodeRef generateRecord() + { + NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); + setupAsFilePlanComponent(record); + doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_RECORD); + doReturn(true).when(mockedRecordService).isRecord(record); + return record; + } + + /** + * Helper method to setup a node reference as a file plan component. + * + * @param nodeRef {@link NodeRef} node reference that will now behave like a file plan component + */ + protected void setupAsFilePlanComponent(NodeRef nodeRef) + { + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT); + doReturn(true).when(mockedFilePlanService).isFilePlanComponent(nodeRef); + doReturn(filePlan).when(mockedFilePlanService).getFilePlan(nodeRef); + doReturn(filePlan).when(mockedNodeService).getProperty(nodeRef, PROP_ROOT_NODEREF); + } + + /** + * Helper method to generate a node reference. + * + * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store + */ + protected NodeRef generateNodeRef() + { + return generateNodeRef(null); + } + + /** + * Helper method to generate a node reference of a particular type. + * + * @param type content type qualified name + * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store with + * the content type provided + */ + protected NodeRef generateNodeRef(QName type) + { + return generateNodeRef(type, true); + } + + /** + * Helper method to generate a cm:content node reference with a given name. + * + * @param name content name + * @return NodeRef node reference + */ + protected NodeRef generateCmContent(String name) + { + NodeRef nodeRef = generateNodeRef(ContentModel.TYPE_CONTENT, true); + doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME); + return nodeRef; + } + + /** + * Helper method to generate a node reference of a particular type with a given existence characteristic. + * + * @param type content type qualified name + * @param exists indicates whether this node should behave like a node that exists or not + * @return {@link NodeRef} node reference that behaves like a node that exists (or not) in the spaces store with + * the content type provided + */ + protected NodeRef generateNodeRef(QName type, boolean exists) + { + NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); + when(mockedNodeService.exists(eq(nodeRef))).thenReturn(exists); + if (type != null) + { + when(mockedNodeService.getType(eq(nodeRef))).thenReturn(type); + } + return nodeRef; + } + + /** + * Helper method to generate a mocked child association reference. + * + * @param parent parent node (optional) + * @param child child node (optional) + * @return {@link ChildAssociationRef} mocked to return the parent and child nodes + */ + protected ChildAssociationRef generateChildAssociationRef(NodeRef parent, NodeRef child) + { + ChildAssociationRef mockedChildAssociationRef = mock(ChildAssociationRef.class); + + if (parent != null) + { + doReturn(parent).when(mockedChildAssociationRef).getParentRef(); + } + + if (child != null) + { + doReturn(child).when(mockedChildAssociationRef).getChildRef(); + } + + return mockedChildAssociationRef; + } + + /** + * Helper method to make one node the primary parent of the other. + *

+ * Assumes the cm:contains assoc type. + * + * @param child + * @param parent + */ + protected void makePrimaryParentOf(NodeRef child, NodeRef parent) + { + makePrimaryParentOf(child, parent, ContentModel.ASSOC_CONTAINS, generateQName()); + } + + protected void makePrimaryParentOf(NodeRef child, NodeRef parent, QName assocType, QName assocName) + { + makePrimaryParentOf(child, parent, assocType, assocName, mockedNodeService); + } + + protected void makePrimaryParentOf(NodeRef child, NodeRef parent, QName assocType, QName assocName, NodeService mockedNodeService) + { + doReturn(new ChildAssociationRef(assocType, parent, assocName, child)) + .when(mockedNodeService) + .getPrimaryParent(child); + } + + /** + * Helper method to make a number of nodes children of another. + *

+ * Assumes the cm:contains assoc type. + * + * @param parent + * @param children + */ + protected void makeChildrenOf(NodeRef parent, NodeRef ... children) + { + List assocs = new ArrayList(children.length); + for (NodeRef child : children) + { + assocs.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parent, generateQName(), child)); + doReturn(assocs).when(mockedNodeService).getParentAssocs(child); + } + doReturn(assocs).when(mockedNodeService).getChildAssocs(parent, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + } + + @SuppressWarnings("unchecked") + protected List buildList(T ... values) + { + List result = new ArrayList(values.length); + for (T value : values) + { + result.add(value); + } + return result; + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseWebScriptUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseWebScriptUnitTest.java index 3bcf4cbbf6..189a6b54d0 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseWebScriptUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseWebScriptUnitTest.java @@ -1,306 +1,306 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.util.Collections.emptyMap; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.StringWriter; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.repo.jscript.People; -import org.alfresco.repo.jscript.ScriptNode; -import org.json.JSONObject; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.extensions.surf.util.Content; -import org.springframework.extensions.webscripts.Container; -import org.springframework.extensions.webscripts.DeclarativeWebScript; -import org.springframework.extensions.webscripts.Description; -import org.springframework.extensions.webscripts.Description.RequiredCache; -import org.springframework.extensions.webscripts.DescriptionExtension; -import org.springframework.extensions.webscripts.FormatRegistry; -import org.springframework.extensions.webscripts.Match; -import org.springframework.extensions.webscripts.ScriptProcessorRegistry; -import org.springframework.extensions.webscripts.SearchPath; -import org.springframework.extensions.webscripts.TemplateProcessorRegistry; -import org.springframework.extensions.webscripts.WebScriptRequest; -import org.springframework.extensions.webscripts.WebScriptResponse; -import org.springframework.extensions.webscripts.json.JSONUtils; -import org.springframework.extensions.webscripts.processor.FTLTemplateProcessor; - -import freemarker.cache.ClassTemplateLoader; -import freemarker.cache.TemplateLoader; - -/** - * Base Web Script Unit Test. - *

- * Provides helper methods that mock the nessesery classes needed to execute - * a Java backed webscript that implements DeclarativeWebScript. - *

- * Note that execution of java script controllers is not currently supported. - * - * @author Roy Wetherall - * @since 2.2 - */ -public abstract class BaseWebScriptUnitTest extends BaseUnitTest -{ - /** web script root folder for RM webscripts */ - protected static final String WEBSCRIPT_ROOT_RM = "alfresco/templates/webscripts/org/alfresco/rma/"; - - /** - * @return declarative webscript - */ - protected abstract DeclarativeWebScript getWebScript(); - - /** - * @return classpath location of webscript template - */ - protected abstract String getWebScriptTemplate(); - - /** - * Helper method to build a map of web script parameter values - * mimicking those provided on the URL - * - * @param values - * @return - */ - protected Map buildParameters(String ... values) - { - Map result = new HashMap(values.length/2); - for (int i = 0; i < values.length; i=i+2) - { - String key = values[i]; - String value = values[i+1]; - result.put(key, value); - } - return result; - } - - /** - * - * @param parameters - * @return - * @throws Exception - */ - protected JSONObject executeJSONWebScript(Map parameters) throws Exception - { - return executeJSONWebScript(parameters, null); - } - - /** - * Execute web script and convert result into a JSON object. - * - * @param parameters map of all parameter values - * @return {@link JSONObject} result, parsed into a JSON object - */ - protected JSONObject executeJSONWebScript(Map parameters, String content) throws Exception - { - String result = executeWebScript(parameters, content); - return new JSONObject(result); - } - - /** - * - * @param parameters - * @return - * @throws Exception - */ - protected String executeWebScript(Map parameters) throws Exception - { - return executeWebScript(parameters, null); - } - - /** - * Execute web script and return result as a string. - * - * @param parameters map of all parameter values - * @return {@link String} result of web script - */ - protected String executeWebScript(Map parameters, String content) throws Exception - { - DeclarativeWebScript webScript = getWebScript(); - String template = getWebScriptTemplate(); - - // initialise webscript - webScript.init(getMockedContainer(template), getMockedDescription()); - - // execute webscript - WebScriptResponse mockedResponse = getMockedWebScriptResponse(); - webScript.execute(getMockedWebScriptRequest(webScript, parameters, content), mockedResponse); - - // return results - return mockedResponse.getWriter().toString(); - } - - /** - * Helper method to get the mocked web script request. - * - * @param webScript declarative web script - * @param parameters web script parameter values - * @return {@link WebScriptRequest} mocked web script request - */ - @SuppressWarnings("rawtypes") - protected WebScriptRequest getMockedWebScriptRequest(DeclarativeWebScript webScript, final Map parameters, String content) throws Exception - { - Match match = new Match(null, parameters, null, webScript); - org.springframework.extensions.webscripts.Runtime mockedRuntime = mock(org.springframework.extensions.webscripts.Runtime.class); - - WebScriptRequest mockedRequest = mock(WebScriptRequest.class); - doReturn(match).when(mockedRequest).getServiceMatch(); - doReturn(mockedRuntime).when(mockedRequest).getRuntime(); - - if (content != null && !content.isEmpty()) - { - Content mockedContent = mock(Content.class); - doReturn(content).when(mockedContent).getContent(); - doReturn(mockedContent).when(mockedRequest).getContent(); - } - - String [] paramNames = (String[])parameters.keySet().toArray(new String[parameters.size()]); - doReturn(paramNames).when(mockedRequest).getParameterNames(); - doAnswer(new Answer() - { - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - String paramName = (String)invocation.getArguments()[0]; - return parameters.get(paramName); - } - - }).when(mockedRequest).getParameter(anyString()); - - doReturn(new String[0]).when(mockedRequest).getHeaderNames(); - doReturn("json").when(mockedRequest).getFormat(); - - return mockedRequest; - } - - /** - * Helper method to get mocked web script response - * - * @return {@link WebScriptResponse} mocked web script response - */ - protected WebScriptResponse getMockedWebScriptResponse() throws Exception - { - WebScriptResponse mockedResponse = mock(WebScriptResponse.class); - StringWriter writer = new StringWriter(); - doReturn(writer).when(mockedResponse).getWriter(); - return mockedResponse; - } - - /** - * Helper method to get mocked container object. - * - * @param template classpath location of webscripts ftl template - * @return {@link Container} mocked container - */ - protected Container getMockedContainer(String template) throws Exception - { - FormatRegistry mockedFormatRegistry = mock(FormatRegistry.class); - doReturn("application/json").when(mockedFormatRegistry).getMimeType(anyString(), anyString()); - - ScriptProcessorRegistry mockedScriptProcessorRegistry = mock(ScriptProcessorRegistry.class); - doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString()); - - TemplateProcessorRegistry mockedTemplateProcessorRegistry = mock(TemplateProcessorRegistry.class); - doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString()); - - FTLTemplateProcessor ftlTemplateProcessor = new FTLTemplateProcessor() - { - @Override - protected TemplateLoader getTemplateLoader() - { - return new ClassTemplateLoader(getClass(), "/"); - } - }; - ftlTemplateProcessor.init(); - - doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString()); - - Container mockedContainer = mock(Container.class); - doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry(); - doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry(); - doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry(); - - Map containerTemplateParameters = new HashMap<>(5); - containerTemplateParameters.put("jsonUtils", new JSONUtils()); - containerTemplateParameters.put("people", getMockedPeopleObject()); - doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters(); - - SearchPath mockedSearchPath = mock(SearchPath.class); - doReturn(false).when(mockedSearchPath).hasDocument(anyString()); - doReturn(mockedSearchPath).when(mockedContainer).getSearchPath(); - - // setup description - Description mockDescription = mock(Description.class); - doReturn(mock(RequiredCache.class)).when(mockDescription).getRequiredCache(); - - return mockedContainer; - } - - /** - * Creates a mock {@code people} object for use as a root object within FTL. - * This {@code people} object will return person nodes as specified in {@link #getMockedPeople()}. - */ - protected People getMockedPeopleObject() - { - People p = mock(People.class); - getMockedPeople().forEach((name, person) -> when(p.getPerson(eq(name))).thenReturn(person) ); - return p; - } - - /** - * Creates a map of person ScriptNodes for use within FTL. - * The default implementation is an empty map, but this can be overridden by subclasses. - * @return a map of usernames to mocked ScriptNode objects representing person nodes. - */ - protected Map getMockedPeople() - { - return emptyMap(); - } - - /** - * Helper method to get mocked description class - * - * @return {@link DescriptionExtension} mocked description class - */ - protected Description getMockedDescription() - { - Description mockedDescription = mock(Description.class); - doReturn(mock(RequiredCache.class)).when(mockedDescription).getRequiredCache(); - return mockedDescription; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.util.Collections.emptyMap; + +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.StringWriter; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.repo.jscript.People; +import org.alfresco.repo.jscript.ScriptNode; +import org.json.JSONObject; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.springframework.extensions.surf.util.Content; +import org.springframework.extensions.webscripts.Container; +import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Description; +import org.springframework.extensions.webscripts.Description.RequiredCache; +import org.springframework.extensions.webscripts.DescriptionExtension; +import org.springframework.extensions.webscripts.FormatRegistry; +import org.springframework.extensions.webscripts.Match; +import org.springframework.extensions.webscripts.ScriptProcessorRegistry; +import org.springframework.extensions.webscripts.SearchPath; +import org.springframework.extensions.webscripts.TemplateProcessorRegistry; +import org.springframework.extensions.webscripts.WebScriptRequest; +import org.springframework.extensions.webscripts.WebScriptResponse; +import org.springframework.extensions.webscripts.json.JSONUtils; +import org.springframework.extensions.webscripts.processor.FTLTemplateProcessor; + +import freemarker.cache.ClassTemplateLoader; +import freemarker.cache.TemplateLoader; + +/** + * Base Web Script Unit Test. + *

+ * Provides helper methods that mock the nessesery classes needed to execute + * a Java backed webscript that implements DeclarativeWebScript. + *

+ * Note that execution of java script controllers is not currently supported. + * + * @author Roy Wetherall + * @since 2.2 + */ +public abstract class BaseWebScriptUnitTest extends BaseUnitTest +{ + /** web script root folder for RM webscripts */ + protected static final String WEBSCRIPT_ROOT_RM = "alfresco/templates/webscripts/org/alfresco/rma/"; + + /** + * @return declarative webscript + */ + protected abstract DeclarativeWebScript getWebScript(); + + /** + * @return classpath location of webscript template + */ + protected abstract String getWebScriptTemplate(); + + /** + * Helper method to build a map of web script parameter values + * mimicking those provided on the URL + * + * @param values + * @return + */ + protected Map buildParameters(String ... values) + { + Map result = new HashMap(values.length/2); + for (int i = 0; i < values.length; i=i+2) + { + String key = values[i]; + String value = values[i+1]; + result.put(key, value); + } + return result; + } + + /** + * + * @param parameters + * @return + * @throws Exception + */ + protected JSONObject executeJSONWebScript(Map parameters) throws Exception + { + return executeJSONWebScript(parameters, null); + } + + /** + * Execute web script and convert result into a JSON object. + * + * @param parameters map of all parameter values + * @return {@link JSONObject} result, parsed into a JSON object + */ + protected JSONObject executeJSONWebScript(Map parameters, String content) throws Exception + { + String result = executeWebScript(parameters, content); + return new JSONObject(result); + } + + /** + * + * @param parameters + * @return + * @throws Exception + */ + protected String executeWebScript(Map parameters) throws Exception + { + return executeWebScript(parameters, null); + } + + /** + * Execute web script and return result as a string. + * + * @param parameters map of all parameter values + * @return {@link String} result of web script + */ + protected String executeWebScript(Map parameters, String content) throws Exception + { + DeclarativeWebScript webScript = getWebScript(); + String template = getWebScriptTemplate(); + + // initialise webscript + webScript.init(getMockedContainer(template), getMockedDescription()); + + // execute webscript + WebScriptResponse mockedResponse = getMockedWebScriptResponse(); + webScript.execute(getMockedWebScriptRequest(webScript, parameters, content), mockedResponse); + + // return results + return mockedResponse.getWriter().toString(); + } + + /** + * Helper method to get the mocked web script request. + * + * @param webScript declarative web script + * @param parameters web script parameter values + * @return {@link WebScriptRequest} mocked web script request + */ + @SuppressWarnings("rawtypes") + protected WebScriptRequest getMockedWebScriptRequest(DeclarativeWebScript webScript, final Map parameters, String content) throws Exception + { + Match match = new Match(null, parameters, null, webScript); + org.springframework.extensions.webscripts.Runtime mockedRuntime = mock(org.springframework.extensions.webscripts.Runtime.class); + + WebScriptRequest mockedRequest = mock(WebScriptRequest.class); + doReturn(match).when(mockedRequest).getServiceMatch(); + doReturn(mockedRuntime).when(mockedRequest).getRuntime(); + + if (content != null && !content.isEmpty()) + { + Content mockedContent = mock(Content.class); + doReturn(content).when(mockedContent).getContent(); + doReturn(mockedContent).when(mockedRequest).getContent(); + } + + String [] paramNames = (String[])parameters.keySet().toArray(new String[parameters.size()]); + doReturn(paramNames).when(mockedRequest).getParameterNames(); + doAnswer(new Answer() + { + @Override + public Object answer(InvocationOnMock invocation) throws Throwable + { + String paramName = (String)invocation.getArguments()[0]; + return parameters.get(paramName); + } + + }).when(mockedRequest).getParameter(anyString()); + + doReturn(new String[0]).when(mockedRequest).getHeaderNames(); + doReturn("json").when(mockedRequest).getFormat(); + + return mockedRequest; + } + + /** + * Helper method to get mocked web script response + * + * @return {@link WebScriptResponse} mocked web script response + */ + protected WebScriptResponse getMockedWebScriptResponse() throws Exception + { + WebScriptResponse mockedResponse = mock(WebScriptResponse.class); + StringWriter writer = new StringWriter(); + doReturn(writer).when(mockedResponse).getWriter(); + return mockedResponse; + } + + /** + * Helper method to get mocked container object. + * + * @param template classpath location of webscripts ftl template + * @return {@link Container} mocked container + */ + protected Container getMockedContainer(String template) throws Exception + { + FormatRegistry mockedFormatRegistry = mock(FormatRegistry.class); + doReturn("application/json").when(mockedFormatRegistry).getMimeType(anyString(), anyString()); + + ScriptProcessorRegistry mockedScriptProcessorRegistry = mock(ScriptProcessorRegistry.class); + doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString()); + + TemplateProcessorRegistry mockedTemplateProcessorRegistry = mock(TemplateProcessorRegistry.class); + doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString()); + + FTLTemplateProcessor ftlTemplateProcessor = new FTLTemplateProcessor() + { + @Override + protected TemplateLoader getTemplateLoader() + { + return new ClassTemplateLoader(getClass(), "/"); + } + }; + ftlTemplateProcessor.init(); + + doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString()); + + Container mockedContainer = mock(Container.class); + doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry(); + doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry(); + doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry(); + + Map containerTemplateParameters = new HashMap<>(5); + containerTemplateParameters.put("jsonUtils", new JSONUtils()); + containerTemplateParameters.put("people", getMockedPeopleObject()); + doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters(); + + SearchPath mockedSearchPath = mock(SearchPath.class); + doReturn(false).when(mockedSearchPath).hasDocument(anyString()); + doReturn(mockedSearchPath).when(mockedContainer).getSearchPath(); + + // setup description + Description mockDescription = mock(Description.class); + doReturn(mock(RequiredCache.class)).when(mockDescription).getRequiredCache(); + + return mockedContainer; + } + + /** + * Creates a mock {@code people} object for use as a root object within FTL. + * This {@code people} object will return person nodes as specified in {@link #getMockedPeople()}. + */ + protected People getMockedPeopleObject() + { + People p = mock(People.class); + getMockedPeople().forEach((name, person) -> when(p.getPerson(eq(name))).thenReturn(person) ); + return p; + } + + /** + * Creates a map of person ScriptNodes for use within FTL. + * The default implementation is an empty map, but this can be overridden by subclasses. + * @return a map of usernames to mocked ScriptNode objects representing person nodes. + */ + protected Map getMockedPeople() + { + return emptyMap(); + } + + /** + * Helper method to get mocked description class + * + * @return {@link DescriptionExtension} mocked description class + */ + protected Description getMockedDescription() + { + Description mockedDescription = mock(Description.class); + doReturn(mock(RequiredCache.class)).when(mockedDescription).getRequiredCache(); + return mockedDescription; + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtils.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtils.java index 3c37eacdf0..4b3d3fb3d1 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtils.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtils.java @@ -1,244 +1,244 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.util.Optional; -import java.util.function.Supplier; - -/** - * Utility class to help with Java exceptions, particularly in test code. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class ExceptionUtils -{ - /** This represents a situation where a throwable of an unexpected type was thrown. */ - public static class UnexpectedThrowableException extends RuntimeException - { - /** serial version uid */ - private static final long serialVersionUID = 3900164716673246207L; - - private final Class expected; - private final Throwable actual; - - public UnexpectedThrowableException(Class expected, Throwable actual) - { - this.expected = expected; - this.actual = actual; - } - - public Class getExpected() { return this.expected; } - public Throwable getActual() { return this.actual; } - - @Override public String toString() - { - return String.join("", "Expected ", expected.getSimpleName(), " but ", - actual.getClass().getSimpleName(), " was thrown."); - } - } - - /** This represents a situation where an expected throwable was not thrown. */ - public static class MissingThrowableException extends RuntimeException - { - /** serial version uid */ - private static final long serialVersionUID = -988022536370047222L; - - private final Class expected; - - public MissingThrowableException(Class expected) - { - this.expected = expected; - } - - public Class getExpected() { return this.expected; } - @Override public String toString() - { - return String.join("", "Expected ", expected.getSimpleName(), " but nothing was thrown."); - } - } - - /** - * Utility method to help with expected exceptions (unchecked - see below) in test code. This can be used in place - * of {@code try/catch} blocks within test code and can sometimes make code more readable. - * A single expected exception would usually be let escape from the test method and be handled e.g. by JUnit's - * {@code @Test(expected="Exception.class")} pattern. - * However if you have multiple expected exceptions in a sequence, you need to either add a sequence of - * {@code try/catch} or use this method. Likewise if you need to make assertions about state within the expected - * exception, such as root cause or other internal state, this method will be useful. - *

- * Examples: - *

    - *
  • - * Calling a local method which throws a {@code RuntimeException}. (An expression lambda) - *
    -     * expectedException(RuntimeException.class, () -> badMethod() );
    -     *         
    - *
  • - *
  • - * Executing a block of code. (Requires return statement) - *
    -     * expectedException(RuntimeException.class, () -> {
    -     *   for (int i = 0; i < 10; i++) {
    -     *     goodMethod();
    -     *   }
    -     *   badMethod();
    -     *   return "result";
    -     * });
    -     *         
    - *
  • - *
  • - * Examining the expected exception e.g. to assert the root cause is correct. - *
    -     * UnsupportedOperationException e = expectedException(UnsupportedOperationException.class, () -> badMethod2() );
    -     * assertEquals(RuntimeException.class, e.getCause().getClass());
    -     *         
    - *
  • - *
  • - * Note that if your lambda expression returns 'void' then you cannot use an expression - * and must explicitly return null from a lambda block. - *
    -     * expectedException(Exception.class, () -> { methodReturningVoid(); return null; } );
    -     * expectedException(Exception.class, () -> { methodReturningVoid("parameter"); return null; } );
    -     *         
    - *
  • - *
- * - * A note on checked exceptions: currently this method does not provide any support for working around the normal - * integration of Java 8 lambdas and checked exceptions. If your {@code code} block must deal with checked exceptions, - * you must add {@code try}/{@code catch} blocks within your lambda which obviously makes this method less useful. - * This may change in the future. - * - * - * @param expected the class of the expected throwable (subtypes will also match). - * @param code a lambda containing the code block which should throw the expected throwable. - * @param the return type of the code block (which should not matter as it should not complete). - * @param the type of the expected throwable (subtypes will also match). - * @return the expected throwable object if it was thrown. - * @throws UnexpectedThrowableException if a non-matching throwable was thrown out of the code block. - * @throws MissingThrowableException if the expected throwable was not thrown out of the code block. - */ - @SuppressWarnings("unchecked") - public static T expectedException(final Class expected, final Supplier code) - { - // The code block may throw an exception or it may not. - Optional maybeThrownByCode; - - try - { - // evaluate the lambda - code.get(); - - // It didn't throw an exception. - maybeThrownByCode = Optional.empty(); - } - catch (Throwable t) - { - maybeThrownByCode = Optional.of(t); - } - - Throwable thrownByCode = maybeThrownByCode.orElseThrow(() -> new MissingThrowableException(expected)); - - if (expected.isAssignableFrom(thrownByCode.getClass())) - { - return (T)thrownByCode; - } - else - { - throw new UnexpectedThrowableException(expected, thrownByCode); - } - } - - /** - * Helper method to work around the difficulties of working with lambdas and checked exceptions. - * Use as follows: - *
-     *     expectedException(WebScriptException.class, () ->
-     *         // "Wash away" any checked exceptions in the inner code block.
-     *         smuggleCheckedExceptions( () -> methodThrowsException())
-     *     );
-     * 
- * @param code a block of code which is declared to throw a checked exception. - * @param the return type of the block of code. - * @param the type of the checked exception. - * @return the value returned by the block of code. - * @throws SmuggledException if the code block threw an exception of type T. - */ - public static R smuggleCheckedExceptions(final ThrowingSupplier code) - { - try - { - return code.get(); - } - catch (RuntimeException e) - { - throw e; - } - catch (Exception e) - { - throw new SmuggledException(e); - } - } - - /** - * Equivalent to `java.util.function.Supplier` but its method declares that it - * throws checked exceptions. - * - * @param The result type of this supplier. - * @param The exception type declared to be thrown by this supplier. - */ - @FunctionalInterface - public interface ThrowingSupplier - { - /** Gets the value */ - R get() throws T; - } - - /** - * A wrapper for checked exceptions so that they can be handled as unchecked exceptions, namely by not requiring - * try/catch blocks etc. - *

- * This type is expected to be most useful when handling Java 8 lambdas containing code which throws checked - * exceptions. - */ - public static class SmuggledException extends RuntimeException - { - private static final long serialVersionUID = -606404592461576013L; - private final Exception e; - - public SmuggledException(Exception e) - { - this.e = e; - } - - public Exception getCheckedException() - { - return this.e; - } - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.util.Optional; +import java.util.function.Supplier; + +/** + * Utility class to help with Java exceptions, particularly in test code. + * + * @author Neil Mc Erlean + * @since 2.4.a + */ +public class ExceptionUtils +{ + /** This represents a situation where a throwable of an unexpected type was thrown. */ + public static class UnexpectedThrowableException extends RuntimeException + { + /** serial version uid */ + private static final long serialVersionUID = 3900164716673246207L; + + private final Class expected; + private final Throwable actual; + + public UnexpectedThrowableException(Class expected, Throwable actual) + { + this.expected = expected; + this.actual = actual; + } + + public Class getExpected() { return this.expected; } + public Throwable getActual() { return this.actual; } + + @Override public String toString() + { + return String.join("", "Expected ", expected.getSimpleName(), " but ", + actual.getClass().getSimpleName(), " was thrown."); + } + } + + /** This represents a situation where an expected throwable was not thrown. */ + public static class MissingThrowableException extends RuntimeException + { + /** serial version uid */ + private static final long serialVersionUID = -988022536370047222L; + + private final Class expected; + + public MissingThrowableException(Class expected) + { + this.expected = expected; + } + + public Class getExpected() { return this.expected; } + @Override public String toString() + { + return String.join("", "Expected ", expected.getSimpleName(), " but nothing was thrown."); + } + } + + /** + * Utility method to help with expected exceptions (unchecked - see below) in test code. This can be used in place + * of {@code try/catch} blocks within test code and can sometimes make code more readable. + * A single expected exception would usually be let escape from the test method and be handled e.g. by JUnit's + * {@code @Test(expected="Exception.class")} pattern. + * However if you have multiple expected exceptions in a sequence, you need to either add a sequence of + * {@code try/catch} or use this method. Likewise if you need to make assertions about state within the expected + * exception, such as root cause or other internal state, this method will be useful. + *

+ * Examples: + *

    + *
  • + * Calling a local method which throws a {@code RuntimeException}. (An expression lambda) + *
    +     * expectedException(RuntimeException.class, () -> badMethod() );
    +     *         
    + *
  • + *
  • + * Executing a block of code. (Requires return statement) + *
    +     * expectedException(RuntimeException.class, () -> {
    +     *   for (int i = 0; i < 10; i++) {
    +     *     goodMethod();
    +     *   }
    +     *   badMethod();
    +     *   return "result";
    +     * });
    +     *         
    + *
  • + *
  • + * Examining the expected exception e.g. to assert the root cause is correct. + *
    +     * UnsupportedOperationException e = expectedException(UnsupportedOperationException.class, () -> badMethod2() );
    +     * assertEquals(RuntimeException.class, e.getCause().getClass());
    +     *         
    + *
  • + *
  • + * Note that if your lambda expression returns 'void' then you cannot use an expression + * and must explicitly return null from a lambda block. + *
    +     * expectedException(Exception.class, () -> { methodReturningVoid(); return null; } );
    +     * expectedException(Exception.class, () -> { methodReturningVoid("parameter"); return null; } );
    +     *         
    + *
  • + *
+ * + * A note on checked exceptions: currently this method does not provide any support for working around the normal + * integration of Java 8 lambdas and checked exceptions. If your {@code code} block must deal with checked exceptions, + * you must add {@code try}/{@code catch} blocks within your lambda which obviously makes this method less useful. + * This may change in the future. + * + * + * @param expected the class of the expected throwable (subtypes will also match). + * @param code a lambda containing the code block which should throw the expected throwable. + * @param the return type of the code block (which should not matter as it should not complete). + * @param the type of the expected throwable (subtypes will also match). + * @return the expected throwable object if it was thrown. + * @throws UnexpectedThrowableException if a non-matching throwable was thrown out of the code block. + * @throws MissingThrowableException if the expected throwable was not thrown out of the code block. + */ + @SuppressWarnings("unchecked") + public static T expectedException(final Class expected, final Supplier code) + { + // The code block may throw an exception or it may not. + Optional maybeThrownByCode; + + try + { + // evaluate the lambda + code.get(); + + // It didn't throw an exception. + maybeThrownByCode = Optional.empty(); + } + catch (Throwable t) + { + maybeThrownByCode = Optional.of(t); + } + + Throwable thrownByCode = maybeThrownByCode.orElseThrow(() -> new MissingThrowableException(expected)); + + if (expected.isAssignableFrom(thrownByCode.getClass())) + { + return (T)thrownByCode; + } + else + { + throw new UnexpectedThrowableException(expected, thrownByCode); + } + } + + /** + * Helper method to work around the difficulties of working with lambdas and checked exceptions. + * Use as follows: + *
+     *     expectedException(WebScriptException.class, () ->
+     *         // "Wash away" any checked exceptions in the inner code block.
+     *         smuggleCheckedExceptions( () -> methodThrowsException())
+     *     );
+     * 
+ * @param code a block of code which is declared to throw a checked exception. + * @param the return type of the block of code. + * @param the type of the checked exception. + * @return the value returned by the block of code. + * @throws SmuggledException if the code block threw an exception of type T. + */ + public static R smuggleCheckedExceptions(final ThrowingSupplier code) + { + try + { + return code.get(); + } + catch (RuntimeException e) + { + throw e; + } + catch (Exception e) + { + throw new SmuggledException(e); + } + } + + /** + * Equivalent to `java.util.function.Supplier` but its method declares that it + * throws checked exceptions. + * + * @param The result type of this supplier. + * @param The exception type declared to be thrown by this supplier. + */ + @FunctionalInterface + public interface ThrowingSupplier + { + /** Gets the value */ + R get() throws T; + } + + /** + * A wrapper for checked exceptions so that they can be handled as unchecked exceptions, namely by not requiring + * try/catch blocks etc. + *

+ * This type is expected to be most useful when handling Java 8 lambdas containing code which throws checked + * exceptions. + */ + public static class SmuggledException extends RuntimeException + { + private static final long serialVersionUID = -606404592461576013L; + private final Exception e; + + public SmuggledException(Exception e) + { + this.e = e; + } + + public Exception getCheckedException() + { + return this.e; + } + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtilsUsageExamplesUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtilsUsageExamplesUnitTest.java index 5792750b8e..f9f31bdd7e 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtilsUsageExamplesUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/ExceptionUtilsUsageExamplesUnitTest.java @@ -1,129 +1,129 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.expectedException; -import static org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.smuggleCheckedExceptions; -import static org.junit.Assert.assertEquals; - -import java.io.IOException; - -import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.MissingThrowableException; -import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.SmuggledException; -import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.UnexpectedThrowableException; -import org.junit.Test; - -/** - * Unit tests showing usage of {@link ExceptionUtils}. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class ExceptionUtilsUsageExamplesUnitTest -{ - private String goodMethod() { return "hello"; } - - private String badMethod1() { throw new RuntimeException("Bad method"); } - - private String badMethod2() { throw new UnsupportedOperationException("Bad method", new RuntimeException("root cause")); } - - @Test public void swallowExpectedExceptions() - { - // Calling a local method. (An expression lambda) - expectedException(RuntimeException.class, () -> badMethod1() ); - - // Executing a block of code. (Requires return statement) - expectedException(RuntimeException.class, () -> - { - for (int i = 0; i < 10; i++) { - goodMethod(); - } - // Also works for subtypes of expected exception. - badMethod2(); - return null; - }); - } - - @Test public void examineTheExpectedException() - { - UnsupportedOperationException e = expectedException(UnsupportedOperationException.class, () -> badMethod2() ); - assertEquals(RuntimeException.class, e.getCause().getClass()); - } - - @Test(expected=MissingThrowableException.class) - public void expectedExceptionNotThrown() - { - expectedException(IOException.class, () -> - { - // Do nothing - return null; - }); - } - - @Test(expected=UnexpectedThrowableException.class) - public void unexpectedExceptionThrown() - { - expectedException(IOException.class, () -> - { - throw new UnsupportedOperationException(); - }); - } - - private void onlySideEffectsHere() { throw new IllegalStateException(); } - - private void onlySideEffectsHere(String s) { throw new IllegalStateException(); } - - // If you use lambdas that return void, then they cannot be lambda expressions. They must be blocks. - @Test public void usingVoidLambdas() - { - expectedException(IllegalStateException.class, () -> { - onlySideEffectsHere(); - return null; - }); - - expectedException(IllegalStateException.class, () -> { - onlySideEffectsHere("hello"); - return null; - }); - } - - // If you use lambdas that throw checked exceptions, the standard Java 8 types are insufficient. - @Test public void smuggleCheckedExceptionsShouldHideCheckedExceptionsInAnUncheckedException() - { - SmuggledException e = expectedException(SmuggledException.class, () -> smuggleCheckedExceptions(() -> methodThrowsException())); - - assertEquals(Exception.class, e.getCheckedException().getClass()); - assertEquals("Checked", e.getCheckedException().getMessage()); - } - - /** This method declares that it throws `java.lang.Exception`. */ - private Object methodThrowsException() throws Exception - { - throw new Exception("Checked"); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.expectedException; +import static org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.smuggleCheckedExceptions; +import static org.junit.Assert.assertEquals; + +import java.io.IOException; + +import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.MissingThrowableException; +import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.SmuggledException; +import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.UnexpectedThrowableException; +import org.junit.Test; + +/** + * Unit tests showing usage of {@link ExceptionUtils}. + * + * @author Neil Mc Erlean + * @since 2.4.a + */ +public class ExceptionUtilsUsageExamplesUnitTest +{ + private String goodMethod() { return "hello"; } + + private String badMethod1() { throw new RuntimeException("Bad method"); } + + private String badMethod2() { throw new UnsupportedOperationException("Bad method", new RuntimeException("root cause")); } + + @Test public void swallowExpectedExceptions() + { + // Calling a local method. (An expression lambda) + expectedException(RuntimeException.class, () -> badMethod1() ); + + // Executing a block of code. (Requires return statement) + expectedException(RuntimeException.class, () -> + { + for (int i = 0; i < 10; i++) { + goodMethod(); + } + // Also works for subtypes of expected exception. + badMethod2(); + return null; + }); + } + + @Test public void examineTheExpectedException() + { + UnsupportedOperationException e = expectedException(UnsupportedOperationException.class, () -> badMethod2() ); + assertEquals(RuntimeException.class, e.getCause().getClass()); + } + + @Test(expected=MissingThrowableException.class) + public void expectedExceptionNotThrown() + { + expectedException(IOException.class, () -> + { + // Do nothing + return null; + }); + } + + @Test(expected=UnexpectedThrowableException.class) + public void unexpectedExceptionThrown() + { + expectedException(IOException.class, () -> + { + throw new UnsupportedOperationException(); + }); + } + + private void onlySideEffectsHere() { throw new IllegalStateException(); } + + private void onlySideEffectsHere(String s) { throw new IllegalStateException(); } + + // If you use lambdas that return void, then they cannot be lambda expressions. They must be blocks. + @Test public void usingVoidLambdas() + { + expectedException(IllegalStateException.class, () -> { + onlySideEffectsHere(); + return null; + }); + + expectedException(IllegalStateException.class, () -> { + onlySideEffectsHere("hello"); + return null; + }); + } + + // If you use lambdas that throw checked exceptions, the standard Java 8 types are insufficient. + @Test public void smuggleCheckedExceptionsShouldHideCheckedExceptionsInAnUncheckedException() + { + SmuggledException e = expectedException(SmuggledException.class, () -> smuggleCheckedExceptions(() -> methodThrowsException())); + + assertEquals(Exception.class, e.getCheckedException().getClass()); + assertEquals("Checked", e.getCheckedException().getMessage()); + } + + /** This method declares that it throws `java.lang.Exception`. */ + private Object methodThrowsException() throws Exception + { + throw new Exception("Checked"); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtils.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtils.java index 7d6c60f364..c8704667dc 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtils.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtils.java @@ -1,97 +1,97 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.util.Arrays.asList; -import static java.util.stream.Collectors.toList; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Stream; - -/** - * Utility class to help with Java 8 FP stuff. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class FPUtils -{ - /** - * This method is intended to work exactly like {@code java.util.Arrays.asList()} but it takes - * a vararg of {@code Supplier}s instead of actual objects. - * - * @param suppliers a vararg of {@link Supplier}s giving a sequence of values for the list. - * @param the type of elements in the list. - * @return the list with each element being the first retrieved from a {@code Supplier}. - */ - @SafeVarargs - public static List asListFrom(Supplier... suppliers) - { - if (suppliers == null || suppliers.length == 0) - { - return Collections.emptyList(); - } - else - { - return Stream.of(suppliers) - .map(s -> s.get()) - .collect(toList()); - } - } - - /** - * This method is intended to work exactly like {@link #asSet(Object[])}} but it takes - * a vararg of {@code Supplier}s instead of actual objects. - * - * @param suppliers a vararg of {@link Supplier}s giving a sequence of values for the set. - * @param the type of elements in the set. - * @return the set with each element being the first retrieved from a {@code Supplier} (duplicates removed). - */ - @SafeVarargs - public static Set asSetFrom(Supplier... suppliers) - { - List l = asListFrom(suppliers); - return new HashSet<>(l); - } - - /** - * This utility method converts a vararg of objects into a Set. - * - * @param objects the objects to be added to the set - * @return a Set of objects (any equal objects will of course not be duplicated) - */ - @SafeVarargs - public static Set asSet(T... objects) - { - return new HashSet<>(asList(objects)); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.util.Arrays.asList; +import static java.util.stream.Collectors.toList; + +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; +import java.util.stream.Stream; + +/** + * Utility class to help with Java 8 FP stuff. + * + * @author Neil Mc Erlean + * @since 2.4.a + */ +public class FPUtils +{ + /** + * This method is intended to work exactly like {@code java.util.Arrays.asList()} but it takes + * a vararg of {@code Supplier}s instead of actual objects. + * + * @param suppliers a vararg of {@link Supplier}s giving a sequence of values for the list. + * @param the type of elements in the list. + * @return the list with each element being the first retrieved from a {@code Supplier}. + */ + @SafeVarargs + public static List asListFrom(Supplier... suppliers) + { + if (suppliers == null || suppliers.length == 0) + { + return Collections.emptyList(); + } + else + { + return Stream.of(suppliers) + .map(s -> s.get()) + .collect(toList()); + } + } + + /** + * This method is intended to work exactly like {@link #asSet(Object[])}} but it takes + * a vararg of {@code Supplier}s instead of actual objects. + * + * @param suppliers a vararg of {@link Supplier}s giving a sequence of values for the set. + * @param the type of elements in the set. + * @return the set with each element being the first retrieved from a {@code Supplier} (duplicates removed). + */ + @SafeVarargs + public static Set asSetFrom(Supplier... suppliers) + { + List l = asListFrom(suppliers); + return new HashSet<>(l); + } + + /** + * This utility method converts a vararg of objects into a Set. + * + * @param objects the objects to be added to the set + * @return a Set of objects (any equal objects will of course not be duplicated) + */ + @SafeVarargs + public static Set asSet(T... objects) + { + return new HashSet<>(asList(objects)); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtilsUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtilsUnitTest.java index 24b9d5970f..23122f878e 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtilsUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/FPUtilsUnitTest.java @@ -1,87 +1,87 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 java.util.Arrays.asList; -import static java.util.Collections.emptyList; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asListFrom; -import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asSet; -import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asSetFrom; -import static org.junit.Assert.assertEquals; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.Test; - -/** - * Unit tests for {@link FPUtils}. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class FPUtilsUnitTest -{ - @Test public void asListShouldProduceList() - { - List l = asListFrom(() -> "hello", - () -> "world", - () -> { - String s1 = "abc"; - String s2 = "xyz"; - return s1 + s2; - }); - assertEquals(asList("hello", "world", "abcxyz"), l); - } - - @Test public void asListShouldWorkForEmptyVarArgs() - { - assertEquals(emptyList(), FPUtils.asListFrom()); - } - - @Test public void asSetShouldProduceSet() - { - assertEquals(new HashSet<>(asList("hello", "world")), - asSet("hello", "hello", "world")); - } - - @Test public void asSetFromShouldWork() - { - Set s = asSetFrom(() -> "hello", - () -> "hello", - () -> "world", - () -> { - String s1 = "wo"; - String s2 = "rld"; - return s1 + s2; - }); - assertEquals(new HashSet<>(asList("hello", "world")), s); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 java.util.Arrays.asList; +import static java.util.Collections.emptyList; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asListFrom; +import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asSet; +import static org.alfresco.module.org_alfresco_module_rm.test.util.FPUtils.asSetFrom; +import static org.junit.Assert.assertEquals; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.junit.Test; + +/** + * Unit tests for {@link FPUtils}. + * + * @author Neil Mc Erlean + * @since 2.4.a + */ +public class FPUtilsUnitTest +{ + @Test public void asListShouldProduceList() + { + List l = asListFrom(() -> "hello", + () -> "world", + () -> { + String s1 = "abc"; + String s2 = "xyz"; + return s1 + s2; + }); + assertEquals(asList("hello", "world", "abcxyz"), l); + } + + @Test public void asListShouldWorkForEmptyVarArgs() + { + assertEquals(emptyList(), FPUtils.asListFrom()); + } + + @Test public void asSetShouldProduceSet() + { + assertEquals(new HashSet<>(asList("hello", "world")), + asSet("hello", "hello", "world")); + } + + @Test public void asSetFromShouldWork() + { + Set s = asSetFrom(() -> "hello", + () -> "hello", + () -> "world", + () -> { + String s1 = "wo"; + String s2 = "rld"; + return s1 + s2; + }); + assertEquals(new HashSet<>(asList("hello", "world")), s); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java index 5e5308307b..39e593e5f1 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java @@ -1,104 +1,104 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.when; - -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -/** - * A helper to initialise a mock {@link AuthenticationUtil}. - * - * @author tpage - */ -public class MockAuthenticationUtilHelper -{ - /** - * Set up a Mockito mock AuthenticationUtil so that it executes all methods assuming the user has - * permissions. If the mock is asked for details about the user then it assumes the currently authenticated user is - * "admin". - * - * @param mockAuthenticationUtil The mock to initialise. - */ - public static void setup(AuthenticationUtil mockAuthenticationUtil) - { - setup(mockAuthenticationUtil, "admin"); - } - - /** - * Set up a Mockito mock AuthenticationUtil so that it executes all methods assuming the user has - * permissions. - * - * @param mockAuthenticationUtil The mock to initialise. - * @param fullyAuthenticatedUser The name of the user that last authenticated. - */ - @SuppressWarnings("unchecked") - public static void setup(AuthenticationUtil mockAuthenticationUtil, String fullyAuthenticatedUser) - { - reset(mockAuthenticationUtil); - - // just do the work - doAnswer(new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RunAsWork work = (RunAsWork) invocation.getArguments()[0]; - return work.doWork(); - } - - }).when(mockAuthenticationUtil). runAsSystem(any(RunAsWork.class)); - - // just do the work - doAnswer(new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RunAsWork work = (RunAsWork) invocation.getArguments()[0]; - return work.doWork(); - } - - }).when(mockAuthenticationUtil). runAs(any(RunAsWork.class), anyString()); - - when(mockAuthenticationUtil.getAdminUserName()).thenReturn("admin"); - when(mockAuthenticationUtil.getFullyAuthenticatedUser()).thenReturn(fullyAuthenticatedUser); - when(mockAuthenticationUtil.getRunAsUser()).thenReturn(fullyAuthenticatedUser); - when(mockAuthenticationUtil.getSystemUserName()).thenReturn("system"); - when(mockAuthenticationUtil.getGuestUserName()).thenReturn("guest"); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.when; + +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +/** + * A helper to initialise a mock {@link AuthenticationUtil}. + * + * @author tpage + */ +public class MockAuthenticationUtilHelper +{ + /** + * Set up a Mockito mock AuthenticationUtil so that it executes all methods assuming the user has + * permissions. If the mock is asked for details about the user then it assumes the currently authenticated user is + * "admin". + * + * @param mockAuthenticationUtil The mock to initialise. + */ + public static void setup(AuthenticationUtil mockAuthenticationUtil) + { + setup(mockAuthenticationUtil, "admin"); + } + + /** + * Set up a Mockito mock AuthenticationUtil so that it executes all methods assuming the user has + * permissions. + * + * @param mockAuthenticationUtil The mock to initialise. + * @param fullyAuthenticatedUser The name of the user that last authenticated. + */ + @SuppressWarnings("unchecked") + public static void setup(AuthenticationUtil mockAuthenticationUtil, String fullyAuthenticatedUser) + { + reset(mockAuthenticationUtil); + + // just do the work + doAnswer(new Answer() + { + @SuppressWarnings("rawtypes") + @Override + public Object answer(InvocationOnMock invocation) throws Throwable + { + RunAsWork work = (RunAsWork) invocation.getArguments()[0]; + return work.doWork(); + } + + }).when(mockAuthenticationUtil). runAsSystem(any(RunAsWork.class)); + + // just do the work + doAnswer(new Answer() + { + @SuppressWarnings("rawtypes") + @Override + public Object answer(InvocationOnMock invocation) throws Throwable + { + RunAsWork work = (RunAsWork) invocation.getArguments()[0]; + return work.doWork(); + } + + }).when(mockAuthenticationUtil). runAs(any(RunAsWork.class), anyString()); + + when(mockAuthenticationUtil.getAdminUserName()).thenReturn("admin"); + when(mockAuthenticationUtil.getFullyAuthenticatedUser()).thenReturn(fullyAuthenticatedUser); + when(mockAuthenticationUtil.getRunAsUser()).thenReturn(fullyAuthenticatedUser); + when(mockAuthenticationUtil.getSystemUserName()).thenReturn("system"); + when(mockAuthenticationUtil.getGuestUserName()).thenReturn("guest"); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/WebScriptExceptionMatcher.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/WebScriptExceptionMatcher.java index 0c442147a9..3591f49df8 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/WebScriptExceptionMatcher.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/WebScriptExceptionMatcher.java @@ -1,107 +1,107 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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 org.junit.internal.matchers.TypeSafeMatcher; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; - -/** - * Web script exception matcher. - *

- * Allows use to check whether the raised web script exception has the correct - * status number or not. - * - * @author Roy Wetherall - * @since 2.2 - */ -@SuppressWarnings("deprecation") -public class WebScriptExceptionMatcher extends TypeSafeMatcher -{ - /** - * Helper method to create a matcher for the file not found (404) - * exception status. - * - * @return {@link WebScriptExceptionMatcher} - */ - public static WebScriptExceptionMatcher fileNotFound() - { - return new WebScriptExceptionMatcher(Status.STATUS_NOT_FOUND); - } - - /** - * Helper method to create a matcher for the bad request status (400) - * exception status. - * - * @return {@link WebScriptExceptionMatcher} - */ - public static WebScriptExceptionMatcher badRequest() - { - return new WebScriptExceptionMatcher(Status.STATUS_BAD_REQUEST); - } - - /** expected status */ - public int expectedStatus; - - /** actual status */ - public int actualStatus; - - /** - * Constructor - * - * @param expectedStatus expected status - */ - public WebScriptExceptionMatcher(int expectedStatus) - { - this.expectedStatus = expectedStatus; - } - - /** - * Determines if the expected outcome matches the actual - * outcome. - * - * @return true if matches, false otherwise - */ - @Override - public boolean matchesSafely(WebScriptException exception) - { - actualStatus = exception.getStatus(); - return (actualStatus == expectedStatus); - } - - /** - * Describe unexpected outcome. - */ - @Override - public void describeTo(org.hamcrest.Description description) - { - description.appendValue(actualStatus) - .appendText(" was found instead of ") - .appendValue(expectedStatus); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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 org.junit.internal.matchers.TypeSafeMatcher; +import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; + +/** + * Web script exception matcher. + *

+ * Allows use to check whether the raised web script exception has the correct + * status number or not. + * + * @author Roy Wetherall + * @since 2.2 + */ +@SuppressWarnings("deprecation") +public class WebScriptExceptionMatcher extends TypeSafeMatcher +{ + /** + * Helper method to create a matcher for the file not found (404) + * exception status. + * + * @return {@link WebScriptExceptionMatcher} + */ + public static WebScriptExceptionMatcher fileNotFound() + { + return new WebScriptExceptionMatcher(Status.STATUS_NOT_FOUND); + } + + /** + * Helper method to create a matcher for the bad request status (400) + * exception status. + * + * @return {@link WebScriptExceptionMatcher} + */ + public static WebScriptExceptionMatcher badRequest() + { + return new WebScriptExceptionMatcher(Status.STATUS_BAD_REQUEST); + } + + /** expected status */ + public int expectedStatus; + + /** actual status */ + public int actualStatus; + + /** + * Constructor + * + * @param expectedStatus expected status + */ + public WebScriptExceptionMatcher(int expectedStatus) + { + this.expectedStatus = expectedStatus; + } + + /** + * Determines if the expected outcome matches the actual + * outcome. + * + * @return true if matches, false otherwise + */ + @Override + public boolean matchesSafely(WebScriptException exception) + { + actualStatus = exception.getStatus(); + return (actualStatus == expectedStatus); + } + + /** + * Describe unexpected outcome. + */ + @Override + public void describeTo(org.hamcrest.Description description) + { + description.appendValue(actualStatus) + .appendText(" was found instead of ") + .appendValue(expectedStatus); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtilsUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtilsUnitTest.java index 9ef1b9708b..135d123fc7 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtilsUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtilsUnitTest.java @@ -1,125 +1,125 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; - -import static com.google.common.collect.Sets.newHashSet; - -import static org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.expectedException; -import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.asSet; -import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.diffKey; -import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.head; -import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.tail; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.Difference; -import org.junit.Test; - -/** - * Unit tests for {@link RMCollectionUtils}. - * - * @author Neil Mc Erlean - * @since 2.4.a - */ -public class RMCollectionUtilsUnitTest -{ - @Test public void getDuplicateElements() - { - List l = asList("A", "B", "C", "B", "A"); - assertEquals("Failed to identify duplicate elements", asList("B", "A"), RMCollectionUtils.getDuplicateElements(l)); - - assertEquals(Collections.emptyList(), RMCollectionUtils.getDuplicateElements(asList("A", "B", "C"))); - } - - @Test public void compareMaps() - { - // Set up two maps to compare - final Map mapA = new HashMap<>(); - final Map mapB = new HashMap<>(); - - // Fill one map with numbers and their squares... - for (int i : asList(1, 2, 3, 4, 5)) - { - mapA.put(i, i*i); - } - - // ... the other one has the same entries... - mapB.putAll(mapA); - - // ... but with an addition, a deletion and a value change. - mapB.put(6, 36); - mapB.remove(1); - mapB.put(3, 100); - - // Now ensure that various changes are correctly identified - assertEquals(Difference.REMOVED, diffKey(mapA, mapB, 1)); - assertEquals(Difference.ADDED, diffKey(mapA, mapB, 6)); - assertEquals(Difference.UNCHANGED, diffKey(mapA, mapB, 2)); - assertEquals(Difference.UNCHANGED, diffKey(mapA, mapB, -1)); - assertEquals(Difference.CHANGED, diffKey(mapA, mapB, 3)); - } - - @Test public void tailsOfLists() - { - assertEquals(asList(2), tail(asList(1, 2))); - assertEquals(emptyList(), tail(asList(1))); - expectedException(UnsupportedOperationException.class, () -> tail(emptyList())); - } - - @Test public void headsOfLists() - { - assertEquals("a", head(asList("a", "b"))); - assertEquals("a", head(asList("a"))); - assertNull(head(emptyList())); - } - - @Test public void elementsAsSet() - { - assertEquals(newHashSet("hello", "world"), asSet("hello", "world")); - assertEquals(newHashSet(3, 7, 31, 127), asSet(3, 7, 31, 127)); - } - - @Test public void elementsAsSerializableList() - { - // If these lines compile, then we're good - Serializable s = RMCollectionUtils.>asSerializableList("one", "two", "three"); - List l = RMCollectionUtils.>asSerializableList("one", "two", "three"); - - assertEquals(s, l); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import static java.util.Arrays.asList; +import static java.util.Collections.emptyList; + +import static com.google.common.collect.Sets.newHashSet; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils.expectedException; +import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.asSet; +import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.diffKey; +import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.head; +import static org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.tail; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.util.RMCollectionUtils.Difference; +import org.junit.Test; + +/** + * Unit tests for {@link RMCollectionUtils}. + * + * @author Neil Mc Erlean + * @since 2.4.a + */ +public class RMCollectionUtilsUnitTest +{ + @Test public void getDuplicateElements() + { + List l = asList("A", "B", "C", "B", "A"); + assertEquals("Failed to identify duplicate elements", asList("B", "A"), RMCollectionUtils.getDuplicateElements(l)); + + assertEquals(Collections.emptyList(), RMCollectionUtils.getDuplicateElements(asList("A", "B", "C"))); + } + + @Test public void compareMaps() + { + // Set up two maps to compare + final Map mapA = new HashMap<>(); + final Map mapB = new HashMap<>(); + + // Fill one map with numbers and their squares... + for (int i : asList(1, 2, 3, 4, 5)) + { + mapA.put(i, i*i); + } + + // ... the other one has the same entries... + mapB.putAll(mapA); + + // ... but with an addition, a deletion and a value change. + mapB.put(6, 36); + mapB.remove(1); + mapB.put(3, 100); + + // Now ensure that various changes are correctly identified + assertEquals(Difference.REMOVED, diffKey(mapA, mapB, 1)); + assertEquals(Difference.ADDED, diffKey(mapA, mapB, 6)); + assertEquals(Difference.UNCHANGED, diffKey(mapA, mapB, 2)); + assertEquals(Difference.UNCHANGED, diffKey(mapA, mapB, -1)); + assertEquals(Difference.CHANGED, diffKey(mapA, mapB, 3)); + } + + @Test public void tailsOfLists() + { + assertEquals(asList(2), tail(asList(1, 2))); + assertEquals(emptyList(), tail(asList(1))); + expectedException(UnsupportedOperationException.class, () -> tail(emptyList())); + } + + @Test public void headsOfLists() + { + assertEquals("a", head(asList("a", "b"))); + assertEquals("a", head(asList("a"))); + assertNull(head(emptyList())); + } + + @Test public void elementsAsSet() + { + assertEquals(newHashSet("hello", "world"), asSet("hello", "world")); + assertEquals(newHashSet(3, 7, 31, 127), asSet(3, 7, 31, 127)); + } + + @Test public void elementsAsSerializableList() + { + // If these lines compile, then we're good + Serializable s = RMCollectionUtils.>asSerializableList("one", "two", "three"); + List l = RMCollectionUtils.>asSerializableList("one", "two", "three"); + + assertEquals(s, l); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheckUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheckUnitTest.java index 701be9eada..8df49113b8 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheckUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/RMParameterCheckUnitTest.java @@ -1,64 +1,64 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.util; - -import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils; -import org.junit.Test; - -/** - * Unit tests for the {@link RMParameter} utility class. - * - * @author tpage - */ -public class RMParameterCheckUnitTest -{ - @Test - public void checkNotBlank() - { - // Check that supplying null causes an exception. - ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { - RMParameterCheck.checkNotBlank("name", null); - return null; - }); - - // Check that supplying an empty string causes an exception. - ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { - RMParameterCheck.checkNotBlank("name", ""); - return null; - }); - - // Check that supplying a whitespace only string causes an exception. - ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { - RMParameterCheck.checkNotBlank("name", "\n\r \t"); - return null; - }); - - // Check that supplying a mainly whitespace string throws no exceptions. - RMParameterCheck.checkNotBlank("name", "\n\r *\t"); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.util; + +import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils; +import org.junit.Test; + +/** + * Unit tests for the {@link RMParameter} utility class. + * + * @author tpage + */ +public class RMParameterCheckUnitTest +{ + @Test + public void checkNotBlank() + { + // Check that supplying null causes an exception. + ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { + RMParameterCheck.checkNotBlank("name", null); + return null; + }); + + // Check that supplying an empty string causes an exception. + ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { + RMParameterCheck.checkNotBlank("name", ""); + return null; + }); + + // Check that supplying a whitespace only string causes an exception. + ExceptionUtils.expectedException(IllegalArgumentException.class, () -> { + RMParameterCheck.checkNotBlank("name", "\n\r \t"); + return null; + }); + + // Check that supplying a mainly whitespace string throws no exceptions. + RMParameterCheck.checkNotBlank("name", "\n\r *\t"); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspectUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspectUnitTest.java index 067d38873e..e06d0f51fd 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspectUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/ExtendedVersionableAspectUnitTest.java @@ -1,409 +1,409 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.lock.LockService; -import org.alfresco.service.cmr.lock.LockStatus; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.service.namespace.QName; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.springframework.extensions.webscripts.GUID; - -/** - * Extended versionable aspect unit test. - * - * @author Roy Wetherall - * @since 2.3.1 - */ -public class ExtendedVersionableAspectUnitTest implements RecordsManagementModel -{ - /** Transaction resource key */ - private static final String KEY_VERSIONED_NODEREFS = "versioned_noderefs"; - - /** test data */ - private NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private NodeRef anotherNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private QName oldType = QName.createQName(RM_URI, GUID.generate()); - private QName newType = QName.createQName(RM_URI, GUID.generate()); - - /** service mocks */ - private @Mock NodeService mockedNodeService; - private @Mock VersionService mockedVersionService; - private @Mock LockService mockedLockService; - private @Mock AlfrescoTransactionSupport mockedAlfrescoTransactionSupport; - private @Mock AuthenticationUtil mockedAuthenticationUtil; - - /** test instance of extended versionable aspect behaviour bean */ - private @InjectMocks ExtendedVersionableAspect extendedVersionableAspect; - - @SuppressWarnings("unchecked") - @Before - public void testSetup() - { - MockitoAnnotations.initMocks(this); - - // just do the work - doAnswer(new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RunAsWork work = (RunAsWork)invocation.getArguments()[0]; - return work.doWork(); - } - - }).when(mockedAuthenticationUtil).runAsSystem((RunAsWork) any(RunAsWork.class)); - } - - /** - * given that autoversion on type change is configured off - * when the type set behvaiour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void autoVersionOff() - { - // auto version off - extendedVersionableAspect.setAutoVersionOnTypeChange(false); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given the node doesn't exist - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeDoesNotExist() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does not exist - when(mockedNodeService.exists(nodeRef)) - .thenReturn(false); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node is locked - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeLocked() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.LOCKED); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node does not have the versionable aspect - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeIsNotVersionable() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node does not have the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(false); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).getLockStatus(nodeRef); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node has the temporary aspect - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeIsTemporary() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node has the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - - // node has the temporary aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - .thenReturn(true); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).getLockStatus(nodeRef); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node is already being versioned - * when the type set behvaiour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void nodeIsBeingVersioned() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node has the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - - // node does not have the temporary aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - .thenReturn(false); - - // node is currently being processed for versioning - when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) - .thenReturn(Collections.singletonMap(nodeRef, nodeRef)); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).getLockStatus(nodeRef); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that the node has the auto version property set to false - * when the type set behaviour is executed - * then a new version is not created - */ - @SuppressWarnings("unchecked") - @Test - public void autoVersionFalse() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node has the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - - // node does not have the temporary aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - .thenReturn(false); - - // node is not being processed for versioning - when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) - .thenReturn(Collections.singletonMap(anotherNodeRef, anotherNodeRef)); - - // auto version false - when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION)) - .thenReturn(Boolean.FALSE); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).getLockStatus(nodeRef); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); - verify(mockedAlfrescoTransactionSupport).getResource(KEY_VERSIONED_NODEREFS); - - // assert the version was not created - verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); - } - - /** - * given that autoversion on type change is configured on - * and the node exists - * and the node is not locked - * and the node has the versionable aspect - * and the node doesn't have the temporary aspect - * and the node isn't already being versioned - * and the auto version property is true - * when the type set behavour is executed - * then a new version is created - */ - @SuppressWarnings("unchecked") - @Test - public void createVersion() - { - // auto version on - extendedVersionableAspect.setAutoVersionOnTypeChange(true); - - // node does exists - when(mockedNodeService.exists(nodeRef)) - .thenReturn(true); - - // node is not locked - when(mockedLockService.getLockStatus(nodeRef)) - .thenReturn(LockStatus.NO_LOCK); - - // node has the versionable aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - - // node does not have the temporary aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) - .thenReturn(false); - - // node is not being processed for versioning - when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) - .thenReturn(new HashMap(Collections.singletonMap(anotherNodeRef, anotherNodeRef))); - - // auto version false - when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION)) - .thenReturn(Boolean.TRUE); - - // execute behaviour - extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); - - // verify other - verify(mockedNodeService).exists(nodeRef); - verify(mockedLockService).getLockStatus(nodeRef); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); - verify(mockedAlfrescoTransactionSupport, times(2)).getResource(KEY_VERSIONED_NODEREFS); - verify(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION); - - // assert the version was not created - verify(mockedVersionService).createVersion(eq(nodeRef), any(Map.class)); - } - -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.service.cmr.lock.LockService; +import org.alfresco.service.cmr.lock.LockStatus; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.version.VersionService; +import org.alfresco.service.namespace.QName; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.springframework.extensions.webscripts.GUID; + +/** + * Extended versionable aspect unit test. + * + * @author Roy Wetherall + * @since 2.3.1 + */ +public class ExtendedVersionableAspectUnitTest implements RecordsManagementModel +{ + /** Transaction resource key */ + private static final String KEY_VERSIONED_NODEREFS = "versioned_noderefs"; + + /** test data */ + private NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); + private NodeRef anotherNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); + private QName oldType = QName.createQName(RM_URI, GUID.generate()); + private QName newType = QName.createQName(RM_URI, GUID.generate()); + + /** service mocks */ + private @Mock NodeService mockedNodeService; + private @Mock VersionService mockedVersionService; + private @Mock LockService mockedLockService; + private @Mock AlfrescoTransactionSupport mockedAlfrescoTransactionSupport; + private @Mock AuthenticationUtil mockedAuthenticationUtil; + + /** test instance of extended versionable aspect behaviour bean */ + private @InjectMocks ExtendedVersionableAspect extendedVersionableAspect; + + @SuppressWarnings("unchecked") + @Before + public void testSetup() + { + MockitoAnnotations.initMocks(this); + + // just do the work + doAnswer(new Answer() + { + @SuppressWarnings("rawtypes") + @Override + public Object answer(InvocationOnMock invocation) throws Throwable + { + RunAsWork work = (RunAsWork)invocation.getArguments()[0]; + return work.doWork(); + } + + }).when(mockedAuthenticationUtil).runAsSystem((RunAsWork) any(RunAsWork.class)); + } + + /** + * given that autoversion on type change is configured off + * when the type set behvaiour is executed + * then a new version is not created + */ + @SuppressWarnings("unchecked") + @Test + public void autoVersionOff() + { + // auto version off + extendedVersionableAspect.setAutoVersionOnTypeChange(false); + + // execute behaviour + extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); + + // assert the version was not created + verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); + } + + /** + * given the node doesn't exist + * when the type set behaviour is executed + * then a new version is not created + */ + @SuppressWarnings("unchecked") + @Test + public void nodeDoesNotExist() + { + // auto version on + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // node does not exist + when(mockedNodeService.exists(nodeRef)) + .thenReturn(false); + + // execute behaviour + extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); + + // assert the version was not created + verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); + } + + /** + * given that the node is locked + * when the type set behaviour is executed + * then a new version is not created + */ + @SuppressWarnings("unchecked") + @Test + public void nodeLocked() + { + // auto version on + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // node does exists + when(mockedNodeService.exists(nodeRef)) + .thenReturn(true); + + // node is locked + when(mockedLockService.getLockStatus(nodeRef)) + .thenReturn(LockStatus.LOCKED); + + // execute behaviour + extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); + + // verify other + verify(mockedNodeService).exists(nodeRef); + + // assert the version was not created + verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); + } + + /** + * given that the node does not have the versionable aspect + * when the type set behaviour is executed + * then a new version is not created + */ + @SuppressWarnings("unchecked") + @Test + public void nodeIsNotVersionable() + { + // auto version on + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // node does exists + when(mockedNodeService.exists(nodeRef)) + .thenReturn(true); + + // node is not locked + when(mockedLockService.getLockStatus(nodeRef)) + .thenReturn(LockStatus.NO_LOCK); + + // node does not have the versionable aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) + .thenReturn(false); + + // execute behaviour + extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); + + // verify other + verify(mockedNodeService).exists(nodeRef); + verify(mockedLockService).getLockStatus(nodeRef); + + // assert the version was not created + verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); + } + + /** + * given that the node has the temporary aspect + * when the type set behaviour is executed + * then a new version is not created + */ + @SuppressWarnings("unchecked") + @Test + public void nodeIsTemporary() + { + // auto version on + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // node does exists + when(mockedNodeService.exists(nodeRef)) + .thenReturn(true); + + // node is not locked + when(mockedLockService.getLockStatus(nodeRef)) + .thenReturn(LockStatus.NO_LOCK); + + // node has the versionable aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) + .thenReturn(true); + + // node has the temporary aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) + .thenReturn(true); + + // execute behaviour + extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); + + // verify other + verify(mockedNodeService).exists(nodeRef); + verify(mockedLockService).getLockStatus(nodeRef); + verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); + + // assert the version was not created + verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); + } + + /** + * given that the node is already being versioned + * when the type set behvaiour is executed + * then a new version is not created + */ + @SuppressWarnings("unchecked") + @Test + public void nodeIsBeingVersioned() + { + // auto version on + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // node does exists + when(mockedNodeService.exists(nodeRef)) + .thenReturn(true); + + // node is not locked + when(mockedLockService.getLockStatus(nodeRef)) + .thenReturn(LockStatus.NO_LOCK); + + // node has the versionable aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) + .thenReturn(true); + + // node does not have the temporary aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) + .thenReturn(false); + + // node is currently being processed for versioning + when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) + .thenReturn(Collections.singletonMap(nodeRef, nodeRef)); + + // execute behaviour + extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); + + // verify other + verify(mockedNodeService).exists(nodeRef); + verify(mockedLockService).getLockStatus(nodeRef); + verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); + verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); + + // assert the version was not created + verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); + } + + /** + * given that the node has the auto version property set to false + * when the type set behaviour is executed + * then a new version is not created + */ + @SuppressWarnings("unchecked") + @Test + public void autoVersionFalse() + { + // auto version on + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // node does exists + when(mockedNodeService.exists(nodeRef)) + .thenReturn(true); + + // node is not locked + when(mockedLockService.getLockStatus(nodeRef)) + .thenReturn(LockStatus.NO_LOCK); + + // node has the versionable aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) + .thenReturn(true); + + // node does not have the temporary aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) + .thenReturn(false); + + // node is not being processed for versioning + when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) + .thenReturn(Collections.singletonMap(anotherNodeRef, anotherNodeRef)); + + // auto version false + when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION)) + .thenReturn(Boolean.FALSE); + + // execute behaviour + extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); + + // verify other + verify(mockedNodeService).exists(nodeRef); + verify(mockedLockService).getLockStatus(nodeRef); + verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); + verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); + verify(mockedAlfrescoTransactionSupport).getResource(KEY_VERSIONED_NODEREFS); + + // assert the version was not created + verify(mockedVersionService, never()).createVersion(eq(nodeRef), any(Map.class)); + } + + /** + * given that autoversion on type change is configured on + * and the node exists + * and the node is not locked + * and the node has the versionable aspect + * and the node doesn't have the temporary aspect + * and the node isn't already being versioned + * and the auto version property is true + * when the type set behavour is executed + * then a new version is created + */ + @SuppressWarnings("unchecked") + @Test + public void createVersion() + { + // auto version on + extendedVersionableAspect.setAutoVersionOnTypeChange(true); + + // node does exists + when(mockedNodeService.exists(nodeRef)) + .thenReturn(true); + + // node is not locked + when(mockedLockService.getLockStatus(nodeRef)) + .thenReturn(LockStatus.NO_LOCK); + + // node has the versionable aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) + .thenReturn(true); + + // node does not have the temporary aspect + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY)) + .thenReturn(false); + + // node is not being processed for versioning + when(mockedAlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS)) + .thenReturn(new HashMap(Collections.singletonMap(anotherNodeRef, anotherNodeRef))); + + // auto version false + when(mockedNodeService.getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION)) + .thenReturn(Boolean.TRUE); + + // execute behaviour + extendedVersionableAspect.onSetNodeType(nodeRef, oldType, newType); + + // verify other + verify(mockedNodeService).exists(nodeRef); + verify(mockedLockService).getLockStatus(nodeRef); + verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); + verify(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_TEMPORARY); + verify(mockedAlfrescoTransactionSupport, times(2)).getResource(KEY_VERSIONED_NODEREFS); + verify(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_AUTO_VERSION); + + // assert the version was not created + verify(mockedVersionService).createVersion(eq(nodeRef), any(Map.class)); + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java index c52e74f0ff..7b425f831e 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java @@ -1,670 +1,670 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.version.Version2Model; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.repo.version.common.VersionImpl; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionType; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Recordable version service implementation unit test. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordableVersionServiceImplUnitTest extends BaseUnitTest -{ - /** versioned content name */ - private static final String CONTENT_NAME = "test.txt"; - - /** versioned node reference */ - private NodeRef nodeRef; - private NodeRef record; - private NodeRef unfiledRecordContainer; - private NodeRef version; - - /** mocked version properties */ - private Map versionProperties; - - /** mocked services */ - private @Mock(name="dbNodeService") NodeService mockedDbNodeService; - - /** recordable version service */ - private @InjectMocks @Spy TestRecordableVersionServiceImpl recordableVersionService; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @SuppressWarnings("unchecked") - @Override - public void before() throws Exception - { - super.before(); - - nodeRef = generateCmContent(CONTENT_NAME); - doReturn(123l).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NODE_DBID); - - versionProperties = new HashMap(5); - - recordableVersionService.initialise(); - - doReturn(generateChildAssociationRef(null, generateNodeRef(Version2Model.TYPE_QNAME_VERSION_HISTORY))) - .when(mockedDbNodeService).createNode(any(NodeRef.class), - any(QName.class), - any(QName.class), - eq(Version2Model.TYPE_QNAME_VERSION_HISTORY), - anyMap()); - doReturn(generateChildAssociationRef(null, generateNodeRef(TYPE_CONTENT))) - .when(mockedDbNodeService).createNode(any(NodeRef.class), - any(QName.class), - any(QName.class), - eq(TYPE_CONTENT), - anyMap()); - - doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - doReturn(unfiledRecordContainer).when(mockedFilePlanService).getUnfiledContainer(any(NodeRef.class)); - - record = generateCmContent(CONTENT_NAME); - FileInfo mockedFileInfo = mock(FileInfo.class); - doReturn(record).when(mockedFileInfo).getNodeRef(); - doReturn(mockedFileInfo).when(mockedFileFolderService).copy(any(NodeRef.class), - any(NodeRef.class), - any(String.class)); - version = generateNodeRef(TYPE_CONTENT); - doReturn(generateChildAssociationRef(null, version)).when(mockedDbNodeService).createNode( - any(NodeRef.class), - eq(Version2Model.CHILD_QNAME_VERSIONS), - any(QName.class), - eq(TYPE_CONTENT), - anyMap()); - } - - /** - * Given that the node has no recordable version aspect - * When I create a version - * Then version service creates a normal version. - */ - @Test - public void noAspect() throws Exception - { - // setup given conditions - doReturn(false).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then a normal version is created - verifyNormalVersion(); - } - - /** - * Given that the node has a recordable version policy of null - * When I create a version - * Then the version service creates a normal version. - */ - @Test - public void policyNull() throws Exception - { - // setup given conditions - doReturn(false).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(null).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then a normal version is created - verifyNormalVersion(); - } - - /** - * Given that the node has a recordable version policy of NONE - * When I create a version - * Then the version service creates a normal version. - */ - @Test - public void policyNone() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.NONE.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then a normal version is created - verifyNormalVersion(); - } - - /** - * Given that the node has a recordable version policy of ALL - * When I create a MINOR version then - * the version service creates a recorded version - */ - @Test - public void policyAllVersionMinor() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.ALL.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - } - - /** - * Helper method that verified that a recorded version was not created. - */ - @SuppressWarnings("unchecked") - private void verifyNormalVersion() throws Exception - { - // verify no interactions - verify(mockedFilePlanService, never()).getUnfiledContainer(any(NodeRef.class)); - verify(mockedFileFolderService, never()).copy(eq(nodeRef), - eq(unfiledRecordContainer), - anyString()); - - // then the version is created - verify(mockedDbNodeService, times(1)).createNode(any(NodeRef.class), - eq(Version2Model.CHILD_QNAME_VERSIONS), - any(QName.class), - eq(TYPE_CONTENT), - anyMap()); - verify(mockedNodeService, times(1)).addAspect(eq(version), eq(Version2Model.ASPECT_VERSION), anyMap()); - verify(mockedNodeService, never()).addAspect(eq(version), eq(RecordableVersionModel.PROP_RECORD_NODE_REF), anyMap()); - } - - /** - * Given that the node has a recordable version policy of ALL - * When I create a MAJOR version then - * the version service creates a recorded version - */ - @Test - public void policyAllVersionMajor() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.ALL.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - - } - - /** - * Given that the node has a recordable version policy of MAJOR_ONLY - * When I create a MINOR version then - * the version service creates a normal version - */ - @Test - public void policyMajorOnlyVersionMinor() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then a normal version is created - verifyNormalVersion(); - } - - /** - * Given that the node has a recordable version policy of MAJOR_ONLY - * When I create a MAJOR version then - * the version service creates a recorded version - */ - @Test - public void policyMajorOnlyVersionMajor() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - } - - /** - * Given that the node has a valid recordable version policy - * And there is no file plan - * When I create a new version - * Then an exception should be thrown to indicate that there is no file plan - */ - @Test - public void noFilePlan() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // expected exception - exception.expect(AlfrescoRuntimeException.class); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - } - - /** - * Given that the node has a valid recordable version policy - * And that I set a specific file plan in the version properties - * When I create a new version - * Then the recorded version should be directed to the specified file plan, not the default file plan - */ - @Test - public void filePlanSpecifiedWithPolicy() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - - // specify the file plan - NodeRef anotherFilePlan = generateNodeRef(TYPE_FILE_PLAN); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, anotherFilePlan); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(0)).createRecordFromCopy(filePlan, nodeRef); - } - - /** - * Given that the node has specifically indicated that a recorded version should be created - * And that I set a specific file plan in the version properties - * When I create a new version - * Then the recorded version should be directed to the specified file plan, not the default file plan - */ - @Test - public void filePlanSpecifiedNoPolicy() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - - // specify the file plan - NodeRef anotherFilePlan = generateNodeRef(TYPE_FILE_PLAN); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, anotherFilePlan); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(0)).createRecordFromCopy(filePlan, nodeRef); - } - - @Test - public void adHocRecordedVersionNoPolicy() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - } - - @Test - public void adHocRecordedVersionOverridePolicy() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - } - - /** - * Given that a node is not versionable - * When I try and create a record from the latest version - * Then nothing will happen, because there is not version to record - */ - @Test - public void notVersionableCreateRecordFromVersion() - { - // content node is not versionable - doReturn(false).when(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - - // create record from version - recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); - - // nothing happens - verify(mockedRecordService, never()).createRecordFromCopy(eq(filePlan), any(NodeRef.class)); - } - - /** - * Given that a nodes last version is recorded - * When I try and create a record from the latest version - * Then nothing will happen, because the latest version is already recorded - */ - @Test - public void alreadyRecordedCreateRecordFromVersion() - { - // latest version is already recorded - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - .thenReturn(true); - when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - .thenReturn(true); - doReturn(mockedVersion) - .when(recordableVersionService).getCurrentVersion(nodeRef); - - // create record from version - recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); - - // nothing happens - verify(mockedRecordService, never()).createRecordFromCopy(eq(filePlan), any(NodeRef.class)); - } - - /** - * Given that a nodes last version is not recorded - * When I try to create a record from the latest version - * Then the latest version is marked as record and a new record version is created to store the version state - */ - @SuppressWarnings("unchecked") - @Test - public void notRecordedCreateRecordFromVersion() - { - // latest version is not recorded - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - doReturn(Collections.emptyMap()).when(mockedVersion).getVersionProperties(); - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - - // version history - NodeRef versionHistoryNodeRef = generateNodeRef(); - doReturn(versionHistoryNodeRef).when(mockedDbNodeService).getChildByName(any(NodeRef.class), eq(Version2Model.CHILD_QNAME_VERSION_HISTORIES), any(String.class)); - - // version number - doReturn(mockedVersion).when(recordableVersionService).getCurrentVersion(nodeRef); - doReturn(versionNodeRef).when(recordableVersionService).convertNodeRef(any(NodeRef.class)); - makePrimaryParentOf(versionNodeRef, versionHistoryNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "something-0"), mockedDbNodeService); - - // created version - NodeRef newVersionNodeRef = generateNodeRef(); - doReturn(generateChildAssociationRef(versionHistoryNodeRef, newVersionNodeRef)).when(mockedDbNodeService).createNode( - eq(versionHistoryNodeRef), - eq(Version2Model.CHILD_QNAME_VERSIONS), - any(QName.class), - any(QName.class), - any(Map.class)); - - // created record - NodeRef newRecordNodeRef = generateNodeRef(); - doReturn(newRecordNodeRef).when(mockedRecordService).createRecordFromContent( - eq(filePlan), - any(String.class), - any(QName.class), - any(Map.class), - any(ContentReader.class)); - - // create record from version - recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); - - // verify that the version is converted to a recorded version - verify(mockedRecordService, times(1)).createRecordFromContent( - eq(filePlan), - any(String.class), - any(QName.class), - any(Map.class), - any(ContentReader.class)); - verify(mockedDbNodeService, times(1)).deleteNode(any(NodeRef.class)); - verify(mockedDbNodeService, times(1)).createNode( - eq(versionHistoryNodeRef), - eq(Version2Model.CHILD_QNAME_VERSIONS), - any(QName.class), - any(QName.class), - any(Map.class)); - verify(mockedNodeService, times(1)).addAspect(eq(newVersionNodeRef), eq(Version2Model.ASPECT_VERSION), any(Map.class)); - verify(mockedNodeService, times(1)).addAspect( - newVersionNodeRef, - RecordableVersionModel.ASPECT_RECORDED_VERSION, - Collections.singletonMap(RecordableVersionModel.PROP_RECORD_NODE_REF, (Serializable)newRecordNodeRef)); - } - - - /** - * given the destroyed prop isn't set - * when I ask if the version is destroyed - * then the result is false - */ - @Test - public void propNotSetVersionNotDestroyed() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - - // set prop not set - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) - .thenReturn(null); - - // is version destroyed - assertFalse(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); - } - - /** - * given the destroyed prop is set - * when I ask if the version is destroyed - * then the result matches the value set in the destroy property - */ - @Test - public void propSetVersionDestroyed() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - - // set prop - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) - .thenReturn(Boolean.TRUE); - - // is version destroyed - assertTrue(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); - - // set prop - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) - .thenReturn(Boolean.FALSE); - - // is version destroyed - assertFalse(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); - } - - /** - * given that the version node doesn't have the recorded version aspect applied - * when I mark the version as destroyed - * then nothing happens - */ - @Test - public void noAspectMarkAsDestroyed() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - - // indicate that the version doesn't have the aspect - when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - .thenReturn(false); - - // mark as destroyed - recordableVersionService.destroyRecordedVersion(mockedVersion); - - // verify nothing happened - verify(mockedDbNodeService, never()) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); - } - - /** - * given that the version node ref has the recorded version aspect applied - * and the record version reference exists - * when I mark the version as destroyed - * then the version is marked as destroyed - */ - @Test - public void markAsDestroyed() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - NodeRef versionRecordNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - when(mockedDbNodeService.exists(versionRecordNodeRef)) - .thenReturn(true); - - // indicate that the version doesn't have the aspect - when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - .thenReturn(true); - - // indicate that the associated version record exists - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF)) - .thenReturn(versionRecordNodeRef); - - // mark as destroyed - recordableVersionService.destroyRecordedVersion(mockedVersion); - - // verify that the version was marked as destroyed - verify(mockedDbNodeService) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); - // and the reference to the version record was cleared - verify(mockedDbNodeService) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); - } - - /** - * given that the version node ref has the recorded version aspect applied - * and the associated version record has been deleted - * when I mark the version as destroyed - * then the version is marked as destroyed - * and the reference to the deleted version record is removed - */ - @Test - public void markAsDestroyedClearNodeRef() - { - // set up version - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - NodeRef versionRecordNodeRef = generateNodeRef(); - when(mockedVersion.getFrozenStateNodeRef()) - .thenReturn(versionNodeRef); - when(mockedDbNodeService.exists(versionRecordNodeRef)) - .thenReturn(false); - - // indicate that the version doesn't have the aspect - when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) - .thenReturn(true); - - // indicate that the associated version record exists - when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF)) - .thenReturn(versionRecordNodeRef); - - // mark as destroyed - recordableVersionService.destroyRecordedVersion(mockedVersion); - - // verify that the version was marked as destroyed - verify(mockedDbNodeService) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); - // and the reference to the version record was cleared - verify(mockedDbNodeService) - .setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.Serializable; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.repo.version.Version2Model; +import org.alfresco.repo.version.VersionModel; +import org.alfresco.repo.version.common.VersionImpl; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.cmr.version.VersionType; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; + +/** + * Recordable version service implementation unit test. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class RecordableVersionServiceImplUnitTest extends BaseUnitTest +{ + /** versioned content name */ + private static final String CONTENT_NAME = "test.txt"; + + /** versioned node reference */ + private NodeRef nodeRef; + private NodeRef record; + private NodeRef unfiledRecordContainer; + private NodeRef version; + + /** mocked version properties */ + private Map versionProperties; + + /** mocked services */ + private @Mock(name="dbNodeService") NodeService mockedDbNodeService; + + /** recordable version service */ + private @InjectMocks @Spy TestRecordableVersionServiceImpl recordableVersionService; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() + */ + @SuppressWarnings("unchecked") + @Override + public void before() throws Exception + { + super.before(); + + nodeRef = generateCmContent(CONTENT_NAME); + doReturn(123l).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NODE_DBID); + + versionProperties = new HashMap(5); + + recordableVersionService.initialise(); + + doReturn(generateChildAssociationRef(null, generateNodeRef(Version2Model.TYPE_QNAME_VERSION_HISTORY))) + .when(mockedDbNodeService).createNode(any(NodeRef.class), + any(QName.class), + any(QName.class), + eq(Version2Model.TYPE_QNAME_VERSION_HISTORY), + anyMap()); + doReturn(generateChildAssociationRef(null, generateNodeRef(TYPE_CONTENT))) + .when(mockedDbNodeService).createNode(any(NodeRef.class), + any(QName.class), + any(QName.class), + eq(TYPE_CONTENT), + anyMap()); + + doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + doReturn(unfiledRecordContainer).when(mockedFilePlanService).getUnfiledContainer(any(NodeRef.class)); + + record = generateCmContent(CONTENT_NAME); + FileInfo mockedFileInfo = mock(FileInfo.class); + doReturn(record).when(mockedFileInfo).getNodeRef(); + doReturn(mockedFileInfo).when(mockedFileFolderService).copy(any(NodeRef.class), + any(NodeRef.class), + any(String.class)); + version = generateNodeRef(TYPE_CONTENT); + doReturn(generateChildAssociationRef(null, version)).when(mockedDbNodeService).createNode( + any(NodeRef.class), + eq(Version2Model.CHILD_QNAME_VERSIONS), + any(QName.class), + eq(TYPE_CONTENT), + anyMap()); + } + + /** + * Given that the node has no recordable version aspect + * When I create a version + * Then version service creates a normal version. + */ + @Test + public void noAspect() throws Exception + { + // setup given conditions + doReturn(false).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then a normal version is created + verifyNormalVersion(); + } + + /** + * Given that the node has a recordable version policy of null + * When I create a version + * Then the version service creates a normal version. + */ + @Test + public void policyNull() throws Exception + { + // setup given conditions + doReturn(false).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(null).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then a normal version is created + verifyNormalVersion(); + } + + /** + * Given that the node has a recordable version policy of NONE + * When I create a version + * Then the version service creates a normal version. + */ + @Test + public void policyNone() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(RecordableVersionPolicy.NONE.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then a normal version is created + verifyNormalVersion(); + } + + /** + * Given that the node has a recordable version policy of ALL + * When I create a MINOR version then + * the version service creates a recorded version + */ + @Test + public void policyAllVersionMinor() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(RecordableVersionPolicy.ALL.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then the recorded version is created + verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); + } + + /** + * Helper method that verified that a recorded version was not created. + */ + @SuppressWarnings("unchecked") + private void verifyNormalVersion() throws Exception + { + // verify no interactions + verify(mockedFilePlanService, never()).getUnfiledContainer(any(NodeRef.class)); + verify(mockedFileFolderService, never()).copy(eq(nodeRef), + eq(unfiledRecordContainer), + anyString()); + + // then the version is created + verify(mockedDbNodeService, times(1)).createNode(any(NodeRef.class), + eq(Version2Model.CHILD_QNAME_VERSIONS), + any(QName.class), + eq(TYPE_CONTENT), + anyMap()); + verify(mockedNodeService, times(1)).addAspect(eq(version), eq(Version2Model.ASPECT_VERSION), anyMap()); + verify(mockedNodeService, never()).addAspect(eq(version), eq(RecordableVersionModel.PROP_RECORD_NODE_REF), anyMap()); + } + + /** + * Given that the node has a recordable version policy of ALL + * When I create a MAJOR version then + * the version service creates a recorded version + */ + @Test + public void policyAllVersionMajor() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(RecordableVersionPolicy.ALL.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then the recorded version is created + verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); + + } + + /** + * Given that the node has a recordable version policy of MAJOR_ONLY + * When I create a MINOR version then + * the version service creates a normal version + */ + @Test + public void policyMajorOnlyVersionMinor() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then a normal version is created + verifyNormalVersion(); + } + + /** + * Given that the node has a recordable version policy of MAJOR_ONLY + * When I create a MAJOR version then + * the version service creates a recorded version + */ + @Test + public void policyMajorOnlyVersionMajor() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then the recorded version is created + verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); + } + + /** + * Given that the node has a valid recordable version policy + * And there is no file plan + * When I create a new version + * Then an exception should be thrown to indicate that there is no file plan + */ + @Test + public void noFilePlan() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); + doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + + // expected exception + exception.expect(AlfrescoRuntimeException.class); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + } + + /** + * Given that the node has a valid recordable version policy + * And that I set a specific file plan in the version properties + * When I create a new version + * Then the recorded version should be directed to the specified file plan, not the default file plan + */ + @Test + public void filePlanSpecifiedWithPolicy() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); + + // specify the file plan + NodeRef anotherFilePlan = generateNodeRef(TYPE_FILE_PLAN); + versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, anotherFilePlan); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then the recorded version is created + verify(mockedRecordService, times(0)).createRecordFromCopy(filePlan, nodeRef); + } + + /** + * Given that the node has specifically indicated that a recorded version should be created + * And that I set a specific file plan in the version properties + * When I create a new version + * Then the recorded version should be directed to the specified file plan, not the default file plan + */ + @Test + public void filePlanSpecifiedNoPolicy() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); + versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); + + // specify the file plan + NodeRef anotherFilePlan = generateNodeRef(TYPE_FILE_PLAN); + versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, anotherFilePlan); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then the recorded version is created + verify(mockedRecordService, times(0)).createRecordFromCopy(filePlan, nodeRef); + } + + @Test + public void adHocRecordedVersionNoPolicy() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); + versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then the recorded version is created + verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); + } + + @Test + public void adHocRecordedVersionOverridePolicy() throws Exception + { + // setup given conditions + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); + doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); + versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); + versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); + + // when version is created + recordableVersionService.createVersion(nodeRef, versionProperties); + + // then the recorded version is created + verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); + } + + /** + * Given that a node is not versionable + * When I try and create a record from the latest version + * Then nothing will happen, because there is not version to record + */ + @Test + public void notVersionableCreateRecordFromVersion() + { + // content node is not versionable + doReturn(false).when(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); + + // create record from version + recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); + + // nothing happens + verify(mockedRecordService, never()).createRecordFromCopy(eq(filePlan), any(NodeRef.class)); + } + + /** + * Given that a nodes last version is recorded + * When I try and create a record from the latest version + * Then nothing will happen, because the latest version is already recorded + */ + @Test + public void alreadyRecordedCreateRecordFromVersion() + { + // latest version is already recorded + Version mockedVersion = mock(VersionImpl.class); + NodeRef versionNodeRef = generateNodeRef(); + when(mockedVersion.getFrozenStateNodeRef()) + .thenReturn(versionNodeRef); + + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) + .thenReturn(true); + when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) + .thenReturn(true); + doReturn(mockedVersion) + .when(recordableVersionService).getCurrentVersion(nodeRef); + + // create record from version + recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); + + // nothing happens + verify(mockedRecordService, never()).createRecordFromCopy(eq(filePlan), any(NodeRef.class)); + } + + /** + * Given that a nodes last version is not recorded + * When I try to create a record from the latest version + * Then the latest version is marked as record and a new record version is created to store the version state + */ + @SuppressWarnings("unchecked") + @Test + public void notRecordedCreateRecordFromVersion() + { + // latest version is not recorded + Version mockedVersion = mock(VersionImpl.class); + NodeRef versionNodeRef = generateNodeRef(); + doReturn(Collections.emptyMap()).when(mockedVersion).getVersionProperties(); + doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); + + // version history + NodeRef versionHistoryNodeRef = generateNodeRef(); + doReturn(versionHistoryNodeRef).when(mockedDbNodeService).getChildByName(any(NodeRef.class), eq(Version2Model.CHILD_QNAME_VERSION_HISTORIES), any(String.class)); + + // version number + doReturn(mockedVersion).when(recordableVersionService).getCurrentVersion(nodeRef); + doReturn(versionNodeRef).when(recordableVersionService).convertNodeRef(any(NodeRef.class)); + makePrimaryParentOf(versionNodeRef, versionHistoryNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "something-0"), mockedDbNodeService); + + // created version + NodeRef newVersionNodeRef = generateNodeRef(); + doReturn(generateChildAssociationRef(versionHistoryNodeRef, newVersionNodeRef)).when(mockedDbNodeService).createNode( + eq(versionHistoryNodeRef), + eq(Version2Model.CHILD_QNAME_VERSIONS), + any(QName.class), + any(QName.class), + any(Map.class)); + + // created record + NodeRef newRecordNodeRef = generateNodeRef(); + doReturn(newRecordNodeRef).when(mockedRecordService).createRecordFromContent( + eq(filePlan), + any(String.class), + any(QName.class), + any(Map.class), + any(ContentReader.class)); + + // create record from version + recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); + + // verify that the version is converted to a recorded version + verify(mockedRecordService, times(1)).createRecordFromContent( + eq(filePlan), + any(String.class), + any(QName.class), + any(Map.class), + any(ContentReader.class)); + verify(mockedDbNodeService, times(1)).deleteNode(any(NodeRef.class)); + verify(mockedDbNodeService, times(1)).createNode( + eq(versionHistoryNodeRef), + eq(Version2Model.CHILD_QNAME_VERSIONS), + any(QName.class), + any(QName.class), + any(Map.class)); + verify(mockedNodeService, times(1)).addAspect(eq(newVersionNodeRef), eq(Version2Model.ASPECT_VERSION), any(Map.class)); + verify(mockedNodeService, times(1)).addAspect( + newVersionNodeRef, + RecordableVersionModel.ASPECT_RECORDED_VERSION, + Collections.singletonMap(RecordableVersionModel.PROP_RECORD_NODE_REF, (Serializable)newRecordNodeRef)); + } + + + /** + * given the destroyed prop isn't set + * when I ask if the version is destroyed + * then the result is false + */ + @Test + public void propNotSetVersionNotDestroyed() + { + // set up version + Version mockedVersion = mock(VersionImpl.class); + NodeRef versionNodeRef = generateNodeRef(); + when(mockedVersion.getFrozenStateNodeRef()) + .thenReturn(versionNodeRef); + + // set prop not set + when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) + .thenReturn(null); + + // is version destroyed + assertFalse(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); + } + + /** + * given the destroyed prop is set + * when I ask if the version is destroyed + * then the result matches the value set in the destroy property + */ + @Test + public void propSetVersionDestroyed() + { + // set up version + Version mockedVersion = mock(VersionImpl.class); + NodeRef versionNodeRef = generateNodeRef(); + when(mockedVersion.getFrozenStateNodeRef()) + .thenReturn(versionNodeRef); + + // set prop + when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) + .thenReturn(Boolean.TRUE); + + // is version destroyed + assertTrue(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); + + // set prop + when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED)) + .thenReturn(Boolean.FALSE); + + // is version destroyed + assertFalse(recordableVersionService.isRecordedVersionDestroyed(mockedVersion)); + } + + /** + * given that the version node doesn't have the recorded version aspect applied + * when I mark the version as destroyed + * then nothing happens + */ + @Test + public void noAspectMarkAsDestroyed() + { + // set up version + Version mockedVersion = mock(VersionImpl.class); + NodeRef versionNodeRef = generateNodeRef(); + when(mockedVersion.getFrozenStateNodeRef()) + .thenReturn(versionNodeRef); + + // indicate that the version doesn't have the aspect + when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) + .thenReturn(false); + + // mark as destroyed + recordableVersionService.destroyRecordedVersion(mockedVersion); + + // verify nothing happened + verify(mockedDbNodeService, never()) + .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); + } + + /** + * given that the version node ref has the recorded version aspect applied + * and the record version reference exists + * when I mark the version as destroyed + * then the version is marked as destroyed + */ + @Test + public void markAsDestroyed() + { + // set up version + Version mockedVersion = mock(VersionImpl.class); + NodeRef versionNodeRef = generateNodeRef(); + NodeRef versionRecordNodeRef = generateNodeRef(); + when(mockedVersion.getFrozenStateNodeRef()) + .thenReturn(versionNodeRef); + when(mockedDbNodeService.exists(versionRecordNodeRef)) + .thenReturn(true); + + // indicate that the version doesn't have the aspect + when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) + .thenReturn(true); + + // indicate that the associated version record exists + when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF)) + .thenReturn(versionRecordNodeRef); + + // mark as destroyed + recordableVersionService.destroyRecordedVersion(mockedVersion); + + // verify that the version was marked as destroyed + verify(mockedDbNodeService) + .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); + // and the reference to the version record was cleared + verify(mockedDbNodeService) + .setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); + } + + /** + * given that the version node ref has the recorded version aspect applied + * and the associated version record has been deleted + * when I mark the version as destroyed + * then the version is marked as destroyed + * and the reference to the deleted version record is removed + */ + @Test + public void markAsDestroyedClearNodeRef() + { + // set up version + Version mockedVersion = mock(VersionImpl.class); + NodeRef versionNodeRef = generateNodeRef(); + NodeRef versionRecordNodeRef = generateNodeRef(); + when(mockedVersion.getFrozenStateNodeRef()) + .thenReturn(versionNodeRef); + when(mockedDbNodeService.exists(versionRecordNodeRef)) + .thenReturn(false); + + // indicate that the version doesn't have the aspect + when(mockedDbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION)) + .thenReturn(true); + + // indicate that the associated version record exists + when(mockedDbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF)) + .thenReturn(versionRecordNodeRef); + + // mark as destroyed + recordableVersionService.destroyRecordedVersion(mockedVersion); + + // verify that the version was marked as destroyed + verify(mockedDbNodeService) + .setProperty(versionNodeRef, RecordableVersionModel.PROP_DESTROYED, Boolean.TRUE); + // and the reference to the version record was cleared + verify(mockedDbNodeService) + .setProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF, null); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java index 8af1d64cb0..512c253aff 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java @@ -1,71 +1,71 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.version; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.policy.PolicyScope; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.namespace.QName; - -/** - * Helper class to help with the unit testing of RecordableVersionServiceImpl. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class TestRecordableVersionServiceImpl extends RecordableVersionServiceImpl -{ - @Override - protected void invokeBeforeCreateVersion(NodeRef nodeRef) - { - } - - @Override - protected void invokeAfterCreateVersion(NodeRef nodeRef, Version version) - { - } - - @Override - protected void invokeAfterVersionRevert(NodeRef nodeRef, Version version) - { - } - - @Override - protected void invokeOnCreateVersion(NodeRef nodeRef, Map versionProperties,PolicyScope nodeDetails) - { - } - - @Override - protected String invokeCalculateVersionLabel(QName classRef, Version preceedingVersion, int versionNumber, Map versionProperties) - { - return "1.1"; - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.version; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.repo.policy.PolicyScope; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.version.Version; +import org.alfresco.service.namespace.QName; + +/** + * Helper class to help with the unit testing of RecordableVersionServiceImpl. + * + * @author Roy Wetherall + * @since 2.3 + */ +public class TestRecordableVersionServiceImpl extends RecordableVersionServiceImpl +{ + @Override + protected void invokeBeforeCreateVersion(NodeRef nodeRef) + { + } + + @Override + protected void invokeAfterCreateVersion(NodeRef nodeRef, Version version) + { + } + + @Override + protected void invokeAfterVersionRevert(NodeRef nodeRef, Version version) + { + } + + @Override + protected void invokeOnCreateVersion(NodeRef nodeRef, Map versionProperties,PolicyScope nodeDetails) + { + } + + @Override + protected String invokeCalculateVersionLabel(QName classRef, Version preceedingVersion, int versionNumber, Map versionProperties) + { + return "1.1"; + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/action/parameter/DateParameterProcessorUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/action/parameter/DateParameterProcessorUnitTest.java index cd968fcf02..24e2a62735 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/action/parameter/DateParameterProcessorUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/action/parameter/DateParameterProcessorUnitTest.java @@ -1,132 +1,132 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.action.parameter; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.junit.Before; -import org.junit.Test; - -/** - * Tests for the DateParameterProcessor - * - * @author Mark Hibbins - * @since 2.2 - */ -public class DateParameterProcessorUnitTest -{ - private DateParameterProcessor dateParameterProcessor; - - @Before - public void setUp() throws Exception - { - this.dateParameterProcessor = new DateParameterProcessor(); - this.dateParameterProcessor.setName("date"); - } - - @Test - public void testGetSubstitutionSuggestions_01() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("date"); - assertTrue(suggestions.contains("date.day.short")); - assertTrue(suggestions.contains("date.day")); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.day.number")); - assertTrue(suggestions.contains("date.day.month")); - assertTrue(suggestions.contains("date.day.year")); - assertTrue(suggestions.contains("date.month.short")); - assertTrue(suggestions.contains("date.month")); - assertTrue(suggestions.contains("date.month.long")); - assertTrue(suggestions.contains("date.month.number")); - assertEquals(10, suggestions.size()); - } - - @Test - public void testGetSubstitutionSuggestions_02() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("dat"); - assertTrue(suggestions.contains("date.day.short")); - assertTrue(suggestions.contains("date.day")); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.day.number")); - assertTrue(suggestions.contains("date.day.month")); - assertTrue(suggestions.contains("date.day.year")); - assertTrue(suggestions.contains("date.month.short")); - assertTrue(suggestions.contains("date.month")); - assertTrue(suggestions.contains("date.month.long")); - assertTrue(suggestions.contains("date.month.number")); - assertEquals(10, suggestions.size()); - } - - @Test - public void testGetSubstitutionSuggestions_03() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("at"); - assertTrue(suggestions.contains("date.day.short")); - assertTrue(suggestions.contains("date.day")); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.day.number")); - assertTrue(suggestions.contains("date.day.month")); - assertTrue(suggestions.contains("date.day.year")); - assertTrue(suggestions.contains("date.month.short")); - assertTrue(suggestions.contains("date.month")); - assertTrue(suggestions.contains("date.month.long")); - assertTrue(suggestions.contains("date.month.number")); - assertEquals(10, suggestions.size()); - } - - @Test - public void testGetSubstitutionSuggestions_05() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("ay"); - assertTrue(suggestions.contains("date.day.short")); - assertTrue(suggestions.contains("date.day")); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.day.number")); - assertTrue(suggestions.contains("date.day.month")); - assertTrue(suggestions.contains("date.day.year")); - assertEquals(6, suggestions.size()); - } - - @Test - public void testGetSubstitutionSuggestions_06() - { - List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("on"); - assertTrue(suggestions.contains("date.day.long")); - assertTrue(suggestions.contains("date.month.short")); - assertTrue(suggestions.contains("date.month")); - assertTrue(suggestions.contains("date.month.long")); - assertTrue(suggestions.contains("date.month.number")); - assertTrue(suggestions.contains("date.year.long")); - assertTrue(suggestions.contains("date.day.month")); - assertEquals(7, suggestions.size()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.action.parameter; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for the DateParameterProcessor + * + * @author Mark Hibbins + * @since 2.2 + */ +public class DateParameterProcessorUnitTest +{ + private DateParameterProcessor dateParameterProcessor; + + @Before + public void setUp() throws Exception + { + this.dateParameterProcessor = new DateParameterProcessor(); + this.dateParameterProcessor.setName("date"); + } + + @Test + public void testGetSubstitutionSuggestions_01() + { + List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("date"); + assertTrue(suggestions.contains("date.day.short")); + assertTrue(suggestions.contains("date.day")); + assertTrue(suggestions.contains("date.day.long")); + assertTrue(suggestions.contains("date.day.number")); + assertTrue(suggestions.contains("date.day.month")); + assertTrue(suggestions.contains("date.day.year")); + assertTrue(suggestions.contains("date.month.short")); + assertTrue(suggestions.contains("date.month")); + assertTrue(suggestions.contains("date.month.long")); + assertTrue(suggestions.contains("date.month.number")); + assertEquals(10, suggestions.size()); + } + + @Test + public void testGetSubstitutionSuggestions_02() + { + List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("dat"); + assertTrue(suggestions.contains("date.day.short")); + assertTrue(suggestions.contains("date.day")); + assertTrue(suggestions.contains("date.day.long")); + assertTrue(suggestions.contains("date.day.number")); + assertTrue(suggestions.contains("date.day.month")); + assertTrue(suggestions.contains("date.day.year")); + assertTrue(suggestions.contains("date.month.short")); + assertTrue(suggestions.contains("date.month")); + assertTrue(suggestions.contains("date.month.long")); + assertTrue(suggestions.contains("date.month.number")); + assertEquals(10, suggestions.size()); + } + + @Test + public void testGetSubstitutionSuggestions_03() + { + List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("at"); + assertTrue(suggestions.contains("date.day.short")); + assertTrue(suggestions.contains("date.day")); + assertTrue(suggestions.contains("date.day.long")); + assertTrue(suggestions.contains("date.day.number")); + assertTrue(suggestions.contains("date.day.month")); + assertTrue(suggestions.contains("date.day.year")); + assertTrue(suggestions.contains("date.month.short")); + assertTrue(suggestions.contains("date.month")); + assertTrue(suggestions.contains("date.month.long")); + assertTrue(suggestions.contains("date.month.number")); + assertEquals(10, suggestions.size()); + } + + @Test + public void testGetSubstitutionSuggestions_05() + { + List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("ay"); + assertTrue(suggestions.contains("date.day.short")); + assertTrue(suggestions.contains("date.day")); + assertTrue(suggestions.contains("date.day.long")); + assertTrue(suggestions.contains("date.day.number")); + assertTrue(suggestions.contains("date.day.month")); + assertTrue(suggestions.contains("date.day.year")); + assertEquals(6, suggestions.size()); + } + + @Test + public void testGetSubstitutionSuggestions_06() + { + List suggestions = this.dateParameterProcessor.getSubstitutionSuggestions("on"); + assertTrue(suggestions.contains("date.day.long")); + assertTrue(suggestions.contains("date.month.short")); + assertTrue(suggestions.contains("date.month")); + assertTrue(suggestions.contains("date.month.long")); + assertTrue(suggestions.contains("date.month.number")); + assertTrue(suggestions.contains("date.year.long")); + assertTrue(suggestions.contains("date.day.month")); + assertEquals(7, suggestions.size()); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/imap/ExtendedImapServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/imap/ExtendedImapServiceImplUnitTest.java index 197a474720..8e1ad00798 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/imap/ExtendedImapServiceImplUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/imap/ExtendedImapServiceImplUnitTest.java @@ -4,122 +4,122 @@ * %% * Copyright (C) 2005 - 2016 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 + * 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.repo.imap; - -import static org.mockito.Mockito.when; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.QName; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.extensions.webscripts.GUID; - -/** - * Unit test for ExtendedImapServiceImpl - * @author Ana Bozianu - */ -public class ExtendedImapServiceImplUnitTest -{ - /* service mocks */ - private @Mock NodeService mockedNodeService; - private @Mock BehaviourFilter mockedPolicyBehaviourFilter; - private @Mock DictionaryService mockedDictionaryService; - private @Mock AuthenticationUtil mockedAuthenticationUtil; - - /* test instance of extended IMAP service implementation */ - private @InjectMocks ExtendedImapServiceImpl extendedImapServiceImpl; - - /* test data */ - private NodeRef rmSite = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private final String RM_SITE_NAME = "RM"; - private NodeRef rmFilePlan = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private final String RM_FILEPLAN_NAME = "fileplan"; - private NodeRef rmCategory = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); - private final String RM_CATEGORY_NAME = "C1"; - - @Before - public void setup() - { - MockitoAnnotations.initMocks(this); - // setup mocked authentication util - MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil); - - // node names - when(mockedNodeService.getProperty(rmSite, ContentModel.PROP_NAME)).thenReturn(RM_SITE_NAME); - when(mockedNodeService.getProperty(rmCategory, ContentModel.PROP_NAME)).thenReturn(RM_CATEGORY_NAME); - when(mockedNodeService.getProperty(rmFilePlan, ContentModel.PROP_NAME)).thenReturn(RM_FILEPLAN_NAME); - - // node types - when(mockedNodeService.getType(rmSite)).thenReturn(RecordsManagementModel.TYPE_RM_SITE); - when(mockedNodeService.getType(rmFilePlan)).thenReturn(RecordsManagementModel.TYPE_FILE_PLAN); - when(mockedNodeService.getType(rmCategory)).thenReturn(RecordsManagementModel.TYPE_RECORD_CATEGORY); - - // type hierarchy - when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_RM_SITE, SiteModel.TYPE_SITE)).thenReturn(true); - when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_FILE_PLAN, SiteModel.TYPE_SITE)).thenReturn(false); - when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_RECORD_CATEGORY, SiteModel.TYPE_SITE)).thenReturn(false); - - // node associations - ChildAssociationRef filePlanParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmSite, QName.createQName(GUID.generate()), rmFilePlan); - when(mockedNodeService.getPrimaryParent(rmFilePlan)).thenReturn(filePlanParentAssoc); - - ChildAssociationRef categoryParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmFilePlan, QName.createQName(GUID.generate()), rmCategory); - when(mockedNodeService.getPrimaryParent(rmCategory)).thenReturn(categoryParentAssoc); - } - - /** - * given the method is called on the rm site node - * check if the result is the site name - */ - @Test - public void testGetPathFromRMSite() - { - String rmSitePath = extendedImapServiceImpl.getPathFromSites(rmSite); - Assert.assertEquals("Incorrect return value", RM_SITE_NAME.toLowerCase(), rmSitePath); - } - - /** - * given the method is called on a rm category - * check if the result is the full path relative to the rm site - */ - @Test - public void testGetPathFromRMCategory() - { - String rmCategoryPath = extendedImapServiceImpl.getPathFromSites(rmCategory); - Assert.assertEquals("Incorrect return value", (RM_SITE_NAME + "/" + RM_FILEPLAN_NAME + "/" + RM_CATEGORY_NAME).toLowerCase(), rmCategoryPath); - } -} +package org.alfresco.repo.imap; + +import static org.mockito.Mockito.when; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper; +import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.QName; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.extensions.webscripts.GUID; + +/** + * Unit test for ExtendedImapServiceImpl + * @author Ana Bozianu + */ +public class ExtendedImapServiceImplUnitTest +{ + /* service mocks */ + private @Mock NodeService mockedNodeService; + private @Mock BehaviourFilter mockedPolicyBehaviourFilter; + private @Mock DictionaryService mockedDictionaryService; + private @Mock AuthenticationUtil mockedAuthenticationUtil; + + /* test instance of extended IMAP service implementation */ + private @InjectMocks ExtendedImapServiceImpl extendedImapServiceImpl; + + /* test data */ + private NodeRef rmSite = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); + private final String RM_SITE_NAME = "RM"; + private NodeRef rmFilePlan = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); + private final String RM_FILEPLAN_NAME = "fileplan"; + private NodeRef rmCategory = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate()); + private final String RM_CATEGORY_NAME = "C1"; + + @Before + public void setup() + { + MockitoAnnotations.initMocks(this); + // setup mocked authentication util + MockAuthenticationUtilHelper.setup(mockedAuthenticationUtil); + + // node names + when(mockedNodeService.getProperty(rmSite, ContentModel.PROP_NAME)).thenReturn(RM_SITE_NAME); + when(mockedNodeService.getProperty(rmCategory, ContentModel.PROP_NAME)).thenReturn(RM_CATEGORY_NAME); + when(mockedNodeService.getProperty(rmFilePlan, ContentModel.PROP_NAME)).thenReturn(RM_FILEPLAN_NAME); + + // node types + when(mockedNodeService.getType(rmSite)).thenReturn(RecordsManagementModel.TYPE_RM_SITE); + when(mockedNodeService.getType(rmFilePlan)).thenReturn(RecordsManagementModel.TYPE_FILE_PLAN); + when(mockedNodeService.getType(rmCategory)).thenReturn(RecordsManagementModel.TYPE_RECORD_CATEGORY); + + // type hierarchy + when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_RM_SITE, SiteModel.TYPE_SITE)).thenReturn(true); + when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_FILE_PLAN, SiteModel.TYPE_SITE)).thenReturn(false); + when(mockedDictionaryService.isSubClass(RecordsManagementModel.TYPE_RECORD_CATEGORY, SiteModel.TYPE_SITE)).thenReturn(false); + + // node associations + ChildAssociationRef filePlanParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmSite, QName.createQName(GUID.generate()), rmFilePlan); + when(mockedNodeService.getPrimaryParent(rmFilePlan)).thenReturn(filePlanParentAssoc); + + ChildAssociationRef categoryParentAssoc = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, rmFilePlan, QName.createQName(GUID.generate()), rmCategory); + when(mockedNodeService.getPrimaryParent(rmCategory)).thenReturn(categoryParentAssoc); + } + + /** + * given the method is called on the rm site node + * check if the result is the site name + */ + @Test + public void testGetPathFromRMSite() + { + String rmSitePath = extendedImapServiceImpl.getPathFromSites(rmSite); + Assert.assertEquals("Incorrect return value", RM_SITE_NAME.toLowerCase(), rmSitePath); + } + + /** + * given the method is called on a rm category + * check if the result is the full path relative to the rm site + */ + @Test + public void testGetPathFromRMCategory() + { + String rmCategoryPath = extendedImapServiceImpl.getPathFromSites(rmCategory); + Assert.assertEquals("Incorrect return value", (RM_SITE_NAME + "/" + RM_FILEPLAN_NAME + "/" + RM_CATEGORY_NAME).toLowerCase(), rmCategoryPath); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImplUnitTest.java index b27eaadf7f..48686b492f 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImplUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/repo/security/permissions/impl/ExtendedPermissionServiceImplUnitTest.java @@ -1,270 +1,270 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.repo.security.permissions.impl; - -import static java.util.Arrays.asList; -import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; -import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; -import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.util.Pair; -import org.apache.commons.lang.StringUtils; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Extended permission service implementation unit test - * - * @author Roy Wetherall - * @since 2.4.a - */ -public class ExtendedPermissionServiceImplUnitTest extends BaseUnitTest -{ - /** test data */ - private static final Long NODE_ACL_ID = 100l; - private static final Set READERS = Stream.of(generateText(), generateText()).collect(Collectors.toSet()); - private static final Set WRITERS = Stream.of(generateText(), generateText()).collect(Collectors.toSet()); - private static final String OWNER = generateText(); - - /** permission service impl, default */ - private @InjectMocks @Spy ExtendedPermissionServiceImpl extendedPermissionServiceImpl = new ExtendedPermissionServiceImpl() - { - protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; }; - }; - - /** permission service impl instance extended for reader/writer tests */ - private @InjectMocks ExtendedPermissionServiceImpl extendedPermissionServiceImplWithReaderWritersSet = new ExtendedPermissionServiceImpl() - { - protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; }; - public java.util.Set getReaders(Long aclId) { return READERS; }; - public java.util.Set getWriters(Long aclId) { return WRITERS; }; - }; - - /** mocks */ - private @Mock PermissionProcessorRegistry mockedPermissionProcessorRegistry; - private @Mock PermissionPreProcessor mockedPermissionPreProcessor; - private @Mock PermissionPostProcessor mockedPermissionPostProcessor; - - /** - * Given a permission pre-processor has been registered - * And does not DENY - * When hasPermission is called - * Then the pre-processor is executed - * And the ACL's are evaluated as normal - */ - @Test - public void preProcessorDoesNotDeny() - { - NodeRef nodeRef = generateCmContent("anyname"); - String perm = AlfMock.generateText(); - when(mockedPermissionProcessorRegistry.getPermissionPreProcessors()) - .thenReturn(asList(mockedPermissionPreProcessor)); - when(mockedPermissionPreProcessor.process(nodeRef, perm)) - .thenReturn(AccessStatus.UNDETERMINED); - - AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); - - assertEquals(AccessStatus.UNDETERMINED, result); - verify(mockedPermissionPreProcessor).process(nodeRef, perm); - verify(extendedPermissionServiceImpl).hasPermissionImpl(nodeRef, perm); - } - - /** - * Given a permission pre-processor has been registered - * And DENY's - * When hasPermission is called - * Then the pre-processor is executed - * And the remaining permission evaluations do not take place - */ - @Test - public void preProcessorDenys() - { - NodeRef nodeRef = generateCmContent("anyname"); - String perm = AlfMock.generateText(); - when(mockedPermissionProcessorRegistry.getPermissionPreProcessors()) - .thenReturn(asList(mockedPermissionPreProcessor)); - when(mockedPermissionPreProcessor.process(nodeRef, perm)) - .thenReturn(AccessStatus.DENIED); - - AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); - - assertEquals(AccessStatus.DENIED, result); - verify(mockedPermissionPreProcessor).process(nodeRef, perm); - verify(extendedPermissionServiceImpl, never()).hasPermissionImpl(nodeRef, perm); - } - - /** - * Given a permission post-processor has been registered - * When hasPermission is called - * Then the permission post-processor is called - */ - @Test - public void postProcessorRegistered() - { - NodeRef nodeRef = generateCmContent("anyname"); - String perm = AlfMock.generateText(); - when(mockedPermissionProcessorRegistry.getPermissionPostProcessors()) - .thenReturn(asList(mockedPermissionPostProcessor)); - when(mockedPermissionPostProcessor.process(AccessStatus.UNDETERMINED, nodeRef, perm)) - .thenReturn(AccessStatus.ALLOWED); - - AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); - - assertEquals(AccessStatus.ALLOWED, result); - verify(mockedPermissionPostProcessor).process(AccessStatus.UNDETERMINED, nodeRef, perm); - verify(extendedPermissionServiceImpl).hasPermissionImpl(nodeRef, perm); - } - - /** - * Given a node with no owner aspect - * When we ask for the readers and writers - * Then the owner isn't included in the result - */ - @Test - public void getReadersAndWritersForNodeWithNoOwnerAspect() - { - // setup node acl - NodeRef nodeRef = generateNodeRef(); - when(mockedNodeService.getNodeAclId(nodeRef)) - .thenReturn(NODE_ACL_ID); - - // setup owner - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - .thenReturn(false); - - // when - Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); - - // then - assertEquals(READERS, result.getFirst()); - assertEquals(WRITERS, result.getSecond()); - } - - /** - * Given a node with no owner set - * When we ask for the readers and writers - * Then the owner isn't included in the result - */ - @Test - public void getReadersAndWritersForNodeWithNoOwnerSet() - { - // setup node acl - NodeRef nodeRef = generateNodeRef(); - when(mockedNodeService.getNodeAclId(nodeRef)) - .thenReturn(NODE_ACL_ID); - - // setup owner - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - .thenReturn(true); - when(mockedOwnableService.getOwner(nodeRef)) - .thenReturn(StringUtils.EMPTY); - - // when - Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); - - // then - assertEquals(READERS, result.getFirst()); - assertEquals(WRITERS, result.getSecond()); - } - - /** - * Given a node with NO_OWNER value set - * When we ask for the readers and writers - * Then the owner isn't included in the result - */ - @Test - public void getReadersAndWritersForNodeWithNoOwnerValueSet() - { - // setup node acl - NodeRef nodeRef = generateNodeRef(); - when(mockedNodeService.getNodeAclId(nodeRef)) - .thenReturn(NODE_ACL_ID); - - // setup owner - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - .thenReturn(false); - when(mockedOwnableService.getOwner(nodeRef)) - .thenReturn(OwnableService.NO_OWNER); - - // when - Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); - - // then - assertEquals(READERS, result.getFirst()); - assertEquals(WRITERS, result.getSecond()); - } - - /** - * Given a node with an owner - * When we ask for the readers and writers - * Then the owner is included in the writers set - */ - @Test - public void getReadersAndWritersForNodeWithOwner() - { - // setup node acl - NodeRef nodeRef = generateNodeRef(); - when(mockedNodeService.getNodeAclId(nodeRef)) - .thenReturn(NODE_ACL_ID); - - // setup owner - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - .thenReturn(true); - when(mockedOwnableService.getOwner(nodeRef)) - .thenReturn(OWNER); - when(mockedAuthorityService.authorityExists(OWNER)) - .thenReturn(true); - - // when - Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); - - // then - assertEquals(READERS, result.getFirst()); - Set writersWithOwner = new HashSet(WRITERS); - writersWithOwner.add(OWNER); - assertEquals(writersWithOwner, result.getSecond()); - } -} +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.repo.security.permissions.impl; + +import static java.util.Arrays.asList; +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateText; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.repo.security.permissions.processor.PermissionPostProcessor; +import org.alfresco.repo.security.permissions.processor.PermissionPreProcessor; +import org.alfresco.repo.security.permissions.processor.PermissionProcessorRegistry; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.util.Pair; +import org.apache.commons.lang.StringUtils; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; + +/** + * Extended permission service implementation unit test + * + * @author Roy Wetherall + * @since 2.4.a + */ +public class ExtendedPermissionServiceImplUnitTest extends BaseUnitTest +{ + /** test data */ + private static final Long NODE_ACL_ID = 100l; + private static final Set READERS = Stream.of(generateText(), generateText()).collect(Collectors.toSet()); + private static final Set WRITERS = Stream.of(generateText(), generateText()).collect(Collectors.toSet()); + private static final String OWNER = generateText(); + + /** permission service impl, default */ + private @InjectMocks @Spy ExtendedPermissionServiceImpl extendedPermissionServiceImpl = new ExtendedPermissionServiceImpl() + { + protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; }; + }; + + /** permission service impl instance extended for reader/writer tests */ + private @InjectMocks ExtendedPermissionServiceImpl extendedPermissionServiceImplWithReaderWritersSet = new ExtendedPermissionServiceImpl() + { + protected AccessStatus hasPermissionImpl(NodeRef nodeRef, String perm) { return AccessStatus.UNDETERMINED; }; + public java.util.Set getReaders(Long aclId) { return READERS; }; + public java.util.Set getWriters(Long aclId) { return WRITERS; }; + }; + + /** mocks */ + private @Mock PermissionProcessorRegistry mockedPermissionProcessorRegistry; + private @Mock PermissionPreProcessor mockedPermissionPreProcessor; + private @Mock PermissionPostProcessor mockedPermissionPostProcessor; + + /** + * Given a permission pre-processor has been registered + * And does not DENY + * When hasPermission is called + * Then the pre-processor is executed + * And the ACL's are evaluated as normal + */ + @Test + public void preProcessorDoesNotDeny() + { + NodeRef nodeRef = generateCmContent("anyname"); + String perm = AlfMock.generateText(); + when(mockedPermissionProcessorRegistry.getPermissionPreProcessors()) + .thenReturn(asList(mockedPermissionPreProcessor)); + when(mockedPermissionPreProcessor.process(nodeRef, perm)) + .thenReturn(AccessStatus.UNDETERMINED); + + AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); + + assertEquals(AccessStatus.UNDETERMINED, result); + verify(mockedPermissionPreProcessor).process(nodeRef, perm); + verify(extendedPermissionServiceImpl).hasPermissionImpl(nodeRef, perm); + } + + /** + * Given a permission pre-processor has been registered + * And DENY's + * When hasPermission is called + * Then the pre-processor is executed + * And the remaining permission evaluations do not take place + */ + @Test + public void preProcessorDenys() + { + NodeRef nodeRef = generateCmContent("anyname"); + String perm = AlfMock.generateText(); + when(mockedPermissionProcessorRegistry.getPermissionPreProcessors()) + .thenReturn(asList(mockedPermissionPreProcessor)); + when(mockedPermissionPreProcessor.process(nodeRef, perm)) + .thenReturn(AccessStatus.DENIED); + + AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); + + assertEquals(AccessStatus.DENIED, result); + verify(mockedPermissionPreProcessor).process(nodeRef, perm); + verify(extendedPermissionServiceImpl, never()).hasPermissionImpl(nodeRef, perm); + } + + /** + * Given a permission post-processor has been registered + * When hasPermission is called + * Then the permission post-processor is called + */ + @Test + public void postProcessorRegistered() + { + NodeRef nodeRef = generateCmContent("anyname"); + String perm = AlfMock.generateText(); + when(mockedPermissionProcessorRegistry.getPermissionPostProcessors()) + .thenReturn(asList(mockedPermissionPostProcessor)); + when(mockedPermissionPostProcessor.process(AccessStatus.UNDETERMINED, nodeRef, perm)) + .thenReturn(AccessStatus.ALLOWED); + + AccessStatus result = extendedPermissionServiceImpl.hasPermission(nodeRef, perm); + + assertEquals(AccessStatus.ALLOWED, result); + verify(mockedPermissionPostProcessor).process(AccessStatus.UNDETERMINED, nodeRef, perm); + verify(extendedPermissionServiceImpl).hasPermissionImpl(nodeRef, perm); + } + + /** + * Given a node with no owner aspect + * When we ask for the readers and writers + * Then the owner isn't included in the result + */ + @Test + public void getReadersAndWritersForNodeWithNoOwnerAspect() + { + // setup node acl + NodeRef nodeRef = generateNodeRef(); + when(mockedNodeService.getNodeAclId(nodeRef)) + .thenReturn(NODE_ACL_ID); + + // setup owner + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) + .thenReturn(false); + + // when + Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); + + // then + assertEquals(READERS, result.getFirst()); + assertEquals(WRITERS, result.getSecond()); + } + + /** + * Given a node with no owner set + * When we ask for the readers and writers + * Then the owner isn't included in the result + */ + @Test + public void getReadersAndWritersForNodeWithNoOwnerSet() + { + // setup node acl + NodeRef nodeRef = generateNodeRef(); + when(mockedNodeService.getNodeAclId(nodeRef)) + .thenReturn(NODE_ACL_ID); + + // setup owner + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) + .thenReturn(true); + when(mockedOwnableService.getOwner(nodeRef)) + .thenReturn(StringUtils.EMPTY); + + // when + Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); + + // then + assertEquals(READERS, result.getFirst()); + assertEquals(WRITERS, result.getSecond()); + } + + /** + * Given a node with NO_OWNER value set + * When we ask for the readers and writers + * Then the owner isn't included in the result + */ + @Test + public void getReadersAndWritersForNodeWithNoOwnerValueSet() + { + // setup node acl + NodeRef nodeRef = generateNodeRef(); + when(mockedNodeService.getNodeAclId(nodeRef)) + .thenReturn(NODE_ACL_ID); + + // setup owner + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) + .thenReturn(false); + when(mockedOwnableService.getOwner(nodeRef)) + .thenReturn(OwnableService.NO_OWNER); + + // when + Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); + + // then + assertEquals(READERS, result.getFirst()); + assertEquals(WRITERS, result.getSecond()); + } + + /** + * Given a node with an owner + * When we ask for the readers and writers + * Then the owner is included in the writers set + */ + @Test + public void getReadersAndWritersForNodeWithOwner() + { + // setup node acl + NodeRef nodeRef = generateNodeRef(); + when(mockedNodeService.getNodeAclId(nodeRef)) + .thenReturn(NODE_ACL_ID); + + // setup owner + when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) + .thenReturn(true); + when(mockedOwnableService.getOwner(nodeRef)) + .thenReturn(OWNER); + when(mockedAuthorityService.authorityExists(OWNER)) + .thenReturn(true); + + // when + Pair, Set> result = extendedPermissionServiceImplWithReaderWritersSet.getReadersAndWriters(nodeRef); + + // then + assertEquals(READERS, result.getFirst()); + Set writersWithOwner = new HashSet(WRITERS); + writersWithOwner.add(OWNER); + assertEquals(writersWithOwner, result.getSecond()); + } +}